1/******/ (function() { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3
4/***/ "./cartridges/app_storefront_base/cartridge/client/default/js/components/focus.js": 5/*!****************************************************************************************!*\ 6 !*** ./cartridges/app_storefront_base/cartridge/client/default/js/components/focus.js ***! 7 \****************************************************************************************/ 8/***/ (function(module) { 9 10"use strict"; 11 12 13module.exports = { 14 setTabNextFocus: function setTabNextFocus(focusParams) { 15 var KEYCODE_TAB = 9; 16 var isTabPressed = focusParams.event.key === 'Tab' || focusParams.event.keyCode === KEYCODE_TAB; 17 if (!isTabPressed) { 18 return; 19 } 20 var firstFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.firstElementSelector); 21 var lastFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.lastElementSelector); 22 if ($(focusParams.containerSelector + ' ' + focusParams.lastElementSelector).is(':disabled')) { 23 lastFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.nextToLastElementSelector); 24 if ($('.product-quickview.product-set').length > 0) { 25 var linkElements = $(focusParams.containerSelector + ' a#fa-link.share-icons'); 26 lastFocusableEl = linkElements[linkElements.length - 1]; 27 } 28 } 29 if (focusParams.event.shiftKey) /* shift + tab */{ 30 if ($(':focus').is(firstFocusableEl)) {
31 lastFocusableEl.focus(); 32 focusParams.event.preventDefault(); 33 } 34 } else /* tab */{ 35 if ($(':focus').is(lastFocusableEl)) { 36 // eslint-disable-line 37 firstFocusableEl.focus(); 38 focusParams.event.preventDefault(); 39 } 40 } 41 } 42}; 43 44/***/ }), 45
46/***/ "./cartridges/app_storefront_base/cartridge/client/default/js/product/base.js": 47/*!************************************************************************************!*\ 48 !*** ./cartridges/app_storefront_base/cartridge/client/default/js/product/base.js ***! 49 \************************************************************************************/ 50/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 51 52"use strict"; 53 54 55var focusHelper = __webpack_require__(/*! ../components/focus */ "./cartridges/app_storefront_base/cartridge/client/default/js/components/focus.js"); 56var location = window.location; 57 58/** 59 * Retrieves the relevant pid value 60 * @param {jquery} $el - DOM container for a given add to cart button 61 * @return {string} - value to be used when adding product to cart 62 */ 63function getPidValue($el) { 64 var pid; 65 if ($('#quickViewModal').hasClass('show') && !$('.product-set').length) { 66 pid = $($el).closest('.modal-content').find('.product-quickview').data('pid'); 67 } else if ($('.product-set-detail').length || $('.product-set').length) { 68 pid = $($el).closest('.product-detail').find('.product-id').text(); 69 } else { 70 pid = $('.product-detail:not(".bundle-item")').data('pid'); 71 } 72 return pid; 73} 74 75/** 76 * Retrieve contextual quantity selector 77 * @param {jquery} $el - DOM container for the relevant quantity 78 * @return {jquery} - quantity selector DOM container 79 */ 80function getQuantitySelector($el) { 81 var quantitySelected; 82 if ($el && $('.set-items').length) { 83 quantitySelected = $($el).closest('.product-detail').find('.quantity-select'); 84 } else if ($el && $('.product-bundle').length) { 85 var quantitySelectedModal = $($el).closest('.modal-footer').find('.quantity-select'); 86 var quantitySelectedPDP = $($el).closest('.bundle-footer').find('.quantity-select'); 87 if (quantitySelectedModal.val() === undefined) { 88 quantitySelected = quantitySelectedPDP; 89 } else { 90 quantitySelected = quantitySelectedModal; 91 } 92 } else { 93 quantitySelected = $('.quantity-select'); 94 } 95 return quantitySelected; 96} 97 98/** 99 * Retrieves the value associated with the Quantity pull-down menu 100 * @param {jquery} $el - DOM container for the relevant quantity 101 * @return {string} - value found in the quantity input 102 */ 103function getQuantitySelected($el) { 104 return getQuantitySelector($el).val(); 105} 106 107/** 108 * Process the attribute values for an attribute that has image swatches 109 * 110 * @param {Object} attr - Attribute 111 * @param {string} attr.id - Attribute ID 112 * @param {Object[]} attr.values - Array of attribute value objects 113 * @param {string} attr.values.value - Attribute coded value 114 * @param {string} attr.values.url - URL to de/select an attribute value of the product 115 * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be 116 * selected. If there is no variant that corresponds to a specific combination of attribute 117 * values, an attribute may be disabled in the Product Detail Page 118 * @param {jQuery} $productContainer - DOM container for a given product 119 * @param {Object} msgs - object containing resource messages 120 */ 121function processSwatchValues(attr, $productContainer, msgs) { 122 attr.values.forEach(function (attrValue) { 123 var $attrValue = $productContainer.find('[data-attr="' + attr.id + '"] [data-attr-value="' + attrValue.value + '"]'); 124 var $swatchButton = $attrValue.parent(); 125 if (attrValue.selected) { 126 $attrValue.addClass('selected'); 127 $attrValue.siblings('.selected-assistive-text').text(msgs.assistiveSelectedText); 128 } else { 129 $attrValue.removeClass('selected'); 130 $attrValue.siblings('.selected-assistive-text').empty(); 131 } 132 if (attrValue.url) { 133 $swatchButton.attr('data-url', attrValue.url); 134 } else { 135 $swatchButton.removeAttr('data-url'); 136 } 137 138 // Disable if not selectable 139 $attrValue.removeClass('selectable unselectable'); 140 $attrValue.addClass(attrValue.selectable ? 'selectable' : 'unselectable'); 141 }); 142} 143 144/** 145 * Process attribute values associated with an attribute that does not have image swatches 146 * 147 * @param {Object} attr - Attribute 148 * @param {string} attr.id - Attribute ID 149 * @param {Object[]} attr.values - Array of attribute value objects 150 * @param {string} attr.values.value - Attribute coded value 151 * @param {string}
151 attr.values.url - URL to de/select an attribute value of the product 152 * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be 153 * selected. If there is no variant that corresponds to a specific combination of attribute 154 * values, an attribute may be disabled in the Product Detail Page 155 * @param {jQuery} $productContainer - DOM container for a given product 156 */ 157function processNonSwatchValues(attr, $productContainer) { 158 var $attr = '[data-attr="' + attr.id + '"]'; 159 var $defaultOption = $productContainer.find($attr + ' .select-' + attr.id + ' option:first'); 160 $defaultOption.attr('value', attr.resetUrl); 161 attr.values.forEach(function (attrValue) { 162 var $attrValue = $productContainer.find($attr + ' [data-attr-value="' + attrValue.value + '"]'); 163 $attrValue.attr('value', attrValue.url).removeAttr('disabled'); 164 if (!attrValue.selectable) { 165 $attrValue.attr('disabled', true); 166 } 167 }); 168} 169 170/** 171 * Routes the handling of attribute processing depending on whether the attribute has image 172 * swatches or not 173 * 174 * @param {Object} attrs - Attribute 175 * @param {string} attr.id - Attribute ID 176 * @param {jQuery} $productContainer - DOM element for a given product 177 * @param {Object} msgs - object containing resource messages 178 */ 179function updateAttrs(attrs, $productContainer, msgs) { 180 // Currently, the only attribute type that has image swatches is Color. 181 var attrsWithSwatches = ['color']; 182 attrs.forEach(function (attr) { 183 if (attrsWithSwatches.indexOf(attr.id) > -1) { 184 processSwatchValues(attr, $productContainer, msgs); 185 } else { 186 processNonSwatchValues(attr, $productContainer); 187 } 188 }); 189} 190 191/** 192 * Updates the availability status in the Product Detail Page 193 * 194 * @param {Object} response - Ajax response object after an 195 * attribute value has been [de]selected 196 * @param {jQuery} $productContainer - DOM element for a given product 197 */ 198function updateAvailability(response, $productContainer) { 199 var availabilityValue = ''; 200 var availabilityMessages = response.product.availability.messages; 201 if (!response.product.readyToOrder) { 202 availabilityValue = '<li><div>' + response.resources.info_selectforstock + '</div></li>'; 203 } else { 204 availabilityMessages.forEach(function (message) { 205 availabilityValue += '<li><div>' + message + '</div></li>'; 206 }); 207 } 208 $($productContainer).trigger('product:updateAvailability', { 209 product: response.product, 210 $productContainer: $productContainer, 211 message: availabilityValue, 212 resources: response.resources 213 }); 214} 215 216/** 217 * Generates html for product attributes section 218 * 219 * @param {array} attributes - list of attributes 220 * @return {string} - Compiled HTML 221 */ 222function getAttributesHtml(attributes) { 223 if (!attributes) { 224 return ''; 225 } 226 var html = ''; 227 attributes.forEach(function (attributeGroup) { 228 if (attributeGroup.ID === 'mainAttributes') { 229 attributeGroup.attributes.forEach(function (attribute) { 230 html += '<div class="attribute-values">' + attribute.label + ': ' + attribute.value + '</div>'; 231 }); 232 } 233 }); 234 return html; 235} 236 237/** 238 * @typedef UpdatedOptionValue 239 * @type Object 240 * @property {string} id - Option value ID for look up 241 * @property {string} url - Updated option value selection URL 242 */ 243 244/** 245 * @typedef OptionSelectionResponse 246 * @type Object 247 * @property {string} priceHtml - Updated price HTML code 248 * @property {Object} options - Updated Options 249 * @property {string} options.id - Option ID 250 * @property {UpdatedOptionValue[]} options.values - Option values 251 */ 252 253/** 254 * Updates DOM using post-option selection Ajax response 255 * 256 * @param {OptionSelectionResponse} optionsHtml - Ajax response optionsHtml from selecting a product option 257 * @param {jQuery} $productContainer - DOM element for current product 258 */ 259function updateOptions(optionsHtml, $productContainer) { 260 // Update options 261 $productContainer.find('.product-options').empty().html(optionsHtml); 262} 263 264/** 265 * Dynamically creates Bootstrap carousel from response containing images 266 * @param {Object[]} imgs - Array of large product images,along with related information 267 * @param {jQuery}
267 $productContainer - DOM element for a given product 268 */ 269function createCarousel(imgs, $productContainer) { 270 var carousel = $productContainer.find('.carousel'); 271 $(carousel).carousel('dispose'); 272 var carouselId = $(carousel).attr('id'); 273 $(carousel).empty().append('<ol class="carousel-indicators"></ol><div class="carousel-inner" role="listbox"></div><a class="carousel-control-prev" href="#' + carouselId + '" role="button" data-slide="prev"><span class="fa icon-prev" aria-hidden="true"></span><span class="sr-only">' + $(carousel).data('prev') + '</span></a><a class="carousel-control-next" href="#' + carouselId + '" role="button" data-slide="next"><span class="fa icon-next" aria-hidden="true"></span><span class="sr-only">' + $(carousel).data('next') + '</span></a>'); 274 for (var i = 0; i < imgs.length; i++) { 275 $('<div class="carousel-item"><img src="' + imgs[i].url + '" class="d-block img-fluid" alt="' + imgs[i].alt + ' image number ' + parseInt(imgs[i].index, 10) + '" title="' + imgs[i].title + '" itemprop="image" /></div>').appendTo($(carousel).find('.carousel-inner')); 276 $('<li data-target="#' + carouselId + '" data-slide-to="' + i + '" class=""></li>').appendTo($(carousel).find('.carousel-indicators')); 277 } 278 $($(carousel).find('.carousel-item')).first().addClass('active'); 279 $($(carousel).find('.carousel-indicators > li')).first().addClass('active'); 280 if (imgs.length === 1) { 281 $($(carousel).find('.carousel-indicators, a[class^="carousel-control-"]')).detach(); 282 } 283 $(carousel).carousel(); 284 $($(carousel).find('.carousel-indicators')).attr('aria-hidden', true); 285} 286 287/** 288 * Parses JSON from Ajax call made whenever an attribute value is [de]selected 289 * @param {Object} response - response from Ajax call 290 * @param {Object} response.product - Product object 291 * @param {string} response.product.id - Product ID 292 * @param {Object[]} response.product.variationAttributes - Product attributes 293 * @param {Object[]} response.product.images - Product images 294 * @param {boolean} response.product.hasRequiredAttrsSelected - Flag as to whether all required 295 * attributes have been selected. Used partially to 296 * determine whether the Add to Cart button can be enabled 297 * @param {jQuery} $productContainer - DOM element for a given product. 298 */ 299function handleVariantResponse(response, $productContainer) { 300 var isChoiceOfBonusProducts = $productContainer.parents('.choose-bonus-product-dialog').length > 0; 301 var isVaraint; 302 if (response.product.variationAttributes) { 303 updateAttrs(response.product.variationAttributes, $productContainer, response.resources); 304 isVaraint = response.product.productType === 'variant'; 305 if (isChoiceOfBonusProducts && isVaraint) { 306 $productContainer.parent('.bonus-product-item').data('pid', response.product.id); 307 $productContainer.parent('.bonus-product-item').data('ready-to-order', response.product.readyToOrder); 308 } 309 } 310 311 // Update primary images 312 var primaryImageUrls = response.product.images.large; 313 createCarousel(primaryImageUrls, $productContainer); 314 315 // Update pricing 316 if (!isChoiceOfBonusProducts) { 317 var $priceSelector = $('.prices .price', $productContainer).length ? $('.prices .price', $productContainer) : $('.prices .price'); 318 $priceSelector.replaceWith(response.product.price.html); 319 } 320 321 // Update promotions 322 $productContainer.find('.promotions').empty().html(response.product.promotionsHtml); 323 updateAvailability(response, $productContainer); 324 if (isChoiceOfBonusProducts) { 325 var $selectButton = $productContainer.find('.select-bonus-product'); 326 $selectButton.trigger('bonusproduct:updateSelectButton', { 327 product: response.product, 328 $productContainer: $productContainer 329 }); 330 } else { 331 // Enable "Add to Cart" button if all required attributes have been selected 332 $('button.add-to-cart, button.add-to-cart-global, button.update-cart-product-global').trigger('product:updateAddToCart', { 333 product: response.product, 334 $productContainer: $productContainer 335 }).trigger('product:statusUpdate', response.product); 336 } 337 338 // Update attributes
339 $productContainer.find('.main-attributes').empty().html(getAttributesHtml(response.product.attributes)); 340} 341 342/** 343 * @typespec UpdatedQuantity 344 * @type Object 345 * @property {boolean} selected - Whether the quantity has been selected 346 * @property {string} value - The number of products to purchase 347 * @property {string} url - Compiled URL that specifies variation attributes, product ID, options, 348 * etc. 349 */ 350 351/** 352 * Updates the quantity DOM elements post Ajax call 353 * @param {UpdatedQuantity[]} quantities - 354 * @param {jQuery} $productContainer - DOM container for a given product 355 */ 356function updateQuantities(quantities, $productContainer) { 357 if ($productContainer.parent('.bonus-product-item').length <= 0) { 358 var optionsHtml = quantities.map(function (quantity) { 359 var selected = quantity.selected ? ' selected ' : ''; 360 return '<option value="' + quantity.value + '" data-url="' + quantity.url + '"' + selected + '>' + quantity.value + '</option>'; 361 }).join(''); 362 getQuantitySelector($productContainer).empty().html(optionsHtml); 363 } 364} 365 366/** 367 * updates the product view when a product attribute is selected or deselected or when 368 * changing quantity 369 * @param {string} selectedValueUrl - the Url for the selected variation value 370 * @param {jQuery} $productContainer - DOM element for current product 371 */ 372function attributeSelect(selectedValueUrl, $productContainer) { 373 if (selectedValueUrl) { 374 $('body').trigger('product:beforeAttributeSelect', { 375 url: selectedValueUrl, 376 container: $productContainer 377 }); 378 $.ajax({ 379 url: selectedValueUrl, 380 method: 'GET', 381 success: function success(data) { 382 handleVariantResponse(data, $productContainer); 383 updateOptions(data.product.optionsHtml, $productContainer); 384 updateQuantities(data.product.quantities, $productContainer); 385 $('body').trigger('product:afterAttributeSelect', { 386 data: data, 387 container: $productContainer 388 }); 389 $.spinner().stop(); 390 }, 391 error: function error() { 392 $.spinner().stop(); 393 } 394 }); 395 } 396} 397 398/** 399 * Retrieves url to use when adding a product to the cart 400 * 401 * @return {string} - The provided URL to use when adding a product to the cart 402 */ 403function getAddToCartUrl() { 404 return $('.add-to-cart-url').val(); 405} 406 407/** 408 * Parses the html for a modal window 409 * @param {string} html - representing the body and footer of the modal window 410 * 411 * @return {Object} - Object with properties body and footer. 412 */ 413function parseHtml(html) { 414 var $html = $('<div>').append($.parseHTML(html)); 415 var body = $html.find('.choice-of-bonus-product'); 416 var footer = $html.find('.modal-footer').children(); 417 return { 418 body: body, 419 footer: footer 420 }; 421} 422 423/** 424 * Retrieves url to use when adding a product to the cart 425 * 426 * @param {Object} data - data object used to fill in dynamic portions of the html 427 */ 428function chooseBonusProducts(data) { 429 $('.modal-body').spinner().start(); 430 if ($('#chooseBonusProductModal').length !== 0) { 431 $('#chooseBonusProductModal').remove(); 432 } 433 var bonusUrl; 434 if (data.bonusChoiceRuleBased) { 435 bonusUrl = data.showProductsUrlRuleBased; 436 } else { 437 bonusUrl = data.showProductsUrlListBased; 438 } 439 var htmlString = '<!-- Modal -->' + '<div class="modal fade" id="chooseBonusProductModal" tabindex="-1" role="dialog">' + '<span class="enter-message sr-only" ></span>' + '<div class="modal-dialog choose-bonus-product-dialog" ' + 'data-total-qty="' + data.maxBonusItems + '"' + 'data-UUID="' + data.uuid + '"' + 'data-pliUUID="' + data.pliUUID + '"' + 'data-addToCartUrl="' + data.addToCartUrl + '"' + 'data-pageStart="0"' + 'data-pageSize="' + data.pageSize + '"' + 'data-moreURL="' + data.showProductsUrlRuleBased + '"' + 'data-bonusChoiceRuleBased="' + data.bonusChoiceRuleBased + '">' + '<!-- Modal content-->' + '<div class="modal-content">' + '<div class="modal-header">' + ' <span class="">' + data.labels.selectprods + '</span>' + ' <button type="button" class="close pull-right" data-dismiss="modal">' + ' <span aria-hidden="true">×</span>
439' + ' <span class="sr-only"> </span>' + ' </button>' + '</div>' + '<div class="modal-body"></div>' + '<div class="modal-footer"></div>' + '</div>' + '</div>' + '</div>'; 440 $('body').append(htmlString); 441 $('.modal-body').spinner().start(); 442 $.ajax({ 443 url: bonusUrl, 444 method: 'GET', 445 dataType: 'json', 446 success: function success(response) { 447 var parsedHtml = parseHtml(response.renderedTemplate); 448 $('#chooseBonusProductModal .modal-body').empty(); 449 $('#chooseBonusProductModal .enter-message').text(response.enterDialogMessage); 450 $('#chooseBonusProductModal .modal-header .close .sr-only').text(response.closeButtonText); 451 $('#chooseBonusProductModal .modal-body').html(parsedHtml.body); 452 $('#chooseBonusProductModal .modal-footer').html(parsedHtml.footer); 453 $('#chooseBonusProductModal').modal('show'); 454 $.spinner().stop(); 455 }, 456 error: function error() { 457 $.spinner().stop(); 458 } 459 }); 460} 461 462/** 463 * Updates the Mini-Cart quantity value after the customer has pressed the "Add to Cart" button 464 * @param {string} response - ajax response from clicking the add to cart button 465 */ 466function handlePostCartAdd(response) { 467 $('.minicart').trigger('count:update', response); 468 var messageType = response.error ? 'alert-danger' : 'alert-success'; 469 // show add to cart toast 470 if (response.newBonusDiscountLineItem && Object.keys(response.newBonusDiscountLineItem).length !== 0) {
471 chooseBonusProducts(response.newBonusDiscountLineItem); 472 } else { 473 if ($('.add-to-cart-messages').length === 0) { 474 $('body').append('<div class="add-to-cart-messages"></div>'); 475 } 476 $('.add-to-cart-messages').append('<div class="alert ' + messageType + ' add-to-basket-alert text-center" role="alert">' + response.message + '</div>'); 477 setTimeout(function () { 478 $('.add-to-basket-alert').remove(); 479 }, 5000); 480 } 481} 482 483/** 484 * Retrieves the bundle product item ID's for the Controller to replace bundle master product 485 * items with their selected variants 486 * 487 * @return {string[]} - List of selected bundle product item ID's 488 */ 489function getChildProducts() { 490 var childProducts = []; 491 $('.bundle-item').each(function () { 492 childProducts.push({ 493 pid: $(this).find('.product-id').text(), 494 quantity: parseInt($(this).find('label.quantity').data('quantity'), 10) 495 }); 496 }); 497 return childProducts.length ? JSON.stringify(childProducts) : []; 498} 499 500/** 501 * Retrieve product options 502 * 503 * @param {jQuery} $productContainer - DOM element for current product 504 * @return {string} - Product options and their selected values 505 */ 506function getOptions($productContainer) { 507 var options = $productContainer.find('.product-option').map(function () { 508 var $elOption = $(this).find('.options-select'); 509 var urlValue = $elOption.val(); 510 var selectedValueId = $elOption.find('option[value="' + urlValue + '"]').data('value-id'); 511 return { 512 optionId: $(this).data('option-id'), 513 selectedValueId: selectedValueId 514 }; 515 }).toArray(); 516 return JSON.stringify(options); 517} 518 519/** 520 * Makes a call to the server to report the event of adding an item to the cart 521 * 522 * @param {string | boolean} url - a string representing the end point to hit so that the event can be recorded, or false 523 */ 524function miniCartReportingUrl(url) { 525 if (url) { 526 $.ajax({ 527 url: url, 528 method: 'GET', 529 success: function success() { 530 // reporting urls hit on the server 531 }, 532 error: function error() { 533 // no reporting urls hit on the server 534 } 535 }); 536 } 537} 538module.exports = { 539 attributeSelect: attributeSelect, 540 methods: { 541 editBonusProducts: function editBonusProducts(data) { 542 chooseBonusProducts(data); 543 } 544 }, 545 focusChooseBonusProductModal: function focusChooseBonusProductModal() { 546 $('body').on('shown.bs.modal', '#chooseBonusProductModal', function () { 547 $('#chooseBonusProductModal').siblings().attr('aria-hidden', 'true'); 548 $('#chooseBonusProductModal .close').focus(); 549 }); 550 }, 551 onClosingChooseBonusProductModal: function onClosingChooseBonusProductModal() { 552 $('body').on('hidden.bs.modal', '#chooseBonusProductModal', function () { 553 $('#chooseBonusProductModal').siblings().attr('aria-hidden', 'false'); 554 }); 555 }, 556 trapChooseBonusProductModalFocus: function trapChooseBonusProductModalFocus() { 557 $('body').on('keydown', '#chooseBonusProductModal', function (e) { 558 var focusParams = { 559 event: e, 560 containerSelector: '#chooseBonusProductModal', 561 firstElementSelector: '.close', 562 lastElementSelector: '.add-bonus-products' 563 }; 564 focusHelper.setTabNextFocus(focusParams); 565 }); 566 }, 567 colorAttribute: function colorAttribute() { 568 $(document).on('click', '[data-attr="color"] button', function (e) { 569 e.preventDefault(); 570 if ($(this).attr('disabled')) { 571 return; 572 } 573 var $productContainer = $(this).closest('.set-item');
574 if (!$productContainer.length) { 575 $productContainer = $(this).closest('.product-detail'); 576 } 577 attributeSelect($(this).attr('data-url'), $productContainer); 578 }); 579 }, 580 selectAttribute: function selectAttribute() { 581 $(document).on('change', 'select[class*="select-"], .options-select', function (e) { 582 e.preventDefault(); 583 var $productContainer = $(this).closest('.set-item'); 584 if (!$productContainer.length) { 585 $productContainer = $(this).closest('.product-detail'); 586 } 587 attributeSelect(e.currentTarget.value, $productContainer); 588 }); 589 }, 590 availability: function availability() { 591 $(document).on('change', '.quantity-select', function (e) { 592 e.preventDefault(); 593 var $productContainer = $(this).closest('.product-detail'); 594 if (!$productContainer.length) { 595 $productContainer = $(this).closest('.modal-content').find('.product-quickview'); 596 } 597 if ($('.bundle-items', $productContainer).length === 0) { 598 attributeSelect($(e.currentTarget).find('option:selected').data('url'), $productContainer); 599 } 600 }); 601 }, 602 addToCart: function addToCart() { 603 $(document).on('click', 'button.add-to-cart, button.add-to-cart-global', function () { 604 var addToCartUrl; 605 var pid; 606 var pidsObj; 607 var setPids; 608 $('body').trigger('product:beforeAddToCart', this); 609 if ($('.set-items').length && $(this).hasClass('add-to-cart-global')) { 610 setPids = []; 611 $('.product-detail').each(function () { 612 if (!$(this).hasClass('product-set-detail')) { 613 setPids.push({ 614 pid: $(this).find('.product-id').text(), 615 qty: $(this).find('.quantity-select').val(), 616 options: getOptions($(this)) 617 }); 618 } 619 }); 620 pidsObj = JSON.stringify(setPids); 621 } 622 pid = getPidValue($(this)); 623 var $productContainer = $(this).closest('.product-detail');
624 if (!$productContainer.length) { 625 $productContainer = $(this).closest('.quick-view-dialog').find('.product-detail'); 626 } 627 addToCartUrl = getAddToCartUrl(); 628 var form = { 629 pid: pid, 630 pidsObj: pidsObj, 631 childProducts: getChildProducts(), 632 quantity: getQuantitySelected($(this)) 633 }; 634 if (!$('.bundle-item').length) { 635 form.options = getOptions($productContainer); 636 } 637 $(this).trigger('updateAddToCartFormData', form); 638 if (addToCartUrl) { 639 $.ajax({ 640 url: addToCartUrl, 641 method: 'POST', 642 data: form, 643 success: function success(data) { 644 handlePostCartAdd(data); 645 $('body').trigger('product:afterAddToCart', data); 646 $.spinner().stop(); 647 miniCartReportingUrl(data.reportingURL); 648 }, 649 error: function error() { 650 $.spinner().stop(); 651 } 652 }); 653 } 654 }); 655 }, 656 selectBonusProduct: function selectBonusProduct() { 657 $(document).on('click', '.select-bonus-product', function () { 658 var $choiceOfBonusProduct = $(this).parents('.choice-of-bonus-product'); 659 var pid = $(this).data('pid'); 660 var maxPids = $('.choose-bonus-product-dialog').data('total-qty'); 661 var submittedQty = parseInt($choiceOfBonusProduct.find('.bonus-quantity-select').val(), 10); 662 var totalQty = 0; 663 $.each($('#chooseBonusProductModal .selected-bonus-products .selected-pid'), function () { 664 totalQty += $(this).data('qty'); 665 }); 666 totalQty += submittedQty; 667 var optionID = $choiceOfBonusProduct.find('.product-option').data('option-id'); 668 var valueId = $choiceOfBonusProduct.find('.options-select option:selected').data('valueId'); 669 if (totalQty <= maxPids) { 670 var selectedBonusProductHtml = '' + '<div class="selected-pid row" ' + 'data-pid="' + pid + '"' + 'data-qty="' + submittedQty + '"' + 'data-optionID="' + (optionID || '') + '"' + 'data-option-selected-value="' + (valueId || '') + '"' + '>' + '<div class="col-sm-11 col-9 bonus-product-name" >' + $choiceOfBonusProduct.find('.product-name').html() + '</div>' + '<div class="col-1"><i class="fa fa-times" aria-hidden="true"></i></div>' + '</div>'; 671 $('#chooseBonusProductModal .selected-bonus-products').append(selectedBonusProductHtml); 672 $('.pre-cart-products').html(totalQty); 673 $('.selected-bonus-products .bonus-summary').removeClass('alert-danger'); 674 } else { 675 $('.selected-bonus-products .bonus-summary').addClass('alert-danger'); 676 } 677 }); 678 }, 679 removeBonusProduct: function removeBonusProduct() { 680 $(document).on('click', '.selected-pid', function () { 681 $(this).remove(); 682 var $selected = $('#chooseBonusProductModal .selected-bonus-products .selected-pid'); 683 var count = 0; 684 if ($selected.length) { 685 $selected.each(function () { 686 count += parseInt($(this).data('qty'), 10); 687 }); 688 } 689 $('.pre-cart-products').html(count); 690 $('.selected-bonus-products .bonus-summary').removeClass('alert-danger'); 691 }); 692 }, 693 enableBonusProductSelection: function enableBonusProductSelection() { 694 $('body').on('bonusproduct:updateSelectButton', function (e, response) { 695 $('button.select-bonus-product', response.$productContainer).attr('disabled', !response.product.readyToOrder || !response.product.available); 696 var pid = response.product.id; 697 $('button.select-bonus-product', response.$productContainer).data('pid', pid); 698 }); 699 }, 700 showMoreBonusProducts: function showMoreBonusProducts() { 701 $(document).on('click', '.show-more-bonus-products', function () { 702 var url = $(this).data('url'); 703 $('.modal-content').spinner().start(); 704 $.ajax({ 705 url: url, 706 method: 'GET', 707 success: function success(html) { 708 var parsedHtml = parseHtml(html); 709 $('.modal-body').append(parsedHtml.body); 710 $('.show-more-bonus-products:first').remove(); 711 $('.modal-content').spinner().stop(); 712 }, 713 error: function error() { 714 $('.modal-content').spinner().stop(); 715 } 716 }); 717 }); 718 }, 719 addBonusProductsToCart: function addBonusProductsToCart() { 720 $(document).on('click', '.add-bonus-products', function () { 721 var $readyToOrderBonusProducts = $('.choose-bonus-product-dialog .selected-pid'); 722 var queryString = '?pids='; 723 var url = $('.choose-bonus-product-dialog').data('addtocarturl'); 724 var pidsObject = { 725 bonusProducts: [] 726 }; 727 $.each($readyToOrderBonusProducts, function () { 728 var qtyOption = parseInt($(this).data('qty'), 10); 729 var option = null; 730 if (qtyOption > 0) { 731 if ($(this).data('optionid') && $(this).data('option-selected-value')) { 732 option = {}; 733 option.optionId = $(this).data('optionid'); 734 option.productId = $(this).data('pid'); 735 option.selectedValueId = $(this).data('option-selected-value'); 736 } 737 pidsObject.bonusProducts.push({ 738 pid: $(this).data('pid'), 739 qty: qtyOption, 740 options: [option] 741 }); 742 pidsObject.totalQty = parseInt($('.pre-cart-products').html(), 10); 743 } 744 }); 745 queryString += JSON.stringify(pidsObject); 746 queryString = queryString + '&uuid=' + $('.choose-bonus-product-dialog').data('uuid'); 747 queryString = queryString + '&pliuuid=' + $('.choose-bonus-product-dialog').data('pliuuid'); 748 $.spinner().start(); 749 $.ajax({ 750 url: url + queryString, 751 method: 'POST', 752 success: function success(data) { 753 $.spinner().stop(); 754 if (data.error) { 755 $('#chooseBonusProductModal').modal('hide'); 756 if ($('.add-to-cart-messages').length === 0) { 757 $('body').append('<div class="add-to-cart-messages"></div>'); 758 } 759 $('.add-to-cart-messages').append('<div class="alert alert-danger add-to-basket-alert text-center"' + ' role="alert">
759' + data.errorMessage + '</div>'); 760 setTimeout(function () { 761 $('.add-to-basket-alert').remove(); 762 }, 3000); 763 } else { 764 $('.configure-bonus-product-attributes').html(data); 765 $('.bonus-products-step2').removeClass('hidden-xl-down'); 766 $('#chooseBonusProductModal').modal('hide'); 767 if ($('.add-to-cart-messages').length === 0) { 768 $('body').append('<div class="add-to-cart-messages"></div>'); 769 } 770 $('.minicart-quantity').html(data.totalQty); 771 $('.add-to-cart-messages').append('<div class="alert alert-success add-to-basket-alert text-center"' + ' role="alert">' + data.msgSuccess + '</div>'); 772 setTimeout(function () { 773 $('.add-to-basket-alert').remove(); 774 if ($('.cart-page').length) { 775 location.reload(); 776 } 777 }, 1500); 778 } 779 }, 780 error: function error() { 781 $.spinner().stop(); 782 } 783 }); 784 }); 785 }, 786 getPidValue: getPidValue, 787 getQuantitySelected: getQuantitySelected, 788 miniCartReportingUrl: miniCartReportingUrl 789}; 790 791/***/ }), 792
793/***/ "./cartridges/app_storefront_base/cartridge/client/default/js/product/detail.js": 794/*!**************************************************************************************!*\ 795 !*** ./cartridges/app_storefront_base/cartridge/client/default/js/product/detail.js ***! 796 \**************************************************************************************/ 797/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 798 799"use strict"; 800 801 802var base = __webpack_require__(/*! ./base */ "./cartridges/app_storefront_base/cartridge/client/default/js/product/base.js"); 803 804/** 805 * Enable/disable UI elements 806 * @param {boolean} enableOrDisable - true or false 807 */ 808function updateAddToCartEnableDisableOtherElements(enableOrDisable) { 809 $('button.add-to-cart-global').attr('disabled', enableOrDisable); 810} 811module.exports = { 812 methods: { 813 updateAddToCartEnableDisableOtherElements: updateAddToCartEnableDisableOtherElements 814 }, 815 availability: base.availability, 816 addToCart: base.addToCart, 817 updateAttributesAndDetails: function updateAttributesAndDetails() { 818 $('body').on('product:statusUpdate', function (e, data) { 819 var $productContainer = $('.product-detail[data-pid="' + data.id + '"]'); 820 $productContainer.find('.description-and-detail .product-attributes').empty().html(data.attributesHtml); 821 if (data.shortDescription) { 822 $productContainer.find('.description-and-detail .description').removeClass('hidden-xl-down'); 823 $productContainer.find('.description-and-detail .description .content').empty().html(data.shortDescription); 824 } else { 825 $productContainer.find('.description-and-detail .description').addClass('hidden-xl-down'); 826 } 827 if (data.longDescription) { 828 $productContainer.find('.description-and-detail .details').removeClass('hidden-xl-down'); 829 $productContainer.find('.description-and-detail .details .content').empty().html(data.longDescription); 830 } else { 831 $productContainer.find('.description-and-detail .details').addClass('hidden-xl-down'); 832 } 833 }); 834 }, 835 showSpinner: function showSpinner() { 836 $('body').on('product:beforeAddToCart', function () { 837 $.spinner().start(); 838 }); 839 }, 840 updateAttribute: function updateAttribute() { 841 $('body').on('product:afterAttributeSelect', function (e, response) { 842 if ($('.product-detail>.bundle-items').length) { 843 response.container.data('pid', response.data.product.id); 844 response.container.find('.product-id').text(response.data.product.id); 845 } else if ($('.product-set-detail').eq(0)) { 846 response.container.data('pid', response.data.product.id); 847 response.container.find('.product-id').text(response.data.product.id); 848 } else { 849 $('.product-id').text(response.data.product.id); 850 $('.product-detail:not(".bundle-item")').data('pid', response.data.product.id); 851 } 852 }); 853 }, 854 updateAddToCart: function updateAddToCart() { 855 $('body').on('product:updateAddToCart', function (e, response) { 856 // update local add to cart (for sets) 857 $('button.add-to-cart', response.$productContainer).attr('disabled', !response.product.readyToOrder || !response.product.available); 858 var enable = $('.product-availability').toArray().every(function (item) { 859 return $(item).data('available') && $(item).data('ready-to-order'); 860 }); 861 module.exports.methods.updateAddToCartEnableDisableOtherElements(!enable); 862 }); 863 }, 864 updateAvailability: function updateAvailability() { 865 $('body').on('product:updateAvailability', function (e, response) { 866 $('div.availability', response.$productContainer).data('ready-to-order', response.product.readyToOrder).data('available', response.product.available); 867 $('.availability-msg', response.$productContainer).empty().html(response.message); 868 if ($('.global-availability').length) { 869 var allAvailable = $('.product-availability').toArray().every(function (item) { 870 return $(item).data('available'); 871 }); 872 var allReady = $('.product-availability').toArray().every(function (item) { 873 return $(item).data('ready-to-order'); 874 }); 875 $('.global-availability').data('ready-to-order', allReady).data('available', allAvailable); 876 $('.global-availability .availability-msg').empty().html(allReady ? response.message : response.resources.info_selectforstock); 877 } 878 }); 879 }, 880 sizeChart: function sizeChart() { 881 $('.size-chart a').on('click', function (e) { 882 e.preventDefault(); 883 var url = $(this).attr('href'); 884 var $prodSizeChart = $(this).closest('.size-chart').find('.size-chart-collapsible'); 885 if ($prodSizeChart.is(':empty')) { 886 $.ajax({ 887 url: url, 888 type: 'get', 889 dataType: 'json', 890 success: function success(data) { 891 $prodSizeChart.append(data.content); 892 } 893 }); 894 } 895 $prodSizeChart.toggleClass('active'); 896 }); 897 var $sizeChart = $('.size-chart-collapsible'); 898 $('body').on('click touchstart', function (e) { 899 if ($('.size-chart').has(e.target).length <= 0) { 900 $sizeChart.removeClass('active'); 901 } 902 }); 903 }, 904 copyProductLink: function copyProductLink() { 905 $('body').on('click', '#fa-link', function (event) { 906 event.preventDefault(); 907 var $temp = $('<input>'); 908 $('body').append($temp); 909 $temp.val($('#shareUrl').val()).select(); 910 document.execCommand('copy'); 911 $temp.remove(); 912 $('.copy-link-message').attr('role', 'alert'); 913 $('.copy-link-message').removeClass('d-none'); 914 setTimeout(function () { 915 $('.copy-link-message').addClass('d-none'); 916 }, 3000); 917 }); 918 }, 919 focusChooseBonusProductModal: base.focusChooseBonusProductModal() 920}; 921 922/***/ }), 923
924/***/ "./cartridges/app_storefront_base/cartridge/client/default/js/util.js": 925/*!****************************************************************************!*\ 926 !*** ./cartridges/app_storefront_base/cartridge/client/default/js/util.js ***! 927 \****************************************************************************/ 928/***/ (function(module) { 929 930"use strict"; 931 932 933function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 934module.exports = function (include) { 935 if (typeof include === 'function') { 936 include(); 937 } else if (_typeof(include) === 'object') { 938 Object.keys(include).forEach(function (key) { 939 if (typeof include[key] === 'function') { 940 include[key](); 941 } 942 }); 943 } 944}; 945 946/***/ }), 947
948/***/ "./cartridges/int_googletags/cartridge/client/default/js/tagManager.js": 949/*!*****************************************************************************!*\ 950 !*** ./cartridges/int_googletags/cartridge/client/default/js/tagManager.js ***! 951 \*****************************************************************************/ 952/***/ (function(module) { 953 954"use strict"; 955 956 957var dataLayer = window.dataLayer; 958var dataLayerUrls = window.dataLayerUrls; 959var dataLayerHelper = window.dataLayerHelper; 960var CHECKOUT_STEPS = { 961 SHIPPING: 'shipping', 962 PAYMENT: 'payment' 963}; 964 965/** 966 * @function 967 * @description appends the parameter with the given name and value to the given url and returns the changed url 968 * @param {string} url the url to which the parameter will be added 969 * @param {string} name the name of the parameter 970 * @param {string} value the value of the parameter 971 * @returns {string} - URL with parameter 972 */ 973function appendParamToURL(url, name, value) { 974 // quit if the param already exists 975 if (url.indexOf(name + '=') !== -1) { 976 return url; 977 } 978 var separator = url.indexOf('?') !== -1 ? '&' : '?'; 979 return url + separator + name + '=' + encodeURIComponent(value); 980} 981/** 982 * addToCart 983 * @description Click event for add product to cart 984 * @param {Object} productObject product object 985 * @param {string} quantity product quantity added 986 */ 987function addToCart(productObject, quantity) { 988 var quantityObj = { 989 quantity: quantity 990 }; 991 var obj = { 992 event: 'add_to_cart', 993 ecommerce: { 994 currency: dataLayerHelper.currencyCode, 995 detail: { 996 products: [] 997 } 998 } 999 }; 1000 obj.ecommerce.detail.products.push($.extend(productObject, quantityObj)); 1001 dataLayer.push(obj); 1002} 1003/** 1004 * removeFromCart 1005 * @param {Object} productObject product object 1006 * @param {string|number} quantity product quantity removed 1007 */ 1008function removeFromCart(productObject, quantity) { 1009 var quantityObj = { 1010 quantity: quantity 1011 }; 1012 var obj = { 1013 event: 'remove_from_cart', 1014 ecommerce: { 1015 currency: dataLayerHelper.currencyCode, 1016 detail: { 1017 products: [] 1018 } 1019 } 1020 }; 1021 obj.ecommerce.detail.products.push($.extend(productObject, quantityObj)); 1022 dataLayer.push(obj); 1023} 1024 1025/** connectConsultant 1026 * @param {Object} data consultant object 1027 * @param {string|null} formType - method is optional, CONSULTANT_METHOD.PHONE_NUMBER by default 1028 * @param {string|null} $form - IBC form 1029 * @description gets the data for connect consultant event 1030 */ 1031function connectConsultant(data, formType, $form) { 1032 var searchMethod; 1033 var distance; 1034 var searchTerm = data && data.stores && data.stores.searchKey ? data.stores.searchKey : ''; 1035 if (formType === 'ibcsearch-name') { 1036 searchMethod = 'name'; 1037 var lastNameField = $form.find('input.js-lastName').val(); 1038 searchTerm += ' ' + lastNameField; 1039 distance = undefined; 1040 } else if (formType === 'ibcsearch-phone') { 1041 searchMethod = 'phone number'; 1042 distance = undefined; 1043 } else { 1044 searchMethod = 'zip code'; 1045 distance = data && data.stores && data.stores.radius ? data.stores.radius : undefined; 1046 } 1047 var obj = { 1048 event: 'consultantLocatorSearch', 1049 numResults: data && data.stores && data.stores.stores && data.stores.stores.length ? data.stores.stores.length : 0, 1050 searchMethod: searchMethod, 1051 searchTerm: searchTerm, 1052 distance: distance 1053 }; 1054 dataLayer.push(obj); 1055} 1056 1057/** consultantLocatorLoadMore 1058 * @param {searchMethod} searchMethod searchMethod 1059 * @description gets search Method 1060 */ 1061function consultantLocatorLoadMore(searchMethod) { 1062 dataLayer.push({ 1063 event: 'consultantLocatorLoadMore', 1064 searchMethod: searchMethod 1065 }); 1066} 1067 1068/** getActiveFormType 1069* @returns {string|null} "name", "phone", "postalcode" or null 1070 */ 1071function getActiveFormType() { 1072 if ($('form.ibcsearch-name').is(':visible')) return 'name'; 1073 if ($('form.ibcsearch-phone').is(':visible')) return 'phone number'; 1074 if ($('form.ibcsearch-postalcode').is(':visible')) return 'zip code'; 1075 return null; 1076} 1077 1078/** getSubsidiaryCode 1079* @returns {string|null} "SubsidiaryCode" 1080 */ 1081function getSubsidiaryCode() { 1082 var subsidiaryCode = $('input[name="subsidiaryCode"]').val(); 1083 return subsidiaryCode; 1084} 1085 1086/** viewProfileSelect 1087 * @param {data} data data 1088 * @param {slotNumber} slotNumber slotNumber 1089 * @description gets search Method 1090 */ 1091function viewProfileSelect(data, slotNumber) { 1092 dataLayer.push({ 1093 event: 'viewProfileSelect', 1094 searchMethod: getActiveFormType(), 1095 referringibcId: data && data.profile && data.profile.consultantNumber ? data.profile.consultantNumber + getSubsidiaryCode() : '', 1096 location: getActiveFormType() ? 'Search' : 'Profile', 1097 searchSlot: slotNumber || null, 1098 activeShop: data && data.profile && data.profile.active ? 'Yes' : 'no' 1099 }); 1100} 1101 1102/** viewProfileSelectHeader 1103 * @param {consultantNumber} consultantNumber consultantNumber 1104 * @param {active} active active 1105 */ 1106function viewProfileSelectHeader(consultantNumber, active) { 1107 dataLayer.push({ 1108 event: 'viewProfileSelect', 1109 searchMethod: null, 1110 referringibcId: consultantNumber ? consultantNumber + getSubsidiaryCode() : '', 1111 location: 'Profile', 1112 searchSlot: null, 1113 activeShop: active ? 'Yes' : 'no' 1114 }); 1115} 1116 1117/** joinTeamSelect 1118 * @param {active} active active 1119 * @param {consultantNumber} consultantNumber consultantNumber 1120 * @param {slotNumber} slotNumber slotNumber 1121 * @description gets search Method 1122 */ 1123function joinTeamSelect(active, consultantNumber, slotNumber) { 1124 var isProfileTrayOpen = $('.tray-modal.search-ibc-profile-tray').is(':visible'); 1125 var isProfilePage = $('.ibc-profile-page.pb-4').length > 0; 1126 dataLayer.push({ 1127 event: 'joinTeamSelect', 1128 searchMethod: getActiveFormType(), 1129 referringibcId: consultantNumber ? consultantNumber + getSubsidiaryCode() : '', 1130 location: isProfileTrayOpen || isProfilePage ? 'Profile' : 'Search', 1131 searchSlot: slotNumber || null, 1132 activeShop: active ? 'Yes' : 'no' 1133 }); 1134} 1135/** searchResults 1136 * @param {searchType} searchType searchType 1137 * @description gets search Method 1138 */ 1139function searchResultsNavigation(searchType) { 1140 dataLayer.push({ 1141 event: 'searchResultsNavigation', 1142 searchType: searchType 1143 }); 1144} 1145/** searchResultsLoadMore 1146 * @param {productSelected} productSelected productSelected 1147 * @description gets search Method 1148 */ 1149function searchResultsLoadMore(productSelected) { 1150 dataLayer.push({ 1151 event: 'searchResultsLoadMore', 1152 searchMethod: productSelected === 'true' ? 'Product' : 'Content' 1153 }); 1154} 1155/** searchResultClick 1156 * @param {Object} data data for the clicked result 1157 * @param {string} data.term search term the user entered 1158 * @param {string} data.searchType result set the click came from (Product | Content) 1159 * @param {string} data.resultName name of the clicked result 1160 * @param {number} data.resultPosition 1-indexed position of the clicked result in the visible list 1161 * @description fires when a user clicks a search result (Product or Content) 1162 */ 1163function searchResultClick(data) { 1164 dataLayer.push({ 1165 event: 'searchResultClick', 1166 term: data.term, 1167 searchType: data.searchType, 1168 result_name: data.resultName, 1169 result_position: data.resultPosition 1170 }); 1171} 1172/** searchSuggestionClick 1173 * @param {Object} data data for the clicked suggestion 1174 * @param {string} data.term partial term the user typed before clicking 1175 * @param {string} data.suggestionText text of the clicked suggestion 1176 * @param {number} data.suggestionPosition 1-indexed position of the suggestion in the dropdown list 1177 * @param {string} data.suggestionType type of the suggestion (product | content | category) 1178 * @description fires when a user clicks an autocomplete suggestion 1179 */ 1180function searchSuggestionClick(data) { 1181 dataLayer.push({ 1182 event: 'searchSuggestionClick', 1183 term: data.term, 1184 suggestion_text: data.suggestionText, 1185 suggestion_position: data.suggestionPosition, 1186 suggestion_type: data.suggestionType 1187 }); 1188} 1189/** applyPromoCode 1190* @param {promoCode} promoCode promoCode 1191* @param {status} status of the code 1192*/ 1193function applyPromoCode(promoCode, status) { 1194 dataLayer.push({ 1195 event: 'apply_promo_code', 1196 coupon: promoCode, 1197 status: status 1198 }); 1199} 1200 1201/** removePromoCode 1202* @param {promoCode} promoCode promoCode 1203* @param {status} status of the code 1204*/ 1205function removePromoCode(promoCode, status) { 1206 dataLayer.push({ 1207 event: 'remove_promo_code', 1208 coupon: promoCode, 1209 status: status 1210 }); 1211} 1212 1213/** openCart 1214 * @param {response} response productData 1215 * @description gets the data for for add to cart 1216 */ 1217function openCart() { 1218 dataLayer.push({ 1219 'event': 'e_openCart' 1220 }); 1221} 1222 1223/** eShare 1224 * @param {response} response productData 1225 * @description gets the data for for add to cart 1226 */ 1227function eAddToFav(response) { 1228 dataLayer.push({ 1229 'event': 'e_addToFav', 1230 'favoritedProduct': response ? response.productData : '' 1231 }); 1232} 1233 1234/** openMinicart 1235*/ 1236function openMinicart() { 1237 dataLayer.push({ 1238 event: 'e_openMinicart' 1239 }); 1240} 1241/** closeMinicart 1242*/ 1243function closeMinicart() { 1244 dataLayer.push({ 1245 event: 'e_closeMinicart' 1246 }); 1247} 1248/** accountRegister 1249*/ 1250function accountRegister() { 1251 dataLayer.push({ 1252 event: 'accountRegister' 1253 }); 1254} 1255 1256/** diconnect Ibc 1257* @param {string} ibcId diconnect Ibc id 1258*/ 1259function diconnectIbc(ibcId) { 1260 dataLayer.push({ 1261 event: 'consultantLocatorDisconnect', 1262 referringibcId: ibcId + getSubsidiaryCode() || '' 1263 }); 1264} 1265 1266/** contact Ibc 1267* @param {string} ibcId diconnect Ibc id 1268* @param {string} contactType contact method 1269* @param {boolean} active store active 1270*/ 1271function contactIbc(ibcId, contactType, active) { 1272 dataLayer.push({ 1273 event: 'contactIbc',
1274 referringibcid: ibcId + getSubsidiaryCode() || '', 1275 method: contactType, 1276 activeShop: active ? 'yes' : 'no' 1277 }); 1278} 1279 1280/** findMyMatch 1281 * @param {Object} productData object 1282*/ 1283function findMyMatch(productData) { 1284 dataLayer.push({ 1285 event: 'e_findMyMatch', 1286 location: 'Pdp', 1287 findMyMatchProduct: productData 1288 }); 1289} 1290/** tryItOn 1291 * @param {Object} productData object 1292*/ 1293function tryItOn(productData) { 1294 dataLayer.push({ 1295 event: 'e_tryItOn', 1296 location: 'Pdp', 1297 tryItOnProduct: productData 1298 }); 1299} 1300 1301/** contact Ibc 1302* @param {string} searchMethod search method type 1303* @param {string} ibcId Ibc id 1304* @param {string} location search location 1305* @param {string} searchSlot slot number in the search 1306* @param {boolean} active store active 1307*/ 1308function consultantLocatorSelect(searchMethod, ibcId, location, searchSlot, active) { 1309 dataLayer.push({ 1310 event: 'consultantLocatorSelect', 1311 searchMethod: searchMethod || null, 1312 referringibcId: ibcId + getSubsidiaryCode() || '', 1313 location: location || '', 1314 searchSlot: searchSlot || null, 1315 activeShop: active ? 'Yes' : 'no' 1316 }); 1317} 1318/** userLogin 1319*/ 1320function userLogin() { 1321 dataLayer.push({ 1322 event: 'e_userLogin' 1323 }); 1324} 1325/** homeMenuNavigation 1326*/ 1327function homeMenuNavigation() { 1328 dataLayer.push({ 1329 event: 'e_homeMenuNavigation' 1330 }); 1331} 1332/** productAccordionClick 1333* @param {string} accordionName accordion name 1334*/ 1335function productAccordionClick(accordionName) { 1336 dataLayer.push({ 1337 event: 'e_productSectionExpanded', 1338 sectionName: accordionName 1339 }); 1340} 1341/** function viewPromotion(creativeName, creativeSlot, promotionId, promotionName) { 1342* @param {string} creativeName creativeName 1343* @param {string} creativeSlot creativeSlot 1344* @param {string} promotionId promotionId 1345* @param {string} promotionName promotionName 1346*/ 1347function viewPromotion(creativeName, creativeSlot, promotionId, promotionName) { 1348 dataLayer.push({ 1349 event: 'view_promotion', 1350 creative_name: creativeName, 1351 creative_slot: creativeSlot, 1352 promotion_id: promotionId, 1353 promotion_name: promotionName 1354 }); 1355} 1356/** function selectPromotion(creativeName, creativeSlot, promotionId, promotionName) { 1357* @param {string} creativeName creativeName 1358* @param {string} creativeSlot creativeSlot 1359* @param {string} promotionId promotionId 1360* @param {string} promotionName promotionName 1361* @param {Object} productData productData 1362*/ 1363function selectPromotion(creativeName, creativeSlot, promotionId, promotionName, productData) { 1364 dataLayer.push({ 1365 event: 'select_promotion', 1366 creative_name: creativeName, 1367 creative_slot: creativeSlot, 1368 promotion_id: promotionId, 1369 promotion_name: promotionName, 1370 items: productData || '' 1371 }); 1372} 1373 1374/** 1375 * Updates the current step in the checkout flow 1376 * @param {Integer} step the step number the flow is currently on 1377 */ 1378function updateCheckoutStep(step) { 1379 if (step && step === CHECKOUT_STEPS.CONTESTS) { 1380 return; 1381 } 1382 var actionUrl = dataLayerUrls.getProductsOfCheckoutStep; 1383 var url = appendParamToURL(actionUrl, 'checkoutStep', step); 1384 $.ajax({ 1385 url: url, 1386 method: 'GET', 1387 success: function success(data) { 1388 var obj = { 1389 event: 'e_checkout', 1390 ecommerce: { 1391 currencyCode: data.currencyCode, 1392 checkout: { 1393 actionField: { 1394 step: data.checkoutData.step.toString() 1395 }, 1396 products: data.checkoutData.products 1397 } 1398 } 1399 }; 1400 dataLayer.push(obj); 1401 } 1402 }); 1403} 1404 1405/** 1406 * Tracks interaction with a product accordion section 1407 * @param {string} action Expand or Collapse of the Accordion 1408 * @param {string} sectionType Title of the section of the accordion. 1409 * @param {string} sectionName The visible title of the accordion or collapsible section that was expanded by the user. 1410 */ 1411function productAccordionInteraction(action, sectionType, sectionName) { 1412 dataLayer.push({ 1413 event: 'e_productAccordionInteraction', 1414 actionType: action, 1415 sectionType: sectionType, 1416 sectionName: sectionName 1417 }); 1418} 1419module.exports = { 1420 connectConsultant: connectConsultant, 1421 addToCart: addToCart, 1422 removeFromCart: removeFromCart, 1423 consultantLocatorLoadMore: consultantLocatorLoadMore, 1424 viewProfileSelect: viewProfileSelect, 1425 viewProfileSelectHeader: viewProfileSelectHeader, 1426 searchResultsNavigation: searchResultsNavigation, 1427 searchResultsLoadMore: searchResultsLoadMore, 1428 searchResultClick: searchResultClick, 1429 searchSuggestionClick: searchSuggestionClick, 1430 joinTeamSelect: joinTeamSelect, 1431 applyPromoCode: applyPromoCode, 1432 removePromoCode: removePromoCode, 1433 openCart: openCart,
1434 eAddToFav: eAddToFav, 1435 diconnectIbc: diconnectIbc, 1436 contactIbc: contactIbc, 1437 consultantLocatorSelect: consultantLocatorSelect, 1438 openMinicart: openMinicart, 1439 closeMinicart: closeMinicart, 1440 accountRegister: accountRegister, 1441 tryItOn: tryItOn, 1442 findMyMatch: findMyMatch, 1443 userLogin: userLogin, 1444 homeMenuNavigation: homeMenuNavigation, 1445 productAccordionClick: productAccordionClick, 1446 viewPromotion: viewPromotion, 1447 selectPromotion: selectPromotion, 1448 updateCheckoutStep: updateCheckoutStep, 1449 productAccordionInteraction: productAccordionInteraction 1450}; 1451 1452/***/ }), 1453
1454/***/ "./cartridges/org_marykay/cartridge/client/default/js/cart/cart.js": 1455/*!*************************************************************************!*\ 1456 !*** ./cartridges/org_marykay/cartridge/client/default/js/cart/cart.js ***! 1457 \*************************************************************************/ 1458/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 1459 1460function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 1461function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 1462function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 1463function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 1464function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 1465function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 1466var base = __webpack_require__(/*! ../product/base */ "./cartridges/org_marykay/cartridge/client/default/js/product/base.js"); 1467var focusHelper = __webpack_require__(/*! ../components/focus */ "./cartridges/org_marykay/cartridge/client/default/js/components/focus.js"); 1468var gtm = __webpack_require__(/*! googletagmanager/tagManager */ "./cartridges/int_googletags/cartridge/client/default/js/tagManager.js"); 1469var swiper = __webpack_require__(/*! ../components/swiper */ "./cartridges/org_marykay/cartridge/client/default/js/components/swiper.js"); 1470var initCarousel = swiper.default; 1471var location = window.location; 1472 1473/* re-initialize slider on update promotion */ 1474/** 1475 * observeAndInitCarousel
1476 * @returns {Object|null} returns observer and disconnects after initializing the carousel or returns null if no initialization is needed 1477 */ 1478function observeAndInitCarousel() { 1479 if ($('.swiper-slide').length) { 1480 initCarousel(); 1481 return null; 1482 } 1483 var debounceTimer; 1484 var observer = new MutationObserver(function (mutations) { 1485 var hasSlides = mutations.some(function (mutation) { 1486 return _toConsumableArray(mutation.addedNodes).some(function (node) { 1487 return node.nodeType === 1 && (node.matches('.swiper-slide') || node.querySelector('.swiper-slide')); 1488 }); 1489 }); 1490 if (!hasSlides) return; 1491 clearTimeout(debounceTimer); 1492 debounceTimer = setTimeout(function () { 1493 initCarousel(); 1494 observer.disconnect(); 1495 }, 100); 1496 }); 1497 observer.observe(document.body, { 1498 childList: true, 1499 subtree: true 1500 }); 1501 return observer; 1502} 1503 1504/** 1505 * renderApproachingDiscountBanners 1506 * @param {function} callback - callback function 1507 * @returns {void} 1508 */ 1509function renderApproachingDiscountBanners(callback) { 1510 var $widgets = $('.promotion-widgets'); 1511 $widgets.each(function () { 1512 var $widget = $(this); 1513 if ($widget.data('url')) { 1514 var widgetsUrl = $widget.data('url'); 1515 $.ajax({ 1516 url: widgetsUrl, 1517 method: 'GET', 1518 dataType: 'html', 1519 success: function success(data) { 1520 if (data === '') { 1521 $widgets.hide(); 1522 } else { 1523 var html = $('<div />'); 1524 html.append(data); 1525 $widget.html($(html).find('.promotion-widgets').html()).show(); 1526 $widgets.show(); 1527 } 1528 if (typeof callback === 'function') { 1529 callback(); 1530 } 1531 } 1532 }); 1533 } 1534 }); 1535} 1536 1537/** 1538 * appends params to a url 1539 * @param {string} url - Original url 1540 * @param {Object} params - Parameters to append 1541 * @returns {string} result url with appended parameters 1542 */ 1543function appendToUrl(url, params) { 1544 var newUrl = url; 1545 newUrl += (newUrl.indexOf('?') !== -1 ? '&' : '?') + Object.keys(params).map(function (key) { 1546 return key + '=' + encodeURIComponent(params[key]); 1547 }).join('&'); 1548 return newUrl; 1549} 1550 1551/** 1552 * Checks whether the basket is valid. if invalid displays error message and disables 1553 * checkout button 1554 * @param {Object} data - AJAX response from the server 1555 */ 1556function validateBasket(data) { 1557 // Check if any item is out of stock (has OOS badge) 1558 var hasOOSItems = false; 1559 if (data.items && data.items.length > 0) { 1560 for (var i = 0; i < data.items.length; i++) { 1561 var item = data.items[i]; 1562 if (item && (item.available === false || item.custom && item.custom.isInStock === false)) { 1563 hasOOSItems = true; 1564 break; 1565 } 1566 } 1567 } 1568 if (data.valid.error || hasOOSItems) { 1569 // Disable checkout button - use both class and attribute for maximum compatibility 1570 $('.checkout-btn').addClass('disabled'); 1571 $('.checkout-btn').attr('disabled', 'disabled'); 1572 if (hasOOSItems) { 1573 var oosHtml = '<div class="alert alert-error alert-error--bg-critical mk-rounded-3 p-3 alert-dismissible valid-cart-error fade show" role="alert">' + '<strong class="title mb-1 font-weight-xbold small d-block">Bag Update Needed</strong>' + '<p class="m-0 small mk-text-color-black">One or more items in your bag are currently out of stock. Please remove these items to proceed with checkout.</p>' + '</div>'; 1574 $('.cart-error').empty().append(oosHtml); 1575 } else if (data.valid.message) { 1576 var errorHtml = '<div class="alert alert-error alert-error--bg-critical mk-rounded-3 p-3 alert-dismissible valid-cart-error ' + 'fade show" role="alert">' + '<button type="button" class="close" data-dismiss="alert" aria-label="Close">' + '<span aria-hidden="true">×</span>' + '</button>' + '<p class="m-0 small mk-text-color-black">' + data.valid.message + '</p>' + '</div>'; 1577 if ($('.cart-error').length) { 1578 $('.cart-error').empty().append(errorHtml); 1579 } 1580 } else if (data.resources && data.resources.emptyCartMsg) { 1581 $('.cart').empty().append('<div class="row"> ' + '<div class="col-12 text-center"> ' + '<h1>' + data.resources.emptyCartMsg + '</h1> ' + '</div> ' + '</div>'); 1582 $('.number-of-items').empty().append(data.resources.numberOfItems); 1583 $('.minicart-quantity').empty().append(data.numItems); 1584 $('.minicart-link').attr({ 1585 'aria-label': data.resources.minicartCountOfItems, 1586 title: data.resources.minicartCountOfItems 1587 }); 1588 $('.minicart .popover').empty(); 1589 $('.minicart .popover').removeClass('show'); 1590 } 1591 } else {
1592 // Only enable checkout if BOTH valid.error is false AND no OOS items exist 1593 var isDisabled = $('.checkout-btn').attr('disabled'); 1594 if (isDisabled === 'disabled') { 1595 $('.checkout-btn').removeAttr('disabled'); 1596 } 1597 $('.checkout-btn').removeClass('disabled'); 1598 $('.cart-error').empty(); 1599 } 1600} 1601 1602/** 1603 * re-renders the order totals and the number of items in the cart 1604 * @param {Object} data - AJAX response from the server 1605 */ 1606function updateCartTotals(data) { 1607 if (data.resources) { 1608 $('.number-of-items').empty().append(data.resources.numberOfItems); 1609 $('.minicart-link').attr({ 1610 'aria-label': data.resources.minicartCountOfItems, 1611 title: data.resources.minicartCountOfItems 1612 }); 1613 } 1614 $('.order-discount').addClass('hide-order-discount'); 1615 $('.shipping-discount').addClass('hide-shipping-discount'); 1616 if (data.totals) { 1617 $('.shipping-cost').empty().append(data.totals.totalShippingCost); 1618 $('.tax-total').empty().append(data.totals.totalTax); 1619 $('.grand-total').empty().append(data.totals.cartGrandTotal); 1620 $('.sub-total').empty().append(data.totals.subTotal); 1621 $('.minicart-quantity').empty().append(data.numItems); 1622 if (data.totals.orderLevelDiscountTotal.value > 0) { 1623 $('.order-discount').removeClass('hide-order-discount'); 1624 $('.order-discount-total').empty().append('- ' + data.totals.orderLevelDiscountTotal.formatted); 1625 } 1626 if (data.totals.shippingLevelDiscountTotal.value > 0) { 1627 $('.shipping-discount').removeClass('hide-shipping-discount'); 1628 $('.shipping-discount-total').empty().append('- ' + data.totals.shippingLevelDiscountTotal.formatted); 1629 } 1630 } 1631 if (data.items) { 1632 data.items.forEach(function (item) { 1633 if (data.totals.orderLevelDiscountTotal.value > 0) { 1634 $('.coupons-and-promos').empty().append(data.totals.discountsHtml); 1635 } 1636 if (item.renderedPromotions) { 1637 $('.item-' + item.UUID).empty().append(item.renderedPromotions); 1638 } else { 1639 $('.item-' + item.UUID).empty(); 1640 } 1641 $('.uuid-' + item.UUID + ' .unit-price').empty().append(item.renderedPrice); 1642 $('.line-item-price-' + item.UUID + ' .unit-price').empty().append(item.renderedPrice); 1643 $('.item-total-' + item.UUID).empty().append(item.priceTotal.renderedPrice); 1644 }); 1645 } 1646} 1647 1648/** 1649 * re-renders the order totals and the number of items in the cart 1650 * @param {Object} message - Error message to display 1651 */ 1652function createErrorNotification(message) { 1653 var errorHtml = '<div class="alert alert-error alert-error--bg-critical mk-rounded-3 p-3 alert-dismissible valid-cart-error ' + 'fade show" role="alert">' + '<button type="button" class="close" data-dismiss="alert" aria-label="Close">' + '<span aria-hidden="true">×</span>' + '</button>' + '<p class="m-0 small mk-text-color-black">' + message + '</p>' + '</div>'; 1654 $('.cart-error').append(errorHtml); 1655} 1656 1657/** 1658 * @param {Object} approachingDiscounts - array of approaching discounts to check if banners need to be re-rendered 1659 * @param {Object} totals - the current totals object to check if banners need to be re-rendered 1660 * re-renders the approaching discount messages 1661 */ 1662function updateApproachingDiscounts(approachingDiscounts, totals) { 1663 var renderBanners = approachingDiscounts && approachingDiscounts.length > 0 || totals && totals.shouldRenderPromotionBanners; 1664 if (renderBanners) { 1665 renderApproachingDiscountBanners(function () { 1666 observeAndInitCarousel(); 1667 }); 1668 } else if ($('.promotion-widgets').length > 0) { 1669 var $promotionWidgets = $('.promotion-widgets'); 1670 $promotionWidgets.empty(); 1671 $promotionWidgets.hide(); 1672 } 1673} 1674 1675/** 1676 * Updates the availability of a product line item 1677 * @param {Object} data - AJAX response from the server 1678 * @param {string} uuid - The uuid of the product line item to update 1679 */ 1680function updateAvailability(data, uuid) { 1681 var lineItem; 1682 var messages = ''; 1683 for (var i = 0; i < data.items.length; i++) { 1684 if (data.items[i].UUID === uuid) { 1685 lineItem = data.items[i]; 1686 break; 1687 } 1688 } 1689 if (lineItem != null) { 1690 $('.availability-' + lineItem.UUID).empty(); 1691 if (lineItem.availability) { 1692 if (lineItem.availability.messages) {
1693 lineItem.availability.messages.forEach(function (message) { 1694 messages += '<p class="line-item-attributes">' + message + '</p>'; 1695 }); 1696 } 1697 if (lineItem.availability.inStockDate) { 1698 messages += '<p class="line-item-attributes line-item-instock-date">' + lineItem.availability.inStockDate + '</p>'; 1699 } 1700 } 1701 $('.availability-' + lineItem.UUID).html(messages); 1702 } 1703} 1704 1705/** 1706 * Finds an element in the array that matches search parameter 1707 * @param {array} array - array of items to search 1708 * @param {function} match - function that takes an element and returns a boolean indicating if the match is made 1709 * @returns {Object|null} - returns an element of the array that matched the query. 1710 */ 1711function findItem(array, match) { 1712 // eslint-disable-line no-unused-vars 1713 for (var i = 0, l = array.length; i < l; i++) { 1714 if (match.call(this, array[i])) { 1715 return array[i]; 1716 } 1717 } 1718 return null; 1719} 1720 1721/** 1722 * Updates details of a product line item 1723 * @param {Object} data - AJAX response from the server 1724 * @param {string} uuid - The uuid of the product line item to update 1725 */ 1726function updateProductDetails(data, uuid) { 1727 $('.card.product-info.uuid-' + uuid).replaceWith(data.renderedTemplate); 1728} 1729 1730/** 1731 * Generates the modal window on the first call. 1732 * 1733 */ 1734function getModalHtmlElement() { 1735 if ($('#editProductModal').length !== 0) { 1736 $('#editProductModal').remove(); 1737 } 1738 var htmlString = '<!-- Modal -->' + '<div class="modal fade" id="editProductModal" tabindex="-1" role="dialog">' + '<span class="enter-message sr-only" ></span>' + '<div class="modal-dialog quick-view-dialog">' + '<!-- Modal content-->' + '<div class="modal-content">' + '<div class="modal-header">' + ' <button type="button" class="close pull-right" data-dismiss="modal">' + ' <span aria-hidden="true">×</span>' + ' <span class="sr-only"> </span>' + ' </button>' + '</div>' + '<div class="modal-body"></div>' + '<div class="modal-footer"></div>' + '</div>' + '</div>' + '</div>'; 1739 $('body').append(htmlString); 1740} 1741 1742/** 1743 * Parses the html for a modal window 1744 * @param {string} html - representing the body and footer of the modal window 1745 * 1746 * @return {Object} - Object with properties body and footer. 1747 */ 1748function parseHtml(html) { 1749 var $html = $('<div>').append($.parseHTML(html)); 1750 var body = $html.find('.product-quickview'); 1751 var footer = $html.find('.modal-footer').children(); 1752 return { 1753 body: body, 1754 footer: footer 1755 }; 1756} 1757 1758/** 1759 * replaces the content in the modal window for product variation to be edited. 1760 * @param {string} editProductUrl - url to be used to retrieve a new product model 1761 */ 1762function fillModalElement(editProductUrl) { 1763 $('.modal-body').spinner().start(); 1764 $.ajax({ 1765 url: editProductUrl, 1766 method: 'GET', 1767 dataType: 'json', 1768 success: function success(data) { 1769 var parsedHtml = parseHtml(data.renderedTemplate); 1770 $('#editProductModal .modal-body').empty(); 1771 $('#editProductModal .modal-body').html(parsedHtml.body); 1772 $('#editProductModal .modal-footer').html(parsedHtml.footer); 1773 $('#editProductModal .modal-header .close .sr-only').text(data.closeButtonText); 1774 $('#editProductModal .enter-message').text(data.enterDialogMessage); 1775 $('#editProductModal').modal('show'); 1776 $('body').trigger('editproductmodal:ready'); 1777 $.spinner().stop(); 1778 }, 1779 error: function error() { 1780 $.spinner().stop(); 1781 } 1782 }); 1783} 1784 1785/** 1786 * replace content of modal 1787 * @param {string} actionUrl - url to be used to remove product 1788 * @param {string} productID - pid 1789 * @param {string} productName - product name 1790 * @param {string} uuid - uuid 1791 */ 1792function confirmDelete(actionUrl, productID, productName, uuid) { 1793 var $deleteConfirmBtn = $('.cart-delete-confirmation-btn'); 1794 var $productToRemoveSpan = $('.product-to-remove'); 1795 $deleteConfirmBtn.data('pid', productID); 1796 $deleteConfirmBtn.data('action', actionUrl); 1797 $deleteConfirmBtn.data('uuid', uuid); 1798 $productToRemoveSpan.empty().append(productName); 1799} 1800 1801/** 1802 * Enables or disables the quantity increment and decrement buttons 1803 * based on the current quantity and the min/max limits. 1804 * 1805 * - Resets both plus and minus buttons to enabled state if quantity is between max and min. 1806 * - Disables the plus button if quantity is at or above max. 1807 * - Disables the minus button if quantity is at or below min. 1808 * 1809 * @param {jQuery} elem - The container element that wraps the quantity input and control buttons. 1810 * @param {number} qty - The current quantity selected by the user. 1811 */ 1812function disableQuantityBtns(elem, qty) { 1813 var $quantityInput = elem.find('.quantity'); 1814 var maxVal = parseInt($quantityInput.attr('max'), 10); 1815 var minVal = parseInt($quantityInput.attr('min'), 10); 1816 var buttons = { 1817 plus: elem.find('.button-plus'), 1818 minus: elem.find('.button-minus') 1819 }; 1820 if (!Number.isNaN(maxVal) && qty >= maxVal) { 1821 buttons.plus.addClass('disable').prop('disabled', true).attr('aria-disabled', true); 1822 buttons.minus.removeClass('disable').prop('disabled', false).attr('aria-disabled', false); 1823 } else if (!Number.isNaN(minVal) && qty <= minVal) { 1824 buttons.minus.addClass('disable').prop('disabled', true).attr('aria-disabled', true); 1825 buttons.plus.removeClass('disable').prop('disabled', false).attr('aria-disabled', false); 1826 } else { 1827 buttons.minus.removeClass('disable').prop('disabled', false).attr('aria-disabled', false); 1828 buttons.plus.removeClass('disable').prop('disabled', false).attr('aria-disabled', false); 1829 } 1830} 1831 1832/** 1833 * returns the localized value for the quantity label 1834 * @param {jquery} $elem - field element 1835 * @returns {string} returns label of quantity 1836 */ 1837function getQuantityLabelPrefix($elem) { 1838 var prefix = $elem.data('aria-label-prefix'); 1839 if (prefix) { 1840 return prefix; 1841 } 1842 var inputId = $elem.attr('id'); 1843 var $container = $elem.closest('.quantity-form').parent(); 1844 var $label = $container.find('label[for="' + inputId + '"]').first(); 1845 if ($label.length && $label.text().trim()) { 1846 return $label.text().trim(); 1847 } 1848 var existingLabel = $elem.attr('aria-label'); 1849 if (existingLabel && existingLabel.indexOf(':') !== -1) { 1850 return existingLabel.substring(0, existingLabel.lastIndexOf(':')).trim(); 1851 } 1852 return 'Quantity'; 1853} 1854
1855/** 1856 * network call to make after quantity is updated 1857 * @param {jquery} elem - jquery element 1858 */ 1859function updateQuantity(elem) { 1860 var $elem = elem; 1861 var preSelectQty = $elem.data('pre-select-qty'); 1862 var quantity = $elem.val(); 1863 var productID = $elem.data('pid'); 1864 var url = $elem.data('action'); 1865 var uuid = $elem.data('uuid'); 1866 var $parentElm = $elem.closest('.quantity-form'); 1867 var quantityLabelPrefix = getQuantityLabelPrefix($elem); 1868 var urlParams = { 1869 pid: productID, 1870 quantity: quantity, 1871 uuid: uuid 1872 }; 1873 url = appendToUrl(url, urlParams); 1874 $elem.parents('.card').spinner().start(); 1875 $('body').trigger('cart:beforeUpdate'); 1876 $.ajax({ 1877 url: url, 1878 type: 'get', 1879 context: $elem[0], 1880 dataType: 'json', 1881 success: function success(data) { 1882 $('.quantity[data-uuid="' + uuid + '"]').val(quantity); 1883 $('.coupons-and-promos').empty().append(data.totals.discountsHtml); 1884 var $liveRegion = $parentElm.find('.qty-live-region'); 1885 $liveRegion.text(quantityLabelPrefix + ': ' + quantity); 1886 if (data && data.gtm && data.gtm.data) { 1887 var qtyDiff = data.gtm.newQty - data.gtm.oldQty; 1888 if (qtyDiff > 0) { 1889 gtm.addToCart(data.gtm.data, qtyDiff); 1890 } else { 1891 gtm.removeFromCart(data.gtm.data, Math.abs(qtyDiff)); 1892 } 1893 } 1894 updateCartTotals(data); 1895 updateApproachingDiscounts(data.approachingDiscounts, data.totals); 1896 updateAvailability(data, uuid); 1897 validateBasket(data); 1898 $elem.data('pre-select-qty', quantity); 1899 $('body').trigger('cart:update', data); 1900 $.spinner().stop(); 1901 if ($elem.parents('.product-info').hasClass('bonus-product-line-item') && $('.cart-page').length) { 1902 location.reload(); 1903 } 1904 }, 1905 error: function error(err) { 1906 if (err.responseJSON.redirectUrl) { 1907 window.location.href = err.responseJSON.redirectUrl; 1908 } else { 1909 createErrorNotification(err.responseJSON.errorMessage); 1910 $elem.val(parseInt(preSelectQty, 10)); 1911 $.spinner().stop(); 1912 } 1913 } 1914 }); 1915} 1916 1917/** 1918 * Gets the FAQ category headline text for the accordion button, falling back to the nearest preceding section title. 1919 * @param {jQuery} $btn - The button element to start the search from. 1920 * @returns {string} The trimmed category title, or an empty string if none found. 1921 */ 1922function getCategoryTitle($btn) { 1923 var faq = $btn.closest('.pxp-faq-component').find('.pxp-faq-category-headline').first().text().trim(); 1924 if (faq) { 1925 return faq; 1926 } 1927 return $btn.closest('.layout-content, .grid-region').prevAll('.layout-section-title').first().find('.layout-section-title-text').text().trim(); 1928} 1929 1930/** 1931 * Sends the product ID to the server and fetches the product data object. 1932 * 1933 * @function getProductDataObject 1934 * @param {string} pid - The product ID to fetch details for. 1935 * @returns {jqXHR} - jQuery promise object for the AJAX request. 1936 */ 1937function getProductDataObject(pid) { 1938 var url = $('#getMatchProductUrl').val(); 1939 return $.ajax({ 1940 url: url, 1941 type: 'post', 1942 dataType: 'json', 1943 data: { 1944 pid: pid, 1945 csrf_token: $('[name="csrf_token"]').val() 1946 } 1947 }); 1948} 1949module.exports = function () { 1950 $('body').on('click', '.remove-product:not(.minicart-delete)', function (e) { 1951 e.preventDefault(); 1952 var $this = $(this); 1953 var actionUrl = $this.data('action'); 1954 var productID = $this.data('pid'); 1955 var productName = $this.data('name'); 1956 var uuid = $this.data('uuid'); 1957 var isMinicart = $this.parents('.remove-line-item').attr('data-isminicart'); 1958 if (!isMinicart) { 1959 confirmDelete(actionUrl, productID, productName, uuid); 1960 } 1961 }); 1962 $('body').on('afterRemoveFromCart', function (e, data) { 1963 e.preventDefault(); 1964 confirmDelete(data.actionUrl, data.productID, data.productName, data.uuid); 1965 }); 1966 $('.optional-promo').click(function (e) { 1967 e.preventDefault(); 1968 $('.promo-code-form').toggle(); 1969 }); 1970 $('body').on('tray:closed', function (e, response) { 1971 if ($(response).hasClass('mini-cart-tray')) { 1972 gtm.closeMinicart(); 1973 } 1974 }); 1975 $('body').on('click', '.mirror-me-js', function () { 1976 var pid = $('.product-detail.product-wrapper').data('pid'); 1977 getProductDataObject(pid).done(function (response) { 1978 gtm.tryItOn(response.productData); 1979 }); 1980 }); 1981 $('body').on('click', '.find-my-match-js', function () { 1982 var pid = $('.product-detail.product-wrapper').data('pid'); 1983 getProductDataObject(pid).done(function (response) { 1984 gtm.findMyMatch(response.productData); 1985 }); 1986 }); 1987 $('.product-details-accordion .card-header button').on('click', function () { 1988 var accordionName = $(this).find('.col-10').text().trim();
1989 gtm.productAccordionClick(accordionName); 1990 }); 1991 $('.pxp-faq-component .pxp-faq-accordion .card-header button').on('click', function () { 1992 var $button = $(this); 1993 var isCurrentlyCollapsed = $button.hasClass('collapsed'); 1994 var expandOrCollapse = isCurrentlyCollapsed ? 'expand' : 'collapse'; 1995 var sectionType = getCategoryTitle($button); 1996 var sectionName = $button.find('.faq-question-text').text().trim(); 1997 gtm.productAccordionInteraction(expandOrCollapse, sectionType, sectionName); 1998 }); 1999 $('body').on('click', '.cart-delete-confirmation-btn, .minicart-delete.remove-product ', function (e) { 2000 e.preventDefault(); 2001 var isMinicart = false; 2002 if ($(e.currentTarget).hasClass('minicart-delete')) { 2003 isMinicart = true; 2004 } 2005 var productID = $(this).data('pid'); 2006 var url = $(this).data('action'); 2007 var uuid = $(this).data('uuid'); 2008 var urlParams = { 2009 pid: productID, 2010 uuid: uuid 2011 }; 2012 url = appendToUrl(url, urlParams); 2013 $('body > .modal-backdrop').remove(); 2014 $.spinner().start(); 2015 $('body').trigger('cart:beforeUpdate'); 2016 $.ajax({ 2017 url: url, 2018 type: 'get', 2019 dataType: 'json', 2020 success: function success(data) { 2021 if (data.basket.items.length === 0) { 2022 $('.cart').empty(); 2023 $('.cart-cart__empty').removeClass('d-none'); 2024 $('.mini-cart-cart__empty').removeClass('d-none').addClass('d-flex'); 2025 $('.number-of-items').empty().append(data.basket.resources.numberOfItems); 2026 var $minicartQuantity = $('.minicart-quantity'); 2027 if (data.basket.numItems > 0) { 2028 $minicartQuantity.empty().append(data.basket.numItems); 2029 } else { 2030 $minicartQuantity.empty(); 2031 $('.minicart .minicart-icon-text').removeClass('active'); 2032 } 2033 var minicartLiveRegion = $('.mini-cart-tray').find('.minicart-live-region'); 2034 if (minicartLiveRegion.length) { 2035 var emptyCartMsg = minicartLiveRegion.data('empty-msg'); 2036 minicartLiveRegion.text(''); 2037 setTimeout(function () { 2038 minicartLiveRegion.text(emptyCartMsg); 2039 }, 100); 2040 } 2041 var liveRegion = document.querySelector('.cart-live-region'); 2042 if (liveRegion) { 2043 var emptyMessage = liveRegion.getAttribute('data-empty-msg'); 2044 liveRegion.textContent = ''; 2045 setTimeout(function () { 2046 liveRegion.textContent = emptyMessage; 2047 }, 100); 2048 } 2049 $('.minicart-link').attr({ 2050 'aria-label': data.basket.resources.minicartCountOfItems, 2051 title: data.basket.resources.minicartCountOfItems 2052 }); 2053 $('.promotion-widgets').empty(); 2054 $('.minicart .popover').empty(); 2055 $('.minicart .popover').removeClass('show'); 2056 $('body').removeClass('modal-open'); 2057 $('html').removeClass('veiled'); 2058 gtm.removeFromCart(data.productData, data.productData.quantity); 2059 } else { 2060 if (data.toBeDeletedUUIDs && data.toBeDeletedUUIDs.length > 0) { 2061 for (var i = 0; i < data.toBeDeletedUUIDs.length; i++) { 2062 $('.uuid-' + data.toBeDeletedUUIDs[i]).remove(); 2063 } 2064 } 2065 if (isMinicart) { 2066 $('.uuid-' + uuid).parents('.minicart-product-container').remove(); 2067 } else { 2068 $('.uuid-' + uuid).remove(); 2069 } 2070 if (!data.basket.hasBonusProduct) { 2071 $('.bonus-product').remove(); 2072 } 2073 $('.coupons-and-promos').empty().append(data.basket.totals.discountsHtml); 2074 updateCartTotals(data.basket); 2075 gtm.removeFromCart(data.productData, data.productData.quantity); 2076 updateApproachingDiscounts(data.basket.approachingDiscounts, data.basket.totals); 2077 $('body').trigger('setShippingMethodSelection', data.basket); 2078 validateBasket(data.basket); 2079 } 2080 $('body').trigger('cart:update', data); 2081 $.spinner().stop(); 2082 if (data.basket.numItems === 0) { 2083 setTimeout(function () { 2084 var btn = $('.close-btn>.tray-popup-close').filter(':visible').first(); 2085 if (btn.length) { 2086 btn[0].focus(); 2087 } 2088 }, 100); 2089 } 2090 }, 2091 error: function error(err) { 2092 if (err.responseJSON.redirectUrl) { 2093 window.location.href = err.responseJSON.redirectUrl; 2094 } else { 2095 createErrorNotification(err.responseJSON.errorMessage); 2096 $.spinner().stop(); 2097 } 2098 } 2099 }); 2100 }); 2101 $('body').on('click', '.quantity-form > .button-plus', function () { 2102 var parentElm = $(this).parents('.quantity-form'); 2103 var $qtyInput = parentElm.find('.quantity'); 2104 var qtyInputData = $qtyInput.data(); 2105 var prefix = getQuantityLabelPrefix($qtyInput); 2106 var $this = $(this); 2107 $this.addClass('clicked'); 2108 setTimeout(function () { 2109 $('.clicked').removeClass('clicked'); 2110 }, 100); 2111 var quantity = $qtyInput.val(); 2112 var maxVal = parseInt($qtyInput.attr('max'), 10); 2113 var parsedQty = parseInt(quantity, 10); 2114 if (parsedQty < maxVal) { 2115 parsedQty++; 2116 $qtyInput.val(parsedQty); 2117 $qtyInput.attr('aria-label', prefix + ': ' + parsedQty); 2118 $(this).removeClass('disable'); 2119 $(this).prop('disabled', false); 2120 }
2121 disableQuantityBtns(parentElm, parsedQty); 2122 if (qtyInputData.updateCart !== false) { 2123 updateQuantity($(this).parent().find('.quantity')); 2124 } 2125 }); 2126 // Decrease product quantity on cart page 2127 $('body').on('click', '.quantity-form > .button-minus', function () { 2128 var parentElm = $(this).parents('.quantity-form'); 2129 var $qtyInput = parentElm.find('.quantity'); 2130 var qtyInputData = $qtyInput.data(); 2131 var prefix = getQuantityLabelPrefix($qtyInput); 2132 $(this).addClass('clicked'); 2133 setTimeout(function () { 2134 $('.clicked').removeClass('clicked'); 2135 }, 100); 2136 var quantity = $qtyInput.val(); 2137 var minVal = parseInt($qtyInput.attr('min'), 10); 2138 var parsedQty = parseInt(quantity, 10); 2139 if (parsedQty > minVal) { 2140 parsedQty--; 2141 $qtyInput.val(parsedQty); 2142 $qtyInput.attr('aria-label', prefix + ': ' + parsedQty); 2143 $(this).removeClass('disable'); 2144 $(this).prop('disabled', false); 2145 } 2146 disableQuantityBtns(parentElm, parsedQty); 2147 if (qtyInputData.updateCart !== false) { 2148 updateQuantity($(this).parent().find('.quantity')); 2149 } 2150 }); 2151 $('body').on('change', '.quantity-form > .quantity', function () { 2152 updateQuantity($(this)); 2153 }); 2154 $('.shippingMethods').change(function () { 2155 var url = $(this).attr('data-actionUrl'); 2156 var urlParams = { 2157 methodID: $(this).find(':selected').attr('data-shipping-id') 2158 }; 2159 // url = appendToUrl(url, urlParams); 2160 2161 $('.totals').spinner().start(); 2162 $('body').trigger('cart:beforeShippingMethodSelected'); 2163 $.ajax({ 2164 url: url, 2165 type: 'post', 2166 dataType: 'json', 2167 data: urlParams, 2168 success: function success(data) { 2169 if (data.error) { 2170 window.location.href = data.redirectUrl; 2171 } else { 2172 $('.coupons-and-promos').empty().append(data.totals.discountsHtml); 2173 updateCartTotals(data); 2174 updateApproachingDiscounts(data.approachingDiscounts, data.totals); 2175 validateBasket(data); 2176 } 2177 $('body').trigger('cart:shippingMethodSelected', data); 2178 $.spinner().stop(); 2179 }, 2180 error: function error(err) { 2181 if (err.redirectUrl) { 2182 window.location.href = err.redirectUrl; 2183 } else { 2184 createErrorNotification(err.responseJSON.errorMessage); 2185 $.spinner().stop(); 2186 } 2187 } 2188 }); 2189 }); 2190 $('.promo-code-form').submit(function (e) { 2191 e.preventDefault(); 2192 $.spinner().start(); 2193 $('.coupon-missing-error').hide(); 2194 $('.coupon-error-message').empty(); 2195 var couponCode = $('.coupon-code-field').val(); 2196 if (!$('.coupon-code-field').val()) { 2197 $('.promo-code-form .form-control').addClass('is-invalid'); 2198 $('.promo-code-form .form-control').attr('aria-describedby', 'missingCouponCode'); 2199 $('.coupon-missing-error').show(); 2200 $.spinner().stop(); 2201 return false; 2202 } 2203 var $form = $('.promo-code-form'); 2204 $('.promo-code-form .form-control').removeClass('is-invalid'); 2205 $('.coupon-error-message').empty(); 2206 $('body').trigger('promotion:beforeUpdate'); 2207 $.ajax({ 2208 url: $form.attr('action'), 2209 type: 'GET', 2210 dataType: 'json', 2211 data: $form.serialize(), 2212 success: function success(data) { 2213 if (data.error) { 2214 $('.promo-code-form .form-control').addClass('is-invalid'); 2215 $('.promo-code-form .form-control').attr('aria-describedby', 'invalidCouponCode'); 2216 $('.coupon-error-message').empty().append(data.errorMessage); 2217 $('body').trigger('promotion:error', data); 2218 gtm.applyPromoCode(couponCode, 'fail'); 2219 } else { 2220 $('.coupons-and-promos').empty().append(data.totals.discountsHtml); 2221 updateCartTotals(data); 2222 updateApproachingDiscounts(data.approachingDiscounts, data.totals); 2223 validateBasket(data); 2224 gtm.applyPromoCode(couponCode, 'success'); 2225 $('body').trigger('promotion:success', data); 2226 } 2227 $('.coupon-code-field').val(''); 2228 $.spinner().stop(); 2229 }, 2230 error: function error(err) { 2231 $('body').trigger('promotion:error', err); 2232 if (err.responseJSON.redirectUrl) { 2233 window.location.href = err.responseJSON.redirectUrl; 2234 } else { 2235 createErrorNotification(err.errorMessage); 2236 $.spinner().stop(); 2237 } 2238 } 2239 }); 2240 return false;
2241 }); 2242 $('body').on('click', '.remove-coupon', function (e) { 2243 e.preventDefault(); 2244 var couponCode = $(this).data('code'); 2245 var uuid = $(this).data('uuid'); 2246 var $deleteConfirmBtn = $('.delete-coupon-confirmation-btn'); 2247 var $productToRemoveSpan = $('.coupon-to-remove'); 2248 $deleteConfirmBtn.data('uuid', uuid); 2249 $deleteConfirmBtn.data('code', couponCode); 2250 $productToRemoveSpan.empty().append(couponCode); 2251 }); 2252 $('body').on('click', '.delete-coupon-confirmation-btn', function (e) { 2253 e.preventDefault(); 2254 var url = $(this).data('action'); 2255 var uuid = $(this).data('uuid'); 2256 var couponCode = $(this).data('code'); 2257 var urlParams = { 2258 code: couponCode, 2259 uuid: uuid 2260 }; 2261 url = appendToUrl(url, urlParams); 2262 $('body > .modal-backdrop').remove(); 2263 $.spinner().start(); 2264 $('body').trigger('promotion:beforeUpdate'); 2265 $.ajax({ 2266 url: url, 2267 type: 'get', 2268 dataType: 'json', 2269 success: function success(data) { 2270 $('.coupon-uuid-' + uuid).remove(); 2271 updateCartTotals(data); 2272 updateApproachingDiscounts(data.approachingDiscounts, data.totals); 2273 validateBasket(data); 2274 gtm.removePromoCode(couponCode, 'success'); 2275 $.spinner().stop(); 2276 $('body').trigger('promotion:success', data); 2277 }, 2278 error: function error(err) { 2279 $('body').trigger('promotion:error', err); 2280 gtm.removePromoCode(couponCode, 'fail'); 2281 if (err.responseJSON.redirectUrl) { 2282 window.location.href = err.responseJSON.redirectUrl; 2283 } else { 2284 createErrorNotification(err.responseJSON.errorMessage); 2285 $.spinner().stop(); 2286 } 2287 } 2288 }); 2289 }); 2290 $('body').on('click', '.cart-page .bonus-product-button', function () { 2291 $.spinner().start(); 2292 $(this).addClass('launched-modal'); 2293 $.ajax({ 2294 url: $(this).data('url'), 2295 method: 'GET', 2296 dataType: 'json', 2297 success: function success(data) { 2298 base.methods.editBonusProducts(data); 2299 $.spinner().stop(); 2300 }, 2301 error: function error() { 2302 $.spinner().stop(); 2303 } 2304 }); 2305 }); 2306 $('body').on('hidden.bs.modal', '#chooseBonusProductModal', function () { 2307 $('#chooseBonusProductModal').remove(); 2308 $('.modal-backdrop').remove(); 2309 $('body').removeClass('modal-open'); 2310 if ($('.cart-page').length) { 2311 $('.launched-modal .btn-outline-primary').trigger('focus'); 2312 $('.launched-modal').removeClass('launched-modal'); 2313 } else { 2314 $('.product-detail .add-to-cart').focus(); 2315 } 2316 }); 2317 $('body').on('click', '.cart-page .product-edit .edit, .cart-page .bundle-edit .edit', function (e) { 2318 e.preventDefault(); 2319 var editProductUrl = $(this).attr('href'); 2320 getModalHtmlElement(); 2321 fillModalElement(editProductUrl); 2322 }); 2323 $('body').on('shown.bs.modal', '#editProductModal', function () { 2324 $('#editProductModal').siblings().attr('aria-hidden', 'true'); 2325 $('#editProductModal .close').focus(); 2326 }); 2327 $('body').on('hidden.bs.modal', '#editProductModal', function () { 2328 $('#editProductModal').siblings().attr('aria-hidden', 'false'); 2329 }); 2330 $('body').on('keydown', '#editProductModal', function (e) { 2331 var focusParams = { 2332 event: e, 2333 containerSelector: '#editProductModal', 2334 firstElementSelector: '.close', 2335 lastElementSelector: '.update-cart-product-global', 2336 nextToLastElementSelector: '.modal-footer .quantity-select' 2337 }; 2338 focusHelper.setTabNextFocus(focusParams); 2339 }); 2340 $('body').on('product:updateAddToCart', function (e, response) { 2341 // update global add to cart (single products, bundles) 2342 var dialog = $(response.$productContainer).closest('.quick-view-dialog'); 2343 $('.update-cart-product-global', dialog).attr('disabled', !$('.global-availability', dialog).data('ready-to-order') || !$('.global-availability', dialog).data('available')); 2344 }); 2345 $('body').on('product:updateAvailability', function (e, response) { 2346 // bundle individual products 2347 $('.product-availability', response.$productContainer).data('ready-to-order', response.product.readyToOrder).data('available', response.product.available).find('.availability-msg').empty().html(response.message);
2348 var dialog = $(response.$productContainer).closest('.quick-view-dialog'); 2349 if ($('.product-availability', dialog).length) { 2350 // bundle all products 2351 var allAvailable = $('.product-availability', dialog).toArray().every(function (item) { 2352 return $(item).data('available'); 2353 }); 2354 var allReady = $('.product-availability', dialog).toArray().every(function (item) { 2355 return $(item).data('ready-to-order'); 2356 }); 2357 $('.global-availability', dialog).data('ready-to-order', allReady).data('available', allAvailable); 2358 $('.global-availability .availability-msg', dialog).empty().html(allReady ? response.message : response.resources.info_selectforstock); 2359 } else { 2360 // single product 2361 $('.global-availability', dialog).data('ready-to-order', response.product.readyToOrder).data('available', response.product.available).find('.availability-msg').empty().html(response.message); 2362 } 2363 }); 2364 $('body').on('product:afterAttributeSelect', function (e, response) { 2365 if ($('.modal.show .product-quickview .bundle-items').length) { 2366 $('.modal.show').find(response.container).data('pid', response.data.product.id); 2367 $('.modal.show').find(response.container).find('.product-id').text(response.data.product.id); 2368 } else { 2369 $('.modal.show .product-quickview').data('pid', response.data.product.id); 2370 } 2371 }); 2372 $('body').on('change', '.quantity-select', function () { 2373 var selectedQuantity = $(this).val(); 2374 $('.modal.show .update-cart-url').data('selected-quantity', selectedQuantity); 2375 }); 2376 $('body').on('change', '.options-select', function () { 2377 var selectedOptionValueId = $(this).children('option:selected').data('value-id'); 2378 $('.modal.show .update-cart-url').data('selected-option', selectedOptionValueId); 2379 }); 2380 $('body').on('click', '.update-cart-product-global', function (e) { 2381 e.preventDefault(); 2382 var updateProductUrl = $(this).closest('.cart-and-ipay').find('.update-cart-url').val(); 2383 var selectedQuantity = $(this).closest('.cart-and-ipay').find('.update-cart-url').data('selected-quantity'); 2384 var selectedOptionValueId = $(this).closest('.cart-and-ipay').find('.update-cart-url').data('selected-option'); 2385 var uuid = $(this).closest('.cart-and-ipay').find('.update-cart-url').data('uuid'); 2386 var form = { 2387 uuid: uuid, 2388 pid: base.getPidValue($(this)), 2389 quantity: selectedQuantity, 2390 selectedOptionValueId: selectedOptionValueId 2391 }; 2392 $(this).parents('.card').spinner().start(); 2393 $('body').trigger('cart:beforeUpdate'); 2394 if (updateProductUrl) { 2395 $.ajax({ 2396 url: updateProductUrl, 2397 type: 'post', 2398 context: this, 2399 data: form, 2400 dataType: 'json', 2401 success: function success(data) { 2402 $('#editProductModal').modal('hide'); 2403 $('.coupons-and-promos').empty().append(data.cartModel.totals.discountsHtml); 2404 updateCartTotals(data.cartModel); 2405 updateApproachingDiscounts(data.cartModel.approachingDiscounts, data.cartModel.totals); 2406 updateAvailability(data.cartModel, uuid); 2407 updateProductDetails(data, uuid); 2408 if (data.uuidToBeDeleted) { 2409 $('.uuid-' + data.uuidToBeDeleted).remove(); 2410 } 2411 validateBasket(data.cartModel); 2412 $('body').trigger('cart:update', data); 2413 $.spinner().stop(); 2414 }, 2415 error: function error(err) { 2416 if (err.responseJSON.redirectUrl) { 2417 window.location.href = err.responseJSON.redirectUrl; 2418 } else { 2419 createErrorNotification(err.responseJSON.errorMessage); 2420 $.spinner().stop(); 2421 } 2422 } 2423 }); 2424 } 2425 }); 2426 $('body').on('click', '.checkout-btn', function () { 2427 gtm.updateCheckoutStep(); 2428 }); 2429 $('.line-item-name').on('keydown', function (e) { 2430 if (e.key === 'Enter') { 2431 e.preventDefault(); 2432 var $link = $(this).find('a'); 2433 if ($link.length && $link.attr('href')) { 2434 window.location.href = $link.attr('href'); 2435 } 2436 } 2437 }); 2438 $('.minicart .minicart-link').on('click', function () { 2439 setTimeout(function () { 2440 if ($('.swiper-slide').length) { 2441 initCarousel(); 2442 } else { 2443 observeAndInitCarousel(); 2444 } 2445 }, 2500); 2446 }); 2447 var config = { 2448 childList: true, 2449 subtree: true 2450 }; 2451 var hasInitialized = false;
2452 var debounceTimer = null; 2453 var observer = new MutationObserver(function (mutations) { 2454 if (hasInitialized) return; 2455 $.each(mutations, function (_, mutation) { 2456 if (mutation.type !== 'childList' || !mutation.addedNodes.length) return; 2457 mutation.addedNodes.forEach(function (node) { 2458 if (node.nodeType !== 1) return false; 2459 var slot = node.closest('[id^="cq_recomm_slot-"]'); 2460 if (!slot) return false; 2461 if (node.classList.contains('swiper-slide') || node.querySelector('.swiper-slide')) { 2462 clearTimeout(debounceTimer); 2463 debounceTimer = setTimeout(function () { 2464 if (hasInitialized) return; 2465 hasInitialized = true; 2466 initCarousel(); 2467 2468 // Stop observing once initialized 2469 observer.disconnect(); 2470 }, 100); 2471 return false; // break .each() 2472 } 2473 return true; 2474 }); 2475 }); 2476 }); 2477 $(document).ready(function () { 2478 // Observe all matching elements (unwrap jQuery → DOM) 2479 if ($('[id^="cq_recomm_slot-"]').length) { 2480 observer.observe(document.body, config); 2481 } 2482 }); 2483 2484 // AC5: reload cart page when bonus PLI count changes after any basket mutation 2485 /** 2486 * Reloads the cart page or refreshes the open mini-cart when server item count differs from DOM. 2487 * @param {Object} data - AJAX response data from any cart mutation 2488 */ 2489 function syncBonusItems(data) { 2490 var items = data && data.cart && data.cart.items || data && data.basket && data.basket.items || data && data.items || null; 2491 if (!items) { 2492 return; 2493 } 2494 if ($('.cart-page').length) { 2495 if (items.length !== $('.cart-left-section .card.product-info').length) { 2496 location.reload(); 2497 } 2498 return; 2499 } 2500 2501 // Mini-cart tray: refresh product list in place when item count changes 2502 var $productSummary = $('.mk-mini-cart .product-summary'); 2503 if (!$productSummary.length) { 2504 return; 2505 } 2506 if (items.length !== $productSummary.find('.minicart-product-container').length) { 2507 var url = $('.minicart-link[data-ajax-content]').data('ajax-content'); 2508 if (!url) { 2509 return; 2510 } 2511 $.spinner().start(); 2512 $.get(url).done(function (html) { 2513 var $freshSummary = $(html).find('.product-summary'); 2514 if ($freshSummary.length) { 2515 $productSummary.html($freshSummary.html()); 2516 } 2517 }).always(function () { 2518 $.spinner().stop(); 2519 }); 2520 } 2521 } 2522 $('body').on('product:afterAddToCart', function (e, data) { 2523 syncBonusItems(data); 2524 }); 2525 $('body').on('cart:update', function (e, data) { 2526 syncBonusItems(data); 2527 }); 2528 base.selectAttribute(); 2529 base.colorAttribute(); 2530 base.removeBonusProduct(); 2531 base.selectBonusProduct(); 2532 base.enableBonusProductSelection(); 2533 base.showMoreBonusProducts(); 2534 base.addBonusProductsToCart(); 2535 base.focusChooseBonusProductModal(); 2536 base.trapChooseBonusProductModalFocus(); 2537 base.onClosingChooseBonusProductModal(); 2538}; 2539 2540/***/ }), 2541
2542/***/ "./cartridges/org_marykay/cartridge/client/default/js/components/deviceDetection.js": 2543/*!******************************************************************************************!*\ 2544 !*** ./cartridges/org_marykay/cartridge/client/default/js/components/deviceDetection.js ***! 2545 \******************************************************************************************/ 2546/***/ (function(module) { 2547 2548/** 2549 * Device Detection Utilities 2550 * Aligns with Bootstrap 4.6 breakpoints defined in _variables.scss 2551 * 2552 * Breakpoints: 2553 * - Phone: < 768px (xs, sm collapsed to mobile) 2554 * - Tablet: 600px - 1199px (custom tablet range + md/lg) 2555 * - Desktop: 1200px - 1439px (xl) 2556 * - Large Desktop: >= 1440px (xxl) 2557 * 2558 * Usage: 2559 * var device = require('./deviceDetection'); 2560 * if (device.isPhone()) { ... } 2561 * var deviceType = device.getDeviceType(); // 'phone' | 'tablet' | 'desktop' | 'large-desktop' 2562 */ 2563 2564// Breakpoint constants (aligned with SCSS $grid-breakpoints) 2565var BREAKPOINTS = { 2566 PHONE_MAX: 767, 2567 TABLET_MIN: 600, 2568 TABLET_MAX: 1199, 2569 DESKTOP_MIN: 1200, 2570 LARGE_DESKTOP_MIN: 1440 2571}; 2572 2573/** 2574 * Get current device type based on viewport width. 2575 * @returns {string} Returns one of: 'phone', 'tablet', 'desktop', or 'large-desktop'. 2576 */ 2577function getDeviceType() { 2578 var width = window.innerWidth; 2579 if (width < BREAKPOINTS.PHONE_MAX) { 2580 return 'phone'; 2581 } 2582 if (width >= BREAKPOINTS.TABLET_MIN && width <= BREAKPOINTS.TABLET_MAX) { 2583 return 'tablet'; 2584 } 2585 if (width >= BREAKPOINTS.DESKTOP_MIN && width < BREAKPOINTS.LARGE_DESKTOP_MIN) { 2586 return 'desktop'; 2587 } 2588 return 'large-desktop'; 2589} 2590 2591/** 2592 * Check if current device is a phone. 2593 * @returns {boolean} True if width < tablet minimum. 2594 */ 2595function isPhone() { 2596 return window.innerWidth < BREAKPOINTS.TABLET_MIN; 2597} 2598 2599/** 2600 * Check if current device is a tablet. 2601 * @returns {boolean} True if width is between tablet min and tablet max. 2602 */ 2603function isTablet() { 2604 var width = window.innerWidth; 2605 return width >= BREAKPOINTS.TABLET_MIN && width <= BREAKPOINTS.TABLET_MAX; 2606} 2607 2608/** 2609 * Check if current device is a desktop. 2610 * @returns {boolean} True if width is between desktop min and large-desktop min. 2611 */ 2612function isDesktop() { 2613 var width = window.innerWidth; 2614 return width >= BREAKPOINTS.DESKTOP_MIN && width < BREAKPOINTS.LARGE_DESKTOP_MIN; 2615} 2616 2617/** 2618 * Check if current device is a large desktop. 2619 * @returns {boolean} True if width >= large desktop minimum. 2620 */ 2621function isLargeDesktop() { 2622 return window.innerWidth >= BREAKPOINTS.LARGE_DESKTOP_MIN; 2623} 2624 2625/** 2626 * Check if current viewport is mobile. 2627 * @returns {boolean} True if width <= tablet max. 2628 */ 2629function isMobile() { 2630 return window.innerWidth <= BREAKPOINTS.TABLET_MAX; 2631} 2632 2633/** 2634 * Get detailed device information. 2635 * @returns {Object} Returns a details object including type, size, and device flags. 2636 */ 2637function getDeviceInfo() { 2638 var width = window.innerWidth; 2639 var height = window.innerHeight; 2640 var deviceType = getDeviceType(); 2641 return { 2642 type: deviceType, 2643 width: width, 2644 height: height, 2645 isPhone: isPhone(), 2646 isTablet: isTablet(), 2647 isDesktop: isDesktop(), 2648 isLargeDesktop: isLargeDesktop(), 2649 isMobile: isMobile(), 2650 isPortrait: height > width, 2651 isLandscape: width > height 2652 }; 2653} 2654module.exports = { 2655 getDeviceType: getDeviceType, 2656 getDeviceInfo: getDeviceInfo, 2657 isPhone: isPhone, 2658 isTablet: isTablet, 2659 isDesktop: isDesktop, 2660 isLargeDesktop: isLargeDesktop, 2661 isMobile: isMobile, 2662 BREAKPOINTS: BREAKPOINTS 2663}; 2664 2665/***/ }), 2666
2667/***/ "./cartridges/org_marykay/cartridge/client/default/js/components/focus.js": 2668/*!********************************************************************************!*\ 2669 !*** ./cartridges/org_marykay/cartridge/client/default/js/components/focus.js ***! 2670 \********************************************************************************/ 2671/***/ (function(module) { 2672 2673module.exports = { 2674 setTabNextFocus: function setTabNextFocus(focusParams) { 2675 var KEYCODE_TAB = 9; 2676 var isTabPressed = focusParams.event.key === 'Tab' || focusParams.event.keyCode === KEYCODE_TAB; 2677 if (!isTabPressed) { 2678 return; 2679 } 2680 var firstFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.firstElementSelector); 2681 var lastFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.lastElementSelector); 2682 if ($(focusParams.containerSelector + ' ' + focusParams.lastElementSelector).is(':disabled')) { 2683 lastFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.nextToLastElementSelector); 2684 if ($('.product-quickview.product-set').length > 0) { 2685 var linkElements = $(focusParams.containerSelector + ' a#fa-link.share-icons'); 2686 lastFocusableEl = linkElements[linkElements.length - 1]; 2687 } 2688 } 2689 if (focusParams.event.shiftKey) /* shift + tab */{ 2690 if ($(':focus').is(firstFocusableEl)) {
2691 lastFocusableEl.focus(); 2692 focusParams.event.preventDefault(); 2693 } 2694 } else /* tab */{ 2695 if ($(':focus').is(lastFocusableEl)) { 2696 // eslint-disable-line 2697 firstFocusableEl.focus(); 2698 focusParams.event.preventDefault(); 2699 } 2700 } 2701 } 2702}; 2703 2704/***/ }), 2705
2706/***/ "./cartridges/org_marykay/cartridge/client/default/js/components/miniCart.js": 2707/*!***********************************************************************************!*\ 2708 !*** ./cartridges/org_marykay/cartridge/client/default/js/components/miniCart.js ***! 2709 \***********************************************************************************/ 2710/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 2711 2712var cart = __webpack_require__(/*! ../cart/cart */ "./cartridges/org_marykay/cartridge/client/default/js/cart/cart.js"); 2713var tray = __webpack_require__(/*! ../components/tray */ "./cartridges/org_marykay/cartridge/client/default/js/components/tray.js"); 2714var snackbar = __webpack_require__(/*! ../components/snackbar */ "./cartridges/org_marykay/cartridge/client/default/js/components/snackbar.js"); 2715var updateMiniCart = true; 2716var location = window.location; 2717 2718/** 2719 * appends params to a url 2720 * @param {string} data - data returned from the server's ajax call 2721 */ 2722function displayMessageAndRemoveFromCart(data) { 2723 $.spinner().stop(); 2724 var status = data.success ? 'success' : 'error'; 2725 snackbar.show({ 2726 position: 'left', 2727 message: data.msg, 2728 type: status 2729 }); 2730 if (!data.itemExists) { 2731 var $targetElement = $('a[data-pid="' + data.pid + '"]').closest('.product-info').find('.remove-product'); 2732 var itemToMove = { 2733 actionUrl: $targetElement.data('action'), 2734 productID: $targetElement.data('pid'), 2735 productName: $targetElement.data('name'), 2736 uuid: $targetElement.data('uuid') 2737 }; 2738 $('body').trigger('afterRemoveFromCart', itemToMove); 2739 $('.cart-delete-confirmation-btn').trigger('click'); 2740 } 2741} 2742/** 2743 * move items from Cart to wishlist 2744 * returns json object with success or error message 2745 */ 2746function moveToWishlist() { 2747 $('body').on('click', '.product-move .move', function (e) { 2748 e.preventDefault(); 2749 var url = $(this).attr('href'); 2750 var pid = $(this).data('pid'); 2751 var optionId = $(this).closest('.product-info').find('.lineItem-options-values').data('option-id'); 2752 var optionVal = $(this).closest('.product-info').find('.lineItem-options-values').data('value-id'); 2753 var productListName = ($(this).data('product-list-name') || '').toString().toUpperCase(); 2754 optionId = optionId || null; 2755 optionVal = optionVal || null; 2756 if (!url || !pid) { 2757 return; 2758 } 2759 $.spinner().start(); 2760 $.ajax({ 2761 url: url, 2762 type: 'post', 2763 dataType: 'json', 2764 data: { 2765 pid: pid, 2766 optionId: optionId, 2767 optionVal: optionVal, 2768 productListName: productListName 2769 }, 2770 success: function success(data) { 2771 var $wishlistIcon = $('.wishlist-icon'); 2772 var $wishlistFilledIcon = $('.wishlist-filled-icon'); 2773 $wishlistIcon.addClass('d-none'); 2774 $wishlistFilledIcon.removeClass('d-none'); 2775 displayMessageAndRemoveFromCart(data); 2776 }, 2777 error: function error(err) { 2778 displayMessageAndRemoveFromCart(err); 2779 } 2780 }); 2781 }); 2782} 2783module.exports = { 2784 base: function base() { 2785 cart(); 2786 $('.minicart').on('count:update', function (event, count) { 2787 if (count && $.isNumeric(count.quantityTotal)) { 2788 $('.minicart .minicart-quantity').text(count.quantityTotal); 2789 $('.minicart .minicart-link').attr({ 2790 'aria-label': count.minicartCountOfItems, 2791 title: count.minicartCountOfItems 2792 }); 2793 } 2794 }); 2795 $('.minicart').on('mouseenter focusin touchstart', function () { 2796 if ($('.search:visible').length === 0) { 2797 return; 2798 } 2799 var url = $('.minicart').data('action-url'); 2800 var count = parseInt($('.minicart .minicart-quantity').text(), 10); 2801 if (count !== 0 && $('.minicart .popover.show').length === 0) { 2802 if (!updateMiniCart) { 2803 $('.minicart .popover').addClass('show'); 2804 return; 2805 } 2806 $('.minicart .popover').addClass('show'); 2807 $('.minicart .popover').spinner().start(); 2808 $.get(url, function (data) { 2809 $('.minicart .popover').empty(); 2810 $('.minicart .popover').append(data); 2811 updateMiniCart = false;
2812 $.spinner().stop(); 2813 }); 2814 } 2815 }); 2816 $('body').on('touchstart click', function (e) { 2817 if ($('.minicart').has(e.target).length <= 0) { 2818 $('.minicart .popover').removeClass('show'); 2819 } 2820 }); 2821 $('.minicart').on('mouseleave focusout', function (event) { 2822 if (event.type === 'focusout' && $('.minicart').has(event.target).length > 0 || event.type === 'mouseleave' && $(event.target).is('.minicart .quantity') || $('body').hasClass('modal-open')) { 2823 event.stopPropagation(); 2824 return; 2825 } 2826 $('.minicart .popover').removeClass('show'); 2827 }); 2828 $('body').on('change', '.minicart .quantity', function () { 2829 if ($(this).parents('.bonus-product-line-item').length && $('.cart-page').length) { 2830 location.reload(); 2831 } 2832 }); 2833 $('body').on('product:afterAddToCart', function () { 2834 updateMiniCart = true; 2835 }); 2836 $('body').on('cart:update', function () { 2837 updateMiniCart = true; 2838 }); 2839 }, 2840 moveToWishlist: moveToWishlist, 2841 minicartCountUpdate: function minicartCountUpdate() { 2842 $('.minicart').on('count:update', function (event, count) { 2843 if (count && $.isNumeric(count.quantityTotal)) { 2844 $('.minicart .minicart-quantity').text(count.quantityTotal); 2845 $('.minicart .minicart-link').attr({ 2846 'aria-label': count.minicartCountOfItems, 2847 title: count.minicartCountOfItems 2848 }); 2849 if ($.isNumeric(count.quantityTotal) === 0) { 2850 $('.minicart .minicart-icon-text').removeClass('active'); 2851 } else { 2852 $('.minicart .minicart-icon-text').addClass('active'); 2853 } 2854 } 2855 }); 2856 }, 2857 minicartEmptyShow: function minicartEmptyShow() { 2858 $('.minicart').on('click', function (e) { 2859 e.preventDefault(); 2860 tray.InitTrayModal(); 2861 }); 2862 }, 2863 miniCartShow: function miniCartShow() { 2864 $('.minicart .minicart-link ').trigger('click'); 2865 } 2866}; 2867 2868/***/ }), 2869
2870/***/ "./cartridges/org_marykay/cartridge/client/default/js/components/snackbar.js": 2871/*!***********************************************************************************!*\ 2872 !*** ./cartridges/org_marykay/cartridge/client/default/js/components/snackbar.js ***! 2873 \***********************************************************************************/ 2874/***/ (function(module) { 2875 2876/** 2877 * Snackbar Component 2878 * Provides toast-like notifications at the bottom of the screen 2879 */ 2880 2881// Build private API using IIFE (Module Pattern) 2882var Snackbar = function () { 2883 var DEFAULT_TIMEOUT = 5000; 2884 var api = { 2885 /** 2886 * Initialize snackbar functionality 2887 */ 2888 init: function init() { 2889 api.bindEvents(); 2890 }, 2891 /** 2892 * Bind event handlers 2893 */ 2894 bindEvents: function bindEvents() { 2895 $(document).on('click', '[data-snackbar-close]', api.closeSnackbar); 2896 $(document).on('click', '[data-snackbar-action]', api.handleAction); 2897 }, 2898 /** 2899 * Show a snackbar notification 2900 * @param {Object} options - Snackbar configuration 2901 * @param {string} options.type - Type of snackbar (success, error, default, warning, info) 2902 * @param {string} options.position - Position of snackbar (center, left, right) 2903 * @param {string} options.title - Optional title text 2904 * @param {string} options.message - Message text 2905 * @param {string} options.actionText - Optional action button text 2906 * @param {string} options.actionUrl - Optional action button URL 2907 * @param {number} options.duration - Auto-hide duration in milliseconds (default: 5000) 2908 * @param {string} options.id - Unique identifier for the snackbar 2909 * @returns {string} The snackbar ID 2910 */ 2911 show: function show(options) { 2912 var defaults = { 2913 type: 'default', 2914 position: 'center', 2915 duration: DEFAULT_TIMEOUT, 2916 id: 'snackbar-' + Date.now() 2917 }; 2918 var config = $.extend({}, defaults, options); 2919 2920 // Check if snackbar template exists in DOM 2921 var $existingSnackbar = $('.snackbar'); 2922 if ($existingSnackbar.length === 0) { 2923 // eslint-disable-next-line no-console 2924 console.warn('Snackbar template not found. Make sure snackbar.isml is included in your template.'); 2925 return null; 2926 } 2927 2928 // Update existing snackbar content 2929 api.updateSnackbarContent($existingSnackbar, config); 2930 2931 // Show with animation 2932 $existingSnackbar.addClass('snackbar--show'); 2933 2934 // Auto-hide if duration is set 2935 if (config.duration > 0) { 2936 setTimeout(function () { 2937 api.hide(config.id); 2938 }, config.duration); 2939 } 2940 return config.id; 2941 }, 2942 /** 2943 * Update snackbar content based on configuration 2944 * @param {jQuery} $snackbar - jQuery object of the snackbar 2945 * @param {Object} config - Snackbar configuration 2946 */ 2947 updateSnackbarContent: function updateSnackbarContent($snackbar, config) { 2948 // Update type classes 2949 $snackbar.removeClass('snackbar--success snackbar--error snackbar--default snackbar--warning snackbar--info').addClass('snackbar--' + config.type); 2950 2951 // Update position classes 2952 $snackbar.removeClass('snackbar--center snackbar--left snackbar--right').addClass('snackbar--' + config.position); 2953 2954 // Update ID 2955 $snackbar.attr('data-snackbar-id', config.id); 2956 2957 // Update title 2958 var $title = $snackbar.find('.snackbar__title'); 2959 if (config.title) { 2960 if ($title.length === 0) { 2961 $snackbar.find('.snackbar__text').prepend('<div class="snackbar__title subtitle-2"></div>'); 2962 $title = $snackbar.find('.snackbar__title'); 2963 } 2964 $title.text(config.title).show(); 2965 } else { 2966 $title.hide(); 2967 } 2968 2969 // Update message 2970 var $message = $snackbar.find('.snackbar__message'); 2971 if (config.message) { 2972 if ($message.length === 0) { 2973 $snackbar.find('.snackbar__text').append('<div class="snackbar__message small"></div>'); 2974 $message = $snackbar.find('.snackbar__message'); 2975 } 2976 $message.text(config.message).show(); 2977 } else { 2978 $message.hide(); 2979 } 2980 2981 /* 2982 // Update action button 2983 var $actionBtn = $snackbar.find('.snackbar__action-btn'); 2984 if (config.actionText && config.actionUrl) { 2985 if ($actionBtn.length === 0) { 2986 $snackbar.find('.snackbar__actions').prepend('<a href="#" class="snackbar__action-btn btn btn-outline-light small" data-snackbar-action></a>'); 2987 $actionBtn = $snackbar.find('.snackbar__action-btn'); 2988 } 2989 $actionBtn.text(config.actionText).attr('href', config.actionUrl).show(); 2990 } else { 2991 $actionBtn.hide(); 2992 } 2993 */ 2994 }, 2995 /** 2996 * Hide a specific snackbar
2997 * @param {string} id - Snackbar ID 2998 */ 2999 hide: function hide(id) { 3000 var $snackbar = $('[data-snackbar-id="' + id + '"]'); 3001 if ($snackbar.length) { 3002 $snackbar.removeClass('snackbar--show').addClass('snackbar--hide'); 3003 setTimeout(function () { 3004 $snackbar.removeClass('snackbar--hide'); 3005 }, 300); // Match animation duration 3006 } 3007 }, 3008 /** 3009 * Hide all snackbars 3010 */ 3011 hideAll: function hideAll() { 3012 $('.snackbar').removeClass('snackbar--show').addClass('snackbar--hide'); 3013 setTimeout(function () { 3014 $('.snackbar').removeClass('snackbar--hide'); 3015 }, 300); // Match animation duration 3016 }, 3017 /** 3018 * Close snackbar event handler 3019 * @param {Event} e - Click event 3020 */ 3021 closeSnackbar: function closeSnackbar(e) { 3022 e.preventDefault(); 3023 var $snackbar = $(e.target).closest('.snackbar'); 3024 var id = $snackbar.attr('data-snackbar-id'); 3025 api.hide(id); 3026 }, 3027 /** 3028 * Handle action button click 3029 * @param {Event} e - Click event 3030 */ 3031 handleAction: function handleAction(e) { 3032 // Let the link navigate naturally, but close the snackbar 3033 var $snackbar = $(e.target).closest('.snackbar'); 3034 var id = $snackbar.attr('data-snackbar-id'); 3035 3036 // Close after a short delay to allow navigation 3037 setTimeout(function () { 3038 api.hide(id); 3039 }, 100); 3040 }, 3041 /** 3042 * Show success snackbar 3043 * @param {string} message - Message text 3044 * @param {Object} options - Additional options 3045 * @returns {string} The snackbar ID 3046 */ 3047 success: function success(message, options) { 3048 var config = $.extend({}, options, { 3049 type: 'success', 3050 message: message 3051 }); 3052 return api.show(config); 3053 }, 3054 /** 3055 * Show error snackbar 3056 * @param {string} message - Message text 3057 * @param {Object} options - Additional options 3058 * @returns {string} The snackbar ID 3059 */ 3060 error: function error(message, options) { 3061 var config = $.extend({}, options, { 3062 type: 'error', 3063 message: message 3064 }); 3065 return api.show(config); 3066 }, 3067 /** 3068 * Show default snackbar 3069 * @param {string} message - Message text 3070 * @param {Object} options - Additional options 3071 * @returns {string} The snackbar ID 3072 */ 3073 default: function _default(message, options) { 3074 var config = $.extend({}, options, { 3075 type: 'default', 3076 message: message 3077 }); 3078 return api.show(config); 3079 }, 3080 /** 3081 * Show warning snackbar 3082 * @param {string} message - Message text 3083 * @param {Object} options - Additional options 3084 * @returns {string} The snackbar ID 3085 */ 3086 warning: function warning(message, options) { 3087 var config = $.extend({}, options, { 3088 type: 'warning', 3089 message: message 3090 }); 3091 return api.show(config); 3092 }, 3093 /** 3094 * Show info snackbar 3095 * @param {string} message - Message text 3096 * @param {Object} options - Additional options 3097 * @returns {string} The snackbar ID 3098 */ 3099 info: function info(message, options) { 3100 var config = $.extend({}, options, { 3101 type: 'info', 3102 message: message 3103 }); 3104 return api.show(config); 3105 } 3106 }; 3107 return api; 3108}(); 3109 3110// Export a single function for processInclude so it does not execute all API methods 3111module.exports = Snackbar; 3112 3113/***/ }), 3114
3115/***/ "./cartridges/org_marykay/cartridge/client/default/js/components/splitBanner.js": 3116/*!**************************************************************************************!*\ 3117 !*** ./cartridges/org_marykay/cartridge/client/default/js/components/splitBanner.js ***! 3118 \**************************************************************************************/ 3119/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 3120 3121/** 3122 * Split Banner Component JavaScript 3123 * Handles Split Banner functionality - reuses product detail logic for modal features 3124 * Simple wrapper for now, additional logic can be added later 3125 */ 3126 3127var detail = __webpack_require__(/*! ../product/details */ "./cartridges/org_marykay/cartridge/client/default/js/product/details.js"); 3128var splitBanner = detail; 3129 3130// Export initialization function for SFRA processInclude pattern 3131module.exports = function () { 3132 return splitBanner; 3133}; 3134 3135/***/ }), 3136
3137/***/ "./cartridges/org_marykay/cartridge/client/default/js/components/swiper.js": 3138/*!*********************************************************************************!*\ 3139 !*** ./cartridges/org_marykay/cartridge/client/default/js/components/swiper.js ***! 3140 \*********************************************************************************/ 3141/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 3142 3143"use strict"; 3144__webpack_require__.r(__webpack_exports__); 3145/* harmony import */ var swiper_bundle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! swiper/bundle */ "./node_modules/swiper/swiper-bundle.mjs"); 3146 3147var deviceDetection = __webpack_require__(/*! ./deviceDetection */ "./cartridges/org_marykay/cartridge/client/default/js/components/deviceDetection.js"); 3148swiper_bundle__WEBPACK_IMPORTED_MODULE_0__["default"].use([swiper_bundle__WEBPACK_IMPORTED_MODULE_0__.Navigation, swiper_bundle__WEBPACK_IMPORTED_MODULE_0__.Pagination]); 3149 3150/** 3151 * Hides Swiper navigation and pagination if there are fewer slides than slidesPerView. 3152 * @param {Object} e - The Swiper instance. 3153 */ 3154function handleSwiperNavigation(e) { 3155 var realSlides = e.slides.filter(function (slide) { 3156 return !slide.classList.contains('swiper-slide-duplicate'); 3157 }); 3158 if (e.params.slidesPerView >= realSlides.length) { 3159 if (e.navigation && e.navigation.nextEl) { 3160 $(e.navigation.nextEl).addClass('swiper-button-hidden'); 3161 } 3162 if (e.navigation && e.navigation.prevEl) { 3163 $(e.navigation.prevEl).addClass('swiper-button-hidden'); 3164 } 3165 if (e.pagination && e.pagination.el) { 3166 $(e.pagination.el).addClass('swiper-pagination-hidden'); 3167 } 3168 } else { 3169 if (e.navigation && e.navigation.nextEl) { 3170 $(e.navigation.nextEl).removeClass('swiper-button-hidden'); 3171 } 3172 if (e.navigation && e.navigation.prevEl) { 3173 $(e.navigation.prevEl).removeClass('swiper-button-hidden'); 3174 } 3175 if (e.pagination && e.pagination.el) { 3176 $(e.pagination.el).removeClass('swiper-pagination-hidden'); 3177 } 3178 } 3179} 3180 3181/** 3182 * Updates the Swiper instance and its pagination if available. 3183 * 3184 * @param {Object} e - The Swiper instance. 3185 */ 3186function updateSwiperAndPagination(e) { 3187 if (typeof e.update === 'function') { 3188 e.update(); 3189 } 3190 if (e.pagination && typeof e.pagination.render === 'function') { 3191 e.pagination.render(); 3192 if (typeof e.pagination.update === 'function') { 3193 e.pagination.update(); 3194 } 3195 } 3196} 3197 3198/** 3199 * Initializes a Swiper carousel for the promotional section. 3200 * 3201 * This function creates a new Swiper instance targeting the `.swiper-container` element. 3202 * It sets up looping, slide spacing, navigation buttons, and clickable pagination. 3203 * 3204 * Requirements: 3205 * - The Swiper library must be included in the project. 3206 * - The HTML structure must include: 3207 * - A container with class `.swiper-container` 3208 * - Navigation buttons with classes `.swiper-button-next` and `.swiper-button-prev` 3209 * - A pagination element with class `.swiper-pagination` 3210 * 3211 * @function 3212 * @returns {void} 3213 */ 3214function initCarousel() { 3215 var defaultOptions = { 3216 loop: true, 3217 slidesPerView: 1, 3218 navigation: { 3219 nextEl: '.swiper-button-next', 3220 prevEl: '.swiper-button-prev' 3221 }, 3222 pagination: { 3223 el: '.swiper-pagination', 3224 clickable: true 3225 } 3226 }; 3227 var customSlidersList = { 3228 'swiper-promo': { 3229 slidesPerView: 1, 3230 slidesPerScroll: 1, 3231 autoplay: { 3232 delay: 5000 3233 }, 3234 autoHeight: true, 3235 on: { 3236 slideChange: function slideChange() { 3237 if ($('#searchModal').hasClass('show')) { 3238 $('body').trigger('header:updateHeaderOffset', [true]); 3239 } else { 3240 $('body').trigger('header:updateHeaderOffset'); 3241 } 3242 } 3243 } 3244 }, 3245 'swiper-products': { 3246 slidesPerView: 2, 3247 slidesPerScroll: 1, 3248 spaceBetween: 16, 3249 slidesPerGroup: 2, 3250 autoHeight: true, 3251 loop: false, 3252 pagination: { 3253 el: '.swiper-pagination', 3254 dynamicBullets: true, 3255 clickable: true 3256 } 3257 }, 3258 'swiper-cart-recommendations': { 3259 slidesPerView: 4, 3260 slidesPerScroll: 1, 3261 loop: true, 3262 breakpoints: { 3263 0: { 3264 slidesPerView: 2, 3265 slidesPerGroup: 2 3266 }, 3267 768: { 3268 slidesPerView: 4, 3269 slidesPerGroup: 4 3270 } 3271 }, 3272 on: { 3273 // Initial load 3274 init: function init(e) { 3275 handleSwiperNavigation(e); 3276 }, 3277 // Optional but recommended for breakpoint changes 3278 resize: function resize(e) { 3279 handleSwiperNavigation(e); 3280 updateSwiperAndPagination(e); 3281 }, 3282 breakpointChange: function breakpointChange(e) { 3283 handleSwiperNavigation(e); 3284 updateSwiperAndPagination(e); 3285 } 3286 } 3287 }, 3288 'ibc-featured-products-swiper': { 3289 slidesPerView: 2, 3290 slidesPerScroll: 1, 3291 spaceBetween: 16, 3292 slidesPerGroup: 2, 3293 loop: false, 3294 autoHeight: true, 3295 pagination: { 3296 el: '.swiper-pagination', 3297 clickable: true 3298 } 3299 } 3300 }; 3301 $('body').find('.swiper-container, .swiper').each(function () { 3302 var $el = $(this); 3303 var matchedClass = null; 3304 $.each(customSlidersList, function (className) { 3305 if ($el.hasClass(className)) { 3306 matchedClass = className; 3307 return false;
3308 } 3309 return true; 3310 }); 3311 var options = matchedClass ? $.extend(true, {}, defaultOptions, customSlidersList[matchedClass]) : defaultOptions; 3312 3313 // Special handling: for the IBC featured-products slider we want 3314 // a static grid on desktop and a Swiper carousel on mobile/tablet. 3315 // Initialize/destroy Swiper responsively using device detection. 3316 if (matchedClass === 'ibc-featured-products-swiper') { 3317 var swiperInstance = null; 3318 var initOrDestroy = function initOrDestroy() { 3319 var isMobileView = deviceDetection.isPhone(); 3320 if (isMobileView && !swiperInstance) { 3321 // initialize Swiper for mobile/tablet 3322 swiperInstance = new swiper_bundle__WEBPACK_IMPORTED_MODULE_0__["default"]($el[0], options); // eslint-disable-line 3323 $el.data('swiperInstance', swiperInstance); 3324 } else if (!isMobileView && swiperInstance) { 3325 // destroy Swiper for desktop so markup becomes a static grid 3326 try { 3327 swiperInstance.destroy(true, true); 3328 } catch (e) { 3329 // ignore 3330 } 3331 swiperInstance = null; 3332 $el.removeData('swiperInstance'); 3333 } 3334 }; 3335 3336 // Run once to set initial state 3337 initOrDestroy(); 3338 3339 // Debounced resize handler 3340 var resizeTimeout = null; 3341 var onResize = function onResize() { 3342 if (resizeTimeout) { 3343 clearTimeout(resizeTimeout); 3344 } 3345 resizeTimeout = setTimeout(function () { 3346 initOrDestroy(); 3347 }, 150); 3348 }; 3349 $(window).on('resize', onResize); 3350 } else { 3351 new swiper_bundle__WEBPACK_IMPORTED_MODULE_0__["default"]($el[0], options); // eslint-disable-line 3352 } 3353 }); 3354} 3355/* harmony default export */ __webpack_exports__["default"] = (initCarousel); 3356 3357/***/ }), 3358
3359/***/ "./cartridges/org_marykay/cartridge/client/default/js/components/tray.js": 3360/*!*******************************************************************************!*\ 3361 !*** ./cartridges/org_marykay/cartridge/client/default/js/components/tray.js ***! 3362 \*******************************************************************************/ 3363/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 3364 3365var formFields = __webpack_require__(/*! ../formFields/formFields */ "./cartridges/org_marykay/cartridge/client/default/js/formFields/formFields.js"); 3366var gtm = __webpack_require__(/*! googletagmanager/tagManager */ "./cartridges/int_googletags/cartridge/client/default/js/tagManager.js"); 3367 3368/** 3369* Calculates the width of the browser scrollbar. 3370* 3371* @returns {number} The width of the scrollbar in pixels. 3372*/ 3373function getScrollbarWidth() { 3374 return window.innerWidth - document.documentElement.clientWidth; 3375} 3376 3377/** 3378* Removes focus trap event listeners from the modal. 3379* 3380* @param {JQuery<HTMLElement>} $trayPopup - The tray modal element. 3381*/ 3382function removeFocusTrap($trayPopup) { 3383 var handler = $trayPopup.data('focusTrapHandler'); 3384 if (handler) { 3385 $(document).off('keydown', handler); 3386 $trayPopup.removeData('focusTrapHandler'); 3387 } 3388} 3389 3390/** 3391* Keeps trigger expanded state synchronized with tray visibility when supported. 3392* 3393* @param {HTMLElement} triggerElement - The element used to open the tray. 3394* @param {boolean} isExpanded - Whether the tray is expanded/open. 3395*/ 3396function setTriggerExpandedState(triggerElement, isExpanded) { 3397 if (!triggerElement || !triggerElement.setAttribute || !triggerElement.getAttribute) { 3398 return; 3399 } 3400 if (triggerElement.getAttribute('aria-expanded') !== null) { 3401 triggerElement.setAttribute('aria-expanded', isExpanded ? 'true' : 'false'); 3402 } 3403} 3404 3405/** 3406* Creates the tray modal and backdrop if they don't exist. 3407* 3408* @param {string} trayId - Unique tray ID (string or number). 3409* @param {string} customClassName - Optional custom class for tray modal. 3410* @param {string} ariaLabel - Optional accessible label for the dialog. 3411* @returns {JQuery<HTMLElement>} The jQuery object of the tray modal. 3412*/ 3413function getOrCreateTrayPopup(trayId) { 3414 var customClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 3415 var ariaLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; 3416 var traySelector = "#tray-modal-".concat(trayId); 3417 var $trayPopup = $(traySelector); 3418 if (!$trayPopup.length) { 3419 var $backdrop = $("<div class=\"tray-modal-backdrop tray-modal-backdrop-".concat(trayId, "\"></div>")); 3420 var labelAttr = ariaLabel ? " aria-label=\"".concat(ariaLabel, "\"") : ''; 3421 $trayPopup = $("\n <div id=\"tray-modal-".concat(trayId, "\" class=\"tray-modal ").concat(customClassName, "\" role=\"dialog\" aria-modal=\"true\"").concat(labelAttr, ">\n <div class=\"tray-modal-content\"></div>\n </div>\n ")); 3422 $('body').append($backdrop, $trayPopup); 3423 } else if (ariaLabel && !$trayPopup.attr('aria-label')) { 3424 $trayPopup.attr('aria-label', ariaLabel); 3425 } 3426 return $trayPopup; 3427} 3428 3429/** 3430* Sets an accessible name for the tray modal. 3431* Uses an in-tray title first, then falls back to the trigger label/text. 3432* 3433* @param {JQuery<HTMLElement>} $trayPopup - The tray modal element. 3434* @param {HTMLElement} triggerElement - The element that opened the tray modal. 3435*/ 3436function setTrayAccessibleName($trayPopup, triggerElement) { 3437 var trayPopupId = $trayPopup.attr('id'); 3438 var $trayTitle = $trayPopup.find('.mk-mini-cart__title').length > 0 ? $trayPopup.find('.mk-mini-cart__title').first() : $trayPopup.find('.js-tray-modal-title').first(); 3439 if ($trayTitle.length > 0 && $trayTitle.text().trim().length > 0) { 3440 if (!$trayTitle.attr('id')) { 3441 $trayTitle.attr('id', "".concat(trayPopupId, "-title")); 3442 } 3443 $trayPopup.attr('aria-labelledby', $trayTitle.attr('id')); 3444 $trayPopup.removeAttr('aria-label'); 3445 return; 3446 } 3447 var triggerLabel = triggerElement.getAttribute('aria-label'); 3448 var triggerText = $(triggerElement).text().replace(/\s+/g, ' ').trim(); 3449 var fallbackLabel = triggerLabel || triggerText || 'Dialog'; 3450 $trayPopup.removeAttr('aria-labelledby'); 3451 $trayPopup.attr('aria-label', fallbackLabel); 3452} 3453 3454/** 3455* Displays the tray modal with a slight delay and handles body scroll lock. 3456* 3457* @param {JQuery<HTMLElement>} $trayPopup - The tray modal DOM element. 3458*/ 3459function showPopupWithDelay($trayPopup) { 3460 $trayPopup.addClass('tray-popup-visible'); 3461 var trayId = $trayPopup.attr('id').replace('tray-modal-', ''); 3462 $(".tray-modal-backdrop-".concat(trayId)).addClass('tray-popup-visible'); 3463 var scrollbarWidth = getScrollbarWidth(); 3464 document.documentElement.style.setProperty('--tray-popup-visible', "".concat(scrollbarWidth + 15, "px"));
3465 var $trayPopupContent = $trayPopup.find('.js-custom-tray-content:not(.d-none)'); 3466 if ($trayPopupContent.length > 0) { 3467 $('body').trigger('tray:adjustHeight', [$trayPopupContent]); 3468 } else { 3469 $('body').trigger('tray:adjustHeight', [$trayPopup]); 3470 } 3471 $('body').addClass('modal-open'); 3472} 3473 3474/** 3475* Closes the tray modal with transition and removes it from the DOM. 3476* Also restores focus to the element that opened the modal. 3477* 3478* @param {JQuery<HTMLElement>} $trayPopup - The tray modal element. 3479*/ 3480function closePopup($trayPopup) { 3481 var trayId = $trayPopup.attr('id').replace('tray-modal-', ''); 3482 $trayPopup.removeClass('tray-popup-visible'); 3483 $(".tray-modal-backdrop-".concat(trayId)).removeClass('tray-popup-visible'); 3484 3485 // Remove focus trap 3486 removeFocusTrap($trayPopup); 3487 3488 // Restore focus to the element that opened the modal 3489 var previousFocus = $trayPopup.data('previousFocus'); 3490 setTriggerExpandedState(previousFocus, false); 3491 if (previousFocus && previousFocus.focus && document.contains(previousFocus)) { 3492 setTimeout(function () { 3493 previousFocus.focus(); 3494 }, 150); 3495 } 3496 3497 // Clear the stored focus reference to prevent memory leaks 3498 $trayPopup.removeData('previousFocus'); 3499 3500 // A360SFCC-3382 ensure we don't keep old bind to stop multiple 'closePopup' calls 3501 $('body').off('click touchstart', ".tray-modal-backdrop-".concat(trayId)); 3502 setTimeout(function () { 3503 var $modals = $('.modal.show'); 3504 if ($modals.length === 0 && $('body').find('.tray-popup-visible:not(".tray-modal-backdrop")').length === 0) { 3505 $('body').removeClass('modal-open'); 3506 } 3507 if (!$trayPopup.hasClass('tray-popup-visible')) { 3508 $(".tray-modal-backdrop-".concat(trayId)).remove(); 3509 $trayPopup.remove(); 3510 } 3511 $('body').trigger('tray:closed', $trayPopup); 3512 }, 100); 3513} 3514 3515/** 3516* Sets up focus trap within the modal for accessibility. 3517* Ensures tab navigation cycles within the modal (from last to first and vice versa). 3518* 3519* @param {JQuery<HTMLElement>} $trayPopup - The tray modal DOM element. 3520*/ 3521function setupFocusTrap($trayPopup) { 3522 var focusableSelector = 'button:not([disabled]), [href]:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])'; 3523 var handleKeyDown = function handleKeyDown(e) { 3524 // Only handle if this modal is visible 3525 if (!$trayPopup.hasClass('tray-popup-visible')) { 3526 return; 3527 } 3528 if (e.key === 'Escape' || e.keyCode === 27 || e.which === 27) { 3529 // Don't close tray if a Bootstrap modal is currently open inside it 3530 var $openBootstrapModal = $('.modal.show'); 3531 if ($openBootstrapModal.length > 0) { 3532 // Let Bootstrap handle the ESC key for its modal 3533 return; 3534 } 3535 3536 // Check if we're in disconnect modal view 3537 var $disconnectModal = $trayPopup.find('.ibc-consultant-disconnect-modal-content'); 3538 if ($disconnectModal.length > 0 && !$disconnectModal.hasClass('d-none')) { 3539 // Trigger the cancel button to go back to card list 3540 e.preventDefault(); 3541 var $disconnectTrigger = $trayPopup.find('.js-disconnect-cancel-btn'); 3542 if ($disconnectTrigger.length > 0) { 3543 $disconnectTrigger.first().trigger('click'); 3544 } 3545 return; 3546 } 3547 e.preventDefault(); 3548 closePopup($trayPopup); 3549 return; 3550 } 3551 if (e.key === 'Tab' || e.keyCode === 9) { 3552 var $focusableElements = $trayPopup.find(focusableSelector).filter(':visible').not('[tabindex="-1"]'); 3553 if ($focusableElements.length === 0) { 3554 return; 3555 } 3556 var firstElement = $focusableElements[0]; 3557 var lastElement = $focusableElements[$focusableElements.length - 1]; 3558 // Shift + Tab (backwards) 3559 if (e.shiftKey) { 3560 if (document.activeElement === firstElement) { 3561 e.preventDefault(); 3562 lastElement.focus(); 3563 } 3564 } else if (document.activeElement === lastElement) { 3565 // Tab (forwards) 3566 e.preventDefault(); 3567 firstElement.focus(); 3568 } 3569 } 3570 }; 3571 $trayPopup.data('focusTrapHandler', handleKeyDown); 3572 $(document).on('keydown', handleKeyDown); 3573} 3574 3575/** 3576* Initializes accessibility features for the modal after content is loaded. 3577* 3578 * @param {JQuery<HTMLElement>} $trayPopup - The tray modal DOM element. 3579 * @param {HTMLElement} triggerElement - The element that triggered the tray open. 3580*/ 3581function initializeAccessibility($trayPopup, triggerElement) { 3582 var focusableSelector = 'button:not([disabled]), [href]:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not
3582([tabindex="-1"]):not([disabled])'; 3583 var previousFocusElement = triggerElement || document.activeElement; 3584 3585 // Always store the current active element (the trigger) for focus restoration 3586 $trayPopup.data('previousFocus', previousFocusElement); 3587 3588 // Set focus to the first focusable element (close button) after modal is visible 3589 setTimeout(function () { 3590 var $closeButton = $trayPopup.find('.tray-popup-close').first(); 3591 var $focusableElements = $trayPopup.find(focusableSelector).filter(':visible'); 3592 if ($focusableElements.length > 0) { 3593 var firstElement = $focusableElements[0]; 3594 firstElement.focus(); 3595 } else if ($closeButton.length > 0) { 3596 $closeButton[0].focus(); 3597 } 3598 }, 300); 3599 3600 // Remove any existing focus trap to prevent duplicate handlers 3601 removeFocusTrap($trayPopup); 3602 3603 // Add focus trap 3604 setupFocusTrap($trayPopup); 3605} 3606 3607/** 3608* Binds click events to close the tray modal. 3609* 3610* @param {JQuery<HTMLElement>} $trayPopup - The tray modal DOM element. 3611*/ 3612function attachPopupCloseEvents($trayPopup) { 3613 var trayId = $trayPopup.attr('id').replace('tray-modal-', ''); 3614 $trayPopup.off('click.trayClose', '.tray-popup-close').on('click.trayClose', '.tray-popup-close', function (e) { 3615 e.preventDefault(); 3616 3617 // Keep propagation for IBC filter "Show Results" so body-level filter handlers still run. 3618 if (!$(e.currentTarget).hasClass('show-results-btn')) { 3619 e.stopPropagation(); 3620 } 3621 var $currentTrayPopup = $(e.currentTarget).closest('.tray-modal'); 3622 closePopup($currentTrayPopup.length ? $currentTrayPopup : $trayPopup); 3623 }); 3624 $('body').off('click.trayClose touchstart.trayClose', ".tray-modal-backdrop-".concat(trayId)).on('click.trayClose touchstart.trayClose', ".tray-modal-backdrop-".concat(trayId), function (e) { 3625 e.stopPropagation(); 3626 closePopup($trayPopup); 3627 }); 3628 if ($trayPopup.find('[data-tray-modal="modal"][data-ajax-content]').length > 0) { 3629 initTray(); // eslint-disable-line 3630 } 3631} 3632 3633/** 3634* Handles tray modal logic for both AJAX and static content. 3635* 3636* @param {Event} e - Click event 3637*/ 3638function showTrayPopUp(e) { 3639 e.preventDefault(); 3640 e.stopPropagation(); 3641 var link = e.currentTarget; 3642 var contentUrl = link.dataset.ajaxContent; 3643 var $card = $(link).closest('.ibc-card-container'); 3644 var customClassName = link.dataset.classnames; 3645 var isAjax = contentUrl !== 'false'; 3646 var slotNumber = $card.index() + 1; // +1 so first card = slot 1 3647 var trayId = link.dataset.trayId || 'default'; // new attribute 3648 var ariaLabel = link.getAttribute('aria-label') || link.getAttribute('title') || ''; 3649 var $trayPopup = getOrCreateTrayPopup(trayId, customClassName, ariaLabel); 3650 var $trayModalContent = $trayPopup.find('.tray-modal-content'); 3651 $trayModalContent.empty(); 3652 if (isAjax) { 3653 $.ajax({ 3654 url: contentUrl, 3655 method: 'GET', 3656 success: function success(data) { 3657 var contentHtml; 3658 var htmlRegex = /<[^>]+>/; 3659 if (!htmlRegex.test(data) && !data.success) { 3660 window.location.reload(); 3661 return; 3662 } 3663 contentHtml = htmlRegex.test(data) ? data : data.renderedTemplate; 3664 $trayModalContent.empty().append(contentHtml); 3665 setTrayAccessibleName($trayPopup, link); 3666 showPopupWithDelay($trayPopup); 3667 attachPopupCloseEvents($trayPopup); 3668 setTriggerExpandedState(link, true); 3669 initializeAccessibility($trayPopup, link); 3670 $('body').trigger('initFloatLabels'); 3671 formFields.updateSelect(); 3672 3673 // Trigger custom event with customClassName 3674 $('body').trigger('trayModalOpened', { 3675 customClassName: customClassName 3676 }); 3677 if (customClassName && customClassName.includes('search-ibc-profile-tray')) { 3678 gtm.viewProfileSelect(data, slotNumber); 3679 } 3680 if (customClassName && customClassName.includes("mini-cart-tray")) { 3681 gtm.openMinicart(); 3682 } 3683 }, 3684 error: function error(_error) { 3685 console.error('Tray Modal AJAX failure :(', _error); // eslint-disable-line no-console 3686 } 3687 }); 3688 } else { 3689 var $defaultContent = $(link).closest('.default-tray').find('.default-tray-content'); 3690 if ($defaultContent.length) { 3691 $trayModalContent.empty().append($defaultContent.html()); 3692 setTrayAccessibleName($trayPopup, link); 3693 showPopupWithDelay($trayPopup); 3694 attachPopupCloseEvents($trayPopup); 3695 setTriggerExpandedState(link, true); 3696 initializeAccessibility($trayPopup, link); 3697 $('body').trigger('ibcSearchFilterIdUpdate'); 3698 $('body').trigger('ibcSearchFilterRetainValues'); 3699 3700 // Trigger custom event with customClassName 3701 $('body').trigger('trayModalOpened', { 3702 customClassName: customClassName 3703 }); 3704 } 3705 } 3706 $('button[data-toggle="tooltip"]').tooltip(); 3707} 3708 3709/** 3710* to initialize the tray 3711*/ 3712function initTray() { 3713 $('[data-tray-modal="modal"][data-ajax-content]').each(function () { 3714 var $trigger = $(this); 3715 var tagName = ($trigger.prop('tagName') || '').toLowerCase(); 3716 var isNativeInteractive = tagName === 'a' || tagName === 'button' || tagName === 'input'; 3717 var hasPopupType = $trigger.attr('aria-haspopup'); 3718 if (!hasPopupType || hasPopupType === 'true') { 3719 $trigger.attr('aria-haspopup', 'dialog'); 3720 } 3721 if (!isNativeInteractive) { 3722 if (!$trigger.attr('role')) { 3723 $trigger.attr('role', 'button'); 3724 } 3725 if (!$trigger.attr('tabindex')) { 3726 $trigger.attr('tabindex', '0'); 3727 } 3728 } 3729 $trigger.off('click.tray').on('click.tray', function (e) { 3730 return showTrayPopUp(e); 3731 }); 3732 if (!isNativeInteractive) { 3733 $trigger.off('keydown.tray').on('keydown.tray', function (e) { 3734 if (e.which === 13 || e.which === 32) { 3735 e.preventDefault(); 3736 showTrayPopUp(e); 3737 } 3738 }); 3739 } else { 3740 $trigger.off('keydown.tray'); 3741 } 3742 }); 3743} 3744module.exports = { 3745 InitTrayModal: function InitTrayModal() { 3746 initTray(); 3747 var params = new URLSearchParams(window.location.search); 3748 if (params.get('open') === 'emailsignup') { 3749 var $emailSignupLink = $('[data-ajax-content*="EmailSignup-Show"]'); 3750 if ($emailSignupLink.length > 0) { 3751 $emailSignupLink.trigger('click'); 3752 } 3753 } 3754 $('body').on('tray:adjustHeight', function (e, $trayPopup) { 3755 var trayHeaderHeight = $trayPopup.find('.tray-header').outerHeight(true) || 0; 3756 var trayFooterHeight = $trayPopup.find('.tray-footer').outerHeight(true) || 0; 3757 if ($trayPopup.hasClass('email-signup-tray')) { 3758 trayFooterHeight = $trayPopup.find('.email-signup-tray__footer').outerHeight(true) || 0; 3759 } 3760 var trayHeaderFooterTotal = trayHeaderHeight + trayFooterHeight; 3761 document.documentElement.style.setProperty('--tray-offset-height', "".concat(trayHeaderFooterTotal, "px")); 3762 $trayPopup.find('.ibc-user-contact').css('height', "calc(100dvh - ".concat(trayHeaderFooterTotal, "px)")); 3763 }); 3764 } 3765}; 3766 3767/***/ }), 3768
3769/***/ "./cartridges/org_marykay/cartridge/client/default/js/formFields/formFields.js": 3770/*!*************************************************************************************!*\ 3771 !*** ./cartridges/org_marykay/cartridge/client/default/js/formFields/formFields.js ***! 3772 \*************************************************************************************/ 3773/***/ (function(module) { 3774 3775"use strict"; 3776 3777 3778// eslint-disable-line 3779 3780/** 3781 * Converting the default select dropdown to unorder list HTML structure. 3782 */ 3783function updateSelect() { 3784 $('.custom-select:not(select)').each(function () { 3785 var $this = $(this); 3786 if ($this.find('.selected-option').length === 0) { 3787 $this.append('<div class="selected-option"></div>'); 3788 } 3789 if ($this.find('.selection-list').length === 0) { 3790 $this.append('<ul class="selection-list"></ul>'); 3791 } else { 3792 $this.find('.selection-list').empty(); 3793 } 3794 var $list = ''; 3795 $this.find('option').each(function () { 3796 var $listClass = ''; 3797 if ($(this).attr('class') && $(this).attr('class') !== undefined && $(this).attr('class') !== '') { 3798 $listClass += $(this).attr('class'); 3799 } 3800 if ($(this).attr('disabled') === 'disabled') { 3801 $listClass += ' option-disabled'; 3802 } 3803 $list += '<li label="' + $(this).text().trim().toLocaleLowerCase() + '" class="' + $listClass + '">' + $(this).text() + '</li>'; 3804 }); 3805 $this.find('.selection-list').append($list); 3806 var $selectedOptionText = $this.find('select option:selected').text(); 3807 $this.find('.selected-option').text($selectedOptionText); 3808 $this.find('.selection-list li').removeClass('selected').removeClass('hover').eq($(this).find('select option:selected').index()).addClass('selected'); 3809 if ($(this).find('select option:selected').val() !== '') { 3810 $this.find('.selected-option').addClass('selected'); 3811 if ($(this).hasClass('birth-month')) { 3812 $this.find('.field-help-text').addClass('d-none'); 3813 } 3814 } else { 3815 $this.find('.selected-option').removeClass('selected'); 3816 if ($(this).hasClass('birth-month')) { 3817 $this.find('.field-help-text').removeClass('d-none'); 3818 } 3819 } 3820 if ($this.find('.selection-list li .bold').length > 0) { 3821 $this.find('.selected-option').html($this.find('.selection-list li').eq($this.find('select option:selected').index()).html()); 3822 } 3823 $this.find('li').removeClass('selected'); 3824 $this.find('li').eq($(this).find('select option:selected').index()).addClass('selected'); 3825 $this.find('.invalid-feedback').appendTo(this); 3826 if ($this.find('.field-help-text').length > 0) { 3827 $this.find('.field-help-text').appendTo(this); 3828 } 3829 if ($this.find('select').is(':disabled')) { 3830 $this.addClass('disabled'); 3831 } else { 3832 $this.removeClass('disabled'); 3833 } 3834 }); 3835} 3836 3837/** Scrolls the container so that the item is fully visible within the container's viewport, if it is not already. 3838 * @param {jQuery} $container - The scrollable container element. 3839 * @param {jQuery} $item - The item element to ensure visibility of. 3840 */ 3841function ensureItemVisible($container, $item) { 3842 if (!$container.length || !$item.length) return; 3843 // Absolute coordinates 3844 var containerTop = $container.offset().top; 3845 var containerHeight = $container.innerHeight(); 3846 var scrollTop = $container.scrollTop(); 3847 var itemTopAbs = $item.offset().top; 3848 var itemBottomAbs = itemTopAbs + $item.outerHeight(); 3849 // Convert absolute → container scroll coordinates 3850 var itemTop = itemTopAbs - containerTop + scrollTop; 3851 var itemBottom = itemBottomAbs - containerTop + scrollTop; 3852 // Visibility window 3853 var viewTop = scrollTop; 3854 var viewBottom = scrollTop + containerHeight; 3855 if (itemTop < viewTop) { 3856 // Scroll up so the item’s top aligns with the container’s top 3857 $container.scrollTop(itemTop); 3858 } else if (itemBottom > viewBottom) { 3859 // Scroll down so the item’s bottom aligns with the container’s bottom 3860 $container.scrollTop(itemBottom - containerHeight); 3861 } 3862} 3863 3864/** Toggles the dropdown open/close when clicking or keypressing on the selected option, and sets the dropdown height and scroll position. 3865 * @remarks Only operates on custom-select wrapper elements that are not a native <select>, to avoid affecting templates where the <select> itself has class="custom-select". 3866 * @param {jQuery} $selectedOption - The selected option element that was clicked or keypressed. 3867 * @param {boolean} [closeOnly=false] - Optional flag to indicate that the dropdown should only be closed, not toggled open if it is currently closed. 3868 * @returns {boolean} True if the dropdown was toggled; otherwise, false if the click or keypress should not toggle the dropdown (e.g. when clicking on a disabled select). 3869 */ 3870function toggleCustomSelect($selectedOption) { 3871 var closeOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3872 if (!$selectedOption.length) return false; 3873 var $selected = $selectedOption.eq(0); 3874 if ($selected.siblings('select').is(':disabled')) { 3875 return false; 3876 } 3877 var $customSelect = $selected.closest('.custom-select:not(select)'); 3878 var $selectedOuterHeight = $selected.outerHeight(); 3879 var $selectionList = $selected.siblings('.selection-list'); 3880 3881 // Close any other open dropdowns before toggling the current one, and remove hover state from their options 3882 var $otherCustomSelects = $('.custom-select:not(select)').not($customSelect); 3883 if ($otherCustomSelects.length > 0) { 3884 $otherCustomSelects.removeClass('current-item'); 3885 $otherCustomSelects.find('li').removeClass('hover'); 3886 } 3887 if (closeOnly) { 3888 $customSelect.removeClass('current-item'); 3889 } else { 3890 $customSelect.toggleClass('current-item'); 3891 } 3892 var $optionSelected = $customSelect.find('select option:selected'); 3893 var $optionSelectedIndex = $optionSelected.length > 0 ? $optionSelected.index() : -1; 3894 3895 // If the dropdown is closed after toggling, restore the selected item in the .selection-list and exit 3896 if (!$customSelect.hasClass('current-item')) { 3897 $customSelect.find('li').removeClass('hover'); 3898 // Restore the selected item in the dropdown list based on the current selected option in the native select element, 3899 // in case it was changed while the dropdown was open 3900 if ($optionSelectedIndex >= 0) { 3901 $selectionList.children('li').eq($optionSelectedIndex).addClass('selected'); 3902 } 3903 return true; 3904 } 3905 3906 // Position the selection list right below the selected option and set its height and scroll position 3907 $selectionList.css('top', $selectedOuterHeight + 2); 3908 var $items = $selectionList.children('li:visible'); 3909 if ($items.length > 10) { 3910 // Set the selection list height to the height of first 10 items 3911 var visibleWindowHeight = $items.slice(0, 10).toArray().reduce(function (sum, li) { 3912 return sum + $(li).outerHeight(); 3913 }, 0); 3914 $selectionList.height(visibleWindowHeight); 3915 // Scroll so selected item is visible 3916 var _$selectedLi = $items.filter('.selected').first(); 3917 if (_$selectedLi.length) { 3918 // Sum heights of all items before the selected one 3919 var offset = 0; 3920 var selectedIndex = $items.index(_$selectedLi); 3921 if (selectedIndex > 0) { 3922 offset = $items.slice(0, selectedIndex - 1).toArray().reduce(function (sum, li) { 3923 return sum + $(li).outerHeight(); 3924 }, 0); 3925 } 3926 $selectionList.scrollTop(offset); 3927 } 3928 } else { 3929 $selectionList.height('auto'); 3930 $selectionList.scrollTop(0); 3931 } 3932 3933 // Set hover state on the selected item in the dropdown list based on the current selected option in the native select element, 3934 // and ensure it is visible in the dropdown list 3935 $selectionList.children('li').removeClass('hover selected'); 3936 if ($optionSelectedIndex >= 0) { 3937 var $selectedLi = $selectionList.children('li').eq($optionSelectedIndex); 3938 $selectedLi.addClass('hover'); 3939 ensureItemVisible($selectionList, $selectedLi); 3940 } 3941 return true; 3942} 3943 3944/** 3945 * Aligns the native select left position depending on platform (Mac vs others). 3946 * @param {boolean} isMac - True when running on a Mac/iOS platform. 3947 */ 3948function syncNativeSelectLeft(isMac) { 3949 var left = isMac ? '0px' : '-9999px'; 3950 $('.custom-select:not(select)').find('select').css({ 3951 /* eslint-disable */ 3952 left: left 3953 /* eslint-enable */ 3954 }); 3955} 3956 3957/** Schedules a hover reset by removing hover from the "from" element and adding it back to the "to" element after a short delay. 3958 * @remarks When a user is hovering a list item and presses a navigation key, it briefly reverts hover to the original item. This prevents skipping items if another navigation key is pressed before the hover reset finishes. 3959 * @param {jQuery} $from - The element to remove hover from. 3960 * @param {jQuery} $to - The element to add hover back to. 3961 * @param {function} setIgnoring - A callback function to set whether navigation keypresses should be ignored during the hover reset delay. 3962 */ 3963function scheduleHoverReset($from, $to, setIgnoring) { 3964 setIgnoring(true); 3965 setTimeout(function () { 3966 $from.removeClass('hover'); 3967 $to.addClass('hover'); 3968 setIgnoring(false); 3969 }, 100); 3970} 3971 3972/** 3973 * Determine whether pointer interaction should move focus to the hidden n
3973ative select. 3974 * iPhone/iPad Safari zooms when a small hidden select receives focus from a tap, so skip 3975 * the programmatic focus for iOS touch interactions and keep keyboard focus behavior elsewhere. 3976 * 3977 * @returns {boolean} True when pointer interaction should focus the native select. 3978 */ 3979function shouldFocusNativeSelectOnPointerDown() { 3980 var isIOSDevice = /iPad|iPhone|iPod/.test(navigator.userAgent); 3981 var isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0; 3982 return !(isIOSDevice && isTouchDevice); 3983} 3984module.exports = { 3985 updateSelect: updateSelect, 3986 selectbox: function selectbox() { 3987 this.updateSelect(); 3988 var $lastMouseDownCustomSelect = null; 3989 var ignoreNavigationKeypressesDuringListItemHoverReset = false; 3990 $(document).on('mousedown', function (e) { 3991 $lastMouseDownCustomSelect = null; 3992 var $target = $(e.target); 3993 if ($target.is(':disabled')) { 3994 return; 3995 } 3996 var $customSelect = $target.closest('.custom-select:not(select)'); 3997 if ($customSelect.length === 0) { 3998 return; 3999 } 4000 var $selected = $target.closest('.selected-option'); 4001 var $optionArea = $target.closest('.selection-list li'); 4002 var isSelectedClicked = $selected.length > 0 && $.contains($customSelect[0], $selected[0]); 4003 var isOptionAreaClicked = $optionArea.length > 0 && $.contains($customSelect[0], $optionArea[0]); 4004 if (isSelectedClicked || isOptionAreaClicked) { 4005 if (shouldFocusNativeSelectOnPointerDown()) { 4006 // Prevent focus loss when pressing and holding mouse button on dropdown 4007 e.preventDefault(); 4008 $customSelect.find('select').focus(); 4009 // Store the custom select that was clicked, to prevent its select element from losing focus on blur 4010 $lastMouseDownCustomSelect = $customSelect; 4011 } 4012 } 4013 }).on('blur', '.custom-select select', function () { 4014 var $this = $(this); 4015 var $customSelect = $this.parent().closest('.custom-select'); 4016 // Prevent select from losing focus when dropdown is open for the same instance 4017 if ($customSelect.hasClass('current-item') && $lastMouseDownCustomSelect && $customSelect.is($lastMouseDownCustomSelect)) { 4018 setTimeout(function () { 4019 $this.focus(); 4020 }, 0); 4021 } 4022 }).on('click', '.selected-option', function () { 4023 window.$currentkeycode = ''; 4024 var isToggled = toggleCustomSelect($(this)); 4025 return !isToggled; 4026 }).on('mouseenter', '.selection-list li', function () { 4027 var $this = $(this); 4028 if ($this.hasClass('option-disabled')) { 4029 return false; 4030 } 4031 // Ensure the item selected after any keypress that changes the selection is visible before applying hover to the item under the mouse 4032 var $selectionList = $this.parent(); 4033 var $selectedLi = $selectionList.children('li.selected').first(); 4034 if ($selectedLi.length > 0 && $selectedLi.index() !== $this.index()) { 4035 ensureItemVisible($selectionList, $selectedLi); 4036 } 4037 $this.siblings().addBack().removeClass('hover selected'); 4038 $this.addClass('hover'); 4039 return true; 4040 }).on('click', '.selection-list li', function () { 4041 var $this = $(this); 4042 var $customSelect = $this.closest('.custom-select:not(select)'); 4043 if (($customSelect.find('#billingAddressSelector').length >= 1 && $customSelect.find('select option').eq($this.index()).attr('value')) === $customSelect.find('.selected-option.selected').attr('value')) { 4044 $customSelect.removeClass('current-item'); // the same option is selected, just close the dropdown 4045 return false; 4046 } 4047 if ($customSelect.find('#billingAddressSelector').length < 1 && $customSelect.find('select option').eq($this.index()).text() === $customSelect.find('.selected-option.selected').text()) { 4048 $customSelect.removeClass('current-item'); // the same option is selected, just close the dropdown 4049 return false; 4050 } 4051 if ($this.hasClass('option-disabled')) { 4052 return false; 4053 } 4054 $customSelect.find('li').removeClass('hover selected'); 4055 $this.addClass('selected'); 4056 $customSelect.find('select option').eq($this.index()).prop('selected', true); 4057 $customSelect.find('.selected-option').text($this.text()); 4058 $customSelect.removeClass('current-item'); 4059 $customSelect.find('select').trigger('change'); 4060 if ($customSelect.find('.selected-option').text().trim() === '') { 4061 $customSelect.find('label').removeClass('input-focus'); 4062 } else { 4063 $customSelect.find('label:not(".input-focus")').addClass('input-focus'); 4064 } 4065 return true; 4066 }).on('change input', 'select', function () { 4067 updateSelect(); 4068 }); 4069 $(document).on('click', function (e) { 4070 var $target = $(e.target); 4071 var $customSelects = $('.custom-select.current-item:not(select)'); 4072 $customSelects.each(function () { 4073 var $customSelect = $(this); 4074 if (!$customSelect.is($target) && !$customSelect.find('*').is($target)) { 4075 toggleCustomSelect($customSelect.find('.selected-option'), true); 4076 } 4077 }); 4078 }); 4079 $('body').off('keydown.formFields').on('keydown.formFields', function (e) { 4080 $lastMouseDownCustomSelect = null; 4081 /* eslint-disable */ 4082 var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; 4083 var $activeCustomSelect = $('.custom-select.current-item:not(select)'); 4084 var $mac = navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i) ? true : false;
4085 /* eslint-enable */ 4086 var isCustomSelectToggled = false; 4087 var isPrintableCharKey = key >= 48 && key <= 90; // Alphanumeric keys only 4088 4089 if ($activeCustomSelect.length > 0) { 4090 $activeCustomSelect.find('select').focus(); 4091 $activeCustomSelect.addClass('current-item'); 4092 var $selectionList = $activeCustomSelect.find('.selection-list'); 4093 var $list = $activeCustomSelect.find('li'); 4094 var $selectedLi = $activeCustomSelect.find('li.selected'); 4095 var $activeLi; 4096 if (typeof window.$currentkeycode !== 'string') { 4097 window.$currentkeycode = ''; 4098 } 4099 if (key === 8) { 4100 // Delete key 4101 window.$currentkeycode = window.$currentkeycode.slice(0, -1); 4102 } else if (isPrintableCharKey) { 4103 window.$currentkeycode += $.trim(String.fromCharCode(key).toLowerCase()); 4104 } 4105 $activeLi = $activeCustomSelect.find('li[label^="' + window.$currentkeycode + '"]'); 4106 if (isPrintableCharKey && $activeLi.length === 0) { 4107 window.$currentkeycode += $.trim(String.fromCharCode(key)); 4108 window.$currentkeycode = window.$currentkeycode.substr(window.$currentkeycode.length - 1, 1); 4109 $activeLi = $activeCustomSelect.find('li[label^="' + window.$currentkeycode + '"]'); 4110 } 4111 if (key === 40 || key === 35 || key === 34) { 4112 // Down or End or Page Down key 4113 if (ignoreNavigationKeypressesDuringListItemHoverReset) { 4114 return false; 4115 } 4116 $activeLi = $activeCustomSelect.find('li.hover'); 4117 if ($activeLi.length === 0 && $selectedLi.length > 0) { 4118 $activeLi = $selectedLi; 4119 } 4120 var $nextLi = $activeLi.next(); 4121 if ($nextLi.length > 0) { 4122 $activeLi.siblings().addBack().removeClass('hover selected'); 4123 var $subsequentLi = key === 40 ? $nextLi : $activeLi.siblings(':last'); 4124 if ($activeLi.is(':hover')) { 4125 $nextLi.addClass('hover'); 4126 ensureItemVisible($selectionList, $nextLi); 4127 scheduleHoverReset($nextLi, $activeLi, function (v) { 4128 ignoreNavigationKeypressesDuringListItemHoverReset = v; 4129 }); 4130 } else { 4131 $subsequentLi.addClass('hover'); 4132 ensureItemVisible($selectionList, $subsequentLi); 4133 } 4134 } 4135 return false; 4136 } 4137 if (key === 38 || key === 36 || key === 33) { 4138 // Up or Home or Page Up key 4139 if (ignoreNavigationKeypressesDuringListItemHoverReset) { 4140 return false; 4141 } 4142 $activeLi = $activeCustomSelect.find('li.hover'); 4143 if ($activeLi.length === 0 && $selectedLi.length > 0) { 4144 $activeLi = $selectedLi; 4145 } 4146 var $prevLi = $activeLi.prev(); 4147 if ($prevLi.length > 0) { 4148 $activeLi.siblings().addBack().removeClass('hover selected'); 4149 var _$subsequentLi = key === 38 ? $prevLi : $activeLi.siblings(':first'); 4150 if ($activeLi.is(':hover')) { 4151 $prevLi.addClass('hover'); 4152 ensureItemVisible($selectionList, $prevLi); 4153 scheduleHoverReset($prevLi, $activeLi, function (v) { 4154 ignoreNavigationKeypressesDuringListItemHoverReset = v; 4155 }); 4156 } else { 4157 _$subsequentLi.addClass('hover'); 4158 ensureItemVisible($selectionList, _$subsequentLi); 4159 } 4160 } 4161 return false; 4162 } 4163 if (key === 13 || key === 32) { 4164 // Enter or Space key 4165 if ($activeLi.length === 0) { 4166 $activeLi = $activeCustomSelect.find('li.hover'); 4167 } 4168 if ($activeLi.length > 0) { 4169 $activeLi.eq(0).trigger('click'); 4170 isCustomSelectToggled = true; 4171 } else { 4172 isCustomSelectToggled = toggleCustomSelect($activeCustomSelect.find('.selected-option'), true); 4173 } 4174 syncNativeSelectLeft($mac); 4175 return !isCustomSelectToggled; 4176 } 4177 if (key === 9 || key === 27) { 4178 // Tab or Escape key 4179 toggleCustomSelect($activeCustomSelect.find('.selected-option'), true); 4180 syncNativeSelectLeft($mac); 4181 } else if ($activeLi.length !== 0) { 4182 $list.removeClass('hover'); 4183 $activeLi.eq(0).addClass('hover'); 4184 } 4185 if (key === 8) { 4186 // Delete key 4187 return false;
4188 } 4189 // Ensure the item selected after any keypress that changes the selection is visible, 4190 // including character keypresses that jump to items by their label. 4191 setTimeout(function () { 4192 $selectedLi = $selectionList.find('li.selected'); 4193 if ($selectedLi.length > 0) { 4194 ensureItemVisible($selectionList, $selectedLi); 4195 } 4196 }, 0); 4197 } else { 4198 var $target = $(e.target); 4199 var $customSelect = $target.closest('.custom-select:not(select)'); 4200 if ($customSelect.length === 0) { 4201 return true; 4202 } 4203 if (key === 13 || key === 32) { 4204 isCustomSelectToggled = toggleCustomSelect($customSelect.find('.selected-option')); 4205 syncNativeSelectLeft($mac); 4206 return !isCustomSelectToggled; 4207 } 4208 } 4209 return true; 4210 }); 4211 } 4212}; 4213 4214/***/ }), 4215
4216/***/ "./cartridges/org_marykay/cartridge/client/default/js/product/base.js": 4217/*!****************************************************************************!*\ 4218 !*** ./cartridges/org_marykay/cartridge/client/default/js/product/base.js ***! 4219 \****************************************************************************/ 4220/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 4221 4222var base = __webpack_require__(/*! base/product/base */ "./cartridges/app_storefront_base/cartridge/client/default/js/product/base.js"); 4223var gtm = __webpack_require__(/*! googletagmanager/tagManager */ "./cartridges/int_googletags/cartridge/client/default/js/tagManager.js"); 4224 4225/** 4226 * Retrieve contextual quantity selector 4227 * @param {jquery} $el - DOM container for the relevant quantity 4228 * @return {jquery} - quantity selector DOM container 4229 */ 4230function getQuantitySelector($el) { 4231 var quantitySelected; 4232 if ($el && $('.set-items').length) { 4233 quantitySelected = $($el).closest('.product-detail').find('.quantity-select'); 4234 } else if ($el && $('.product-bundle').length) { 4235 var quantitySelectedModal = $($el).closest('.modal-footer').find('.quantity-select'); 4236 var quantitySelectedPDP = $($el).closest('.bundle-footer').find('.quantity-select'); 4237 if (quantitySelectedModal.val() === undefined) { 4238 quantitySelected = quantitySelectedPDP; 4239 } else { 4240 quantitySelected = quantitySelectedModal; 4241 } 4242 } else { 4243 quantitySelected = $('.quantity-select'); 4244 } 4245 return quantitySelected; 4246} 4247 4248/** 4249 * Parses the html for a modal window 4250 * @param {string} html - representing the body and footer of the modal window 4251 * 4252 * @return {Object} - Object with properties body and footer. 4253 */ 4254function parseHtml(html) { 4255 var $html = $('<div>').append($.parseHTML(html)); 4256 var body = $html.find('.choice-of-bonus-product'); 4257 var footer = $html.find('.modal-footer').children(); 4258 return { 4259 body: body, 4260 footer: footer 4261 }; 4262} 4263 4264/** 4265 * Ensure exactly one focusable radio in a radiogroup (roving tabindex pattern) 4266 * @param {jQuery} $group - container with role radiogroup 4267 */ 4268function ensureRovingTabindex($group) { 4269 if (!$group || !$group.length) return; 4270 var $radios = $group.find('[role="radio"]'); 4271 if (!$radios.length) return; 4272 $radios.attr('tabindex', '-1'); 4273 var $selected = $radios.filter('[aria-checked="true"]'); 4274 var $enabled = $radios.filter('[aria-disabled!="true"]'); 4275 var $target = $selected.first(); 4276 if (!$target.length) { 4277 $target = $enabled.first().length ? $enabled.first() : $radios.first(); 4278 } 4279 $target.attr('tabindex', '0'); 4280} 4281 4282/** 4283 * Process the attribute values for an attribute that has image swatches 4284 * 4285 * @param {Object} attr - Attribute 4286 * @param {string} attr.id - Attribute ID 4287 * @param {Object[]} attr.values - Array of attribute value objects 4288 * @param {string} attr.values.value - Attribute coded value 4289 * @param {string} attr.values.url - URL to de/select an attribute value of the product 4290 * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be 4291 * selected. If there is no variant that corresponds to a specific combination of attribute 4292 * values, an attribute may be disabled in the Product Detail Page 4293 * @param {jQuery} $productContainer - DOM container for a given product 4294 * @param {Object} msgs - object containing resource messages 4295 */ 4296function processSwatchValues(attr, $productContainer, msgs) { 4297 $productContainer.find('.shade-name-pxp').empty().html(attr.displayValue ? attr.displayValue : ''); 4298 attr.values.forEach(function (attrValue) { 4299 var $attrValue = $productContainer.find('[data-attr="' + attr.id + '"] [data-attr-value="' + attrValue.value + '"]'); 4300 var $swatchButton = $attrValue.parent(); 4301 if (attrValue.selected) { 4302 $swatchButton.addClass('selected'); 4303 $attrValue.siblings('.selected-assistive-text').text(msgs.assistiveSelectedText); 4304 } else { 4305 $swatchButton.removeClass('selected'); 4306 $attrValue.siblings('.selected-assistive-text').empty(); 4307 } 4308 if (attrValue.url) { 4309 $swatchButton.attr('data-url', attrValue.url); 4310 } else { 4311 $swatchButton.removeAttr('data-url'); 4312 } 4313 if (!attrValue.selectable) { 4314 $swatchButton.addClass('unselectable'); 4315 } else { 4316 $swatchButton.removeClass('unselectable'); 4317 } 4318 4319 // Accessibility state sync 4320 $swatchButton.attr('role', 'radio'); 4321 $swatchButton.attr('aria-checked', attrValue.selected ? 'true' : 'false'); 4322 $swatchButton.attr('aria-disabled', attrValue.selectable ? 'false' : 'true'); 4323 $swatchButton.attr('tabindex', attrValue.selected ? '0' : '-1'); 4324 }); 4325 4326 // Ensure radiogroup has a single focusable control
4327 var $group = $productContainer.find('[data-attr="' + attr.id + '"]'); 4328 ensureRovingTabindex($group); 4329} 4330 4331/** 4332 * Process attribute values associated with an attribute that does not have image swatches 4333 * 4334 * @param {Object} attr - Attribute 4335 * @param {string} attr.id - Attribute ID 4336 * @param {Object[]} attr.values - Array of attribute value objects 4337 * @param {string} attr.values.value - Attribute coded value 4338 * @param {string} attr.values.url - URL to de/select an attribute value of the product 4339 * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be 4340 * selected. If there is no variant that corresponds to a specific combination of attribute 4341 * values, an attribute may be disabled in the Product Detail Page 4342 * @param {jQuery} $productContainer - DOM container for a given product 4343 */ 4344function processNonSwatchValues(attr, $productContainer) { 4345 var $attr = '[data-attr="' + attr.id + '"]'; 4346 var $defaultOption = $productContainer.find($attr + ' .select-' + attr.id + ' option:first'); 4347 $defaultOption.attr('value', attr.resetUrl); 4348 attr.values.forEach(function (attrValue) { 4349 var $attrValue = $productContainer.find($attr + ' [data-attr-value="' + attrValue.value + '"]'); 4350 $attrValue.attr('value', attrValue.url).removeAttr('disabled'); 4351 }); 4352} 4353 4354/** 4355 * Routes the handling of attribute processing depending on whether the attribute has image 4356 * swatches or not 4357 * 4358 * @param {Object} attrs - Attribute 4359 * @param {string} attr.id - Attribute ID 4360 * @param {jQuery} $productContainer - DOM element for a given product 4361 * @param {Object} msgs - object containing resource messages 4362 */ 4363function updateAttrs(attrs, $productContainer, msgs) { 4364 // Currently, the only attribute type that has image swatches is Color. 4365 var attrsWithSwatches = ['shadeRGBCode']; 4366 attrs.forEach(function (attr) { 4367 if (attrsWithSwatches.indexOf(attr.id) > -1) { 4368 processSwatchValues(attr, $productContainer, msgs); 4369 } else { 4370 processNonSwatchValues(attr, $productContainer); 4371 } 4372 }); 4373} 4374 4375/** 4376 * Updates the availability status in the Product Detail Page 4377 * 4378 * @param {Object} response - Ajax response object after an 4379 * attribute value has been [de]selected 4380 * @param {jQuery} $productContainer - DOM element for a given product 4381 */ 4382function updateAvailability(response, $productContainer) { 4383 var availabilityValue = ''; 4384 var availabilityMessages = response.product.availability.messages; 4385 if (!response.product.readyToOrder) { 4386 availabilityValue = '<li><div>' + response.resources.info_selectforstock + '</div></li>'; 4387 } else { 4388 availabilityMessages.forEach(function (message) { 4389 availabilityValue += '<li><div>' + message + '</div></li>'; 4390 }); 4391 } 4392 $($productContainer).trigger('product:updateAvailability', { 4393 product: response.product, 4394 $productContainer: $productContainer, 4395 message: availabilityValue, 4396 resources: response.resources 4397 }); 4398} 4399 4400/** 4401 * Generates html for product attributes section 4402 * 4403 * @param {array} attributes - list of attributes 4404 * @return {string} - Compiled HTML 4405 */ 4406function getAttributesHtml(attributes) { 4407 if (!attributes) { 4408 return ''; 4409 } 4410 var html = ''; 4411 attributes.forEach(function (attributeGroup) { 4412 if (attributeGroup.ID === 'mainAttributes') { 4413 attributeGroup.attributes.forEach(function (attribute) { 4414 html += '<div class="attribute-values">' + attribute.label + ': ' + attribute.value + '</div>'; 4415 }); 4416 } 4417 }); 4418 return html; 4419} 4420 4421/** 4422 * Updates DOM using post-option selection Ajax response 4423 * 4424 * @param {OptionSelectionResponse} optionsHtml - Ajax response optionsHtml from selecting a product option 4425 * @param {jQuery} $productContainer - DOM element for current product 4426 */ 4427function updateOptions(optionsHtml, $productContainer) { 4428 // Update options 4429 $productContainer.find('.product-options').empty().html(optionsHtml); 4430} 4431 4432/** 4433 * Dynamically creates Bootstrap carousel from response containing images 4434 * @param {Object[]} imgs - Array of large product images,along with related information 4435 * @param {jQuery}
4435 $productContainer - DOM element for a given product 4436 */ 4437function createCarousel(imgs, $productContainer) { 4438 var $carousel = $productContainer.find('.carousel'); 4439 $carousel.carousel('dispose'); 4440 var carouselId = $carousel.attr('id'); 4441 $carousel.empty().append('<ol class="carousel-indicators"></ol>' + '<div class="carousel-inner" role="listbox"></div>' + '<a class="carousel-control-prev" href="#' + carouselId + '" role="button" data-slide="prev">' + '<svg class="icon-left icon--md" aria-hidden="true" aria-label="Previous Slide Icon">' + '<use xlink:href="' + window.STATIC_URL + '/images/compiled/sprites.svg#mk-icons-caret-left-black"></use>' + '</svg>' + '<span class="sr-only">' + $carousel.data('prev') + '</span>' + '</a>' + '<a class="carousel-control-next" href="#' + carouselId + '" role="button" data-slide="next">' + '<svg class="icon-right icon--md" aria-hidden="true" aria-label="Next Slide Icon">' + '<use xlink:href="' + window.STATIC_URL + '/images/compiled/sprites.svg#mk-icons-caret-right-black"></use>' + '</svg>' + '<span class="sr-only">' + $carousel.data('next') + '</span>' + '</a>'); 4442 for (var i = 0; i < imgs.length; i++) { 4443 $('<div class="carousel-item"><img src="' + imgs[i].url + '" class="d-block img-fluid mk-aspect-ratio-1" alt="' + imgs[i].alt + ' image number ' + parseInt(imgs[i].index, 10) + '" title="' + imgs[i].title + '" itemprop="image" /></div>').appendTo($carousel.find('.carousel-inner')); 4444 $('<li data-target="#' + carouselId + '" data-slide-to="' + i + '" class="border-0 mk-rounded-2 dot-indicator"></li>').appendTo($carousel.find('.carousel-indicators')); 4445 } 4446 $carousel.find('.carousel-item').first().addClass('active'); 4447 $carousel.find('.carousel-indicators > li').first().addClass('active'); 4448 if (imgs.length === 1) { 4449 $carousel.find('.carousel-indicators, a[class^="carousel-control-"]').detach(); 4450 } 4451 $carousel.carousel(); 4452 $carousel.find('.carousel-indicators').attr('aria-hidden', true); 4453} 4454 4455/** 4456 * Update product images 4457 * @param {Object[]} imgs - Array of hi-res product images,along with related information 4458 * @param {jQuery} $productContainer - DOM element for a given product 4459 */ 4460/** 4461 * Updates product images in the container based on available images 4462 * @param {Object[]} imgs - Array of image objects with url and alt properties 4463 * @param {jQuery} $productContainer - DOM element containing product images 4464 */ 4465function updateProductImages(imgs, $productContainer) { 4466 var IMAGE_SELECTOR = '.js-pxp-image'; 4467 var $imagesContainer = $productContainer.find('.pxp-images .hi-res-images-container'); 4468 var $images = $imagesContainer.find(IMAGE_SELECTOR); 4469 var displayedImagesCount = $images.length; 4470 var maxImagesToDisplay = Math.min(imgs.length, 7); 4471 4472 /** 4473 * Updates an existing image element with new image data 4474 * @param {jQuery} $imgElement - jQuery image element to update 4475 * @param {Object} img - Image object with url and alt properties 4476 */ 4477 function updateExistingImage($imgElement, img) { 4478 $imgElement.attr('src', img.url); 4479 $imgElement.attr('alt', img.alt); 4480 } 4481 4482 /** 4483 * Creates a new image element with image data 4484 * @param {jQuery} $existingImageElement - jQuery image element to create 4485 * @param {Object} imageData - Image object with url and alt properties 4486 * @returns {jQuery} - New image element 4487 */ 4488 function createNewImage($existingImageElement, imageData) { 4489 var $newImage; 4490 if ($existingImageElement !== null) { 4491 $newImage = $existingImageElement.clone(); 4492 } else { 4493 $newImage = $('<img>'); 4494 $newImage.addClass('img-fluid w-100 product-detail__pxp-image js-pxp-image'); 4495 } 4496 $newImage.attr('src', imageData.url); 4497 $newImage.attr('alt', imageData.alt); 4498 return $newImage; 4499 } 4500 4501 /** 4502 * Creates a container div for a hi-res image with appropriate column class. 4503 * @param {boolean} [isFirstImage=false] - Whether this is the first image (affects column width) 4504 * @returns {jQuery} - New jQuery div element with correct classes 4505 */ 4506 function createImageContainer() { 4507 var isFirstImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4508 // Defensive: ensure isFirstImage is boolean 4509 var isFirst = Boolean(isFirstImage); 4510 // Use semantic class names and avoid string interpolation injection 4511 var colClass = isFirst ? 'col-12' : 'col-6'; 4512 // Only allow known classes, never inject untrusted data 4513 var $newImageContainer = $('<div>').addClass('hi-res-image').addClass('mk-image-skeleton').addClass(colClass); 4514 return $newImageContainer; 4515 } 4516 4517 /** 4518 * Adds a new image element to the container 4519 * @param {Object} imageData - Image object with url and alt properties 4520 * @param {jQuery} $existingImageElement - jQuery image element to add, if null, a new image element will be created 4521 */ 4522 function addNewImage(imageData) { 4523 var $existingImageElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 4524 var $newImage = createNewImage($existingImageElement, imageData); 4525 var $newImageContainer = createImageContainer($existingImageElement == null); 4526 4527 // Append the new image to the container 4528 $newImageContainer.append($newImage); 4529 4530 // Append the new image container to the images parent container 4531 $imagesContainer.append($newImageContainer); 4532 } 4533 try { 4534 var totalImagesToHandle = Math.min(Math.max(displayedImagesCount, maxImagesToDisplay), 7); 4535 if (totalImagesToHandle === 0) { 4536 $imagesContainer.empty(); 4537 } else { 4538 // Single loop to handle both adding/updating and removing images efficiently 4539 for (var i = 0; i < totalImagesToHandle; i++) { 4540 var $currentImage = $images.eq(i); 4541 var imgData = imgs[i]; 4542 if (imgData && $currentImage.length) { 4543 updateExistingImage($currentImage, imgData); 4544 } else if (imgData && !$currentImage.length) { 4545 if (i === 0) { 4546 $imagesContainer.empty(); 4547 addNewImage(imgData, null); 4548 } else { 4549 $images = $imagesContainer.find(IMAGE_SELECTOR); 4550 var $lastImage = $images.eq(i - 1); 4551 addNewImage(imgData, $lastImage); 4552 } 4553 } else if ($currentImage.length) { 4554 $currentImage.parent().remove(); 4555 } 4556 } 4557 } 4558 } catch (e) { 4559 // Do nothing at moment 4560 } 4561} 4562 4563/** 4564 * Update certficate Badge 4565 * 4566 * @param {response} response - Ajax response 4567 * @param {jQuery} $productContainer - DOM element for current product 4568 */ 4569function updateCertificateBadge(response, $productContainer) { 4570 var $pxpImages = $productContainer.find('.pxp-images'); 4571 $pxpImages.find('.product-badge-js').empty(); 4572 if (response && response.product && response.product.certficateBadgeTemplate) { 4573 if ($pxpImages.find('.hi-res-image').length > 0) { 4574 $pxpImages.find('.product-badge-js').html(response.product.certficateBadgeTemplate); 4575 } 4576 } 4577} 4578 4579/** 4580 * Update wishlist Button on PDP 4581 * @param {jQuery} $productContainer - DOM element for a given product 4582 * @param {Object} response - Ajax response object after an 4583 * attribute value has been [de]selected 4584 */ 4585function updateWishlist($productContainer, response) { 4586 var $wishlistTile = $productContainer.find('.wishlistTile'); 4587 var $wishlisticon = $productContainer.find('.wishlist-icon'); 4588 var $wishlistFilledIcon = $productContainer.find('.wishlist-filled-icon'); 4589 if (response.product.custom.isInWishlist) { 4590 $wishlistTile.addClass('active'); 4591 $wishlisticon.addClass('d-none'); 4592 $wishlistFilledIcon.removeClass('d-none'); 4593 } else { 4594 $wishlistTile.removeClass('active'); 4595 $wishlisticon.removeClass('d-none'); 4596 $wishlistFilledIcon.addClass('d-none'); 4597 } 4598} 4599 4600/** 4601 * Update MirrorMe Source 4602 * @param {jQuery} $productContainer - DOM element for a given product 4603 * @param {Object} response - Ajax response object after an 4604 * attribute value has been [de]selected 4605 */ 4606function updateMirrorMeSource($productContainer, response) { 4607 var enterpriseMarketingPartID = response && response.product && response.product.custom && response.product.custom.enterpriseMarketingPartID ? response.product.custom.enterpriseMarketingPartID : ''; 4608 var isDeepLink = response && response.product && response.product.custom && response.product.custom.isDeepLink ? response.product.custom.isDeepLink : false;
4609 if (isDeepLink && enterpriseMarketingPartID) { 4610 var mirrorMeBaseURL = $('.mirror-me-Iframes').attr('data-baseurl'); 4611 var consultant = $('.mirror-me-Iframes').attr('data-consultant'); 4612 var mksubsidiaryid = $('.mirror-me-Iframes').attr('data-mksubsidiaryid'); 4613 var iframeAppProject = $('.mirror-me-Iframes').attr('data-iframeappproject'); 4614 var iframeAppDomain = $('.mirror-me-Iframes').attr('data-iframeappdomain'); 4615 var language = $('.mirror-me-Iframes').attr('data-language'); 4616 var newSrc = mirrorMeBaseURL + '?project=' + iframeAppProject + '&lang=' + language + '&deeplink=' + enterpriseMarketingPartID + '&d=' + iframeAppDomain + '&m=' + consultant + '&MKSubsidiaryID=' + mksubsidiaryid; 4617 4618 // Update the iframe src 4619 $productContainer.find('#MirrorMe').attr('src', newSrc); 4620 } 4621} 4622 4623/** 4624 * Retrieves url to use when adding a product to the cart 4625 * 4626 * @return {string} - The provided URL to use when adding a product to the cart 4627 */ 4628function getAddToCartUrl() { 4629 return $('.add-to-cart-url').val(); 4630} 4631 4632/** 4633 * Retrieves the bundle product item ID's for the Controller to replace bundle master product 4634 * items with their selected variants 4635 * 4636 * @return {string[]} - List of selected bundle product item ID's 4637 */ 4638function getChildProducts() { 4639 var childProducts = []; 4640 $('.bundle-item').each(function () { 4641 childProducts.push({ 4642 pid: $(this).find('.product-id').text(), 4643 quantity: parseInt($(this).find('label.quantity').data('quantity'), 10) 4644 }); 4645 }); 4646 return childProducts.length ? JSON.stringify(childProducts) : []; 4647} 4648 4649/** 4650 * Retrieve product options 4651 * 4652 * @param {jQuery} $productContainer - DOM element for current product 4653 * @return {string} - Product options and their selected values 4654 */ 4655function getOptions($productContainer) { 4656 var options = $productContainer.find('.product-option').map(function () { 4657 var $elOption = $(this).find('.options-select'); 4658 var urlValue = $elOption.val(); 4659 var selectedValueId = $elOption.find('option[value="' + urlValue + '"]').data('value-id'); 4660 return { 4661 optionId: $(this).data('option-id'), 4662 selectedValueId: selectedValueId 4663 }; 4664 }).toArray(); 4665 return JSON.stringify(options); 4666} 4667 4668/** 4669 * Parses JSON from Ajax call made whenever an attribute value is [de]selected 4670 * @param {Object} response - response from Ajax call 4671 * @param {Object} response.product - Product object 4672 * @param {string} response.product.id - Product ID 4673 * @param {Object[]} response.product.variationAttributes - Product attributes 4674 * @param {Object[]} response.product.images - Product images 4675 * @param {boolean} response.product.hasRequiredAttrsSelected - Flag as to whether all required 4676 * attributes have been selected. Used partially to 4677 * determine whether the Add to Cart button can be enabled 4678 * @param {jQuery} $productContainer - DOM element for a given product. 4679 */ 4680function handleVariantResponse(response, $productContainer) { 4681 var isChoiceOfBonusProducts = $productContainer.parents('.choose-bonus-product-dialog').length > 0; 4682 var isVaraint; 4683 if (response.product.variationAttributes) { 4684 updateAttrs(response.product.variationAttributes, $productContainer, response.resources); 4685 isVaraint = response.product.productType === 'variant'; 4686 if (isChoiceOfBonusProducts && isVaraint) { 4687 $productContainer.parent('.bonus-product-item').data('pid', response.product.id); 4688 $productContainer.parent('.bonus-product-item').data('ready-to-order', response.product.readyToOrder); 4689 $('button.add-to-cart, button.add-to-cart-global, button.update-cart-product-global').data('pid', response.product.id); 4690 } 4691 } 4692 4693 // Update primary images 4694 var primaryImageUrls = response.product.images.large; 4695 try {
4696 if (!$productContainer.hasClass('product-quickview')) { 4697 updateProductImages(primaryImageUrls, $productContainer); 4698 updateCertificateBadge(response, $productContainer); 4699 $productContainer.find('.product').attr('data-pid', response.product.id); 4700 updateWishlist($productContainer, response); 4701 updateMirrorMeSource($productContainer, response); 4702 } else { 4703 createCarousel(primaryImageUrls, $productContainer); 4704 } 4705 } catch (e) { 4706 // Do nothing at moment 4707 } 4708 4709 // Update pricing 4710 if (!isChoiceOfBonusProducts) { 4711 var $priceSelector = $('.prices .price', $productContainer).length ? $('.prices .price', $productContainer) : $('.prices .price'); 4712 $priceSelector.replaceWith(response.product.price.html); 4713 } 4714 4715 // Update promotions 4716 $productContainer.find('.promotions').empty().html(response.product.promotionsHtml); 4717 updateAvailability(response, $productContainer); 4718 if (isChoiceOfBonusProducts) { 4719 var $selectButton = $productContainer.find('.select-bonus-product'); 4720 $selectButton.trigger('bonusproduct:updateSelectButton', { 4721 product: response.product, 4722 $productContainer: $productContainer 4723 }); 4724 } else { 4725 // Enable "Add to Cart" button if all required attributes have been selected 4726 $('button.add-to-cart, button.add-to-cart-global, button.update-cart-product-global').trigger('product:updateAddToCart', { 4727 product: response.product, 4728 $productContainer: $productContainer, 4729 resources: response.resources 4730 }).trigger('product:statusUpdate', response.product); 4731 } 4732 4733 // Update attributes 4734 $productContainer.find('.main-attributes').empty().html(getAttributesHtml(response.product.attributes)); 4735 // Update prices inside Sticky Add to Bag Section (mobile view shows price within button) 4736 try { 4737 var _response$product; 4738 var $stickyAtb = $('.sticky-atb'); 4739 var price = response === null || response === void 0 || (_response$product = response.product) === null || _response$product === void 0 ? void 0 : _response$product.price.html; 4740 var $priceElement = $('.price', $stickyAtb); 4741 $priceElement.replaceWith(price); 4742 } catch (err) { 4743 // Handle error 4744 } 4745} 4746 4747/** 4748 * Retrieves url to use when adding a product to the cart 4749 * 4750 * @param {Object} data - data object used to fill in dynamic portions of the html 4751 */ 4752function chooseBonusProducts(data) { 4753 $('.modal-body').spinner().start(); 4754 if ($('#chooseBonusProductModal').length !== 0) { 4755 $('#chooseBonusProductModal').remove(); 4756 } 4757 var bonusUrl; 4758 if (data.bonusChoiceRuleBased) { 4759 bonusUrl = data.showProductsUrlRuleBased; 4760 } else { 4761 bonusUrl = data.showProductsUrlListBased; 4762 } 4763 var htmlString = '<!-- Modal -->' + '<div class="modal fade" id="chooseBonusProductModal" tabindex="-1" role="dialog">' + '<span class="enter-message sr-only" ></span>' + '<div class="modal-dialog choose-bonus-product-dialog" ' + 'data-total-qty="' + data.maxBonusItems + '"' + 'data-UUID="' + data.uuid + '"' + 'data-pliUUID="' + data.pliUUID + '"' + 'data-addToCartUrl="' + data.addToCartUrl + '"' + 'data-pageStart="0"' + 'data-pageSize="' + data.pageSize + '"' + 'data-moreURL="' + data.showProductsUrlRuleBased + '"' + 'data-bonusChoiceRuleBased="' + data.bonusChoiceRuleBased + '">' + '<!-- Modal content-->' + '<div class="modal-content">' + '<div class="modal-header">' + ' <span class="">' + data.labels.selectprods + '</span>' + ' <button type="button" class="close pull-right" data-dismiss="modal">' + ' <span aria-hidden="true">×</span>' + ' <span class="sr-only"> </span>' + ' </button>' + '</div>' + '<div class="modal-body"></div>' + '<div class="modal-footer"></div>' + '</div>' + '</div>' + '</div>'; 4764 $('body').append(htmlString); 4765 $('.modal-body').spinner().start(); 4766 $.ajax({ 4767 url: bonusUrl, 4768 method: 'GET', 4769 dataType: 'json', 4770 success: function success(response) { 4771 var parsedHtml = parseHtml(response.renderedTemplate); 4772 $('#chooseBonusProductModal .modal-body').empty(); 4773 $('#chooseBonusProductModal .enter-message').text(response.enterDialogMessage); 4774 $('#chooseBonusProductModal .modal-header .close .sr-only').text(response.closeButtonText); 4775 $('#chooseBonusProductModal .modal-body').html(parsedHtml.body); 4776 $('#chooseBonusProductModal .modal-footer').html(parsedHtml.footer); 4777 $('#chooseBonusProductModal').modal('show'); 4778 $.spinner().stop(); 4779 }, 4780 error: function error() { 4781 $.spinner().stop(); 4782 } 4783 }); 4784} 4785 4786/** 4787 * @typespec UpdatedQuantity 4788 * @type Object 4789 * @property {boolean} selected - Whether the quantity has been selected 4790 * @property {string} value - The number of products to purchase 4791 * @property {string} url - Compiled URL that specifies variation attributes, product ID, options, 4792 * etc. 4793 */ 4794 4795/** 4796 * Updates the quantity DOM elements post Ajax call 4797 * @param {UpdatedQuantity[]} quantities - 4798 * @param {jQuery}
4798 $productContainer - DOM container for a given product 4799 */ 4800function updateQuantities(quantities, $productContainer) { 4801 if ($productContainer.parent('.bonus-product-item').length <= 0) { 4802 var optionsHtml = quantities.map(function (quantity) { 4803 var selected = quantity.selected ? ' selected ' : ''; 4804 return '<option value="' + quantity.value + '" data-url="' + quantity.url + '"' + selected + '>' + quantity.value + '</option>'; 4805 }).join(''); 4806 getQuantitySelector($productContainer).empty().html(optionsHtml); 4807 } 4808} 4809 4810/** 4811 * Makes a call to the server to report the event of adding an item to the cart 4812 * 4813 * @param {string | boolean} url - a string representing the end point to hit so that the event can be recorded, or false 4814 */ 4815function miniCartReportingUrl(url) { 4816 if (url) { 4817 $.ajax({ 4818 url: url, 4819 method: 'GET', 4820 success: function success() { 4821 // reporting urls hit on the server 4822 }, 4823 error: function error() { 4824 // no reporting urls hit on the server 4825 } 4826 }); 4827 } 4828} 4829 4830/** 4831 * Updates the Mini-Cart quantity value after the customer has pressed the "Add to Cart" button 4832 * @param {string} response - ajax response from clicking the add to cart button 4833 */ 4834function handlePostCartAdd(response) { 4835 $('.minicart').trigger('count:update', response); 4836 if (response.newBonusDiscountLineItem && Object.keys(response.newBonusDiscountLineItem).length !== 0) {
4837 chooseBonusProducts(response.newBonusDiscountLineItem); 4838 } 4839} 4840 4841/** 4842 * @param {string} finishValue - raw product finish value 4843 * @returns {string} formatted product finish value 4844 */ 4845function formatProductFinish(finishValue) { 4846 if (!finishValue) { 4847 return ''; 4848 } 4849 return "<span class='productFinishLabel' aria-label=\"Product Finish: ".concat(finishValue, "\">").concat(finishValue, "</span>"); 4850} 4851 4852/** 4853 * Updates the product finish value in the product detail page 4854 * @param {Object} product - product object from ajax response 4855 * @param {jQuery} $productContainer - DOM element for current product 4856 */ 4857function updateProductFinish(product, $productContainer) { 4858 if (product.custom && product.custom.productFinish) { 4859 $productContainer.find('.product-detail__productFinish').html(formatProductFinish(product.custom.productFinish)); 4860 } else { 4861 $productContainer.find('.product-detail__productFinish').empty(); 4862 } 4863} 4864 4865/** 4866 * updates the product view when a product attribute is selected or deselected or when 4867 * changing quantity 4868 * @param {string} selectedValueUrl - the Url for the selected variation value 4869 * @param {jQuery} $productContainer - DOM element for current product 4870 */ 4871base.attributeSelect = function (selectedValueUrl, $productContainer) { 4872 if (selectedValueUrl) { 4873 $('body').trigger('product:beforeAttributeSelect', { 4874 url: selectedValueUrl, 4875 container: $productContainer 4876 }); 4877 $.ajax({ 4878 url: selectedValueUrl, 4879 method: 'GET', 4880 success: function success(data) { 4881 handleVariantResponse(data, $productContainer); 4882 updateOptions(data.product.optionsHtml, $productContainer); 4883 updateQuantities(data.product.quantities, $productContainer); 4884 updateProductFinish(data.product, $productContainer); 4885 $('body').trigger('product:afterAttributeSelect', { 4886 data: data, 4887 container: $productContainer 4888 }); 4889 $.spinner().stop(); 4890 }, 4891 error: function error() { 4892 $.spinner().stop(); 4893 } 4894 }); 4895 } 4896}; 4897base.colorAttribute = function () { 4898 // Click to select 4899 $(document).off('click', '[data-attr="shadeRGBCode"] button:not(".selected"):not("[disabled]")').on('click', '[data-attr="shadeRGBCode"] button:not(".selected"):not("[disabled]")', function (e) { 4900 e.preventDefault(); 4901 if ($(this).attr('disabled')) { 4902 return; 4903 } 4904 var $productContainer = $(this).closest('.set-item');
4905 if (!$productContainer.length) { 4906 $productContainer = $(this).closest('.product-detail'); 4907 } 4908 base.attributeSelect($(this).attr('data-url'), $productContainer); 4909 }); 4910 4911 // Keyboard navigation (roving tabindex) 4912 $(document).on('keydown', '[data-attr="shadeRGBCode"] [role="radio"]', function (e) { 4913 var keys = { 4914 LEFT: 37, 4915 UP: 38, 4916 RIGHT: 39, 4917 DOWN: 40, 4918 HOME: 36, 4919 END: 35, 4920 ENTER: 13, 4921 SPACE: 32 4922 }; 4923 var code = e.which || e.keyCode; 4924 if ([keys.LEFT, keys.UP, keys.RIGHT, keys.DOWN, keys.HOME, keys.END, keys.ENTER, keys.SPACE].indexOf(code) === -1) { 4925 return; 4926 } 4927 e.preventDefault(); 4928 var $current = $(this); 4929 var $group = $current.closest('[data-attr="shadeRGBCode"]'); 4930 var $radios = $group.find('[role="radio"]'); 4931 var $enabled = $radios.filter(':not(:disabled)[aria-disabled!="true"]'); 4932 4933 // Index within enabled list (fallback to first enabled) 4934 var idxEnabled = $enabled.index($current); 4935 if (idxEnabled === -1) { 4936 idxEnabled = $enabled.index($enabled.filter('[aria-checked="true"]').first()); 4937 if (idxEnabled === -1) idxEnabled = 0; 4938 } 4939 4940 /** 4941 * Moves focus to the given radio element and updates tabindex. 4942 * @param {jQuery} $t - The target radio element. 4943 * @returns {undefined} 4944 */ 4945 function moveTo($t) { 4946 if (!$t || !$t.length) return undefined; 4947 $radios.attr('tabindex', '-1'); 4948 $t.attr('tabindex', '0').focus(); 4949 return undefined; 4950 } 4951 if (code === keys.HOME) { 4952 moveTo($enabled.first()); 4953 return; 4954 } 4955 if (code === keys.END) { 4956 moveTo($enabled.last()); 4957 return; 4958 } 4959 if (code === keys.LEFT || code === keys.UP) moveTo($enabled.eq(Math.max(idxEnabled - 1, 0))); 4960 if (code === keys.RIGHT || code === keys.DOWN) moveTo($enabled.eq(Math.min(idxEnabled + 1, $enabled.length - 1))); 4961 if ((code === keys.ENTER || code === keys.SPACE) && !$current.attr('disabled')) $current.click(); 4962 if ((code === keys.ENTER || code === keys.SPACE) && !$current.attr('disabled')) { 4963 $current.click(); 4964 } 4965 }); 4966}; 4967base.selectAttribute = function () { 4968 $(document).on('change', 'select[class*="select-"], .options-select', function (e) { 4969 e.preventDefault(); 4970 var $productContainer = $(this).closest('.set-item');
4971 if (!$productContainer.length) { 4972 $productContainer = $(this).closest('.product-detail'); 4973 } 4974 base.attributeSelect(e.currentTarget.value, $productContainer); 4975 }); 4976}; 4977base.addToCart = function () { 4978 $(document).on('click', 'button.add-to-cart, button.add-to-cart-global', function () { 4979 var addToCartUrl; 4980 var pid; 4981 var pidsObj; 4982 var setPids; 4983 $('body').trigger('product:beforeAddToCart', this); 4984 if ($('.set-items').length && $(this).hasClass('add-to-cart-global')) { 4985 setPids = []; 4986 $('.product-detail').each(function () { 4987 if (!$(this).hasClass('product-set-detail')) { 4988 setPids.push({ 4989 pid: $(this).find('.product-id').text(), 4990 qty: $(this).find('.quantity-select').val(), 4991 options: getOptions($(this)) 4992 }); 4993 } 4994 }); 4995 pidsObj = JSON.stringify(setPids); 4996 } 4997 pid = base.getPidValue($(this)); 4998 var $productContainer = $(this).closest('.product-detail'); 4999 if (!$productContainer.length) { 5000 $productContainer = $(this).closest('.quick-view-dialog').find('.product-detail'); 5001 } 5002 var $productTile = document.querySelector(".product[data-pid=\"".concat(pid, "\"] .product-tile")); 5003 var productListName = $productTile && $productTile.dataset ? $productTile.dataset.gtmProductListName : ''; 5004 var productDetailObject = window.dataLayer.find(function (item) { 5005 return item.event === "productDetailView"; 5006 }); 5007 if (productDetailObject) { 5008 productListName = productDetailObject && productDetailObject.ecommerce && productDetailObject.ecommerce.detail && productDetailObject.ecommerce.detail.products ? productDetailObject.ecommerce.detail.products[0].item_list_name : ''; 5009 } 5010 addToCartUrl = getAddToCartUrl(); 5011 var form = { 5012 pid: pid, 5013 pidsObj: pidsObj, 5014 childProducts: getChildProducts(), 5015 quantity: base.getQuantitySelected($(this)), 5016 productListName: productListName 5017 }; 5018 if (!$('.bundle-item').length) { 5019 form.options = getOptions($productContainer); 5020 } 5021 $(this).trigger('updateAddToCartFormData', form); 5022 if (addToCartUrl) { 5023 $.ajax({ 5024 url: addToCartUrl, 5025 method: 'POST', 5026 data: form, 5027 success: function success(data) { 5028 if (data.gateError && data.error) { 5029 // If gate error, redirect to gate closed URL 5030 window.location = data.redirectUrl; 5031 return; 5032 } 5033 handlePostCartAdd(data); 5034 $('body').trigger('product:afterAddToCart', data); 5035 if (data.productData) { 5036 gtm.addToCart(data.productData, data.productData.quantity); 5037 } 5038 if (data.quantityTotal === 1) { 5039 gtm.openCart(); 5040 } 5041 $.spinner().stop(); 5042 miniCartReportingUrl(data.reportingURL); 5043 var miniCart = __webpack_require__(/*! ../components/miniCart */ "./cartridges/org_marykay/cartridge/client/default/js/components/miniCart.js"); 5044 miniCart.miniCartShow(); 5045 var trayOpened = false; 5046 $('body').on('trayModalOpened', function (e, traydata) { 5047 if (!trayOpened && data.maxQty && data.maxQty.error && traydata.customClassName.includes('mini-cart-tray')) { 5048 $('.minicart-maxqty-error').addClass('alert alert-danger p-4'); 5049 var errorHtml = '<strong class="title mb-1 font-weight-xbold small d-block">' + data.maxQty.message + '</strong>' + '<p class="m-0 small mk-text-color-black">' + data.maxQty.msg + '</p>'; 5050 $('.minicart-maxqty-error').append(errorHtml); 5051 trayOpened = true; 5052 } 5053 }); 5054 }, 5055 error: function error() { 5056 $.spinner().stop(); 5057 } 5058 }); 5059 } 5060 }); 5061}; 5062module.exports = base; 5063 5064/***/ }), 5065
5066/***/ "./cartridges/org_marykay/cartridge/client/default/js/product/details.js": 5067/*!*******************************************************************************!*\ 5068 !*** ./cartridges/org_marykay/cartridge/client/default/js/product/details.js ***! 5069 \*******************************************************************************/ 5070/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 5071 5072function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } 5073function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } 5074function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } 5075function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 5076function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 5077function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 5078var base = __webpack_require__(/*! ./base */ "./cartridges/org_marykay/cartridge/client/default/js/product/base.js"); 5079var detail = __webpack_require__(/*! base/product/detail */ "./cartridges/app_storefront_base/cartridge/client/default/js/product/detail.js"); 5080var minicart = __webpack_require__(/*! ../components/miniCart */ "./cartridges/org_marykay/cartridge/client/default/js/components/miniCart.js"); 5081var gtm = __webpack_require__(/*! googletagmanager/tagManager */ "./cartridges/int_googletags/cartridge/client/default/js/tagManager.js"); 5082var cartHelpers = __webpack_require__(/*! ../utilities/cartHelpers */ "./cartridges/org_marykay/cartridge/client/default/js/utilities/cartHelpers.js"); 5083var _require = __webpack_require__(/*! ../utilities */ "./cartridges/org_marykay/cartridge/client/default/js/utilities.js"), 5084 throttle = _require.throttle; 5085var Snackbar = __webpack_require__(/*! ../components/snackbar */ "./cartridges/org_marykay/cartridge/client/default/js/components/snackbar.js"); 5086var TRY_IT_IFRAME_HEIGHT_BUFFER = 8; 5087var TRY_IT_IFRAME_ASPECT_RATIO_WIDTH = 16; 5088var TRY_IT_IFRAME_ASPECT_RATIO_HEIGHT = 11; 5089var TRY_IT_MOBILE_BREAKPOINT = 768; 5090var TRY_IT_MOBILE_MAX_DIMENSION = 1024; 5091var TRY_IT_MIRROR_ME_NON_MOBILE_WIDTH_SAFETY_FACTOR = 0.95; 5092var TRY_IT_DIALOG_VERTICAL_MARGIN = 16; 5093detail.updateAddToCart = function () { 5094 $('body').on('product:updateAddToCart', function (e, response) { 5095 var $addToCartBtn = $('button.add-to-cart .js-atc-main', response.$productContainer); 5096 var isDiscontinued = response.product.custom && response.product.custom.isDiscontinuedProduct; 5097 // update local add to cart (for sets) 5098 if (response.resources && response.resources.addtoCart && response.resources.outOfStock) { 5099 if (!response.product.readyToOrder || !response.product.available) { 5100 $addToCartBtn.html(response.resources.outOfStock); 5101 } else { 5102 $addToCartBtn.html("<svg class=\"icon--sm mr-2\" aria-hidden=\"true\" aria-label=\"Add to Bag Icon\"><use xlink:href=\"".concat(window.STATIC_URL, "/images/compiled/sprites.svg#mk-icons-plus-white\"></use></svg>") + response.resources.addtoCart); 5103 } 5104 }
5105 $('button.add-to-cart', response.$productContainer).attr('disabled', !response.product.readyToOrder || !response.product.available || isDiscontinued); 5106 var enable = $('.product-availability').toArray().every(function (item) { 5107 return $(item).data('available') && $(item).data('ready-to-order'); 5108 }); 5109 detail.methods.updateAddToCartEnableDisableOtherElements(!enable); 5110 }); 5111}; 5112detail.handleSlickSlotAddToCart = function () { 5113 $('body').on('click', '.add-to-cart-button-slick-slot', function (e) { 5114 e.preventDefault(); 5115 e.stopPropagation(); 5116 var $addToCartButton = $(this); 5117 5118 // Prevent multiple clicks 5119 if ($addToCartButton.prop('disabled') || $addToCartButton.attr('aria-disabled') === 'true') { 5120 e.stopImmediatePropagation(); 5121 return; 5122 } 5123 5124 // Validate URL 5125 var url = $addToCartButton.data('url'); 5126 if (!url) { 5127 console.error('Add to cart URL not found'); 5128 return; 5129 } 5130 5131 // Get product ID 5132 var pid = $addToCartButton.data('pid'); 5133 var $product = $addToCartButton.closest('.product'); 5134 var $selectedSwatch = $product.find('.swatch-link.selected.swatch-active .swatch-value'); 5135 if ($selectedSwatch.length && $selectedSwatch.data('variant-id')) { 5136 pid = $selectedSwatch.data('variant-id'); 5137 } 5138 5139 // Get quantity 5140 var quantity = parseInt($selectedSwatch.data('quantity'), 10) || 1; 5141 var maxQty = parseInt($selectedSwatch.data('max-quantity'), 10) || 999; 5142 quantity = Math.min(quantity, maxQty); 5143 5144 // Disable button and show spinner 5145 $addToCartButton.prop('disabled', true); 5146 $.spinner().start(); 5147 5148 // AJAX call 5149 $.ajax({ 5150 url: url, 5151 type: 'post', 5152 data: { 5153 pid: pid, 5154 quantity: quantity 5155 }, 5156 success: function success(data) { 5157 if (data.cartItemsHTML) { 5158 $('.cart-product-items').empty().html(data.cartItemsHTML); 5159 } 5160 if (data.productData && data.productData.quantity !== undefined) { 5161 gtm.addToCart(data.productData, data.productData.quantity); 5162 } 5163 if (data.quantityTotal && data.quantityTotal === 1) { 5164 gtm.openCart(); 5165 } 5166 $('.minicart').trigger('count:update', data); 5167 minicart.miniCartShow(); 5168 var trayOpened = false; 5169 $('body').on('trayModalOpened', function (eTMO, traydata) { 5170 if (!trayOpened && data.maxQty && data.maxQty.error && traydata.customClassName.includes('mini-cart-tray')) { 5171 $('.minicart-maxqty-error').addClass('alert alert-danger p-4'); 5172 var errorHtml = '<strong class="title mb-1 font-weight-xbold small d-block">' + data.maxQty.message + '</strong>' + '<p class="m-0 small mk-text-color-black">' + data.maxQty.msg + '</p>'; 5173 $('.minicart-maxqty-error').append(errorHtml); 5174 trayOpened = true; 5175 } 5176 }); 5177 cartHelpers.updateCartTotals(data); // ✅ Use shared utility 5178 5179 $.spinner().stop(); 5180 $addToCartButton.prop('disabled', false); 5181 }, 5182 error: function error(xhr) { 5183 $.spinner().stop(); 5184 $addToCartButton.prop('disabled', false); 5185 var errorMessage = 'Unable to add item to cart. Please try again.'; 5186 if (xhr.responseJSON && xhr.responseJSON.errorMessage) { 5187 errorMessage = xhr.responseJSON.errorMessage; 5188 } 5189 Snackbar.show({ 5190 message: errorMessage, 5191 actionText: 'Dismiss', 5192 actionHandler: function actionHandler() {} 5193 }); 5194 } 5195 }); 5196 }); 5197}; 5198var toggleStickyAtb = function toggleStickyAtb($stickyAtb, windowScrollTop, actualAtbOffsetTop) { 5199 // Show sticky atb when actual atb is out of window due to scroll. Hide sticky atb when actual atb is in window due to scroll. 5200 if (windowScrollTop > actualAtbOffsetTop) { 5201 if ($stickyAtb.hasClass('hidden')) { 5202 $stickyAtb.removeClass('hidden'); 5203 } 5204 $stickyAtb.addClass('visible'); 5205 } else if ($stickyAtb.hasClass('visible')) { 5206 $stickyAtb.removeClass('visible'); 5207 $stickyAtb.addClass('hidden'); 5208 $stickyAtb.one('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', function () { 5209 $stickyAtb.removeClass('hidden'); 5210 }); 5211 } 5212}; 5213 5214// jQuery IIFE to listen to scroll event 5215(function ($) { 5216 var $window = $(window); 5217 var $actualAtb = $('.pricing-actions .add-to-cart'); 5218 var $stickyAtb = $('.sticky-atb'); 5219 $window.on('scroll', throttle(function () { 5220 var windowScrollTop = $window.scrollTop(); 5221 var actualAtbOffsetTop = $actualAtb.length ? $actualAtb.offset().top : 0; 5222 toggleStickyAtb($stickyAtb, windowScrollTop, actualAtbOffsetTop); 5223 }, 100)); 5224 var $footer = document.querySelector('footer'); 5225 var stickyButton = document.querySelector('.sticky-atb'); 5226 var observer = new IntersectionObserver(function (entries) {
5227 entries.forEach(function (entry) { 5228 if (entry.isIntersecting && stickyButton) { 5229 stickyButton.classList.add('footer-touched'); 5230 } else if (stickyButton) { 5231 stickyButton.classList.remove('footer-touched'); 5232 } 5233 }); 5234 }, { 5235 rootMargin: '0px', 5236 threshold: 0.1 // Trigger as soon as they touch 5237 }); 5238 observer.observe($footer); 5239})(jQuery); 5240 5241/** 5242 * Parses the html for a modal window 5243 * @param {string} html - representing the body and footer of the modal window 5244 * 5245 * @return {Object} - Object with properties body and footer. 5246 */ 5247function parseHtml(html) { 5248 var $html = $('<div>').append($.parseHTML(html)); 5249 var body = $html.find('.choice-of-bonus-product'); 5250 var footer = $html.find('.modal-footer').children(); 5251 return { 5252 body: body, 5253 footer: footer 5254 }; 5255} 5256 5257/** 5258 * Retrieves url to use when adding a product to the cart 5259 * 5260 * @param {Object} data - data object used to fill in dynamic portions of the html 5261 */ 5262function chooseBonusProducts(data) { 5263 $('.modal-body').spinner().start(); 5264 if ($('#chooseBonusProductModal').length !== 0) { 5265 $('#chooseBonusProductModal').remove(); 5266 } 5267 var bonusUrl; 5268 if (data.bonusChoiceRuleBased) { 5269 bonusUrl = data.showProductsUrlRuleBased; 5270 } else { 5271 bonusUrl = data.showProductsUrlListBased; 5272 } 5273 var htmlString = '<!-- Modal -->' + '<div class="modal fade" id="chooseBonusProductModal" tabindex="-1" role="dialog">' + '<span class="enter-message sr-only" ></span>' + '<div class="modal-dialog choose-bonus-product-dialog" ' + 'data-total-qty="' + data.maxBonusItems + '"' + 'data-UUID="' + data.uuid + '"' + 'data-pliUUID="' + data.pliUUID + '"' + 'data-addToCartUrl="' + data.addToCartUrl + '"' + 'data-pageStart="0"' + 'data-pageSize="' + data.pageSize + '"' + 'data-moreURL="' + data.showProductsUrlRuleBased + '"' + 'data-bonusChoiceRuleBased="' + data.bonusChoiceRuleBased + '">' + '<!-- Modal content-->' + '<div class="modal-content">' + '<div class="modal-header">' + ' <span class="">' + data.labels.selectprods + '</span>' + ' <button type="button" class="close pull-right" data-dismiss="modal">' + ' <span aria-hidden="true">×</span>' + ' <span class="sr-only"> </span>' + ' </button>' + '</div>' + '<div class="modal-body"></div>' + '<div class="modal-footer"></div>' + '</div>' + '</div>' + '</div>'; 5274 $('body').append(htmlString); 5275 $('.modal-body').spinner().start(); 5276 $.ajax({ 5277 url: bonusUrl, 5278 method: 'GET', 5279 dataType: 'json', 5280 success: function success(response) { 5281 var parsedHtml = parseHtml(response.renderedTemplate); 5282 $('#chooseBonusProductModal .modal-body').empty(); 5283 $('#chooseBonusProductModal .enter-message').text(response.enterDialogMessage); 5284 $('#chooseBonusProductModal .modal-header .close .sr-only').text(response.closeButtonText); 5285 $('#chooseBonusProductModal .modal-body').html(parsedHtml.body); 5286 $('#chooseBonusProductModal .modal-footer').html(parsedHtml.footer); 5287 $('#chooseBonusProductModal').modal('show'); 5288 $.spinner().stop(); 5289 }, 5290 error: function error() { 5291 $.spinner().stop(); 5292 } 5293 }); 5294} 5295 5296/** 5297 * Updates the Mini-Cart quantity value after the customer has pressed the "Add to Cart" button 5298 * @param {string} response - ajax response from clicking the add to cart button 5299 */ 5300detail.handlePostCartAdd = function (response) { 5301 $('.minicart').trigger('count:update', response); 5302 // show add to cart toast 5303 if (response && response.newBonusDiscountLineItem && Object.keys(response.newBonusDiscountLineItem).length !== 0) {
5304 chooseBonusProducts(response.newBonusDiscountLineItem); 5305 } 5306}; 5307/** 5308 * Makes a call to the server to report the event of adding an item to the cart 5309 * 5310 * @param {string | boolean} url - a string representing the end point to hit so that the event can be recorded, or false 5311 */ 5312detail.miniCartReportingUrl = function (url) { 5313 if (url) { 5314 $.ajax({ 5315 url: url, 5316 method: 'GET', 5317 success: function success() { 5318 // reporting urls hit on the server 5319 }, 5320 error: function error() { 5321 // no reporting urls hit on the server 5322 } 5323 }); 5324 } 5325}; 5326 5327/** 5328* Showing the toast message when the customer has pressed the "Add to Cart" button 5329* @param {string} response - ajax response from clicking the add to cart button 5330*/ 5331function toastmessage(response) { 5332 // eslint-disable-line no-unused-vars 5333 var messageType = response.error ? 'error' : 'success'; 5334 var $modal = $('#tryit-modal'); 5335 var modalData = $modal.data(); 5336 var message = response.error ? modalData.errormsg : modalData.sucssessmsg; 5337 Snackbar.show({ 5338 type: messageType, 5339 position: 'left', 5340 message: message 5341 }); 5342} 5343 5344/** 5345 * Safely parse a Porthole message payload. 5346 * @param {string|Object} messageData - Raw event payload. 5347 * @returns {Object|null} Parsed payload when available. 5348 */ 5349function parseTryItMessageData(messageData) { 5350 if (!messageData) { 5351 return null; 5352 } 5353 if (_typeof(messageData) === 'object') { 5354 return messageData; 5355 } 5356 if (typeof messageData !== 'string') { 5357 return null; 5358 } 5359 try { 5360 return JSON.parse(messageData); 5361 } catch (error) { 5362 return null; 5363 } 5364} 5365 5366/** 5367 * Normalize a numeric iframe dimension. 5368 * @param {string|number} value - Raw dimension value. 5369 * @returns {number|null} Normalized dimension. 5370 */ 5371function normalizeTryItDimension(value) { 5372 var numericValue = parseFloat(value); 5373 if (Number.isNaN(numericValue) || numericValue <= 0) { 5374 return null; 5375 } 5376 return Math.ceil(numericValue); 5377} 5378 5379/** 5380 * Get the visible viewport width for try-it sizing. 5381 * @returns {number} Viewport width. 5382 */ 5383function getTryItViewportWidth() { 5384 if (window.visualViewport && window.visualViewport.width) { 5385 return Math.round(window.visualViewport.width); 5386 } 5387 return window.innerWidth || document.documentElement.clientWidth || 0; 5388} 5389 5390/** 5391 * Get the visible viewport height for try-it sizing. 5392 * @returns {number} Viewport height. 5393 */
5394function getTryItViewportHeight() { 5395 if (window.visualViewport && window.visualViewport.height) { 5396 return Math.round(window.visualViewport.height); 5397 } 5398 return window.innerHeight || document.documentElement.clientHeight || 0; 5399} 5400 5401/** 5402 * Determine whether the browser is currently pinch-zoomed. 5403 * @returns {boolean} True when visual viewport scale is above the default level. 5404 */ 5405function isTryItViewportZoomed() { 5406 return Boolean(window.visualViewport && typeof window.visualViewport.scale === 'number' && window.visualViewport.scale > 1); 5407} 5408 5409/** 5410 * Determine whether try-it modal sizing should use the mobile fullscreen path. 5411 * @returns {boolean} True when viewport is mobile-sized. 5412 */ 5413function isTryItMobileViewport() { 5414 var hasCoarsePointer = window.matchMedia && window.matchMedia('(pointer: coarse)').matches; 5415 var hasTouchPoints = typeof navigator.maxTouchPoints === 'number' && navigator.maxTouchPoints > 0; 5416 var viewportHeight = getTryItViewportHeight(); 5417 var viewportWidth = getTryItViewportWidth(); 5418 var largestViewportDimension = Math.max(viewportWidth, viewportHeight); 5419 var smallestViewportDimension = Math.min(viewportWidth, viewportHeight); 5420 return (hasCoarsePointer || hasTouchPoints) && smallestViewportDimension < TRY_IT_MOBILE_BREAKPOINT && largestViewportDimension < TRY_IT_MOBILE_MAX_DIMENSION; 5421} 5422 5423/** 5424 * Determine whether the viewport is narrow but should still use constrained desktop sizing. 5425 * @returns {boolean} True when viewport is narrow and not mobile-fullscreen. 5426 */ 5427function isTryItConstrainedViewport() { 5428 return !isTryItMobileViewport() && getTryItViewportWidth() < TRY_IT_MOBILE_BREAKPOINT; 5429} 5430 5431/** 5432 * Get the available viewport height after the try-it desktop dialog margins. 5433 * @returns {number} Available height. 5434 */ 5435function getTryItAvailableViewportHeight() {
5436 var viewportHeight = getTryItViewportHeight(); 5437 if (isTryItMobileViewport()) { 5438 return viewportHeight; 5439 } 5440 return Math.max(viewportHeight - TRY_IT_DIALOG_VERTICAL_MARGIN, 320); 5441} 5442 5443/** 5444 * Get the current viewport orientation for try-it sizing state. 5445 * @returns {string} portrait or landscape. 5446 */ 5447function getTryItViewportOrientation() { 5448 return getTryItViewportWidth() >= getTryItViewportHeight() ? 'landscape' : 'portrait'; 5449} 5450 5451/** 5452 * Determine whether the try-it modal is currently visible. 5453 * @param {JQuery} $tryItModal - Modal receiving the iframe. 5454 * @returns {boolean} True when the modal is visible. 5455 */ 5456function isTryItModalVisible($tryItModal) { 5457 return Boolean($tryItModal && $tryItModal.length && $tryItModal.hasClass('show') && $tryItModal.is(':visible')); 5458} 5459 5460/** 5461 * Get the minimum safe width for a try-it iframe. 5462 * @param {JQuery} $tryItModal - Modal receiving the iframe. 5463 * @param {JQuery} $tryItIframe - Iframe receiving the sizing override. 5464 * @returns {number} Minimum safe width. 5465 */ 5466function getTryItMinimumWidth($tryItModal, $tryItIframe) { 5467 var modalBodyWidth = 0; 5468 var modalContentWidth = 0; 5469 var iframeWidth = 0; 5470 var iframeElement; 5471 var viewportWidth = getTryItViewportWidth(); 5472 var minimumFallbackWidth = Math.min(320, viewportWidth); 5473 var modalVisible = isTryItModalVisible($tryItModal); 5474 if ($tryItModal && $tryItModal.length) { 5475 modalBodyWidth = $tryItModal.find('.modal-body').first().innerWidth() || 0; 5476 modalContentWidth = $tryItModal.find('.modal-content').first().innerWidth() || 0; 5477 } 5478 if (modalVisible && $tryItIframe && $tryItIframe.length) { 5479 iframeElement = $tryItIframe.get(0); 5480 iframeWidth = iframeElement ? Math.round(iframeElement.getBoundingClientRect().width) : 0; 5481 } 5482 return Math.max(modalBodyWidth, modalContentWidth, iframeWidth, minimumFallbackWidth); 5483} 5484 5485/** 5486 * Get the minimum iframe height required for the vendor aspect ratio. 5487 * @param {number} width - Applied iframe width. 5488 * @returns {number|null} Aspect-ratio-derived height. 5489 */ 5490function getTryItAspectRatioHeight(width) { 5491 if (!width || width <= 0) { 5492 return null; 5493 } 5494 return Math.round(width * TRY_IT_IFRAME_ASPECT_RATIO_HEIGHT / TRY_IT_IFRAME_ASPECT_RATIO_WIDTH); 5495} 5496 5497/** 5498 * Get the minimum iframe width required for the vendor aspect ratio. 5499 * @param {number} height - Applied iframe height. 5500 * @returns {number|null} Aspect-ratio-derived width. 5501 */ 5502function getTryItAspectRatioWidth(height) { 5503 if (!height || height <= 0) { 5504 return null; 5505 } 5506 return Math.round(height * TRY_IT_IFRAME_ASPECT_RATIO_WIDTH / TRY_IT_IFRAME_ASPECT_RATIO_HEIGHT); 5507} 5508 5509/** 5510 * Determine whether the current iframe belongs to Mirror Me. 5511 * @param {JQuery} $tryItIframe - Iframe receiving the sizing override. 5512 * @returns {boolean} True when sizing Mirror Me. 5513 */ 5514function isMirrorMeTryItIframe($tryItIframe) { 5515 if (!$tryItIframe || !$tryItIframe.length) { 5516 return false; 5517 } 5518 return $tryItIframe.is('#MirrorMe') || $tryItIframe.hasClass('mirror-me-Iframe'); 5519} 5520 5521/** 5522 * Apply a small non-mobile width trim for Mirror Me to avoid internal vertical scroll. 5523 * @param {JQuery} $tryItIframe - Iframe receiving the sizing override. 5524 * @param {number|null} width - Width to adjust. 5525 * @returns {number|null} Width with app-specific adjustment applied. 5526 */ 5527function getTryItSafeNonMobileWidth($tryItIframe, width) { 5528 if (!width || width <= 0) { 5529 return null; 5530 } 5531 if (!isMirrorMeTryItIframe($tryItIframe)) { 5532 return width; 5533 } 5534 return Math.max(Math.round(width * TRY_IT_MIRROR_ME_NON_MOBILE_WIDTH_SAFETY_FACTOR), 1); 5535} 5536 5537/** 5538 * Get the non-mobile height buffer for the current try-it app. 5539 * @param {JQuery} $tryItIframe - Iframe receiving the sizing override. 5540 * @returns {number} Height buffer to apply. 5541 */ 5542function getTryItNonMobileHeightBuffer($tryItIframe) { 5543 return isMirrorMeTryItIframe($tryItIframe) ? TRY_IT_IFRAME_HEIGHT_BUFFER : 0; 5544} 5545 5546/** 5547 * Fit iframe dimensions inside the available viewport while preserving aspect ratio. 5548 * @param {number|null} width - Natural iframe width. 5549 * @param {number|null} height - Natural iframe height. 5550 * @param {number} maxWidth - Available viewport width. 5551 * @param {number} maxHeight - Available viewport height. 5552 * @returns {Object|null} Contained dimensions. 5553 */ 5554function getTryItContainedDimensions(width, height, maxWidth, maxHeight) { 5555 var aspectRatio; 5556 var containedHeight; 5557 var containedWidth; 5558 if (!width || !height || !maxWidth || !maxHeight) { 5559 return null; 5560 } 5561 aspectRatio = width / height; 5562 containedWidth = Math.min(width, maxWidth); 5563 containedHeight = Math.round(containedWidth / aspectRatio); 5564 if (containedHeight > maxHeight) { 5565 containedHeight = maxHeight; 5566 containedWidth = Math.round(containedHeight * aspectRatio); 5567 } 5568 return { 5569 height: containedHeight, 5570 width: containedWidth 5571 }; 5572} 5573 5574/** 5575 * Read the last stored vendor resize payload for a modal. 5576 * @param {JQuery} $tryItModal - Modal receiving the iframe. 5577 * @returns {Object|null} Stored vendor dimensions. 5578 */ 5579function getStoredTryItModalDimensions($tryItModal) { 5580 var storedDimensions; 5581 if (!$tryItModal || !$tryItModal.length) { 5582 return null; 5583 }
5584 storedDimensions = $tryItModal.data('tryitLastDimensions'); 5585 return storedDimensions || null; 5586} 5587 5588/** 5589 * Toggle vertical centering based on rendered try-it modal height. 5590 * @param {JQuery} $tryItModal - Modal receiving the iframe. 5591 * @param {number|null} iframeHeight - Applied iframe height. 5592 * @returns {void} 5593 */ 5594function updateTryItModalVerticalAlignment($tryItModal, iframeHeight) { 5595 var viewportHeight; 5596 var shouldCenter; 5597 if (!$tryItModal || !$tryItModal.length) { 5598 return; 5599 } 5600 if (isTryItMobileViewport()) { 5601 $tryItModal.removeClass('tryit-modal--centered'); 5602 return; 5603 } 5604 viewportHeight = getTryItViewportHeight(); 5605 shouldCenter = Boolean(iframeHeight && iframeHeight < viewportHeight); 5606 $tryItModal.toggleClass('tryit-modal--centered', shouldCenter); 5607} 5608 5609/** 5610 * Toggle modal viewport mode classes for mobile-specific layout overrides. 5611 * @param {JQuery} $tryItModal - Modal receiving the iframe. 5612 * @returns {void} 5613 */ 5614function updateTryItModalViewportMode($tryItModal) { 5615 var isMobileViewport; 5616 if (!$tryItModal || !$tryItModal.length) { 5617 return; 5618 } 5619 isMobileViewport = isTryItMobileViewport(); 5620 $tryItModal.toggleClass('tryit-modal--mobile-viewport', isMobileViewport); 5621 $tryItModal.toggleClass('tryit-modal--constrained-viewport', !isMobileViewport && isTryItConstrainedViewport()); 5622} 5623 5624/** 5625 * Determine whether the incoming vendor resize payload matches the current modal state. 5626 * @param {JQuery} $tryItModal - Modal receiving the iframe. 5627 * @param {Object} resizeData - Vendor resize payload. 5628 * @returns {boolean} True when the resize is already applied. 5629 */ 5630function isDuplicateTryItVendorResize($tryItModal, resizeData) { 5631 var storedDimensions; 5632 if (!$tryItModal || !$tryItModal.length || !resizeData) { 5633 return false; 5634 } 5635 storedDimensions = getStoredTryItModalDimensions($tryItModal); 5636 return Boolean(storedDimensions && storedDimensions.source === 'vendor' && storedDimensions.orientation === getTryItViewportOrientation() && storedDimensions.width === (resizeData.width || null) && storedDimensions.height === (resizeData.height || null)); 5637} 5638 5639/** 5640 * Persist the last valid try-it resize payload on the modal. 5641 * @param {JQuery} $tryItModal - Modal receiving the iframe. 5642 * @param {Object} dimensions - Parsed dimensions. 5643 * @returns {void} 5644 */ 5645function storeTryItModalDimensions($tryItModal, dimensions) { 5646 if (!$tryItModal || !$tryItModal.length || !dimensions) { 5647 return; 5648 } 5649 $tryItModal.data('tryitLastDimensions', { 5650 height: dimensions.height || null, 5651 orientation: getTryItViewportOrientation(), 5652 source: 'vendor', 5653 width: dimensions.width || null 5654 }); 5655} 5656 5657/** 5658 * Build viewport-adaptive fallback dimensions for refresh events. 5659 * @param {JQuery} $tryItModal - Modal receiving the iframe. 5660 * @param {JQuery} $tryItIframe - Iframe receiving the sizing override. 5661 * @returns {Object|null} Fallback dimensions. 5662 */ 5663function getTryItViewportFallbackDimensions($tryItModal, $tryItIframe) { 5664 var iframeElement; 5665 var fallbackWidth; 5666 var fallbackHeight; 5667 var minimumWidth; 5668 var viewportHeight; 5669 var viewportWidth; 5670 var modalVisible; 5671 if (!$tryItModal || !$tryItModal.length || !$tryItIframe || !$tryItIframe.length) { 5672 return null; 5673 } 5674 $tryItIframe.css('--tryit-iframe-height', ''); 5675 $tryItIframe.css('--tryit-iframe-width', ''); 5676 viewportWidth = getTryItViewportWidth();
5677 viewportHeight = getTryItViewportHeight(); 5678 minimumWidth = getTryItMinimumWidth($tryItModal, $tryItIframe); 5679 modalVisible = isTryItModalVisible($tryItModal); 5680 if (isTryItMobileViewport()) { 5681 return { 5682 orientation: getTryItViewportOrientation(), 5683 source: 'fallback', 5684 width: viewportWidth, 5685 height: viewportHeight 5686 }; 5687 } 5688 iframeElement = $tryItIframe.get(0); 5689 fallbackWidth = modalVisible && iframeElement ? Math.round(iframeElement.getBoundingClientRect().width) : 0; 5690 if (!fallbackWidth) { 5691 fallbackWidth = modalVisible ? minimumWidth : viewportWidth; 5692 } 5693 fallbackWidth = Math.min(Math.max(fallbackWidth, minimumWidth), viewportWidth); 5694 fallbackHeight = getTryItAspectRatioHeight(fallbackWidth); 5695 if (!fallbackWidth && !fallbackHeight) { 5696 return null; 5697 } 5698 return { 5699 orientation: getTryItViewportOrientation(), 5700 source: 'fallback', 5701 width: fallbackWidth, 5702 height: fallbackHeight 5703 }; 5704} 5705 5706/** 5707 * Rebuild dimensions for the current orientation using the last vendor aspect ratio. 5708 * @param {Object} dimensions - Last known vendor dimensions. 5709 * @returns {Object|null} Orientation-adjusted dimensions. 5710 */ 5711function getTryItOrientationAdjustedDimensions(dimensions) { 5712 var availableHeight; 5713 var containedDimensions; 5714 var defaultHeight; 5715 var defaultWidth; 5716 var maxContentHeight; 5717 var viewportWidth; 5718 if (!dimensions || !dimensions.width || !dimensions.height) { 5719 return null; 5720 } 5721 if (isTryItMobileViewport()) { 5722 return { 5723 orientation: getTryItViewportOrientation(), 5724 source: 'fallback', 5725 width: getTryItViewportWidth(),
5726 height: getTryItViewportHeight() 5727 }; 5728 } 5729 viewportWidth = getTryItViewportWidth(); 5730 availableHeight = getTryItAvailableViewportHeight(); 5731 defaultHeight = dimensions.height; 5732 maxContentHeight = Math.max(availableHeight - TRY_IT_IFRAME_HEIGHT_BUFFER, 0); 5733 if (!defaultHeight) { 5734 defaultHeight = getTryItAspectRatioHeight(viewportWidth); 5735 } 5736 defaultWidth = getTryItAspectRatioWidth(defaultHeight) || viewportWidth; 5737 containedDimensions = getTryItContainedDimensions(defaultWidth, defaultHeight, viewportWidth, maxContentHeight || availableHeight); 5738 if (!containedDimensions) { 5739 return null; 5740 } 5741 return { 5742 orientation: getTryItViewportOrientation(), 5743 source: 'fallback', 5744 width: containedDimensions.width, 5745 height: containedDimensions.height 5746 }; 5747} 5748 5749/** 5750 * Extract resize dimensions from a Porthole message. 5751 * Supports JSON payloads and query-string style payloads. 5752 * @param {string|Object} messageData - Raw event payload. 5753 * @returns {Object|null} Parsed dimensions. 5754 */ 5755function parseTryItResizeMessage(messageData) { 5756 var parsedMessage = parseTryItMessageData(messageData); 5757 var resizeHeight; 5758 var resizeWidth; 5759 var messageType; 5760 var payload; 5761 var params; 5762 if (parsedMessage) { 5763 messageType = parsedMessage.type || parsedMessage.event || parsedMessage.action || parsedMessage.name; 5764 payload = parsedMessage.payload || parsedMessage.data || parsedMessage.detail; 5765 resizeHeight = normalizeTryItDimension(parsedMessage.height || parsedMessage.iframeHeight || parsedMessage.modalHeight || payload && payload.height || parsedMessage.size && parsedMessage.size.height); 5766 resizeWidth = normalizeTryItDimension(parsedMessage.width || parsedMessage.iframeWidth || parsedMessage.modalWidth || payload && payload.width || parsedMessage.size && parsedMessage.size.width); 5767 if ((messageType === 'foundationMatchAppResize' || messageType === 'mkrealtimeAppResize') && (resizeHeight || resizeWidth)) { 5768 return { 5769 height: resizeHeight, 5770 width: resizeWidth 5771 }; 5772 } 5773 return null; 5774 } 5775 if (typeof messageData !== 'string' || messageData.indexOf('=') === -1) { 5776 return null; 5777 } 5778 params = new URLSearchParams(messageData); 5779 messageType = params.get('type') || params.get('event') || params.get('action') || params.get('name'); 5780 resizeHeight = normalizeTryItDimension(params.get('height') || params.get('iframeHeight') || params.get('modalHeight')); 5781 resizeWidth = normalizeTryItDimension(params.get('width') || params.get('iframeWidth') || params.get('modalWidth')); 5782 if ((messageType === 'foundationMatchAppResize' || messageType === 'mkrealtimeAppResize') && (resizeHeight || resizeWidth)) { 5783 return { 5784 height: resizeHeight, 5785 width: resizeWidth 5786 }; 5787 } 5788 return null; 5789} 5790 5791/** 5792 * Apply modal sizing overrides received from the iframe. 5793 * @param {JQuery} $tryItModal - Modal receiving the iframe. 5794 * @param {Object} dimensions - Parsed dimensions. 5795 * @returns {void} 5796 */ 5797function applyTryItModalDimensions($tryItModal, dimensions) { 5798 var $tryItIframe; 5799 var containedDimensions; 5800 var defaultHeight; 5801 var defaultWidth; 5802 var isMirrorMeIframe; 5803 var iframeHeightBuffer; 5804 var isMobileViewport; 5805 var maxContentHeight; 5806 var safeHeight; 5807 var safeWidth; 5808 var availableHeight; 5809 var viewportHeight; 5810 var viewportWidth; 5811 var minimumWidth; 5812 if (!$tryItModal || !$tryItModal.length || !dimensions) { 5813 return; 5814 } 5815 updateTryItModalViewportMode($tryItModal); 5816 $tryItIframe = $tryItModal.find('.mirror-me-Iframe, .find-my-match-Iframe').first(); 5817 if (!$tryItIframe.length) { 5818 $tryItIframe = $tryItModal.find('iframe').first(); 5819 } 5820 if (!$tryItIframe.length) { 5821 return; 5822 } 5823 if (isTryItMobileViewport() && isTryItViewportZoomed()) { 5824 return; 5825 } 5826 viewportWidth = getTryItViewportWidth();
5827 viewportHeight = getTryItViewportHeight(); 5828 availableHeight = getTryItAvailableViewportHeight(); 5829 isMobileViewport = isTryItMobileViewport(); 5830 isMirrorMeIframe = isMirrorMeTryItIframe($tryItIframe); 5831 minimumWidth = getTryItMinimumWidth($tryItModal, $tryItIframe); 5832 iframeHeightBuffer = isMobileViewport ? TRY_IT_IFRAME_HEIGHT_BUFFER : getTryItNonMobileHeightBuffer($tryItIframe); 5833 maxContentHeight = Math.max(availableHeight - iframeHeightBuffer, 0); 5834 if (isMobileViewport) { 5835 safeWidth = viewportWidth; 5836 safeHeight = Math.max(viewportHeight, 320); 5837 } else { 5838 defaultHeight = dimensions.height || getTryItAspectRatioHeight(viewportWidth); 5839 defaultWidth = isMirrorMeIframe ? getTryItAspectRatioWidth(defaultHeight) : dimensions.width; 5840 if (!defaultWidth) { 5841 defaultWidth = getTryItAspectRatioWidth(defaultHeight) || viewportWidth; 5842 } 5843 if (!defaultWidth) { 5844 defaultWidth = Math.max(dimensions.width || 0, minimumWidth); 5845 defaultHeight = dimensions.height || getTryItAspectRatioHeight(defaultWidth); 5846 } 5847 if (defaultHeight <= maxContentHeight && defaultWidth <= viewportWidth) { 5848 containedDimensions = { 5849 height: defaultHeight, 5850 width: defaultWidth 5851 }; 5852 } else { 5853 containedDimensions = getTryItContainedDimensions(defaultWidth, defaultHeight, viewportWidth, maxContentHeight || availableHeight); 5854 } 5855 if (containedDimensions) { 5856 safeWidth = getTryItSafeNonMobileWidth($tryItIframe, containedDimensions.width) || containedDimensions.width; 5857 safeHeight = Math.min(containedDimensions.height + iframeHeightBuffer, availableHeight); 5858 } 5859 } 5860 if (safeHeight) { 5861 $tryItIframe.css('--tryit-iframe-height', "".concat(safeHeight, "px")); 5862 } 5863 if (safeWidth) { 5864 $tryItIframe.css('--tryit-iframe-width', "".concat(safeWidth, "px")); 5865 } 5866 updateTryItModalVerticalAlignment($tryItModal, safeHeight); 5867} 5868 5869/** 5870 * Clear modal sizing overrides so each open starts from defaults. 5871 * @param {JQuery} $tryItModal - Modal receiving the iframe. 5872 * @returns {void} 5873 */ 5874function resetTryItModalDimensions($tryItModal) { 5875 var $tryItIframe; 5876 if (!$tryItModal || !$tryItModal.length) { 5877 return; 5878 } 5879 $tryItIframe = $tryItModal.find('.mirror-me-Iframe, .find-my-match-Iframe').first(); 5880 if (!$tryItIframe.length) { 5881 $tryItIframe = $tryItModal.find('iframe').first(); 5882 } 5883 if ($tryItIframe.length) { 5884 $tryItIframe.css('--tryit-iframe-height', ''); 5885 $tryItIframe.css('--tryit-iframe-width', ''); 5886 } 5887 $tryItModal.removeData('tryitLastDimensions'); 5888 updateTryItModalViewportMode($tryItModal); 5889 $tryItModal.removeClass('tryit-modal--centered'); 5890} 5891 5892/** 5893 * Get the origin for a remote iframe URL. 5894 * @param {string} url - Remote iframe URL. 5895 * @returns {string|null} Origin when valid. 5896 */ 5897function getTryItOrigin(url) { 5898 if (!url) { 5899 return null; 5900 } 5901 try { 5902 return new URL(url, window.location.origin).origin; 5903 } catch (error) { 5904 return null; 5905 } 5906} 5907 5908/** 5909 * Run a callback after layout has settled for a modal sizing pass. 5910 * @param {Function} callback - Work to run after paint. 5911 * @returns {void} 5912 */ 5913function runAfterTryItLayout(callback) { 5914 var requestFrame = window.requestAnimationFrame || function (fn) { 5915 return window.setTimeout(fn, 0); 5916 }; 5917 requestFrame(function () { 5918 requestFrame(callback); 5919 }); 5920} 5921 5922// jQuery IIFE to listen to click event 5923(function ($) { 5924 var baseURL = $('.find-my-match-Iframes').attr('data-baseurl'); 5925 var parentSelector = ".product-detail"; 5926 var $parent = $(parentSelector); 5927 var $modal = $('#tryit-modal', $parent); 5928 var findMyMatchProxy = null; 5929 var findMyMatchHandler = null; 5930 5931 // Mirror me 5932 var mirrorMeURL = $('.mirror-me-Iframes').attr('data-baseurl'); 5933 var findMyMatchOrigin = getTryItOrigin(baseURL); 5934 var mirrorMeOrigin = getTryItOrigin(mirrorMeURL); 5935 var allowedTryItOrigins = [findMyMatchOrigin, mirrorMeOrigin].filter(Boolean); 5936 var mirrorMeProxy = null; 5937 var mirrorMeHandler = null; 5938 var $currentTryItModal = $(); 5939 var tryItResizeTimeout = null; 5940 5941 /** 5942 * Resolve a try-it modal that contains the expected iframe. 5943 * @param {string} iframeSelector - Iframe selector to match. 5944 * @returns {JQuery} Matching modal. 5945 */ 5946 function getActiveTryItModal(iframeSelector) { 5947 var $candidateModal; 5948 if ($currentTryItModal.length && (!iframeSelector || $currentTryItModal.find(iframeSelector).length)) { 5949 return $currentTryItModal; 5950 } 5951 $candidateModal = $('.tryit-modal.show', $parent).filter(function () { 5952 return !iframeSelector || $(this).find(iframeSelector).length; 5953 }).first(); 5954 if ($candidateModal.length) { 5955 return $candidateModal; 5956 } 5957 return $('#tryit-modal', $parent).filter(function () { 5958 return !iframeSelector || $(this).find(iframeSelector).length; 5959 }).first(); 5960 } 5961 5962 /** 5963 * Resolve the iframe selector for the currently open try-it modal. 5964 * @returns {string} Iframe selector. 5965 */ 5966 function getCurrentTryItIframeSelector() { 5967 var $activeModal = getActiveTryItModal(); 5968 var modalType; 5969 if (!$activeModal || !$activeModal.length) { 5970 return ''; 5971 } 5972 if ($activeModal.find('#MirrorMe').length) { 5973 return '#MirrorMe'; 5974 } 5975 if ($activeModal.find('#FindMyMatch').length) { 5976 return '#FindMyMatch'; 5977 } 5978 modalType = $activeModal.find('.close').attr('data-type'); 5979 if (modalType === 'mirror-me') { 5980 return '#MirrorMe'; 5981 } 5982 if (modalType === 'find-my-match') { 5983 return '#FindMyMatch'; 5984 } 5985 return ''; 5986 } 5987 5988 /** 5989 * Refresh sizing for a specific try-it modal. 5990 * @param {JQuery} $tryItModal - Modal to resize. 5991 * @param {string} iframeSelector - Iframe selector to match. 5992 * @returns {void} 5993 */ 5994 function refreshTryItModalDimensions($tryItModal, iframeSelector) { 5995 var $activeIframe; 5996 var fallbackDimensions; 5997 var currentOrientation; 5998 var orientationAdjustedDimensions; 5999 var storedDimensions; 6000 if (!$tryItModal.length || !iframeSelector) { 6001 return; 6002 } 6003 $activeIframe = iframeSelector ? $tryItModal.find(iframeSelector).first() : $tryItModal.find('iframe').first(); 6004 updateTryItModalViewportMode($tryItModal); 6005 storedDimensions = getStoredTryItModalDimensions($tryItModal); 6006 currentOrientation = getTryItViewportOrientation(); 6007 if (storedDimensions && storedDimensions.source === 'vendor' && storedDimensions.orientation === currentOrientation) { 6008 applyTryItModalDimensions($tryItModal, storedDimensions); 6009 return; 6010 } 6011 if (storedDimensions && storedDimensions.source === 'vendor') { 6012 orientationAdjustedDimensions = getTryItOrientationAdjustedDimensions(storedDimensions); 6013 if (orientationAdjustedDimensions) { 6014 applyTryItModalDimensions($tryItModal, orientationAdjustedDimensions); 6015 return; 6016 } 6017 } 6018 fallbackDimensions = getTryItViewportFallbackDimensions($tryItModal, $activeIframe); 6019 if (fallbackDimensions) { 6020 applyTryItModalDimensions($tryItModal, fallbackDimensions); 6021 } 6022 } 6023 6024 /** 6025 * Refresh the open try-it modal after viewport changes. 6026 * @returns {void} 6027 */ 6028 function refreshCurrentTryItModalDimensions() { 6029 var iframeSelector = getCurrentTryItIframeSelector(); 6030 var $activeModal = getActiveTryItModal(iframeSelector); 6031 if (!$activeModal.length || !iframeSelector) { 6032 return; 6033 } 6034 refreshTryItModalDimensions($activeModal, iframeSelector); 6035 } 6036 6037 /**
6038 * Clear any pending viewport refresh request. 6039 * @returns {void} 6040 */ 6041 function clearPendingTryItResizeTimeout() { 6042 if (!tryItResizeTimeout) { 6043 return; 6044 } 6045 window.clearTimeout(tryItResizeTimeout); 6046 tryItResizeTimeout = null; 6047 } 6048 6049 /** 6050 * Schedule a try-it resize request after viewport changes settle. 6051 * @returns {void} 6052 */ 6053 function scheduleTryItViewportRefresh() { 6054 if (isTryItViewportZoomed()) { 6055 return; 6056 } 6057 clearPendingTryItResizeTimeout(); 6058 tryItResizeTimeout = window.setTimeout(function () { 6059 tryItResizeTimeout = null; 6060 runAfterTryItLayout(refreshCurrentTryItModalDimensions); 6061 }, 150); 6062 } 6063 6064 /** 6065 * Register viewport and orientation listeners for try-it modal resizing. 6066 * @returns {void} 6067 */ 6068 function registerTryItViewportRefreshListeners() { 6069 var orientationMediaQuery; 6070 window.addEventListener('resize', scheduleTryItViewportRefresh); 6071 window.addEventListener('orientationchange', scheduleTryItViewportRefresh); 6072 if (window.visualViewport) { 6073 window.visualViewport.addEventListener('resize', scheduleTryItViewportRefresh); 6074 } 6075 if (window.screen && window.screen.orientation && typeof window.screen.orientation.addEventListener === 'function') { 6076 window.screen.orientation.addEventListener('change', scheduleTryItViewportRefresh); 6077 } 6078 if (!window.matchMedia) { 6079 return; 6080 } 6081 orientationMediaQuery = window.matchMedia('(orientation: portrait)'); 6082 if (typeof orientationMediaQuery.addEventListener === 'function') { 6083 orientationMediaQuery.addEventListener('change', scheduleTryItViewportRefresh); 6084 } else if (typeof orientationMediaQuery.addListener === 'function') { 6085 orientationMediaQuery.addListener(scheduleTryItViewportRefresh); 6086 } 6087 } 6088 6089 /** 6090 * Apply resize data from a trusted postMessage event. 6091 * @param {MessageEvent} event - Browser message event. 6092 * @returns {void} 6093 */ 6094 function handleTryItWindowMessage(event) { 6095 var iframeSelector; 6096 var resizeData; 6097 var $activeModal; 6098 if (!event || allowedTryItOrigins.indexOf(event.origin) === -1) { 6099 return; 6100 } 6101 if (event.origin === mirrorMeOrigin) { 6102 iframeSelector = '#MirrorMe'; 6103 } else if (event.origin === findMyMatchOrigin) { 6104 iframeSelector = '#FindMyMatch'; 6105 } 6106 resizeData = parseTryItResizeMessage(event.data); 6107 if (!resizeData) { 6108 return; 6109 } 6110 if (isTryItViewportZoomed()) { 6111 return; 6112 } 6113 $activeModal = getActiveTryItModal(iframeSelector); 6114 if (isDuplicateTryItVendorResize($activeModal, resizeData)) { 6115 return; 6116 } 6117 storeTryItModalDimensions($activeModal, resizeData); 6118 applyTryItModalDimensions($activeModal, resizeData); 6119 } 6120 window.addEventListener('message', handleTryItWindowMessage); 6121 registerTryItViewportRefreshListeners(); 6122 6123 /** 6124 * Initialize Porthole proxy and event listener 6125 */ 6126 function initializemirrorMeProxy() { 6127 if (typeof Porthole !== 'undefined') { 6128 if (mirrorMeProxy && mirrorMeHandler) { 6129 mirrorMeProxy.removeEventListener(mirrorMeHandler); 6130 } 6131 mirrorMeProxy = new Porthole.WindowProxy(mirrorMeURL, 'mirrorMe'); // eslint-disable-line 6132 6133 mirrorMeHandler = function mirrorMeHandler(event) { 6134 if ((event === null || event === void 0 ? void 0 : event.origin) !== mirrorMeURL) { 6135 return; 6136 } 6137 var resizeData = parseTryItResizeMessage(event && event.data); 6138 if (resizeData) { 6139 var $mirrorMeModal = getActiveTryItModal('#MirrorMe'); 6140 if (isTryItViewportZoomed()) { 6141 return; 6142 } 6143 if (isDuplicateTryItVendorResize($mirrorMeModal, resizeData)) { 6144 return; 6145 } 6146 storeTryItModalDimensions($mirrorMeModal, resizeData); 6147 applyTryItModalDimensions($mirrorMeModal, resizeData); 6148 return; 6149 } 6150 if (typeof (event === null || event === void 0 ? void 0 : event.data) === 'string' && event.data.includes('addToBag')) { 6151 var data = event.data; 6152 var params = new URLSearchParams(data); 6153 var partId = params.get("productId"); 6154 var quantity = params.get("quantity"); 6155 var url = $('.add-to-cart-url').val(); 6156 var form = { 6157 pid: partId, 6158 quantity: quantity 6159 }; 6160 if (partId && url) { 6161 $.ajax({ 6162 url: url, 6163 type: 'post', 6164 data: form, 6165 success: function success(response) { 6166 detail.handlePostCartAdd(response); 6167 $('body').trigger('product:afterAddToCart', response); 6168 detail.miniCartReportingUrl(response.reportingURL); 6169 minicart.miniCartShow(); 6170 } 6171 }); 6172 } 6173 } 6174 }; 6175 mirrorMeProxy.addEventListener(mirrorMeHandler); 6176 } 6177 } 6178 6179 /** 6180 * Initialize Porthole proxy and event listener 6181 */ 6182 function initializeFindMyMatchProxy() { 6183 if (typeof Porthole !== 'undefined') { 6184 if (findMyMatchProxy && findMyMatchHandler) { 6185 findMyMatchProxy.removeEventListener(findMyMatchHandler); 6186 } 6187 findMyMatchProxy = new Porthole.WindowProxy(baseURL, 'FindMyMatch'); // eslint-disable-line 6188 6189 findMyMatchHandler = function findMyMatchHandler(event) { 6190 if ((event === null || event === void 0 ? void 0 : event.origin) !== baseURL) { 6191 return; 6192 } 6193 var resizeData = parseTryItResizeMessage(event && event.data); 6194 if (resizeData) { 6195 var $findMyMatchModal = getActiveTryItModal('#FindMyMatch'); 6196 if (isTryItViewportZoomed()) { 6197 return; 6198 } 6199 if (isDuplicateTryItVendorResize($findMyMatchModal, resizeData)) { 6200 return; 6201 } 6202 storeTryItModalDimensions($findMyMatchModal, resizeData); 6203 applyTryItModalDimensions($findMyMatchModal, resizeData); 6204 return; 6205 } 6206 6207 // if (event?.origin === baseURL && event?.data && event.data.includes('add_to_cart')) { 6208 if (typeof (event === null || event === void 0 ? void 0 : event.data) === 'string' && event.data.includes('add_to_cart')) { 6209 var eventData = JSON.parse(event.data); 6210 var item = eventData.parameters.ecommerce.items[0]; 6211 var variantId = item.item_variant; 6212 var quantity = item.quantity; 6213 var url = $('.add-to-cart-url').val(); 6214 var form = { 6215 pid: variantId, 6216 quantity: quantity 6217 }; 6218 if (variantId && url) { 6219 $.ajax({ 6220 url: url, 6221 type: 'post', 6222 data: form, 6223 success: function success(data) { 6224 detail.handlePostCartAdd(data); 6225 $('body').trigger('product:afterAddToCart', data); 6226 detail.miniCartReportingUrl(data.reportingURL); 6227 minicart.miniCartShow(); 6228 } 6229 }); 6230 } 6231 } 6232 }; 6233 findMyMatchProxy.addEventListener(findMyMatchHandler); 6234 } 6235 } 6236 6237 /** 6238 * Close modal and reset iframe 6239 * @param {Object} $hostElement - jQuery object representing the host parent element 6240 */ 6241 function closeModal($hostElement) { 6242 var $parentElement = $hostElement || $parent; 6243 var $iframe = $('#FindMyMatch', $parentElement); 6244 var $openModal = $('#tryit-modal', $parentElement); 6245 if ($currentTryItModal.length && $currentTryItModal.is($openModal)) { 6246 $currentTryItModal = $(); 6247 } 6248 clearPendingTryItResizeTimeout(); 6249 resetTryItModalDimensions($openModal); 6250 if ($iframe) { 6251 var src = $iframe.attr('src'); 6252 $iframe.attr('src', ''); 6253 $iframe.attr('src', src); 6254 } 6255 if (findMyMatchProxy && findMyMatchHandler) { 6256 findMyMatchProxy.removeEventListener(findMyMatchHandler); 6257 findMyMatchHandler = null; 6258 } 6259 var findMyMatchmodalBody = $('.find-my-match-Iframes', $parentElement).html(); 6260 if (findMyMatchmodalBody.length) {
6261 $openModal.find('.modal-body').empty(); 6262 } 6263 $openModal.modal('hide'); 6264 } 6265 6266 /** 6267 * Close modal and reset iframe 6268 * @param {Object} $hostElement - jQuery object representing the host parent element 6269 */ 6270 function closeMirrorMeModal($hostElement) { 6271 var $parentElement = $hostElement || $parent; 6272 var $iframe = $('#MirrorMe', $parentElement); 6273 var $openModal = $('#tryit-modal', $parentElement); 6274 if ($currentTryItModal.length && $currentTryItModal.is($openModal)) { 6275 $currentTryItModal = $(); 6276 } 6277 clearPendingTryItResizeTimeout(); 6278 resetTryItModalDimensions($openModal); 6279 if ($iframe) { 6280 var src = $iframe.attr('src'); 6281 $iframe.attr('src', ''); 6282 $iframe.attr('src', src); 6283 } 6284 if (mirrorMeProxy && mirrorMeHandler) { 6285 mirrorMeProxy.removeEventListener(mirrorMeHandler); 6286 mirrorMeHandler = null; 6287 } 6288 var mirrorMemodalBody = $('.mirror-me-Iframes', $parentElement).html(); 6289 if (mirrorMemodalBody.length) { 6290 $openModal.find('.modal-body').empty(); 6291 } 6292 $openModal.modal('hide'); 6293 } 6294 $modal.on('hidden.bs.modal', '#tryit-modal', function () { 6295 var type = $(this).find('.close').attr('data-type'); 6296 var $hostElement = $(this).closest('.product-detail'); 6297 if (type === 'find-my-match') { 6298 closeModal($hostElement); 6299 } else if (type === 'mirror-me') { 6300 closeMirrorMeModal($hostElement); 6301 } 6302 $('html').removeAttr('tryit-modal-open'); 6303 }); 6304 6305 /** 6306 * Open generic modal and initialize iframe and proxy 6307 * @param {Object} $hostElement - jQuery object representing the host parent element 6308 * @param {Object} config - Configuration object for modal 6309 */ 6310 function openGenericModal($hostElement, config) { 6311 var $parentElement = $hostElement || $parent; 6312 var $iframe = $(config.iframeSelector, $parentElement); 6313 var $tryItModal = $('#tryit-modal', $parentElement); 6314 var $modalIframe; 6315 $currentTryItModal = $tryItModal; 6316 updateTryItModalViewportMode($tryItModal); 6317 resetTryItModalDimensions($tryItModal); 6318 6319 // Remove any existing handler 6320 $tryItModal.off('hidden.bs.modal'); 6321 6322 // Attach handler specific to this modal instance 6323 $tryItModal.on('hidden.bs.modal', function () { 6324 var type = $(this).find('.close').attr('data-type'); 6325 if (type === 'find-my-match') { 6326 closeModal($hostElement); 6327 } else if (type === 'mirror-me') { 6328 closeMirrorMeModal($hostElement); 6329 } 6330 $('html').removeAttr('tryit-modal-open'); 6331 }); 6332 if ($iframe) { 6333 var src = $iframe.attr('src'); 6334 $iframe.attr('src', src); 6335 } 6336 var modalBody = $(config.modalBodySelector, $parentElement).html(); 6337 if (modalBody.length) { 6338 $tryItModal.find('.modal-body').empty(); 6339 $tryItModal.find('.modal-body').html(modalBody); 6340 $tryItModal.find('.close').attr('data-type', config.type); 6341 $modalIframe = $tryItModal.find(config.iframeSelector); 6342 $tryItModal.off('shown.bs.modal.tryitSizing').on('shown.bs.modal.tryitSizing', function () { 6343 runAfterTryItLayout(function () { 6344 refreshTryItModalDimensions($tryItModal, config.iframeSelector); 6345 }); 6346 }); 6347 if ($modalIframe.length) { 6348 $modalIframe.off('load.tryitSizing').one('load.tryitSizing', function () { 6349 runAfterTryItLayout(function () { 6350 refreshTryItModalDimensions($tryItModal, config.iframeSelector); 6351 }); 6352 }); 6353 } 6354 $('html').attr('tryit-modal-open', 'true'); 6355 $tryItModal.modal('show'); 6356 } 6357 config.initializeProxy(); 6358 } 6359 6360 /** 6361 * Open modal and initialize iframe and proxy 6362 * @param {Object} $hostElement - jQuery object representing the host parent element 6363 */ 6364 function openModal($hostElement) { 6365 openGenericModal($hostElement, { 6366 iframeSelector: '#FindMyMatch', 6367 modalBodySelector: '.find-my-match-Iframes', 6368 type: 'find-my-match', 6369 initializeProxy: initializeFindMyMatchProxy 6370 }); 6371 } 6372 6373 /** 6374 * Open modal and initialize iframe and proxy 6375 * @param {Object} $hostElement - jQuery object representing the host parent element 6376 */ 6377 function openMirrorMeModal($hostElement) { 6378 openGenericModal($hostElement, { 6379 iframeSelector: '#MirrorMe', 6380 modalBodySelector: '.mirror-me-Iframes', 6381 type: 'mirror-me', 6382 initializeProxy: initializemirrorMeProxy 6383 }); 6384 } 6385 $parent.off('click', '.find-my-match-js').on('click', '.find-my-match-js', function (e) { 6386 e.preventDefault(); 6387 var $hostElement = $(this).closest('.product-detail'); 6388 if ($hostElement.length === 0) { 6389 console.error('find-my-match-js button not inside .product-detail container'); 6390 return; 6391 } 6392 openModal($hostElement); 6393 }); 6394 $parent.off('click', '.mirror-me-js').on('click', '.mirror-me-js', function (e) { 6395 e.preventDefault(); 6396 var $hostElement = $(this).closest('.product-detail'); 6397 if ($hostElement.length === 0) { 6398 console.error('mirror-me-js button not inside .product-detail container'); 6399 return; 6400 } 6401 openMirrorMeModal($hostElement); 6402 }); 6403 if (typeof Porthole !== 'undefined') { 6404 Porthole.WindowProxyDispatcher.start(); // eslint-disable-line 6405 } 6406 $parent.off('keydown', '.product-details-accordion .card-header').on('keydown', '.product-details-accordion .card-header', function (e) { 6407 if (e.key === 'Enter') { 6408 e.preventDefault(); 6409 $(this).find('.btn').trigger('click'); 6410 } 6411 }); 6412})(jQuery); 6413module.exports = _objectSpread(_objectSpread({}, base), detail); 6414 6415/***/ }), 6416
6417/***/ "./cartridges/org_marykay/cartridge/client/default/js/utilities.js": 6418/*!*************************************************************************!*\ 6419 !*** ./cartridges/org_marykay/cartridge/client/default/js/utilities.js ***! 6420 \*************************************************************************/ 6421/***/ (function(module) { 6422 6423var throttle = function throttle(func, limit) { 6424 var inThrottle; 6425 return function () { 6426 var args = arguments; 6427 var context = this; 6428 if (!inThrottle) { 6429 func.apply(context, args); 6430 inThrottle = true; 6431 setTimeout(function () { 6432 inThrottle = false; 6433 }, limit); 6434 } 6435 }; 6436}; 6437/** 6438 * Checks if a URL is relative - prevent url spoofing 6439 * @param {string} url - url to check 6440 * @returns {boolean} - true if relative URL 6441 */ 6442var isRelativeUrl = function isRelativeUrl(url) { 6443 return typeof url === 'string' && url.startsWith('/') && !url.startsWith('//'); 6444}; 6445var applyUrlParameter = function applyUrlParameter(urlString, parameterName, parameterValue) { 6446 if (!urlString || !parameterName) { 6447 return urlString; 6448 } 6449 var url; 6450 try { 6451 url = new URL(urlString); 6452 } catch (e) { 6453 return urlString; 6454 } 6455 url.searchParams.set(parameterName, parameterValue); 6456 return url.toString(); 6457}; 6458 6459/** 6460 * @function appendParamToURL 6461 * @description appends the parameter with the given name and value to the given url and returns the changed url 6462 * @param {string} url the url to which the parameter will be added 6463 * @param {string} name the name of the parameter 6464 * @param {string} value the value of the parameter 6465 * @returns {string|null} - URL with parameter 6466 */ 6467var appendParamToURL = function appendParamToURL(url, name, value) { 6468 if (!url || !name) { 6469 return url; 6470 } 6471 // quit if the param already exists 6472 if (url.indexOf(name + '=') !== -1) { 6473 return url; 6474 } 6475 var separator = url.indexOf('?') !== -1 ? '&' : '?'; 6476 return url + separator + name + '=' + encodeURIComponent(value); 6477}; 6478module.exports = { 6479 throttle: throttle, 6480 isRelativeUrl: isRelativeUrl, 6481 applyUrlParameter: applyUrlParameter, 6482 appendParamToURL: appendParamToURL 6483}; 6484 6485/***/ }), 6486
6487/***/ "./cartridges/org_marykay/cartridge/client/default/js/utilities/cartHelpers.js": 6488/*!*************************************************************************************!*\ 6489 !*** ./cartridges/org_marykay/cartridge/client/default/js/utilities/cartHelpers.js ***! 6490 \*************************************************************************************/ 6491/***/ (function(module) { 6492 6493module.exports = { 6494 updateCartTotals: function updateCartTotals(data) { 6495 if (data.resources) { 6496 $('.number-of-items').empty().append(data.resources.numberOfItems); 6497 $('.minicart-link').attr({ 6498 'aria-label': data.resources.minicartCountOfItems, 6499 title: data.resources.minicartCountOfItems 6500 }); 6501 } 6502 $('.ibcDiscountAmount').addClass('d-none'); 6503 $('.shipping-discount').addClass('d-none'); 6504 $('.coupon-discounts').addClass('d-none'); 6505 if (data.totals) { 6506 $('.shipping-cost').empty().append(data.totals.totalShippingCost); 6507 $('.shipping-total-cost').empty().append(data.totals.totalShippingCost); 6508 $('.tax-total').empty().append(data.totals.totalTax); 6509 $('.grand-total').empty().append(data.totals.grandTotal); 6510 $('.grand-total-sum').empty().append(data.totals.grandTotal); 6511 $('.sub-total').empty().append(data.totals.subTotal); 6512 if (data.totals.ibcDiscountAmount && data.totals.ibcDiscountAmount.formatted) { 6513 $('.ibcDiscountAmount').removeClass('d-none'); 6514 var discountText = $('.ibcDiscountAmount').data('label'); 6515 $('.order-discount').first().text(discountText.replace('{percentage}', data.totals.discountPercent)); 6516 $('.order-discount-total').empty().append(data.totals.ibcDiscountAmount.formatted); 6517 } 6518 if (data.totals.shippingLevelDiscountTotal.value > 0) { 6519 $('.shipping-discount').removeClass('d-none'); 6520 $('.shipping-discount-total').empty().append('- ' + data.totals.shippingLevelDiscountTotal.formatted); 6521 } 6522 if (data.totals.discounts.length > 0) { 6523 $('.coupon-discounts').removeClass('d-none'); 6524 $('.coupon-discounts').empty().append(data.totals.couponDiscountsHtml); 6525 } 6526 } 6527 if (data.cart && data.cart.numItems !== undefined) { 6528 $('.minicart-quantity').empty().append(data.cart.numItems); 6529 } 6530 if (data.actionUrls) { 6531 $('.delete-coupon-confirmation-btn').attr('data-action', data.actionUrls.removeCouponLineItem); 6532 } 6533 if (data.items) { 6534 data.items.forEach(function (item) { 6535 if (data.totals.orderLevelDiscountTotal.value > 0) { 6536 $('.coupons-and-promos').empty().append(data.totals.discountsHtml); 6537 } 6538 if (item.renderedPromotions) { 6539 $('.item-' + item.UUID).empty().append(item.renderedPromotions); 6540 } else { 6541 $('.item-' + item.UUID).empty(); 6542 } 6543 $('.uuid-' + item.UUID + ' .unit-price').empty().append(item.renderedPrice); 6544 $('.line-item-price-' + item.UUID + ' .unit-price').empty().append(item.renderedPrice); 6545 $('.item-total-' + item.UUID).empty().append(item.priceTotal.renderedPrice); 6546 }); 6547 } 6548 } 6549}; 6550 6551/***/ }), 6552
vendor: 14,182 bytes, lines 6553-6947
6553/***/ "./node_modules/swiper/modules/a11y.mjs": 6554/*!**********************************************!*\ 6555 !*** ./node_modules/swiper/modules/a11y.mjs ***! 6556 \**********************************************/ 6557/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 6558 6559"use strict"; 6560__webpack_require__.r(__webpack_exports__); 6561/* harmony export */ __webpack_require__.d(__webpack_exports__, { 6562/* harmony export */ "default": function() { return /* binding */ A11y; } 6563/* harmony export */ }); 6564/* harmony import */ var _shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 6565/* harmony import */ var _shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/classes-to-selector.mjs */ "./node_modules/swiper/shared/classes-to-selector.mjs"); 6566/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 6567 6568 6569 6570 6571function A11y(_ref) { 6572 let { 6573 swiper, 6574 extendParams, 6575 on 6576 } = _ref; 6577 extendParams({ 6578 a11y: { 6579 enabled: true, 6580 notificationClass: 'swiper-notification', 6581 prevSlideMessage: 'Previous slide', 6582 nextSlideMessage: 'Next slide', 6583 firstSlideMessage: 'This is the first slide', 6584 lastSlideMessage: 'This is the last slide', 6585 paginationBulletMessage: 'Go to slide {{index}}', 6586 slideLabelMessage: '{{index}} / {{slidesLength}}', 6587 containerMessage: null, 6588 containerRoleDescriptionMessage: null, 6589 containerRole: null, 6590 itemRoleDescriptionMessage: null, 6591 slideRole: 'group', 6592 id: null, 6593 scrollOnFocus: true 6594 } 6595 }); 6596 swiper.a11y = { 6597 clicked: false 6598 }; 6599 let liveRegion = null; 6600 let preventFocusHandler; 6601 let focusTargetSlideEl; 6602 let visibilityChangedTimestamp = new Date().getTime(); 6603 function notify(message) { 6604 const notification = liveRegion; 6605 if (notification.length === 0) return; 6606 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.s)(notification, message); 6607 } 6608 function getRandomNumber(size) { 6609 if (size === void 0) { 6610 size = 16; 6611 } 6612 const randomChar = () => Math.round(16 * Math.random()).toString(16); 6613 return 'x'.repeat(size).replace(/x/g, randomChar); 6614 } 6615 function makeElFocusable(el) { 6616 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 6617 el.forEach(subEl => { 6618 subEl.setAttribute('tabIndex', '0'); 6619 }); 6620 } 6621 function makeElNotFocusable(el) { 6622 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 6623 el.forEach(subEl => { 6624 subEl.setAttribute('tabIndex', '-1'); 6625 }); 6626 } 6627 function addElRole(el, role) { 6628 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 6629 el.forEach(subEl => { 6630 subEl.setAttribute('role', role); 6631 }); 6632 } 6633 function addElRoleDescription(el, description) { 6634 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 6635 el.forEach(subEl => { 6636 subEl.setAttribute('aria-roledescription', description); 6637 }); 6638 } 6639 function addElControls(el, controls) { 6640 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 6641 el.forEach(subEl => { 6642 subEl.setAttribute('aria-controls', controls); 6643 }); 6644 } 6645 function addElLabel(el, label) { 6646 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 6647 el.forEach(subEl => { 6648 subEl.setAttribute('aria-label', label); 6649 }); 6650 } 6651 function addElId(el, id) { 6652 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 6653 el.forEach(subEl => { 6654 subEl.setAttribute('id', id); 6655 }); 6656 } 6657 function addElLive(el, live) { 6658 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 6659 el.forEach(subEl => { 6660 subEl.setAttribute('aria-live', live); 6661 }); 6662 } 6663 function disableEl(el) { 6664 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 6665 el.forEach(subEl => { 6666 subEl.setAttribute('aria-disabled', true); 6667 }); 6668 } 6669 function enableEl(el) { 6670 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 6671 el.forEach(subEl => { 6672 subEl.setAttribute('aria-disabled', false); 6673 }); 6674 } 6675 function onEnterOrSpaceKey(e) { 6676 if (e.keyCode !== 13 && e.keyCode !== 32) return; 6677 const params = swiper.params.a11y; 6678 const targetEl = e.target; 6679 if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) { 6680 if (!e.target.matches((0,_shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_1__.c)(swiper.params.pagination.bulletClass))) return; 6681 } 6682 if (swiper.navigation && swiper.navigation.prevEl && swiper.navigation.nextEl) { 6683 const prevEls = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(swiper.navigation.prevEl); 6684 const nextEls = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(swiper.navigation.nextEl); 6685 if (nextEls.includes(targetEl)) { 6686 if (!(swiper.isEnd && !swiper.params.loop)) { 6687 swiper.slideNext(); 6688 } 6689 if (swiper.isEnd) { 6690 notify(params.lastSlideMessage); 6691 } else { 6692 notify(params.nextSlideMessage); 6693 } 6694 } 6695 if (prevEls.includes(targetEl)) { 6696 if (!(swiper.isBeginning && !swiper.params.loop)) { 6697 swiper.slidePrev(); 6698 } 6699 if (swiper.isBeginning) { 6700 notify(params.firstSlideMessage); 6701 } else { 6702 notify(params.prevSlideMessage); 6703 } 6704 } 6705 } 6706 if (swiper.pagination && targetEl.matches((0,_shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_1__.c)(swiper.params.pagination.bulletClass))) { 6707 targetEl.click(); 6708 } 6709 } 6710 function updateNavigation() { 6711 if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return; 6712 const { 6713 nextEl, 6714 prevEl 6715 } = swiper.navigation; 6716 if (prevEl) { 6717 if (swiper.isBeginning) { 6718 disableEl(prevEl); 6719 makeElNotFocusable(prevEl); 6720 } else { 6721 enableEl(prevEl); 6722 makeElFocusable(prevEl); 6723 } 6724 } 6725 if (nextEl) { 6726 if (swiper.isEnd) { 6727 disableEl(nextEl); 6728 makeElNotFocusable(nextEl); 6729 } else { 6730 enableEl(nextEl); 6731 makeElFocusable(nextEl); 6732 } 6733 } 6734 } 6735 function hasPagination() { 6736 return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length; 6737 } 6738 function hasClickablePagination() { 6739 return hasPagination() && swiper.params.pagination.clickable; 6740 } 6741 function updatePagination() { 6742 const params = swiper.params.a11y; 6743 if (!hasPagination()) return; 6744 swiper.pagination.bullets.forEach(bulletEl => { 6745 if (swiper.params.pagination.clickable) { 6746 makeElFocusable(bulletEl); 6747 if (!swiper.params.pagination.renderBullet) { 6748 addElRole(bulletEl, 'button'); 6749 addElLabel(bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.i)(bulletEl) + 1)); 6750 } 6751 } 6752 if (bulletEl.matches((0,_shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_1__.c)(swiper.params.pagination.bulletActiveClass))) { 6753 bulletEl.setAttribute('aria-current', 'true'); 6754 } else { 6755 bulletEl.removeAttribute('aria-current'); 6756 } 6757 }); 6758 } 6759 const initNavEl = (el, wrapperId, message) => { 6760 makeElFocusable(el); 6761 if (el.tagName !== 'BUTTON') { 6762 addElRole(el, 'button'); 6763 el.addEventListener('keydown', onEnterOrSpaceKey); 6764 } 6765 addElLabel(el, message); 6766 addElControls(el, wrapperId); 6767 }; 6768 const handlePointerDown = e => { 6769 if (focusTargetSlideEl && focusTargetSlideEl !== e.target && !focusTargetSlideEl.contains(e.target)) { 6770 preventFocusHandler = true; 6771 } 6772 swiper.a11y.clicked = true; 6773 }; 6774 const handlePointerUp = () => { 6775 preventFocusHandler = false; 6776 requestAnimationFrame(() => { 6777 requestAnimationFrame(() => { 6778 if (!swiper.destroyed) { 6779 swiper.a11y.clicked = false; 6780 } 6781 }); 6782 }); 6783 }; 6784 const onVisibilityChange = e => { 6785 visibilityChangedTimestamp = new Date().getTime(); 6786 }; 6787 const handleFocus = e => { 6788 if (swiper.a11y.clicked || !swiper.params.a11y.scrollOnFocus) return; 6789 if (new Date().getTime() - visibilityChangedTimestamp < 100) return; 6790 const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`); 6791 if (!slideEl || !swiper.slides.includes(slideEl)) return; 6792 focusTargetSlideEl = slideEl; 6793 const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex; 6794 const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl); 6795 if (isActive || isVisible) return; 6796 if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return; 6797 if (swiper.isHorizontal()) { 6798 swiper.el.scrollLeft = 0; 6799 } else { 6800 swiper.el.scrollTop = 0; 6801 } 6802 requestAnimationFrame(() => { 6803 if (preventFocusHandler) return; 6804 if (swiper.params.loop) { 6805 swiper.slideToLoop(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute('data-swiper-slide-index'))), 0); 6806 } else { 6807 swiper.slideTo(swiper.getSlideIndexWhenGrid(swiper.slides.indexOf(slideEl)), 0); 6808 } 6809 preventFocusHandler = false; 6810 }); 6811 }; 6812 const initSlides = () => { 6813 const params = swiper.params.a11y; 6814 if (params.itemRoleDescriptionMessage) { 6815 addElRoleDescription(swiper.slides, params.itemRoleDescriptionMessage); 6816 } 6817 if (params.slideRole) { 6818 addElRole(swiper.slides, params.slideRole); 6819 } 6820 const slidesLength = swiper.slides.length; 6821 if (params.slideLabelMessage) { 6822 swiper.slides.forEach((slideEl, index) => { 6823 const slideIndex = swiper.params.loop ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : index; 6824 const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength); 6825 addElLabel(slideEl, ariaLabelMessage); 6826 }); 6827 } 6828 }; 6829 const init = () => { 6830 const params = swiper.params.a11y; 6831 swiper.el.append(liveRegion); 6832 6833 // Container 6834 const containerEl = swiper.el; 6835 if (params.containerRoleDescriptionMessage) { 6836 addElRoleDescription(containerEl, params.containerRoleDescriptionMessage); 6837 } 6838 if (params.containerMessage) { 6839 addElLabel(containerEl, params.containerMessage); 6840 } 6841 if (params.containerRole) { 6842 addElRole(containerEl, params.containerRole); 6843 } 6844 6845 // Wrapper 6846 const wrapperEl = swiper.wrapperEl; 6847 const wrapperId = params.id || wrapperEl.getAttribute('id') || `swiper-wrapper-${getRandomNumber(16)}`; 6848 const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite'; 6849 addElId(wrapperEl, wrapperId); 6850 addElLive(wrapperEl, live); 6851 6852 // Slide 6853 initSlides(); 6854 6855 // Navigation 6856 let { 6857 nextEl, 6858 prevEl 6859 } = swiper.navigation ? swiper.navigation : {}; 6860 nextEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(nextEl); 6861 prevEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(prevEl); 6862 if (nextEl) { 6863 nextEl.forEach(el => initNavEl(el, wrapperId, params.nextSlideMessage)); 6864 } 6865 if (prevEl) { 6866 prevEl.forEach(el => initNavEl(el, wrapperId, params.prevSlideMessage)); 6867 } 6868 6869 // Pagination 6870 if (hasClickablePagination()) { 6871 const paginationEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(swiper.pagination.el); 6872 paginationEl.forEach(el => { 6873 el.addEventListener('keydown', onEnterOrSpaceKey); 6874 }); 6875 } 6876 6877 // Tab focus 6878 const document = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 6879 document.addEventListener('visibilitychange', onVisibilityChange); 6880 swiper.el.addEventListener('focus', handleFocus, true); 6881 swiper.el.addEventListener('focus', handleFocus, true); 6882 swiper.el.addEventListener('pointerdown', handlePointerDown, true); 6883 swiper.el.addEventListener('pointerup', handlePointerUp, true); 6884 }; 6885 function destroy() { 6886 if (liveRegion) liveRegion.remove(); 6887 let { 6888 nextEl, 6889 prevEl 6890 } = swiper.navigation ? swiper.navigation : {}; 6891 nextEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(nextEl); 6892 prevEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(prevEl); 6893 if (nextEl) { 6894 nextEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey)); 6895 } 6896 if (prevEl) { 6897 prevEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey)); 6898 } 6899 6900 // Pagination 6901 if (hasClickablePagination()) { 6902 const paginationEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(swiper.pagination.el); 6903 paginationEl.forEach(el => { 6904 el.removeEventListener('keydown', onEnterOrSpaceKey); 6905 }); 6906 } 6907 const document = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 6908 document.removeEventListener('visibilitychange', onVisibilityChange); 6909 // Tab focus 6910 if (swiper.el && typeof swiper.el !== 'string') { 6911 swiper.el.removeEventListener('focus', handleFocus, true); 6912 swiper.el.removeEventListener('pointerdown', handlePointerDown, true); 6913 swiper.el.removeEventListener('pointerup', handlePointerUp, true); 6914 } 6915 } 6916 on('beforeInit', () => { 6917 liveRegion = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.c)('span', swiper.params.a11y.notificationClass); 6918 liveRegion.setAttribute('aria-live', 'assertive'); 6919 liveRegion.setAttribute('aria-atomic', 'true'); 6920 }); 6921 on('afterInit', () => { 6922 if (!swiper.params.a11y.enabled) return; 6923 init(); 6924 }); 6925 on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', () => { 6926 if (!swiper.params.a11y.enabled) return; 6927 initSlides(); 6928 }); 6929 on('fromEdge toEdge afterInit lock unlock', () => { 6930 if (!swiper.params.a11y.enabled) return; 6931 updateNavigation(); 6932 }); 6933 on('paginationUpdate', () => { 6934 if (!swiper.params.a11y.enabled) return; 6935 updatePagination(); 6936 }); 6937 on('destroy', () => { 6938 if (!swiper.params.a11y.enabled) return; 6939 destroy(); 6940 }); 6941} 6942 6943 6944 6945 6946/***/ }), 6947
vendor: 10,064 bytes, lines 6948-7267
6948/***/ "./node_modules/swiper/modules/autoplay.mjs": 6949/*!**************************************************!*\ 6950 !*** ./node_modules/swiper/modules/autoplay.mjs ***! 6951 \**************************************************/ 6952/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 6953 6954"use strict"; 6955__webpack_require__.r(__webpack_exports__); 6956/* harmony export */ __webpack_require__.d(__webpack_exports__, { 6957/* harmony export */ "default": function() { return /* binding */ Autoplay; } 6958/* harmony export */ }); 6959/* harmony import */ var _shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 6960 6961 6962/* eslint no-underscore-dangle: "off" */ 6963/* eslint no-use-before-define: "off" */ 6964function Autoplay(_ref) { 6965 let { 6966 swiper, 6967 extendParams, 6968 on, 6969 emit, 6970 params 6971 } = _ref; 6972 swiper.autoplay = { 6973 running: false, 6974 paused: false, 6975 timeLeft: 0 6976 }; 6977 extendParams({ 6978 autoplay: { 6979 enabled: false, 6980 delay: 3000, 6981 waitForTransition: true, 6982 disableOnInteraction: false, 6983 stopOnLastSlide: false, 6984 reverseDirection: false, 6985 pauseOnMouseEnter: false 6986 } 6987 }); 6988 let timeout; 6989 let raf; 6990 let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000; 6991 let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000; 6992 let autoplayTimeLeft; 6993 let autoplayStartTime = new Date().getTime(); 6994 let wasPaused; 6995 let isTouched; 6996 let pausedByTouch; 6997 let touchStartTimeout; 6998 let slideChanged; 6999 let pausedByInteraction; 7000 let pausedByPointerEnter; 7001 function onTransitionEnd(e) { 7002 if (!swiper || swiper.destroyed || !swiper.wrapperEl) return; 7003 if (e.target !== swiper.wrapperEl) return; 7004 swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd); 7005 if (pausedByPointerEnter || e.detail && e.detail.bySwiperTouchMove) { 7006 return; 7007 } 7008 resume(); 7009 } 7010 const calcTimeLeft = () => { 7011 if (swiper.destroyed || !swiper.autoplay.running) return; 7012 if (swiper.autoplay.paused) { 7013 wasPaused = true; 7014 } else if (wasPaused) { 7015 autoplayDelayCurrent = autoplayTimeLeft; 7016 wasPaused = false; 7017 } 7018 const timeLeft = swiper.autoplay.paused ? autoplayTimeLeft : autoplayStartTime + autoplayDelayCurrent - new Date().getTime(); 7019 swiper.autoplay.timeLeft = timeLeft; 7020 emit('autoplayTimeLeft', timeLeft, timeLeft / autoplayDelayTotal); 7021 raf = requestAnimationFrame(() => { 7022 calcTimeLeft(); 7023 }); 7024 }; 7025 const getSlideDelay = () => { 7026 let activeSlideEl; 7027 if (swiper.virtual && swiper.params.virtual.enabled) { 7028 activeSlideEl = swiper.slides.find(slideEl => slideEl.classList.contains('swiper-slide-active')); 7029 } else { 7030 activeSlideEl = swiper.slides[swiper.activeIndex]; 7031 } 7032 if (!activeSlideEl) return undefined; 7033 const currentSlideDelay = parseInt(activeSlideEl.getAttribute('data-swiper-autoplay'), 10); 7034 return currentSlideDelay; 7035 }; 7036 const run = delayForce => { 7037 if (swiper.destroyed || !swiper.autoplay.running) return; 7038 cancelAnimationFrame(raf); 7039 calcTimeLeft(); 7040 let delay = typeof delayForce === 'undefined' ? swiper.params.autoplay.delay : delayForce; 7041 autoplayDelayTotal = swiper.params.autoplay.delay; 7042 autoplayDelayCurrent = swiper.params.autoplay.delay; 7043 const currentSlideDelay = getSlideDelay(); 7044 if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0 && typeof delayForce === 'undefined') { 7045 delay = currentSlideDelay; 7046 autoplayDelayTotal = currentSlideDelay; 7047 autoplayDelayCurrent = currentSlideDelay; 7048 } 7049 autoplayTimeLeft = delay; 7050 const speed = swiper.params.speed; 7051 const proceed = () => { 7052 if (!swiper || swiper.destroyed) return; 7053 if (swiper.params.autoplay.reverseDirection) { 7054 if (!swiper.isBeginning || swiper.params.loop || swiper.params.rewind) { 7055 swiper.slidePrev(speed, true, true); 7056 emit('autoplay'); 7057 } else if (!swiper.params.autoplay.stopOnLastSlide) { 7058 swiper.slideTo(swiper.slides.length - 1, speed, true, true); 7059 emit('autoplay'); 7060 } 7061 } else { 7062 if (!swiper.isEnd || swiper.params.loop || swiper.params.rewind) { 7063 swiper.slideNext(speed, true, true); 7064 emit('autoplay'); 7065 } else if (!swiper.params.autoplay.stopOnLastSlide) { 7066 swiper.slideTo(0, speed, true, true); 7067 emit('autoplay'); 7068 } 7069 } 7070 if (swiper.params.cssMode) { 7071 autoplayStartTime = new Date().getTime(); 7072 requestAnimationFrame(() => { 7073 run(); 7074 }); 7075 } 7076 }; 7077 if (delay > 0) { 7078 clearTimeout(timeout); 7079 timeout = setTimeout(() => { 7080 proceed(); 7081 }, delay); 7082 } else { 7083 requestAnimationFrame(() => { 7084 proceed(); 7085 }); 7086 } 7087 7088 // eslint-disable-next-line 7089 return delay; 7090 }; 7091 const start = () => { 7092 autoplayStartTime = new Date().getTime(); 7093 swiper.autoplay.running = true; 7094 run(); 7095 emit('autoplayStart'); 7096 }; 7097 const stop = () => { 7098 swiper.autoplay.running = false; 7099 clearTimeout(timeout); 7100 cancelAnimationFrame(raf); 7101 emit('autoplayStop'); 7102 }; 7103 const pause = (internal, reset) => { 7104 if (swiper.destroyed || !swiper.autoplay.running) return; 7105 clearTimeout(timeout); 7106 if (!internal) { 7107 pausedByInteraction = true; 7108 } 7109 const proceed = () => { 7110 emit('autoplayPause'); 7111 if (swiper.params.autoplay.waitForTransition) { 7112 swiper.wrapperEl.addEventListener('transitionend', onTransitionEnd); 7113 } else { 7114 resume(); 7115 } 7116 }; 7117 swiper.autoplay.paused = true; 7118 if (reset) { 7119 if (slideChanged) { 7120 autoplayTimeLeft = swiper.params.autoplay.delay; 7121 } 7122 slideChanged = false; 7123 proceed(); 7124 return; 7125 } 7126 const delay = autoplayTimeLeft || swiper.params.autoplay.delay; 7127 autoplayTimeLeft = delay - (new Date().getTime() - autoplayStartTime); 7128 if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop) return; 7129 if (autoplayTimeLeft < 0) autoplayTimeLeft = 0; 7130 proceed(); 7131 }; 7132 const resume = () => { 7133 if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop || swiper.destroyed || !swiper.autoplay.running) return; 7134 autoplayStartTime = new Date().getTime(); 7135 if (pausedByInteraction) { 7136 pausedByInteraction = false; 7137 run(autoplayTimeLeft); 7138 } else { 7139 run(); 7140 } 7141 swiper.autoplay.paused = false; 7142 emit('autoplayResume'); 7143 }; 7144 const onVisibilityChange = () => { 7145 if (swiper.destroyed || !swiper.autoplay.running) return; 7146 const document = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 7147 if (document.visibilityState === 'hidden') { 7148 pausedByInteraction = true; 7149 pause(true); 7150 } 7151 if (document.visibilityState === 'visible') { 7152 resume(); 7153 } 7154 }; 7155 const onPointerEnter = e => { 7156 if (e.pointerType !== 'mouse') return; 7157 pausedByInteraction = true; 7158 pausedByPointerEnter = true; 7159 if (swiper.animating || swiper.autoplay.paused) return; 7160 pause(true); 7161 }; 7162 const onPointerLeave = e => { 7163 if (e.pointerType !== 'mouse') return; 7164 pausedByPointerEnter = false; 7165 if (swiper.autoplay.paused) { 7166 resume(); 7167 } 7168 }; 7169 const attachMouseEvents = () => { 7170 if (swiper.params.autoplay.pauseOnMouseEnter) { 7171 swiper.el.addEventListener('pointerenter', onPointerEnter); 7172 swiper.el.addEventListener('pointerleave', onPointerLeave); 7173 } 7174 }; 7175 const detachMouseEvents = () => { 7176 if (swiper.el && typeof swiper.el !== 'string') { 7177 swiper.el.removeEventListener('pointerenter', onPointerEnter); 7178 swiper.el.removeEventListener('pointerleave', onPointerLeave); 7179 } 7180 }; 7181 const attachDocumentEvents = () => { 7182 const document = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 7183 document.addEventListener('visibilitychange', onVisibilityChange); 7184 }; 7185 const detachDocumentEvents = () => { 7186 const document = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 7187 document.removeEventListener('visibilitychange', onVisibilityChange); 7188 }; 7189 on('init', () => { 7190 if (swiper.params.autoplay.enabled) { 7191 attachMouseEvents(); 7192 attachDocumentEvents(); 7193 start(); 7194 } 7195 }); 7196 on('destroy', () => { 7197 detachMouseEvents(); 7198 detachDocumentEvents(); 7199 if (swiper.autoplay.running) { 7200 stop(); 7201 } 7202 }); 7203 on('_freeModeStaticRelease', () => { 7204 if (pausedByTouch || pausedByInteraction) { 7205 resume(); 7206 } 7207 }); 7208 on('_freeModeNoMomentumRelease', () => { 7209 if (!swiper.params.autoplay.disableOnInteraction) { 7210 pause(true, true); 7211 } else { 7212 stop(); 7213 } 7214 }); 7215 on('beforeTransitionStart', (_s, speed, internal) => { 7216 if (swiper.destroyed || !swiper.autoplay.running) return; 7217 if (internal || !swiper.params.autoplay.disableOnInteraction) { 7218 pause(true, true); 7219 } else { 7220 stop(); 7221 } 7222 }); 7223 on('sliderFirstMove', () => { 7224 if (swiper.destroyed || !swiper.autoplay.running) return; 7225 if (swiper.params.autoplay.disableOnInteraction) { 7226 stop(); 7227 return; 7228 } 7229 isTouched = true; 7230 pausedByTouch = false; 7231 pausedByInteraction = false; 7232 touchStartTimeout = setTimeout(() => { 7233 pausedByInteraction = true; 7234 pausedByTouch = true; 7235 pause(true); 7236 }, 200); 7237 }); 7238 on('touchEnd', () => { 7239 if (swiper.destroyed || !swiper.autoplay.running || !isTouched) return; 7240 clearTimeout(touchStartTimeout); 7241 clearTimeout(timeout); 7242 if (swiper.params.autoplay.disableOnInteraction) { 7243 pausedByTouch = false; 7244 isTouched = false; 7245 return; 7246 } 7247 if (pausedByTouch && swiper.params.cssMode) resume(); 7248 pausedByTouch = false; 7249 isTouched = false; 7250 }); 7251 on('slideChange', () => { 7252 if (swiper.destroyed || !swiper.autoplay.running) return; 7253 slideChanged = true; 7254 }); 7255 Object.assign(swiper.autoplay, { 7256 start, 7257 stop, 7258 pause, 7259 resume 7260 }); 7261} 7262 7263 7264 7265 7266/***/ }), 7267
vendor: 7,533 bytes, lines 7268-7474
7268/***/ "./node_modules/swiper/modules/controller.mjs": 7269/*!****************************************************!*\ 7270 !*** ./node_modules/swiper/modules/controller.mjs ***! 7271 \****************************************************/ 7272/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 7273 7274"use strict"; 7275__webpack_require__.r(__webpack_exports__); 7276/* harmony export */ __webpack_require__.d(__webpack_exports__, { 7277/* harmony export */ "default": function() { return /* binding */ Controller; } 7278/* harmony export */ }); 7279/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 7280 7281 7282/* eslint no-bitwise: ["error", { "allow": [">>"] }] */ 7283function Controller(_ref) { 7284 let { 7285 swiper, 7286 extendParams, 7287 on 7288 } = _ref; 7289 extendParams({ 7290 controller: { 7291 control: undefined, 7292 inverse: false, 7293 by: 'slide' // or 'container' 7294 } 7295 }); 7296 7297 swiper.controller = { 7298 control: undefined 7299 }; 7300 function LinearSpline(x, y) { 7301 const binarySearch = function search() { 7302 let maxIndex; 7303 let minIndex; 7304 let guess; 7305 return (array, val) => { 7306 minIndex = -1; 7307 maxIndex = array.length; 7308 while (maxIndex - minIndex > 1) { 7309 guess = maxIndex + minIndex >> 1; 7310 if (array[guess] <= val) { 7311 minIndex = guess; 7312 } else { 7313 maxIndex = guess; 7314 } 7315 } 7316 return maxIndex; 7317 }; 7318 }(); 7319 this.x = x; 7320 this.y = y; 7321 this.lastIndex = x.length - 1; 7322 // Given an x value (x2), return the expected y2 value: 7323 // (x1,y1) is the known point before given value, 7324 // (x3,y3) is the known point after given value. 7325 let i1; 7326 let i3; 7327 this.interpolate = function interpolate(x2) { 7328 if (!x2) return 0; 7329 7330 // Get the indexes of x1 and x3 (the array indexes before and after given x2): 7331 i3 = binarySearch(this.x, x2); 7332 i1 = i3 - 1; 7333 7334 // We have our indexes i1 & i3, so we can calculate already: 7335 // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1 7336 return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1]; 7337 }; 7338 return this; 7339 } 7340 function getInterpolateFunction(c) { 7341 swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid); 7342 } 7343 function setTranslate(_t, byController) { 7344 const controlled = swiper.controller.control; 7345 let multiplier; 7346 let controlledTranslate; 7347 const Swiper = swiper.constructor; 7348 function setControlledTranslate(c) { 7349 if (c.destroyed) return; 7350 7351 // this will create an Interpolate function based on the snapGrids 7352 // x is the Grid of the scrolled scroller and y will be the controlled scroller 7353 // it makes sense to create this only once and recall it for the interpolation 7354 // the function does a lot of value caching for performance 7355 const translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate; 7356 if (swiper.params.controller.by === 'slide') { 7357 getInterpolateFunction(c); 7358 // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid 7359 // but it did not work out 7360 controlledTranslate = -swiper.controller.spline.interpolate(-translate); 7361 } 7362 if (!controlledTranslate || swiper.params.controller.by === 'container') { 7363 multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate()); 7364 if (Number.isNaN(multiplier) || !Number.isFinite(multiplier)) { 7365 multiplier = 1; 7366 } 7367 controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate(); 7368 } 7369 if (swiper.params.controller.inverse) { 7370 controlledTranslate = c.maxTranslate() - controlledTranslate; 7371 } 7372 c.updateProgress(controlledTranslate); 7373 c.setTranslate(controlledTranslate, swiper); 7374 c.updateActiveIndex(); 7375 c.updateSlidesClasses(); 7376 } 7377 if (Array.isArray(controlled)) { 7378 for (let i = 0; i < controlled.length; i += 1) { 7379 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 7380 setControlledTranslate(controlled[i]); 7381 } 7382 } 7383 } else if (controlled instanceof Swiper && byController !== controlled) { 7384 setControlledTranslate(controlled); 7385 } 7386 } 7387 function setTransition(duration, byController) { 7388 const Swiper = swiper.constructor; 7389 const controlled = swiper.controller.control; 7390 let i; 7391 function setControlledTransition(c) { 7392 if (c.destroyed) return; 7393 c.setTransition(duration, swiper); 7394 if (duration !== 0) { 7395 c.transitionStart(); 7396 if (c.params.autoHeight) { 7397 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.n)(() => { 7398 c.updateAutoHeight(); 7399 }); 7400 } 7401 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.l)(c.wrapperEl, () => { 7402 if (!controlled) return; 7403 c.transitionEnd(); 7404 }); 7405 } 7406 } 7407 if (Array.isArray(controlled)) { 7408 for (i = 0; i < controlled.length; i += 1) { 7409 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 7410 setControlledTransition(controlled[i]); 7411 } 7412 } 7413 } else if (controlled instanceof Swiper && byController !== controlled) { 7414 setControlledTransition(controlled); 7415 } 7416 } 7417 function removeSpline() { 7418 if (!swiper.controller.control) return; 7419 if (swiper.controller.spline) { 7420 swiper.controller.spline = undefined; 7421 delete swiper.controller.spline; 7422 } 7423 } 7424 on('beforeInit', () => { 7425 if (typeof window !== 'undefined' && ( 7426 // eslint-disable-line 7427 typeof swiper.params.controller.control === 'string' || swiper.params.controller.control instanceof HTMLElement)) { 7428 const controlElements = typeof swiper.params.controller.control === 'string' ? [...document.querySelectorAll(swiper.params.controller.control)] : [swiper.params.controller.control]; 7429 controlElements.forEach(controlElement => { 7430 if (!swiper.controller.control) swiper.controller.control = []; 7431 if (controlElement && controlElement.swiper) { 7432 swiper.controller.control.push(controlElement.swiper); 7433 } else if (controlElement) { 7434 const eventName = `${swiper.params.eventsPrefix}init`; 7435 const onControllerSwiper = e => { 7436 swiper.controller.control.push(e.detail[0]); 7437 swiper.update(); 7438 controlElement.removeEventListener(eventName, onControllerSwiper); 7439 }; 7440 controlElement.addEventListener(eventName, onControllerSwiper); 7441 } 7442 }); 7443 return; 7444 } 7445 swiper.controller.control = swiper.params.controller.control; 7446 }); 7447 on('update', () => { 7448 removeSpline(); 7449 }); 7450 on('resize', () => { 7451 removeSpline(); 7452 }); 7453 on('observerUpdate', () => { 7454 removeSpline(); 7455 }); 7456 on('setTranslate', (_s, translate, byController) => { 7457 if (!swiper.controller.control || swiper.controller.control.destroyed) return; 7458 swiper.controller.setTranslate(translate, byController); 7459 }); 7460 on('setTransition', (_s, duration, byController) => { 7461 if (!swiper.controller.control || swiper.controller.control.destroyed) return; 7462 swiper.controller.setTransition(duration, byController); 7463 }); 7464 Object.assign(swiper.controller, { 7465 setTranslate, 7466 setTransition 7467 }); 7468} 7469 7470 7471 7472 7473/***/ }), 7474
vendor: 6,057 bytes, lines 7475-7622
7475/***/ "./node_modules/swiper/modules/effect-cards.mjs": 7476/*!******************************************************!*\ 7477 !*** ./node_modules/swiper/modules/effect-cards.mjs ***! 7478 \******************************************************/ 7479/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 7480 7481"use strict"; 7482__webpack_require__.r(__webpack_exports__); 7483/* harmony export */ __webpack_require__.d(__webpack_exports__, { 7484/* harmony export */ "default": function() { return /* binding */ EffectCards; } 7485/* harmony export */ }); 7486/* harmony import */ var _shared_create_shadow_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/create-shadow.mjs */ "./node_modules/swiper/shared/create-shadow.mjs"); 7487/* harmony import */ var _shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/effect-init.mjs */ "./node_modules/swiper/shared/effect-init.mjs"); 7488/* harmony import */ var _shared_effect_target_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shared/effect-target.mjs */ "./node_modules/swiper/shared/effect-target.mjs"); 7489/* harmony import */ var _shared_effect_virtual_transition_end_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shared/effect-virtual-transition-end.mjs */ "./node_modules/swiper/shared/effect-virtual-transition-end.mjs"); 7490/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 7491 7492 7493 7494 7495 7496 7497function EffectCards(_ref) { 7498 let { 7499 swiper, 7500 extendParams, 7501 on 7502 } = _ref; 7503 extendParams({ 7504 cardsEffect: { 7505 slideShadows: true, 7506 rotate: true, 7507 perSlideRotate: 2, 7508 perSlideOffset: 8 7509 } 7510 }); 7511 const setTranslate = () => { 7512 const { 7513 slides, 7514 activeIndex, 7515 rtlTranslate: rtl 7516 } = swiper; 7517 const params = swiper.params.cardsEffect; 7518 const { 7519 startTranslate, 7520 isTouched 7521 } = swiper.touchEventsData; 7522 const currentTranslate = rtl ? -swiper.translate : swiper.translate; 7523 for (let i = 0; i < slides.length; i += 1) { 7524 const slideEl = slides[i]; 7525 const slideProgress = slideEl.progress; 7526 const progress = Math.min(Math.max(slideProgress, -4), 4); 7527 let offset = slideEl.swiperSlideOffset; 7528 if (swiper.params.centeredSlides && !swiper.params.cssMode) { 7529 swiper.wrapperEl.style.transform = `translateX(${swiper.minTranslate()}px)`; 7530 } 7531 if (swiper.params.centeredSlides && swiper.params.cssMode) { 7532 offset -= slides[0].swiperSlideOffset; 7533 } 7534 let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset; 7535 let tY = 0; 7536 const tZ = -100 * Math.abs(progress); 7537 let scale = 1; 7538 let rotate = -params.perSlideRotate * progress; 7539 let tXAdd = params.perSlideOffset - Math.abs(progress) * 0.75; 7540 const slideIndex = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i; 7541 const isSwipeToNext = (slideIndex === activeIndex || slideIndex === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate; 7542 const isSwipeToPrev = (slideIndex === activeIndex || slideIndex === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate; 7543 if (isSwipeToNext || isSwipeToPrev) { 7544 const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5; 7545 rotate += -28 * progress * subProgress; 7546 scale += -0.5 * subProgress; 7547 tXAdd += 96 * subProgress; 7548 tY = `${-25 * subProgress * Math.abs(progress)}%`; 7549 } 7550 if (progress < 0) { 7551 // next 7552 tX = `calc(${tX}px ${rtl ? '-' : '+'} (${tXAdd * Math.abs(progress)}%))`; 7553 } else if (progress > 0) { 7554 // prev 7555 tX = `calc(${tX}px ${rtl ? '-' : '+'} (-${tXAdd * Math.abs(progress)}%))`; 7556 } else { 7557 tX = `${tX}px`; 7558 } 7559 if (!swiper.isHorizontal()) { 7560 const prevY = tY; 7561 tY = tX; 7562 tX = prevY; 7563 } 7564 const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`; 7565 7566 /* eslint-disable */ 7567 const transform = ` 7568 translate3d(${tX}, ${tY}, ${tZ}px) 7569 rotateZ(${params.rotate ? rtl ? -rotate : rotate : 0}deg) 7570 scale(${scaleString}) 7571 `; 7572 /* eslint-enable */ 7573 7574 if (params.slideShadows) { 7575 // Set shadows 7576 let shadowEl = slideEl.querySelector('.swiper-slide-shadow'); 7577 if (!shadowEl) { 7578 shadowEl = (0,_shared_create_shadow_mjs__WEBPACK_IMPORTED_MODULE_0__.c)('cards', slideEl); 7579 } 7580 if (shadowEl) shadowEl.style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1); 7581 } 7582 slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 7583 const targetEl = (0,_shared_effect_target_mjs__WEBPACK_IMPORTED_MODULE_2__.e)(params, slideEl); 7584 targetEl.style.transform = transform; 7585 } 7586 }; 7587 const setTransition = duration => { 7588 const transformElements = swiper.slides.map(slideEl => (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_4__.g)(slideEl)); 7589 transformElements.forEach(el => { 7590 el.style.transitionDuration = `${duration}ms`; 7591 el.querySelectorAll('.swiper-slide-shadow').forEach(shadowEl => { 7592 shadowEl.style.transitionDuration = `${duration}ms`; 7593 }); 7594 }); 7595 (0,_shared_effect_virtual_transition_end_mjs__WEBPACK_IMPORTED_MODULE_3__.e)({ 7596 swiper, 7597 duration, 7598 transformElements 7599 }); 7600 }; 7601 (0,_shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_1__.e)({ 7602 effect: 'cards', 7603 swiper, 7604 on, 7605 setTranslate, 7606 setTransition, 7607 perspective: () => true, 7608 overwriteParams: () => ({ 7609 _loopSwapReset: false, 7610 watchSlidesProgress: true, 7611 loopAdditionalSlides: swiper.params.cardsEffect.rotate ? 3 : 2, 7612 centeredSlides: true, 7613 virtualTranslate: !swiper.params.cssMode 7614 }) 7615 }); 7616} 7617 7618 7619 7620 7621/***/ }), 7622
vendor: 5,714 bytes, lines 7623-7745
7623/***/ "./node_modules/swiper/modules/effect-coverflow.mjs": 7624/*!**********************************************************!*\ 7625 !*** ./node_modules/swiper/modules/effect-coverflow.mjs ***! 7626 \**********************************************************/ 7627/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 7628 7629"use strict"; 7630__webpack_require__.r(__webpack_exports__); 7631/* harmony export */ __webpack_require__.d(__webpack_exports__, { 7632/* harmony export */ "default": function() { return /* binding */ EffectCoverflow; } 7633/* harmony export */ }); 7634/* harmony import */ var _shared_create_shadow_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/create-shadow.mjs */ "./node_modules/swiper/shared/create-shadow.mjs"); 7635/* harmony import */ var _shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/effect-init.mjs */ "./node_modules/swiper/shared/effect-init.mjs"); 7636/* harmony import */ var _shared_effect_target_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shared/effect-target.mjs */ "./node_modules/swiper/shared/effect-target.mjs"); 7637/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 7638 7639 7640 7641 7642 7643function EffectCoverflow(_ref) { 7644 let { 7645 swiper, 7646 extendParams, 7647 on 7648 } = _ref; 7649 extendParams({ 7650 coverflowEffect: { 7651 rotate: 50, 7652 stretch: 0, 7653 depth: 100, 7654 scale: 1, 7655 modifier: 1, 7656 slideShadows: true 7657 } 7658 }); 7659 const setTranslate = () => { 7660 const { 7661 width: swiperWidth, 7662 height: swiperHeight, 7663 slides, 7664 slidesSizesGrid 7665 } = swiper; 7666 const params = swiper.params.coverflowEffect; 7667 const isHorizontal = swiper.isHorizontal(); 7668 const transform = swiper.translate; 7669 const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2; 7670 const rotate = isHorizontal ? params.rotate : -params.rotate; 7671 const translate = params.depth; 7672 const r = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_3__.p)(swiper); 7673 // Each slide offset from center 7674 for (let i = 0, length = slides.length; i < length; i += 1) { 7675 const slideEl = slides[i]; 7676 const slideSize = slidesSizesGrid[i]; 7677 const slideOffset = slideEl.swiperSlideOffset; 7678 const centerOffset = (center - slideOffset - slideSize / 2) / slideSize; 7679 const offsetMultiplier = typeof params.modifier === 'function' ? params.modifier(centerOffset) : centerOffset * params.modifier; 7680 let rotateY = isHorizontal ? rotate * offsetMultiplier : 0; 7681 let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; 7682 // var rotateZ = 0 7683 let translateZ = -translate * Math.abs(offsetMultiplier); 7684 let stretch = params.stretch; 7685 // Allow percentage to make a relative stretch for responsive sliders 7686 if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) { 7687 stretch = parseFloat(params.stretch) / 100 * slideSize; 7688 } 7689 let translateY = isHorizontal ? 0 : stretch * offsetMultiplier; 7690 let translateX = isHorizontal ? stretch * offsetMultiplier : 0; 7691 let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); 7692 7693 // Fix for ultra small values 7694 if (Math.abs(translateX) < 0.001) translateX = 0; 7695 if (Math.abs(translateY) < 0.001) translateY = 0; 7696 if (Math.abs(translateZ) < 0.001) translateZ = 0; 7697 if (Math.abs(rotateY) < 0.001) rotateY = 0; 7698 if (Math.abs(rotateX) < 0.001) rotateX = 0; 7699 if (Math.abs(scale) < 0.001) scale = 0; 7700 const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px) rotateX(${r(rotateX)}deg) rotateY(${r(rotateY)}deg) scale(${scale})`; 7701 const targetEl = (0,_shared_effect_target_mjs__WEBPACK_IMPORTED_MODULE_2__.e)(params, slideEl); 7702 targetEl.style.transform = slideTransform; 7703 slideEl.style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1; 7704 if (params.slideShadows) { 7705 // Set shadows 7706 let shadowBeforeEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 7707 let shadowAfterEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 7708 if (!shadowBeforeEl) { 7709 shadowBeforeEl = (0,_shared_create_shadow_mjs__WEBPACK_IMPORTED_MODULE_0__.c)('coverflow', slideEl, isHorizontal ? 'left' : 'top'); 7710 } 7711 if (!shadowAfterEl) { 7712 shadowAfterEl = (0,_shared_create_shadow_mjs__WEBPACK_IMPORTED_MODULE_0__.c)('coverflow', slideEl, isHorizontal ? 'right' : 'bottom'); 7713 } 7714 if (shadowBeforeEl) shadowBeforeEl.style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0; 7715 if (shadowAfterEl) shadowAfterEl.style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0; 7716 } 7717 } 7718 }; 7719 const setTransition = duration => { 7720 const transformElements = swiper.slides.map(slideEl => (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_3__.g)(slideEl)); 7721 transformElements.forEach(el => { 7722 el.style.transitionDuration = `${duration}ms`; 7723 el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => { 7724 shadowEl.style.transitionDuration = `${duration}ms`; 7725 }); 7726 }); 7727 }; 7728 (0,_shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_1__.e)({ 7729 effect: 'coverflow', 7730 swiper, 7731 on, 7732 setTranslate, 7733 setTransition, 7734 perspective: () => true, 7735 overwriteParams: () => ({ 7736 watchSlidesProgress: true 7737 }) 7738 }); 7739} 7740 7741 7742 7743 7744/***/ }), 7745
vendor: 6,483 bytes, lines 7746-7911
7746/***/ "./node_modules/swiper/modules/effect-creative.mjs": 7747/*!*********************************************************!*\ 7748 !*** ./node_modules/swiper/modules/effect-creative.mjs ***! 7749 \*********************************************************/ 7750/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 7751 7752"use strict"; 7753__webpack_require__.r(__webpack_exports__); 7754/* harmony export */ __webpack_require__.d(__webpack_exports__, { 7755/* harmony export */ "default": function() { return /* binding */ EffectCreative; } 7756/* harmony export */ }); 7757/* harmony import */ var _shared_create_shadow_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/create-shadow.mjs */ "./node_modules/swiper/shared/create-shadow.mjs"); 7758/* harmony import */ var _shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/effect-init.mjs */ "./node_modules/swiper/shared/effect-init.mjs"); 7759/* harmony import */ var _shared_effect_target_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shared/effect-target.mjs */ "./node_modules/swiper/shared/effect-target.mjs"); 7760/* harmony import */ var _shared_effect_virtual_transition_end_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shared/effect-virtual-transition-end.mjs */ "./node_modules/swiper/shared/effect-virtual-transition-end.mjs"); 7761/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 7762 7763 7764 7765 7766 7767 7768function EffectCreative(_ref) { 7769 let { 7770 swiper, 7771 extendParams, 7772 on 7773 } = _ref; 7774 extendParams({ 7775 creativeEffect: { 7776 limitProgress: 1, 7777 shadowPerProgress: false, 7778 progressMultiplier: 1, 7779 perspective: true, 7780 prev: { 7781 translate: [0, 0, 0], 7782 rotate: [0, 0, 0], 7783 opacity: 1, 7784 scale: 1 7785 }, 7786 next: { 7787 translate: [0, 0, 0], 7788 rotate: [0, 0, 0], 7789 opacity: 1, 7790 scale: 1 7791 } 7792 } 7793 }); 7794 const getTranslateValue = value => { 7795 if (typeof value === 'string') return value; 7796 return `${value}px`; 7797 }; 7798 const setTranslate = () => { 7799 const { 7800 slides, 7801 wrapperEl, 7802 slidesSizesGrid 7803 } = swiper; 7804 const params = swiper.params.creativeEffect; 7805 const { 7806 progressMultiplier: multiplier 7807 } = params; 7808 const isCenteredSlides = swiper.params.centeredSlides; 7809 const rotateFix = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_4__.p)(swiper); 7810 if (isCenteredSlides) { 7811 const margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0; 7812 wrapperEl.style.transform = `translateX(calc(50% - ${margin}px))`; 7813 } 7814 for (let i = 0; i < slides.length; i += 1) { 7815 const slideEl = slides[i]; 7816 const slideProgress = slideEl.progress; 7817 const progress = Math.min(Math.max(slideEl.progress, -params.limitProgress), params.limitProgress); 7818 let originalProgress = progress; 7819 if (!isCenteredSlides) { 7820 originalProgress = Math.min(Math.max(slideEl.originalProgress, -params.limitProgress), params.limitProgress); 7821 } 7822 const offset = slideEl.swiperSlideOffset; 7823 const t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0]; 7824 const r = [0, 0, 0]; 7825 let custom = false; 7826 if (!swiper.isHorizontal()) { 7827 t[1] = t[0]; 7828 t[0] = 0; 7829 } 7830 let data = { 7831 translate: [0, 0, 0], 7832 rotate: [0, 0, 0], 7833 scale: 1, 7834 opacity: 1 7835 }; 7836 if (progress < 0) { 7837 data = params.next; 7838 custom = true; 7839 } else if (progress > 0) { 7840 data = params.prev; 7841 custom = true; 7842 } 7843 // set translate 7844 t.forEach((value, index) => { 7845 t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`; 7846 }); 7847 // set rotates 7848 r.forEach((value, index) => { 7849 let val = data.rotate[index] * Math.abs(progress * multiplier); 7850 r[index] = val; 7851 }); 7852 slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 7853 const translateString = t.join(', '); 7854 const rotateString = `rotateX(${rotateFix(r[0])}deg) rotateY(${rotateFix(r[1])}deg) rotateZ(${rotateFix(r[2])}deg)`; 7855 const scaleString = originalProgress < 0 ? `scale(${1 + (1 - data.scale) * originalProgress * multiplier})` : `scale(${1 - (1 - data.scale) * originalProgress * multiplier})`; 7856 const opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier; 7857 const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`; 7858 7859 // Set shadows 7860 if (custom && data.shadow || !custom) { 7861 let shadowEl = slideEl.querySelector('.swiper-slide-shadow'); 7862 if (!shadowEl && data.shadow) { 7863 shadowEl = (0,_shared_create_shadow_mjs__WEBPACK_IMPORTED_MODULE_0__.c)('creative', slideEl); 7864 } 7865 if (shadowEl) { 7866 const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress; 7867 shadowEl.style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1); 7868 } 7869 } 7870 const targetEl = (0,_shared_effect_target_mjs__WEBPACK_IMPORTED_MODULE_2__.e)(params, slideEl); 7871 targetEl.style.transform = transform; 7872 targetEl.style.opacity = opacityString; 7873 if (data.origin) { 7874 targetEl.style.transformOrigin = data.origin; 7875 } 7876 } 7877 }; 7878 const setTransition = duration => { 7879 const transformElements = swiper.slides.map(slideEl => (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_4__.g)(slideEl)); 7880 transformElements.forEach(el => { 7881 el.style.transitionDuration = `${duration}ms`; 7882 el.querySelectorAll('.swiper-slide-shadow').forEach(shadowEl => { 7883 shadowEl.style.transitionDuration = `${duration}ms`; 7884 }); 7885 }); 7886 (0,_shared_effect_virtual_transition_end_mjs__WEBPACK_IMPORTED_MODULE_3__.e)({ 7887 swiper, 7888 duration, 7889 transformElements, 7890 allSlides: true 7891 }); 7892 }; 7893 (0,_shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_1__.e)({ 7894 effect: 'creative', 7895 swiper, 7896 on, 7897 setTranslate, 7898 setTransition, 7899 perspective: () => swiper.params.creativeEffect.perspective, 7900 overwriteParams: () => ({ 7901 watchSlidesProgress: true, 7902 virtualTranslate: !swiper.params.cssMode 7903 }) 7904 }); 7905} 7906 7907 7908 7909 7910/***/ }), 7911
vendor: 7,636 bytes, lines 7912-8102
7912/***/ "./node_modules/swiper/modules/effect-cube.mjs": 7913/*!*****************************************************!*\ 7914 !*** ./node_modules/swiper/modules/effect-cube.mjs ***! 7915 \*****************************************************/ 7916/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 7917 7918"use strict"; 7919__webpack_require__.r(__webpack_exports__); 7920/* harmony export */ __webpack_require__.d(__webpack_exports__, { 7921/* harmony export */ "default": function() { return /* binding */ EffectCube; } 7922/* harmony export */ }); 7923/* harmony import */ var _shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/effect-init.mjs */ "./node_modules/swiper/shared/effect-init.mjs"); 7924/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 7925 7926 7927 7928function EffectCube(_ref) { 7929 let { 7930 swiper, 7931 extendParams, 7932 on 7933 } = _ref; 7934 extendParams({ 7935 cubeEffect: { 7936 slideShadows: true, 7937 shadow: true, 7938 shadowOffset: 20, 7939 shadowScale: 0.94 7940 } 7941 }); 7942 const createSlideShadows = (slideEl, progress, isHorizontal) => { 7943 let shadowBefore = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 7944 let shadowAfter = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 7945 if (!shadowBefore) { 7946 shadowBefore = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.c)('div', `swiper-slide-shadow-cube swiper-slide-shadow-${isHorizontal ? 'left' : 'top'}`.split(' ')); 7947 slideEl.append(shadowBefore); 7948 } 7949 if (!shadowAfter) { 7950 shadowAfter = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.c)('div', `swiper-slide-shadow-cube swiper-slide-shadow-${isHorizontal ? 'right' : 'bottom'}`.split(' ')); 7951 slideEl.append(shadowAfter); 7952 } 7953 if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0); 7954 if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0); 7955 }; 7956 const recreateShadows = () => { 7957 // create new ones 7958 const isHorizontal = swiper.isHorizontal(); 7959 swiper.slides.forEach(slideEl => { 7960 const progress = Math.max(Math.min(slideEl.progress, 1), -1); 7961 createSlideShadows(slideEl, progress, isHorizontal); 7962 }); 7963 }; 7964 const setTranslate = () => { 7965 const { 7966 el, 7967 wrapperEl, 7968 slides, 7969 width: swiperWidth, 7970 height: swiperHeight, 7971 rtlTranslate: rtl, 7972 size: swiperSize, 7973 browser 7974 } = swiper; 7975 const r = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.p)(swiper); 7976 const params = swiper.params.cubeEffect; 7977 const isHorizontal = swiper.isHorizontal(); 7978 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 7979 let wrapperRotate = 0; 7980 let cubeShadowEl; 7981 if (params.shadow) { 7982 if (isHorizontal) { 7983 cubeShadowEl = swiper.wrapperEl.querySelector('.swiper-cube-shadow'); 7984 if (!cubeShadowEl) { 7985 cubeShadowEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.c)('div', 'swiper-cube-shadow'); 7986 swiper.wrapperEl.append(cubeShadowEl); 7987 } 7988 cubeShadowEl.style.height = `${swiperWidth}px`; 7989 } else { 7990 cubeShadowEl = el.querySelector('.swiper-cube-shadow'); 7991 if (!cubeShadowEl) { 7992 cubeShadowEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.c)('div', 'swiper-cube-shadow'); 7993 el.append(cubeShadowEl); 7994 } 7995 } 7996 } 7997 for (let i = 0; i < slides.length; i += 1) { 7998 const slideEl = slides[i]; 7999 let slideIndex = i; 8000 if (isVirtual) { 8001 slideIndex = parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10); 8002 } 8003 let slideAngle = slideIndex * 90; 8004 let round = Math.floor(slideAngle / 360); 8005 if (rtl) { 8006 slideAngle = -slideAngle; 8007 round = Math.floor(-slideAngle / 360); 8008 } 8009 const progress = Math.max(Math.min(slideEl.progress, 1), -1); 8010 let tx = 0; 8011 let ty = 0; 8012 let tz = 0; 8013 if (slideIndex % 4 === 0) { 8014 tx = -round * 4 * swiperSize; 8015 tz = 0; 8016 } else if ((slideIndex - 1) % 4 === 0) { 8017 tx = 0; 8018 tz = -round * 4 * swiperSize; 8019 } else if ((slideIndex - 2) % 4 === 0) { 8020 tx = swiperSize + round * 4 * swiperSize; 8021 tz = swiperSize; 8022 } else if ((slideIndex - 3) % 4 === 0) { 8023 tx = -swiperSize; 8024 tz = 3 * swiperSize + swiperSize * 4 * round; 8025 } 8026 if (rtl) { 8027 tx = -tx; 8028 } 8029 if (!isHorizontal) { 8030 ty = tx; 8031 tx = 0; 8032 } 8033 const transform = `rotateX(${r(isHorizontal ? 0 : -slideAngle)}deg) rotateY(${r(isHorizontal ? slideAngle : 0)}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`; 8034 if (progress <= 1 && progress > -1) { 8035 wrapperRotate = slideIndex * 90 + progress * 90; 8036 if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90; 8037 } 8038 slideEl.style.transform = transform; 8039 if (params.slideShadows) { 8040 createSlideShadows(slideEl, progress, isHorizontal); 8041 } 8042 } 8043 wrapperEl.style.transformOrigin = `50% 50% -${swiperSize / 2}px`; 8044 wrapperEl.style['-webkit-transform-origin'] = `50% 50% -${swiperSize / 2}px`; 8045 if (params.shadow) { 8046 if (isHorizontal) { 8047 cubeShadowEl.style.transform = `translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(89.99deg) rotateZ(0deg) scale(${params.shadowScale})`; 8048 } else { 8049 const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90; 8050 const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2); 8051 const scale1 = params.shadowScale; 8052 const scale2 = params.shadowScale / multiplier; 8053 const offset = params.shadowOffset; 8054 cubeShadowEl.style.transform = `scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-89.99deg)`; 8055 } 8056 } 8057 const zFactor = (browser.isSafari || browser.isWebView) && browser.needPerspectiveFix ? -swiperSize / 2 : 0; 8058 wrapperEl.style.transform = `translate3d(0px,0,${zFactor}px) rotateX(${r(swiper.isHorizontal() ? 0 : wrapperRotate)}deg) rotateY(${r(swiper.isHorizontal() ? -wrapperRotate : 0)}deg)`; 8059 wrapperEl.style.setProperty('--swiper-cube-translate-z', `${zFactor}px`); 8060 }; 8061 const setTransition = duration => { 8062 const { 8063 el, 8064 slides 8065 } = swiper; 8066 slides.forEach(slideEl => { 8067 slideEl.style.transitionDuration = `${duration}ms`; 8068 slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(subEl => { 8069 subEl.style.transitionDuration = `${duration}ms`; 8070 }); 8071 }); 8072 if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) { 8073 const shadowEl = el.querySelector('.swiper-cube-shadow'); 8074 if (shadowEl) shadowEl.style.transitionDuration = `${duration}ms`; 8075 } 8076 }; 8077 (0,_shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_0__.e)({ 8078 effect: 'cube', 8079 swiper, 8080 on, 8081 setTranslate, 8082 setTransition, 8083 recreateShadows, 8084 getEffectParams: () => swiper.params.cubeEffect, 8085 perspective: () => true, 8086 overwriteParams: () => ({ 8087 slidesPerView: 1, 8088 slidesPerGroup: 1, 8089 watchSlidesProgress: true, 8090 resistanceRatio: 0, 8091 spaceBetween: 0, 8092 centeredSlides: false, 8093 virtualTranslate: true 8094 }) 8095 }); 8096} 8097 8098 8099 8100 8101/***/ }), 8102
vendor: 3,103 bytes, lines 8103-8187
8103/***/ "./node_modules/swiper/modules/effect-fade.mjs": 8104/*!*****************************************************!*\ 8105 !*** ./node_modules/swiper/modules/effect-fade.mjs ***! 8106 \*****************************************************/ 8107/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 8108 8109"use strict"; 8110__webpack_require__.r(__webpack_exports__); 8111/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8112/* harmony export */ "default": function() { return /* binding */ EffectFade; } 8113/* harmony export */ }); 8114/* harmony import */ var _shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/effect-init.mjs */ "./node_modules/swiper/shared/effect-init.mjs"); 8115/* harmony import */ var _shared_effect_target_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/effect-target.mjs */ "./node_modules/swiper/shared/effect-target.mjs"); 8116/* harmony import */ var _shared_effect_virtual_transition_end_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shared/effect-virtual-transition-end.mjs */ "./node_modules/swiper/shared/effect-virtual-transition-end.mjs"); 8117/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 8118 8119 8120 8121 8122 8123function EffectFade(_ref) { 8124 let { 8125 swiper, 8126 extendParams, 8127 on 8128 } = _ref; 8129 extendParams({ 8130 fadeEffect: { 8131 crossFade: false 8132 } 8133 }); 8134 const setTranslate = () => { 8135 const { 8136 slides 8137 } = swiper; 8138 const params = swiper.params.fadeEffect; 8139 for (let i = 0; i < slides.length; i += 1) { 8140 const slideEl = swiper.slides[i]; 8141 const offset = slideEl.swiperSlideOffset; 8142 let tx = -offset; 8143 if (!swiper.params.virtualTranslate) tx -= swiper.translate; 8144 let ty = 0; 8145 if (!swiper.isHorizontal()) { 8146 ty = tx; 8147 tx = 0; 8148 } 8149 const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs(slideEl.progress), 0) : 1 + Math.min(Math.max(slideEl.progress, -1), 0); 8150 const targetEl = (0,_shared_effect_target_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(params, slideEl); 8151 targetEl.style.opacity = slideOpacity; 8152 targetEl.style.transform = `translate3d(${tx}px, ${ty}px, 0px)`; 8153 } 8154 }; 8155 const setTransition = duration => { 8156 const transformElements = swiper.slides.map(slideEl => (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_3__.g)(slideEl)); 8157 transformElements.forEach(el => { 8158 el.style.transitionDuration = `${duration}ms`; 8159 }); 8160 (0,_shared_effect_virtual_transition_end_mjs__WEBPACK_IMPORTED_MODULE_2__.e)({ 8161 swiper, 8162 duration, 8163 transformElements, 8164 allSlides: true 8165 }); 8166 }; 8167 (0,_shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_0__.e)({ 8168 effect: 'fade', 8169 swiper, 8170 on, 8171 setTranslate, 8172 setTransition, 8173 overwriteParams: () => ({ 8174 slidesPerView: 1, 8175 slidesPerGroup: 1, 8176 watchSlidesProgress: true, 8177 spaceBetween: 0, 8178 virtualTranslate: !swiper.params.cssMode 8179 }) 8180 }); 8181} 8182 8183 8184 8185 8186/***/ }), 8187
vendor: 5,336 bytes, lines 8188-8318
8188/***/ "./node_modules/swiper/modules/effect-flip.mjs": 8189/*!*****************************************************!*\ 8190 !*** ./node_modules/swiper/modules/effect-flip.mjs ***! 8191 \*****************************************************/ 8192/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 8193 8194"use strict"; 8195__webpack_require__.r(__webpack_exports__); 8196/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8197/* harmony export */ "default": function() { return /* binding */ EffectFlip; } 8198/* harmony export */ }); 8199/* harmony import */ var _shared_create_shadow_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/create-shadow.mjs */ "./node_modules/swiper/shared/create-shadow.mjs"); 8200/* harmony import */ var _shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/effect-init.mjs */ "./node_modules/swiper/shared/effect-init.mjs"); 8201/* harmony import */ var _shared_effect_target_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shared/effect-target.mjs */ "./node_modules/swiper/shared/effect-target.mjs"); 8202/* harmony import */ var _shared_effect_virtual_transition_end_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shared/effect-virtual-transition-end.mjs */ "./node_modules/swiper/shared/effect-virtual-transition-end.mjs"); 8203/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 8204 8205 8206 8207 8208 8209 8210function EffectFlip(_ref) { 8211 let { 8212 swiper, 8213 extendParams, 8214 on 8215 } = _ref; 8216 extendParams({ 8217 flipEffect: { 8218 slideShadows: true, 8219 limitRotation: true 8220 } 8221 }); 8222 const createSlideShadows = (slideEl, progress) => { 8223 let shadowBefore = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 8224 let shadowAfter = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 8225 if (!shadowBefore) { 8226 shadowBefore = (0,_shared_create_shadow_mjs__WEBPACK_IMPORTED_MODULE_0__.c)('flip', slideEl, swiper.isHorizontal() ? 'left' : 'top'); 8227 } 8228 if (!shadowAfter) { 8229 shadowAfter = (0,_shared_create_shadow_mjs__WEBPACK_IMPORTED_MODULE_0__.c)('flip', slideEl, swiper.isHorizontal() ? 'right' : 'bottom'); 8230 } 8231 if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0); 8232 if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0); 8233 }; 8234 const recreateShadows = () => { 8235 // Set shadows 8236 swiper.params.flipEffect; 8237 swiper.slides.forEach(slideEl => { 8238 let progress = slideEl.progress; 8239 if (swiper.params.flipEffect.limitRotation) { 8240 progress = Math.max(Math.min(slideEl.progress, 1), -1); 8241 } 8242 createSlideShadows(slideEl, progress); 8243 }); 8244 }; 8245 const setTranslate = () => { 8246 const { 8247 slides, 8248 rtlTranslate: rtl 8249 } = swiper; 8250 const params = swiper.params.flipEffect; 8251 const rotateFix = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_4__.p)(swiper); 8252 for (let i = 0; i < slides.length; i += 1) { 8253 const slideEl = slides[i]; 8254 let progress = slideEl.progress; 8255 if (swiper.params.flipEffect.limitRotation) { 8256 progress = Math.max(Math.min(slideEl.progress, 1), -1); 8257 } 8258 const offset = slideEl.swiperSlideOffset; 8259 const rotate = -180 * progress; 8260 let rotateY = rotate; 8261 let rotateX = 0; 8262 let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset; 8263 let ty = 0; 8264 if (!swiper.isHorizontal()) { 8265 ty = tx; 8266 tx = 0; 8267 rotateX = -rotateY; 8268 rotateY = 0; 8269 } else if (rtl) { 8270 rotateY = -rotateY; 8271 } 8272 slideEl.style.zIndex = -Math.abs(Math.round(progress)) + slides.length; 8273 if (params.slideShadows) { 8274 createSlideShadows(slideEl, progress); 8275 } 8276 const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateFix(rotateX)}deg) rotateY(${rotateFix(rotateY)}deg)`; 8277 const targetEl = (0,_shared_effect_target_mjs__WEBPACK_IMPORTED_MODULE_2__.e)(params, slideEl); 8278 targetEl.style.transform = transform; 8279 } 8280 }; 8281 const setTransition = duration => { 8282 const transformElements = swiper.slides.map(slideEl => (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_4__.g)(slideEl)); 8283 transformElements.forEach(el => { 8284 el.style.transitionDuration = `${duration}ms`; 8285 el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => { 8286 shadowEl.style.transitionDuration = `${duration}ms`; 8287 }); 8288 }); 8289 (0,_shared_effect_virtual_transition_end_mjs__WEBPACK_IMPORTED_MODULE_3__.e)({ 8290 swiper, 8291 duration, 8292 transformElements 8293 }); 8294 }; 8295 (0,_shared_effect_init_mjs__WEBPACK_IMPORTED_MODULE_1__.e)({ 8296 effect: 'flip', 8297 swiper, 8298 on, 8299 setTranslate, 8300 setTransition, 8301 recreateShadows, 8302 getEffectParams: () => swiper.params.flipEffect, 8303 perspective: () => true, 8304 overwriteParams: () => ({ 8305 slidesPerView: 1, 8306 slidesPerGroup: 1, 8307 watchSlidesProgress: true, 8308 spaceBetween: 0, 8309 virtualTranslate: !swiper.params.cssMode 8310 }) 8311 }); 8312} 8313 8314 8315 8316 8317/***/ }), 8318
vendor: 9,261 bytes, lines 8319-8571
8319/***/ "./node_modules/swiper/modules/free-mode.mjs": 8320/*!***************************************************!*\ 8321 !*** ./node_modules/swiper/modules/free-mode.mjs ***! 8322 \***************************************************/ 8323/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 8324 8325"use strict"; 8326__webpack_require__.r(__webpack_exports__); 8327/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8328/* harmony export */ "default": function() { return /* binding */ freeMode; } 8329/* harmony export */ }); 8330/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 8331 8332 8333function freeMode(_ref) { 8334 let { 8335 swiper, 8336 extendParams, 8337 emit, 8338 once 8339 } = _ref; 8340 extendParams({ 8341 freeMode: { 8342 enabled: false, 8343 momentum: true, 8344 momentumRatio: 1, 8345 momentumBounce: true, 8346 momentumBounceRatio: 1, 8347 momentumVelocityRatio: 1, 8348 sticky: false, 8349 minimumVelocity: 0.02 8350 } 8351 }); 8352 function onTouchStart() { 8353 if (swiper.params.cssMode) return; 8354 const translate = swiper.getTranslate(); 8355 swiper.setTranslate(translate); 8356 swiper.setTransition(0); 8357 swiper.touchEventsData.velocities.length = 0; 8358 swiper.freeMode.onTouchEnd({ 8359 currentPos: swiper.rtl ? swiper.translate : -swiper.translate 8360 }); 8361 } 8362 function onTouchMove() { 8363 if (swiper.params.cssMode) return; 8364 const { 8365 touchEventsData: data, 8366 touches 8367 } = swiper; 8368 // Velocity 8369 if (data.velocities.length === 0) { 8370 data.velocities.push({ 8371 position: touches[swiper.isHorizontal() ? 'startX' : 'startY'], 8372 time: data.touchStartTime 8373 }); 8374 } 8375 data.velocities.push({ 8376 position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'], 8377 time: (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.f)() 8378 }); 8379 } 8380 function onTouchEnd(_ref2) { 8381 let { 8382 currentPos 8383 } = _ref2; 8384 if (swiper.params.cssMode) return; 8385 const { 8386 params, 8387 wrapperEl, 8388 rtlTranslate: rtl, 8389 snapGrid, 8390 touchEventsData: data 8391 } = swiper; 8392 // Time diff 8393 const touchEndTime = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.f)(); 8394 const timeDiff = touchEndTime - data.touchStartTime; 8395 if (currentPos < -swiper.minTranslate()) { 8396 swiper.slideTo(swiper.activeIndex); 8397 return; 8398 } 8399 if (currentPos > -swiper.maxTranslate()) { 8400 if (swiper.slides.length < snapGrid.length) { 8401 swiper.slideTo(snapGrid.length - 1); 8402 } else { 8403 swiper.slideTo(swiper.slides.length - 1); 8404 } 8405 return; 8406 } 8407 if (params.freeMode.momentum) { 8408 if (data.velocities.length > 1) { 8409 const lastMoveEvent = data.velocities.pop(); 8410 const velocityEvent = data.velocities.pop(); 8411 const distance = lastMoveEvent.position - velocityEvent.position; 8412 const time = lastMoveEvent.time - velocityEvent.time; 8413 swiper.velocity = distance / time; 8414 swiper.velocity /= 2; 8415 if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) { 8416 swiper.velocity = 0; 8417 } 8418 // this implies that the user stopped moving a finger then released. 8419 // There would be no events with distance zero, so the last event is stale. 8420 if (time > 150 || (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.f)() - lastMoveEvent.time > 300) { 8421 swiper.velocity = 0; 8422 } 8423 } else { 8424 swiper.velocity = 0; 8425 } 8426 swiper.velocity *= params.freeMode.momentumVelocityRatio; 8427 data.velocities.length = 0; 8428 let momentumDuration = 1000 * params.freeMode.momentumRatio; 8429 const momentumDistance = swiper.velocity * momentumDuration; 8430 let newPosition = swiper.translate + momentumDistance; 8431 if (rtl) newPosition = -newPosition; 8432 let doBounce = false; 8433 let afterBouncePosition; 8434 const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio; 8435 let needsLoopFix; 8436 if (newPosition < swiper.maxTranslate()) { 8437 if (params.freeMode.momentumBounce) { 8438 if (newPosition + swiper.maxTranslate() < -bounceAmount) { 8439 newPosition = swiper.maxTranslate() - bounceAmount; 8440 } 8441 afterBouncePosition = swiper.maxTranslate(); 8442 doBounce = true; 8443 data.allowMomentumBounce = true; 8444 } else { 8445 newPosition = swiper.maxTranslate(); 8446 } 8447 if (params.loop && params.centeredSlides) needsLoopFix = true; 8448 } else if (newPosition > swiper.minTranslate()) { 8449 if (params.freeMode.momentumBounce) { 8450 if (newPosition - swiper.minTranslate() > bounceAmount) { 8451 newPosition = swiper.minTranslate() + bounceAmount; 8452 } 8453 afterBouncePosition = swiper.minTranslate(); 8454 doBounce = true; 8455 data.allowMomentumBounce = true; 8456 } else { 8457 newPosition = swiper.minTranslate(); 8458 } 8459 if (params.loop && params.centeredSlides) needsLoopFix = true; 8460 } else if (params.freeMode.sticky) { 8461 let nextSlide; 8462 for (let j = 0; j < snapGrid.length; j += 1) { 8463 if (snapGrid[j] > -newPosition) { 8464 nextSlide = j; 8465 break; 8466 } 8467 } 8468 if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') { 8469 newPosition = snapGrid[nextSlide]; 8470 } else { 8471 newPosition = snapGrid[nextSlide - 1]; 8472 } 8473 newPosition = -newPosition; 8474 } 8475 if (needsLoopFix) { 8476 once('transitionEnd', () => { 8477 swiper.loopFix(); 8478 }); 8479 } 8480 // Fix duration 8481 if (swiper.velocity !== 0) { 8482 if (rtl) { 8483 momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity); 8484 } else { 8485 momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity); 8486 } 8487 if (params.freeMode.sticky) { 8488 // If freeMode.sticky is active and the user ends a swipe with a slow-velocity 8489 // event, then durations can be 20+ seconds to slide one (or zero!) slides. 8490 // It's easy to see this when simulating touch with mouse events. To fix this, 8491 // limit single-slide swipes to the default slide duration. This also has the 8492 // nice side effect of matching slide speed if the user stopped moving before 8493 // lifting finger or mouse vs. moving slowly before lifting the finger/mouse. 8494 // For faster swipes, also apply limits (albeit higher ones). 8495 const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate); 8496 const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex]; 8497 if (moveDistance < currentSlideSize) { 8498 momentumDuration = params.speed; 8499 } else if (moveDistance < 2 * currentSlideSize) { 8500 momentumDuration = params.speed * 1.5; 8501 } else { 8502 momentumDuration = params.speed * 2.5; 8503 } 8504 } 8505 } else if (params.freeMode.sticky) { 8506 swiper.slideToClosest(); 8507 return; 8508 } 8509 if (params.freeMode.momentumBounce && doBounce) { 8510 swiper.updateProgress(afterBouncePosition); 8511 swiper.setTransition(momentumDuration); 8512 swiper.setTranslate(newPosition); 8513 swiper.transitionStart(true, swiper.swipeDirection); 8514 swiper.animating = true; 8515 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.l)(wrapperEl, () => { 8516 if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return; 8517 emit('momentumBounce'); 8518 swiper.setTransition(params.speed); 8519 setTimeout(() => { 8520 swiper.setTranslate(afterBouncePosition); 8521 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.l)(wrapperEl, () => { 8522 if (!swiper || swiper.destroyed) return; 8523 swiper.transitionEnd(); 8524 }); 8525 }, 0); 8526 }); 8527 } else if (swiper.velocity) { 8528 emit('_freeModeNoMomentumRelease'); 8529 swiper.updateProgress(newPosition); 8530 swiper.setTransition(momentumDuration); 8531 swiper.setTranslate(newPosition); 8532 swiper.transitionStart(true, swiper.swipeDirection); 8533 if (!swiper.animating) { 8534 swiper.animating = true; 8535 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.l)(wrapperEl, () => { 8536 if (!swiper || swiper.destroyed) return; 8537 swiper.transitionEnd(); 8538 }); 8539 } 8540 } else { 8541 swiper.updateProgress(newPosition); 8542 } 8543 swiper.updateActiveIndex(); 8544 swiper.updateSlidesClasses(); 8545 } else if (params.freeMode.sticky) { 8546 swiper.slideToClosest(); 8547 return; 8548 } else if (params.freeMode) { 8549 emit('_freeModeNoMomentumRelease'); 8550 } 8551 if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) { 8552 emit('_freeModeStaticRelease'); 8553 swiper.updateProgress(); 8554 swiper.updateActiveIndex(); 8555 swiper.updateSlidesClasses(); 8556 } 8557 } 8558 Object.assign(swiper, { 8559 freeMode: { 8560 onTouchStart, 8561 onTouchMove, 8562 onTouchEnd 8563 } 8564 }); 8565} 8566 8567 8568 8569 8570/***/ }), 8571
vendor: 5,731 bytes, lines 8572-8741
8572/***/ "./node_modules/swiper/modules/grid.mjs": 8573/*!**********************************************!*\ 8574 !*** ./node_modules/swiper/modules/grid.mjs ***! 8575 \**********************************************/ 8576/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 8577 8578"use strict"; 8579__webpack_require__.r(__webpack_exports__); 8580/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8581/* harmony export */ "default": function() { return /* binding */ Grid; } 8582/* harmony export */ }); 8583function Grid(_ref) { 8584 let { 8585 swiper, 8586 extendParams, 8587 on 8588 } = _ref; 8589 extendParams({ 8590 grid: { 8591 rows: 1, 8592 fill: 'column' 8593 } 8594 }); 8595 let slidesNumberEvenToRows; 8596 let slidesPerRow; 8597 let numFullColumns; 8598 let wasMultiRow; 8599 const getSpaceBetween = () => { 8600 let spaceBetween = swiper.params.spaceBetween; 8601 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 8602 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size; 8603 } else if (typeof spaceBetween === 'string') { 8604 spaceBetween = parseFloat(spaceBetween); 8605 } 8606 return spaceBetween; 8607 }; 8608 const initSlides = slides => { 8609 const { 8610 slidesPerView 8611 } = swiper.params; 8612 const { 8613 rows, 8614 fill 8615 } = swiper.params.grid; 8616 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : slides.length; 8617 numFullColumns = Math.floor(slidesLength / rows); 8618 if (Math.floor(slidesLength / rows) === slidesLength / rows) { 8619 slidesNumberEvenToRows = slidesLength; 8620 } else { 8621 slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows; 8622 } 8623 if (slidesPerView !== 'auto' && fill === 'row') { 8624 slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows); 8625 } 8626 slidesPerRow = slidesNumberEvenToRows / rows; 8627 }; 8628 const unsetSlides = () => { 8629 if (swiper.slides) { 8630 swiper.slides.forEach(slide => { 8631 if (slide.swiperSlideGridSet) { 8632 slide.style.height = ''; 8633 slide.style[swiper.getDirectionLabel('margin-top')] = ''; 8634 } 8635 }); 8636 } 8637 }; 8638 const updateSlide = (i, slide, slides) => { 8639 const { 8640 slidesPerGroup 8641 } = swiper.params; 8642 const spaceBetween = getSpaceBetween(); 8643 const { 8644 rows, 8645 fill 8646 } = swiper.params.grid; 8647 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : slides.length; 8648 // Set slides order 8649 let newSlideOrderIndex; 8650 let column; 8651 let row; 8652 if (fill === 'row' && slidesPerGroup > 1) { 8653 const groupIndex = Math.floor(i / (slidesPerGroup * rows)); 8654 const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex; 8655 const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup); 8656 row = Math.floor(slideIndexInGroup / columnsInGroup); 8657 column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup; 8658 newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows; 8659 slide.style.order = newSlideOrderIndex; 8660 } else if (fill === 'column') { 8661 column = Math.floor(i / rows); 8662 row = i - column * rows; 8663 if (column > numFullColumns || column === numFullColumns && row === rows - 1) { 8664 row += 1; 8665 if (row >= rows) { 8666 row = 0; 8667 column += 1; 8668 } 8669 } 8670 } else { 8671 row = Math.floor(i / slidesPerRow); 8672 column = i - row * slidesPerRow; 8673 } 8674 slide.row = row; 8675 slide.column = column; 8676 slide.style.height = `calc((100% - ${(rows - 1) * spaceBetween}px) / ${rows})`; 8677 slide.style[swiper.getDirectionLabel('margin-top')] = row !== 0 ? spaceBetween && `${spaceBetween}px` : ''; 8678 slide.swiperSlideGridSet = true; 8679 }; 8680 const updateWrapperSize = (slideSize, snapGrid) => { 8681 const { 8682 centeredSlides, 8683 roundLengths 8684 } = swiper.params; 8685 const spaceBetween = getSpaceBetween(); 8686 const { 8687 rows 8688 } = swiper.params.grid; 8689 swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows; 8690 swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween; 8691 if (!swiper.params.cssMode) { 8692 swiper.wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`; 8693 } 8694 if (centeredSlides) { 8695 const newSlidesGrid = []; 8696 for (let i = 0; i < snapGrid.length; i += 1) { 8697 let slidesGridItem = snapGrid[i]; 8698 if (roundLengths) slidesGridItem = Math.floor(slidesGridItem); 8699 if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem); 8700 } 8701 snapGrid.splice(0, snapGrid.length); 8702 snapGrid.push(...newSlidesGrid); 8703 } 8704 }; 8705 const onInit = () => { 8706 wasMultiRow = swiper.params.grid && swiper.params.grid.rows > 1; 8707 }; 8708 const onUpdate = () => { 8709 const { 8710 params, 8711 el 8712 } = swiper; 8713 const isMultiRow = params.grid && params.grid.rows > 1; 8714 if (wasMultiRow && !isMultiRow) { 8715 el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`); 8716 numFullColumns = 1; 8717 swiper.emitContainerClasses(); 8718 } else if (!wasMultiRow && isMultiRow) { 8719 el.classList.add(`${params.containerModifierClass}grid`); 8720 if (params.grid.fill === 'column') { 8721 el.classList.add(`${params.containerModifierClass}grid-column`); 8722 } 8723 swiper.emitContainerClasses(); 8724 } 8725 wasMultiRow = isMultiRow; 8726 }; 8727 on('init', onInit); 8728 on('update', onUpdate); 8729 swiper.grid = { 8730 initSlides, 8731 unsetSlides, 8732 updateSlide, 8733 updateWrapperSize 8734 }; 8735} 8736 8737 8738 8739 8740/***/ }), 8741
vendor: 4,427 bytes, lines 8742-8851
8742/***/ "./node_modules/swiper/modules/hash-navigation.mjs": 8743/*!*********************************************************!*\ 8744 !*** ./node_modules/swiper/modules/hash-navigation.mjs ***! 8745 \*********************************************************/ 8746/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 8747 8748"use strict"; 8749__webpack_require__.r(__webpack_exports__); 8750/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8751/* harmony export */ "default": function() { return /* binding */ HashNavigation; } 8752/* harmony export */ }); 8753/* harmony import */ var _shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 8754/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 8755 8756 8757 8758function HashNavigation(_ref) { 8759 let { 8760 swiper, 8761 extendParams, 8762 emit, 8763 on 8764 } = _ref; 8765 let initialized = false; 8766 const document = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 8767 const window = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 8768 extendParams({ 8769 hashNavigation: { 8770 enabled: false, 8771 replaceState: false, 8772 watchState: false, 8773 getSlideIndex(_s, hash) { 8774 if (swiper.virtual && swiper.params.virtual.enabled) { 8775 const slideWithHash = swiper.slides.find(slideEl => slideEl.getAttribute('data-hash') === hash); 8776 if (!slideWithHash) return 0; 8777 const index = parseInt(slideWithHash.getAttribute('data-swiper-slide-index'), 10); 8778 return index; 8779 } 8780 return swiper.getSlideIndex((0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(swiper.slidesEl, `.${swiper.params.slideClass}[data-hash="${hash}"], swiper-slide[data-hash="${hash}"]`)[0]); 8781 } 8782 } 8783 }); 8784 const onHashChange = () => { 8785 emit('hashChange'); 8786 const newHash = document.location.hash.replace('#', ''); 8787 const activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${swiper.activeIndex}"]`) : swiper.slides[swiper.activeIndex]; 8788 const activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') : ''; 8789 if (newHash !== activeSlideHash) { 8790 const newIndex = swiper.params.hashNavigation.getSlideIndex(swiper, newHash); 8791 if (typeof newIndex === 'undefined' || Number.isNaN(newIndex)) return; 8792 swiper.slideTo(newIndex); 8793 } 8794 }; 8795 const setHash = () => { 8796 if (!initialized || !swiper.params.hashNavigation.enabled) return; 8797 const activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${swiper.activeIndex}"]`) : swiper.slides[swiper.activeIndex]; 8798 const activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') || activeSlideEl.getAttribute('data-history') : ''; 8799 if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) { 8800 window.history.replaceState(null, null, `#${activeSlideHash}` || ''); 8801 emit('hashSet'); 8802 } else { 8803 document.location.hash = activeSlideHash || ''; 8804 emit('hashSet'); 8805 } 8806 }; 8807 const init = () => { 8808 if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return; 8809 initialized = true; 8810 const hash = document.location.hash.replace('#', ''); 8811 if (hash) { 8812 const speed = 0; 8813 const index = swiper.params.hashNavigation.getSlideIndex(swiper, hash); 8814 swiper.slideTo(index || 0, speed, swiper.params.runCallbacksOnInit, true); 8815 } 8816 if (swiper.params.hashNavigation.watchState) { 8817 window.addEventListener('hashchange', onHashChange); 8818 } 8819 }; 8820 const destroy = () => { 8821 if (swiper.params.hashNavigation.watchState) { 8822 window.removeEventListener('hashchange', onHashChange); 8823 } 8824 }; 8825 on('init', () => { 8826 if (swiper.params.hashNavigation.enabled) { 8827 init(); 8828 } 8829 }); 8830 on('destroy', () => { 8831 if (swiper.params.hashNavigation.enabled) { 8832 destroy(); 8833 } 8834 }); 8835 on('transitionEnd _freeModeNoMomentumRelease', () => { 8836 if (initialized) { 8837 setHash(); 8838 } 8839 }); 8840 on('slideChange', () => { 8841 if (initialized && swiper.params.cssMode) { 8842 setHash(); 8843 } 8844 }); 8845} 8846 8847 8848 8849 8850/***/ }), 8851
vendor: 5,144 bytes, lines 8852-9009
8852/***/ "./node_modules/swiper/modules/history.mjs": 8853/*!*************************************************!*\ 8854 !*** ./node_modules/swiper/modules/history.mjs ***! 8855 \*************************************************/ 8856/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 8857 8858"use strict"; 8859__webpack_require__.r(__webpack_exports__); 8860/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8861/* harmony export */ "default": function() { return /* binding */ History; } 8862/* harmony export */ }); 8863/* harmony import */ var _shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 8864 8865 8866function History(_ref) { 8867 let { 8868 swiper, 8869 extendParams, 8870 on 8871 } = _ref; 8872 extendParams({ 8873 history: { 8874 enabled: false, 8875 root: '', 8876 replaceState: false, 8877 key: 'slides', 8878 keepQuery: false 8879 } 8880 }); 8881 let initialized = false; 8882 let paths = {}; 8883 const slugify = text => { 8884 return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, ''); 8885 }; 8886 const getPathValues = urlOverride => { 8887 const window = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 8888 let location; 8889 if (urlOverride) { 8890 location = new URL(urlOverride); 8891 } else { 8892 location = window.location; 8893 } 8894 const pathArray = location.pathname.slice(1).split('/').filter(part => part !== ''); 8895 const total = pathArray.length; 8896 const key = pathArray[total - 2]; 8897 const value = pathArray[total - 1]; 8898 return { 8899 key, 8900 value 8901 }; 8902 }; 8903 const setHistory = (key, index) => { 8904 const window = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 8905 if (!initialized || !swiper.params.history.enabled) return; 8906 let location; 8907 if (swiper.params.url) { 8908 location = new URL(swiper.params.url); 8909 } else { 8910 location = window.location; 8911 } 8912 const slide = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${index}"]`) : swiper.slides[index]; 8913 let value = slugify(slide.getAttribute('data-history')); 8914 if (swiper.params.history.root.length > 0) { 8915 let root = swiper.params.history.root; 8916 if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1); 8917 value = `${root}/${key ? `${key}/` : ''}${value}`; 8918 } else if (!location.pathname.includes(key)) { 8919 value = `${key ? `${key}/` : ''}${value}`; 8920 } 8921 if (swiper.params.history.keepQuery) { 8922 value += location.search; 8923 } 8924 const currentState = window.history.state; 8925 if (currentState && currentState.value === value) { 8926 return; 8927 } 8928 if (swiper.params.history.replaceState) { 8929 window.history.replaceState({ 8930 value 8931 }, null, value); 8932 } else { 8933 window.history.pushState({ 8934 value 8935 }, null, value); 8936 } 8937 }; 8938 const scrollToSlide = (speed, value, runCallbacks) => { 8939 if (value) { 8940 for (let i = 0, length = swiper.slides.length; i < length; i += 1) { 8941 const slide = swiper.slides[i]; 8942 const slideHistory = slugify(slide.getAttribute('data-history')); 8943 if (slideHistory === value) { 8944 const index = swiper.getSlideIndex(slide); 8945 swiper.slideTo(index, speed, runCallbacks); 8946 } 8947 } 8948 } else { 8949 swiper.slideTo(0, speed, runCallbacks); 8950 } 8951 }; 8952 const setHistoryPopState = () => { 8953 paths = getPathValues(swiper.params.url); 8954 scrollToSlide(swiper.params.speed, paths.value, false); 8955 }; 8956 const init = () => { 8957 const window = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 8958 if (!swiper.params.history) return; 8959 if (!window.history || !window.history.pushState) { 8960 swiper.params.history.enabled = false; 8961 swiper.params.hashNavigation.enabled = true; 8962 return; 8963 } 8964 initialized = true; 8965 paths = getPathValues(swiper.params.url); 8966 if (!paths.key && !paths.value) { 8967 if (!swiper.params.history.replaceState) { 8968 window.addEventListener('popstate', setHistoryPopState); 8969 } 8970 return; 8971 } 8972 scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit); 8973 if (!swiper.params.history.replaceState) { 8974 window.addEventListener('popstate', setHistoryPopState); 8975 } 8976 }; 8977 const destroy = () => { 8978 const window = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 8979 if (!swiper.params.history.replaceState) { 8980 window.removeEventListener('popstate', setHistoryPopState); 8981 } 8982 }; 8983 on('init', () => { 8984 if (swiper.params.history.enabled) { 8985 init(); 8986 } 8987 }); 8988 on('destroy', () => { 8989 if (swiper.params.history.enabled) { 8990 destroy(); 8991 } 8992 }); 8993 on('transitionEnd _freeModeNoMomentumRelease', () => { 8994 if (initialized) { 8995 setHistory(swiper.params.history.key, swiper.activeIndex); 8996 } 8997 }); 8998 on('slideChange', () => { 8999 if (initialized && swiper.params.cssMode) { 9000 setHistory(swiper.params.history.key, swiper.activeIndex); 9001 } 9002 }); 9003} 9004 9005 9006 9007 9008/***/ }), 9009
vendor: 5,339 bytes, lines 9010-9143
9010/***/ "./node_modules/swiper/modules/keyboard.mjs": 9011/*!**************************************************!*\ 9012 !*** ./node_modules/swiper/modules/keyboard.mjs ***! 9013 \**************************************************/ 9014/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 9015 9016"use strict"; 9017__webpack_require__.r(__webpack_exports__); 9018/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9019/* harmony export */ "default": function() { return /* binding */ Keyboard; } 9020/* harmony export */ }); 9021/* harmony import */ var _shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 9022/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 9023 9024 9025 9026/* eslint-disable consistent-return */ 9027function Keyboard(_ref) { 9028 let { 9029 swiper, 9030 extendParams, 9031 on, 9032 emit 9033 } = _ref; 9034 const document = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 9035 const window = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 9036 swiper.keyboard = { 9037 enabled: false 9038 }; 9039 extendParams({ 9040 keyboard: { 9041 enabled: false, 9042 onlyInViewport: true, 9043 pageUpDown: true 9044 } 9045 }); 9046 function handle(event) { 9047 if (!swiper.enabled) return; 9048 const { 9049 rtlTranslate: rtl 9050 } = swiper; 9051 let e = event; 9052 if (e.originalEvent) e = e.originalEvent; // jquery fix 9053 const kc = e.keyCode || e.charCode; 9054 const pageUpDown = swiper.params.keyboard.pageUpDown; 9055 const isPageUp = pageUpDown && kc === 33; 9056 const isPageDown = pageUpDown && kc === 34; 9057 const isArrowLeft = kc === 37; 9058 const isArrowRight = kc === 39; 9059 const isArrowUp = kc === 38; 9060 const isArrowDown = kc === 40; 9061 // Directions locks 9062 if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) { 9063 return false; 9064 } 9065 if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) { 9066 return false; 9067 } 9068 if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { 9069 return undefined; 9070 } 9071 if (document.activeElement && (document.activeElement.isContentEditable || document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea'))) { 9072 return undefined; 9073 } 9074 if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) { 9075 let inView = false; 9076 // Check that swiper should be inside of visible area of window 9077 if ((0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.b)(swiper.el, `.${swiper.params.slideClass}, swiper-slide`).length > 0 && (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.b)(swiper.el, `.${swiper.params.slideActiveClass}`).length === 0) { 9078 return undefined; 9079 } 9080 const el = swiper.el; 9081 const swiperWidth = el.clientWidth; 9082 const swiperHeight = el.clientHeight; 9083 const windowWidth = window.innerWidth; 9084 const windowHeight = window.innerHeight; 9085 const swiperOffset = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.d)(el); 9086 if (rtl) swiperOffset.left -= el.scrollLeft; 9087 const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]]; 9088 for (let i = 0; i < swiperCoord.length; i += 1) { 9089 const point = swiperCoord[i]; 9090 if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) { 9091 if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line 9092 inView = true; 9093 } 9094 } 9095 if (!inView) return undefined; 9096 } 9097 if (swiper.isHorizontal()) { 9098 if (isPageUp || isPageDown || isArrowLeft || isArrowRight) { 9099 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 9100 } 9101 if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext(); 9102 if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev(); 9103 } else { 9104 if (isPageUp || isPageDown || isArrowUp || isArrowDown) { 9105 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 9106 } 9107 if (isPageDown || isArrowDown) swiper.slideNext(); 9108 if (isPageUp || isArrowUp) swiper.slidePrev(); 9109 } 9110 emit('keyPress', kc); 9111 return undefined; 9112 } 9113 function enable() { 9114 if (swiper.keyboard.enabled) return; 9115 document.addEventListener('keydown', handle); 9116 swiper.keyboard.enabled = true; 9117 } 9118 function disable() { 9119 if (!swiper.keyboard.enabled) return; 9120 document.removeEventListener('keydown', handle); 9121 swiper.keyboard.enabled = false; 9122 } 9123 on('init', () => { 9124 if (swiper.params.keyboard.enabled) { 9125 enable(); 9126 } 9127 }); 9128 on('destroy', () => { 9129 if (swiper.keyboard.enabled) { 9130 disable(); 9131 } 9132 }); 9133 Object.assign(swiper.keyboard, { 9134 enable, 9135 disable 9136 }); 9137} 9138 9139 9140 9141 9142/***/ }), 9143
vendor: 5,875 bytes, lines 9144-9352
9144/***/ "./node_modules/swiper/modules/manipulation.mjs": 9145/*!******************************************************!*\ 9146 !*** ./node_modules/swiper/modules/manipulation.mjs ***! 9147 \******************************************************/ 9148/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 9149 9150"use strict"; 9151__webpack_require__.r(__webpack_exports__); 9152/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9153/* harmony export */ "default": function() { return /* binding */ Manipulation; } 9154/* harmony export */ }); 9155/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 9156 9157 9158function appendSlide(slides) { 9159 const swiper = this; 9160 const { 9161 params, 9162 slidesEl 9163 } = swiper; 9164 if (params.loop) { 9165 swiper.loopDestroy(); 9166 } 9167 const appendElement = slideEl => { 9168 if (typeof slideEl === 'string') { 9169 const tempDOM = document.createElement('div'); 9170 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.s)(tempDOM, slideEl); 9171 slidesEl.append(tempDOM.children[0]); 9172 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.s)(tempDOM, ''); 9173 } else { 9174 slidesEl.append(slideEl); 9175 } 9176 }; 9177 if (typeof slides === 'object' && 'length' in slides) { 9178 for (let i = 0; i < slides.length; i += 1) { 9179 if (slides[i]) appendElement(slides[i]); 9180 } 9181 } else { 9182 appendElement(slides); 9183 } 9184 swiper.recalcSlides(); 9185 if (params.loop) { 9186 swiper.loopCreate(); 9187 } 9188 if (!params.observer || swiper.isElement) { 9189 swiper.update(); 9190 } 9191} 9192 9193function prependSlide(slides) { 9194 const swiper = this; 9195 const { 9196 params, 9197 activeIndex, 9198 slidesEl 9199 } = swiper; 9200 if (params.loop) { 9201 swiper.loopDestroy(); 9202 } 9203 let newActiveIndex = activeIndex + 1; 9204 const prependElement = slideEl => { 9205 if (typeof slideEl === 'string') { 9206 const tempDOM = document.createElement('div'); 9207 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.s)(tempDOM, slideEl); 9208 slidesEl.prepend(tempDOM.children[0]); 9209 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.s)(tempDOM, ''); 9210 } else { 9211 slidesEl.prepend(slideEl); 9212 } 9213 }; 9214 if (typeof slides === 'object' && 'length' in slides) { 9215 for (let i = 0; i < slides.length; i += 1) { 9216 if (slides[i]) prependElement(slides[i]); 9217 } 9218 newActiveIndex = activeIndex + slides.length; 9219 } else { 9220 prependElement(slides); 9221 } 9222 swiper.recalcSlides(); 9223 if (params.loop) { 9224 swiper.loopCreate(); 9225 } 9226 if (!params.observer || swiper.isElement) { 9227 swiper.update(); 9228 } 9229 swiper.slideTo(newActiveIndex, 0, false); 9230} 9231 9232function addSlide(index, slides) { 9233 const swiper = this; 9234 const { 9235 params, 9236 activeIndex, 9237 slidesEl 9238 } = swiper; 9239 let activeIndexBuffer = activeIndex; 9240 if (params.loop) { 9241 activeIndexBuffer -= swiper.loopedSlides; 9242 swiper.loopDestroy(); 9243 swiper.recalcSlides(); 9244 } 9245 const baseLength = swiper.slides.length; 9246 if (index <= 0) { 9247 swiper.prependSlide(slides); 9248 return; 9249 } 9250 if (index >= baseLength) { 9251 swiper.appendSlide(slides); 9252 return; 9253 } 9254 let newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer; 9255 const slidesBuffer = []; 9256 for (let i = baseLength - 1; i >= index; i -= 1) { 9257 const currentSlide = swiper.slides[i]; 9258 currentSlide.remove(); 9259 slidesBuffer.unshift(currentSlide); 9260 } 9261 if (typeof slides === 'object' && 'length' in slides) { 9262 for (let i = 0; i < slides.length; i += 1) { 9263 if (slides[i]) slidesEl.append(slides[i]); 9264 } 9265 newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer; 9266 } else { 9267 slidesEl.append(slides); 9268 } 9269 for (let i = 0; i < slidesBuffer.length; i += 1) { 9270 slidesEl.append(slidesBuffer[i]); 9271 } 9272 swiper.recalcSlides(); 9273 if (params.loop) { 9274 swiper.loopCreate(); 9275 } 9276 if (!params.observer || swiper.isElement) { 9277 swiper.update(); 9278 } 9279 if (params.loop) { 9280 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 9281 } else { 9282 swiper.slideTo(newActiveIndex, 0, false); 9283 } 9284} 9285 9286function removeSlide(slidesIndexes) { 9287 const swiper = this; 9288 const { 9289 params, 9290 activeIndex 9291 } = swiper; 9292 let activeIndexBuffer = activeIndex; 9293 if (params.loop) { 9294 activeIndexBuffer -= swiper.loopedSlides; 9295 swiper.loopDestroy(); 9296 } 9297 let newActiveIndex = activeIndexBuffer; 9298 let indexToRemove; 9299 if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) { 9300 for (let i = 0; i < slidesIndexes.length; i += 1) { 9301 indexToRemove = slidesIndexes[i]; 9302 if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove(); 9303 if (indexToRemove < newActiveIndex) newActiveIndex -= 1; 9304 } 9305 newActiveIndex = Math.max(newActiveIndex, 0); 9306 } else { 9307 indexToRemove = slidesIndexes; 9308 if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove(); 9309 if (indexToRemove < newActiveIndex) newActiveIndex -= 1; 9310 newActiveIndex = Math.max(newActiveIndex, 0); 9311 } 9312 swiper.recalcSlides(); 9313 if (params.loop) { 9314 swiper.loopCreate(); 9315 } 9316 if (!params.observer || swiper.isElement) { 9317 swiper.update(); 9318 } 9319 if (params.loop) { 9320 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 9321 } else { 9322 swiper.slideTo(newActiveIndex, 0, false); 9323 } 9324} 9325 9326function removeAllSlides() { 9327 const swiper = this; 9328 const slidesIndexes = []; 9329 for (let i = 0; i < swiper.slides.length; i += 1) { 9330 slidesIndexes.push(i); 9331 } 9332 swiper.removeSlide(slidesIndexes); 9333} 9334 9335function Manipulation(_ref) { 9336 let { 9337 swiper 9338 } = _ref; 9339 Object.assign(swiper, { 9340 appendSlide: appendSlide.bind(swiper), 9341 prependSlide: prependSlide.bind(swiper), 9342 addSlide: addSlide.bind(swiper), 9343 removeSlide: removeSlide.bind(swiper), 9344 removeAllSlides: removeAllSlides.bind(swiper) 9345 }); 9346} 9347 9348 9349 9350 9351/***/ }), 9352
vendor: 16,029 bytes, lines 9353-9764
9353/***/ "./node_modules/swiper/modules/mousewheel.mjs": 9354/*!****************************************************!*\ 9355 !*** ./node_modules/swiper/modules/mousewheel.mjs ***! 9356 \****************************************************/ 9357/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 9358 9359"use strict"; 9360__webpack_require__.r(__webpack_exports__); 9361/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9362/* harmony export */ "default": function() { return /* binding */ Mousewheel; } 9363/* harmony export */ }); 9364/* harmony import */ var _shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 9365/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 9366 9367 9368 9369/* eslint-disable consistent-return */ 9370function Mousewheel(_ref) { 9371 let { 9372 swiper, 9373 extendParams, 9374 on, 9375 emit 9376 } = _ref; 9377 const window = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 9378 extendParams({ 9379 mousewheel: { 9380 enabled: false, 9381 releaseOnEdges: false, 9382 invert: false, 9383 forceToAxis: false, 9384 sensitivity: 1, 9385 eventsTarget: 'container', 9386 thresholdDelta: null, 9387 thresholdTime: null, 9388 noMousewheelClass: 'swiper-no-mousewheel' 9389 } 9390 }); 9391 swiper.mousewheel = { 9392 enabled: false 9393 }; 9394 let timeout; 9395 let lastScrollTime = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.f)(); 9396 let lastEventBeforeSnap; 9397 const recentWheelEvents = []; 9398 function normalize(e) { 9399 // Reasonable defaults 9400 const PIXEL_STEP = 10; 9401 const LINE_HEIGHT = 40; 9402 const PAGE_HEIGHT = 800; 9403 let sX = 0; 9404 let sY = 0; // spinX, spinY 9405 let pX = 0; 9406 let pY = 0; // pixelX, pixelY 9407 9408 // Legacy 9409 if ('detail' in e) { 9410 sY = e.detail; 9411 } 9412 if ('wheelDelta' in e) { 9413 sY = -e.wheelDelta / 120; 9414 } 9415 if ('wheelDeltaY' in e) { 9416 sY = -e.wheelDeltaY / 120; 9417 } 9418 if ('wheelDeltaX' in e) { 9419 sX = -e.wheelDeltaX / 120; 9420 } 9421 9422 // side scrolling on FF with DOMMouseScroll 9423 if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { 9424 sX = sY; 9425 sY = 0; 9426 } 9427 pX = sX * PIXEL_STEP; 9428 pY = sY * PIXEL_STEP; 9429 if ('deltaY' in e) { 9430 pY = e.deltaY; 9431 } 9432 if ('deltaX' in e) { 9433 pX = e.deltaX; 9434 } 9435 if (e.shiftKey && !pX) { 9436 // if user scrolls with shift he wants horizontal scroll 9437 pX = pY; 9438 pY = 0; 9439 } 9440 if ((pX || pY) && e.deltaMode) { 9441 if (e.deltaMode === 1) { 9442 // delta in LINE units 9443 pX *= LINE_HEIGHT; 9444 pY *= LINE_HEIGHT; 9445 } else { 9446 // delta in PAGE units 9447 pX *= PAGE_HEIGHT; 9448 pY *= PAGE_HEIGHT; 9449 } 9450 } 9451 9452 // Fall-back if spin cannot be determined 9453 if (pX && !sX) { 9454 sX = pX < 1 ? -1 : 1; 9455 } 9456 if (pY && !sY) { 9457 sY = pY < 1 ? -1 : 1; 9458 } 9459 return { 9460 spinX: sX, 9461 spinY: sY, 9462 pixelX: pX, 9463 pixelY: pY 9464 }; 9465 } 9466 function handleMouseEnter() { 9467 if (!swiper.enabled) return; 9468 swiper.mouseEntered = true; 9469 } 9470 function handleMouseLeave() { 9471 if (!swiper.enabled) return; 9472 swiper.mouseEntered = false; 9473 } 9474 function animateSlider(newEvent) { 9475 if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) { 9476 // Prevent if delta of wheel scroll delta is below configured threshold 9477 return false; 9478 } 9479 if (swiper.params.mousewheel.thresholdTime && (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.f)() - lastScrollTime < swiper.params.mousewheel.thresholdTime) { 9480 // Prevent if time between scrolls is below configured threshold 9481 return false; 9482 } 9483 9484 // If the movement is NOT big enough and 9485 // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider): 9486 // Don't go any further (avoid insignificant scroll movement). 9487 if (newEvent.delta >= 6 && (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.f)() - lastScrollTime < 60) { 9488 // Return false as a default 9489 return true; 9490 } 9491 // If user is scrolling towards the end: 9492 // If the slider hasn't hit the latest slide or 9493 // if the slider is a loop and 9494 // if the slider isn't moving right now: 9495 // Go to next slide and 9496 // emit a scroll event. 9497 // Else (the user is scrolling towards the beginning) and 9498 // if the slider hasn't hit the first slide or 9499 // if the slider is a loop and 9500 // if the slider isn't moving right now: 9501 // Go to prev slide and 9502 // emit a scroll event. 9503 if (newEvent.direction < 0) { 9504 if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { 9505 swiper.slideNext(); 9506 emit('scroll', newEvent.raw); 9507 } 9508 } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { 9509 swiper.slidePrev(); 9510 emit('scroll', newEvent.raw); 9511 } 9512 // If you got here is because an animation has been triggered so store the current time 9513 lastScrollTime = new window.Date().getTime(); 9514 // Return false as a default 9515 return false; 9516 } 9517 function releaseScroll(newEvent) { 9518 const params = swiper.params.mousewheel; 9519 if (newEvent.direction < 0) { 9520 if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) { 9521 // Return true to animate scroll on edges 9522 return true; 9523 } 9524 } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) { 9525 // Return true to animate scroll on edges 9526 return true; 9527 } 9528 return false; 9529 } 9530 function handle(event) { 9531 let e = event; 9532 let disableParentSwiper = true; 9533 if (!swiper.enabled) return; 9534 9535 // Ignore event if the target or its parents have the swiper-no-mousewheel class 9536 if (event.target.closest(`.${swiper.params.mousewheel.noMousewheelClass}`)) return; 9537 const params = swiper.params.mousewheel; 9538 if (swiper.params.cssMode) { 9539 e.preventDefault(); 9540 } 9541 let targetEl = swiper.el; 9542 if (swiper.params.mousewheel.eventsTarget !== 'container') { 9543 targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget); 9544 } 9545 const targetElContainsTarget = targetEl && targetEl.contains(e.target); 9546 if (!swiper.mouseEntered && !targetElContainsTarget && !params.releaseOnEdges) return true; 9547 if (e.originalEvent) e = e.originalEvent; // jquery fix 9548 let delta = 0; 9549 const rtlFactor = swiper.rtlTranslate ? -1 : 1; 9550 const data = normalize(e); 9551 if (params.forceToAxis) { 9552 if (swiper.isHorizontal()) { 9553 if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true; 9554 } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true; 9555 } else { 9556 delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; 9557 } 9558 if (delta === 0) return true; 9559 if (params.invert) delta = -delta; 9560 9561 // Get the scroll positions 9562 let positions = swiper.getTranslate() + delta * params.sensitivity; 9563 if (positions >= swiper.minTranslate()) positions = swiper.minTranslate(); 9564 if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); 9565 9566 // When loop is true: 9567 // the disableParentSwiper will be true. 9568 // When loop is false: 9569 // if the scroll positions is not on edge, 9570 // then the disableParentSwiper will be true. 9571 // if the scroll on edge positions, 9572 // then the disableParentSwiper will be false. 9573 disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate()); 9574 if (disableParentSwiper && swiper.params.nested) e.stopPropagation(); 9575 if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) { 9576 // Register the new event in a variable which stores the relevant data 9577 const newEvent = { 9578 time: (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.f)(), 9579 delta: Math.abs(delta), 9580 direction: Math.sign(delta), 9581 raw: event 9582 }; 9583 9584 // Keep the most recent events 9585 if (recentWheelEvents.length >= 2) { 9586 recentWheelEvents.shift(); // only store the last N events 9587 } 9588 9589 const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 9590 recentWheelEvents.push(newEvent); 9591 9592 // If there is at least one previous recorded event: 9593 // If direction has changed or 9594 // if the scroll is quicker than the previous one: 9595 // Animate the slider. 9596 // Else (this is the first time the wheel is moved): 9597 // Animate the slider. 9598 if (prevEvent) { 9599 if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) { 9600 animateSlider(newEvent); 9601 } 9602 } else { 9603 animateSlider(newEvent); 9604 } 9605 9606 // If it's time to release the scroll: 9607 // Return now so you don't hit the preventDefault. 9608 if (releaseScroll(newEvent)) { 9609 return true; 9610 } 9611 } else { 9612 // Freemode or scrollContainer: 9613 9614 // If we recently snapped after a momentum scroll, then ignore wheel events 9615 // to give time for the deceleration to finish. Stop ignoring after 500 msecs 9616 // or if it's a new scroll (larger delta or inverse sign as last event before 9617 // an end-of-momentum snap). 9618 const newEvent = { 9619 time: (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.f)(), 9620 delta: Math.abs(delta), 9621 direction: Math.sign(delta) 9622 }; 9623 const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction; 9624 if (!ignoreWheelEvents) { 9625 lastEventBeforeSnap = undefined; 9626 let position = swiper.getTranslate() + delta * params.sensitivity; 9627 const wasBeginning = swiper.isBeginning; 9628 const wasEnd = swiper.isEnd; 9629 if (position >= swiper.minTranslate()) position = swiper.minTranslate(); 9630 if (position <= swiper.maxTranslate()) position = swiper.maxTranslate(); 9631 swiper.setTransition(0); 9632 swiper.setTranslate(position); 9633 swiper.updateProgress(); 9634 swiper.updateActiveIndex(); 9635 swiper.updateSlidesClasses(); 9636 if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) { 9637 swiper.updateSlidesClasses(); 9638 } 9639 if (swiper.params.loop) { 9640 swiper.loopFix({ 9641 direction: newEvent.direction < 0 ? 'next' : 'prev', 9642 byMousewheel: true 9643 }); 9644 } 9645 if (swiper.params.freeMode.sticky) { 9646 // When wheel scrolling starts with sticky (aka snap) enabled, then detect 9647 // the end of a momentum scroll by storing recent (N=15?) wheel events. 9648 // 1. do all N events have decreasing or same (absolute value) delta? 9649 // 2. did all N events arrive in the last M (M=500?) msecs? 9650 // 3. does the earliest event have an (absolute value) delta that's 9651 // at least P (P=1?) larger than the most recent event's delta? 9652 // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels? 9653 // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration. 9654 // Snap immediately and ignore remaining wheel events in this scroll. 9655 // See comment above for "remaining wheel events in this scroll" determination. 9656 // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event. 9657 clearTimeout(timeout); 9658 timeout = undefined; 9659 if (recentWheelEvents.length >= 15) { 9660 recentWheelEvents.shift(); // only store the last N events 9661 } 9662 9663 const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 9664 const firstEvent = recentWheelEvents[0]; 9665 recentWheelEvents.push(newEvent); 9666 if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) { 9667 // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log. 9668 recentWheelEvents.splice(0); 9669 } else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) { 9670 // We're at the end of the deceleration of a momentum scroll, so there's no need 9671 // to wait for more events. Snap ASAP on the next tick. 9672 // Also, because there's some remaining momentum we'll bias the snap in the 9673 // direction of the ongoing scroll because it's better UX for the scroll to snap 9674 // in the same direction as the scroll instead of reversing to snap. Therefore, 9675 // if it's already scrolled more than 20% in the current direction, keep going. 9676 const snapToThreshold = delta > 0 ? 0.8 : 0.2; 9677 lastEventBeforeSnap = newEvent; 9678 recentWheelEvents.splice(0); 9679 timeout = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.n)(() => { 9680 if (swiper.destroyed || !swiper.params) return; 9681 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 9682 }, 0); // no delay; move on next tick 9683 } 9684 9685 if (!timeout) { 9686 // if we get here, then we haven't detected the end of a momentum scroll, so 9687 // we'll consider a scroll "complete" when there haven't been any wheel events 9688 // for 500ms. 9689 timeout = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.n)(() => { 9690 if (swiper.destroyed || !swiper.params) return; 9691 const snapToThreshold = 0.5; 9692 lastEventBeforeSnap = newEvent; 9693 recentWheelEvents.splice(0); 9694 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 9695 }, 500); 9696 } 9697 } 9698 9699 // Emit event 9700 if (!ignoreWheelEvents) emit('scroll', e); 9701 9702 // Stop autoplay 9703 if (swiper.params.autoplay && swiper.params.autoplay.disableOnInteraction) swiper.autoplay.stop(); 9704 // Return page scroll on edge positions 9705 if (params.releaseOnEdges && (position === swiper.minTranslate() || position === swiper.maxTranslate())) { 9706 return true; 9707 } 9708 } 9709 } 9710 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 9711 return false; 9712 } 9713 function events(method) { 9714 let targetEl = swiper.el; 9715 if (swiper.params.mousewheel.eventsTarget !== 'container') { 9716 targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget); 9717 } 9718 targetEl[method]('mouseenter', handleMouseEnter); 9719 targetEl[method]('mouseleave', handleMouseLeave); 9720 targetEl[method]('wheel', handle); 9721 } 9722 function enable() { 9723 if (swiper.params.cssMode) { 9724 swiper.wrapperEl.removeEventListener('wheel', handle); 9725 return true; 9726 } 9727 if (swiper.mousewheel.enabled) return false; 9728 events('addEventListener'); 9729 swiper.mousewheel.enabled = true; 9730 return true; 9731 } 9732 function disable() { 9733 if (swiper.params.cssMode) { 9734 swiper.wrapperEl.addEventListener(event, handle); 9735 return true; 9736 } 9737 if (!swiper.mousewheel.enabled) return false; 9738 events('removeEventListener'); 9739 swiper.mousewheel.enabled = false; 9740 return true; 9741 } 9742 on('init', () => { 9743 if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) { 9744 disable(); 9745 } 9746 if (swiper.params.mousewheel.enabled) enable(); 9747 }); 9748 on('destroy', () => { 9749 if (swiper.params.cssMode) { 9750 enable(); 9751 } 9752 if (swiper.mousewheel.enabled) disable(); 9753 }); 9754 Object.assign(swiper.mousewheel, { 9755 enable, 9756 disable 9757 }); 9758} 9759 9760 9761 9762 9763/***/ }), 9764
vendor: 7,442 bytes, lines 9765-9981
9765/***/ "./node_modules/swiper/modules/navigation.mjs": 9766/*!****************************************************!*\ 9767 !*** ./node_modules/swiper/modules/navigation.mjs ***! 9768 \****************************************************/ 9769/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 9770 9771"use strict"; 9772__webpack_require__.r(__webpack_exports__); 9773/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9774/* harmony export */ "default": function() { return /* binding */ Navigation; } 9775/* harmony export */ }); 9776/* harmony import */ var _shared_create_element_if_not_defined_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/create-element-if-not-defined.mjs */ "./node_modules/swiper/shared/create-element-if-not-defined.mjs"); 9777/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 9778 9779 9780 9781function Navigation(_ref) { 9782 let { 9783 swiper, 9784 extendParams, 9785 on, 9786 emit 9787 } = _ref; 9788 extendParams({ 9789 navigation: { 9790 nextEl: null, 9791 prevEl: null, 9792 hideOnClick: false, 9793 disabledClass: 'swiper-button-disabled', 9794 hiddenClass: 'swiper-button-hidden', 9795 lockClass: 'swiper-button-lock', 9796 navigationDisabledClass: 'swiper-navigation-disabled' 9797 } 9798 }); 9799 swiper.navigation = { 9800 nextEl: null, 9801 prevEl: null 9802 }; 9803 function getEl(el) { 9804 let res; 9805 if (el && typeof el === 'string' && swiper.isElement) { 9806 res = swiper.el.querySelector(el) || swiper.hostEl.querySelector(el); 9807 if (res) return res; 9808 } 9809 if (el) { 9810 if (typeof el === 'string') res = [...document.querySelectorAll(el)]; 9811 if (swiper.params.uniqueNavElements && typeof el === 'string' && res && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) { 9812 res = swiper.el.querySelector(el); 9813 } else if (res && res.length === 1) { 9814 res = res[0]; 9815 } 9816 } 9817 if (el && !res) return el; 9818 // if (Array.isArray(res) && res.length === 1) res = res[0]; 9819 return res; 9820 } 9821 function toggleEl(el, disabled) { 9822 const params = swiper.params.navigation; 9823 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.m)(el); 9824 el.forEach(subEl => { 9825 if (subEl) { 9826 subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' ')); 9827 if (subEl.tagName === 'BUTTON') subEl.disabled = disabled; 9828 if (swiper.params.watchOverflow && swiper.enabled) { 9829 subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass); 9830 } 9831 } 9832 }); 9833 } 9834 function update() { 9835 // Update Navigation Buttons 9836 const { 9837 nextEl, 9838 prevEl 9839 } = swiper.navigation; 9840 if (swiper.params.loop) { 9841 toggleEl(prevEl, false); 9842 toggleEl(nextEl, false); 9843 return; 9844 } 9845 toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind); 9846 toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind); 9847 } 9848 function onPrevClick(e) { 9849 e.preventDefault(); 9850 if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return; 9851 swiper.slidePrev(); 9852 emit('navigationPrev'); 9853 } 9854 function onNextClick(e) { 9855 e.preventDefault(); 9856 if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return; 9857 swiper.slideNext(); 9858 emit('navigationNext'); 9859 } 9860 function init() { 9861 const params = swiper.params.navigation; 9862 swiper.params.navigation = (0,_shared_create_element_if_not_defined_mjs__WEBPACK_IMPORTED_MODULE_0__.c)(swiper, swiper.originalParams.navigation, swiper.params.navigation, { 9863 nextEl: 'swiper-button-next', 9864 prevEl: 'swiper-button-prev' 9865 }); 9866 if (!(params.nextEl || params.prevEl)) return; 9867 let nextEl = getEl(params.nextEl); 9868 let prevEl = getEl(params.prevEl); 9869 Object.assign(swiper.navigation, { 9870 nextEl, 9871 prevEl 9872 }); 9873 nextEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.m)(nextEl); 9874 prevEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.m)(prevEl); 9875 const initButton = (el, dir) => { 9876 if (el) { 9877 el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick); 9878 } 9879 if (!swiper.enabled && el) { 9880 el.classList.add(...params.lockClass.split(' ')); 9881 } 9882 }; 9883 nextEl.forEach(el => initButton(el, 'next')); 9884 prevEl.forEach(el => initButton(el, 'prev')); 9885 } 9886 function destroy() { 9887 let { 9888 nextEl, 9889 prevEl 9890 } = swiper.navigation; 9891 nextEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.m)(nextEl); 9892 prevEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.m)(prevEl); 9893 const destroyButton = (el, dir) => { 9894 el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick); 9895 el.classList.remove(...swiper.params.navigation.disabledClass.split(' ')); 9896 }; 9897 nextEl.forEach(el => destroyButton(el, 'next')); 9898 prevEl.forEach(el => destroyButton(el, 'prev')); 9899 } 9900 on('init', () => { 9901 if (swiper.params.navigation.enabled === false) { 9902 // eslint-disable-next-line 9903 disable(); 9904 } else { 9905 init(); 9906 update(); 9907 } 9908 }); 9909 on('toEdge fromEdge lock unlock', () => { 9910 update(); 9911 }); 9912 on('destroy', () => { 9913 destroy(); 9914 }); 9915 on('enable disable', () => { 9916 let { 9917 nextEl, 9918 prevEl 9919 } = swiper.navigation; 9920 nextEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.m)(nextEl); 9921 prevEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.m)(prevEl); 9922 if (swiper.enabled) { 9923 update(); 9924 return; 9925 } 9926 [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.add(swiper.params.navigation.lockClass)); 9927 }); 9928 on('click', (_s, e) => { 9929 let { 9930 nextEl, 9931 prevEl 9932 } = swiper.navigation; 9933 nextEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.m)(nextEl); 9934 prevEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.m)(prevEl); 9935 const targetEl = e.target; 9936 let targetIsButton = prevEl.includes(targetEl) || nextEl.includes(targetEl); 9937 if (swiper.isElement && !targetIsButton) { 9938 const path = e.path || e.composedPath && e.composedPath(); 9939 if (path) { 9940 targetIsButton = path.find(pathEl => nextEl.includes(pathEl) || prevEl.includes(pathEl)); 9941 } 9942 } 9943 if (swiper.params.navigation.hideOnClick && !targetIsButton) { 9944 if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return; 9945 let isHidden; 9946 if (nextEl.length) { 9947 isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass); 9948 } else if (prevEl.length) { 9949 isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass); 9950 } 9951 if (isHidden === true) { 9952 emit('navigationShow'); 9953 } else { 9954 emit('navigationHide'); 9955 } 9956 [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass)); 9957 } 9958 }); 9959 const enable = () => { 9960 swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' ')); 9961 init(); 9962 update(); 9963 }; 9964 const disable = () => { 9965 swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' ')); 9966 destroy(); 9967 }; 9968 Object.assign(swiper.navigation, { 9969 enable, 9970 disable, 9971 update, 9972 init, 9973 destroy 9974 }); 9975} 9976 9977 9978 9979 9980/***/ }), 9981
vendor: 19,155 bytes, lines 9982-10459
9982/***/ "./node_modules/swiper/modules/pagination.mjs": 9983/*!****************************************************!*\ 9984 !*** ./node_modules/swiper/modules/pagination.mjs ***! 9985 \****************************************************/ 9986/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 9987 9988"use strict"; 9989__webpack_require__.r(__webpack_exports__); 9990/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9991/* harmony export */ "default": function() { return /* binding */ Pagination; } 9992/* harmony export */ }); 9993/* harmony import */ var _shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/classes-to-selector.mjs */ "./node_modules/swiper/shared/classes-to-selector.mjs"); 9994/* harmony import */ var _shared_create_element_if_not_defined_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/create-element-if-not-defined.mjs */ "./node_modules/swiper/shared/create-element-if-not-defined.mjs"); 9995/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 9996 9997 9998 9999 10000function Pagination(_ref) { 10001 let { 10002 swiper, 10003 extendParams, 10004 on, 10005 emit 10006 } = _ref; 10007 const pfx = 'swiper-pagination'; 10008 extendParams({ 10009 pagination: { 10010 el: null, 10011 bulletElement: 'span', 10012 clickable: false, 10013 hideOnClick: false, 10014 renderBullet: null, 10015 renderProgressbar: null, 10016 renderFraction: null, 10017 renderCustom: null, 10018 progressbarOpposite: false, 10019 type: 'bullets', 10020 // 'bullets' or 'progressbar' or 'fraction' or 'custom' 10021 dynamicBullets: false, 10022 dynamicMainBullets: 1, 10023 formatFractionCurrent: number => number, 10024 formatFractionTotal: number => number, 10025 bulletClass: `${pfx}-bullet`, 10026 bulletActiveClass: `${pfx}-bullet-active`, 10027 modifierClass: `${pfx}-`, 10028 currentClass: `${pfx}-current`, 10029 totalClass: `${pfx}-total`, 10030 hiddenClass: `${pfx}-hidden`, 10031 progressbarFillClass: `${pfx}-progressbar-fill`, 10032 progressbarOppositeClass: `${pfx}-progressbar-opposite`, 10033 clickableClass: `${pfx}-clickable`, 10034 lockClass: `${pfx}-lock`, 10035 horizontalClass: `${pfx}-horizontal`, 10036 verticalClass: `${pfx}-vertical`, 10037 paginationDisabledClass: `${pfx}-disabled` 10038 } 10039 }); 10040 swiper.pagination = { 10041 el: null, 10042 bullets: [] 10043 }; 10044 let bulletSize; 10045 let dynamicBulletIndex = 0; 10046 function isPaginationDisabled() { 10047 return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0; 10048 } 10049 function setSideBullets(bulletEl, position) { 10050 const { 10051 bulletActiveClass 10052 } = swiper.params.pagination; 10053 if (!bulletEl) return; 10054 bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`]; 10055 if (bulletEl) { 10056 bulletEl.classList.add(`${bulletActiveClass}-${position}`); 10057 bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`]; 10058 if (bulletEl) { 10059 bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`); 10060 } 10061 } 10062 } 10063 function getMoveDirection(prevIndex, nextIndex, length) { 10064 prevIndex = prevIndex % length; 10065 nextIndex = nextIndex % length; 10066 if (nextIndex === prevIndex + 1) { 10067 return 'next'; 10068 } else if (nextIndex === prevIndex - 1) { 10069 return 'previous'; 10070 } 10071 return; 10072 } 10073 function onBulletClick(e) { 10074 const bulletEl = e.target.closest((0,_shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_0__.c)(swiper.params.pagination.bulletClass)); 10075 if (!bulletEl) { 10076 return; 10077 } 10078 e.preventDefault(); 10079 const index = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.i)(bulletEl) * swiper.params.slidesPerGroup; 10080 if (swiper.params.loop) { 10081 if (swiper.realIndex === index) return; 10082 const moveDirection = getMoveDirection(swiper.realIndex, index, swiper.slides.length); 10083 if (moveDirection === 'next') { 10084 swiper.slideNext(); 10085 } else if (moveDirection === 'previous') { 10086 swiper.slidePrev(); 10087 } else { 10088 swiper.slideToLoop(index); 10089 } 10090 } else { 10091 swiper.slideTo(index); 10092 } 10093 } 10094 function update() { 10095 // Render || Update Pagination bullets/items 10096 const rtl = swiper.rtl; 10097 const params = swiper.params.pagination; 10098 if (isPaginationDisabled()) return; 10099 let el = swiper.pagination.el; 10100 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 10101 // Current/Total 10102 let current; 10103 let previousIndex; 10104 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; 10105 const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 10106 if (swiper.params.loop) { 10107 previousIndex = swiper.previousRealIndex || 0; 10108 current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex; 10109 } else if (typeof swiper.snapIndex !== 'undefined') { 10110 current = swiper.snapIndex; 10111 previousIndex = swiper.previousSnapIndex; 10112 } else { 10113 previousIndex = swiper.previousIndex || 0; 10114 current = swiper.activeIndex || 0; 10115 } 10116 // Types 10117 if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { 10118 const bullets = swiper.pagination.bullets; 10119 let firstIndex; 10120 let lastIndex; 10121 let midIndex; 10122 if (params.dynamicBullets) { 10123 bulletSize = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.h)(bullets[0], swiper.isHorizontal() ? 'width' : 'height', true); 10124 el.forEach(subEl => { 10125 subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`; 10126 }); 10127 if (params.dynamicMainBullets > 1 && previousIndex !== undefined) { 10128 dynamicBulletIndex += current - (previousIndex || 0); 10129 if (dynamicBulletIndex > params.dynamicMainBullets - 1) { 10130 dynamicBulletIndex = params.dynamicMainBullets - 1; 10131 } else if (dynamicBulletIndex < 0) { 10132 dynamicBulletIndex = 0; 10133 } 10134 } 10135 firstIndex = Math.max(current - dynamicBulletIndex, 0); 10136 lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); 10137 midIndex = (lastIndex + firstIndex) / 2; 10138 } 10139 bullets.forEach(bulletEl => { 10140 const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat(); 10141 bulletEl.classList.remove(...classesToRemove); 10142 }); 10143 if (el.length > 1) { 10144 bullets.forEach(bullet => { 10145 const bulletIndex = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.i)(bullet); 10146 if (bulletIndex === current) { 10147 bullet.classList.add(...params.bulletActiveClass.split(' ')); 10148 } else if (swiper.isElement) { 10149 bullet.setAttribute('part', 'bullet'); 10150 } 10151 if (params.dynamicBullets) { 10152 if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { 10153 bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' ')); 10154 } 10155 if (bulletIndex === firstIndex) { 10156 setSideBullets(bullet, 'prev'); 10157 } 10158 if (bulletIndex === lastIndex) { 10159 setSideBullets(bullet, 'next'); 10160 } 10161 } 10162 }); 10163 } else { 10164 const bullet = bullets[current]; 10165 if (bullet) { 10166 bullet.classList.add(...params.bulletActiveClass.split(' ')); 10167 } 10168 if (swiper.isElement) { 10169 bullets.forEach((bulletEl, bulletIndex) => { 10170 bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet'); 10171 }); 10172 } 10173 if (params.dynamicBullets) { 10174 const firstDisplayedBullet = bullets[firstIndex]; 10175 const lastDisplayedBullet = bullets[lastIndex]; 10176 for (let i = firstIndex; i <= lastIndex; i += 1) { 10177 if (bullets[i]) { 10178 bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' ')); 10179 } 10180 } 10181 setSideBullets(firstDisplayedBullet, 'prev'); 10182 setSideBullets(lastDisplayedBullet, 'next'); 10183 } 10184 } 10185 if (params.dynamicBullets) { 10186 const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); 10187 const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize; 10188 const offsetProp = rtl ? 'right' : 'left'; 10189 bullets.forEach(bullet => { 10190 bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`; 10191 }); 10192 } 10193 } 10194 el.forEach((subEl, subElIndex) => { 10195 if (params.type === 'fraction') { 10196 subEl.querySelectorAll((0,_shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_0__.c)(params.currentClass)).forEach(fractionEl => { 10197 fractionEl.textContent = params.formatFractionCurrent(current + 1); 10198 }); 10199 subEl.querySelectorAll((0,_shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_0__.c)(params.totalClass)).forEach(totalEl => { 10200 totalEl.textContent = params.formatFractionTotal(total); 10201 }); 10202 } 10203 if (params.type === 'progressbar') { 10204 let progressbarDirection; 10205 if (params.progressbarOpposite) { 10206 progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; 10207 } else { 10208 progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; 10209 } 10210 const scale = (current + 1) / total; 10211 let scaleX = 1; 10212 let scaleY = 1; 10213 if (progressbarDirection === 'horizontal') { 10214 scaleX = scale; 10215 } else { 10216 scaleY = scale; 10217 } 10218 subEl.querySelectorAll((0,_shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_0__.c)(params.progressbarFillClass)).forEach(progressEl => { 10219 progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`; 10220 progressEl.style.transitionDuration = `${swiper.params.speed}ms`; 10221 }); 10222 } 10223 if (params.type === 'custom' && params.renderCustom) { 10224 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.s)(subEl, params.renderCustom(swiper, current + 1, total)); 10225 if (subElIndex === 0) emit('paginationRender', subEl); 10226 } else { 10227 if (subElIndex === 0) emit('paginationRender', subEl); 10228 emit('paginationUpdate', subEl); 10229 } 10230 if (swiper.params.watchOverflow && swiper.enabled) { 10231 subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass); 10232 } 10233 }); 10234 } 10235 function render() { 10236 // Render Container 10237 const params = swiper.params.pagination; 10238 if (isPaginationDisabled()) return; 10239 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.grid && swiper.params.grid.rows > 1 ? swiper.slides.length / Math.ceil(swiper.params.grid.rows) : swiper.slides.length; 10240 let el = swiper.pagination.el; 10241 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 10242 let paginationHTML = ''; 10243 if (params.type === 'bullets') { 10244 let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 10245 if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) { 10246 numberOfBullets = slidesLength; 10247 } 10248 for (let i = 0; i < numberOfBullets; i += 1) { 10249 if (params.renderBullet) { 10250 paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass); 10251 } else { 10252 // prettier-ignore 10253 paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part="bullet"' : ''} class="${params.bulletClass}"></${params.bulletElement}>`; 10254 } 10255 } 10256 } 10257 if (params.type === 'fraction') { 10258 if (params.renderFraction) { 10259 paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); 10260 } else { 10261 paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`; 10262 } 10263 } 10264 if (params.type === 'progressbar') { 10265 if (params.renderProgressbar) { 10266 paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); 10267 } else { 10268 paginationHTML = `<span class="${params.progressbarFillClass}"></span>`; 10269 } 10270 } 10271 swiper.pagination.bullets = []; 10272 el.forEach(subEl => { 10273 if (params.type !== 'custom') { 10274 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.s)(subEl, paginationHTML || ''); 10275 } 10276 if (params.type === 'bullets') { 10277 swiper.pagination.bullets.push(...subEl.querySelectorAll((0,_shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_0__.c)(params.bulletClass))); 10278 } 10279 }); 10280 if (params.type !== 'custom') { 10281 emit('paginationRender', el[0]); 10282 } 10283 } 10284 function init() { 10285 swiper.params.pagination = (0,_shared_create_element_if_not_defined_mjs__WEBPACK_IMPORTED_MODULE_1__.c)(swiper, swiper.originalParams.pagination, swiper.params.pagination, { 10286 el: 'swiper-pagination' 10287 }); 10288 const params = swiper.params.pagination; 10289 if (!params.el) return; 10290 let el; 10291 if (typeof params.el === 'string' && swiper.isElement) { 10292 el = swiper.el.querySelector(params.el); 10293 } 10294 if (!el && typeof params.el === 'string') { 10295 el = [...document.querySelectorAll(params.el)]; 10296 } 10297 if (!el) { 10298 el = params.el; 10299 } 10300 if (!el || el.length === 0) return; 10301 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) { 10302 el = [...swiper.el.querySelectorAll(params.el)]; 10303 // check if it belongs to another nested Swiper 10304 if (el.length > 1) { 10305 el = el.find(subEl => { 10306 if ((0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.b)(subEl, '.swiper')[0] !== swiper.el) return false; 10307 return true; 10308 }); 10309 } 10310 } 10311 if (Array.isArray(el) && el.length === 1) el = el[0]; 10312 Object.assign(swiper.pagination, { 10313 el 10314 }); 10315 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 10316 el.forEach(subEl => { 10317 if (params.type === 'bullets' && params.clickable) { 10318 subEl.classList.add(...(params.clickableClass || '').split(' ')); 10319 } 10320 subEl.classList.add(params.modifierClass + params.type); 10321 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 10322 if (params.type === 'bullets' && params.dynamicBullets) { 10323 subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`); 10324 dynamicBulletIndex = 0; 10325 if (params.dynamicMainBullets < 1) { 10326 params.dynamicMainBullets = 1; 10327 } 10328 } 10329 if (params.type === 'progressbar' && params.progressbarOpposite) { 10330 subEl.classList.add(params.progressbarOppositeClass); 10331 } 10332 if (params.clickable) { 10333 subEl.addEventListener('click', onBulletClick); 10334 } 10335 if (!swiper.enabled) { 10336 subEl.classList.add(params.lockClass); 10337 } 10338 }); 10339 } 10340 function destroy() { 10341 const params = swiper.params.pagination; 10342 if (isPaginationDisabled()) return; 10343 let el = swiper.pagination.el; 10344 if (el) { 10345 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 10346 el.forEach(subEl => { 10347 subEl.classList.remove(params.hiddenClass); 10348 subEl.classList.remove(params.modifierClass + params.type); 10349 subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 10350 if (params.clickable) { 10351 subEl.classList.remove(...(params.clickableClass || '').split(' ')); 10352 subEl.removeEventListener('click', onBulletClick); 10353 } 10354 }); 10355 } 10356 if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' '))); 10357 } 10358 on('changeDirection', () => { 10359 if (!swiper.pagination || !swiper.pagination.el) return; 10360 const params = swiper.params.pagination; 10361 let { 10362 el 10363 } = swiper.pagination; 10364 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 10365 el.forEach(subEl => { 10366 subEl.classList.remove(params.horizontalClass, params.verticalClass); 10367 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 10368 }); 10369 }); 10370 on('init', () => { 10371 if (swiper.params.pagination.enabled === false) { 10372 // eslint-disable-next-line 10373 disable(); 10374 } else { 10375 init(); 10376 render(); 10377 update(); 10378 } 10379 }); 10380 on('activeIndexChange', () => { 10381 if (typeof swiper.snapIndex === 'undefined') { 10382 update(); 10383 } 10384 }); 10385 on('snapIndexChange', () => { 10386 update(); 10387 }); 10388 on('snapGridLengthChange', () => { 10389 render(); 10390 update(); 10391 }); 10392 on('destroy', () => { 10393 destroy(); 10394 }); 10395 on('enable disable', () => { 10396 let { 10397 el 10398 } = swiper.pagination; 10399 if (el) { 10400 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 10401 el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass)); 10402 } 10403 }); 10404 on('lock unlock', () => { 10405 update(); 10406 }); 10407 on('click', (_s, e) => { 10408 const targetEl = e.target; 10409 const el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(swiper.pagination.el); 10410 if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) { 10411 if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return; 10412 const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass); 10413 if (isHidden === true) { 10414 emit('paginationShow'); 10415 } else { 10416 emit('paginationHide'); 10417 } 10418 el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass)); 10419 } 10420 }); 10421 const enable = () => { 10422 swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass); 10423 let { 10424 el 10425 } = swiper.pagination; 10426 if (el) { 10427 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 10428 el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass)); 10429 } 10430 init(); 10431 render(); 10432 update(); 10433 }; 10434 const disable = () => { 10435 swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass); 10436 let { 10437 el 10438 } = swiper.pagination; 10439 if (el) { 10440 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.m)(el); 10441 el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass)); 10442 } 10443 destroy(); 10444 }; 10445 Object.assign(swiper.pagination, { 10446 enable, 10447 disable, 10448 render, 10449 update, 10450 init, 10451 destroy 10452 }); 10453} 10454 10455 10456 10457 10458/***/ }), 10459
vendor: 4,718 bytes, lines 10460-10599
10460/***/ "./node_modules/swiper/modules/parallax.mjs": 10461/*!**************************************************!*\ 10462 !*** ./node_modules/swiper/modules/parallax.mjs ***! 10463 \**************************************************/ 10464/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 10465 10466"use strict"; 10467__webpack_require__.r(__webpack_exports__); 10468/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10469/* harmony export */ "default": function() { return /* binding */ Parallax; } 10470/* harmony export */ }); 10471/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 10472 10473 10474function Parallax(_ref) { 10475 let { 10476 swiper, 10477 extendParams, 10478 on 10479 } = _ref; 10480 extendParams({ 10481 parallax: { 10482 enabled: false 10483 } 10484 }); 10485 const elementsSelector = '[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]'; 10486 const setTransform = (el, progress) => { 10487 const { 10488 rtl 10489 } = swiper; 10490 const rtlFactor = rtl ? -1 : 1; 10491 const p = el.getAttribute('data-swiper-parallax') || '0'; 10492 let x = el.getAttribute('data-swiper-parallax-x'); 10493 let y = el.getAttribute('data-swiper-parallax-y'); 10494 const scale = el.getAttribute('data-swiper-parallax-scale'); 10495 const opacity = el.getAttribute('data-swiper-parallax-opacity'); 10496 const rotate = el.getAttribute('data-swiper-parallax-rotate'); 10497 if (x || y) { 10498 x = x || '0'; 10499 y = y || '0'; 10500 } else if (swiper.isHorizontal()) { 10501 x = p; 10502 y = '0'; 10503 } else { 10504 y = p; 10505 x = '0'; 10506 } 10507 if (x.indexOf('%') >= 0) { 10508 x = `${parseInt(x, 10) * progress * rtlFactor}%`; 10509 } else { 10510 x = `${x * progress * rtlFactor}px`; 10511 } 10512 if (y.indexOf('%') >= 0) { 10513 y = `${parseInt(y, 10) * progress}%`; 10514 } else { 10515 y = `${y * progress}px`; 10516 } 10517 if (typeof opacity !== 'undefined' && opacity !== null) { 10518 const currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress)); 10519 el.style.opacity = currentOpacity; 10520 } 10521 let transform = `translate3d(${x}, ${y}, 0px)`; 10522 if (typeof scale !== 'undefined' && scale !== null) { 10523 const currentScale = scale - (scale - 1) * (1 - Math.abs(progress)); 10524 transform += ` scale(${currentScale})`; 10525 } 10526 if (rotate && typeof rotate !== 'undefined' && rotate !== null) { 10527 const currentRotate = rotate * progress * -1; 10528 transform += ` rotate(${currentRotate}deg)`; 10529 } 10530 el.style.transform = transform; 10531 }; 10532 const setTranslate = () => { 10533 const { 10534 el, 10535 slides, 10536 progress, 10537 snapGrid, 10538 isElement 10539 } = swiper; 10540 const elements = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.e)(el, elementsSelector); 10541 if (swiper.isElement) { 10542 elements.push(...(0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.e)(swiper.hostEl, elementsSelector)); 10543 } 10544 elements.forEach(subEl => { 10545 setTransform(subEl, progress); 10546 }); 10547 slides.forEach((slideEl, slideIndex) => { 10548 let slideProgress = slideEl.progress; 10549 if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') { 10550 slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1); 10551 } 10552 slideProgress = Math.min(Math.max(slideProgress, -1), 1); 10553 slideEl.querySelectorAll(`${elementsSelector}, [data-swiper-parallax-rotate]`).forEach(subEl => { 10554 setTransform(subEl, slideProgress); 10555 }); 10556 }); 10557 }; 10558 const setTransition = function (duration) { 10559 if (duration === void 0) { 10560 duration = swiper.params.speed; 10561 } 10562 const { 10563 el, 10564 hostEl 10565 } = swiper; 10566 const elements = [...el.querySelectorAll(elementsSelector)]; 10567 if (swiper.isElement) { 10568 elements.push(...hostEl.querySelectorAll(elementsSelector)); 10569 } 10570 elements.forEach(parallaxEl => { 10571 let parallaxDuration = parseInt(parallaxEl.getAttribute('data-swiper-parallax-duration'), 10) || duration; 10572 if (duration === 0) parallaxDuration = 0; 10573 parallaxEl.style.transitionDuration = `${parallaxDuration}ms`; 10574 }); 10575 }; 10576 on('beforeInit', () => { 10577 if (!swiper.params.parallax.enabled) return; 10578 swiper.params.watchSlidesProgress = true; 10579 swiper.originalParams.watchSlidesProgress = true; 10580 }); 10581 on('init', () => { 10582 if (!swiper.params.parallax.enabled) return; 10583 setTranslate(); 10584 }); 10585 on('setTranslate', () => { 10586 if (!swiper.params.parallax.enabled) return; 10587 setTranslate(); 10588 }); 10589 on('setTransition', (_swiper, duration) => { 10590 if (!swiper.params.parallax.enabled) return; 10591 setTransition(duration); 10592 }); 10593} 10594 10595 10596 10597 10598/***/ }), 10599
vendor: 12,551 bytes, lines 10600-10984
10600/***/ "./node_modules/swiper/modules/scrollbar.mjs": 10601/*!***************************************************!*\ 10602 !*** ./node_modules/swiper/modules/scrollbar.mjs ***! 10603 \***************************************************/ 10604/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 10605 10606"use strict"; 10607__webpack_require__.r(__webpack_exports__); 10608/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10609/* harmony export */ "default": function() { return /* binding */ Scrollbar; } 10610/* harmony export */ }); 10611/* harmony import */ var _shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 10612/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 10613/* harmony import */ var _shared_create_element_if_not_defined_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shared/create-element-if-not-defined.mjs */ "./node_modules/swiper/shared/create-element-if-not-defined.mjs"); 10614/* harmony import */ var _shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shared/classes-to-selector.mjs */ "./node_modules/swiper/shared/classes-to-selector.mjs"); 10615 10616 10617 10618 10619 10620function Scrollbar(_ref) { 10621 let { 10622 swiper, 10623 extendParams, 10624 on, 10625 emit 10626 } = _ref; 10627 const document = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 10628 let isTouched = false; 10629 let timeout = null; 10630 let dragTimeout = null; 10631 let dragStartPos; 10632 let dragSize; 10633 let trackSize; 10634 let divider; 10635 extendParams({ 10636 scrollbar: { 10637 el: null, 10638 dragSize: 'auto', 10639 hide: false, 10640 draggable: false, 10641 snapOnRelease: true, 10642 lockClass: 'swiper-scrollbar-lock', 10643 dragClass: 'swiper-scrollbar-drag', 10644 scrollbarDisabledClass: 'swiper-scrollbar-disabled', 10645 horizontalClass: `swiper-scrollbar-horizontal`, 10646 verticalClass: `swiper-scrollbar-vertical` 10647 } 10648 }); 10649 swiper.scrollbar = { 10650 el: null, 10651 dragEl: null 10652 }; 10653 function setTranslate() { 10654 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10655 const { 10656 scrollbar, 10657 rtlTranslate: rtl 10658 } = swiper; 10659 const { 10660 dragEl, 10661 el 10662 } = scrollbar; 10663 const params = swiper.params.scrollbar; 10664 const progress = swiper.params.loop ? swiper.progressLoop : swiper.progress; 10665 let newSize = dragSize; 10666 let newPos = (trackSize - dragSize) * progress; 10667 if (rtl) { 10668 newPos = -newPos; 10669 if (newPos > 0) { 10670 newSize = dragSize - newPos; 10671 newPos = 0; 10672 } else if (-newPos + dragSize > trackSize) { 10673 newSize = trackSize + newPos; 10674 } 10675 } else if (newPos < 0) { 10676 newSize = dragSize + newPos; 10677 newPos = 0; 10678 } else if (newPos + dragSize > trackSize) { 10679 newSize = trackSize - newPos; 10680 } 10681 if (swiper.isHorizontal()) { 10682 dragEl.style.transform = `translate3d(${newPos}px, 0, 0)`; 10683 dragEl.style.width = `${newSize}px`; 10684 } else { 10685 dragEl.style.transform = `translate3d(0px, ${newPos}px, 0)`; 10686 dragEl.style.height = `${newSize}px`; 10687 } 10688 if (params.hide) { 10689 clearTimeout(timeout); 10690 el.style.opacity = 1; 10691 timeout = setTimeout(() => { 10692 el.style.opacity = 0; 10693 el.style.transitionDuration = '400ms'; 10694 }, 1000); 10695 } 10696 } 10697 function setTransition(duration) { 10698 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10699 swiper.scrollbar.dragEl.style.transitionDuration = `${duration}ms`; 10700 } 10701 function updateSize() { 10702 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10703 const { 10704 scrollbar 10705 } = swiper; 10706 const { 10707 dragEl, 10708 el 10709 } = scrollbar; 10710 dragEl.style.width = ''; 10711 dragEl.style.height = ''; 10712 trackSize = swiper.isHorizontal() ? el.offsetWidth : el.offsetHeight; 10713 divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0)); 10714 if (swiper.params.scrollbar.dragSize === 'auto') { 10715 dragSize = trackSize * divider; 10716 } else { 10717 dragSize = parseInt(swiper.params.scrollbar.dragSize, 10); 10718 } 10719 if (swiper.isHorizontal()) { 10720 dragEl.style.width = `${dragSize}px`; 10721 } else { 10722 dragEl.style.height = `${dragSize}px`; 10723 } 10724 if (divider >= 1) { 10725 el.style.display = 'none'; 10726 } else { 10727 el.style.display = ''; 10728 } 10729 if (swiper.params.scrollbar.hide) { 10730 el.style.opacity = 0; 10731 } 10732 if (swiper.params.watchOverflow && swiper.enabled) { 10733 scrollbar.el.classList[swiper.isLocked ? 'add' : 'remove'](swiper.params.scrollbar.lockClass); 10734 } 10735 } 10736 function getPointerPosition(e) { 10737 return swiper.isHorizontal() ? e.clientX : e.clientY; 10738 } 10739 function setDragPosition(e) { 10740 const { 10741 scrollbar, 10742 rtlTranslate: rtl 10743 } = swiper; 10744 const { 10745 el 10746 } = scrollbar; 10747 let positionRatio; 10748 positionRatio = (getPointerPosition(e) - (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.d)(el)[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize); 10749 positionRatio = Math.max(Math.min(positionRatio, 1), 0); 10750 if (rtl) { 10751 positionRatio = 1 - positionRatio; 10752 } 10753 const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio; 10754 swiper.updateProgress(position); 10755 swiper.setTranslate(position); 10756 swiper.updateActiveIndex(); 10757 swiper.updateSlidesClasses(); 10758 } 10759 function onDragStart(e) { 10760 const params = swiper.params.scrollbar; 10761 const { 10762 scrollbar, 10763 wrapperEl 10764 } = swiper; 10765 const { 10766 el, 10767 dragEl 10768 } = scrollbar; 10769 isTouched = true; 10770 dragStartPos = e.target === dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null; 10771 e.preventDefault(); 10772 e.stopPropagation(); 10773 wrapperEl.style.transitionDuration = '100ms'; 10774 dragEl.style.transitionDuration = '100ms'; 10775 setDragPosition(e); 10776 clearTimeout(dragTimeout); 10777 el.style.transitionDuration = '0ms'; 10778 if (params.hide) { 10779 el.style.opacity = 1; 10780 } 10781 if (swiper.params.cssMode) { 10782 swiper.wrapperEl.style['scroll-snap-type'] = 'none'; 10783 } 10784 emit('scrollbarDragStart', e); 10785 } 10786 function onDragMove(e) { 10787 const { 10788 scrollbar, 10789 wrapperEl 10790 } = swiper; 10791 const { 10792 el, 10793 dragEl 10794 } = scrollbar; 10795 if (!isTouched) return; 10796 if (e.preventDefault && e.cancelable) e.preventDefault();else e.returnValue = false; 10797 setDragPosition(e); 10798 wrapperEl.style.transitionDuration = '0ms'; 10799 el.style.transitionDuration = '0ms'; 10800 dragEl.style.transitionDuration = '0ms'; 10801 emit('scrollbarDragMove', e); 10802 } 10803 function onDragEnd(e) { 10804 const params = swiper.params.scrollbar; 10805 const { 10806 scrollbar, 10807 wrapperEl 10808 } = swiper; 10809 const { 10810 el 10811 } = scrollbar; 10812 if (!isTouched) return; 10813 isTouched = false; 10814 if (swiper.params.cssMode) { 10815 swiper.wrapperEl.style['scroll-snap-type'] = ''; 10816 wrapperEl.style.transitionDuration = ''; 10817 } 10818 if (params.hide) { 10819 clearTimeout(dragTimeout); 10820 dragTimeout = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.n)(() => { 10821 el.style.opacity = 0; 10822 el.style.transitionDuration = '400ms'; 10823 }, 1000); 10824 } 10825 emit('scrollbarDragEnd', e); 10826 if (params.snapOnRelease) { 10827 swiper.slideToClosest(); 10828 } 10829 } 10830 function events(method) { 10831 const { 10832 scrollbar, 10833 params 10834 } = swiper; 10835 const el = scrollbar.el; 10836 if (!el) return; 10837 const target = el; 10838 const activeListener = params.passiveListeners ? { 10839 passive: false, 10840 capture: false 10841 } : false; 10842 const passiveListener = params.passiveListeners ? { 10843 passive: true, 10844 capture: false 10845 } : false; 10846 if (!target) return; 10847 const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 10848 target[eventMethod]('pointerdown', onDragStart, activeListener); 10849 document[eventMethod]('pointermove', onDragMove, activeListener); 10850 document[eventMethod]('pointerup', onDragEnd, passiveListener); 10851 } 10852 function enableDraggable() { 10853 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10854 events('on'); 10855 } 10856 function disableDraggable() { 10857 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10858 events('off'); 10859 } 10860 function init() { 10861 const { 10862 scrollbar, 10863 el: swiperEl 10864 } = swiper; 10865 swiper.params.scrollbar = (0,_shared_create_element_if_not_defined_mjs__WEBPACK_IMPORTED_MODULE_2__.c)(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, { 10866 el: 'swiper-scrollbar' 10867 }); 10868 const params = swiper.params.scrollbar; 10869 if (!params.el) return; 10870 let el; 10871 if (typeof params.el === 'string' && swiper.isElement) { 10872 el = swiper.el.querySelector(params.el); 10873 } 10874 if (!el && typeof params.el === 'string') { 10875 el = document.querySelectorAll(params.el); 10876 if (!el.length) return; 10877 } else if (!el) { 10878 el = params.el; 10879 } 10880 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && el.length > 1 && swiperEl.querySelectorAll(params.el).length === 1) { 10881 el = swiperEl.querySelector(params.el); 10882 } 10883 if (el.length > 0) el = el[0]; 10884 el.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 10885 let dragEl; 10886 if (el) { 10887 dragEl = el.querySelector((0,_shared_classes_to_selector_mjs__WEBPACK_IMPORTED_MODULE_3__.c)(swiper.params.scrollbar.dragClass)); 10888 if (!dragEl) { 10889 dragEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.c)('div', swiper.params.scrollbar.dragClass); 10890 el.append(dragEl); 10891 } 10892 } 10893 Object.assign(scrollbar, { 10894 el, 10895 dragEl 10896 }); 10897 if (params.draggable) { 10898 enableDraggable(); 10899 } 10900 if (el) { 10901 el.classList[swiper.enabled ? 'remove' : 'add'](...(0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.j)(swiper.params.scrollbar.lockClass)); 10902 } 10903 } 10904 function destroy() { 10905 const params = swiper.params.scrollbar; 10906 const el = swiper.scrollbar.el; 10907 if (el) { 10908 el.classList.remove(...(0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.j)(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass)); 10909 } 10910 disableDraggable(); 10911 } 10912 on('changeDirection', () => { 10913 if (!swiper.scrollbar || !swiper.scrollbar.el) return; 10914 const params = swiper.params.scrollbar; 10915 let { 10916 el 10917 } = swiper.scrollbar; 10918 el = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.m)(el); 10919 el.forEach(subEl => { 10920 subEl.classList.remove(params.horizontalClass, params.verticalClass); 10921 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 10922 }); 10923 }); 10924 on('init', () => { 10925 if (swiper.params.scrollbar.enabled === false) { 10926 // eslint-disable-next-line 10927 disable(); 10928 } else { 10929 init(); 10930 updateSize(); 10931 setTranslate(); 10932 } 10933 }); 10934 on('update resize observerUpdate lock unlock changeDirection', () => { 10935 updateSize(); 10936 }); 10937 on('setTranslate', () => { 10938 setTranslate(); 10939 }); 10940 on('setTransition', (_s, duration) => { 10941 setTransition(duration); 10942 }); 10943 on('enable disable', () => { 10944 const { 10945 el 10946 } = swiper.scrollbar; 10947 if (el) { 10948 el.classList[swiper.enabled ? 'remove' : 'add'](...(0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.j)(swiper.params.scrollbar.lockClass)); 10949 } 10950 }); 10951 on('destroy', () => { 10952 destroy(); 10953 }); 10954 const enable = () => { 10955 swiper.el.classList.remove(...(0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.j)(swiper.params.scrollbar.scrollbarDisabledClass)); 10956 if (swiper.scrollbar.el) { 10957 swiper.scrollbar.el.classList.remove(...(0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.j)(swiper.params.scrollbar.scrollbarDisabledClass)); 10958 } 10959 init(); 10960 updateSize(); 10961 setTranslate(); 10962 }; 10963 const disable = () => { 10964 swiper.el.classList.add(...(0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.j)(swiper.params.scrollbar.scrollbarDisabledClass)); 10965 if (swiper.scrollbar.el) { 10966 swiper.scrollbar.el.classList.add(...(0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.j)(swiper.params.scrollbar.scrollbarDisabledClass)); 10967 } 10968 destroy(); 10969 }; 10970 Object.assign(swiper.scrollbar, { 10971 enable, 10972 disable, 10973 updateSize, 10974 setTranslate, 10975 init, 10976 destroy 10977 }); 10978} 10979 10980 10981 10982 10983/***/ }), 10984
vendor: 8,213 bytes, lines 10985-11198
10985/***/ "./node_modules/swiper/modules/thumbs.mjs": 10986/*!************************************************!*\ 10987 !*** ./node_modules/swiper/modules/thumbs.mjs ***! 10988 \************************************************/ 10989/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 10990 10991"use strict"; 10992__webpack_require__.r(__webpack_exports__); 10993/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10994/* harmony export */ "default": function() { return /* binding */ Thumb; } 10995/* harmony export */ }); 10996/* harmony import */ var _shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 10997/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 10998 10999 11000 11001function Thumb(_ref) { 11002 let { 11003 swiper, 11004 extendParams, 11005 on 11006 } = _ref; 11007 extendParams({ 11008 thumbs: { 11009 swiper: null, 11010 multipleActiveThumbs: true, 11011 autoScrollOffset: 0, 11012 slideThumbActiveClass: 'swiper-slide-thumb-active', 11013 thumbsContainerClass: 'swiper-thumbs' 11014 } 11015 }); 11016 let initialized = false; 11017 let swiperCreated = false; 11018 swiper.thumbs = { 11019 swiper: null 11020 }; 11021 function onThumbClick() { 11022 const thumbsSwiper = swiper.thumbs.swiper; 11023 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 11024 const clickedIndex = thumbsSwiper.clickedIndex; 11025 const clickedSlide = thumbsSwiper.clickedSlide; 11026 if (clickedSlide && clickedSlide.classList.contains(swiper.params.thumbs.slideThumbActiveClass)) return; 11027 if (typeof clickedIndex === 'undefined' || clickedIndex === null) return; 11028 let slideToIndex; 11029 if (thumbsSwiper.params.loop) { 11030 slideToIndex = parseInt(thumbsSwiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10); 11031 } else { 11032 slideToIndex = clickedIndex; 11033 } 11034 if (swiper.params.loop) { 11035 swiper.slideToLoop(slideToIndex); 11036 } else { 11037 swiper.slideTo(slideToIndex); 11038 } 11039 } 11040 function init() { 11041 const { 11042 thumbs: thumbsParams 11043 } = swiper.params; 11044 if (initialized) return false; 11045 initialized = true; 11046 const SwiperClass = swiper.constructor; 11047 if (thumbsParams.swiper instanceof SwiperClass) { 11048 if (thumbsParams.swiper.destroyed) { 11049 initialized = false; 11050 return false; 11051 } 11052 swiper.thumbs.swiper = thumbsParams.swiper; 11053 Object.assign(swiper.thumbs.swiper.originalParams, { 11054 watchSlidesProgress: true, 11055 slideToClickedSlide: false 11056 }); 11057 Object.assign(swiper.thumbs.swiper.params, { 11058 watchSlidesProgress: true, 11059 slideToClickedSlide: false 11060 }); 11061 swiper.thumbs.swiper.update(); 11062 } else if ((0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.o)(thumbsParams.swiper)) { 11063 const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper); 11064 Object.assign(thumbsSwiperParams, { 11065 watchSlidesProgress: true, 11066 slideToClickedSlide: false 11067 }); 11068 swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams); 11069 swiperCreated = true; 11070 } 11071 swiper.thumbs.swiper.el.classList.add(swiper.params.thumbs.thumbsContainerClass); 11072 swiper.thumbs.swiper.on('tap', onThumbClick); 11073 return true; 11074 } 11075 function update(initial) { 11076 const thumbsSwiper = swiper.thumbs.swiper; 11077 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 11078 const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView; 11079 11080 // Activate thumbs 11081 let thumbsToActivate = 1; 11082 const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass; 11083 if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) { 11084 thumbsToActivate = swiper.params.slidesPerView; 11085 } 11086 if (!swiper.params.thumbs.multipleActiveThumbs) { 11087 thumbsToActivate = 1; 11088 } 11089 thumbsToActivate = Math.floor(thumbsToActivate); 11090 thumbsSwiper.slides.forEach(slideEl => slideEl.classList.remove(thumbActiveClass)); 11091 if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) { 11092 for (let i = 0; i < thumbsToActivate; i += 1) { 11093 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(thumbsSwiper.slidesEl, `[data-swiper-slide-index="${swiper.realIndex + i}"]`).forEach(slideEl => { 11094 slideEl.classList.add(thumbActiveClass); 11095 }); 11096 } 11097 } else { 11098 for (let i = 0; i < thumbsToActivate; i += 1) { 11099 if (thumbsSwiper.slides[swiper.realIndex + i]) { 11100 thumbsSwiper.slides[swiper.realIndex + i].classList.add(thumbActiveClass); 11101 } 11102 } 11103 } 11104 const autoScrollOffset = swiper.params.thumbs.autoScrollOffset; 11105 const useOffset = autoScrollOffset && !thumbsSwiper.params.loop; 11106 if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) { 11107 const currentThumbsIndex = thumbsSwiper.activeIndex; 11108 let newThumbsIndex; 11109 let direction; 11110 if (thumbsSwiper.params.loop) { 11111 const newThumbsSlide = thumbsSwiper.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') === `${swiper.realIndex}`); 11112 newThumbsIndex = thumbsSwiper.slides.indexOf(newThumbsSlide); 11113 direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev'; 11114 } else { 11115 newThumbsIndex = swiper.realIndex; 11116 direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev'; 11117 } 11118 if (useOffset) { 11119 newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset; 11120 } 11121 if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) { 11122 if (thumbsSwiper.params.centeredSlides) { 11123 if (newThumbsIndex > currentThumbsIndex) { 11124 newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1; 11125 } else { 11126 newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1; 11127 } 11128 } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ; 11129 thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined); 11130 } 11131 } 11132 } 11133 on('beforeInit', () => { 11134 const { 11135 thumbs 11136 } = swiper.params; 11137 if (!thumbs || !thumbs.swiper) return; 11138 if (typeof thumbs.swiper === 'string' || thumbs.swiper instanceof HTMLElement) { 11139 const document = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 11140 const getThumbsElementAndInit = () => { 11141 const thumbsElement = typeof thumbs.swiper === 'string' ? document.querySelector(thumbs.swiper) : thumbs.swiper; 11142 if (thumbsElement && thumbsElement.swiper) { 11143 thumbs.swiper = thumbsElement.swiper; 11144 init(); 11145 update(true); 11146 } else if (thumbsElement) { 11147 const eventName = `${swiper.params.eventsPrefix}init`; 11148 const onThumbsSwiper = e => { 11149 thumbs.swiper = e.detail[0]; 11150 thumbsElement.removeEventListener(eventName, onThumbsSwiper); 11151 init(); 11152 update(true); 11153 thumbs.swiper.update(); 11154 swiper.update(); 11155 }; 11156 thumbsElement.addEventListener(eventName, onThumbsSwiper); 11157 } 11158 return thumbsElement; 11159 }; 11160 const watchForThumbsToAppear = () => { 11161 if (swiper.destroyed) return; 11162 const thumbsElement = getThumbsElementAndInit(); 11163 if (!thumbsElement) { 11164 requestAnimationFrame(watchForThumbsToAppear); 11165 } 11166 }; 11167 requestAnimationFrame(watchForThumbsToAppear); 11168 } else { 11169 init(); 11170 update(true); 11171 } 11172 }); 11173 on('slideChange update resize observerUpdate', () => { 11174 update(); 11175 }); 11176 on('setTransition', (_s, duration) => { 11177 const thumbsSwiper = swiper.thumbs.swiper; 11178 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 11179 thumbsSwiper.setTransition(duration); 11180 }); 11181 on('beforeDestroy', () => { 11182 const thumbsSwiper = swiper.thumbs.swiper; 11183 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 11184 if (swiperCreated) { 11185 thumbsSwiper.destroy(); 11186 } 11187 }); 11188 Object.assign(swiper.thumbs, { 11189 init, 11190 update 11191 }); 11192} 11193 11194 11195 11196 11197/***/ }), 11198
vendor: 12,588 bytes, lines 11199-11564
11199/***/ "./node_modules/swiper/modules/virtual.mjs": 11200/*!*************************************************!*\ 11201 !*** ./node_modules/swiper/modules/virtual.mjs ***! 11202 \*************************************************/ 11203/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 11204 11205"use strict"; 11206__webpack_require__.r(__webpack_exports__); 11207/* harmony export */ __webpack_require__.d(__webpack_exports__, { 11208/* harmony export */ "default": function() { return /* binding */ Virtual; } 11209/* harmony export */ }); 11210/* harmony import */ var _shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 11211/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 11212 11213 11214 11215function Virtual(_ref) { 11216 let { 11217 swiper, 11218 extendParams, 11219 on, 11220 emit 11221 } = _ref; 11222 extendParams({ 11223 virtual: { 11224 enabled: false, 11225 slides: [], 11226 cache: true, 11227 renderSlide: null, 11228 renderExternal: null, 11229 renderExternalUpdate: true, 11230 addSlidesBefore: 0, 11231 addSlidesAfter: 0 11232 } 11233 }); 11234 let cssModeTimeout; 11235 const document = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 11236 swiper.virtual = { 11237 cache: {}, 11238 from: undefined, 11239 to: undefined, 11240 slides: [], 11241 offset: 0, 11242 slidesGrid: [] 11243 }; 11244 const tempDOM = document.createElement('div'); 11245 function renderSlide(slide, index) { 11246 const params = swiper.params.virtual; 11247 if (params.cache && swiper.virtual.cache[index]) { 11248 return swiper.virtual.cache[index]; 11249 } 11250 // eslint-disable-next-line 11251 let slideEl; 11252 if (params.renderSlide) { 11253 slideEl = params.renderSlide.call(swiper, slide, index); 11254 if (typeof slideEl === 'string') { 11255 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.s)(tempDOM, slideEl); 11256 slideEl = tempDOM.children[0]; 11257 } 11258 } else if (swiper.isElement) { 11259 slideEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.c)('swiper-slide'); 11260 } else { 11261 slideEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.c)('div', swiper.params.slideClass); 11262 } 11263 slideEl.setAttribute('data-swiper-slide-index', index); 11264 if (!params.renderSlide) { 11265 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.s)(slideEl, slide); 11266 } 11267 if (params.cache) { 11268 swiper.virtual.cache[index] = slideEl; 11269 } 11270 return slideEl; 11271 } 11272 function update(force, beforeInit, forceActiveIndex) { 11273 const { 11274 slidesPerView, 11275 slidesPerGroup, 11276 centeredSlides, 11277 loop: isLoop, 11278 initialSlide 11279 } = swiper.params; 11280 if (beforeInit && !isLoop && initialSlide > 0) { 11281 return; 11282 } 11283 const { 11284 addSlidesBefore, 11285 addSlidesAfter 11286 } = swiper.params.virtual; 11287 const { 11288 from: previousFrom, 11289 to: previousTo, 11290 slides, 11291 slidesGrid: previousSlidesGrid, 11292 offset: previousOffset 11293 } = swiper.virtual; 11294 if (!swiper.params.cssMode) { 11295 swiper.updateActiveIndex(); 11296 } 11297 const activeIndex = typeof forceActiveIndex === 'undefined' ? swiper.activeIndex || 0 : forceActiveIndex; 11298 let offsetProp; 11299 if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top'; 11300 let slidesAfter; 11301 let slidesBefore; 11302 if (centeredSlides) { 11303 slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter; 11304 slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore; 11305 } else { 11306 slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter; 11307 slidesBefore = (isLoop ? slidesPerView : slidesPerGroup) + addSlidesBefore; 11308 } 11309 let from = activeIndex - slidesBefore; 11310 let to = activeIndex + slidesAfter; 11311 if (!isLoop) { 11312 from = Math.max(from, 0); 11313 to = Math.min(to, slides.length - 1); 11314 } 11315 let offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0); 11316 if (isLoop && activeIndex >= slidesBefore) { 11317 from -= slidesBefore; 11318 if (!centeredSlides) offset += swiper.slidesGrid[0]; 11319 } else if (isLoop && activeIndex < slidesBefore) { 11320 from = -slidesBefore; 11321 if (centeredSlides) offset += swiper.slidesGrid[0]; 11322 } 11323 Object.assign(swiper.virtual, { 11324 from, 11325 to, 11326 offset, 11327 slidesGrid: swiper.slidesGrid, 11328 slidesBefore, 11329 slidesAfter 11330 }); 11331 function onRendered() { 11332 swiper.updateSlides(); 11333 swiper.updateProgress(); 11334 swiper.updateSlidesClasses(); 11335 emit('virtualUpdate'); 11336 } 11337 if (previousFrom === from && previousTo === to && !force) { 11338 if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) { 11339 swiper.slides.forEach(slideEl => { 11340 slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`; 11341 }); 11342 } 11343 swiper.updateProgress(); 11344 emit('virtualUpdate'); 11345 return; 11346 } 11347 if (swiper.params.virtual.renderExternal) { 11348 swiper.params.virtual.renderExternal.call(swiper, { 11349 offset, 11350 from, 11351 to, 11352 slides: function getSlides() { 11353 const slidesToRender = []; 11354 for (let i = from; i <= to; i += 1) { 11355 slidesToRender.push(slides[i]); 11356 } 11357 return slidesToRender; 11358 }() 11359 }); 11360 if (swiper.params.virtual.renderExternalUpdate) { 11361 onRendered(); 11362 } else { 11363 emit('virtualUpdate'); 11364 } 11365 return; 11366 } 11367 const prependIndexes = []; 11368 const appendIndexes = []; 11369 const getSlideIndex = index => { 11370 let slideIndex = index; 11371 if (index < 0) { 11372 slideIndex = slides.length + index; 11373 } else if (slideIndex >= slides.length) { 11374 // eslint-disable-next-line 11375 slideIndex = slideIndex - slides.length; 11376 } 11377 return slideIndex; 11378 }; 11379 if (force) { 11380 swiper.slides.filter(el => el.matches(`.${swiper.params.slideClass}, swiper-slide`)).forEach(slideEl => { 11381 slideEl.remove(); 11382 }); 11383 } else { 11384 for (let i = previousFrom; i <= previousTo; i += 1) { 11385 if (i < from || i > to) { 11386 const slideIndex = getSlideIndex(i); 11387 swiper.slides.filter(el => el.matches(`.${swiper.params.slideClass}[data-swiper-slide-index="${slideIndex}"], swiper-slide[data-swiper-slide-index="${slideIndex}"]`)).forEach(slideEl => { 11388 slideEl.remove(); 11389 }); 11390 } 11391 } 11392 } 11393 const loopFrom = isLoop ? -slides.length : 0; 11394 const loopTo = isLoop ? slides.length * 2 : slides.length; 11395 for (let i = loopFrom; i < loopTo; i += 1) { 11396 if (i >= from && i <= to) { 11397 const slideIndex = getSlideIndex(i); 11398 if (typeof previousTo === 'undefined' || force) { 11399 appendIndexes.push(slideIndex); 11400 } else { 11401 if (i > previousTo) appendIndexes.push(slideIndex); 11402 if (i < previousFrom) prependIndexes.push(slideIndex); 11403 } 11404 } 11405 } 11406 appendIndexes.forEach(index => { 11407 swiper.slidesEl.append(renderSlide(slides[index], index)); 11408 }); 11409 if (isLoop) { 11410 for (let i = prependIndexes.length - 1; i >= 0; i -= 1) { 11411 const index = prependIndexes[i]; 11412 swiper.slidesEl.prepend(renderSlide(slides[index], index)); 11413 } 11414 } else { 11415 prependIndexes.sort((a, b) => b - a); 11416 prependIndexes.forEach(index => { 11417 swiper.slidesEl.prepend(renderSlide(slides[index], index)); 11418 }); 11419 } 11420 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(swiper.slidesEl, '.swiper-slide, swiper-slide').forEach(slideEl => { 11421 slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`; 11422 }); 11423 onRendered(); 11424 } 11425 function appendSlide(slides) { 11426 if (typeof slides === 'object' && 'length' in slides) { 11427 for (let i = 0; i < slides.length; i += 1) { 11428 if (slides[i]) swiper.virtual.slides.push(slides[i]); 11429 } 11430 } else { 11431 swiper.virtual.slides.push(slides); 11432 } 11433 update(true); 11434 } 11435 function prependSlide(slides) { 11436 const activeIndex = swiper.activeIndex; 11437 let newActiveIndex = activeIndex + 1; 11438 let numberOfNewSlides = 1; 11439 if (Array.isArray(slides)) { 11440 for (let i = 0; i < slides.length; i += 1) { 11441 if (slides[i]) swiper.virtual.slides.unshift(slides[i]); 11442 } 11443 newActiveIndex = activeIndex + slides.length; 11444 numberOfNewSlides = slides.length; 11445 } else { 11446 swiper.virtual.slides.unshift(slides); 11447 } 11448 if (swiper.params.virtual.cache) { 11449 const cache = swiper.virtual.cache; 11450 const newCache = {}; 11451 Object.keys(cache).forEach(cachedIndex => { 11452 const cachedEl = cache[cachedIndex]; 11453 const cachedElIndex = cachedEl.getAttribute('data-swiper-slide-index'); 11454 if (cachedElIndex) { 11455 cachedEl.setAttribute('data-swiper-slide-index', parseInt(cachedElIndex, 10) + numberOfNewSlides); 11456 } 11457 newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = cachedEl; 11458 }); 11459 swiper.virtual.cache = newCache; 11460 } 11461 update(true); 11462 swiper.slideTo(newActiveIndex, 0); 11463 } 11464 function removeSlide(slidesIndexes) { 11465 if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return; 11466 let activeIndex = swiper.activeIndex; 11467 if (Array.isArray(slidesIndexes)) { 11468 for (let i = slidesIndexes.length - 1; i >= 0; i -= 1) { 11469 if (swiper.params.virtual.cache) { 11470 delete swiper.virtual.cache[slidesIndexes[i]]; 11471 // shift cache indexes 11472 Object.keys(swiper.virtual.cache).forEach(key => { 11473 if (key > slidesIndexes) { 11474 swiper.virtual.cache[key - 1] = swiper.virtual.cache[key]; 11475 swiper.virtual.cache[key - 1].setAttribute('data-swiper-slide-index', key - 1); 11476 delete swiper.virtual.cache[key]; 11477 } 11478 }); 11479 } 11480 swiper.virtual.slides.splice(slidesIndexes[i], 1); 11481 if (slidesIndexes[i] < activeIndex) activeIndex -= 1; 11482 activeIndex = Math.max(activeIndex, 0); 11483 } 11484 } else { 11485 if (swiper.params.virtual.cache) { 11486 delete swiper.virtual.cache[slidesIndexes]; 11487 // shift cache indexes 11488 Object.keys(swiper.virtual.cache).forEach(key => { 11489 if (key > slidesIndexes) { 11490 swiper.virtual.cache[key - 1] = swiper.virtual.cache[key]; 11491 swiper.virtual.cache[key - 1].setAttribute('data-swiper-slide-index', key - 1); 11492 delete swiper.virtual.cache[key]; 11493 } 11494 }); 11495 } 11496 swiper.virtual.slides.splice(slidesIndexes, 1); 11497 if (slidesIndexes < activeIndex) activeIndex -= 1; 11498 activeIndex = Math.max(activeIndex, 0); 11499 } 11500 update(true); 11501 swiper.slideTo(activeIndex, 0); 11502 } 11503 function removeAllSlides() { 11504 swiper.virtual.slides = []; 11505 if (swiper.params.virtual.cache) { 11506 swiper.virtual.cache = {}; 11507 } 11508 update(true); 11509 swiper.slideTo(0, 0); 11510 } 11511 on('beforeInit', () => { 11512 if (!swiper.params.virtual.enabled) return; 11513 let domSlidesAssigned; 11514 if (typeof swiper.passedParams.virtual.slides === 'undefined') { 11515 const slides = [...swiper.slidesEl.children].filter(el => el.matches(`.${swiper.params.slideClass}, swiper-slide`)); 11516 if (slides && slides.length) { 11517 swiper.virtual.slides = [...slides]; 11518 domSlidesAssigned = true; 11519 slides.forEach((slideEl, slideIndex) => { 11520 slideEl.setAttribute('data-swiper-slide-index', slideIndex); 11521 swiper.virtual.cache[slideIndex] = slideEl; 11522 slideEl.remove(); 11523 }); 11524 } 11525 } 11526 if (!domSlidesAssigned) { 11527 swiper.virtual.slides = swiper.params.virtual.slides; 11528 } 11529 swiper.classNames.push(`${swiper.params.containerModifierClass}virtual`); 11530 swiper.params.watchSlidesProgress = true; 11531 swiper.originalParams.watchSlidesProgress = true; 11532 update(false, true); 11533 }); 11534 on('setTranslate', () => { 11535 if (!swiper.params.virtual.enabled) return; 11536 if (swiper.params.cssMode && !swiper._immediateVirtual) { 11537 clearTimeout(cssModeTimeout); 11538 cssModeTimeout = setTimeout(() => { 11539 update(); 11540 }, 100); 11541 } else { 11542 update(); 11543 } 11544 }); 11545 on('init update resize', () => { 11546 if (!swiper.params.virtual.enabled) return; 11547 if (swiper.params.cssMode) { 11548 (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.a)(swiper.wrapperEl, '--swiper-virtual-size', `${swiper.virtualSize}px`); 11549 } 11550 }); 11551 Object.assign(swiper.virtual, { 11552 appendSlide, 11553 prependSlide, 11554 removeSlide, 11555 removeAllSlides, 11556 update 11557 }); 11558} 11559 11560 11561 11562 11563/***/ }), 11564
vendor: 26,521 bytes, lines 11565-12282
11565/***/ "./node_modules/swiper/modules/zoom.mjs": 11566/*!**********************************************!*\ 11567 !*** ./node_modules/swiper/modules/zoom.mjs ***! 11568 \**********************************************/ 11569/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 11570 11571"use strict"; 11572__webpack_require__.r(__webpack_exports__); 11573/* harmony export */ __webpack_require__.d(__webpack_exports__, { 11574/* harmony export */ "default": function() { return /* binding */ Zoom; } 11575/* harmony export */ }); 11576/* harmony import */ var _shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 11577/* harmony import */ var _shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 11578 11579 11580 11581function Zoom(_ref) { 11582 let { 11583 swiper, 11584 extendParams, 11585 on, 11586 emit 11587 } = _ref; 11588 const window = (0,_shared_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 11589 extendParams({ 11590 zoom: { 11591 enabled: false, 11592 limitToOriginalSize: false, 11593 maxRatio: 3, 11594 minRatio: 1, 11595 panOnMouseMove: false, 11596 toggle: true, 11597 containerClass: 'swiper-zoom-container', 11598 zoomedSlideClass: 'swiper-slide-zoomed' 11599 } 11600 }); 11601 swiper.zoom = { 11602 enabled: false 11603 }; 11604 let currentScale = 1; 11605 let isScaling = false; 11606 let isPanningWithMouse = false; 11607 let mousePanStart = { 11608 x: 0, 11609 y: 0 11610 }; 11611 const mousePanSensitivity = -3; // Negative to invert pan direction 11612 let fakeGestureTouched; 11613 let fakeGestureMoved; 11614 const evCache = []; 11615 const gesture = { 11616 originX: 0, 11617 originY: 0, 11618 slideEl: undefined, 11619 slideWidth: undefined, 11620 slideHeight: undefined, 11621 imageEl: undefined, 11622 imageWrapEl: undefined, 11623 maxRatio: 3 11624 }; 11625 const image = { 11626 isTouched: undefined, 11627 isMoved: undefined, 11628 currentX: undefined, 11629 currentY: undefined, 11630 minX: undefined, 11631 minY: undefined, 11632 maxX: undefined, 11633 maxY: undefined, 11634 width: undefined, 11635 height: undefined, 11636 startX: undefined, 11637 startY: undefined, 11638 touchesStart: {}, 11639 touchesCurrent: {} 11640 }; 11641 const velocity = { 11642 x: undefined, 11643 y: undefined, 11644 prevPositionX: undefined, 11645 prevPositionY: undefined, 11646 prevTime: undefined 11647 }; 11648 let scale = 1; 11649 Object.defineProperty(swiper.zoom, 'scale', { 11650 get() { 11651 return scale; 11652 }, 11653 set(value) { 11654 if (scale !== value) { 11655 const imageEl = gesture.imageEl; 11656 const slideEl = gesture.slideEl; 11657 emit('zoomChange', value, imageEl, slideEl); 11658 } 11659 scale = value; 11660 } 11661 }); 11662 function getDistanceBetweenTouches() { 11663 if (evCache.length < 2) return 1; 11664 const x1 = evCache[0].pageX; 11665 const y1 = evCache[0].pageY; 11666 const x2 = evCache[1].pageX; 11667 const y2 = evCache[1].pageY; 11668 const distance = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2); 11669 return distance; 11670 } 11671 function getMaxRatio() { 11672 const params = swiper.params.zoom; 11673 const maxRatio = gesture.imageWrapEl.getAttribute('data-swiper-zoom') || params.maxRatio; 11674 if (params.limitToOriginalSize && gesture.imageEl && gesture.imageEl.naturalWidth) { 11675 const imageMaxRatio = gesture.imageEl.naturalWidth / gesture.imageEl.offsetWidth; 11676 return Math.min(imageMaxRatio, maxRatio); 11677 } 11678 return maxRatio; 11679 } 11680 function getScaleOrigin() { 11681 if (evCache.length < 2) return { 11682 x: null, 11683 y: null 11684 }; 11685 const box = gesture.imageEl.getBoundingClientRect(); 11686 return [(evCache[0].pageX + (evCache[1].pageX - evCache[0].pageX) / 2 - box.x - window.scrollX) / currentScale, (evCache[0].pageY + (evCache[1].pageY - evCache[0].pageY) / 2 - box.y - window.scrollY) / currentScale]; 11687 } 11688 function getSlideSelector() { 11689 return swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`; 11690 } 11691 function eventWithinSlide(e) { 11692 const slideSelector = getSlideSelector(); 11693 if (e.target.matches(slideSelector)) return true; 11694 if (swiper.slides.filter(slideEl => slideEl.contains(e.target)).length > 0) return true; 11695 return false; 11696 } 11697 function eventWithinZoomContainer(e) { 11698 const selector = `.${swiper.params.zoom.containerClass}`; 11699 if (e.target.matches(selector)) return true; 11700 if ([...swiper.hostEl.querySelectorAll(selector)].filter(containerEl => containerEl.contains(e.target)).length > 0) return true; 11701 return false; 11702 } 11703 11704 // Events 11705 function onGestureStart(e) { 11706 if (e.pointerType === 'mouse') { 11707 evCache.splice(0, evCache.length); 11708 } 11709 if (!eventWithinSlide(e)) return; 11710 const params = swiper.params.zoom; 11711 fakeGestureTouched = false; 11712 fakeGestureMoved = false; 11713 evCache.push(e); 11714 if (evCache.length < 2) { 11715 return; 11716 } 11717 fakeGestureTouched = true; 11718 gesture.scaleStart = getDistanceBetweenTouches(); 11719 if (!gesture.slideEl) { 11720 gesture.slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`); 11721 if (!gesture.slideEl) gesture.slideEl = swiper.slides[swiper.activeIndex]; 11722 let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`); 11723 if (imageEl) { 11724 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 11725 } 11726 gesture.imageEl = imageEl; 11727 if (imageEl) { 11728 gesture.imageWrapEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.b)(gesture.imageEl, `.${params.containerClass}`)[0]; 11729 } else { 11730 gesture.imageWrapEl = undefined; 11731 } 11732 if (!gesture.imageWrapEl) { 11733 gesture.imageEl = undefined; 11734 return; 11735 } 11736 gesture.maxRatio = getMaxRatio(); 11737 } 11738 if (gesture.imageEl) { 11739 const [originX, originY] = getScaleOrigin(); 11740 gesture.originX = originX; 11741 gesture.originY = originY; 11742 gesture.imageEl.style.transitionDuration = '0ms'; 11743 } 11744 isScaling = true; 11745 } 11746 function onGestureChange(e) { 11747 if (!eventWithinSlide(e)) return; 11748 const params = swiper.params.zoom; 11749 const zoom = swiper.zoom; 11750 const pointerIndex = evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId); 11751 if (pointerIndex >= 0) evCache[pointerIndex] = e; 11752 if (evCache.length < 2) { 11753 return; 11754 } 11755 fakeGestureMoved = true; 11756 gesture.scaleMove = getDistanceBetweenTouches(); 11757 if (!gesture.imageEl) { 11758 return; 11759 } 11760 zoom.scale = gesture.scaleMove / gesture.scaleStart * currentScale; 11761 if (zoom.scale > gesture.maxRatio) { 11762 zoom.scale = gesture.maxRatio - 1 + (zoom.scale - gesture.maxRatio + 1) ** 0.5; 11763 } 11764 if (zoom.scale < params.minRatio) { 11765 zoom.scale = params.minRatio + 1 - (params.minRatio - zoom.scale + 1) ** 0.5; 11766 } 11767 gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`; 11768 } 11769 function onGestureEnd(e) { 11770 if (!eventWithinSlide(e)) return; 11771 if (e.pointerType === 'mouse' && e.type === 'pointerout') return; 11772 const params = swiper.params.zoom; 11773 const zoom = swiper.zoom; 11774 const pointerIndex = evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId); 11775 if (pointerIndex >= 0) evCache.splice(pointerIndex, 1); 11776 if (!fakeGestureTouched || !fakeGestureMoved) { 11777 return; 11778 } 11779 fakeGestureTouched = false; 11780 fakeGestureMoved = false; 11781 if (!gesture.imageEl) return; 11782 zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio); 11783 gesture.imageEl.style.transitionDuration = `${swiper.params.speed}ms`; 11784 gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`; 11785 currentScale = zoom.scale; 11786 isScaling = false; 11787 if (zoom.scale > 1 && gesture.slideEl) { 11788 gesture.slideEl.classList.add(`${params.zoomedSlideClass}`); 11789 } else if (zoom.scale <= 1 && gesture.slideEl) { 11790 gesture.slideEl.classList.remove(`${params.zoomedSlideClass}`); 11791 } 11792 if (zoom.scale === 1) { 11793 gesture.originX = 0; 11794 gesture.originY = 0; 11795 gesture.slideEl = undefined; 11796 } 11797 } 11798 let allowTouchMoveTimeout; 11799 function allowTouchMove() { 11800 swiper.touchEventsData.preventTouchMoveFromPointerMove = false; 11801 } 11802 function preventTouchMove() { 11803 clearTimeout(allowTouchMoveTimeout); 11804 swiper.touchEventsData.preventTouchMoveFromPointerMove = true; 11805 allowTouchMoveTimeout = setTimeout(() => { 11806 if (swiper.destroyed) return; 11807 allowTouchMove(); 11808 }); 11809 } 11810 function onTouchStart(e) { 11811 const device = swiper.device; 11812 if (!gesture.imageEl) return; 11813 if (image.isTouched) return; 11814 if (device.android && e.cancelable) e.preventDefault(); 11815 image.isTouched = true; 11816 const event = evCache.length > 0 ? evCache[0] : e; 11817 image.touchesStart.x = event.pageX; 11818 image.touchesStart.y = event.pageY; 11819 } 11820 function onTouchMove(e) { 11821 const isMouseEvent = e.pointerType === 'mouse'; 11822 const isMousePan = isMouseEvent && swiper.params.zoom.panOnMouseMove; 11823 if (!eventWithinSlide(e) || !eventWithinZoomContainer(e)) { 11824 return; 11825 } 11826 const zoom = swiper.zoom; 11827 if (!gesture.imageEl) { 11828 return; 11829 } 11830 if (!image.isTouched || !gesture.slideEl) { 11831 if (isMousePan) onMouseMove(e); 11832 return; 11833 } 11834 if (isMousePan) { 11835 onMouseMove(e); 11836 return; 11837 } 11838 if (!image.isMoved) { 11839 image.width = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 11840 image.height = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 11841 image.startX = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.k)(gesture.imageWrapEl, 'x') || 0; 11842 image.startY = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.k)(gesture.imageWrapEl, 'y') || 0; 11843 gesture.slideWidth = gesture.slideEl.offsetWidth; 11844 gesture.slideHeight = gesture.slideEl.offsetHeight; 11845 gesture.imageWrapEl.style.transitionDuration = '0ms'; 11846 } 11847 // Define if we need image drag 11848 const scaledWidth = image.width * zoom.scale; 11849 const scaledHeight = image.height * zoom.scale; 11850 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 11851 image.maxX = -image.minX; 11852 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 11853 image.maxY = -image.minY; 11854 image.touchesCurrent.x = evCache.length > 0 ? evCache[0].pageX : e.pageX; 11855 image.touchesCurrent.y = evCache.length > 0 ? evCache[0].pageY : e.pageY; 11856 const touchesDiff = Math.max(Math.abs(image.touchesCurrent.x - image.touchesStart.x), Math.abs(image.touchesCurrent.y - image.touchesStart.y)); 11857 if (touchesDiff > 5) { 11858 swiper.allowClick = false; 11859 } 11860 if (!image.isMoved && !isScaling) { 11861 if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) { 11862 image.isTouched = false; 11863 allowTouchMove(); 11864 return; 11865 } 11866 if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) { 11867 image.isTouched = false; 11868 allowTouchMove(); 11869 return; 11870 } 11871 } 11872 if (e.cancelable) { 11873 e.preventDefault(); 11874 } 11875 e.stopPropagation(); 11876 preventTouchMove(); 11877 image.isMoved = true; 11878 const scaleRatio = (zoom.scale - currentScale) / (gesture.maxRatio - swiper.params.zoom.minRatio); 11879 const { 11880 originX, 11881 originY 11882 } = gesture; 11883 image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX + scaleRatio * (image.width - originX * 2); 11884 image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY + scaleRatio * (image.height - originY * 2); 11885 if (image.currentX < image.minX) { 11886 image.currentX = image.minX + 1 - (image.minX - image.currentX + 1) ** 0.8; 11887 } 11888 if (image.currentX > image.maxX) { 11889 image.currentX = image.maxX - 1 + (image.currentX - image.maxX + 1) ** 0.8; 11890 } 11891 if (image.currentY < image.minY) { 11892 image.currentY = image.minY + 1 - (image.minY - image.currentY + 1) ** 0.8; 11893 } 11894 if (image.currentY > image.maxY) { 11895 image.currentY = image.maxY - 1 + (image.currentY - image.maxY + 1) ** 0.8; 11896 } 11897 11898 // Velocity 11899 if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x; 11900 if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y; 11901 if (!velocity.prevTime) velocity.prevTime = Date.now(); 11902 velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2; 11903 velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2; 11904 if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0; 11905 if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0; 11906 velocity.prevPositionX = image.touchesCurrent.x; 11907 velocity.prevPositionY = image.touchesCurrent.y; 11908 velocity.prevTime = Date.now(); 11909 gesture.imageWrapEl.style.transform = `translate3d(${image.currentX}px, ${image.currentY}px,0)`; 11910 } 11911 function onTouchEnd() { 11912 const zoom = swiper.zoom; 11913 evCache.length = 0; 11914 if (!gesture.imageEl) return; 11915 if (!image.isTouched || !image.isMoved) { 11916 image.isTouched = false; 11917 image.isMoved = false; 11918 return; 11919 } 11920 image.isTouched = false; 11921 image.isMoved = false; 11922 let momentumDurationX = 300; 11923 let momentumDurationY = 300; 11924 const momentumDistanceX = velocity.x * momentumDurationX; 11925 const newPositionX = image.currentX + momentumDistanceX; 11926 const momentumDistanceY = velocity.y * momentumDurationY; 11927 const newPositionY = image.currentY + momentumDistanceY; 11928 11929 // Fix duration 11930 if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x); 11931 if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y); 11932 const momentumDuration = Math.max(momentumDurationX, momentumDurationY); 11933 image.currentX = newPositionX; 11934 image.currentY = newPositionY; 11935 // Define if we need image drag 11936 const scaledWidth = image.width * zoom.scale; 11937 const scaledHeight = image.height * zoom.scale; 11938 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 11939 image.maxX = -image.minX; 11940 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 11941 image.maxY = -image.minY; 11942 image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX); 11943 image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY); 11944 gesture.imageWrapEl.style.transitionDuration = `${momentumDuration}ms`; 11945 gesture.imageWrapEl.style.transform = `translate3d(${image.currentX}px, ${image.currentY}px,0)`; 11946 } 11947 function onTransitionEnd() { 11948 const zoom = swiper.zoom; 11949 if (gesture.slideEl && swiper.activeIndex !== swiper.slides.indexOf(gesture.slideEl)) { 11950 if (gesture.imageEl) { 11951 gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)'; 11952 } 11953 if (gesture.imageWrapEl) { 11954 gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)'; 11955 } 11956 gesture.slideEl.classList.remove(`${swiper.params.zoom.zoomedSlideClass}`); 11957 zoom.scale = 1; 11958 currentScale = 1; 11959 gesture.slideEl = undefined; 11960 gesture.imageEl = undefined; 11961 gesture.imageWrapEl = undefined; 11962 gesture.originX = 0; 11963 gesture.originY = 0; 11964 } 11965 } 11966 function onMouseMove(e) { 11967 // Only pan if zoomed in and mouse panning is enabled 11968 if (currentScale <= 1 || !gesture.imageWrapEl) return; 11969 if (!eventWithinSlide(e) || !eventWithinZoomContainer(e)) return; 11970 const currentTransform = window.getComputedStyle(gesture.imageWrapEl).transform; 11971 const matrix = new window.DOMMatrix(currentTransform); 11972 if (!isPanningWithMouse) { 11973 isPanningWithMouse = true; 11974 mousePanStart.x = e.clientX; 11975 mousePanStart.y = e.clientY; 11976 image.startX = matrix.e; 11977 image.startY = matrix.f; 11978 image.width = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 11979 image.height = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 11980 gesture.slideWidth = gesture.slideEl.offsetWidth; 11981 gesture.slideHeight = gesture.slideEl.offsetHeight; 11982 return; 11983 } 11984 const deltaX = (e.clientX - mousePanStart.x) * mousePanSensitivity; 11985 const deltaY = (e.clientY - mousePanStart.y) * mousePanSensitivity; 11986 const scaledWidth = image.width * currentScale; 11987 const scaledHeight = image.height * currentScale; 11988 const slideWidth = gesture.slideWidth; 11989 const slideHeight = gesture.slideHeight; 11990 const minX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); 11991 const maxX = -minX; 11992 const minY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); 11993 const maxY = -minY; 11994 const newX = Math.max(Math.min(image.startX + deltaX, maxX), minX); 11995 const newY = Math.max(Math.min(image.startY + deltaY, maxY), minY); 11996 gesture.imageWrapEl.style.transitionDuration = '0ms'; 11997 gesture.imageWrapEl.style.transform = `translate3d(${newX}px, ${newY}px, 0)`; 11998 mousePanStart.x = e.clientX; 11999 mousePanStart.y = e.clientY; 12000 image.startX = newX; 12001 image.startY = newY; 12002 image.currentX = newX; 12003 image.currentY = newY; 12004 } 12005 function zoomIn(e) { 12006 const zoom = swiper.zoom; 12007 const params = swiper.params.zoom; 12008 if (!gesture.slideEl) { 12009 if (e && e.target) { 12010 gesture.slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`); 12011 } 12012 if (!gesture.slideEl) { 12013 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { 12014 gesture.slideEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(swiper.slidesEl, `.${swiper.params.slideActiveClass}`)[0]; 12015 } else { 12016 gesture.slideEl = swiper.slides[swiper.activeIndex]; 12017 } 12018 } 12019 let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`); 12020 if (imageEl) { 12021 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 12022 } 12023 gesture.imageEl = imageEl; 12024 if (imageEl) { 12025 gesture.imageWrapEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.b)(gesture.imageEl, `.${params.containerClass}`)[0]; 12026 } else { 12027 gesture.imageWrapEl = undefined; 12028 } 12029 } 12030 if (!gesture.imageEl || !gesture.imageWrapEl) return; 12031 if (swiper.params.cssMode) { 12032 swiper.wrapperEl.style.overflow = 'hidden'; 12033 swiper.wrapperEl.style.touchAction = 'none'; 12034 } 12035 gesture.slideEl.classList.add(`${params.zoomedSlideClass}`); 12036 let touchX; 12037 let touchY; 12038 let offsetX; 12039 let offsetY; 12040 let diffX; 12041 let diffY; 12042 let translateX; 12043 let translateY; 12044 let imageWidth; 12045 let imageHeight; 12046 let scaledWidth; 12047 let scaledHeight; 12048 let translateMinX; 12049 let translateMinY; 12050 let translateMaxX; 12051 let translateMaxY; 12052 let slideWidth; 12053 let slideHeight; 12054 if (typeof image.touchesStart.x === 'undefined' && e) { 12055 touchX = e.pageX; 12056 touchY = e.pageY; 12057 } else { 12058 touchX = image.touchesStart.x; 12059 touchY = image.touchesStart.y; 12060 } 12061 const prevScale = currentScale; 12062 const forceZoomRatio = typeof e === 'number' ? e : null; 12063 if (currentScale === 1 && forceZoomRatio) { 12064 touchX = undefined; 12065 touchY = undefined; 12066 image.touchesStart.x = undefined; 12067 image.touchesStart.y = undefined; 12068 } 12069 const maxRatio = getMaxRatio(); 12070 zoom.scale = forceZoomRatio || maxRatio; 12071 currentScale = forceZoomRatio || maxRatio; 12072 if (e && !(currentScale === 1 && forceZoomRatio)) { 12073 slideWidth = gesture.slideEl.offsetWidth; 12074 slideHeight = gesture.slideEl.offsetHeight; 12075 offsetX = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.d)(gesture.slideEl).left + window.scrollX; 12076 offsetY = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.d)(gesture.slideEl).top + window.scrollY; 12077 diffX = offsetX + slideWidth / 2 - touchX; 12078 diffY = offsetY + slideHeight / 2 - touchY; 12079 imageWidth = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 12080 imageHeight = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 12081 scaledWidth = imageWidth * zoom.scale; 12082 scaledHeight = imageHeight * zoom.scale; 12083 translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); 12084 translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); 12085 translateMaxX = -translateMinX; 12086 translateMaxY = -translateMinY; 12087 if (prevScale > 0 && forceZoomRatio && typeof image.currentX === 'number' && typeof image.currentY === 'number') { 12088 translateX = image.currentX * zoom.scale / prevScale; 12089 translateY = image.currentY * zoom.scale / prevScale; 12090 } else { 12091 translateX = diffX * zoom.scale; 12092 translateY = diffY * zoom.scale; 12093 } 12094 if (translateX < translateMinX) { 12095 translateX = translateMinX; 12096 } 12097 if (translateX > translateMaxX) { 12098 translateX = translateMaxX; 12099 } 12100 if (translateY < translateMinY) { 12101 translateY = translateMinY; 12102 } 12103 if (translateY > translateMaxY) { 12104 translateY = translateMaxY; 12105 } 12106 } else { 12107 translateX = 0; 12108 translateY = 0; 12109 } 12110 if (forceZoomRatio && zoom.scale === 1) { 12111 gesture.originX = 0; 12112 gesture.originY = 0; 12113 } 12114 image.currentX = translateX; 12115 image.currentY = translateY; 12116 gesture.imageWrapEl.style.transitionDuration = '300ms'; 12117 gesture.imageWrapEl.style.transform = `translate3d(${translateX}px, ${translateY}px,0)`; 12118 gesture.imageEl.style.transitionDuration = '300ms'; 12119 gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`; 12120 } 12121 function zoomOut() { 12122 const zoom = swiper.zoom; 12123 const params = swiper.params.zoom; 12124 if (!gesture.slideEl) { 12125 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { 12126 gesture.slideEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(swiper.slidesEl, `.${swiper.params.slideActiveClass}`)[0]; 12127 } else { 12128 gesture.slideEl = swiper.slides[swiper.activeIndex]; 12129 } 12130 let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`); 12131 if (imageEl) { 12132 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 12133 } 12134 gesture.imageEl = imageEl; 12135 if (imageEl) { 12136 gesture.imageWrapEl = (0,_shared_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.b)(gesture.imageEl, `.${params.containerClass}`)[0]; 12137 } else { 12138 gesture.imageWrapEl = undefined; 12139 } 12140 } 12141 if (!gesture.imageEl || !gesture.imageWrapEl) return; 12142 if (swiper.params.cssMode) { 12143 swiper.wrapperEl.style.overflow = ''; 12144 swiper.wrapperEl.style.touchAction = ''; 12145 } 12146 zoom.scale = 1; 12147 currentScale = 1; 12148 image.currentX = undefined; 12149 image.currentY = undefined; 12150 image.touchesStart.x = undefined; 12151 image.touchesStart.y = undefined; 12152 gesture.imageWrapEl.style.transitionDuration = '300ms'; 12153 gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)'; 12154 gesture.imageEl.style.transitionDuration = '300ms'; 12155 gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)'; 12156 gesture.slideEl.classList.remove(`${params.zoomedSlideClass}`); 12157 gesture.slideEl = undefined; 12158 gesture.originX = 0; 12159 gesture.originY = 0; 12160 if (swiper.params.zoom.panOnMouseMove) { 12161 mousePanStart = { 12162 x: 0, 12163 y: 0 12164 }; 12165 if (isPanningWithMouse) { 12166 isPanningWithMouse = false; 12167 image.startX = 0; 12168 image.startY = 0; 12169 } 12170 } 12171 } 12172 12173 // Toggle Zoom 12174 function zoomToggle(e) { 12175 const zoom = swiper.zoom; 12176 if (zoom.scale && zoom.scale !== 1) { 12177 // Zoom Out 12178 zoomOut(); 12179 } else { 12180 // Zoom In 12181 zoomIn(e); 12182 } 12183 } 12184 function getListeners() { 12185 const passiveListener = swiper.params.passiveListeners ? { 12186 passive: true, 12187 capture: false 12188 } : false; 12189 const activeListenerWithCapture = swiper.params.passiveListeners ? { 12190 passive: false, 12191 capture: true 12192 } : true; 12193 return { 12194 passiveListener, 12195 activeListenerWithCapture 12196 }; 12197 } 12198 12199 // Attach/Detach Events 12200 function enable() { 12201 const zoom = swiper.zoom; 12202 if (zoom.enabled) return; 12203 zoom.enabled = true; 12204 const { 12205 passiveListener, 12206 activeListenerWithCapture 12207 } = getListeners(); 12208 12209 // Scale image 12210 swiper.wrapperEl.addEventListener('pointerdown', onGestureStart, passiveListener); 12211 swiper.wrapperEl.addEventListener('pointermove', onGestureChange, activeListenerWithCapture); 12212 ['pointerup', 'pointercancel', 'pointerout'].forEach(eventName => { 12213 swiper.wrapperEl.addEventListener(eventName, onGestureEnd, passiveListener); 12214 }); 12215 12216 // Move image 12217 swiper.wrapperEl.addEventListener('pointermove', onTouchMove, activeListenerWithCapture); 12218 } 12219 function disable() { 12220 const zoom = swiper.zoom; 12221 if (!zoom.enabled) return; 12222 zoom.enabled = false; 12223 const { 12224 passiveListener, 12225 activeListenerWithCapture 12226 } = getListeners(); 12227 12228 // Scale image 12229 swiper.wrapperEl.removeEventListener('pointerdown', onGestureStart, passiveListener); 12230 swiper.wrapperEl.removeEventListener('pointermove', onGestureChange, activeListenerWithCapture); 12231 ['pointerup', 'pointercancel', 'pointerout'].forEach(eventName => { 12232 swiper.wrapperEl.removeEventListener(eventName, onGestureEnd, passiveListener); 12233 }); 12234 12235 // Move image 12236 swiper.wrapperEl.removeEventListener('pointermove', onTouchMove, activeListenerWithCapture); 12237 } 12238 on('init', () => { 12239 if (swiper.params.zoom.enabled) { 12240 enable(); 12241 } 12242 }); 12243 on('destroy', () => { 12244 disable(); 12245 }); 12246 on('touchStart', (_s, e) => { 12247 if (!swiper.zoom.enabled) return; 12248 onTouchStart(e); 12249 }); 12250 on('touchEnd', (_s, e) => { 12251 if (!swiper.zoom.enabled) return; 12252 onTouchEnd(); 12253 }); 12254 on('doubleTap', (_s, e) => { 12255 if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) { 12256 zoomToggle(e); 12257 } 12258 }); 12259 on('transitionEnd', () => { 12260 if (swiper.zoom.enabled && swiper.params.zoom.enabled) { 12261 onTransitionEnd(); 12262 } 12263 }); 12264 on('slideChange', () => { 12265 if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) { 12266 onTransitionEnd(); 12267 } 12268 }); 12269 Object.assign(swiper.zoom, { 12270 enable, 12271 disable, 12272 in: zoomIn, 12273 out: zoomOut, 12274 toggle: zoomToggle 12275 }); 12276} 12277 12278 12279 12280 12281/***/ }), 12282
vendor: 805 bytes, lines 12283-12306
12283/***/ "./node_modules/swiper/shared/classes-to-selector.mjs": 12284/*!************************************************************!*\ 12285 !*** ./node_modules/swiper/shared/classes-to-selector.mjs ***! 12286 \************************************************************/ 12287/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 12288 12289"use strict"; 12290__webpack_require__.r(__webpack_exports__); 12291/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12292/* harmony export */ c: function() { return /* binding */ classesToSelector; } 12293/* harmony export */ }); 12294function classesToSelector(classes) { 12295 if (classes === void 0) { 12296 classes = ''; 12297 } 12298 return `.${classes.trim().replace(/([\.:!+\/()[\]])/g, '\\$1') // eslint-disable-line 12299 .replace(/ /g, '.')}`; 12300} 12301 12302 12303 12304 12305/***/ }), 12306
vendor: 1,439 bytes, lines 12307-12343
12307/***/ "./node_modules/swiper/shared/create-element-if-not-defined.mjs": 12308/*!**********************************************************************!*\ 12309 !*** ./node_modules/swiper/shared/create-element-if-not-defined.mjs ***! 12310 \**********************************************************************/ 12311/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 12312 12313"use strict"; 12314__webpack_require__.r(__webpack_exports__); 12315/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12316/* harmony export */ c: function() { return /* binding */ createElementIfNotDefined; } 12317/* harmony export */ }); 12318/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 12319 12320 12321function createElementIfNotDefined(swiper, originalParams, params, checkProps) { 12322 if (swiper.params.createElements) { 12323 Object.keys(checkProps).forEach(key => { 12324 if (!params[key] && params.auto === true) { 12325 let element = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.e)(swiper.el, `.${checkProps[key]}`)[0]; 12326 if (!element) { 12327 element = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.c)('div', checkProps[key]); 12328 element.className = checkProps[key]; 12329 swiper.el.append(element); 12330 } 12331 params[key] = element; 12332 originalParams[key] = element; 12333 } 12334 }); 12335 } 12336 return params; 12337} 12338 12339 12340 12341 12342/***/ }), 12343
vendor: 1,235 bytes, lines 12344-12373
12344/***/ "./node_modules/swiper/shared/create-shadow.mjs": 12345/*!******************************************************!*\ 12346 !*** ./node_modules/swiper/shared/create-shadow.mjs ***! 12347 \******************************************************/ 12348/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 12349 12350"use strict"; 12351__webpack_require__.r(__webpack_exports__); 12352/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12353/* harmony export */ c: function() { return /* binding */ createShadow; } 12354/* harmony export */ }); 12355/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 12356 12357 12358function createShadow(suffix, slideEl, side) { 12359 const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}${suffix ? ` swiper-slide-shadow-${suffix}` : ''}`; 12360 const shadowContainer = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(slideEl); 12361 let shadowEl = shadowContainer.querySelector(`.${shadowClass.split(' ').join('.')}`); 12362 if (!shadowEl) { 12363 shadowEl = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.c)('div', shadowClass.split(' ')); 12364 shadowContainer.append(shadowEl); 12365 } 12366 return shadowEl; 12367} 12368 12369 12370 12371 12372/***/ }), 12373
vendor: 2,374 bytes, lines 12374-12446
12374/***/ "./node_modules/swiper/shared/effect-init.mjs": 12375/*!****************************************************!*\ 12376 !*** ./node_modules/swiper/shared/effect-init.mjs ***! 12377 \****************************************************/ 12378/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 12379 12380"use strict"; 12381__webpack_require__.r(__webpack_exports__); 12382/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12383/* harmony export */ e: function() { return /* binding */ effectInit; } 12384/* harmony export */ }); 12385function effectInit(params) { 12386 const { 12387 effect, 12388 swiper, 12389 on, 12390 setTranslate, 12391 setTransition, 12392 overwriteParams, 12393 perspective, 12394 recreateShadows, 12395 getEffectParams 12396 } = params; 12397 on('beforeInit', () => { 12398 if (swiper.params.effect !== effect) return; 12399 swiper.classNames.push(`${swiper.params.containerModifierClass}${effect}`); 12400 if (perspective && perspective()) { 12401 swiper.classNames.push(`${swiper.params.containerModifierClass}3d`); 12402 } 12403 const overwriteParamsResult = overwriteParams ? overwriteParams() : {}; 12404 Object.assign(swiper.params, overwriteParamsResult); 12405 Object.assign(swiper.originalParams, overwriteParamsResult); 12406 }); 12407 on('setTranslate _virtualUpdated', () => { 12408 if (swiper.params.effect !== effect) return; 12409 setTranslate(); 12410 }); 12411 on('setTransition', (_s, duration) => { 12412 if (swiper.params.effect !== effect) return; 12413 setTransition(duration); 12414 }); 12415 on('transitionEnd', () => { 12416 if (swiper.params.effect !== effect) return; 12417 if (recreateShadows) { 12418 if (!getEffectParams || !getEffectParams().slideShadows) return; 12419 // remove shadows 12420 swiper.slides.forEach(slideEl => { 12421 slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => shadowEl.remove()); 12422 }); 12423 // create new one 12424 recreateShadows(); 12425 } 12426 }); 12427 let requireUpdateOnVirtual; 12428 on('virtualUpdate', () => { 12429 if (swiper.params.effect !== effect) return; 12430 if (!swiper.slides.length) { 12431 requireUpdateOnVirtual = true; 12432 } 12433 requestAnimationFrame(() => { 12434 if (requireUpdateOnVirtual && swiper.slides && swiper.slides.length) { 12435 setTranslate(); 12436 requireUpdateOnVirtual = false; 12437 } 12438 }); 12439 }); 12440} 12441 12442 12443 12444 12445/***/ }), 12446
vendor: 1,028 bytes, lines 12447-12474
12447/***/ "./node_modules/swiper/shared/effect-target.mjs": 12448/*!******************************************************!*\ 12449 !*** ./node_modules/swiper/shared/effect-target.mjs ***! 12450 \******************************************************/ 12451/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 12452 12453"use strict"; 12454__webpack_require__.r(__webpack_exports__); 12455/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12456/* harmony export */ e: function() { return /* binding */ effectTarget; } 12457/* harmony export */ }); 12458/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 12459 12460 12461function effectTarget(effectParams, slideEl) { 12462 const transformEl = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(slideEl); 12463 if (transformEl !== slideEl) { 12464 transformEl.style.backfaceVisibility = 'hidden'; 12465 transformEl.style['-webkit-backface-visibility'] = 'hidden'; 12466 } 12467 return transformEl; 12468} 12469 12470 12471 12472 12473/***/ }), 12474
vendor: 2,131 bytes, lines 12475-12538
12475/***/ "./node_modules/swiper/shared/effect-virtual-transition-end.mjs": 12476/*!**********************************************************************!*\ 12477 !*** ./node_modules/swiper/shared/effect-virtual-transition-end.mjs ***! 12478 \**********************************************************************/ 12479/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 12480 12481"use strict"; 12482__webpack_require__.r(__webpack_exports__); 12483/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12484/* harmony export */ e: function() { return /* binding */ effectVirtualTransitionEnd; } 12485/* harmony export */ }); 12486/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 12487 12488 12489function effectVirtualTransitionEnd(_ref) { 12490 let { 12491 swiper, 12492 duration, 12493 transformElements, 12494 allSlides 12495 } = _ref; 12496 const { 12497 activeIndex 12498 } = swiper; 12499 const getSlide = el => { 12500 if (!el.parentElement) { 12501 // assume shadow root 12502 const slide = swiper.slides.find(slideEl => slideEl.shadowRoot && slideEl.shadowRoot === el.parentNode); 12503 return slide; 12504 } 12505 return el.parentElement; 12506 }; 12507 if (swiper.params.virtualTranslate && duration !== 0) { 12508 let eventTriggered = false; 12509 let transitionEndTarget; 12510 if (allSlides) { 12511 transitionEndTarget = transformElements; 12512 } else { 12513 transitionEndTarget = transformElements.filter(transformEl => { 12514 const el = transformEl.classList.contains('swiper-slide-transform') ? getSlide(transformEl) : transformEl; 12515 return swiper.getSlideIndex(el) === activeIndex; 12516 }); 12517 } 12518 transitionEndTarget.forEach(el => { 12519 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.l)(el, () => { 12520 if (eventTriggered) return; 12521 if (!swiper || swiper.destroyed) return; 12522 eventTriggered = true; 12523 swiper.animating = false; 12524 const evt = new window.CustomEvent('transitionend', { 12525 bubbles: true, 12526 cancelable: true 12527 }); 12528 swiper.wrapperEl.dispatchEvent(evt); 12529 }); 12530 }); 12531 } 12532} 12533 12534 12535 12536 12537/***/ }), 12538
vendor: 3,468 bytes, lines 12539-12700
12539/***/ "./node_modules/swiper/shared/ssr-window.esm.mjs": 12540/*!*******************************************************!*\ 12541 !*** ./node_modules/swiper/shared/ssr-window.esm.mjs ***! 12542 \*******************************************************/ 12543/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 12544 12545"use strict"; 12546__webpack_require__.r(__webpack_exports__); 12547/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12548/* harmony export */ a: function() { return /* binding */ getWindow; }, 12549/* harmony export */ g: function() { return /* binding */ getDocument; } 12550/* harmony export */ }); 12551/** 12552 * SSR Window 5.0.1 12553 * Better handling for window object in SSR environment 12554 * https://github.com/nolimits4web/ssr-window 12555 * 12556 * Copyright 2025, Vladimir Kharlampidi 12557 * 12558 * Licensed under MIT 12559 * 12560 * Released on: June 27, 2025 12561 */ 12562/* eslint-disable no-param-reassign */ 12563function isObject(obj) { 12564 return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object; 12565} 12566function extend(target, src) { 12567 if (target === void 0) { 12568 target = {}; 12569 } 12570 if (src === void 0) { 12571 src = {}; 12572 } 12573 const noExtend = ['__proto__', 'constructor', 'prototype']; 12574 Object.keys(src).filter(key => noExtend.indexOf(key) < 0).forEach(key => { 12575 if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) { 12576 extend(target[key], src[key]); 12577 } 12578 }); 12579} 12580const ssrDocument = { 12581 body: {}, 12582 addEventListener() {}, 12583 removeEventListener() {}, 12584 activeElement: { 12585 blur() {}, 12586 nodeName: '' 12587 }, 12588 querySelector() { 12589 return null; 12590 }, 12591 querySelectorAll() { 12592 return []; 12593 }, 12594 getElementById() { 12595 return null; 12596 }, 12597 createEvent() { 12598 return { 12599 initEvent() {} 12600 }; 12601 }, 12602 createElement() { 12603 return { 12604 children: [], 12605 childNodes: [], 12606 style: {}, 12607 setAttribute() {}, 12608 getElementsByTagName() { 12609 return []; 12610 } 12611 }; 12612 }, 12613 createElementNS() { 12614 return {}; 12615 }, 12616 importNode() { 12617 return null; 12618 }, 12619 location: { 12620 hash: '', 12621 host: '', 12622 hostname: '', 12623 href: '', 12624 origin: '', 12625 pathname: '', 12626 protocol: '', 12627 search: '' 12628 } 12629}; 12630function getDocument() { 12631 const doc = typeof document !== 'undefined' ? document : {}; 12632 extend(doc, ssrDocument); 12633 return doc; 12634} 12635const ssrWindow = { 12636 document: ssrDocument, 12637 navigator: { 12638 userAgent: '' 12639 }, 12640 location: { 12641 hash: '', 12642 host: '', 12643 hostname: '', 12644 href: '', 12645 origin: '', 12646 pathname: '', 12647 protocol: '', 12648 search: '' 12649 }, 12650 history: { 12651 replaceState() {}, 12652 pushState() {}, 12653 go() {}, 12654 back() {} 12655 }, 12656 CustomEvent: function CustomEvent() { 12657 return this; 12658 }, 12659 addEventListener() {}, 12660 removeEventListener() {}, 12661 getComputedStyle() { 12662 return { 12663 getPropertyValue() { 12664 return ''; 12665 } 12666 }; 12667 }, 12668 Image() {}, 12669 Date() {}, 12670 screen: {}, 12671 setTimeout() {}, 12672 clearTimeout() {}, 12673 matchMedia() { 12674 return {}; 12675 }, 12676 requestAnimationFrame(callback) { 12677 if (typeof setTimeout === 'undefined') { 12678 callback(); 12679 return null; 12680 } 12681 return setTimeout(callback, 0); 12682 }, 12683 cancelAnimationFrame(id) { 12684 if (typeof setTimeout === 'undefined') { 12685 return; 12686 } 12687 clearTimeout(id); 12688 } 12689}; 12690function getWindow() { 12691 const win = typeof window !== 'undefined' ? window : {}; 12692 extend(win, ssrWindow); 12693 return win; 12694} 12695 12696 12697 12698 12699/***/ }), 12700
vendor: 135,087 bytes, lines 12701-16670
12701/***/ "./node_modules/swiper/shared/swiper-core.mjs": 12702/*!****************************************************!*\ 12703 !*** ./node_modules/swiper/shared/swiper-core.mjs ***! 12704 \****************************************************/ 12705/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 12706 12707"use strict"; 12708__webpack_require__.r(__webpack_exports__); 12709/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12710/* harmony export */ S: function() { return /* binding */ Swiper; }, 12711/* harmony export */ d: function() { return /* binding */ defaults; } 12712/* harmony export */ }); 12713/* harmony import */ var _ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 12714/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/swiper/shared/utils.mjs"); 12715 12716 12717 12718let support; 12719function calcSupport() { 12720 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 12721 const document = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 12722 return { 12723 smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style, 12724 touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch) 12725 }; 12726} 12727function getSupport() { 12728 if (!support) { 12729 support = calcSupport(); 12730 } 12731 return support; 12732} 12733 12734let deviceCached; 12735function calcDevice(_temp) { 12736 let { 12737 userAgent 12738 } = _temp === void 0 ? {} : _temp; 12739 const support = getSupport(); 12740 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 12741 const platform = window.navigator.platform; 12742 const ua = userAgent || window.navigator.userAgent; 12743 const device = { 12744 ios: false, 12745 android: false 12746 }; 12747 const screenWidth = window.screen.width; 12748 const screenHeight = window.screen.height; 12749 const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line 12750 let ipad = ua.match(/(iPad).*OS\s([\d_]+)/); 12751 const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); 12752 const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); 12753 const windows = platform === 'Win32'; 12754 let macos = platform === 'MacIntel'; 12755 12756 // iPadOs 13 fix 12757 const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810']; 12758 if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) { 12759 ipad = ua.match(/(Version)\/([\d.]+)/); 12760 if (!ipad) ipad = [0, 1, '13_0_0']; 12761 macos = false; 12762 } 12763 12764 // Android 12765 if (android && !windows) { 12766 device.os = 'android'; 12767 device.android = true; 12768 } 12769 if (ipad || iphone || ipod) { 12770 device.os = 'ios'; 12771 device.ios = true; 12772 } 12773 12774 // Export object 12775 return device; 12776} 12777function getDevice(overrides) { 12778 if (overrides === void 0) { 12779 overrides = {}; 12780 } 12781 if (!deviceCached) { 12782 deviceCached = calcDevice(overrides); 12783 } 12784 return deviceCached; 12785} 12786 12787let browser; 12788function calcBrowser() { 12789 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 12790 const device = getDevice(); 12791 let needPerspectiveFix = false; 12792 function isSafari() { 12793 const ua = window.navigator.userAgent.toLowerCase(); 12794 return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0; 12795 } 12796 if (isSafari()) { 12797 const ua = String(window.navigator.userAgent); 12798 if (ua.includes('Version/')) { 12799 const [major, minor] = ua.split('Version/')[1].split(' ')[0].split('.').map(num => Number(num)); 12800 needPerspectiveFix = major < 16 || major === 16 && minor < 2; 12801 } 12802 } 12803 const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent); 12804 const isSafariBrowser = isSafari(); 12805 const need3dFix = isSafariBrowser || isWebView && device.ios; 12806 return { 12807 isSafari: needPerspectiveFix || isSafariBrowser, 12808 needPerspectiveFix, 12809 need3dFix, 12810 isWebView 12811 }; 12812} 12813function getBrowser() { 12814 if (!browser) { 12815 browser = calcBrowser(); 12816 } 12817 return browser; 12818} 12819 12820function Resize(_ref) { 12821 let { 12822 swiper, 12823 on, 12824 emit 12825 } = _ref; 12826 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 12827 let observer = null; 12828 let animationFrame = null; 12829 const resizeHandler = () => { 12830 if (!swiper || swiper.destroyed || !swiper.initialized) return; 12831 emit('beforeResize'); 12832 emit('resize'); 12833 }; 12834 const createObserver = () => { 12835 if (!swiper || swiper.destroyed || !swiper.initialized) return; 12836 observer = new ResizeObserver(entries => { 12837 animationFrame = window.requestAnimationFrame(() => { 12838 const { 12839 width, 12840 height 12841 } = swiper; 12842 let newWidth = width; 12843 let newHeight = height; 12844 entries.forEach(_ref2 => { 12845 let { 12846 contentBoxSize, 12847 contentRect, 12848 target 12849 } = _ref2; 12850 if (target && target !== swiper.el) return; 12851 newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize; 12852 newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize; 12853 }); 12854 if (newWidth !== width || newHeight !== height) { 12855 resizeHandler(); 12856 } 12857 }); 12858 }); 12859 observer.observe(swiper.el); 12860 }; 12861 const removeObserver = () => { 12862 if (animationFrame) { 12863 window.cancelAnimationFrame(animationFrame); 12864 } 12865 if (observer && observer.unobserve && swiper.el) { 12866 observer.unobserve(swiper.el); 12867 observer = null; 12868 } 12869 }; 12870 const orientationChangeHandler = () => { 12871 if (!swiper || swiper.destroyed || !swiper.initialized) return; 12872 emit('orientationchange'); 12873 }; 12874 on('init', () => { 12875 if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') { 12876 createObserver(); 12877 return; 12878 } 12879 window.addEventListener('resize', resizeHandler); 12880 window.addEventListener('orientationchange', orientationChangeHandler); 12881 }); 12882 on('destroy', () => { 12883 removeObserver(); 12884 window.removeEventListener('resize', resizeHandler); 12885 window.removeEventListener('orientationchange', orientationChangeHandler); 12886 }); 12887} 12888 12889function Observer(_ref) { 12890 let { 12891 swiper, 12892 extendParams, 12893 on, 12894 emit 12895 } = _ref; 12896 const observers = []; 12897 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 12898 const attach = function (target, options) { 12899 if (options === void 0) { 12900 options = {}; 12901 } 12902 const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver; 12903 const observer = new ObserverFunc(mutations => { 12904 // The observerUpdate event should only be triggered 12905 // once despite the number of mutations. Additional 12906 // triggers are redundant and are very costly 12907 if (swiper.__preventObserver__) return; 12908 if (mutations.length === 1) { 12909 emit('observerUpdate', mutations[0]); 12910 return; 12911 } 12912 const observerUpdate = function observerUpdate() { 12913 emit('observerUpdate', mutations[0]); 12914 }; 12915 if (window.requestAnimationFrame) { 12916 window.requestAnimationFrame(observerUpdate); 12917 } else { 12918 window.setTimeout(observerUpdate, 0); 12919 } 12920 }); 12921 observer.observe(target, { 12922 attributes: typeof options.attributes === 'undefined' ? true : options.attributes, 12923 childList: swiper.isElement || (typeof options.childList === 'undefined' ? true : options).childList, 12924 characterData: typeof options.characterData === 'undefined' ? true : options.characterData 12925 }); 12926 observers.push(observer); 12927 }; 12928 const init = () => { 12929 if (!swiper.params.observer) return; 12930 if (swiper.params.observeParents) { 12931 const containerParents = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.b)(swiper.hostEl); 12932 for (let i = 0; i < containerParents.length; i += 1) { 12933 attach(containerParents[i]); 12934 } 12935 } 12936 // Observe container 12937 attach(swiper.hostEl, { 12938 childList: swiper.params.observeSlideChildren 12939 }); 12940 12941 // Observe wrapper 12942 attach(swiper.wrapperEl, { 12943 attributes: false 12944 }); 12945 }; 12946 const destroy = () => { 12947 observers.forEach(observer => { 12948 observer.disconnect(); 12949 }); 12950 observers.splice(0, observers.length); 12951 }; 12952 extendParams({ 12953 observer: false, 12954 observeParents: false, 12955 observeSlideChildren: false 12956 }); 12957 on('init', init); 12958 on('destroy', destroy); 12959} 12960 12961/* eslint-disable no-underscore-dangle */ 12962 12963var eventsEmitter = { 12964 on(events, handler, priority) { 12965 const self = this; 12966 if (!self.eventsListeners || self.destroyed) return self; 12967 if (typeof handler !== 'function') return self; 12968 const method = priority ? 'unshift' : 'push'; 12969 events.split(' ').forEach(event => { 12970 if (!self.eventsListeners[event]) self.eventsListeners[event] = []; 12971 self.eventsListeners[event][method](handler); 12972 }); 12973 return self; 12974 }, 12975 once(events, handler, priority) { 12976 const self = this; 12977 if (!self.eventsListeners || self.destroyed) return self; 12978 if (typeof handler !== 'function') return self; 12979 function onceHandler() { 12980 self.off(events, onceHandler); 12981 if (onceHandler.__emitterProxy) { 12982 delete onceHandler.__emitterProxy; 12983 } 12984 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 12985 args[_key] = arguments[_key]; 12986 } 12987 handler.apply(self, args); 12988 } 12989 onceHandler.__emitterProxy = handler; 12990 return self.on(events, onceHandler, priority); 12991 }, 12992 onAny(handler, priority) { 12993 const self = this; 12994 if (!self.eventsListeners || self.destroyed) return self; 12995 if (typeof handler !== 'function') return self; 12996 const method = priority ? 'unshift' : 'push'; 12997 if (self.eventsAnyListeners.indexOf(handler) < 0) { 12998 self.eventsAnyListeners[method](handler); 12999 } 13000 return self; 13001 }, 13002 offAny(handler) { 13003 const self = this; 13004 if (!self.eventsListeners || self.destroyed) return self; 13005 if (!self.eventsAnyListeners) return self; 13006 const index = self.eventsAnyListeners.indexOf(handler); 13007 if (index >= 0) { 13008 self.eventsAnyListeners.splice(index, 1); 13009 } 13010 return self; 13011 }, 13012 off(events, handler) { 13013 const self = this; 13014 if (!self.eventsListeners || self.destroyed) return self; 13015 if (!self.eventsListeners) return self; 13016 events.split(' ').forEach(event => { 13017 if (typeof handler === 'undefined') { 13018 self.eventsListeners[event] = []; 13019 } else if (self.eventsListeners[event]) { 13020 self.eventsListeners[event].forEach((eventHandler, index) => { 13021 if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) { 13022 self.eventsListeners[event].splice(index, 1); 13023 } 13024 }); 13025 } 13026 }); 13027 return self; 13028 }, 13029 emit() { 13030 const self = this; 13031 if (!self.eventsListeners || self.destroyed) return self; 13032 if (!self.eventsListeners) return self; 13033 let events; 13034 let data; 13035 let context; 13036 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 13037 args[_key2] = arguments[_key2]; 13038 } 13039 if (typeof args[0] === 'string' || Array.isArray(args[0])) { 13040 events = args[0]; 13041 data = args.slice(1, args.length); 13042 context = self; 13043 } else { 13044 events = args[0].events; 13045 data = args[0].data; 13046 context = args[0].context || self; 13047 } 13048 data.unshift(context); 13049 const eventsArray = Array.isArray(events) ? events : events.split(' '); 13050 eventsArray.forEach(event => { 13051 if (self.eventsAnyListeners && self.eventsAnyListeners.length) { 13052 self.eventsAnyListeners.forEach(eventHandler => { 13053 eventHandler.apply(context, [event, ...data]); 13054 }); 13055 } 13056 if (self.eventsListeners && self.eventsListeners[event]) { 13057 self.eventsListeners[event].forEach(eventHandler => { 13058 eventHandler.apply(context, data); 13059 }); 13060 } 13061 }); 13062 return self; 13063 } 13064}; 13065 13066function updateSize() { 13067 const swiper = this; 13068 let width; 13069 let height; 13070 const el = swiper.el; 13071 if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) { 13072 width = swiper.params.width; 13073 } else { 13074 width = el.clientWidth; 13075 } 13076 if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) { 13077 height = swiper.params.height; 13078 } else { 13079 height = el.clientHeight; 13080 } 13081 if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) { 13082 return; 13083 } 13084 13085 // Subtract paddings 13086 width = width - parseInt((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.q)(el, 'padding-left') || 0, 10) - parseInt((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.q)(el, 'padding-right') || 0, 10); 13087 height = height - parseInt((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.q)(el, 'padding-top') || 0, 10) - parseInt((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.q)(el, 'padding-bottom') || 0, 10); 13088 if (Number.isNaN(width)) width = 0; 13089 if (Number.isNaN(height)) height = 0; 13090 Object.assign(swiper, { 13091 width, 13092 height, 13093 size: swiper.isHorizontal() ? width : height 13094 }); 13095} 13096 13097function updateSlides() { 13098 const swiper = this; 13099 function getDirectionPropertyValue(node, label) { 13100 return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0); 13101 } 13102 const params = swiper.params; 13103 const { 13104 wrapperEl, 13105 slidesEl, 13106 size: swiperSize, 13107 rtlTranslate: rtl, 13108 wrongRTL 13109 } = swiper; 13110 const isVirtual = swiper.virtual && params.virtual.enabled; 13111 const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; 13112 const slides = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(slidesEl, `.${swiper.params.slideClass}, swiper-slide`); 13113 const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; 13114 let snapGrid = []; 13115 const slidesGrid = []; 13116 const slidesSizesGrid = []; 13117 let offsetBefore = params.slidesOffsetBefore; 13118 if (typeof offsetBefore === 'function') { 13119 offsetBefore = params.slidesOffsetBefore.call(swiper); 13120 } 13121 let offsetAfter = params.slidesOffsetAfter; 13122 if (typeof offsetAfter === 'function') { 13123 offsetAfter = params.slidesOffsetAfter.call(swiper); 13124 } 13125 const previousSnapGridLength = swiper.snapGrid.length; 13126 const previousSlidesGridLength = swiper.slidesGrid.length; 13127 let spaceBetween = params.spaceBetween; 13128 let slidePosition = -offsetBefore; 13129 let prevSlideSize = 0; 13130 let index = 0; 13131 if (typeof swiperSize === 'undefined') { 13132 return; 13133 } 13134 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 13135 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize; 13136 } else if (typeof spaceBetween === 'string') { 13137 spaceBetween = parseFloat(spaceBetween); 13138 } 13139 swiper.virtualSize = -spaceBetween; 13140 13141 // reset margins 13142 slides.forEach(slideEl => { 13143 if (rtl) { 13144 slideEl.style.marginLeft = ''; 13145 } else { 13146 slideEl.style.marginRight = ''; 13147 } 13148 slideEl.style.marginBottom = ''; 13149 slideEl.style.marginTop = ''; 13150 }); 13151 13152 // reset cssMode offsets 13153 if (params.centeredSlides && params.cssMode) { 13154 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.a)(wrapperEl, '--swiper-centered-offset-before', ''); 13155 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.a)(wrapperEl, '--swiper-centered-offset-after', ''); 13156 } 13157 const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid; 13158 if (gridEnabled) { 13159 swiper.grid.initSlides(slides); 13160 } else if (swiper.grid) { 13161 swiper.grid.unsetSlides(); 13162 } 13163 13164 // Calc slides 13165 let slideSize; 13166 const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => { 13167 return typeof params.breakpoints[key].slidesPerView !== 'undefined'; 13168 }).length > 0; 13169 for (let i = 0; i < slidesLength; i += 1) { 13170 slideSize = 0; 13171 let slide; 13172 if (slides[i]) slide = slides[i]; 13173 if (gridEnabled) { 13174 swiper.grid.updateSlide(i, slide, slides); 13175 } 13176 if (slides[i] && (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.q)(slide, 'display') === 'none') continue; // eslint-disable-line 13177 13178 if (params.slidesPerView === 'auto') { 13179 if (shouldResetSlideSize) { 13180 slides[i].style[swiper.getDirectionLabel('width')] = ``; 13181 } 13182 const slideStyles = getComputedStyle(slide); 13183 const currentTransform = slide.style.transform; 13184 const currentWebKitTransform = slide.style.webkitTransform; 13185 if (currentTransform) { 13186 slide.style.transform = 'none'; 13187 } 13188 if (currentWebKitTransform) { 13189 slide.style.webkitTransform = 'none'; 13190 } 13191 if (params.roundLengths) { 13192 slideSize = swiper.isHorizontal() ? (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.h)(slide, 'width', true) : (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.h)(slide, 'height', true); 13193 } else { 13194 // eslint-disable-next-line 13195 const width = getDirectionPropertyValue(slideStyles, 'width'); 13196 const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left'); 13197 const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right'); 13198 const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left'); 13199 const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right'); 13200 const boxSizing = slideStyles.getPropertyValue('box-sizing'); 13201 if (boxSizing && boxSizing === 'border-box') { 13202 slideSize = width + marginLeft + marginRight; 13203 } else { 13204 const { 13205 clientWidth, 13206 offsetWidth 13207 } = slide; 13208 slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth); 13209 } 13210 } 13211 if (currentTransform) { 13212 slide.style.transform = currentTransform; 13213 } 13214 if (currentWebKitTransform) { 13215 slide.style.webkitTransform = currentWebKitTransform; 13216 } 13217 if (params.roundLengths) slideSize = Math.floor(slideSize); 13218 } else { 13219 slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView; 13220 if (params.roundLengths) slideSize = Math.floor(slideSize); 13221 if (slides[i]) { 13222 slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`; 13223 } 13224 } 13225 if (slides[i]) { 13226 slides[i].swiperSlideSize = slideSize; 13227 } 13228 slidesSizesGrid.push(slideSize); 13229 if (params.centeredSlides) { 13230 slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; 13231 if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 13232 if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 13233 if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0; 13234 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 13235 if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition); 13236 slidesGrid.push(slidePosition); 13237 } else { 13238 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 13239 if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition); 13240 slidesGrid.push(slidePosition); 13241 slidePosition = slidePosition + slideSize + spaceBetween; 13242 } 13243 swiper.virtualSize += slideSize + spaceBetween; 13244 prevSlideSize = slideSize; 13245 index += 1; 13246 } 13247 swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; 13248 if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) { 13249 wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`; 13250 } 13251 if (params.setWrapperSize) { 13252 wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`; 13253 } 13254 if (gridEnabled) { 13255 swiper.grid.updateWrapperSize(slideSize, snapGrid); 13256 } 13257 13258 // Remove last grid elements depending on width 13259 if (!params.centeredSlides) { 13260 const newSlidesGrid = []; 13261 for (let i = 0; i < snapGrid.length; i += 1) { 13262 let slidesGridItem = snapGrid[i]; 13263 if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem); 13264 if (snapGrid[i] <= swiper.virtualSize - swiperSize) { 13265 newSlidesGrid.push(slidesGridItem); 13266 } 13267 } 13268 snapGrid = newSlidesGrid; 13269 if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) { 13270 snapGrid.push(swiper.virtualSize - swiperSize); 13271 } 13272 } 13273 if (isVirtual && params.loop) { 13274 const size = slidesSizesGrid[0] + spaceBetween; 13275 if (params.slidesPerGroup > 1) { 13276 const groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup); 13277 const groupSize = size * params.slidesPerGroup; 13278 for (let i = 0; i < groups; i += 1) { 13279 snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize); 13280 } 13281 } 13282 for (let i = 0; i < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; i += 1) { 13283 if (params.slidesPerGroup === 1) { 13284 snapGrid.push(snapGrid[snapGrid.length - 1] + size); 13285 } 13286 slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size); 13287 swiper.virtualSize += size; 13288 } 13289 } 13290 if (snapGrid.length === 0) snapGrid = [0]; 13291 if (spaceBetween !== 0) { 13292 const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight'); 13293 slides.filter((_, slideIndex) => { 13294 if (!params.cssMode || params.loop) return true; 13295 if (slideIndex === slides.length - 1) { 13296 return false; 13297 } 13298 return true; 13299 }).forEach(slideEl => { 13300 slideEl.style[key] = `${spaceBetween}px`; 13301 }); 13302 } 13303 if (params.centeredSlides && params.centeredSlidesBounds) { 13304 let allSlidesSize = 0; 13305 slidesSizesGrid.forEach(slideSizeValue => { 13306 allSlidesSize += slideSizeValue + (spaceBetween || 0); 13307 }); 13308 allSlidesSize -= spaceBetween; 13309 const maxSnap = allSlidesSize > swiperSize ? allSlidesSize - swiperSize : 0; 13310 snapGrid = snapGrid.map(snap => { 13311 if (snap <= 0) return -offsetBefore; 13312 if (snap > maxSnap) return maxSnap + offsetAfter; 13313 return snap; 13314 }); 13315 } 13316 if (params.centerInsufficientSlides) { 13317 let allSlidesSize = 0; 13318 slidesSizesGrid.forEach(slideSizeValue => { 13319 allSlidesSize += slideSizeValue + (spaceBetween || 0); 13320 }); 13321 allSlidesSize -= spaceBetween; 13322 const offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0); 13323 if (allSlidesSize + offsetSize < swiperSize) { 13324 const allSlidesOffset = (swiperSize - allSlidesSize - offsetSize) / 2; 13325 snapGrid.forEach((snap, snapIndex) => { 13326 snapGrid[snapIndex] = snap - allSlidesOffset; 13327 }); 13328 slidesGrid.forEach((snap, snapIndex) => { 13329 slidesGrid[snapIndex] = snap + allSlidesOffset; 13330 }); 13331 } 13332 } 13333 Object.assign(swiper, { 13334 slides, 13335 snapGrid, 13336 slidesGrid, 13337 slidesSizesGrid 13338 }); 13339 if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) { 13340 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.a)(wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`); 13341 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.a)(wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`); 13342 const addToSnapGrid = -swiper.snapGrid[0]; 13343 const addToSlidesGrid = -swiper.slidesGrid[0]; 13344 swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid); 13345 swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid); 13346 } 13347 if (slidesLength !== previousSlidesLength) { 13348 swiper.emit('slidesLengthChange'); 13349 } 13350 if (snapGrid.length !== previousSnapGridLength) { 13351 if (swiper.params.watchOverflow) swiper.checkOverflow(); 13352 swiper.emit('snapGridLengthChange'); 13353 } 13354 if (slidesGrid.length !== previousSlidesGridLength) { 13355 swiper.emit('slidesGridLengthChange'); 13356 } 13357 if (params.watchSlidesProgress) { 13358 swiper.updateSlidesOffset(); 13359 } 13360 swiper.emit('slidesUpdated'); 13361 if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) { 13362 const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`; 13363 const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass); 13364 if (slidesLength <= params.maxBackfaceHiddenSlides) { 13365 if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass); 13366 } else if (hasClassBackfaceClassAdded) { 13367 swiper.el.classList.remove(backFaceHiddenClass); 13368 } 13369 } 13370} 13371 13372function updateAutoHeight(speed) { 13373 const swiper = this; 13374 const activeSlides = []; 13375 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 13376 let newHeight = 0; 13377 let i; 13378 if (typeof speed === 'number') { 13379 swiper.setTransition(speed); 13380 } else if (speed === true) { 13381 swiper.setTransition(swiper.params.speed); 13382 } 13383 const getSlideByIndex = index => { 13384 if (isVirtual) { 13385 return swiper.slides[swiper.getSlideIndexByData(index)]; 13386 } 13387 return swiper.slides[index]; 13388 }; 13389 // Find slides currently in view 13390 if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) { 13391 if (swiper.params.centeredSlides) { 13392 (swiper.visibleSlides || []).forEach(slide => { 13393 activeSlides.push(slide); 13394 }); 13395 } else { 13396 for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) { 13397 const index = swiper.activeIndex + i; 13398 if (index > swiper.slides.length && !isVirtual) break; 13399 activeSlides.push(getSlideByIndex(index)); 13400 } 13401 } 13402 } else { 13403 activeSlides.push(getSlideByIndex(swiper.activeIndex)); 13404 } 13405 13406 // Find new height from highest slide in view 13407 for (i = 0; i < activeSlides.length; i += 1) { 13408 if (typeof activeSlides[i] !== 'undefined') { 13409 const height = activeSlides[i].offsetHeight; 13410 newHeight = height > newHeight ? height : newHeight; 13411 } 13412 } 13413 13414 // Update Height 13415 if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`; 13416} 13417 13418function updateSlidesOffset() { 13419 const swiper = this; 13420 const slides = swiper.slides; 13421 // eslint-disable-next-line 13422 const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0; 13423 for (let i = 0; i < slides.length; i += 1) { 13424 slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment(); 13425 } 13426} 13427 13428const toggleSlideClasses$1 = (slideEl, condition, className) => { 13429 if (condition && !slideEl.classList.contains(className)) { 13430 slideEl.classList.add(className); 13431 } else if (!condition && slideEl.classList.contains(className)) { 13432 slideEl.classList.remove(className); 13433 } 13434}; 13435function updateSlidesProgress(translate) { 13436 if (translate === void 0) { 13437 translate = this && this.translate || 0; 13438 } 13439 const swiper = this; 13440 const params = swiper.params; 13441 const { 13442 slides, 13443 rtlTranslate: rtl, 13444 snapGrid 13445 } = swiper; 13446 if (slides.length === 0) return; 13447 if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset(); 13448 let offsetCenter = -translate; 13449 if (rtl) offsetCenter = translate; 13450 swiper.visibleSlidesIndexes = []; 13451 swiper.visibleSlides = []; 13452 let spaceBetween = params.spaceBetween; 13453 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 13454 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size; 13455 } else if (typeof spaceBetween === 'string') { 13456 spaceBetween = parseFloat(spaceBetween); 13457 } 13458 for (let i = 0; i < slides.length; i += 1) { 13459 const slide = slides[i]; 13460 let slideOffset = slide.swiperSlideOffset; 13461 if (params.cssMode && params.centeredSlides) { 13462 slideOffset -= slides[0].swiperSlideOffset; 13463 } 13464 const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween); 13465 const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween); 13466 const slideBefore = -(offsetCenter - slideOffset); 13467 const slideAfter = slideBefore + swiper.slidesSizesGrid[i]; 13468 const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i]; 13469 const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size; 13470 if (isVisible) { 13471 swiper.visibleSlides.push(slide); 13472 swiper.visibleSlidesIndexes.push(i); 13473 } 13474 toggleSlideClasses$1(slide, isVisible, params.slideVisibleClass); 13475 toggleSlideClasses$1(slide, isFullyVisible, params.slideFullyVisibleClass); 13476 slide.progress = rtl ? -slideProgress : slideProgress; 13477 slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress; 13478 } 13479} 13480 13481function updateProgress(translate) { 13482 const swiper = this; 13483 if (typeof translate === 'undefined') { 13484 const multiplier = swiper.rtlTranslate ? -1 : 1; 13485 // eslint-disable-next-line 13486 translate = swiper && swiper.translate && swiper.translate * multiplier || 0; 13487 } 13488 const params = swiper.params; 13489 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 13490 let { 13491 progress, 13492 isBeginning, 13493 isEnd, 13494 progressLoop 13495 } = swiper; 13496 const wasBeginning = isBeginning; 13497 const wasEnd = isEnd; 13498 if (translatesDiff === 0) { 13499 progress = 0; 13500 isBeginning = true; 13501 isEnd = true; 13502 } else { 13503 progress = (translate - swiper.minTranslate()) / translatesDiff; 13504 const isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1; 13505 const isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1; 13506 isBeginning = isBeginningRounded || progress <= 0; 13507 isEnd = isEndRounded || progress >= 1; 13508 if (isBeginningRounded) progress = 0; 13509 if (isEndRounded) progress = 1; 13510 } 13511 if (params.loop) { 13512 const firstSlideIndex = swiper.getSlideIndexByData(0); 13513 const lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1); 13514 const firstSlideTranslate = swiper.slidesGrid[firstSlideIndex]; 13515 const lastSlideTranslate = swiper.slidesGrid[lastSlideIndex]; 13516 const translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1]; 13517 const translateAbs = Math.abs(translate); 13518 if (translateAbs >= firstSlideTranslate) { 13519 progressLoop = (translateAbs - firstSlideTranslate) / translateMax; 13520 } else { 13521 progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax; 13522 } 13523 if (progressLoop > 1) progressLoop -= 1; 13524 } 13525 Object.assign(swiper, { 13526 progress, 13527 progressLoop, 13528 isBeginning, 13529 isEnd 13530 }); 13531 if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate); 13532 if (isBeginning && !wasBeginning) { 13533 swiper.emit('reachBeginning toEdge'); 13534 } 13535 if (isEnd && !wasEnd) { 13536 swiper.emit('reachEnd toEdge'); 13537 } 13538 if (wasBeginning && !isBeginning || wasEnd && !isEnd) { 13539 swiper.emit('fromEdge'); 13540 } 13541 swiper.emit('progress', progress); 13542} 13543 13544const toggleSlideClasses = (slideEl, condition, className) => { 13545 if (condition && !slideEl.classList.contains(className)) { 13546 slideEl.classList.add(className); 13547 } else if (!condition && slideEl.classList.contains(className)) { 13548 slideEl.classList.remove(className); 13549 } 13550}; 13551function updateSlidesClasses() { 13552 const swiper = this; 13553 const { 13554 slides, 13555 params, 13556 slidesEl, 13557 activeIndex 13558 } = swiper; 13559 const isVirtual = swiper.virtual && params.virtual.enabled; 13560 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 13561 const getFilteredSlide = selector => { 13562 return (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0]; 13563 }; 13564 let activeSlide; 13565 let prevSlide; 13566 let nextSlide; 13567 if (isVirtual) { 13568 if (params.loop) { 13569 let slideIndex = activeIndex - swiper.virtual.slidesBefore; 13570 if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex; 13571 if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length; 13572 activeSlide = getFilteredSlide(`[data-swiper-slide-index="${slideIndex}"]`); 13573 } else { 13574 activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`); 13575 } 13576 } else { 13577 if (gridEnabled) { 13578 activeSlide = slides.find(slideEl => slideEl.column === activeIndex); 13579 nextSlide = slides.find(slideEl => slideEl.column === activeIndex + 1); 13580 prevSlide = slides.find(slideEl => slideEl.column === activeIndex - 1); 13581 } else { 13582 activeSlide = slides[activeIndex]; 13583 } 13584 } 13585 if (activeSlide) { 13586 if (!gridEnabled) { 13587 // Next Slide 13588 nextSlide = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.r)(activeSlide, `.${params.slideClass}, swiper-slide`)[0]; 13589 if (params.loop && !nextSlide) { 13590 nextSlide = slides[0]; 13591 } 13592 13593 // Prev Slide 13594 prevSlide = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.t)(activeSlide, `.${params.slideClass}, swiper-slide`)[0]; 13595 if (params.loop && !prevSlide === 0) { 13596 prevSlide = slides[slides.length - 1]; 13597 } 13598 } 13599 } 13600 slides.forEach(slideEl => { 13601 toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass); 13602 toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass); 13603 toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass); 13604 }); 13605 swiper.emitSlidesClasses(); 13606} 13607 13608const processLazyPreloader = (swiper, imageEl) => { 13609 if (!swiper || swiper.destroyed || !swiper.params) return; 13610 const slideSelector = () => swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`; 13611 const slideEl = imageEl.closest(slideSelector()); 13612 if (slideEl) { 13613 let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`); 13614 if (!lazyEl && swiper.isElement) { 13615 if (slideEl.shadowRoot) { 13616 lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`); 13617 } else { 13618 // init later 13619 requestAnimationFrame(() => { 13620 if (slideEl.shadowRoot) { 13621 lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`); 13622 if (lazyEl) lazyEl.remove(); 13623 } 13624 }); 13625 } 13626 } 13627 if (lazyEl) lazyEl.remove(); 13628 } 13629}; 13630const unlazy = (swiper, index) => { 13631 if (!swiper.slides[index]) return; 13632 const imageEl = swiper.slides[index].querySelector('[loading="lazy"]'); 13633 if (imageEl) imageEl.removeAttribute('loading'); 13634}; 13635const preload = swiper => { 13636 if (!swiper || swiper.destroyed || !swiper.params) return; 13637 let amount = swiper.params.lazyPreloadPrevNext; 13638 const len = swiper.slides.length; 13639 if (!len || !amount || amount < 0) return; 13640 amount = Math.min(amount, len); 13641 const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView); 13642 const activeIndex = swiper.activeIndex; 13643 if (swiper.params.grid && swiper.params.grid.rows > 1) { 13644 const activeColumn = activeIndex; 13645 const preloadColumns = [activeColumn - amount]; 13646 preloadColumns.push(...Array.from({ 13647 length: amount 13648 }).map((_, i) => { 13649 return activeColumn + slidesPerView + i; 13650 })); 13651 swiper.slides.forEach((slideEl, i) => { 13652 if (preloadColumns.includes(slideEl.column)) unlazy(swiper, i); 13653 }); 13654 return; 13655 } 13656 const slideIndexLastInView = activeIndex + slidesPerView - 1; 13657 if (swiper.params.rewind || swiper.params.loop) { 13658 for (let i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) { 13659 const realIndex = (i % len + len) % len; 13660 if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex); 13661 } 13662 } else { 13663 for (let i = Math.max(activeIndex - amount, 0); i <= Math.min(slideIndexLastInView + amount, len - 1); i += 1) { 13664 if (i !== activeIndex && (i > slideIndexLastInView || i < activeIndex)) { 13665 unlazy(swiper, i); 13666 } 13667 } 13668 } 13669}; 13670 13671function getActiveIndexByTranslate(swiper) { 13672 const { 13673 slidesGrid, 13674 params 13675 } = swiper; 13676 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 13677 let activeIndex; 13678 for (let i = 0; i < slidesGrid.length; i += 1) { 13679 if (typeof slidesGrid[i + 1] !== 'undefined') { 13680 if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) { 13681 activeIndex = i; 13682 } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) { 13683 activeIndex = i + 1; 13684 } 13685 } else if (translate >= slidesGrid[i]) { 13686 activeIndex = i; 13687 } 13688 } 13689 // Normalize slideIndex 13690 if (params.normalizeSlideIndex) { 13691 if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0; 13692 } 13693 return activeIndex; 13694} 13695function updateActiveIndex(newActiveIndex) { 13696 const swiper = this; 13697 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 13698 const { 13699 snapGrid, 13700 params, 13701 activeIndex: previousIndex, 13702 realIndex: previousRealIndex, 13703 snapIndex: previousSnapIndex 13704 } = swiper; 13705 let activeIndex = newActiveIndex; 13706 let snapIndex; 13707 const getVirtualRealIndex = aIndex => { 13708 let realIndex = aIndex - swiper.virtual.slidesBefore; 13709 if (realIndex < 0) { 13710 realIndex = swiper.virtual.slides.length + realIndex; 13711 } 13712 if (realIndex >= swiper.virtual.slides.length) { 13713 realIndex -= swiper.virtual.slides.length; 13714 } 13715 return realIndex; 13716 }; 13717 if (typeof activeIndex === 'undefined') { 13718 activeIndex = getActiveIndexByTranslate(swiper); 13719 } 13720 if (snapGrid.indexOf(translate) >= 0) { 13721 snapIndex = snapGrid.indexOf(translate); 13722 } else { 13723 const skip = Math.min(params.slidesPerGroupSkip, activeIndex); 13724 snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup); 13725 } 13726 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 13727 if (activeIndex === previousIndex && !swiper.params.loop) { 13728 if (snapIndex !== previousSnapIndex) { 13729 swiper.snapIndex = snapIndex; 13730 swiper.emit('snapIndexChange'); 13731 } 13732 return; 13733 } 13734 if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 13735 swiper.realIndex = getVirtualRealIndex(activeIndex); 13736 return; 13737 } 13738 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 13739 13740 // Get real index 13741 let realIndex; 13742 if (swiper.virtual && params.virtual.enabled && params.loop) { 13743 realIndex = getVirtualRealIndex(activeIndex); 13744 } else if (gridEnabled) { 13745 const firstSlideInColumn = swiper.slides.find(slideEl => slideEl.column === activeIndex); 13746 let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10); 13747 if (Number.isNaN(activeSlideIndex)) { 13748 activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0); 13749 } 13750 realIndex = Math.floor(activeSlideIndex / params.grid.rows); 13751 } else if (swiper.slides[activeIndex]) { 13752 const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index'); 13753 if (slideIndex) { 13754 realIndex = parseInt(slideIndex, 10); 13755 } else { 13756 realIndex = activeIndex; 13757 } 13758 } else { 13759 realIndex = activeIndex; 13760 } 13761 Object.assign(swiper, { 13762 previousSnapIndex, 13763 snapIndex, 13764 previousRealIndex, 13765 realIndex, 13766 previousIndex, 13767 activeIndex 13768 }); 13769 if (swiper.initialized) { 13770 preload(swiper); 13771 } 13772 swiper.emit('activeIndexChange'); 13773 swiper.emit('snapIndexChange'); 13774 if (swiper.initialized || swiper.params.runCallbacksOnInit) { 13775 if (previousRealIndex !== realIndex) { 13776 swiper.emit('realIndexChange'); 13777 } 13778 swiper.emit('slideChange'); 13779 } 13780} 13781 13782function updateClickedSlide(el, path) { 13783 const swiper = this; 13784 const params = swiper.params; 13785 let slide = el.closest(`.${params.slideClass}, swiper-slide`); 13786 if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) { 13787 [...path.slice(path.indexOf(el) + 1, path.length)].forEach(pathEl => { 13788 if (!slide && pathEl.matches && pathEl.matches(`.${params.slideClass}, swiper-slide`)) { 13789 slide = pathEl; 13790 } 13791 }); 13792 } 13793 let slideFound = false; 13794 let slideIndex; 13795 if (slide) { 13796 for (let i = 0; i < swiper.slides.length; i += 1) { 13797 if (swiper.slides[i] === slide) { 13798 slideFound = true; 13799 slideIndex = i; 13800 break; 13801 } 13802 } 13803 } 13804 if (slide && slideFound) { 13805 swiper.clickedSlide = slide; 13806 if (swiper.virtual && swiper.params.virtual.enabled) { 13807 swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10); 13808 } else { 13809 swiper.clickedIndex = slideIndex; 13810 } 13811 } else { 13812 swiper.clickedSlide = undefined; 13813 swiper.clickedIndex = undefined; 13814 return; 13815 } 13816 if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) { 13817 swiper.slideToClickedSlide(); 13818 } 13819} 13820 13821var update = { 13822 updateSize, 13823 updateSlides, 13824 updateAutoHeight, 13825 updateSlidesOffset, 13826 updateSlidesProgress, 13827 updateProgress, 13828 updateSlidesClasses, 13829 updateActiveIndex, 13830 updateClickedSlide 13831}; 13832 13833function getSwiperTranslate(axis) { 13834 if (axis === void 0) { 13835 axis = this.isHorizontal() ? 'x' : 'y'; 13836 } 13837 const swiper = this; 13838 const { 13839 params, 13840 rtlTranslate: rtl, 13841 translate, 13842 wrapperEl 13843 } = swiper; 13844 if (params.virtualTranslate) { 13845 return rtl ? -translate : translate; 13846 } 13847 if (params.cssMode) { 13848 return translate; 13849 } 13850 let currentTranslate = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.k)(wrapperEl, axis); 13851 currentTranslate += swiper.cssOverflowAdjustment(); 13852 if (rtl) currentTranslate = -currentTranslate; 13853 return currentTranslate || 0; 13854} 13855 13856function setTranslate(translate, byController) { 13857 const swiper = this; 13858 const { 13859 rtlTranslate: rtl, 13860 params, 13861 wrapperEl, 13862 progress 13863 } = swiper; 13864 let x = 0; 13865 let y = 0; 13866 const z = 0; 13867 if (swiper.isHorizontal()) { 13868 x = rtl ? -translate : translate; 13869 } else { 13870 y = translate; 13871 } 13872 if (params.roundLengths) { 13873 x = Math.floor(x); 13874 y = Math.floor(y); 13875 } 13876 swiper.previousTranslate = swiper.translate; 13877 swiper.translate = swiper.isHorizontal() ? x : y; 13878 if (params.cssMode) { 13879 wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y; 13880 } else if (!params.virtualTranslate) { 13881 if (swiper.isHorizontal()) { 13882 x -= swiper.cssOverflowAdjustment(); 13883 } else { 13884 y -= swiper.cssOverflowAdjustment(); 13885 } 13886 wrapperEl.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`; 13887 } 13888 13889 // Check if we need to update progress 13890 let newProgress; 13891 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 13892 if (translatesDiff === 0) { 13893 newProgress = 0; 13894 } else { 13895 newProgress = (translate - swiper.minTranslate()) / translatesDiff; 13896 } 13897 if (newProgress !== progress) { 13898 swiper.updateProgress(translate); 13899 } 13900 swiper.emit('setTranslate', swiper.translate, byController); 13901} 13902 13903function minTranslate() { 13904 return -this.snapGrid[0]; 13905} 13906 13907function maxTranslate() { 13908 return -this.snapGrid[this.snapGrid.length - 1]; 13909} 13910 13911function translateTo(translate, speed, runCallbacks, translateBounds, internal) { 13912 if (translate === void 0) { 13913 translate = 0; 13914 } 13915 if (speed === void 0) { 13916 speed = this.params.speed; 13917 } 13918 if (runCallbacks === void 0) { 13919 runCallbacks = true; 13920 } 13921 if (translateBounds === void 0) { 13922 translateBounds = true; 13923 } 13924 const swiper = this; 13925 const { 13926 params, 13927 wrapperEl 13928 } = swiper; 13929 if (swiper.animating && params.preventInteractionOnTransition) { 13930 return false; 13931 } 13932 const minTranslate = swiper.minTranslate(); 13933 const maxTranslate = swiper.maxTranslate(); 13934 let newTranslate; 13935 if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; 13936 13937 // Update progress 13938 swiper.updateProgress(newTranslate); 13939 if (params.cssMode) { 13940 const isH = swiper.isHorizontal(); 13941 if (speed === 0) { 13942 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; 13943 } else { 13944 if (!swiper.support.smoothScroll) { 13945 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.u)({ 13946 swiper, 13947 targetPosition: -newTranslate, 13948 side: isH ? 'left' : 'top' 13949 }); 13950 return true; 13951 } 13952 wrapperEl.scrollTo({ 13953 [isH ? 'left' : 'top']: -newTranslate, 13954 behavior: 'smooth' 13955 }); 13956 } 13957 return true; 13958 } 13959 if (speed === 0) { 13960 swiper.setTransition(0); 13961 swiper.setTranslate(newTranslate); 13962 if (runCallbacks) { 13963 swiper.emit('beforeTransitionStart', speed, internal); 13964 swiper.emit('transitionEnd'); 13965 } 13966 } else { 13967 swiper.setTransition(speed); 13968 swiper.setTranslate(newTranslate); 13969 if (runCallbacks) { 13970 swiper.emit('beforeTransitionStart', speed, internal); 13971 swiper.emit('transitionStart'); 13972 } 13973 if (!swiper.animating) { 13974 swiper.animating = true; 13975 if (!swiper.onTranslateToWrapperTransitionEnd) { 13976 swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) { 13977 if (!swiper || swiper.destroyed) return; 13978 if (e.target !== this) return; 13979 swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 13980 swiper.onTranslateToWrapperTransitionEnd = null; 13981 delete swiper.onTranslateToWrapperTransitionEnd; 13982 swiper.animating = false; 13983 if (runCallbacks) { 13984 swiper.emit('transitionEnd'); 13985 } 13986 }; 13987 } 13988 swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 13989 } 13990 } 13991 return true; 13992} 13993 13994var translate = { 13995 getTranslate: getSwiperTranslate, 13996 setTranslate, 13997 minTranslate, 13998 maxTranslate, 13999 translateTo 14000}; 14001 14002function setTransition(duration, byController) { 14003 const swiper = this; 14004 if (!swiper.params.cssMode) { 14005 swiper.wrapperEl.style.transitionDuration = `${duration}ms`; 14006 swiper.wrapperEl.style.transitionDelay = duration === 0 ? `0ms` : ''; 14007 } 14008 swiper.emit('setTransition', duration, byController); 14009} 14010 14011function transitionEmit(_ref) { 14012 let { 14013 swiper, 14014 runCallbacks, 14015 direction, 14016 step 14017 } = _ref; 14018 const { 14019 activeIndex, 14020 previousIndex 14021 } = swiper; 14022 let dir = direction; 14023 if (!dir) { 14024 if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset'; 14025 } 14026 swiper.emit(`transition${step}`); 14027 if (runCallbacks && dir === 'reset') { 14028 swiper.emit(`slideResetTransition${step}`); 14029 } else if (runCallbacks && activeIndex !== previousIndex) { 14030 swiper.emit(`slideChangeTransition${step}`); 14031 if (dir === 'next') { 14032 swiper.emit(`slideNextTransition${step}`); 14033 } else { 14034 swiper.emit(`slidePrevTransition${step}`); 14035 } 14036 } 14037} 14038 14039function transitionStart(runCallbacks, direction) { 14040 if (runCallbacks === void 0) { 14041 runCallbacks = true; 14042 } 14043 const swiper = this; 14044 const { 14045 params 14046 } = swiper; 14047 if (params.cssMode) return; 14048 if (params.autoHeight) { 14049 swiper.updateAutoHeight(); 14050 } 14051 transitionEmit({ 14052 swiper, 14053 runCallbacks, 14054 direction, 14055 step: 'Start' 14056 }); 14057} 14058 14059function transitionEnd(runCallbacks, direction) { 14060 if (runCallbacks === void 0) { 14061 runCallbacks = true; 14062 } 14063 const swiper = this; 14064 const { 14065 params 14066 } = swiper; 14067 swiper.animating = false; 14068 if (params.cssMode) return; 14069 swiper.setTransition(0); 14070 transitionEmit({ 14071 swiper, 14072 runCallbacks, 14073 direction, 14074 step: 'End' 14075 }); 14076} 14077 14078var transition = { 14079 setTransition, 14080 transitionStart, 14081 transitionEnd 14082}; 14083 14084function slideTo(index, speed, runCallbacks, internal, initial) { 14085 if (index === void 0) { 14086 index = 0; 14087 } 14088 if (runCallbacks === void 0) { 14089 runCallbacks = true; 14090 } 14091 if (typeof index === 'string') { 14092 index = parseInt(index, 10); 14093 } 14094 const swiper = this; 14095 let slideIndex = index; 14096 if (slideIndex < 0) slideIndex = 0; 14097 const { 14098 params, 14099 snapGrid, 14100 slidesGrid, 14101 previousIndex, 14102 activeIndex, 14103 rtlTranslate: rtl, 14104 wrapperEl, 14105 enabled 14106 } = swiper; 14107 if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) { 14108 return false; 14109 } 14110 if (typeof speed === 'undefined') { 14111 speed = swiper.params.speed; 14112 } 14113 const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex); 14114 let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup); 14115 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 14116 const translate = -snapGrid[snapIndex]; 14117 // Normalize slideIndex 14118 if (params.normalizeSlideIndex) { 14119 for (let i = 0; i < slidesGrid.length; i += 1) { 14120 const normalizedTranslate = -Math.floor(translate * 100); 14121 const normalizedGrid = Math.floor(slidesGrid[i] * 100); 14122 const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100); 14123 if (typeof slidesGrid[i + 1] !== 'undefined') { 14124 if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) { 14125 slideIndex = i; 14126 } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) { 14127 slideIndex = i + 1; 14128 } 14129 } else if (normalizedTranslate >= normalizedGrid) { 14130 slideIndex = i; 14131 } 14132 } 14133 } 14134 // Directions locks 14135 if (swiper.initialized && slideIndex !== activeIndex) { 14136 if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) { 14137 return false; 14138 } 14139 if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) { 14140 if ((activeIndex || 0) !== slideIndex) { 14141 return false; 14142 } 14143 } 14144 } 14145 if (slideIndex !== (previousIndex || 0) && runCallbacks) { 14146 swiper.emit('beforeSlideChangeStart'); 14147 } 14148 14149 // Update progress 14150 swiper.updateProgress(translate); 14151 let direction; 14152 if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; 14153 14154 // initial virtual 14155 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 14156 const isInitialVirtual = isVirtual && initial; 14157 // Update Index 14158 if (!isInitialVirtual && (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate)) { 14159 swiper.updateActiveIndex(slideIndex); 14160 // Update Height 14161 if (params.autoHeight) { 14162 swiper.updateAutoHeight(); 14163 } 14164 swiper.updateSlidesClasses(); 14165 if (params.effect !== 'slide') { 14166 swiper.setTranslate(translate); 14167 } 14168 if (direction !== 'reset') { 14169 swiper.transitionStart(runCallbacks, direction); 14170 swiper.transitionEnd(runCallbacks, direction); 14171 } 14172 return false; 14173 } 14174 if (params.cssMode) { 14175 const isH = swiper.isHorizontal(); 14176 const t = rtl ? translate : -translate; 14177 if (speed === 0) { 14178 if (isVirtual) { 14179 swiper.wrapperEl.style.scrollSnapType = 'none'; 14180 swiper._immediateVirtual = true; 14181 } 14182 if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) { 14183 swiper._cssModeVirtualInitialSet = true; 14184 requestAnimationFrame(() => { 14185 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 14186 }); 14187 } else { 14188 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 14189 } 14190 if (isVirtual) { 14191 requestAnimationFrame(() => { 14192 swiper.wrapperEl.style.scrollSnapType = ''; 14193 swiper._immediateVirtual = false; 14194 }); 14195 } 14196 } else { 14197 if (!swiper.support.smoothScroll) { 14198 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.u)({ 14199 swiper, 14200 targetPosition: t, 14201 side: isH ? 'left' : 'top' 14202 }); 14203 return true; 14204 } 14205 wrapperEl.scrollTo({ 14206 [isH ? 'left' : 'top']: t, 14207 behavior: 'smooth' 14208 }); 14209 } 14210 return true; 14211 } 14212 const browser = getBrowser(); 14213 const isSafari = browser.isSafari; 14214 if (isVirtual && !initial && isSafari && swiper.isElement) { 14215 swiper.virtual.update(false, false, slideIndex); 14216 } 14217 swiper.setTransition(speed); 14218 swiper.setTranslate(translate); 14219 swiper.updateActiveIndex(slideIndex); 14220 swiper.updateSlidesClasses(); 14221 swiper.emit('beforeTransitionStart', speed, internal); 14222 swiper.transitionStart(runCallbacks, direction); 14223 if (speed === 0) { 14224 swiper.transitionEnd(runCallbacks, direction); 14225 } else if (!swiper.animating) { 14226 swiper.animating = true; 14227 if (!swiper.onSlideToWrapperTransitionEnd) { 14228 swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) { 14229 if (!swiper || swiper.destroyed) return; 14230 if (e.target !== this) return; 14231 swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 14232 swiper.onSlideToWrapperTransitionEnd = null; 14233 delete swiper.onSlideToWrapperTransitionEnd; 14234 swiper.transitionEnd(runCallbacks, direction); 14235 }; 14236 } 14237 swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 14238 } 14239 return true; 14240} 14241 14242function slideToLoop(index, speed, runCallbacks, internal) { 14243 if (index === void 0) { 14244 index = 0; 14245 } 14246 if (runCallbacks === void 0) { 14247 runCallbacks = true; 14248 } 14249 if (typeof index === 'string') { 14250 const indexAsNumber = parseInt(index, 10); 14251 index = indexAsNumber; 14252 } 14253 const swiper = this; 14254 if (swiper.destroyed) return; 14255 if (typeof speed === 'undefined') { 14256 speed = swiper.params.speed; 14257 } 14258 const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1; 14259 let newIndex = index; 14260 if (swiper.params.loop) { 14261 if (swiper.virtual && swiper.params.virtual.enabled) { 14262 // eslint-disable-next-line 14263 newIndex = newIndex + swiper.virtual.slidesBefore; 14264 } else { 14265 let targetSlideIndex; 14266 if (gridEnabled) { 14267 const slideIndex = newIndex * swiper.params.grid.rows; 14268 targetSlideIndex = swiper.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex).column; 14269 } else { 14270 targetSlideIndex = swiper.getSlideIndexByData(newIndex); 14271 } 14272 const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length; 14273 const { 14274 centeredSlides 14275 } = swiper.params; 14276 let slidesPerView = swiper.params.slidesPerView; 14277 if (slidesPerView === 'auto') { 14278 slidesPerView = swiper.slidesPerViewDynamic(); 14279 } else { 14280 slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10)); 14281 if (centeredSlides && slidesPerView % 2 === 0) { 14282 slidesPerView = slidesPerView + 1; 14283 } 14284 } 14285 let needLoopFix = cols - targetSlideIndex < slidesPerView; 14286 if (centeredSlides) { 14287 needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2); 14288 } 14289 if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) { 14290 needLoopFix = false; 14291 } 14292 if (needLoopFix) { 14293 const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev'; 14294 swiper.loopFix({ 14295 direction, 14296 slideTo: true, 14297 activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1, 14298 slideRealIndex: direction === 'next' ? swiper.realIndex : undefined 14299 }); 14300 } 14301 if (gridEnabled) { 14302 const slideIndex = newIndex * swiper.params.grid.rows; 14303 newIndex = swiper.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex).column; 14304 } else { 14305 newIndex = swiper.getSlideIndexByData(newIndex); 14306 } 14307 } 14308 } 14309 requestAnimationFrame(() => { 14310 swiper.slideTo(newIndex, speed, runCallbacks, internal); 14311 }); 14312 return swiper; 14313} 14314 14315/* eslint no-unused-vars: "off" */ 14316function slideNext(speed, runCallbacks, internal) { 14317 if (runCallbacks === void 0) { 14318 runCallbacks = true; 14319 } 14320 const swiper = this; 14321 const { 14322 enabled, 14323 params, 14324 animating 14325 } = swiper; 14326 if (!enabled || swiper.destroyed) return swiper; 14327 if (typeof speed === 'undefined') { 14328 speed = swiper.params.speed; 14329 } 14330 let perGroup = params.slidesPerGroup; 14331 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 14332 perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1); 14333 } 14334 const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup; 14335 const isVirtual = swiper.virtual && params.virtual.enabled; 14336 if (params.loop) { 14337 if (animating && !isVirtual && params.loopPreventsSliding) return false; 14338 swiper.loopFix({ 14339 direction: 'next' 14340 }); 14341 // eslint-disable-next-line 14342 swiper._clientLeft = swiper.wrapperEl.clientLeft; 14343 if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) { 14344 requestAnimationFrame(() => { 14345 swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 14346 }); 14347 return true; 14348 } 14349 } 14350 if (params.rewind && swiper.isEnd) { 14351 return swiper.slideTo(0, speed, runCallbacks, internal); 14352 } 14353 return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 14354} 14355 14356/* eslint no-unused-vars: "off" */ 14357function slidePrev(speed, runCallbacks, internal) { 14358 if (runCallbacks === void 0) { 14359 runCallbacks = true; 14360 } 14361 const swiper = this; 14362 const { 14363 params, 14364 snapGrid, 14365 slidesGrid, 14366 rtlTranslate, 14367 enabled, 14368 animating 14369 } = swiper; 14370 if (!enabled || swiper.destroyed) return swiper; 14371 if (typeof speed === 'undefined') { 14372 speed = swiper.params.speed; 14373 } 14374 const isVirtual = swiper.virtual && params.virtual.enabled; 14375 if (params.loop) { 14376 if (animating && !isVirtual && params.loopPreventsSliding) return false; 14377 swiper.loopFix({ 14378 direction: 'prev' 14379 }); 14380 // eslint-disable-next-line 14381 swiper._clientLeft = swiper.wrapperEl.clientLeft; 14382 } 14383 const translate = rtlTranslate ? swiper.translate : -swiper.translate; 14384 function normalize(val) { 14385 if (val < 0) return -Math.floor(Math.abs(val)); 14386 return Math.floor(val); 14387 } 14388 const normalizedTranslate = normalize(translate); 14389 const normalizedSnapGrid = snapGrid.map(val => normalize(val)); 14390 const isFreeMode = params.freeMode && params.freeMode.enabled; 14391 let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; 14392 if (typeof prevSnap === 'undefined' && (params.cssMode || isFreeMode)) { 14393 let prevSnapIndex; 14394 snapGrid.forEach((snap, snapIndex) => { 14395 if (normalizedTranslate >= snap) { 14396 // prevSnap = snap; 14397 prevSnapIndex = snapIndex; 14398 } 14399 }); 14400 if (typeof prevSnapIndex !== 'undefined') { 14401 prevSnap = isFreeMode ? snapGrid[prevSnapIndex] : snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex]; 14402 } 14403 } 14404 let prevIndex = 0; 14405 if (typeof prevSnap !== 'undefined') { 14406 prevIndex = slidesGrid.indexOf(prevSnap); 14407 if (prevIndex < 0) prevIndex = swiper.activeIndex - 1; 14408 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 14409 prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1; 14410 prevIndex = Math.max(prevIndex, 0); 14411 } 14412 } 14413 if (params.rewind && swiper.isBeginning) { 14414 const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 14415 return swiper.slideTo(lastIndex, speed, runCallbacks, internal); 14416 } else if (params.loop && swiper.activeIndex === 0 && params.cssMode) { 14417 requestAnimationFrame(() => { 14418 swiper.slideTo(prevIndex, speed, runCallbacks, internal); 14419 }); 14420 return true; 14421 } 14422 return swiper.slideTo(prevIndex, speed, runCallbacks, internal); 14423} 14424 14425/* eslint no-unused-vars: "off" */ 14426function slideReset(speed, runCallbacks, internal) { 14427 if (runCallbacks === void 0) { 14428 runCallbacks = true; 14429 } 14430 const swiper = this; 14431 if (swiper.destroyed) return; 14432 if (typeof speed === 'undefined') { 14433 speed = swiper.params.speed; 14434 } 14435 return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); 14436} 14437 14438/* eslint no-unused-vars: "off" */ 14439function slideToClosest(speed, runCallbacks, internal, threshold) { 14440 if (runCallbacks === void 0) { 14441 runCallbacks = true; 14442 } 14443 if (threshold === void 0) { 14444 threshold = 0.5; 14445 } 14446 const swiper = this; 14447 if (swiper.destroyed) return; 14448 if (typeof speed === 'undefined') { 14449 speed = swiper.params.speed; 14450 } 14451 let index = swiper.activeIndex; 14452 const skip = Math.min(swiper.params.slidesPerGroupSkip, index); 14453 const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup); 14454 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 14455 if (translate >= swiper.snapGrid[snapIndex]) { 14456 // The current translate is on or after the current snap index, so the choice 14457 // is between the current index and the one after it. 14458 const currentSnap = swiper.snapGrid[snapIndex]; 14459 const nextSnap = swiper.snapGrid[snapIndex + 1]; 14460 if (translate - currentSnap > (nextSnap - currentSnap) * threshold) { 14461 index += swiper.params.slidesPerGroup; 14462 } 14463 } else { 14464 // The current translate is before the current snap index, so the choice 14465 // is between the current index and the one before it. 14466 const prevSnap = swiper.snapGrid[snapIndex - 1]; 14467 const currentSnap = swiper.snapGrid[snapIndex]; 14468 if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) { 14469 index -= swiper.params.slidesPerGroup; 14470 } 14471 } 14472 index = Math.max(index, 0); 14473 index = Math.min(index, swiper.slidesGrid.length - 1); 14474 return swiper.slideTo(index, speed, runCallbacks, internal); 14475} 14476 14477function slideToClickedSlide() { 14478 const swiper = this; 14479 if (swiper.destroyed) return; 14480 const { 14481 params, 14482 slidesEl 14483 } = swiper; 14484 const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView; 14485 let slideToIndex = swiper.getSlideIndexWhenGrid(swiper.clickedIndex); 14486 let realIndex; 14487 const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`; 14488 const isGrid = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1; 14489 if (params.loop) { 14490 if (swiper.animating) return; 14491 realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10); 14492 if (params.centeredSlides) { 14493 swiper.slideToLoop(realIndex); 14494 } else if (slideToIndex > (isGrid ? (swiper.slides.length - slidesPerView) / 2 - (swiper.params.grid.rows - 1) : swiper.slides.length - slidesPerView)) { 14495 swiper.loopFix(); 14496 slideToIndex = swiper.getSlideIndex((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]); 14497 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.n)(() => { 14498 swiper.slideTo(slideToIndex); 14499 }); 14500 } else { 14501 swiper.slideTo(slideToIndex); 14502 } 14503 } else { 14504 swiper.slideTo(slideToIndex); 14505 } 14506} 14507 14508var slide = { 14509 slideTo, 14510 slideToLoop, 14511 slideNext, 14512 slidePrev, 14513 slideReset, 14514 slideToClosest, 14515 slideToClickedSlide 14516}; 14517 14518function loopCreate(slideRealIndex, initial) { 14519 const swiper = this; 14520 const { 14521 params, 14522 slidesEl 14523 } = swiper; 14524 if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return; 14525 const initSlides = () => { 14526 const slides = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(slidesEl, `.${params.slideClass}, swiper-slide`); 14527 slides.forEach((el, index) => { 14528 el.setAttribute('data-swiper-slide-index', index); 14529 }); 14530 }; 14531 const clearBlankSlides = () => { 14532 const slides = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(slidesEl, `.${params.slideBlankClass}`); 14533 slides.forEach(el => { 14534 el.remove(); 14535 }); 14536 if (slides.length > 0) { 14537 swiper.recalcSlides(); 14538 swiper.updateSlides(); 14539 } 14540 }; 14541 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 14542 if (params.loopAddBlankSlides && (params.slidesPerGroup > 1 || gridEnabled)) { 14543 clearBlankSlides(); 14544 } 14545 const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1); 14546 const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0; 14547 const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0; 14548 const addBlankSlides = amountOfSlides => { 14549 for (let i = 0; i < amountOfSlides; i += 1) { 14550 const slideEl = swiper.isElement ? (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.c)('swiper-slide', [params.slideBlankClass]) : (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.c)('div', [params.slideClass, params.slideBlankClass]); 14551 swiper.slidesEl.append(slideEl); 14552 } 14553 }; 14554 if (shouldFillGroup) { 14555 if (params.loopAddBlankSlides) { 14556 const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup; 14557 addBlankSlides(slidesToAdd); 14558 swiper.recalcSlides(); 14559 swiper.updateSlides(); 14560 } else { 14561 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.v)('Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)'); 14562 } 14563 initSlides(); 14564 } else if (shouldFillGrid) { 14565 if (params.loopAddBlankSlides) { 14566 const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows; 14567 addBlankSlides(slidesToAdd); 14568 swiper.recalcSlides(); 14569 swiper.updateSlides(); 14570 } else { 14571 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.v)('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)'); 14572 } 14573 initSlides(); 14574 } else { 14575 initSlides(); 14576 } 14577 swiper.loopFix({ 14578 slideRealIndex, 14579 direction: params.centeredSlides ? undefined : 'next', 14580 initial 14581 }); 14582} 14583 14584function loopFix(_temp) { 14585 let { 14586 slideRealIndex, 14587 slideTo = true, 14588 direction, 14589 setTranslate, 14590 activeSlideIndex, 14591 initial, 14592 byController, 14593 byMousewheel 14594 } = _temp === void 0 ? {} : _temp; 14595 const swiper = this; 14596 if (!swiper.params.loop) return; 14597 swiper.emit('beforeLoopFix'); 14598 const { 14599 slides, 14600 allowSlidePrev, 14601 allowSlideNext, 14602 slidesEl, 14603 params 14604 } = swiper; 14605 const { 14606 centeredSlides, 14607 initialSlide 14608 } = params; 14609 swiper.allowSlidePrev = true; 14610 swiper.allowSlideNext = true; 14611 if (swiper.virtual && params.virtual.enabled) { 14612 if (slideTo) { 14613 if (!params.centeredSlides && swiper.snapIndex === 0) { 14614 swiper.slideTo(swiper.virtual.slides.length, 0, false, true); 14615 } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) { 14616 swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true); 14617 } else if (swiper.snapIndex === swiper.snapGrid.length - 1) { 14618 swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true); 14619 } 14620 } 14621 swiper.allowSlidePrev = allowSlidePrev; 14622 swiper.allowSlideNext = allowSlideNext; 14623 swiper.emit('loopFix'); 14624 return; 14625 } 14626 let slidesPerView = params.slidesPerView; 14627 if (slidesPerView === 'auto') { 14628 slidesPerView = swiper.slidesPerViewDynamic(); 14629 } else { 14630 slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10)); 14631 if (centeredSlides && slidesPerView % 2 === 0) { 14632 slidesPerView = slidesPerView + 1; 14633 } 14634 } 14635 const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup; 14636 let loopedSlides = centeredSlides ? Math.max(slidesPerGroup, Math.ceil(slidesPerView / 2)) : slidesPerGroup; 14637 if (loopedSlides % slidesPerGroup !== 0) { 14638 loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup; 14639 } 14640 loopedSlides += params.loopAdditionalSlides; 14641 swiper.loopedSlides = loopedSlides; 14642 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 14643 if (slides.length < slidesPerView + loopedSlides || swiper.params.effect === 'cards' && slides.length < slidesPerView + loopedSlides * 2) { 14644 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.v)('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'); 14645 } else if (gridEnabled && params.grid.fill === 'row') { 14646 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.v)('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`'); 14647 } 14648 const prependSlidesIndexes = []; 14649 const appendSlidesIndexes = []; 14650 const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length; 14651 const isInitialOverflow = initial && cols - initialSlide < slidesPerView && !centeredSlides; 14652 let activeIndex = isInitialOverflow ? initialSlide : swiper.activeIndex; 14653 if (typeof activeSlideIndex === 'undefined') { 14654 activeSlideIndex = swiper.getSlideIndex(slides.find(el => el.classList.contains(params.slideActiveClass))); 14655 } else { 14656 activeIndex = activeSlideIndex; 14657 } 14658 const isNext = direction === 'next' || !direction; 14659 const isPrev = direction === 'prev' || !direction; 14660 let slidesPrepended = 0; 14661 let slidesAppended = 0; 14662 const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex; 14663 const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0); 14664 // prepend last slides before start 14665 if (activeColIndexWithShift < loopedSlides) { 14666 slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup); 14667 for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) { 14668 const index = i - Math.floor(i / cols) * cols; 14669 if (gridEnabled) { 14670 const colIndexToPrepend = cols - index - 1; 14671 for (let i = slides.length - 1; i >= 0; i -= 1) { 14672 if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i); 14673 } 14674 // slides.forEach((slide, slideIndex) => { 14675 // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex); 14676 // }); 14677 } else { 14678 prependSlidesIndexes.push(cols - index - 1); 14679 } 14680 } 14681 } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) { 14682 slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup); 14683 if (isInitialOverflow) { 14684 slidesAppended = Math.max(slidesAppended, slidesPerView - cols + initialSlide + 1); 14685 } 14686 for (let i = 0; i < slidesAppended; i += 1) { 14687 const index = i - Math.floor(i / cols) * cols; 14688 if (gridEnabled) { 14689 slides.forEach((slide, slideIndex) => { 14690 if (slide.column === index) appendSlidesIndexes.push(slideIndex); 14691 }); 14692 } else { 14693 appendSlidesIndexes.push(index); 14694 } 14695 } 14696 } 14697 swiper.__preventObserver__ = true; 14698 requestAnimationFrame(() => { 14699 swiper.__preventObserver__ = false; 14700 }); 14701 if (swiper.params.effect === 'cards' && slides.length < slidesPerView + loopedSlides * 2) { 14702 if (appendSlidesIndexes.includes(activeSlideIndex)) { 14703 appendSlidesIndexes.splice(appendSlidesIndexes.indexOf(activeSlideIndex), 1); 14704 } 14705 if (prependSlidesIndexes.includes(activeSlideIndex)) { 14706 prependSlidesIndexes.splice(prependSlidesIndexes.indexOf(activeSlideIndex), 1); 14707 } 14708 } 14709 if (isPrev) { 14710 prependSlidesIndexes.forEach(index => { 14711 slides[index].swiperLoopMoveDOM = true; 14712 slidesEl.prepend(slides[index]); 14713 slides[index].swiperLoopMoveDOM = false; 14714 }); 14715 } 14716 if (isNext) { 14717 appendSlidesIndexes.forEach(index => { 14718 slides[index].swiperLoopMoveDOM = true; 14719 slidesEl.append(slides[index]); 14720 slides[index].swiperLoopMoveDOM = false; 14721 }); 14722 } 14723 swiper.recalcSlides(); 14724 if (params.slidesPerView === 'auto') { 14725 swiper.updateSlides(); 14726 } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) { 14727 swiper.slides.forEach((slide, slideIndex) => { 14728 swiper.grid.updateSlide(slideIndex, slide, swiper.slides); 14729 }); 14730 } 14731 if (params.watchSlidesProgress) { 14732 swiper.updateSlidesOffset(); 14733 } 14734 if (slideTo) { 14735 if (prependSlidesIndexes.length > 0 && isPrev) { 14736 if (typeof slideRealIndex === 'undefined') { 14737 const currentSlideTranslate = swiper.slidesGrid[activeIndex]; 14738 const newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended]; 14739 const diff = newSlideTranslate - currentSlideTranslate; 14740 if (byMousewheel) { 14741 swiper.setTranslate(swiper.translate - diff); 14742 } else { 14743 swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true); 14744 if (setTranslate) { 14745 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; 14746 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; 14747 } 14748 } 14749 } else { 14750 if (setTranslate) { 14751 const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length; 14752 swiper.slideTo(swiper.activeIndex + shift, 0, false, true); 14753 swiper.touchEventsData.currentTranslate = swiper.translate; 14754 } 14755 } 14756 } else if (appendSlidesIndexes.length > 0 && isNext) { 14757 if (typeof slideRealIndex === 'undefined') { 14758 const currentSlideTranslate = swiper.slidesGrid[activeIndex]; 14759 const newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended]; 14760 const diff = newSlideTranslate - currentSlideTranslate; 14761 if (byMousewheel) { 14762 swiper.setTranslate(swiper.translate - diff); 14763 } else { 14764 swiper.slideTo(activeIndex - slidesAppended, 0, false, true); 14765 if (setTranslate) { 14766 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; 14767 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; 14768 } 14769 } 14770 } else { 14771 const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length; 14772 swiper.slideTo(swiper.activeIndex - shift, 0, false, true); 14773 } 14774 } 14775 } 14776 swiper.allowSlidePrev = allowSlidePrev; 14777 swiper.allowSlideNext = allowSlideNext; 14778 if (swiper.controller && swiper.controller.control && !byController) { 14779 const loopParams = { 14780 slideRealIndex, 14781 direction, 14782 setTranslate, 14783 activeSlideIndex, 14784 byController: true 14785 }; 14786 if (Array.isArray(swiper.controller.control)) { 14787 swiper.controller.control.forEach(c => { 14788 if (!c.destroyed && c.params.loop) c.loopFix({ 14789 ...loopParams, 14790 slideTo: c.params.slidesPerView === params.slidesPerView ? slideTo : false 14791 }); 14792 }); 14793 } else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) { 14794 swiper.controller.control.loopFix({ 14795 ...loopParams, 14796 slideTo: swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false 14797 }); 14798 } 14799 } 14800 swiper.emit('loopFix'); 14801} 14802 14803function loopDestroy() { 14804 const swiper = this; 14805 const { 14806 params, 14807 slidesEl 14808 } = swiper; 14809 if (!params.loop || !slidesEl || swiper.virtual && swiper.params.virtual.enabled) return; 14810 swiper.recalcSlides(); 14811 const newSlidesOrder = []; 14812 swiper.slides.forEach(slideEl => { 14813 const index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex; 14814 newSlidesOrder[index] = slideEl; 14815 }); 14816 swiper.slides.forEach(slideEl => { 14817 slideEl.removeAttribute('data-swiper-slide-index'); 14818 }); 14819 newSlidesOrder.forEach(slideEl => { 14820 slidesEl.append(slideEl); 14821 }); 14822 swiper.recalcSlides(); 14823 swiper.slideTo(swiper.realIndex, 0); 14824} 14825 14826var loop = { 14827 loopCreate, 14828 loopFix, 14829 loopDestroy 14830}; 14831 14832function setGrabCursor(moving) { 14833 const swiper = this; 14834 if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; 14835 const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl; 14836 if (swiper.isElement) { 14837 swiper.__preventObserver__ = true; 14838 } 14839 el.style.cursor = 'move'; 14840 el.style.cursor = moving ? 'grabbing' : 'grab'; 14841 if (swiper.isElement) { 14842 requestAnimationFrame(() => { 14843 swiper.__preventObserver__ = false; 14844 }); 14845 } 14846} 14847 14848function unsetGrabCursor() { 14849 const swiper = this; 14850 if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) { 14851 return; 14852 } 14853 if (swiper.isElement) { 14854 swiper.__preventObserver__ = true; 14855 } 14856 swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = ''; 14857 if (swiper.isElement) { 14858 requestAnimationFrame(() => { 14859 swiper.__preventObserver__ = false; 14860 }); 14861 } 14862} 14863 14864var grabCursor = { 14865 setGrabCursor, 14866 unsetGrabCursor 14867}; 14868 14869// Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd 14870function closestElement(selector, base) { 14871 if (base === void 0) { 14872 base = this; 14873 } 14874 function __closestFrom(el) { 14875 if (!el || el === (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)() || el === (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)()) return null; 14876 if (el.assignedSlot) el = el.assignedSlot; 14877 const found = el.closest(selector); 14878 if (!found && !el.getRootNode) { 14879 return null; 14880 } 14881 return found || __closestFrom(el.getRootNode().host); 14882 } 14883 return __closestFrom(base); 14884} 14885function preventEdgeSwipe(swiper, event, startX) { 14886 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 14887 const { 14888 params 14889 } = swiper; 14890 const edgeSwipeDetection = params.edgeSwipeDetection; 14891 const edgeSwipeThreshold = params.edgeSwipeThreshold; 14892 if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) { 14893 if (edgeSwipeDetection === 'prevent') { 14894 event.preventDefault(); 14895 return true; 14896 } 14897 return false; 14898 } 14899 return true; 14900} 14901function onTouchStart(event) { 14902 const swiper = this; 14903 const document = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 14904 let e = event; 14905 if (e.originalEvent) e = e.originalEvent; 14906 const data = swiper.touchEventsData; 14907 if (e.type === 'pointerdown') { 14908 if (data.pointerId !== null && data.pointerId !== e.pointerId) { 14909 return; 14910 } 14911 data.pointerId = e.pointerId; 14912 } else if (e.type === 'touchstart' && e.targetTouches.length === 1) { 14913 data.touchId = e.targetTouches[0].identifier; 14914 } 14915 if (e.type === 'touchstart') { 14916 // don't proceed touch event 14917 preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX); 14918 return; 14919 } 14920 const { 14921 params, 14922 touches, 14923 enabled 14924 } = swiper; 14925 if (!enabled) return; 14926 if (!params.simulateTouch && e.pointerType === 'mouse') return; 14927 if (swiper.animating && params.preventInteractionOnTransition) { 14928 return; 14929 } 14930 if (!swiper.animating && params.cssMode && params.loop) { 14931 swiper.loopFix(); 14932 } 14933 let targetEl = e.target; 14934 if (params.touchEventsTarget === 'wrapper') { 14935 if (!(0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.w)(targetEl, swiper.wrapperEl)) return; 14936 } 14937 if ('which' in e && e.which === 3) return; 14938 if ('button' in e && e.button > 0) return; 14939 if (data.isTouched && data.isMoved) return; 14940 14941 // change target el for shadow root component 14942 const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; 14943 // eslint-disable-next-line 14944 const eventPath = e.composedPath ? e.composedPath() : e.path; 14945 if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) { 14946 targetEl = eventPath[0]; 14947 } 14948 const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`; 14949 const isTargetShadow = !!(e.target && e.target.shadowRoot); 14950 14951 // use closestElement for shadow root element to get the actual closest for nested shadow root element 14952 if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) { 14953 swiper.allowClick = true; 14954 return; 14955 } 14956 if (params.swipeHandler) { 14957 if (!targetEl.closest(params.swipeHandler)) return; 14958 } 14959 touches.currentX = e.pageX; 14960 touches.currentY = e.pageY; 14961 const startX = touches.currentX; 14962 const startY = touches.currentY; 14963 14964 // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore 14965 14966 if (!preventEdgeSwipe(swiper, e, startX)) { 14967 return; 14968 } 14969 Object.assign(data, { 14970 isTouched: true, 14971 isMoved: false, 14972 allowTouchCallbacks: true, 14973 isScrolling: undefined, 14974 startMoving: undefined 14975 }); 14976 touches.startX = startX; 14977 touches.startY = startY; 14978 data.touchStartTime = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.f)(); 14979 swiper.allowClick = true; 14980 swiper.updateSize(); 14981 swiper.swipeDirection = undefined; 14982 if (params.threshold > 0) data.allowThresholdMove = false; 14983 let preventDefault = true; 14984 if (targetEl.matches(data.focusableElements)) { 14985 preventDefault = false; 14986 if (targetEl.nodeName === 'SELECT') { 14987 data.isTouched = false; 14988 } 14989 } 14990 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl && (e.pointerType === 'mouse' || e.pointerType !== 'mouse' && !targetEl.matches(data.focusableElements))) { 14991 document.activeElement.blur(); 14992 } 14993 const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; 14994 if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) { 14995 e.preventDefault(); 14996 } 14997 if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) { 14998 swiper.freeMode.onTouchStart(); 14999 } 15000 swiper.emit('touchStart', e); 15001} 15002 15003function onTouchMove(event) { 15004 const document = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 15005 const swiper = this; 15006 const data = swiper.touchEventsData; 15007 const { 15008 params, 15009 touches, 15010 rtlTranslate: rtl, 15011 enabled 15012 } = swiper; 15013 if (!enabled) return; 15014 if (!params.simulateTouch && event.pointerType === 'mouse') return; 15015 let e = event; 15016 if (e.originalEvent) e = e.originalEvent; 15017 if (e.type === 'pointermove') { 15018 if (data.touchId !== null) return; // return from pointer if we use touch 15019 const id = e.pointerId; 15020 if (id !== data.pointerId) return; 15021 } 15022 let targetTouch; 15023 if (e.type === 'touchmove') { 15024 targetTouch = [...e.changedTouches].find(t => t.identifier === data.touchId); 15025 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 15026 } else { 15027 targetTouch = e; 15028 } 15029 if (!data.isTouched) { 15030 if (data.startMoving && data.isScrolling) { 15031 swiper.emit('touchMoveOpposite', e); 15032 } 15033 return; 15034 } 15035 const pageX = targetTouch.pageX; 15036 const pageY = targetTouch.pageY; 15037 if (e.preventedByNestedSwiper) { 15038 touches.startX = pageX; 15039 touches.startY = pageY; 15040 return; 15041 } 15042 if (!swiper.allowTouchMove) { 15043 if (!e.target.matches(data.focusableElements)) { 15044 swiper.allowClick = false; 15045 } 15046 if (data.isTouched) { 15047 Object.assign(touches, { 15048 startX: pageX, 15049 startY: pageY, 15050 currentX: pageX, 15051 currentY: pageY 15052 }); 15053 data.touchStartTime = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.f)(); 15054 } 15055 return; 15056 } 15057 if (params.touchReleaseOnEdges && !params.loop) { 15058 if (swiper.isVertical()) { 15059 // Vertical 15060 if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) { 15061 data.isTouched = false; 15062 data.isMoved = false; 15063 return; 15064 } 15065 } else if (rtl && (pageX > touches.startX && -swiper.translate <= swiper.maxTranslate() || pageX < touches.startX && -swiper.translate >= swiper.minTranslate())) { 15066 return; 15067 } else if (!rtl && (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate())) { 15068 return; 15069 } 15070 } 15071 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== e.target && e.pointerType !== 'mouse') { 15072 document.activeElement.blur(); 15073 } 15074 if (document.activeElement) { 15075 if (e.target === document.activeElement && e.target.matches(data.focusableElements)) { 15076 data.isMoved = true; 15077 swiper.allowClick = false; 15078 return; 15079 } 15080 } 15081 if (data.allowTouchCallbacks) { 15082 swiper.emit('touchMove', e); 15083 } 15084 touches.previousX = touches.currentX; 15085 touches.previousY = touches.currentY; 15086 touches.currentX = pageX; 15087 touches.currentY = pageY; 15088 const diffX = touches.currentX - touches.startX; 15089 const diffY = touches.currentY - touches.startY; 15090 if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return; 15091 if (typeof data.isScrolling === 'undefined') { 15092 let touchAngle; 15093 if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) { 15094 data.isScrolling = false; 15095 } else { 15096 // eslint-disable-next-line 15097 if (diffX * diffX + diffY * diffY >= 25) { 15098 touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI; 15099 data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle; 15100 } 15101 } 15102 } 15103 if (data.isScrolling) { 15104 swiper.emit('touchMoveOpposite', e); 15105 } 15106 if (typeof data.startMoving === 'undefined') { 15107 if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) { 15108 data.startMoving = true; 15109 } 15110 } 15111 if (data.isScrolling || e.type === 'touchmove' && data.preventTouchMoveFromPointerMove) { 15112 data.isTouched = false; 15113 return; 15114 } 15115 if (!data.startMoving) { 15116 return; 15117 } 15118 swiper.allowClick = false; 15119 if (!params.cssMode && e.cancelable) { 15120 e.preventDefault(); 15121 } 15122 if (params.touchMoveStopPropagation && !params.nested) { 15123 e.stopPropagation(); 15124 } 15125 let diff = swiper.isHorizontal() ? diffX : diffY; 15126 let touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY; 15127 if (params.oneWayMovement) { 15128 diff = Math.abs(diff) * (rtl ? 1 : -1); 15129 touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1); 15130 } 15131 touches.diff = diff; 15132 diff *= params.touchRatio; 15133 if (rtl) { 15134 diff = -diff; 15135 touchesDiff = -touchesDiff; 15136 } 15137 const prevTouchesDirection = swiper.touchesDirection; 15138 swiper.swipeDirection = diff > 0 ? 'prev' : 'next'; 15139 swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next'; 15140 const isLoop = swiper.params.loop && !params.cssMode; 15141 const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev; 15142 if (!data.isMoved) { 15143 if (isLoop && allowLoopFix) { 15144 swiper.loopFix({ 15145 direction: swiper.swipeDirection 15146 }); 15147 } 15148 data.startTranslate = swiper.getTranslate(); 15149 swiper.setTransition(0); 15150 if (swiper.animating) { 15151 const evt = new window.CustomEvent('transitionend', { 15152 bubbles: true, 15153 cancelable: true, 15154 detail: { 15155 bySwiperTouchMove: true 15156 } 15157 }); 15158 swiper.wrapperEl.dispatchEvent(evt); 15159 } 15160 data.allowMomentumBounce = false; 15161 // Grab Cursor 15162 if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 15163 swiper.setGrabCursor(true); 15164 } 15165 swiper.emit('sliderFirstMove', e); 15166 } 15167 let loopFixed; 15168 new Date().getTime(); 15169 if (params._loopSwapReset !== false && data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) { 15170 Object.assign(touches, { 15171 startX: pageX, 15172 startY: pageY, 15173 currentX: pageX, 15174 currentY: pageY, 15175 startTranslate: data.currentTranslate 15176 }); 15177 data.loopSwapReset = true; 15178 data.startTranslate = data.currentTranslate; 15179 return; 15180 } 15181 swiper.emit('sliderMove', e); 15182 data.isMoved = true; 15183 data.currentTranslate = diff + data.startTranslate; 15184 let disableParentSwiper = true; 15185 let resistanceRatio = params.resistanceRatio; 15186 if (params.touchReleaseOnEdges) { 15187 resistanceRatio = 0; 15188 } 15189 if (diff > 0) { 15190 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())) { 15191 swiper.loopFix({ 15192 direction: 'prev', 15193 setTranslate: true, 15194 activeSlideIndex: 0 15195 }); 15196 } 15197 if (data.currentTranslate > swiper.minTranslate()) { 15198 disableParentSwiper = false; 15199 if (params.resistance) { 15200 data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio; 15201 } 15202 } 15203 } else if (diff < 0) { 15204 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())) { 15205 swiper.loopFix({ 15206 direction: 'next', 15207 setTranslate: true, 15208 activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10))) 15209 }); 15210 } 15211 if (data.currentTranslate < swiper.maxTranslate()) { 15212 disableParentSwiper = false; 15213 if (params.resistance) { 15214 data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio; 15215 } 15216 } 15217 } 15218 if (disableParentSwiper) { 15219 e.preventedByNestedSwiper = true; 15220 } 15221 15222 // Directions locks 15223 if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) { 15224 data.currentTranslate = data.startTranslate; 15225 } 15226 if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) { 15227 data.currentTranslate = data.startTranslate; 15228 } 15229 if (!swiper.allowSlidePrev && !swiper.allowSlideNext) { 15230 data.currentTranslate = data.startTranslate; 15231 } 15232 15233 // Threshold 15234 if (params.threshold > 0) { 15235 if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { 15236 if (!data.allowThresholdMove) { 15237 data.allowThresholdMove = true; 15238 touches.startX = touches.currentX; 15239 touches.startY = touches.currentY; 15240 data.currentTranslate = data.startTranslate; 15241 touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; 15242 return; 15243 } 15244 } else { 15245 data.currentTranslate = data.startTranslate; 15246 return; 15247 } 15248 } 15249 if (!params.followFinger || params.cssMode) return; 15250 15251 // Update active index in free mode 15252 if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) { 15253 swiper.updateActiveIndex(); 15254 swiper.updateSlidesClasses(); 15255 } 15256 if (params.freeMode && params.freeMode.enabled && swiper.freeMode) { 15257 swiper.freeMode.onTouchMove(); 15258 } 15259 // Update progress 15260 swiper.updateProgress(data.currentTranslate); 15261 // Update translate 15262 swiper.setTranslate(data.currentTranslate); 15263} 15264 15265function onTouchEnd(event) { 15266 const swiper = this; 15267 const data = swiper.touchEventsData; 15268 let e = event; 15269 if (e.originalEvent) e = e.originalEvent; 15270 let targetTouch; 15271 const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel'; 15272 if (!isTouchEvent) { 15273 if (data.touchId !== null) return; // return from pointer if we use touch 15274 if (e.pointerId !== data.pointerId) return; 15275 targetTouch = e; 15276 } else { 15277 targetTouch = [...e.changedTouches].find(t => t.identifier === data.touchId); 15278 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 15279 } 15280 if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) { 15281 const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView); 15282 if (!proceed) { 15283 return; 15284 } 15285 } 15286 data.pointerId = null; 15287 data.touchId = null; 15288 const { 15289 params, 15290 touches, 15291 rtlTranslate: rtl, 15292 slidesGrid, 15293 enabled 15294 } = swiper; 15295 if (!enabled) return; 15296 if (!params.simulateTouch && e.pointerType === 'mouse') return; 15297 if (data.allowTouchCallbacks) { 15298 swiper.emit('touchEnd', e); 15299 } 15300 data.allowTouchCallbacks = false; 15301 if (!data.isTouched) { 15302 if (data.isMoved && params.grabCursor) { 15303 swiper.setGrabCursor(false); 15304 } 15305 data.isMoved = false; 15306 data.startMoving = false; 15307 return; 15308 } 15309 15310 // Return Grab Cursor 15311 if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 15312 swiper.setGrabCursor(false); 15313 } 15314 15315 // Time diff 15316 const touchEndTime = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.f)(); 15317 const timeDiff = touchEndTime - data.touchStartTime; 15318 15319 // Tap, doubleTap, Click 15320 if (swiper.allowClick) { 15321 const pathTree = e.path || e.composedPath && e.composedPath(); 15322 swiper.updateClickedSlide(pathTree && pathTree[0] || e.target, pathTree); 15323 swiper.emit('tap click', e); 15324 if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) { 15325 swiper.emit('doubleTap doubleClick', e); 15326 } 15327 } 15328 data.lastClickTime = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.f)(); 15329 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.n)(() => { 15330 if (!swiper.destroyed) swiper.allowClick = true; 15331 }); 15332 if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) { 15333 data.isTouched = false; 15334 data.isMoved = false; 15335 data.startMoving = false; 15336 return; 15337 } 15338 data.isTouched = false; 15339 data.isMoved = false; 15340 data.startMoving = false; 15341 let currentPos; 15342 if (params.followFinger) { 15343 currentPos = rtl ? swiper.translate : -swiper.translate; 15344 } else { 15345 currentPos = -data.currentTranslate; 15346 } 15347 if (params.cssMode) { 15348 return; 15349 } 15350 if (params.freeMode && params.freeMode.enabled) { 15351 swiper.freeMode.onTouchEnd({ 15352 currentPos 15353 }); 15354 return; 15355 } 15356 15357 // Find current slide 15358 const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop; 15359 let stopIndex = 0; 15360 let groupSize = swiper.slidesSizesGrid[0]; 15361 for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) { 15362 const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 15363 if (typeof slidesGrid[i + increment] !== 'undefined') { 15364 if (swipeToLast || currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) { 15365 stopIndex = i; 15366 groupSize = slidesGrid[i + increment] - slidesGrid[i]; 15367 } 15368 } else if (swipeToLast || currentPos >= slidesGrid[i]) { 15369 stopIndex = i; 15370 groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; 15371 } 15372 } 15373 let rewindFirstIndex = null; 15374 let rewindLastIndex = null; 15375 if (params.rewind) { 15376 if (swiper.isBeginning) { 15377 rewindLastIndex = params.virtual && params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 15378 } else if (swiper.isEnd) { 15379 rewindFirstIndex = 0; 15380 } 15381 } 15382 // Find current slide size 15383 const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; 15384 const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 15385 if (timeDiff > params.longSwipesMs) { 15386 // Long touches 15387 if (!params.longSwipes) { 15388 swiper.slideTo(swiper.activeIndex); 15389 return; 15390 } 15391 if (swiper.swipeDirection === 'next') { 15392 if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex); 15393 } 15394 if (swiper.swipeDirection === 'prev') { 15395 if (ratio > 1 - params.longSwipesRatio) { 15396 swiper.slideTo(stopIndex + increment); 15397 } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) { 15398 swiper.slideTo(rewindLastIndex); 15399 } else { 15400 swiper.slideTo(stopIndex); 15401 } 15402 } 15403 } else { 15404 // Short swipes 15405 if (!params.shortSwipes) { 15406 swiper.slideTo(swiper.activeIndex); 15407 return; 15408 } 15409 const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl); 15410 if (!isNavButtonTarget) { 15411 if (swiper.swipeDirection === 'next') { 15412 swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment); 15413 } 15414 if (swiper.swipeDirection === 'prev') { 15415 swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex); 15416 } 15417 } else if (e.target === swiper.navigation.nextEl) { 15418 swiper.slideTo(stopIndex + increment); 15419 } else { 15420 swiper.slideTo(stopIndex); 15421 } 15422 } 15423} 15424 15425function onResize() { 15426 const swiper = this; 15427 const { 15428 params, 15429 el 15430 } = swiper; 15431 if (el && el.offsetWidth === 0) return; 15432 15433 // Breakpoints 15434 if (params.breakpoints) { 15435 swiper.setBreakpoint(); 15436 } 15437 15438 // Save locks 15439 const { 15440 allowSlideNext, 15441 allowSlidePrev, 15442 snapGrid 15443 } = swiper; 15444 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 15445 15446 // Disable locks on resize 15447 swiper.allowSlideNext = true; 15448 swiper.allowSlidePrev = true; 15449 swiper.updateSize(); 15450 swiper.updateSlides(); 15451 swiper.updateSlidesClasses(); 15452 const isVirtualLoop = isVirtual && params.loop; 15453 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) { 15454 swiper.slideTo(swiper.slides.length - 1, 0, false, true); 15455 } else { 15456 if (swiper.params.loop && !isVirtual) { 15457 swiper.slideToLoop(swiper.realIndex, 0, false, true); 15458 } else { 15459 swiper.slideTo(swiper.activeIndex, 0, false, true); 15460 } 15461 } 15462 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 15463 clearTimeout(swiper.autoplay.resizeTimeout); 15464 swiper.autoplay.resizeTimeout = setTimeout(() => { 15465 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 15466 swiper.autoplay.resume(); 15467 } 15468 }, 500); 15469 } 15470 // Return locks after resize 15471 swiper.allowSlidePrev = allowSlidePrev; 15472 swiper.allowSlideNext = allowSlideNext; 15473 if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) { 15474 swiper.checkOverflow(); 15475 } 15476} 15477 15478function onClick(e) { 15479 const swiper = this; 15480 if (!swiper.enabled) return; 15481 if (!swiper.allowClick) { 15482 if (swiper.params.preventClicks) e.preventDefault(); 15483 if (swiper.params.preventClicksPropagation && swiper.animating) { 15484 e.stopPropagation(); 15485 e.stopImmediatePropagation(); 15486 } 15487 } 15488} 15489 15490function onScroll() { 15491 const swiper = this; 15492 const { 15493 wrapperEl, 15494 rtlTranslate, 15495 enabled 15496 } = swiper; 15497 if (!enabled) return; 15498 swiper.previousTranslate = swiper.translate; 15499 if (swiper.isHorizontal()) { 15500 swiper.translate = -wrapperEl.scrollLeft; 15501 } else { 15502 swiper.translate = -wrapperEl.scrollTop; 15503 } 15504 // eslint-disable-next-line 15505 if (swiper.translate === 0) swiper.translate = 0; 15506 swiper.updateActiveIndex(); 15507 swiper.updateSlidesClasses(); 15508 let newProgress; 15509 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 15510 if (translatesDiff === 0) { 15511 newProgress = 0; 15512 } else { 15513 newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff; 15514 } 15515 if (newProgress !== swiper.progress) { 15516 swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate); 15517 } 15518 swiper.emit('setTranslate', swiper.translate, false); 15519} 15520 15521function onLoad(e) { 15522 const swiper = this; 15523 processLazyPreloader(swiper, e.target); 15524 if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) { 15525 return; 15526 } 15527 swiper.update(); 15528} 15529 15530function onDocumentTouchStart() { 15531 const swiper = this; 15532 if (swiper.documentTouchHandlerProceeded) return; 15533 swiper.documentTouchHandlerProceeded = true; 15534 if (swiper.params.touchReleaseOnEdges) { 15535 swiper.el.style.touchAction = 'auto'; 15536 } 15537} 15538 15539const events = (swiper, method) => { 15540 const document = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 15541 const { 15542 params, 15543 el, 15544 wrapperEl, 15545 device 15546 } = swiper; 15547 const capture = !!params.nested; 15548 const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 15549 const swiperMethod = method; 15550 if (!el || typeof el === 'string') return; 15551 15552 // Touch Events 15553 document[domMethod]('touchstart', swiper.onDocumentTouchStart, { 15554 passive: false, 15555 capture 15556 }); 15557 el[domMethod]('touchstart', swiper.onTouchStart, { 15558 passive: false 15559 }); 15560 el[domMethod]('pointerdown', swiper.onTouchStart, { 15561 passive: false 15562 }); 15563 document[domMethod]('touchmove', swiper.onTouchMove, { 15564 passive: false, 15565 capture 15566 }); 15567 document[domMethod]('pointermove', swiper.onTouchMove, { 15568 passive: false, 15569 capture 15570 }); 15571 document[domMethod]('touchend', swiper.onTouchEnd, { 15572 passive: true 15573 }); 15574 document[domMethod]('pointerup', swiper.onTouchEnd, { 15575 passive: true 15576 }); 15577 document[domMethod]('pointercancel', swiper.onTouchEnd, { 15578 passive: true 15579 }); 15580 document[domMethod]('touchcancel', swiper.onTouchEnd, { 15581 passive: true 15582 }); 15583 document[domMethod]('pointerout', swiper.onTouchEnd, { 15584 passive: true 15585 }); 15586 document[domMethod]('pointerleave', swiper.onTouchEnd, { 15587 passive: true 15588 }); 15589 document[domMethod]('contextmenu', swiper.onTouchEnd, { 15590 passive: true 15591 }); 15592 15593 // Prevent Links Clicks 15594 if (params.preventClicks || params.preventClicksPropagation) { 15595 el[domMethod]('click', swiper.onClick, true); 15596 } 15597 if (params.cssMode) { 15598 wrapperEl[domMethod]('scroll', swiper.onScroll); 15599 } 15600 15601 // Resize handler 15602 if (params.updateOnWindowResize) { 15603 swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true); 15604 } else { 15605 swiper[swiperMethod]('observerUpdate', onResize, true); 15606 } 15607 15608 // Images loader 15609 el[domMethod]('load', swiper.onLoad, { 15610 capture: true 15611 }); 15612}; 15613function attachEvents() { 15614 const swiper = this; 15615 const { 15616 params 15617 } = swiper; 15618 swiper.onTouchStart = onTouchStart.bind(swiper); 15619 swiper.onTouchMove = onTouchMove.bind(swiper); 15620 swiper.onTouchEnd = onTouchEnd.bind(swiper); 15621 swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper); 15622 if (params.cssMode) { 15623 swiper.onScroll = onScroll.bind(swiper); 15624 } 15625 swiper.onClick = onClick.bind(swiper); 15626 swiper.onLoad = onLoad.bind(swiper); 15627 events(swiper, 'on'); 15628} 15629function detachEvents() { 15630 const swiper = this; 15631 events(swiper, 'off'); 15632} 15633var events$1 = { 15634 attachEvents, 15635 detachEvents 15636}; 15637 15638const isGridEnabled = (swiper, params) => { 15639 return swiper.grid && params.grid && params.grid.rows > 1; 15640}; 15641function setBreakpoint() { 15642 const swiper = this; 15643 const { 15644 realIndex, 15645 initialized, 15646 params, 15647 el 15648 } = swiper; 15649 const breakpoints = params.breakpoints; 15650 if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; 15651 const document = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 15652 15653 // Get breakpoint for window/container width and update parameters 15654 const breakpointsBase = params.breakpointsBase === 'window' || !params.breakpointsBase ? params.breakpointsBase : 'container'; 15655 const breakpointContainer = ['window', 'container'].includes(params.breakpointsBase) || !params.breakpointsBase ? swiper.el : document.querySelector(params.breakpointsBase); 15656 const breakpoint = swiper.getBreakpoint(breakpoints, breakpointsBase, breakpointContainer); 15657 if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; 15658 const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; 15659 const breakpointParams = breakpointOnlyParams || swiper.originalParams; 15660 const wasMultiRow = isGridEnabled(swiper, params); 15661 const isMultiRow = isGridEnabled(swiper, breakpointParams); 15662 const wasGrabCursor = swiper.params.grabCursor; 15663 const isGrabCursor = breakpointParams.grabCursor; 15664 const wasEnabled = params.enabled; 15665 if (wasMultiRow && !isMultiRow) { 15666 el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`); 15667 swiper.emitContainerClasses(); 15668 } else if (!wasMultiRow && isMultiRow) { 15669 el.classList.add(`${params.containerModifierClass}grid`); 15670 if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') { 15671 el.classList.add(`${params.containerModifierClass}grid-column`); 15672 } 15673 swiper.emitContainerClasses(); 15674 } 15675 if (wasGrabCursor && !isGrabCursor) { 15676 swiper.unsetGrabCursor(); 15677 } else if (!wasGrabCursor && isGrabCursor) { 15678 swiper.setGrabCursor(); 15679 } 15680 15681 // Toggle navigation, pagination, scrollbar 15682 ['navigation', 'pagination', 'scrollbar'].forEach(prop => { 15683 if (typeof breakpointParams[prop] === 'undefined') return; 15684 const wasModuleEnabled = params[prop] && params[prop].enabled; 15685 const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled; 15686 if (wasModuleEnabled && !isModuleEnabled) { 15687 swiper[prop].disable(); 15688 } 15689 if (!wasModuleEnabled && isModuleEnabled) { 15690 swiper[prop].enable(); 15691 } 15692 }); 15693 const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; 15694 const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); 15695 const wasLoop = params.loop; 15696 if (directionChanged && initialized) { 15697 swiper.changeDirection(); 15698 } 15699 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.x)(swiper.params, breakpointParams); 15700 const isEnabled = swiper.params.enabled; 15701 const hasLoop = swiper.params.loop; 15702 Object.assign(swiper, { 15703 allowTouchMove: swiper.params.allowTouchMove, 15704 allowSlideNext: swiper.params.allowSlideNext, 15705 allowSlidePrev: swiper.params.allowSlidePrev 15706 }); 15707 if (wasEnabled && !isEnabled) { 15708 swiper.disable(); 15709 } else if (!wasEnabled && isEnabled) { 15710 swiper.enable(); 15711 } 15712 swiper.currentBreakpoint = breakpoint; 15713 swiper.emit('_beforeBreakpoint', breakpointParams); 15714 if (initialized) { 15715 if (needsReLoop) { 15716 swiper.loopDestroy(); 15717 swiper.loopCreate(realIndex); 15718 swiper.updateSlides(); 15719 } else if (!wasLoop && hasLoop) { 15720 swiper.loopCreate(realIndex); 15721 swiper.updateSlides(); 15722 } else if (wasLoop && !hasLoop) { 15723 swiper.loopDestroy(); 15724 } 15725 } 15726 swiper.emit('breakpoint', breakpointParams); 15727} 15728 15729function getBreakpoint(breakpoints, base, containerEl) { 15730 if (base === void 0) { 15731 base = 'window'; 15732 } 15733 if (!breakpoints || base === 'container' && !containerEl) return undefined; 15734 let breakpoint = false; 15735 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 15736 const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight; 15737 const points = Object.keys(breakpoints).map(point => { 15738 if (typeof point === 'string' && point.indexOf('@') === 0) { 15739 const minRatio = parseFloat(point.substr(1)); 15740 const value = currentHeight * minRatio; 15741 return { 15742 value, 15743 point 15744 }; 15745 } 15746 return { 15747 value: point, 15748 point 15749 }; 15750 }); 15751 points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10)); 15752 for (let i = 0; i < points.length; i += 1) { 15753 const { 15754 point, 15755 value 15756 } = points[i]; 15757 if (base === 'window') { 15758 if (window.matchMedia(`(min-width: ${value}px)`).matches) { 15759 breakpoint = point; 15760 } 15761 } else if (value <= containerEl.clientWidth) { 15762 breakpoint = point; 15763 } 15764 } 15765 return breakpoint || 'max'; 15766} 15767 15768var breakpoints = { 15769 setBreakpoint, 15770 getBreakpoint 15771}; 15772 15773function prepareClasses(entries, prefix) { 15774 const resultClasses = []; 15775 entries.forEach(item => { 15776 if (typeof item === 'object') { 15777 Object.keys(item).forEach(classNames => { 15778 if (item[classNames]) { 15779 resultClasses.push(prefix + classNames); 15780 } 15781 }); 15782 } else if (typeof item === 'string') { 15783 resultClasses.push(prefix + item); 15784 } 15785 }); 15786 return resultClasses; 15787} 15788function addClasses() { 15789 const swiper = this; 15790 const { 15791 classNames, 15792 params, 15793 rtl, 15794 el, 15795 device 15796 } = swiper; 15797 // prettier-ignore 15798 const suffixes = prepareClasses(['initialized', params.direction, { 15799 'free-mode': swiper.params.freeMode && params.freeMode.enabled 15800 }, { 15801 'autoheight': params.autoHeight 15802 }, { 15803 'rtl': rtl 15804 }, { 15805 'grid': params.grid && params.grid.rows > 1 15806 }, { 15807 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column' 15808 }, { 15809 'android': device.android 15810 }, { 15811 'ios': device.ios 15812 }, { 15813 'css-mode': params.cssMode 15814 }, { 15815 'centered': params.cssMode && params.centeredSlides 15816 }, { 15817 'watch-progress': params.watchSlidesProgress 15818 }], params.containerModifierClass); 15819 classNames.push(...suffixes); 15820 el.classList.add(...classNames); 15821 swiper.emitContainerClasses(); 15822} 15823 15824function removeClasses() { 15825 const swiper = this; 15826 const { 15827 el, 15828 classNames 15829 } = swiper; 15830 if (!el || typeof el === 'string') return; 15831 el.classList.remove(...classNames); 15832 swiper.emitContainerClasses(); 15833} 15834 15835var classes = { 15836 addClasses, 15837 removeClasses 15838}; 15839 15840function checkOverflow() { 15841 const swiper = this; 15842 const { 15843 isLocked: wasLocked, 15844 params 15845 } = swiper; 15846 const { 15847 slidesOffsetBefore 15848 } = params; 15849 if (slidesOffsetBefore) { 15850 const lastSlideIndex = swiper.slides.length - 1; 15851 const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; 15852 swiper.isLocked = swiper.size > lastSlideRightEdge; 15853 } else { 15854 swiper.isLocked = swiper.snapGrid.length === 1; 15855 } 15856 if (params.allowSlideNext === true) { 15857 swiper.allowSlideNext = !swiper.isLocked; 15858 } 15859 if (params.allowSlidePrev === true) { 15860 swiper.allowSlidePrev = !swiper.isLocked; 15861 } 15862 if (wasLocked && wasLocked !== swiper.isLocked) { 15863 swiper.isEnd = false; 15864 } 15865 if (wasLocked !== swiper.isLocked) { 15866 swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); 15867 } 15868} 15869var checkOverflow$1 = { 15870 checkOverflow 15871}; 15872 15873var defaults = { 15874 init: true, 15875 direction: 'horizontal', 15876 oneWayMovement: false, 15877 swiperElementNodeName: 'SWIPER-CONTAINER', 15878 touchEventsTarget: 'wrapper', 15879 initialSlide: 0, 15880 speed: 300, 15881 cssMode: false, 15882 updateOnWindowResize: true, 15883 resizeObserver: true, 15884 nested: false, 15885 createElements: false, 15886 eventsPrefix: 'swiper', 15887 enabled: true, 15888 focusableElements: 'input, select, option, textarea, button, video, label', 15889 // Overrides 15890 width: null, 15891 height: null, 15892 // 15893 preventInteractionOnTransition: false, 15894 // ssr 15895 userAgent: null, 15896 url: null, 15897 // To support iOS's swipe-to-go-back gesture (when being used in-app). 15898 edgeSwipeDetection: false, 15899 edgeSwipeThreshold: 20, 15900 // Autoheight 15901 autoHeight: false, 15902 // Set wrapper width 15903 setWrapperSize: false, 15904 // Virtual Translate 15905 virtualTranslate: false, 15906 // Effects 15907 effect: 'slide', 15908 // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip' 15909 15910 // Breakpoints 15911 breakpoints: undefined, 15912 breakpointsBase: 'window', 15913 // Slides grid 15914 spaceBetween: 0, 15915 slidesPerView: 1, 15916 slidesPerGroup: 1, 15917 slidesPerGroupSkip: 0, 15918 slidesPerGroupAuto: false, 15919 centeredSlides: false, 15920 centeredSlidesBounds: false, 15921 slidesOffsetBefore: 0, 15922 // in px 15923 slidesOffsetAfter: 0, 15924 // in px 15925 normalizeSlideIndex: true, 15926 centerInsufficientSlides: false, 15927 // Disable swiper and hide navigation when container not overflow 15928 watchOverflow: true, 15929 // Round length 15930 roundLengths: false, 15931 // Touches 15932 touchRatio: 1, 15933 touchAngle: 45, 15934 simulateTouch: true, 15935 shortSwipes: true, 15936 longSwipes: true, 15937 longSwipesRatio: 0.5, 15938 longSwipesMs: 300, 15939 followFinger: true, 15940 allowTouchMove: true, 15941 threshold: 5, 15942 touchMoveStopPropagation: false, 15943 touchStartPreventDefault: true, 15944 touchStartForcePreventDefault: false, 15945 touchReleaseOnEdges: false, 15946 // Unique Navigation Elements 15947 uniqueNavElements: true, 15948 // Resistance 15949 resistance: true, 15950 resistanceRatio: 0.85, 15951 // Progress 15952 watchSlidesProgress: false, 15953 // Cursor 15954 grabCursor: false, 15955 // Clicks 15956 preventClicks: true, 15957 preventClicksPropagation: true, 15958 slideToClickedSlide: false, 15959 // loop 15960 loop: false, 15961 loopAddBlankSlides: true, 15962 loopAdditionalSlides: 0, 15963 loopPreventsSliding: true, 15964 // rewind 15965 rewind: false, 15966 // Swiping/no swiping 15967 allowSlidePrev: true, 15968 allowSlideNext: true, 15969 swipeHandler: null, 15970 // '.swipe-handler', 15971 noSwiping: true, 15972 noSwipingClass: 'swiper-no-swiping', 15973 noSwipingSelector: null, 15974 // Passive Listeners 15975 passiveListeners: true, 15976 maxBackfaceHiddenSlides: 10, 15977 // NS 15978 containerModifierClass: 'swiper-', 15979 // NEW 15980 slideClass: 'swiper-slide', 15981 slideBlankClass: 'swiper-slide-blank', 15982 slideActiveClass: 'swiper-slide-active', 15983 slideVisibleClass: 'swiper-slide-visible', 15984 slideFullyVisibleClass: 'swiper-slide-fully-visible', 15985 slideNextClass: 'swiper-slide-next', 15986 slidePrevClass: 'swiper-slide-prev', 15987 wrapperClass: 'swiper-wrapper', 15988 lazyPreloaderClass: 'swiper-lazy-preloader', 15989 lazyPreloadPrevNext: 0, 15990 // Callbacks 15991 runCallbacksOnInit: true, 15992 // Internals 15993 _emitClasses: false 15994}; 15995 15996function moduleExtendParams(params, allModulesParams) { 15997 return function extendParams(obj) { 15998 if (obj === void 0) { 15999 obj = {}; 16000 } 16001 const moduleParamName = Object.keys(obj)[0]; 16002 const moduleParams = obj[moduleParamName]; 16003 if (typeof moduleParams !== 'object' || moduleParams === null) { 16004 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.x)(allModulesParams, obj); 16005 return; 16006 } 16007 if (params[moduleParamName] === true) { 16008 params[moduleParamName] = { 16009 enabled: true 16010 }; 16011 } 16012 if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) { 16013 params[moduleParamName].auto = true; 16014 } 16015 if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) { 16016 params[moduleParamName].auto = true; 16017 } 16018 if (!(moduleParamName in params && 'enabled' in moduleParams)) { 16019 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.x)(allModulesParams, obj); 16020 return; 16021 } 16022 if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) { 16023 params[moduleParamName].enabled = true; 16024 } 16025 if (!params[moduleParamName]) params[moduleParamName] = { 16026 enabled: false 16027 }; 16028 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.x)(allModulesParams, obj); 16029 }; 16030} 16031 16032/* eslint no-param-reassign: "off" */ 16033const prototypes = { 16034 eventsEmitter, 16035 update, 16036 translate, 16037 transition, 16038 slide, 16039 loop, 16040 grabCursor, 16041 events: events$1, 16042 breakpoints, 16043 checkOverflow: checkOverflow$1, 16044 classes 16045}; 16046const extendedDefaults = {}; 16047class Swiper { 16048 constructor() { 16049 let el; 16050 let params; 16051 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 16052 args[_key] = arguments[_key]; 16053 } 16054 if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') { 16055 params = args[0]; 16056 } else { 16057 [el, params] = args; 16058 } 16059 if (!params) params = {}; 16060 params = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.x)({}, params); 16061 if (el && !params.el) params.el = el; 16062 const document = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 16063 if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) { 16064 const swipers = []; 16065 document.querySelectorAll(params.el).forEach(containerEl => { 16066 const newParams = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.x)({}, params, { 16067 el: containerEl 16068 }); 16069 swipers.push(new Swiper(newParams)); 16070 }); 16071 // eslint-disable-next-line no-constructor-return 16072 return swipers; 16073 } 16074 16075 // Swiper Instance 16076 const swiper = this; 16077 swiper.__swiper__ = true; 16078 swiper.support = getSupport(); 16079 swiper.device = getDevice({ 16080 userAgent: params.userAgent 16081 }); 16082 swiper.browser = getBrowser(); 16083 swiper.eventsListeners = {}; 16084 swiper.eventsAnyListeners = []; 16085 swiper.modules = [...swiper.__modules__]; 16086 if (params.modules && Array.isArray(params.modules)) { 16087 swiper.modules.push(...params.modules); 16088 } 16089 const allModulesParams = {}; 16090 swiper.modules.forEach(mod => { 16091 mod({ 16092 params, 16093 swiper, 16094 extendParams: moduleExtendParams(params, allModulesParams), 16095 on: swiper.on.bind(swiper), 16096 once: swiper.once.bind(swiper), 16097 off: swiper.off.bind(swiper), 16098 emit: swiper.emit.bind(swiper) 16099 }); 16100 }); 16101 16102 // Extend defaults with modules params 16103 const swiperParams = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.x)({}, defaults, allModulesParams); 16104 16105 // Extend defaults with passed params 16106 swiper.params = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.x)({}, swiperParams, extendedDefaults, params); 16107 swiper.originalParams = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.x)({}, swiper.params); 16108 swiper.passedParams = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.x)({}, params); 16109 16110 // add event listeners 16111 if (swiper.params && swiper.params.on) { 16112 Object.keys(swiper.params.on).forEach(eventName => { 16113 swiper.on(eventName, swiper.params.on[eventName]); 16114 }); 16115 } 16116 if (swiper.params && swiper.params.onAny) { 16117 swiper.onAny(swiper.params.onAny); 16118 } 16119 16120 // Extend Swiper 16121 Object.assign(swiper, { 16122 enabled: swiper.params.enabled, 16123 el, 16124 // Classes 16125 classNames: [], 16126 // Slides 16127 slides: [], 16128 slidesGrid: [], 16129 snapGrid: [], 16130 slidesSizesGrid: [], 16131 // isDirection 16132 isHorizontal() { 16133 return swiper.params.direction === 'horizontal'; 16134 }, 16135 isVertical() { 16136 return swiper.params.direction === 'vertical'; 16137 }, 16138 // Indexes 16139 activeIndex: 0, 16140 realIndex: 0, 16141 // 16142 isBeginning: true, 16143 isEnd: false, 16144 // Props 16145 translate: 0, 16146 previousTranslate: 0, 16147 progress: 0, 16148 velocity: 0, 16149 animating: false, 16150 cssOverflowAdjustment() { 16151 // Returns 0 unless `translate` is > 2**23 16152 // Should be subtracted from css values to prevent overflow 16153 return Math.trunc(this.translate / 2 ** 23) * 2 ** 23; 16154 }, 16155 // Locks 16156 allowSlideNext: swiper.params.allowSlideNext, 16157 allowSlidePrev: swiper.params.allowSlidePrev, 16158 // Touch Events 16159 touchEventsData: { 16160 isTouched: undefined, 16161 isMoved: undefined, 16162 allowTouchCallbacks: undefined, 16163 touchStartTime: undefined, 16164 isScrolling: undefined, 16165 currentTranslate: undefined, 16166 startTranslate: undefined, 16167 allowThresholdMove: undefined, 16168 // Form elements to match 16169 focusableElements: swiper.params.focusableElements, 16170 // Last click time 16171 lastClickTime: 0, 16172 clickTimeout: undefined, 16173 // Velocities 16174 velocities: [], 16175 allowMomentumBounce: undefined, 16176 startMoving: undefined, 16177 pointerId: null, 16178 touchId: null 16179 }, 16180 // Clicks 16181 allowClick: true, 16182 // Touches 16183 allowTouchMove: swiper.params.allowTouchMove, 16184 touches: { 16185 startX: 0, 16186 startY: 0, 16187 currentX: 0, 16188 currentY: 0, 16189 diff: 0 16190 }, 16191 // Images 16192 imagesToLoad: [], 16193 imagesLoaded: 0 16194 }); 16195 swiper.emit('_swiper'); 16196 16197 // Init 16198 if (swiper.params.init) { 16199 swiper.init(); 16200 } 16201 16202 // Return app instance 16203 // eslint-disable-next-line no-constructor-return 16204 return swiper; 16205 } 16206 getDirectionLabel(property) { 16207 if (this.isHorizontal()) { 16208 return property; 16209 } 16210 // prettier-ignore 16211 return { 16212 'width': 'height', 16213 'margin-top': 'margin-left', 16214 'margin-bottom ': 'margin-right', 16215 'margin-left': 'margin-top', 16216 'margin-right': 'margin-bottom', 16217 'padding-left': 'padding-top', 16218 'padding-right': 'padding-bottom', 16219 'marginRight': 'marginBottom' 16220 }[property]; 16221 } 16222 getSlideIndex(slideEl) { 16223 const { 16224 slidesEl, 16225 params 16226 } = this; 16227 const slides = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(slidesEl, `.${params.slideClass}, swiper-slide`); 16228 const firstSlideIndex = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.i)(slides[0]); 16229 return (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.i)(slideEl) - firstSlideIndex; 16230 } 16231 getSlideIndexByData(index) { 16232 return this.getSlideIndex(this.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index)); 16233 } 16234 getSlideIndexWhenGrid(index) { 16235 if (this.grid && this.params.grid && this.params.grid.rows > 1) { 16236 if (this.params.grid.fill === 'column') { 16237 index = Math.floor(index / this.params.grid.rows); 16238 } else if (this.params.grid.fill === 'row') { 16239 index = index % Math.ceil(this.slides.length / this.params.grid.rows); 16240 } 16241 } 16242 return index; 16243 } 16244 recalcSlides() { 16245 const swiper = this; 16246 const { 16247 slidesEl, 16248 params 16249 } = swiper; 16250 swiper.slides = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(slidesEl, `.${params.slideClass}, swiper-slide`); 16251 } 16252 enable() { 16253 const swiper = this; 16254 if (swiper.enabled) return; 16255 swiper.enabled = true; 16256 if (swiper.params.grabCursor) { 16257 swiper.setGrabCursor(); 16258 } 16259 swiper.emit('enable'); 16260 } 16261 disable() { 16262 const swiper = this; 16263 if (!swiper.enabled) return; 16264 swiper.enabled = false; 16265 if (swiper.params.grabCursor) { 16266 swiper.unsetGrabCursor(); 16267 } 16268 swiper.emit('disable'); 16269 } 16270 setProgress(progress, speed) { 16271 const swiper = this; 16272 progress = Math.min(Math.max(progress, 0), 1); 16273 const min = swiper.minTranslate(); 16274 const max = swiper.maxTranslate(); 16275 const current = (max - min) * progress + min; 16276 swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed); 16277 swiper.updateActiveIndex(); 16278 swiper.updateSlidesClasses(); 16279 } 16280 emitContainerClasses() { 16281 const swiper = this; 16282 if (!swiper.params._emitClasses || !swiper.el) return; 16283 const cls = swiper.el.className.split(' ').filter(className => { 16284 return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0; 16285 }); 16286 swiper.emit('_containerClasses', cls.join(' ')); 16287 } 16288 getSlideClasses(slideEl) { 16289 const swiper = this; 16290 if (swiper.destroyed) return ''; 16291 return slideEl.className.split(' ').filter(className => { 16292 return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0; 16293 }).join(' '); 16294 } 16295 emitSlidesClasses() { 16296 const swiper = this; 16297 if (!swiper.params._emitClasses || !swiper.el) return; 16298 const updates = []; 16299 swiper.slides.forEach(slideEl => { 16300 const classNames = swiper.getSlideClasses(slideEl); 16301 updates.push({ 16302 slideEl, 16303 classNames 16304 }); 16305 swiper.emit('_slideClass', slideEl, classNames); 16306 }); 16307 swiper.emit('_slideClasses', updates); 16308 } 16309 slidesPerViewDynamic(view, exact) { 16310 if (view === void 0) { 16311 view = 'current'; 16312 } 16313 if (exact === void 0) { 16314 exact = false; 16315 } 16316 const swiper = this; 16317 const { 16318 params, 16319 slides, 16320 slidesGrid, 16321 slidesSizesGrid, 16322 size: swiperSize, 16323 activeIndex 16324 } = swiper; 16325 let spv = 1; 16326 if (typeof params.slidesPerView === 'number') return params.slidesPerView; 16327 if (params.centeredSlides) { 16328 let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0; 16329 let breakLoop; 16330 for (let i = activeIndex + 1; i < slides.length; i += 1) { 16331 if (slides[i] && !breakLoop) { 16332 slideSize += Math.ceil(slides[i].swiperSlideSize); 16333 spv += 1; 16334 if (slideSize > swiperSize) breakLoop = true; 16335 } 16336 } 16337 for (let i = activeIndex - 1; i >= 0; i -= 1) { 16338 if (slides[i] && !breakLoop) { 16339 slideSize += slides[i].swiperSlideSize; 16340 spv += 1; 16341 if (slideSize > swiperSize) breakLoop = true; 16342 } 16343 } 16344 } else { 16345 // eslint-disable-next-line 16346 if (view === 'current') { 16347 for (let i = activeIndex + 1; i < slides.length; i += 1) { 16348 const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize; 16349 if (slideInView) { 16350 spv += 1; 16351 } 16352 } 16353 } else { 16354 // previous 16355 for (let i = activeIndex - 1; i >= 0; i -= 1) { 16356 const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize; 16357 if (slideInView) { 16358 spv += 1; 16359 } 16360 } 16361 } 16362 } 16363 return spv; 16364 } 16365 update() { 16366 const swiper = this; 16367 if (!swiper || swiper.destroyed) return; 16368 const { 16369 snapGrid, 16370 params 16371 } = swiper; 16372 // Breakpoints 16373 if (params.breakpoints) { 16374 swiper.setBreakpoint(); 16375 } 16376 [...swiper.el.querySelectorAll('[loading="lazy"]')].forEach(imageEl => { 16377 if (imageEl.complete) { 16378 processLazyPreloader(swiper, imageEl); 16379 } 16380 }); 16381 swiper.updateSize(); 16382 swiper.updateSlides(); 16383 swiper.updateProgress(); 16384 swiper.updateSlidesClasses(); 16385 function setTranslate() { 16386 const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; 16387 const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); 16388 swiper.setTranslate(newTranslate); 16389 swiper.updateActiveIndex(); 16390 swiper.updateSlidesClasses(); 16391 } 16392 let translated; 16393 if (params.freeMode && params.freeMode.enabled && !params.cssMode) { 16394 setTranslate(); 16395 if (params.autoHeight) { 16396 swiper.updateAutoHeight(); 16397 } 16398 } else { 16399 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) { 16400 const slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides; 16401 translated = swiper.slideTo(slides.length - 1, 0, false, true); 16402 } else { 16403 translated = swiper.slideTo(swiper.activeIndex, 0, false, true); 16404 } 16405 if (!translated) { 16406 setTranslate(); 16407 } 16408 } 16409 if (params.watchOverflow && snapGrid !== swiper.snapGrid) { 16410 swiper.checkOverflow(); 16411 } 16412 swiper.emit('update'); 16413 } 16414 changeDirection(newDirection, needUpdate) { 16415 if (needUpdate === void 0) { 16416 needUpdate = true; 16417 } 16418 const swiper = this; 16419 const currentDirection = swiper.params.direction; 16420 if (!newDirection) { 16421 // eslint-disable-next-line 16422 newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; 16423 } 16424 if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') { 16425 return swiper; 16426 } 16427 swiper.el.classList.remove(`${swiper.params.containerModifierClass}${currentDirection}`); 16428 swiper.el.classList.add(`${swiper.params.containerModifierClass}${newDirection}`); 16429 swiper.emitContainerClasses(); 16430 swiper.params.direction = newDirection; 16431 swiper.slides.forEach(slideEl => { 16432 if (newDirection === 'vertical') { 16433 slideEl.style.width = ''; 16434 } else { 16435 slideEl.style.height = ''; 16436 } 16437 }); 16438 swiper.emit('changeDirection'); 16439 if (needUpdate) swiper.update(); 16440 return swiper; 16441 } 16442 changeLanguageDirection(direction) { 16443 const swiper = this; 16444 if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return; 16445 swiper.rtl = direction === 'rtl'; 16446 swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl; 16447 if (swiper.rtl) { 16448 swiper.el.classList.add(`${swiper.params.containerModifierClass}rtl`); 16449 swiper.el.dir = 'rtl'; 16450 } else { 16451 swiper.el.classList.remove(`${swiper.params.containerModifierClass}rtl`); 16452 swiper.el.dir = 'ltr'; 16453 } 16454 swiper.update(); 16455 } 16456 mount(element) { 16457 const swiper = this; 16458 if (swiper.mounted) return true; 16459 16460 // Find el 16461 let el = element || swiper.params.el; 16462 if (typeof el === 'string') { 16463 el = document.querySelector(el); 16464 } 16465 if (!el) { 16466 return false; 16467 } 16468 el.swiper = swiper; 16469 if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) { 16470 swiper.isElement = true; 16471 } 16472 const getWrapperSelector = () => { 16473 return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`; 16474 }; 16475 const getWrapper = () => { 16476 if (el && el.shadowRoot && el.shadowRoot.querySelector) { 16477 const res = el.shadowRoot.querySelector(getWrapperSelector()); 16478 // Children needs to return slot items 16479 return res; 16480 } 16481 return (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(el, getWrapperSelector())[0]; 16482 }; 16483 // Find Wrapper 16484 let wrapperEl = getWrapper(); 16485 if (!wrapperEl && swiper.params.createElements) { 16486 wrapperEl = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.c)('div', swiper.params.wrapperClass); 16487 el.append(wrapperEl); 16488 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.e)(el, `.${swiper.params.slideClass}`).forEach(slideEl => { 16489 wrapperEl.append(slideEl); 16490 }); 16491 } 16492 Object.assign(swiper, { 16493 el, 16494 wrapperEl, 16495 slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl, 16496 hostEl: swiper.isElement ? el.parentNode.host : el, 16497 mounted: true, 16498 // RTL 16499 rtl: el.dir.toLowerCase() === 'rtl' || (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.q)(el, 'direction') === 'rtl', 16500 rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.q)(el, 'direction') === 'rtl'), 16501 wrongRTL: (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.q)(wrapperEl, 'display') === '-webkit-box' 16502 }); 16503 return true; 16504 } 16505 init(el) { 16506 const swiper = this; 16507 if (swiper.initialized) return swiper; 16508 const mounted = swiper.mount(el); 16509 if (mounted === false) return swiper; 16510 swiper.emit('beforeInit'); 16511 16512 // Set breakpoint 16513 if (swiper.params.breakpoints) { 16514 swiper.setBreakpoint(); 16515 } 16516 16517 // Add Classes 16518 swiper.addClasses(); 16519 16520 // Update size 16521 swiper.updateSize(); 16522 16523 // Update slides 16524 swiper.updateSlides(); 16525 if (swiper.params.watchOverflow) { 16526 swiper.checkOverflow(); 16527 } 16528 16529 // Set Grab Cursor 16530 if (swiper.params.grabCursor && swiper.enabled) { 16531 swiper.setGrabCursor(); 16532 } 16533 16534 // Slide To Initial Slide 16535 if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 16536 swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true); 16537 } else { 16538 swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); 16539 } 16540 16541 // Create loop 16542 if (swiper.params.loop) { 16543 swiper.loopCreate(undefined, true); 16544 } 16545 16546 // Attach events 16547 swiper.attachEvents(); 16548 const lazyElements = [...swiper.el.querySelectorAll('[loading="lazy"]')]; 16549 if (swiper.isElement) { 16550 lazyElements.push(...swiper.hostEl.querySelectorAll('[loading="lazy"]')); 16551 } 16552 lazyElements.forEach(imageEl => { 16553 if (imageEl.complete) { 16554 processLazyPreloader(swiper, imageEl); 16555 } else { 16556 imageEl.addEventListener('load', e => { 16557 processLazyPreloader(swiper, e.target); 16558 }); 16559 } 16560 }); 16561 preload(swiper); 16562 16563 // Init Flag 16564 swiper.initialized = true; 16565 preload(swiper); 16566 16567 // Emit 16568 swiper.emit('init'); 16569 swiper.emit('afterInit'); 16570 return swiper; 16571 } 16572 destroy(deleteInstance, cleanStyles) { 16573 if (deleteInstance === void 0) { 16574 deleteInstance = true; 16575 } 16576 if (cleanStyles === void 0) { 16577 cleanStyles = true; 16578 } 16579 const swiper = this; 16580 const { 16581 params, 16582 el, 16583 wrapperEl, 16584 slides 16585 } = swiper; 16586 if (typeof swiper.params === 'undefined' || swiper.destroyed) { 16587 return null; 16588 } 16589 swiper.emit('beforeDestroy'); 16590 16591 // Init Flag 16592 swiper.initialized = false; 16593 16594 // Detach events 16595 swiper.detachEvents(); 16596 16597 // Destroy loop 16598 if (params.loop) { 16599 swiper.loopDestroy(); 16600 } 16601 16602 // Cleanup styles 16603 if (cleanStyles) { 16604 swiper.removeClasses(); 16605 if (el && typeof el !== 'string') { 16606 el.removeAttribute('style'); 16607 } 16608 if (wrapperEl) { 16609 wrapperEl.removeAttribute('style'); 16610 } 16611 if (slides && slides.length) { 16612 slides.forEach(slideEl => { 16613 slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass); 16614 slideEl.removeAttribute('style'); 16615 slideEl.removeAttribute('data-swiper-slide-index'); 16616 }); 16617 } 16618 } 16619 swiper.emit('destroy'); 16620 16621 // Detach emitter events 16622 Object.keys(swiper.eventsListeners).forEach(eventName => { 16623 swiper.off(eventName); 16624 }); 16625 if (deleteInstance !== false) { 16626 if (swiper.el && typeof swiper.el !== 'string') { 16627 swiper.el.swiper = null; 16628 } 16629 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.y)(swiper); 16630 } 16631 swiper.destroyed = true; 16632 return null; 16633 } 16634 static extendDefaults(newDefaults) { 16635 (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.x)(extendedDefaults, newDefaults); 16636 } 16637 static get extendedDefaults() { 16638 return extendedDefaults; 16639 } 16640 static get defaults() { 16641 return defaults; 16642 } 16643 static installModule(mod) { 16644 if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = []; 16645 const modules = Swiper.prototype.__modules__; 16646 if (typeof mod === 'function' && modules.indexOf(mod) < 0) { 16647 modules.push(mod); 16648 } 16649 } 16650 static use(module) { 16651 if (Array.isArray(module)) { 16652 module.forEach(m => Swiper.installModule(m)); 16653 return Swiper; 16654 } 16655 Swiper.installModule(module); 16656 return Swiper; 16657 } 16658} 16659Object.keys(prototypes).forEach(prototypeGroup => { 16660 Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => { 16661 Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod]; 16662 }); 16663}); 16664Swiper.use([Resize, Observer]); 16665 16666 16667 16668 16669/***/ }), 16670
vendor: 13,873 bytes, lines 16671-17053
16671/***/ "./node_modules/swiper/shared/utils.mjs": 16672/*!**********************************************!*\ 16673 !*** ./node_modules/swiper/shared/utils.mjs ***! 16674 \**********************************************/ 16675/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 16676 16677"use strict"; 16678__webpack_require__.r(__webpack_exports__); 16679/* harmony export */ __webpack_require__.d(__webpack_exports__, { 16680/* harmony export */ a: function() { return /* binding */ setCSSProperty; }, 16681/* harmony export */ b: function() { return /* binding */ elementParents; }, 16682/* harmony export */ c: function() { return /* binding */ createElement; }, 16683/* harmony export */ d: function() { return /* binding */ elementOffset; }, 16684/* harmony export */ e: function() { return /* binding */ elementChildren; }, 16685/* harmony export */ f: function() { return /* binding */ now; }, 16686/* harmony export */ g: function() { return /* binding */ getSlideTransformEl; }, 16687/* harmony export */ h: function() { return /* binding */ elementOuterSize; }, 16688/* harmony export */ i: function() { return /* binding */ elementIndex; }, 16689/* harmony export */ j: function() { return /* binding */ classesToTokens; }, 16690/* harmony export */ k: function() { return /* binding */ getTranslate; }, 16691/* harmony export */ l: function() { return /* binding */ elementTransitionEnd; }, 16692/* harmony export */ m: function() { return /* binding */ makeElementsArray; }, 16693/* harmony export */ n: function() { return /* binding */ nextTick; }, 16694/* harmony export */ o: function() { return /* binding */ isObject; }, 16695/* harmony export */ p: function() { return /* binding */ getRotateFix; }, 16696/* harmony export */ q: function() { return /* binding */ elementStyle; }, 16697/* harmony export */ r: function() { return /* binding */ elementNextAll; }, 16698/* harmony export */ s: function() { return /* binding */ setInnerHTML; }, 16699/* harmony export */ t: function() { return /* binding */ elementPrevAll; }, 16700/* harmony export */ u: function() { return /* binding */ animateCSSModeScroll; }, 16701/* harmony export */ v: function() { return /* binding */ showWarning; }, 16702/* harmony export */ w: function() { return /* binding */ elementIsChildOf; }, 16703/* harmony export */ x: function() { return /* binding */ extend; }, 16704/* harmony export */ y: function() { return /* binding */ deleteProps; } 16705/* harmony export */ }); 16706/* harmony import */ var _ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ssr-window.esm.mjs */ "./node_modules/swiper/shared/ssr-window.esm.mjs"); 16707 16708 16709function classesToTokens(classes) { 16710 if (classes === void 0) { 16711 classes = ''; 16712 } 16713 return classes.trim().split(' ').filter(c => !!c.trim()); 16714} 16715 16716function deleteProps(obj) { 16717 const object = obj; 16718 Object.keys(object).forEach(key => { 16719 try { 16720 object[key] = null; 16721 } catch (e) { 16722 // no getter for object 16723 } 16724 try { 16725 delete object[key]; 16726 } catch (e) { 16727 // something got wrong 16728 } 16729 }); 16730} 16731function nextTick(callback, delay) { 16732 if (delay === void 0) { 16733 delay = 0; 16734 } 16735 return setTimeout(callback, delay); 16736} 16737function now() { 16738 return Date.now(); 16739} 16740function getComputedStyle(el) { 16741 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 16742 let style; 16743 if (window.getComputedStyle) { 16744 style = window.getComputedStyle(el, null); 16745 } 16746 if (!style && el.currentStyle) { 16747 style = el.currentStyle; 16748 } 16749 if (!style) { 16750 style = el.style; 16751 } 16752 return style; 16753} 16754function getTranslate(el, axis) { 16755 if (axis === void 0) { 16756 axis = 'x'; 16757 } 16758 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 16759 let matrix; 16760 let curTransform; 16761 let transformMatrix; 16762 const curStyle = getComputedStyle(el); 16763 if (window.WebKitCSSMatrix) { 16764 curTransform = curStyle.transform || curStyle.webkitTransform; 16765 if (curTransform.split(',').length > 6) { 16766 curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', '); 16767 } 16768 // Some old versions of Webkit choke when 'none' is passed; pass 16769 // empty string instead in this case 16770 transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); 16771 } else { 16772 transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); 16773 matrix = transformMatrix.toString().split(','); 16774 } 16775 if (axis === 'x') { 16776 // Latest Chrome and webkits Fix 16777 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; 16778 // Crazy IE10 Matrix 16779 else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); 16780 // Normal Browsers 16781 else curTransform = parseFloat(matrix[4]); 16782 } 16783 if (axis === 'y') { 16784 // Latest Chrome and webkits Fix 16785 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; 16786 // Crazy IE10 Matrix 16787 else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); 16788 // Normal Browsers 16789 else curTransform = parseFloat(matrix[5]); 16790 } 16791 return curTransform || 0; 16792} 16793function isObject(o) { 16794 return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object'; 16795} 16796function isNode(node) { 16797 // eslint-disable-next-line 16798 if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') { 16799 return node instanceof HTMLElement; 16800 } 16801 return node && (node.nodeType === 1 || node.nodeType === 11); 16802} 16803function extend() { 16804 const to = Object(arguments.length <= 0 ? undefined : arguments[0]); 16805 const noExtend = ['__proto__', 'constructor', 'prototype']; 16806 for (let i = 1; i < arguments.length; i += 1) { 16807 const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i]; 16808 if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) { 16809 const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0); 16810 for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) { 16811 const nextKey = keysArray[nextIndex]; 16812 const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); 16813 if (desc !== undefined && desc.enumerable) { 16814 if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) { 16815 if (nextSource[nextKey].__swiper__) { 16816 to[nextKey] = nextSource[nextKey]; 16817 } else { 16818 extend(to[nextKey], nextSource[nextKey]); 16819 } 16820 } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) { 16821 to[nextKey] = {}; 16822 if (nextSource[nextKey].__swiper__) { 16823 to[nextKey] = nextSource[nextKey]; 16824 } else { 16825 extend(to[nextKey], nextSource[nextKey]); 16826 } 16827 } else { 16828 to[nextKey] = nextSource[nextKey]; 16829 } 16830 } 16831 } 16832 } 16833 } 16834 return to; 16835} 16836function setCSSProperty(el, varName, varValue) { 16837 el.style.setProperty(varName, varValue); 16838} 16839function animateCSSModeScroll(_ref) { 16840 let { 16841 swiper, 16842 targetPosition, 16843 side 16844 } = _ref; 16845 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 16846 const startPosition = -swiper.translate; 16847 let startTime = null; 16848 let time; 16849 const duration = swiper.params.speed; 16850 swiper.wrapperEl.style.scrollSnapType = 'none'; 16851 window.cancelAnimationFrame(swiper.cssModeFrameID); 16852 const dir = targetPosition > startPosition ? 'next' : 'prev'; 16853 const isOutOfBound = (current, target) => { 16854 return dir === 'next' && current >= target || dir === 'prev' && current <= target; 16855 }; 16856 const animate = () => { 16857 time = new Date().getTime(); 16858 if (startTime === null) { 16859 startTime = time; 16860 } 16861 const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); 16862 const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2; 16863 let currentPosition = startPosition + easeProgress * (targetPosition - startPosition); 16864 if (isOutOfBound(currentPosition, targetPosition)) { 16865 currentPosition = targetPosition; 16866 } 16867 swiper.wrapperEl.scrollTo({ 16868 [side]: currentPosition 16869 }); 16870 if (isOutOfBound(currentPosition, targetPosition)) { 16871 swiper.wrapperEl.style.overflow = 'hidden'; 16872 swiper.wrapperEl.style.scrollSnapType = ''; 16873 setTimeout(() => { 16874 swiper.wrapperEl.style.overflow = ''; 16875 swiper.wrapperEl.scrollTo({ 16876 [side]: currentPosition 16877 }); 16878 }); 16879 window.cancelAnimationFrame(swiper.cssModeFrameID); 16880 return; 16881 } 16882 swiper.cssModeFrameID = window.requestAnimationFrame(animate); 16883 }; 16884 animate(); 16885} 16886function getSlideTransformEl(slideEl) { 16887 return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowRoot && slideEl.shadowRoot.querySelector('.swiper-slide-transform') || slideEl; 16888} 16889function elementChildren(element, selector) { 16890 if (selector === void 0) { 16891 selector = ''; 16892 } 16893 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 16894 const children = [...element.children]; 16895 if (window.HTMLSlotElement && element instanceof HTMLSlotElement) { 16896 children.push(...element.assignedElements()); 16897 } 16898 if (!selector) { 16899 return children; 16900 } 16901 return children.filter(el => el.matches(selector)); 16902} 16903function elementIsChildOfSlot(el, slot) { 16904 // Breadth-first search through all parent's children and assigned elements 16905 const elementsQueue = [slot]; 16906 while (elementsQueue.length > 0) { 16907 const elementToCheck = elementsQueue.shift(); 16908 if (el === elementToCheck) { 16909 return true; 16910 } 16911 elementsQueue.push(...elementToCheck.children, ...(elementToCheck.shadowRoot ? elementToCheck.shadowRoot.children : []), ...(elementToCheck.assignedElements ? elementToCheck.assignedElements() : [])); 16912 } 16913} 16914function elementIsChildOf(el, parent) { 16915 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 16916 let isChild = parent.contains(el); 16917 if (!isChild && window.HTMLSlotElement && parent instanceof HTMLSlotElement) { 16918 const children = [...parent.assignedElements()]; 16919 isChild = children.includes(el); 16920 if (!isChild) { 16921 isChild = elementIsChildOfSlot(el, parent); 16922 } 16923 } 16924 return isChild; 16925} 16926function showWarning(text) { 16927 try { 16928 console.warn(text); 16929 return; 16930 } catch (err) { 16931 // err 16932 } 16933} 16934function createElement(tag, classes) { 16935 if (classes === void 0) { 16936 classes = []; 16937 } 16938 const el = document.createElement(tag); 16939 el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes))); 16940 return el; 16941} 16942function elementOffset(el) { 16943 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 16944 const document = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.g)(); 16945 const box = el.getBoundingClientRect(); 16946 const body = document.body; 16947 const clientTop = el.clientTop || body.clientTop || 0; 16948 const clientLeft = el.clientLeft || body.clientLeft || 0; 16949 const scrollTop = el === window ? window.scrollY : el.scrollTop; 16950 const scrollLeft = el === window ? window.scrollX : el.scrollLeft; 16951 return { 16952 top: box.top + scrollTop - clientTop, 16953 left: box.left + scrollLeft - clientLeft 16954 }; 16955} 16956function elementPrevAll(el, selector) { 16957 const prevEls = []; 16958 while (el.previousElementSibling) { 16959 const prev = el.previousElementSibling; // eslint-disable-line 16960 if (selector) { 16961 if (prev.matches(selector)) prevEls.push(prev); 16962 } else prevEls.push(prev); 16963 el = prev; 16964 } 16965 return prevEls; 16966} 16967function elementNextAll(el, selector) { 16968 const nextEls = []; 16969 while (el.nextElementSibling) { 16970 const next = el.nextElementSibling; // eslint-disable-line 16971 if (selector) { 16972 if (next.matches(selector)) nextEls.push(next); 16973 } else nextEls.push(next); 16974 el = next; 16975 } 16976 return nextEls; 16977} 16978function elementStyle(el, prop) { 16979 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 16980 return window.getComputedStyle(el, null).getPropertyValue(prop); 16981} 16982function elementIndex(el) { 16983 let child = el; 16984 let i; 16985 if (child) { 16986 i = 0; 16987 // eslint-disable-next-line 16988 while ((child = child.previousSibling) !== null) { 16989 if (child.nodeType === 1) i += 1; 16990 } 16991 return i; 16992 } 16993 return undefined; 16994} 16995function elementParents(el, selector) { 16996 const parents = []; // eslint-disable-line 16997 let parent = el.parentElement; // eslint-disable-line 16998 while (parent) { 16999 if (selector) { 17000 if (parent.matches(selector)) parents.push(parent); 17001 } else { 17002 parents.push(parent); 17003 } 17004 parent = parent.parentElement; 17005 } 17006 return parents; 17007} 17008function elementTransitionEnd(el, callback) { 17009 function fireCallBack(e) { 17010 if (e.target !== el) return; 17011 callback.call(el, e); 17012 el.removeEventListener('transitionend', fireCallBack); 17013 } 17014 if (callback) { 17015 el.addEventListener('transitionend', fireCallBack); 17016 } 17017} 17018function elementOuterSize(el, size, includeMargins) { 17019 const window = (0,_ssr_window_esm_mjs__WEBPACK_IMPORTED_MODULE_0__.a)(); 17020 if (includeMargins) { 17021 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')); 17022 } 17023 return el.offsetWidth; 17024} 17025function makeElementsArray(el) { 17026 return (Array.isArray(el) ? el : [el]).filter(e => !!e); 17027} 17028function getRotateFix(swiper) { 17029 return v => { 17030 if (Math.abs(v) > 0 && swiper.browser && swiper.browser.need3dFix && Math.abs(v) % 90 === 0) { 17031 return v + 0.001; 17032 } 17033 return v; 17034 }; 17035} 17036function setInnerHTML(el, html) { 17037 if (html === void 0) { 17038 html = ''; 17039 } 17040 if (typeof trustedTypes !== 'undefined') { 17041 el.innerHTML = trustedTypes.createPolicy('html', { 17042 createHTML: s => s 17043 }).createHTML(html); 17044 } else { 17045 el.innerHTML = html; 17046 } 17047} 17048 17049 17050 17051 17052/***/ }), 17053
vendor: 6,926 bytes, lines 17054-17134
17054/***/ "./node_modules/swiper/swiper-bundle.mjs": 17055/*!***********************************************!*\ 17056 !*** ./node_modules/swiper/swiper-bundle.mjs ***! 17057 \***********************************************/ 17058/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 17059 17060"use strict"; 17061__webpack_require__.r(__webpack_exports__); 17062/* harmony export */ __webpack_require__.d(__webpack_exports__, { 17063/* harmony export */ Swiper: function() { return /* reexport safe */ _shared_swiper_core_mjs__WEBPACK_IMPORTED_MODULE_0__.S; }, 17064/* harmony export */ "default": function() { return /* reexport safe */ _shared_swiper_core_mjs__WEBPACK_IMPORTED_MODULE_0__.S; } 17065/* harmony export */ }); 17066/* harmony import */ var _shared_swiper_core_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./shared/swiper-core.mjs */ "./node_modules/swiper/shared/swiper-core.mjs"); 17067/* harmony import */ var _modules_virtual_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/virtual.mjs */ "./node_modules/swiper/modules/virtual.mjs"); 17068/* harmony import */ var _modules_keyboard_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/keyboard.mjs */ "./node_modules/swiper/modules/keyboard.mjs"); 17069/* harmony import */ var _modules_mousewheel_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/mousewheel.mjs */ "./node_modules/swiper/modules/mousewheel.mjs"); 17070/* harmony import */ var _modules_navigation_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/navigation.mjs */ "./node_modules/swiper/modules/navigation.mjs"); 17071/* harmony import */ var _modules_pagination_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/pagination.mjs */ "./node_modules/swiper/modules/pagination.mjs"); 17072/* harmony import */ var _modules_scrollbar_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modules/scrollbar.mjs */ "./node_modules/swiper/modules/scrollbar.mjs"); 17073/* harmony import */ var _modules_parallax_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modules/parallax.mjs */ "./node_modules/swiper/modules/parallax.mjs"); 17074/* harmony import */ var _modules_zoom_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modules/zoom.mjs */ "./node_modules/swiper/modules/zoom.mjs"); 17075/* harmony import */ var _modules_controller_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./modules/controller.mjs */ "./node_modules/swiper/modules/controller.mjs"); 17076/* harmony import */ var _modules_a11y_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./modules/a11y.mjs */ "./node_modules/swiper/modules/a11y.mjs"); 17077/* harmony import */ var _modules_history_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./modules/history.mjs */ "./node_modules/swiper/modules/history.mjs"); 17078/* harmony import */ var _modules_hash_navigation_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./modules/hash-navigation.mjs */ "./node_modules/swiper/modules/hash-navigation.mjs"); 17079/* harmony import */ var _modules_autoplay_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./modules/autoplay.mjs */ "./node_modules/swiper/modules/autoplay.mjs"); 17080/* harmony import */ var _modules_thumbs_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./modules/thumbs.mjs */ "./node_modules/swiper/modules/thumbs.mjs"); 17081/* harmony import */ var _modules_free_mode_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./modules/free-mode.mjs */ "./node_modules/swiper/modules/free-mode.mjs"); 17082/* harmony import */ var _modules_grid_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./modules/grid.mjs */ "./node_modules/swiper/modules/grid.mjs"); 17083/* harmony import */ var _modules_manipulation_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./modules/manipulation.mjs */ "./node_modules/swiper/modules/manipulation.mjs"); 17084/* harmony import */ var _modules_effect_fade_mjs__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./modules/effect-fade.mjs */ "./node_modules/swiper/modules/effect-fade.mjs"); 17085/* harmony import */ var _modules_effect_cube_mjs__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./modules/effect-cube.mjs */ "./node_modules/swiper/modules/effect-cube.mjs"); 17086/* harmony import */ var _modules_effect_flip_mjs__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./modules/effect-flip.mjs */ "./node_modules/swiper/modules/effect-flip.mjs"); 17087/* harmony import */ var _modules_effect_coverflow_mjs__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./modules/effect-coverflow.mjs */ "./node_modules/swiper/modules/effect-coverflow.mjs"); 17088/* harmony import */ var _modules_effect_creative_mjs__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./modules/effect-creative.mjs */ "./node_modules/swiper/modules/effect-creative.mjs"); 17089/* harmony import */ var _modules_effect_cards_mjs__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./modules/effect-cards.mjs */ "./node_modules/swiper/modules/effect-cards.mjs"); 17090/** 17091 * Swiper 11.2.10 17092 * Most modern mobile touch slider and framework with hardware accelerated transitions 17093 * https://swiperjs.com 17094 * 17095 * Copyright 2014-2025 Vladimir Kharlampidi 17096 * 17097 * Released under the MIT License 17098 * 17099 * Released on: June 28, 2025 17100 */ 17101 17102 17103 17104 17105 17106 17107 17108 17109 17110 17111 17112 17113 17114 17115 17116 17117 17118 17119 17120 17121 17122 17123 17124 17125 17126 17127// Swiper Class 17128const modules = [_modules_virtual_mjs__WEBPACK_IMPORTED_MODULE_1__["default"], _modules_keyboard_mjs__WEBPACK_IMPORTED_MODULE_2__["default"], _modules_mousewheel_mjs__WEBPACK_IMPORTED_MODULE_3__["default"], _modules_navigation_mjs__WEBPACK_IMPORTED_MODULE_4__["default"], _modules_pagination_mjs__WEBPACK_IMPORTED_MODULE_5__["default"], _modules_scrollbar_mjs__WEBPACK_IMPORTED_MODULE_6__["default"], _modules_parallax_mjs__WEBPACK_IMPORTED_MODULE_7__["default"], _modules_zoom_mjs__WEBPACK_IMPORTED_MODULE_8__["default"], _modules_controller_mjs__WEBPACK_IMPORTED_MODULE_9__["default"], _modules_a11y_mjs__WEBPACK_IMPORTED_MODULE_10__["default"], _modules_history_mjs__WEBPACK_IMPORTED_MODULE_11__["default"], _modules_hash_navigation_mjs__WEBPACK_IMPORTED_MODULE_12__["default"], _modules_autoplay_mjs__WEBPACK_IMPORTED_MODULE_13__["default"], _modules_thumbs_mjs__WEBPACK_IMPORTED_MODULE_14__["default"], _modules_free_mode_mjs__WEBPACK_IMPORTED_MODULE_15__["default"], _modules_grid_mjs__WEBPACK_IMPORTED_MODULE_16__["default"], _modules_manipulation_mjs__WEBPACK_IMPORTED_MODULE_17__["default"], _modules_effect_fade_mjs__WEBPACK_IMPORTED_MODULE_18__["default"], _modules_effect_cube_mjs__WEBPACK_IMPORTED_MODULE_19__["default"], _modules_effect_flip_mjs__WEBPACK_IMPORTED_MODULE_20__["default"], _modules_effect_coverflow_mjs__WEBPACK_IMPORTED_MODULE_21__["default"], _modules_effect_creative_mjs__WEBPACK_IMPORTED_MODULE_22__["default"], _modules_effect_cards_mjs__WEBPACK_IMPORTED_MODULE_23__["default"]]; 17129_shared_swiper_core_mjs__WEBPACK_IMPORTED_MODULE_0__.S.use(modules); 17130 17131 17132 17133 17134/***/ })
vendor: 3,083 bytes, lines 17134-17205
17134 17135 17136/******/ }); 17137/************************************************************************/ 17138/******/ // The module cache 17139/******/ var __webpack_module_cache__ = {}; 17140/******/ 17141/******/ // The require function 17142/******/ function __webpack_require__(moduleId) { 17143/******/ // Check if module is in cache 17144/******/ var cachedModule = __webpack_module_cache__[moduleId]; 17145/******/ if (cachedModule !== undefined) { 17146/******/ return cachedModule.exports; 17147/******/ } 17148/******/ // Create a new module (and put it into the cache) 17149/******/ var module = __webpack_module_cache__[moduleId] = { 17150/******/ // no module.id needed 17151/******/ // no module.loaded needed 17152/******/ exports: {} 17153/******/ }; 17154/******/ 17155/******/ // Execute the module function 17156/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 17157/******/ 17158/******/ // Return the exports of the module 17159/******/ return module.exports; 17160/******/ } 17161/******/ 17162/************************************************************************/ 17163/******/ /* webpack/runtime/define property getters */ 17164/******/ !function() { 17165/******/ // define getter functions for harmony exports 17166/******/ __webpack_require__.d = function(exports, definition) { 17167/******/ for(var key in definition) { 17168/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 17169/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 17170/******/ } 17171/******/ } 17172/******/ }; 17173/******/ }(); 17174/******/ 17175/******/ /* webpack/runtime/hasOwnProperty shorthand */ 17176/******/ !function() { 17177/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 17178/******/ }(); 17179/******/ 17180/******/ /* webpack/runtime/make namespace object */ 17181/******/ !function() { 17182/******/ // define __esModule on exports 17183/******/ __webpack_require__.r = function(exports) { 17184/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 17185/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 17186/******/ } 17187/******/ Object.defineProperty(exports, '__esModule', { value: true }); 17188/******/ }; 17189/******/ }(); 17190/******/ 17191/************************************************************************/ 17192var __webpack_exports__ = {}; 17193// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. 17194!function() { 17195/*!***************************************************************************!*\ 17196 !*** ./cartridges/org_marykay/cartridge/client/default/js/splitBanner.js ***! 17197 \***************************************************************************/ 17198var processInclude = __webpack_require__(/*! base/util */ "./cartridges/app_storefront_base/cartridge/client/default/js/util.js"); 17199$(document).ready(function () { 17200 processInclude(__webpack_require__(/*! org/components/splitBanner */ "./cartridges/org_marykay/cartridge/client/default/js/components/splitBanner.js")); 17201}); 17202}(); 17203/******/ })() 17204; 17205//# sourceMappingURL=splitBanner.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.