PluginProbe ʕ •ᴥ•ʔ
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 3.0.3
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v3.0.3
4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.11.0 1.11.1 1.11.2 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.9.0 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 2.0.0 2.0.1 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.12.0 2.13.0 2.14.0 2.14.1 2.15.0 2.15.1 2.16.0 2.16.1 2.16.2 2.16.3 2.17.0 2.17.1 2.17.2 2.18.0 2.19.0 2.19.2 2.19.3 2.19.4 2.2.0 2.2.1 2.20.0 2.20.1 2.20.2 2.20.3 2.20.4 2.20.5 2.20.6 2.21.0 2.22.0 2.22.1 2.23.0 2.24.0 2.25.0 2.25.1 2.25.2 2.26.0 2.27.0 2.27.1 2.28.0 2.29.0 2.29.1 2.29.2 2.29.3 2.29.4 2.3.0 2.3.1 2.30.0 2.31.0 2.31.1 2.31.2 2.31.3 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.40.0 2.40.1 2.5.0 2.5.1 2.5.2 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.9.0 3.0.0 3.0.0-RC1 3.0.0-RC2 3.0.0-beta1 3.0.0-beta2 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.10.0 3.10.1 3.11.0 3.12.0 3.13.0 3.13.1 3.13.2 3.13.3 3.13.4 3.14.0 3.15.0 3.15.1 3.15.2 3.15.3 3.15.4 3.15.5 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.16.6 3.16.7 3.16.8 3.17.0 3.17.1 3.17.2 3.17.3 3.17.4 3.17.5 3.17.6 3.18.0 3.19.0 3.19.1 3.19.2 3.2.0 3.2.1 3.2.2 3.20.0 3.20.1 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 4.0.0 4.0.1 4.0.2 4.0.3 trunk 4.1.0 0.2.19.1 4.1.1 1.0.0 4.2.0 1.0.1 1.0.2
surecart / dist / components / esm / sc-image-slider.entry.js
surecart / dist / components / esm Last commit date
MockProcessor-498b60c5.js 1 year ago MockProcessor-498b60c5.js.map 1 year ago add-query-args-0e2a8393.js 1 year ago add-query-args-0e2a8393.js.map 1 year ago address-b892540d.js 1 year ago address-b892540d.js.map 1 year ago animation-registry-12eed2e3.js 1 year ago animation-registry-12eed2e3.js.map 1 year ago app-globals-707edcd4.js 1 year ago app-globals-707edcd4.js.map 1 year ago consumer-e06b16d3.js 1 year ago consumer-e06b16d3.js.map 1 year ago countries-c2f41f03.js 1 year ago countries-c2f41f03.js.map 1 year ago currency-a0c9bff4.js 1 year ago currency-a0c9bff4.js.map 1 year ago error-ca32663d.js 1 year ago error-ca32663d.js.map 1 year ago fetch-2032d11d.js 1 year ago fetch-2032d11d.js.map 1 year ago form-data-76641f16.js 1 year ago form-data-76641f16.js.map 1 year ago functions-2a4a4ba3.js 1 year ago functions-2a4a4ba3.js.map 1 year ago getters-929aa1df.js 1 year ago getters-929aa1df.js.map 1 year ago getters-a7eec27c.js 1 year ago getters-a7eec27c.js.map 1 year ago getters-b1d93841.js 1 year ago getters-b1d93841.js.map 1 year ago getters-e4172581.js 1 year ago getters-e4172581.js.map 1 year ago getters-ff7a502e.js 1 year ago getters-ff7a502e.js.map 1 year ago google-a86aa761.js 1 year ago google-a86aa761.js.map 1 year ago google-dd89f242.js 1 year ago google-dd89f242.js.map 1 year ago index-0202319f.js 1 year ago index-0202319f.js.map 1 year ago index-06061d4e.js 1 year ago index-06061d4e.js.map 1 year ago index-745b6bec.js 1 year ago index-745b6bec.js.map 1 year ago index-871d88b8.js 1 year ago index-871d88b8.js.map 1 year ago index-96490395.js 1 year ago index-96490395.js.map 1 year ago index-c5a96d53.js 2 years ago index-c5a96d53.js.map 2 years ago index.js 1 year ago index.js.map 1 year ago inline-c012a0f9.js 1 year ago inline-c012a0f9.js.map 1 year ago lazy-deb42890.js 1 year ago lazy-deb42890.js.map 1 year ago library-e110eea6.js 1 year ago library-e110eea6.js.map 1 year ago loader.js 1 year ago loader.js.map 1 year ago media-d21119a3.js 1 year ago media-d21119a3.js.map 1 year ago mutations-01792dfb.js 1 year ago mutations-01792dfb.js.map 1 year ago mutations-30225b1b.js 1 year ago mutations-30225b1b.js.map 1 year ago mutations-d5e8faea.js 1 year ago mutations-d5e8faea.js.map 1 year ago mutations-ed6d0770.js 1 year ago mutations-ed6d0770.js.map 1 year ago page-align-0cdacf32.js 1 year ago page-align-0cdacf32.js.map 1 year ago price-d5770168.js 1 year ago price-d5770168.js.map 1 year ago pure-963214cb.js 1 year ago pure-963214cb.js.map 1 year ago quantity-1f39f750.js 1 year ago quantity-1f39f750.js.map 1 year ago remove-query-args-938c53ea.js 1 year ago remove-query-args-938c53ea.js.map 1 year ago sc-address_3.entry.js 1 year ago sc-address_3.entry.js.map 1 year ago sc-alert_13.entry.js 1 year ago sc-alert_13.entry.js.map 1 year ago sc-avatar.entry.js 1 year ago sc-avatar.entry.js.map 1 year ago sc-badge-notice.entry.js 1 year ago sc-badge-notice.entry.js.map 1 year ago sc-breadcrumb.entry.js 1 year ago sc-breadcrumb.entry.js.map 1 year ago sc-breadcrumbs.entry.js 1 year ago sc-breadcrumbs.entry.js.map 1 year ago sc-button-group.entry.js 1 year ago sc-button-group.entry.js.map 1 year ago sc-cancel-dialog_2.entry.js 1 year ago sc-cancel-dialog_2.entry.js.map 1 year ago sc-cancel-discount_4.entry.js 1 year ago sc-cancel-discount_4.entry.js.map 1 year ago sc-card.entry.js 1 year ago sc-card.entry.js.map 1 year ago sc-cart-button.entry.js 1 year ago sc-cart-button.entry.js.map 1 year ago sc-cart-form-submit.entry.js 1 year ago sc-cart-form-submit.entry.js.map 1 year ago sc-cart-form.entry.js 1 year ago sc-cart-form.entry.js.map 1 year ago sc-cart-header.entry.js 1 year ago sc-cart-header.entry.js.map 1 year ago sc-cart-icon.entry.js 1 year ago sc-cart-icon.entry.js.map 1 year ago sc-cart-loader.entry.js 1 year ago sc-cart-loader.entry.js.map 1 year ago sc-cart-session-provider_3.entry.js 1 year ago sc-cart-session-provider_3.entry.js.map 1 year ago sc-cart-submit.entry.js 1 year ago sc-cart-submit.entry.js.map 1 year ago sc-cart.entry.js 1 year ago sc-cart.entry.js.map 1 year ago sc-cc-logo_2.entry.js 1 year ago sc-cc-logo_2.entry.js.map 1 year ago sc-charges-list.entry.js 1 year ago sc-charges-list.entry.js.map 1 year ago sc-checkout-form-errors.entry.js 1 year ago sc-checkout-form-errors.entry.js.map 1 year ago sc-checkout-mollie-payment_2.entry.js 1 year ago sc-checkout-mollie-payment_2.entry.js.map 1 year ago sc-checkout-product-price-variant-selector.entry.js 1 year ago sc-checkout-product-price-variant-selector.entry.js.map 1 year ago sc-checkout-stock-alert_9.entry.js 1 year ago sc-checkout-stock-alert_9.entry.js.map 1 year ago sc-checkout.entry.js 1 year ago sc-checkout.entry.js.map 1 year ago sc-choice-container.entry.js 1 year ago sc-choice-container.entry.js.map 1 year ago sc-choice.entry.js 1 year ago sc-choice.entry.js.map 1 year ago sc-choices.entry.js 1 year ago sc-choices.entry.js.map 1 year ago sc-column_2.entry.js 1 year ago sc-column_2.entry.js.map 1 year ago sc-compact-address_16.entry.js 1 year ago sc-compact-address_16.entry.js.map 1 year ago sc-conditional-form.entry.js 1 year ago sc-conditional-form.entry.js.map 1 year ago sc-consumer.entry.js 1 year ago sc-consumer.entry.js.map 1 year ago sc-coupon-form.entry.js 1 year ago sc-coupon-form.entry.js.map 1 year ago sc-custom-order-price-input.entry.js 1 year ago sc-custom-order-price-input.entry.js.map 1 year ago sc-customer-details.entry.js 1 year ago sc-customer-details.entry.js.map 1 year ago sc-customer-edit.entry.js 1 year ago sc-customer-edit.entry.js.map 1 year ago sc-customer-email.entry.js 1 year ago sc-customer-email.entry.js.map 1 year ago sc-customer-firstname.entry.js 1 year ago sc-customer-firstname.entry.js.map 1 year ago sc-customer-lastname.entry.js 1 year ago sc-customer-lastname.entry.js.map 1 year ago sc-customer-name.entry.js 1 year ago sc-customer-name.entry.js.map 1 year ago sc-customer-phone.entry.js 1 year ago sc-customer-phone.entry.js.map 1 year ago sc-dashboard-customer-details.entry.js 1 year ago sc-dashboard-customer-details.entry.js.map 1 year ago sc-dashboard-downloads-list.entry.js 1 year ago sc-dashboard-downloads-list.entry.js.map 1 year ago sc-divider.entry.js 1 year ago sc-divider.entry.js.map 1 year ago sc-donation-choices.entry.js 1 year ago sc-donation-choices.entry.js.map 1 year ago sc-downloads-list.entry.js 1 year ago sc-downloads-list.entry.js.map 1 year ago sc-dropdown_3.entry.js 1 year ago sc-dropdown_3.entry.js.map 1 year ago sc-empty.entry.js 1 year ago sc-empty.entry.js.map 1 year ago sc-express-payment.entry.js 1 year ago sc-express-payment.entry.js.map 1 year ago sc-feature-demo-banner.entry.js 1 year ago sc-feature-demo-banner.entry.js.map 1 year ago sc-form-control_2.entry.js 1 year ago sc-form-control_2.entry.js.map 1 year ago sc-form-row.entry.js 1 year ago sc-form-row.entry.js.map 1 year ago sc-form.entry.js 1 year ago sc-form.entry.js.map 1 year ago sc-format-bytes.entry.js 1 year ago sc-format-bytes.entry.js.map 1 year ago sc-format-interval.entry.js 1 year ago sc-format-interval.entry.js.map 1 year ago sc-fulfillment-shipping-status-badge.entry.js 1 year ago sc-fulfillment-shipping-status-badge.entry.js.map 1 year ago sc-fulfillments.entry.js 1 year ago sc-fulfillments.entry.js.map 1 year ago sc-heading_2.entry.js 1 year ago sc-heading_2.entry.js.map 1 year ago sc-image-slider.entry.js 1 year ago sc-image-slider.entry.js.map 1 year ago sc-invoice-status-badge.entry.js 1 year ago sc-invoice-status-badge.entry.js.map 1 year ago sc-invoices-list.entry.js 1 year ago sc-invoices-list.entry.js.map 1 year ago sc-license.entry.js 1 year ago sc-license.entry.js.map 1 year ago sc-licenses-list.entry.js 1 year ago sc-licenses-list.entry.js.map 1 year ago sc-line-item-bump.entry.js 1 year ago sc-line-item-bump.entry.js.map 1 year ago sc-line-item-total.entry.js 1 year ago sc-line-item-total.entry.js.map 1 year ago sc-line-item.entry.js 1 year ago sc-line-item.entry.js.map 1 year ago sc-line-items-provider.entry.js 1 year ago sc-line-items-provider.entry.js.map 1 year ago sc-line-items.entry.js 1 year ago sc-line-items.entry.js.map 1 year ago sc-login-form.entry.js 1 year ago sc-login-form.entry.js.map 1 year ago sc-manual-payment-method_3.entry.js 1 year ago sc-manual-payment-method_3.entry.js.map 1 year ago sc-menu-divider.entry.js 1 year ago sc-menu-divider.entry.js.map 1 year ago sc-menu-label_2.entry.js 1 year ago sc-menu-label_2.entry.js.map 1 year ago sc-mollie-add-method.entry.js 1 year ago sc-mollie-add-method.entry.js.map 1 year ago sc-order-confirmation-customer.entry.js 1 year ago sc-order-confirmation-customer.entry.js.map 1 year ago sc-order-confirmation-details.entry.js 1 year ago sc-order-confirmation-details.entry.js.map 1 year ago sc-order-confirmation-line-items_2.entry.js 1 year ago sc-order-confirmation-line-items_2.entry.js.map 1 year ago sc-order-confirmation.entry.js 1 year ago sc-order-confirmation.entry.js.map 1 year ago sc-order-coupon-form.entry.js 1 year ago sc-order-coupon-form.entry.js.map 1 year ago sc-order-detail.entry.js 1 year ago sc-order-detail.entry.js.map 1 year ago sc-order-fulfillment-badge.entry.js 1 year ago sc-order-fulfillment-badge.entry.js.map 1 year ago sc-order-manual-instructions.entry.js 1 year ago sc-order-manual-instructions.entry.js.map 1 year ago sc-order-password.entry.js 1 year ago sc-order-password.entry.js.map 1 year ago sc-order-return-badge.entry.js 1 year ago sc-order-return-badge.entry.js.map 1 year ago sc-order-shipment-badge.entry.js 1 year ago sc-order-shipment-badge.entry.js.map 1 year ago sc-order-status-badge.entry.js 1 year ago sc-order-status-badge.entry.js.map 1 year ago sc-order-submit.entry.js 1 year ago sc-order-submit.entry.js.map 1 year ago sc-order-summary.entry.js 1 year ago sc-order-summary.entry.js.map 1 year ago sc-order.entry.js 1 year ago sc-order.entry.js.map 1 year ago sc-orders-list.entry.js 1 year ago sc-orders-list.entry.js.map 1 year ago sc-pagination.entry.js 1 year ago sc-pagination.entry.js.map 1 year ago sc-password-nag.entry.js 1 year ago sc-password-nag.entry.js.map 1 year ago sc-password.entry.js 1 year ago sc-password.entry.js.map 1 year ago sc-payment-method-choice_2.entry.js 1 year ago sc-payment-method-choice_2.entry.js.map 1 year ago sc-payment-method-details.entry.js 1 year ago sc-payment-method-details.entry.js.map 1 year ago sc-payment-methods-list.entry.js 1 year ago sc-payment-methods-list.entry.js.map 1 year ago sc-payment.entry.js 1 year ago sc-payment.entry.js.map 1 year ago sc-paypal-add-method.entry.js 1 year ago sc-paypal-add-method.entry.js.map 1 year ago sc-paypal-buttons_2.entry.js 1 year ago sc-paypal-buttons_2.entry.js.map 1 year ago sc-paystack-add-method.entry.js 1 year ago sc-paystack-add-method.entry.js.map 1 year ago sc-phone-input.entry.js 1 year ago sc-phone-input.entry.js.map 1 year ago sc-pill-option.entry.js 1 year ago sc-pill-option.entry.js.map 1 year ago sc-premium-tag.entry.js 1 year ago sc-premium-tag.entry.js.map 1 year ago sc-price-choice-container.entry.js 1 year ago sc-price-choice-container.entry.js.map 1 year ago sc-price-choice.entry.js 1 year ago sc-price-choice.entry.js.map 1 year ago sc-price-choices.entry.js 1 year ago sc-price-choices.entry.js.map 1 year ago sc-price-input.entry.js 1 year ago sc-price-input.entry.js.map 1 year ago sc-price-range.entry.js 1 year ago sc-price-range.entry.js.map 1 year ago sc-price.entry.js 1 year ago sc-price.entry.js.map 1 year ago sc-product-buy-button.entry.js 1 year ago sc-product-buy-button.entry.js.map 1 year ago sc-product-donation-amount-choice.entry.js 1 year ago sc-product-donation-amount-choice.entry.js.map 1 year ago sc-product-donation-choices.entry.js 1 year ago sc-product-donation-choices.entry.js.map 1 year ago sc-product-donation-custom-amount.entry.js 1 year ago sc-product-donation-custom-amount.entry.js.map 1 year ago sc-product-item-image_3.entry.js 1 year ago sc-product-item-image_3.entry.js.map 1 year ago sc-product-item-list.entry.js 1 year ago sc-product-item-list.entry.js.map 1 year ago sc-product-item.entry.js 1 year ago sc-product-item.entry.js.map 1 year ago sc-product-line-item_2.entry.js 1 year ago sc-product-line-item_2.entry.js.map 1 year ago sc-product-pills-variant-option.entry.js 1 year ago sc-product-pills-variant-option.entry.js.map 1 year ago sc-product-price-choices.entry.js 1 year ago sc-product-price-choices.entry.js.map 1 year ago sc-product-price-modal.entry.js 1 year ago sc-product-price-modal.entry.js.map 1 year ago sc-product-price.entry.js 1 year ago sc-product-price.entry.js.map 1 year ago sc-product-quantity.entry.js 1 year ago sc-product-quantity.entry.js.map 1 year ago sc-product-selected-price.entry.js 1 year ago sc-product-selected-price.entry.js.map 1 year ago sc-product-text.entry.js 1 year ago sc-product-text.entry.js.map 1 year ago sc-provider.entry.js 1 year ago sc-provider.entry.js.map 1 year ago sc-provisional-banner.entry.js 1 year ago sc-provisional-banner.entry.js.map 1 year ago sc-purchase-downloads-list.entry.js 1 year ago sc-purchase-downloads-list.entry.js.map 1 year ago sc-recurring-price-choice-container.entry.js 1 year ago sc-recurring-price-choice-container.entry.js.map 1 year ago sc-rich-text.entry.js 1 year ago sc-rich-text.entry.js.map 1 year ago sc-spacing.entry.js 1 year ago sc-spacing.entry.js.map 1 year ago sc-stacked-list_2.entry.js 1 year ago sc-stacked-list_2.entry.js.map 1 year ago sc-stripe-add-method.entry.js 1 year ago sc-stripe-add-method.entry.js.map 1 year ago sc-stripe-element.entry.js 1 year ago sc-stripe-element.entry.js.map 1 year ago sc-stripe-payment-element.entry.js 1 year ago sc-stripe-payment-element.entry.js.map 1 year ago sc-stripe-payment-request.entry.js 1 year ago sc-stripe-payment-request.entry.js.map 1 year ago sc-subscription-ad-hoc-confirm.entry.js 1 year ago sc-subscription-ad-hoc-confirm.entry.js.map 1 year ago sc-subscription-details_2.entry.js 1 year ago sc-subscription-details_2.entry.js.map 1 year ago sc-subscription-payment-method.entry.js 1 year ago sc-subscription-payment-method.entry.js.map 1 year ago sc-subscription-payment.entry.js 1 year ago sc-subscription-payment.entry.js.map 1 year ago sc-subscription-switch.entry.js 1 year ago sc-subscription-switch.entry.js.map 1 year ago sc-subscription-variation-confirm.entry.js 1 year ago sc-subscription-variation-confirm.entry.js.map 1 year ago sc-subscription.entry.js 1 year ago sc-subscription.entry.js.map 1 year ago sc-subscriptions-list.entry.js 1 year ago sc-subscriptions-list.entry.js.map 1 year ago sc-summary.entry.js 1 year ago sc-summary.entry.js.map 1 year ago sc-switch.entry.js 1 year ago sc-switch.entry.js.map 1 year ago sc-tab-group.entry.js 1 year ago sc-tab-group.entry.js.map 1 year ago sc-tab-panel.entry.js 1 year ago sc-tab-panel.entry.js.map 1 year ago sc-tab.entry.js 1 year ago sc-tab.entry.js.map 1 year ago sc-table-head.entry.js 1 year ago sc-table-head.entry.js.map 1 year ago sc-table_3.entry.js 1 year ago sc-table_3.entry.js.map 1 year ago sc-tag.entry.js 1 year ago sc-tag.entry.js.map 1 year ago sc-toggle.entry.js 1 year ago sc-toggle.entry.js.map 1 year ago sc-toggles.entry.js 1 year ago sc-toggles.entry.js.map 1 year ago sc-total.entry.js 1 year ago sc-total.entry.js.map 1 year ago sc-upcoming-invoice.entry.js 1 year ago sc-upcoming-invoice.entry.js.map 1 year ago sc-upgrade-required.entry.js 1 year ago sc-upgrade-required.entry.js.map 1 year ago sc-upsell-countdown-timer.entry.js 1 year ago sc-upsell-countdown-timer.entry.js.map 1 year ago sc-upsell-no-thanks-button.entry.js 1 year ago sc-upsell-no-thanks-button.entry.js.map 1 year ago sc-upsell-submit-button.entry.js 1 year ago sc-upsell-submit-button.entry.js.map 1 year ago sc-upsell-totals.entry.js 1 year ago sc-upsell-totals.entry.js.map 1 year ago sc-upsell.entry.js 1 year ago sc-upsell.entry.js.map 1 year ago sc-visually-hidden.entry.js 1 year ago sc-visually-hidden.entry.js.map 1 year ago sc-wordpress-password-edit.entry.js 1 year ago sc-wordpress-password-edit.entry.js.map 1 year ago sc-wordpress-user-edit.entry.js 1 year ago sc-wordpress-user-edit.entry.js.map 1 year ago sc-wordpress-user.entry.js 1 year ago sc-wordpress-user.entry.js.map 1 year ago store-7020541e.js 1 year ago store-7020541e.js.map 1 year ago store-a8bae355.js 1 year ago store-a8bae355.js.map 1 year ago store-dcefd119.js 1 year ago store-dcefd119.js.map 1 year ago surecart.js 1 year ago surecart.js.map 1 year ago tax-d4911dbc.js 1 year ago tax-d4911dbc.js.map 1 year ago universe-5a73abb7.js 1 year ago universe-5a73abb7.js.map 1 year ago util-50af2a83.js 1 year ago util-50af2a83.js.map 1 year ago utils-e9ee502a.js 1 year ago utils-e9ee502a.js.map 1 year ago watchers-38693c1f.js 1 year ago watchers-38693c1f.js.map 1 year ago watchers-46ca00a4.js 1 year ago watchers-46ca00a4.js.map 1 year ago watchers-67501779.js 1 year ago watchers-67501779.js.map 1 year ago watchers-94c3ca47.js 1 year ago watchers-94c3ca47.js.map 1 year ago watchers-bbcb6e4d.js 1 year ago watchers-bbcb6e4d.js.map 1 year ago
sc-image-slider.entry.js
4616 lines
1 import { r as registerInstance, h } from './index-745b6bec.js';
2
3 /**
4 * SSR Window 4.0.2
5 * Better handling for window object in SSR environment
6 * https://github.com/nolimits4web/ssr-window
7 *
8 * Copyright 2021, Vladimir Kharlampidi
9 *
10 * Licensed under MIT
11 *
12 * Released on: December 13, 2021
13 */
14 /* eslint-disable no-param-reassign */
15 function isObject$1(obj) {
16 return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object;
17 }
18 function extend$1(target, src) {
19 if (target === void 0) {
20 target = {};
21 }
22 if (src === void 0) {
23 src = {};
24 }
25 Object.keys(src).forEach(key => {
26 if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject$1(src[key]) && isObject$1(target[key]) && Object.keys(src[key]).length > 0) {
27 extend$1(target[key], src[key]);
28 }
29 });
30 }
31 const ssrDocument = {
32 body: {},
33 addEventListener() {},
34 removeEventListener() {},
35 activeElement: {
36 blur() {},
37 nodeName: ''
38 },
39 querySelector() {
40 return null;
41 },
42 querySelectorAll() {
43 return [];
44 },
45 getElementById() {
46 return null;
47 },
48 createEvent() {
49 return {
50 initEvent() {}
51 };
52 },
53 createElement() {
54 return {
55 children: [],
56 childNodes: [],
57 style: {},
58 setAttribute() {},
59 getElementsByTagName() {
60 return [];
61 }
62 };
63 },
64 createElementNS() {
65 return {};
66 },
67 importNode() {
68 return null;
69 },
70 location: {
71 hash: '',
72 host: '',
73 hostname: '',
74 href: '',
75 origin: '',
76 pathname: '',
77 protocol: '',
78 search: ''
79 }
80 };
81 function getDocument() {
82 const doc = typeof document !== 'undefined' ? document : {};
83 extend$1(doc, ssrDocument);
84 return doc;
85 }
86 const ssrWindow = {
87 document: ssrDocument,
88 navigator: {
89 userAgent: ''
90 },
91 location: {
92 hash: '',
93 host: '',
94 hostname: '',
95 href: '',
96 origin: '',
97 pathname: '',
98 protocol: '',
99 search: ''
100 },
101 history: {
102 replaceState() {},
103 pushState() {},
104 go() {},
105 back() {}
106 },
107 CustomEvent: function CustomEvent() {
108 return this;
109 },
110 addEventListener() {},
111 removeEventListener() {},
112 getComputedStyle() {
113 return {
114 getPropertyValue() {
115 return '';
116 }
117 };
118 },
119 Image() {},
120 Date() {},
121 screen: {},
122 setTimeout() {},
123 clearTimeout() {},
124 matchMedia() {
125 return {};
126 },
127 requestAnimationFrame(callback) {
128 if (typeof setTimeout === 'undefined') {
129 callback();
130 return null;
131 }
132 return setTimeout(callback, 0);
133 },
134 cancelAnimationFrame(id) {
135 if (typeof setTimeout === 'undefined') {
136 return;
137 }
138 clearTimeout(id);
139 }
140 };
141 function getWindow() {
142 const win = typeof window !== 'undefined' ? window : {};
143 extend$1(win, ssrWindow);
144 return win;
145 }
146
147 function classesToTokens(classes) {
148 if (classes === void 0) {
149 classes = '';
150 }
151 return classes.trim().split(' ').filter(c => !!c.trim());
152 }
153
154 function deleteProps(obj) {
155 const object = obj;
156 Object.keys(object).forEach(key => {
157 try {
158 object[key] = null;
159 } catch (e) {
160 // no getter for object
161 }
162 try {
163 delete object[key];
164 } catch (e) {
165 // something got wrong
166 }
167 });
168 }
169 function nextTick(callback, delay) {
170 if (delay === void 0) {
171 delay = 0;
172 }
173 return setTimeout(callback, delay);
174 }
175 function now() {
176 return Date.now();
177 }
178 function getComputedStyle$1(el) {
179 const window = getWindow();
180 let style;
181 if (window.getComputedStyle) {
182 style = window.getComputedStyle(el, null);
183 }
184 if (!style && el.currentStyle) {
185 style = el.currentStyle;
186 }
187 if (!style) {
188 style = el.style;
189 }
190 return style;
191 }
192 function getTranslate(el, axis) {
193 if (axis === void 0) {
194 axis = 'x';
195 }
196 const window = getWindow();
197 let matrix;
198 let curTransform;
199 let transformMatrix;
200 const curStyle = getComputedStyle$1(el);
201 if (window.WebKitCSSMatrix) {
202 curTransform = curStyle.transform || curStyle.webkitTransform;
203 if (curTransform.split(',').length > 6) {
204 curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');
205 }
206 // Some old versions of Webkit choke when 'none' is passed; pass
207 // empty string instead in this case
208 transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
209 } else {
210 transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
211 matrix = transformMatrix.toString().split(',');
212 }
213 if (axis === 'x') {
214 // Latest Chrome and webkits Fix
215 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;
216 // Crazy IE10 Matrix
217 else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);
218 // Normal Browsers
219 else curTransform = parseFloat(matrix[4]);
220 }
221 if (axis === 'y') {
222 // Latest Chrome and webkits Fix
223 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;
224 // Crazy IE10 Matrix
225 else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);
226 // Normal Browsers
227 else curTransform = parseFloat(matrix[5]);
228 }
229 return curTransform || 0;
230 }
231 function isObject(o) {
232 return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';
233 }
234 function isNode(node) {
235 // eslint-disable-next-line
236 if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {
237 return node instanceof HTMLElement;
238 }
239 return node && (node.nodeType === 1 || node.nodeType === 11);
240 }
241 function extend() {
242 const to = Object(arguments.length <= 0 ? undefined : arguments[0]);
243 const noExtend = ['__proto__', 'constructor', 'prototype'];
244 for (let i = 1; i < arguments.length; i += 1) {
245 const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];
246 if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
247 const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0);
248 for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
249 const nextKey = keysArray[nextIndex];
250 const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
251 if (desc !== undefined && desc.enumerable) {
252 if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
253 if (nextSource[nextKey].__swiper__) {
254 to[nextKey] = nextSource[nextKey];
255 } else {
256 extend(to[nextKey], nextSource[nextKey]);
257 }
258 } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
259 to[nextKey] = {};
260 if (nextSource[nextKey].__swiper__) {
261 to[nextKey] = nextSource[nextKey];
262 } else {
263 extend(to[nextKey], nextSource[nextKey]);
264 }
265 } else {
266 to[nextKey] = nextSource[nextKey];
267 }
268 }
269 }
270 }
271 }
272 return to;
273 }
274 function setCSSProperty(el, varName, varValue) {
275 el.style.setProperty(varName, varValue);
276 }
277 function animateCSSModeScroll(_ref) {
278 let {
279 swiper,
280 targetPosition,
281 side
282 } = _ref;
283 const window = getWindow();
284 const startPosition = -swiper.translate;
285 let startTime = null;
286 let time;
287 const duration = swiper.params.speed;
288 swiper.wrapperEl.style.scrollSnapType = 'none';
289 window.cancelAnimationFrame(swiper.cssModeFrameID);
290 const dir = targetPosition > startPosition ? 'next' : 'prev';
291 const isOutOfBound = (current, target) => {
292 return dir === 'next' && current >= target || dir === 'prev' && current <= target;
293 };
294 const animate = () => {
295 time = new Date().getTime();
296 if (startTime === null) {
297 startTime = time;
298 }
299 const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
300 const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
301 let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);
302 if (isOutOfBound(currentPosition, targetPosition)) {
303 currentPosition = targetPosition;
304 }
305 swiper.wrapperEl.scrollTo({
306 [side]: currentPosition
307 });
308 if (isOutOfBound(currentPosition, targetPosition)) {
309 swiper.wrapperEl.style.overflow = 'hidden';
310 swiper.wrapperEl.style.scrollSnapType = '';
311 setTimeout(() => {
312 swiper.wrapperEl.style.overflow = '';
313 swiper.wrapperEl.scrollTo({
314 [side]: currentPosition
315 });
316 });
317 window.cancelAnimationFrame(swiper.cssModeFrameID);
318 return;
319 }
320 swiper.cssModeFrameID = window.requestAnimationFrame(animate);
321 };
322 animate();
323 }
324 function elementChildren(element, selector) {
325 if (selector === void 0) {
326 selector = '';
327 }
328 return [...element.children].filter(el => el.matches(selector));
329 }
330 function showWarning(text) {
331 try {
332 console.warn(text);
333 return;
334 } catch (err) {
335 // err
336 }
337 }
338 function createElement(tag, classes) {
339 if (classes === void 0) {
340 classes = [];
341 }
342 const el = document.createElement(tag);
343 el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes)));
344 return el;
345 }
346 function elementPrevAll(el, selector) {
347 const prevEls = [];
348 while (el.previousElementSibling) {
349 const prev = el.previousElementSibling; // eslint-disable-line
350 if (selector) {
351 if (prev.matches(selector)) prevEls.push(prev);
352 } else prevEls.push(prev);
353 el = prev;
354 }
355 return prevEls;
356 }
357 function elementNextAll(el, selector) {
358 const nextEls = [];
359 while (el.nextElementSibling) {
360 const next = el.nextElementSibling; // eslint-disable-line
361 if (selector) {
362 if (next.matches(selector)) nextEls.push(next);
363 } else nextEls.push(next);
364 el = next;
365 }
366 return nextEls;
367 }
368 function elementStyle(el, prop) {
369 const window = getWindow();
370 return window.getComputedStyle(el, null).getPropertyValue(prop);
371 }
372 function elementIndex(el) {
373 let child = el;
374 let i;
375 if (child) {
376 i = 0;
377 // eslint-disable-next-line
378 while ((child = child.previousSibling) !== null) {
379 if (child.nodeType === 1) i += 1;
380 }
381 return i;
382 }
383 return undefined;
384 }
385 function elementParents(el, selector) {
386 const parents = []; // eslint-disable-line
387 let parent = el.parentElement; // eslint-disable-line
388 while (parent) {
389 if (selector) {
390 if (parent.matches(selector)) parents.push(parent);
391 } else {
392 parents.push(parent);
393 }
394 parent = parent.parentElement;
395 }
396 return parents;
397 }
398 function elementOuterSize(el, size, includeMargins) {
399 const window = getWindow();
400 if (includeMargins) {
401 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'));
402 }
403 return el.offsetWidth;
404 }
405 function makeElementsArray(el) {
406 return (Array.isArray(el) ? el : [el]).filter(e => !!e);
407 }
408
409 let support;
410 function calcSupport() {
411 const window = getWindow();
412 const document = getDocument();
413 return {
414 smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style,
415 touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch)
416 };
417 }
418 function getSupport() {
419 if (!support) {
420 support = calcSupport();
421 }
422 return support;
423 }
424
425 let deviceCached;
426 function calcDevice(_temp) {
427 let {
428 userAgent
429 } = _temp === void 0 ? {} : _temp;
430 const support = getSupport();
431 const window = getWindow();
432 const platform = window.navigator.platform;
433 const ua = userAgent || window.navigator.userAgent;
434 const device = {
435 ios: false,
436 android: false
437 };
438 const screenWidth = window.screen.width;
439 const screenHeight = window.screen.height;
440 const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
441 let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
442 const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
443 const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
444 const windows = platform === 'Win32';
445 let macos = platform === 'MacIntel';
446
447 // iPadOs 13 fix
448 const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];
449 if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) {
450 ipad = ua.match(/(Version)\/([\d.]+)/);
451 if (!ipad) ipad = [0, 1, '13_0_0'];
452 macos = false;
453 }
454
455 // Android
456 if (android && !windows) {
457 device.os = 'android';
458 device.android = true;
459 }
460 if (ipad || iphone || ipod) {
461 device.os = 'ios';
462 device.ios = true;
463 }
464
465 // Export object
466 return device;
467 }
468 function getDevice(overrides) {
469 if (overrides === void 0) {
470 overrides = {};
471 }
472 if (!deviceCached) {
473 deviceCached = calcDevice(overrides);
474 }
475 return deviceCached;
476 }
477
478 let browser;
479 function calcBrowser() {
480 const window = getWindow();
481 const device = getDevice();
482 let needPerspectiveFix = false;
483 function isSafari() {
484 const ua = window.navigator.userAgent.toLowerCase();
485 return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
486 }
487 if (isSafari()) {
488 const ua = String(window.navigator.userAgent);
489 if (ua.includes('Version/')) {
490 const [major, minor] = ua.split('Version/')[1].split(' ')[0].split('.').map(num => Number(num));
491 needPerspectiveFix = major < 16 || major === 16 && minor < 2;
492 }
493 }
494 const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent);
495 const isSafariBrowser = isSafari();
496 const need3dFix = isSafariBrowser || isWebView && device.ios;
497 return {
498 isSafari: needPerspectiveFix || isSafariBrowser,
499 needPerspectiveFix,
500 need3dFix,
501 isWebView
502 };
503 }
504 function getBrowser() {
505 if (!browser) {
506 browser = calcBrowser();
507 }
508 return browser;
509 }
510
511 function Resize(_ref) {
512 let {
513 swiper,
514 on,
515 emit
516 } = _ref;
517 const window = getWindow();
518 let observer = null;
519 let animationFrame = null;
520 const resizeHandler = () => {
521 if (!swiper || swiper.destroyed || !swiper.initialized) return;
522 emit('beforeResize');
523 emit('resize');
524 };
525 const createObserver = () => {
526 if (!swiper || swiper.destroyed || !swiper.initialized) return;
527 observer = new ResizeObserver(entries => {
528 animationFrame = window.requestAnimationFrame(() => {
529 const {
530 width,
531 height
532 } = swiper;
533 let newWidth = width;
534 let newHeight = height;
535 entries.forEach(_ref2 => {
536 let {
537 contentBoxSize,
538 contentRect,
539 target
540 } = _ref2;
541 if (target && target !== swiper.el) return;
542 newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;
543 newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;
544 });
545 if (newWidth !== width || newHeight !== height) {
546 resizeHandler();
547 }
548 });
549 });
550 observer.observe(swiper.el);
551 };
552 const removeObserver = () => {
553 if (animationFrame) {
554 window.cancelAnimationFrame(animationFrame);
555 }
556 if (observer && observer.unobserve && swiper.el) {
557 observer.unobserve(swiper.el);
558 observer = null;
559 }
560 };
561 const orientationChangeHandler = () => {
562 if (!swiper || swiper.destroyed || !swiper.initialized) return;
563 emit('orientationchange');
564 };
565 on('init', () => {
566 if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') {
567 createObserver();
568 return;
569 }
570 window.addEventListener('resize', resizeHandler);
571 window.addEventListener('orientationchange', orientationChangeHandler);
572 });
573 on('destroy', () => {
574 removeObserver();
575 window.removeEventListener('resize', resizeHandler);
576 window.removeEventListener('orientationchange', orientationChangeHandler);
577 });
578 }
579
580 function Observer(_ref) {
581 let {
582 swiper,
583 extendParams,
584 on,
585 emit
586 } = _ref;
587 const observers = [];
588 const window = getWindow();
589 const attach = function (target, options) {
590 if (options === void 0) {
591 options = {};
592 }
593 const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
594 const observer = new ObserverFunc(mutations => {
595 // The observerUpdate event should only be triggered
596 // once despite the number of mutations. Additional
597 // triggers are redundant and are very costly
598 if (swiper.__preventObserver__) return;
599 if (mutations.length === 1) {
600 emit('observerUpdate', mutations[0]);
601 return;
602 }
603 const observerUpdate = function observerUpdate() {
604 emit('observerUpdate', mutations[0]);
605 };
606 if (window.requestAnimationFrame) {
607 window.requestAnimationFrame(observerUpdate);
608 } else {
609 window.setTimeout(observerUpdate, 0);
610 }
611 });
612 observer.observe(target, {
613 attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
614 childList: typeof options.childList === 'undefined' ? true : options.childList,
615 characterData: typeof options.characterData === 'undefined' ? true : options.characterData
616 });
617 observers.push(observer);
618 };
619 const init = () => {
620 if (!swiper.params.observer) return;
621 if (swiper.params.observeParents) {
622 const containerParents = elementParents(swiper.hostEl);
623 for (let i = 0; i < containerParents.length; i += 1) {
624 attach(containerParents[i]);
625 }
626 }
627 // Observe container
628 attach(swiper.hostEl, {
629 childList: swiper.params.observeSlideChildren
630 });
631
632 // Observe wrapper
633 attach(swiper.wrapperEl, {
634 attributes: false
635 });
636 };
637 const destroy = () => {
638 observers.forEach(observer => {
639 observer.disconnect();
640 });
641 observers.splice(0, observers.length);
642 };
643 extendParams({
644 observer: false,
645 observeParents: false,
646 observeSlideChildren: false
647 });
648 on('init', init);
649 on('destroy', destroy);
650 }
651
652 /* eslint-disable no-underscore-dangle */
653
654 var eventsEmitter = {
655 on(events, handler, priority) {
656 const self = this;
657 if (!self.eventsListeners || self.destroyed) return self;
658 if (typeof handler !== 'function') return self;
659 const method = priority ? 'unshift' : 'push';
660 events.split(' ').forEach(event => {
661 if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
662 self.eventsListeners[event][method](handler);
663 });
664 return self;
665 },
666 once(events, handler, priority) {
667 const self = this;
668 if (!self.eventsListeners || self.destroyed) return self;
669 if (typeof handler !== 'function') return self;
670 function onceHandler() {
671 self.off(events, onceHandler);
672 if (onceHandler.__emitterProxy) {
673 delete onceHandler.__emitterProxy;
674 }
675 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
676 args[_key] = arguments[_key];
677 }
678 handler.apply(self, args);
679 }
680 onceHandler.__emitterProxy = handler;
681 return self.on(events, onceHandler, priority);
682 },
683 onAny(handler, priority) {
684 const self = this;
685 if (!self.eventsListeners || self.destroyed) return self;
686 if (typeof handler !== 'function') return self;
687 const method = priority ? 'unshift' : 'push';
688 if (self.eventsAnyListeners.indexOf(handler) < 0) {
689 self.eventsAnyListeners[method](handler);
690 }
691 return self;
692 },
693 offAny(handler) {
694 const self = this;
695 if (!self.eventsListeners || self.destroyed) return self;
696 if (!self.eventsAnyListeners) return self;
697 const index = self.eventsAnyListeners.indexOf(handler);
698 if (index >= 0) {
699 self.eventsAnyListeners.splice(index, 1);
700 }
701 return self;
702 },
703 off(events, handler) {
704 const self = this;
705 if (!self.eventsListeners || self.destroyed) return self;
706 if (!self.eventsListeners) return self;
707 events.split(' ').forEach(event => {
708 if (typeof handler === 'undefined') {
709 self.eventsListeners[event] = [];
710 } else if (self.eventsListeners[event]) {
711 self.eventsListeners[event].forEach((eventHandler, index) => {
712 if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {
713 self.eventsListeners[event].splice(index, 1);
714 }
715 });
716 }
717 });
718 return self;
719 },
720 emit() {
721 const self = this;
722 if (!self.eventsListeners || self.destroyed) return self;
723 if (!self.eventsListeners) return self;
724 let events;
725 let data;
726 let context;
727 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
728 args[_key2] = arguments[_key2];
729 }
730 if (typeof args[0] === 'string' || Array.isArray(args[0])) {
731 events = args[0];
732 data = args.slice(1, args.length);
733 context = self;
734 } else {
735 events = args[0].events;
736 data = args[0].data;
737 context = args[0].context || self;
738 }
739 data.unshift(context);
740 const eventsArray = Array.isArray(events) ? events : events.split(' ');
741 eventsArray.forEach(event => {
742 if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
743 self.eventsAnyListeners.forEach(eventHandler => {
744 eventHandler.apply(context, [event, ...data]);
745 });
746 }
747 if (self.eventsListeners && self.eventsListeners[event]) {
748 self.eventsListeners[event].forEach(eventHandler => {
749 eventHandler.apply(context, data);
750 });
751 }
752 });
753 return self;
754 }
755 };
756
757 function updateSize() {
758 const swiper = this;
759 let width;
760 let height;
761 const el = swiper.el;
762 if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
763 width = swiper.params.width;
764 } else {
765 width = el.clientWidth;
766 }
767 if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {
768 height = swiper.params.height;
769 } else {
770 height = el.clientHeight;
771 }
772 if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
773 return;
774 }
775
776 // Subtract paddings
777 width = width - parseInt(elementStyle(el, 'padding-left') || 0, 10) - parseInt(elementStyle(el, 'padding-right') || 0, 10);
778 height = height - parseInt(elementStyle(el, 'padding-top') || 0, 10) - parseInt(elementStyle(el, 'padding-bottom') || 0, 10);
779 if (Number.isNaN(width)) width = 0;
780 if (Number.isNaN(height)) height = 0;
781 Object.assign(swiper, {
782 width,
783 height,
784 size: swiper.isHorizontal() ? width : height
785 });
786 }
787
788 function updateSlides() {
789 const swiper = this;
790 function getDirectionPropertyValue(node, label) {
791 return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0);
792 }
793 const params = swiper.params;
794 const {
795 wrapperEl,
796 slidesEl,
797 size: swiperSize,
798 rtlTranslate: rtl,
799 wrongRTL
800 } = swiper;
801 const isVirtual = swiper.virtual && params.virtual.enabled;
802 const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
803 const slides = elementChildren(slidesEl, `.${swiper.params.slideClass}, swiper-slide`);
804 const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
805 let snapGrid = [];
806 const slidesGrid = [];
807 const slidesSizesGrid = [];
808 let offsetBefore = params.slidesOffsetBefore;
809 if (typeof offsetBefore === 'function') {
810 offsetBefore = params.slidesOffsetBefore.call(swiper);
811 }
812 let offsetAfter = params.slidesOffsetAfter;
813 if (typeof offsetAfter === 'function') {
814 offsetAfter = params.slidesOffsetAfter.call(swiper);
815 }
816 const previousSnapGridLength = swiper.snapGrid.length;
817 const previousSlidesGridLength = swiper.slidesGrid.length;
818 let spaceBetween = params.spaceBetween;
819 let slidePosition = -offsetBefore;
820 let prevSlideSize = 0;
821 let index = 0;
822 if (typeof swiperSize === 'undefined') {
823 return;
824 }
825 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
826 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
827 } else if (typeof spaceBetween === 'string') {
828 spaceBetween = parseFloat(spaceBetween);
829 }
830 swiper.virtualSize = -spaceBetween;
831
832 // reset margins
833 slides.forEach(slideEl => {
834 if (rtl) {
835 slideEl.style.marginLeft = '';
836 } else {
837 slideEl.style.marginRight = '';
838 }
839 slideEl.style.marginBottom = '';
840 slideEl.style.marginTop = '';
841 });
842
843 // reset cssMode offsets
844 if (params.centeredSlides && params.cssMode) {
845 setCSSProperty(wrapperEl, '--swiper-centered-offset-before', '');
846 setCSSProperty(wrapperEl, '--swiper-centered-offset-after', '');
847 }
848 const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
849 if (gridEnabled) {
850 swiper.grid.initSlides(slides);
851 } else if (swiper.grid) {
852 swiper.grid.unsetSlides();
853 }
854
855 // Calc slides
856 let slideSize;
857 const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => {
858 return typeof params.breakpoints[key].slidesPerView !== 'undefined';
859 }).length > 0;
860 for (let i = 0; i < slidesLength; i += 1) {
861 slideSize = 0;
862 let slide;
863 if (slides[i]) slide = slides[i];
864 if (gridEnabled) {
865 swiper.grid.updateSlide(i, slide, slides);
866 }
867 if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
868
869 if (params.slidesPerView === 'auto') {
870 if (shouldResetSlideSize) {
871 slides[i].style[swiper.getDirectionLabel('width')] = ``;
872 }
873 const slideStyles = getComputedStyle(slide);
874 const currentTransform = slide.style.transform;
875 const currentWebKitTransform = slide.style.webkitTransform;
876 if (currentTransform) {
877 slide.style.transform = 'none';
878 }
879 if (currentWebKitTransform) {
880 slide.style.webkitTransform = 'none';
881 }
882 if (params.roundLengths) {
883 slideSize = swiper.isHorizontal() ? elementOuterSize(slide, 'width', true) : elementOuterSize(slide, 'height', true);
884 } else {
885 // eslint-disable-next-line
886 const width = getDirectionPropertyValue(slideStyles, 'width');
887 const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');
888 const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');
889 const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');
890 const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');
891 const boxSizing = slideStyles.getPropertyValue('box-sizing');
892 if (boxSizing && boxSizing === 'border-box') {
893 slideSize = width + marginLeft + marginRight;
894 } else {
895 const {
896 clientWidth,
897 offsetWidth
898 } = slide;
899 slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
900 }
901 }
902 if (currentTransform) {
903 slide.style.transform = currentTransform;
904 }
905 if (currentWebKitTransform) {
906 slide.style.webkitTransform = currentWebKitTransform;
907 }
908 if (params.roundLengths) slideSize = Math.floor(slideSize);
909 } else {
910 slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
911 if (params.roundLengths) slideSize = Math.floor(slideSize);
912 if (slides[i]) {
913 slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`;
914 }
915 }
916 if (slides[i]) {
917 slides[i].swiperSlideSize = slideSize;
918 }
919 slidesSizesGrid.push(slideSize);
920 if (params.centeredSlides) {
921 slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
922 if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
923 if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
924 if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
925 if (params.roundLengths) slidePosition = Math.floor(slidePosition);
926 if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);
927 slidesGrid.push(slidePosition);
928 } else {
929 if (params.roundLengths) slidePosition = Math.floor(slidePosition);
930 if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);
931 slidesGrid.push(slidePosition);
932 slidePosition = slidePosition + slideSize + spaceBetween;
933 }
934 swiper.virtualSize += slideSize + spaceBetween;
935 prevSlideSize = slideSize;
936 index += 1;
937 }
938 swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;
939 if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
940 wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;
941 }
942 if (params.setWrapperSize) {
943 wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
944 }
945 if (gridEnabled) {
946 swiper.grid.updateWrapperSize(slideSize, snapGrid);
947 }
948
949 // Remove last grid elements depending on width
950 if (!params.centeredSlides) {
951 const newSlidesGrid = [];
952 for (let i = 0; i < snapGrid.length; i += 1) {
953 let slidesGridItem = snapGrid[i];
954 if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
955 if (snapGrid[i] <= swiper.virtualSize - swiperSize) {
956 newSlidesGrid.push(slidesGridItem);
957 }
958 }
959 snapGrid = newSlidesGrid;
960 if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
961 snapGrid.push(swiper.virtualSize - swiperSize);
962 }
963 }
964 if (isVirtual && params.loop) {
965 const size = slidesSizesGrid[0] + spaceBetween;
966 if (params.slidesPerGroup > 1) {
967 const groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup);
968 const groupSize = size * params.slidesPerGroup;
969 for (let i = 0; i < groups; i += 1) {
970 snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize);
971 }
972 }
973 for (let i = 0; i < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; i += 1) {
974 if (params.slidesPerGroup === 1) {
975 snapGrid.push(snapGrid[snapGrid.length - 1] + size);
976 }
977 slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size);
978 swiper.virtualSize += size;
979 }
980 }
981 if (snapGrid.length === 0) snapGrid = [0];
982 if (spaceBetween !== 0) {
983 const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight');
984 slides.filter((_, slideIndex) => {
985 if (!params.cssMode || params.loop) return true;
986 if (slideIndex === slides.length - 1) {
987 return false;
988 }
989 return true;
990 }).forEach(slideEl => {
991 slideEl.style[key] = `${spaceBetween}px`;
992 });
993 }
994 if (params.centeredSlides && params.centeredSlidesBounds) {
995 let allSlidesSize = 0;
996 slidesSizesGrid.forEach(slideSizeValue => {
997 allSlidesSize += slideSizeValue + (spaceBetween || 0);
998 });
999 allSlidesSize -= spaceBetween;
1000 const maxSnap = allSlidesSize - swiperSize;
1001 snapGrid = snapGrid.map(snap => {
1002 if (snap <= 0) return -offsetBefore;
1003 if (snap > maxSnap) return maxSnap + offsetAfter;
1004 return snap;
1005 });
1006 }
1007 if (params.centerInsufficientSlides) {
1008 let allSlidesSize = 0;
1009 slidesSizesGrid.forEach(slideSizeValue => {
1010 allSlidesSize += slideSizeValue + (spaceBetween || 0);
1011 });
1012 allSlidesSize -= spaceBetween;
1013 const offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0);
1014 if (allSlidesSize + offsetSize < swiperSize) {
1015 const allSlidesOffset = (swiperSize - allSlidesSize - offsetSize) / 2;
1016 snapGrid.forEach((snap, snapIndex) => {
1017 snapGrid[snapIndex] = snap - allSlidesOffset;
1018 });
1019 slidesGrid.forEach((snap, snapIndex) => {
1020 slidesGrid[snapIndex] = snap + allSlidesOffset;
1021 });
1022 }
1023 }
1024 Object.assign(swiper, {
1025 slides,
1026 snapGrid,
1027 slidesGrid,
1028 slidesSizesGrid
1029 });
1030 if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) {
1031 setCSSProperty(wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`);
1032 setCSSProperty(wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`);
1033 const addToSnapGrid = -swiper.snapGrid[0];
1034 const addToSlidesGrid = -swiper.slidesGrid[0];
1035 swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid);
1036 swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid);
1037 }
1038 if (slidesLength !== previousSlidesLength) {
1039 swiper.emit('slidesLengthChange');
1040 }
1041 if (snapGrid.length !== previousSnapGridLength) {
1042 if (swiper.params.watchOverflow) swiper.checkOverflow();
1043 swiper.emit('snapGridLengthChange');
1044 }
1045 if (slidesGrid.length !== previousSlidesGridLength) {
1046 swiper.emit('slidesGridLengthChange');
1047 }
1048 if (params.watchSlidesProgress) {
1049 swiper.updateSlidesOffset();
1050 }
1051 swiper.emit('slidesUpdated');
1052 if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) {
1053 const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;
1054 const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass);
1055 if (slidesLength <= params.maxBackfaceHiddenSlides) {
1056 if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass);
1057 } else if (hasClassBackfaceClassAdded) {
1058 swiper.el.classList.remove(backFaceHiddenClass);
1059 }
1060 }
1061 }
1062
1063 function updateAutoHeight(speed) {
1064 const swiper = this;
1065 const activeSlides = [];
1066 const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
1067 let newHeight = 0;
1068 let i;
1069 if (typeof speed === 'number') {
1070 swiper.setTransition(speed);
1071 } else if (speed === true) {
1072 swiper.setTransition(swiper.params.speed);
1073 }
1074 const getSlideByIndex = index => {
1075 if (isVirtual) {
1076 return swiper.slides[swiper.getSlideIndexByData(index)];
1077 }
1078 return swiper.slides[index];
1079 };
1080 // Find slides currently in view
1081 if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
1082 if (swiper.params.centeredSlides) {
1083 (swiper.visibleSlides || []).forEach(slide => {
1084 activeSlides.push(slide);
1085 });
1086 } else {
1087 for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
1088 const index = swiper.activeIndex + i;
1089 if (index > swiper.slides.length && !isVirtual) break;
1090 activeSlides.push(getSlideByIndex(index));
1091 }
1092 }
1093 } else {
1094 activeSlides.push(getSlideByIndex(swiper.activeIndex));
1095 }
1096
1097 // Find new height from highest slide in view
1098 for (i = 0; i < activeSlides.length; i += 1) {
1099 if (typeof activeSlides[i] !== 'undefined') {
1100 const height = activeSlides[i].offsetHeight;
1101 newHeight = height > newHeight ? height : newHeight;
1102 }
1103 }
1104
1105 // Update Height
1106 if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`;
1107 }
1108
1109 function updateSlidesOffset() {
1110 const swiper = this;
1111 const slides = swiper.slides;
1112 // eslint-disable-next-line
1113 const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0;
1114 for (let i = 0; i < slides.length; i += 1) {
1115 slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment();
1116 }
1117 }
1118
1119 const toggleSlideClasses$1 = (slideEl, condition, className) => {
1120 if (condition && !slideEl.classList.contains(className)) {
1121 slideEl.classList.add(className);
1122 } else if (!condition && slideEl.classList.contains(className)) {
1123 slideEl.classList.remove(className);
1124 }
1125 };
1126 function updateSlidesProgress(translate) {
1127 if (translate === void 0) {
1128 translate = this && this.translate || 0;
1129 }
1130 const swiper = this;
1131 const params = swiper.params;
1132 const {
1133 slides,
1134 rtlTranslate: rtl,
1135 snapGrid
1136 } = swiper;
1137 if (slides.length === 0) return;
1138 if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
1139 let offsetCenter = -translate;
1140 if (rtl) offsetCenter = translate;
1141 swiper.visibleSlidesIndexes = [];
1142 swiper.visibleSlides = [];
1143 let spaceBetween = params.spaceBetween;
1144 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
1145 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size;
1146 } else if (typeof spaceBetween === 'string') {
1147 spaceBetween = parseFloat(spaceBetween);
1148 }
1149 for (let i = 0; i < slides.length; i += 1) {
1150 const slide = slides[i];
1151 let slideOffset = slide.swiperSlideOffset;
1152 if (params.cssMode && params.centeredSlides) {
1153 slideOffset -= slides[0].swiperSlideOffset;
1154 }
1155 const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
1156 const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
1157 const slideBefore = -(offsetCenter - slideOffset);
1158 const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
1159 const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i];
1160 const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
1161 if (isVisible) {
1162 swiper.visibleSlides.push(slide);
1163 swiper.visibleSlidesIndexes.push(i);
1164 }
1165 toggleSlideClasses$1(slide, isVisible, params.slideVisibleClass);
1166 toggleSlideClasses$1(slide, isFullyVisible, params.slideFullyVisibleClass);
1167 slide.progress = rtl ? -slideProgress : slideProgress;
1168 slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
1169 }
1170 }
1171
1172 function updateProgress(translate) {
1173 const swiper = this;
1174 if (typeof translate === 'undefined') {
1175 const multiplier = swiper.rtlTranslate ? -1 : 1;
1176 // eslint-disable-next-line
1177 translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
1178 }
1179 const params = swiper.params;
1180 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
1181 let {
1182 progress,
1183 isBeginning,
1184 isEnd,
1185 progressLoop
1186 } = swiper;
1187 const wasBeginning = isBeginning;
1188 const wasEnd = isEnd;
1189 if (translatesDiff === 0) {
1190 progress = 0;
1191 isBeginning = true;
1192 isEnd = true;
1193 } else {
1194 progress = (translate - swiper.minTranslate()) / translatesDiff;
1195 const isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1;
1196 const isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1;
1197 isBeginning = isBeginningRounded || progress <= 0;
1198 isEnd = isEndRounded || progress >= 1;
1199 if (isBeginningRounded) progress = 0;
1200 if (isEndRounded) progress = 1;
1201 }
1202 if (params.loop) {
1203 const firstSlideIndex = swiper.getSlideIndexByData(0);
1204 const lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1);
1205 const firstSlideTranslate = swiper.slidesGrid[firstSlideIndex];
1206 const lastSlideTranslate = swiper.slidesGrid[lastSlideIndex];
1207 const translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1];
1208 const translateAbs = Math.abs(translate);
1209 if (translateAbs >= firstSlideTranslate) {
1210 progressLoop = (translateAbs - firstSlideTranslate) / translateMax;
1211 } else {
1212 progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax;
1213 }
1214 if (progressLoop > 1) progressLoop -= 1;
1215 }
1216 Object.assign(swiper, {
1217 progress,
1218 progressLoop,
1219 isBeginning,
1220 isEnd
1221 });
1222 if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);
1223 if (isBeginning && !wasBeginning) {
1224 swiper.emit('reachBeginning toEdge');
1225 }
1226 if (isEnd && !wasEnd) {
1227 swiper.emit('reachEnd toEdge');
1228 }
1229 if (wasBeginning && !isBeginning || wasEnd && !isEnd) {
1230 swiper.emit('fromEdge');
1231 }
1232 swiper.emit('progress', progress);
1233 }
1234
1235 const toggleSlideClasses = (slideEl, condition, className) => {
1236 if (condition && !slideEl.classList.contains(className)) {
1237 slideEl.classList.add(className);
1238 } else if (!condition && slideEl.classList.contains(className)) {
1239 slideEl.classList.remove(className);
1240 }
1241 };
1242 function updateSlidesClasses() {
1243 const swiper = this;
1244 const {
1245 slides,
1246 params,
1247 slidesEl,
1248 activeIndex
1249 } = swiper;
1250 const isVirtual = swiper.virtual && params.virtual.enabled;
1251 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
1252 const getFilteredSlide = selector => {
1253 return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
1254 };
1255 let activeSlide;
1256 let prevSlide;
1257 let nextSlide;
1258 if (isVirtual) {
1259 if (params.loop) {
1260 let slideIndex = activeIndex - swiper.virtual.slidesBefore;
1261 if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex;
1262 if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length;
1263 activeSlide = getFilteredSlide(`[data-swiper-slide-index="${slideIndex}"]`);
1264 } else {
1265 activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`);
1266 }
1267 } else {
1268 if (gridEnabled) {
1269 activeSlide = slides.filter(slideEl => slideEl.column === activeIndex)[0];
1270 nextSlide = slides.filter(slideEl => slideEl.column === activeIndex + 1)[0];
1271 prevSlide = slides.filter(slideEl => slideEl.column === activeIndex - 1)[0];
1272 } else {
1273 activeSlide = slides[activeIndex];
1274 }
1275 }
1276 if (activeSlide) {
1277 if (!gridEnabled) {
1278 // Next Slide
1279 nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
1280 if (params.loop && !nextSlide) {
1281 nextSlide = slides[0];
1282 }
1283
1284 // Prev Slide
1285 prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
1286 if (params.loop && !prevSlide === 0) {
1287 prevSlide = slides[slides.length - 1];
1288 }
1289 }
1290 }
1291 slides.forEach(slideEl => {
1292 toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass);
1293 toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass);
1294 toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass);
1295 });
1296 swiper.emitSlidesClasses();
1297 }
1298
1299 const processLazyPreloader = (swiper, imageEl) => {
1300 if (!swiper || swiper.destroyed || !swiper.params) return;
1301 const slideSelector = () => swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`;
1302 const slideEl = imageEl.closest(slideSelector());
1303 if (slideEl) {
1304 let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`);
1305 if (!lazyEl && swiper.isElement) {
1306 if (slideEl.shadowRoot) {
1307 lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
1308 } else {
1309 // init later
1310 requestAnimationFrame(() => {
1311 if (slideEl.shadowRoot) {
1312 lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
1313 if (lazyEl) lazyEl.remove();
1314 }
1315 });
1316 }
1317 }
1318 if (lazyEl) lazyEl.remove();
1319 }
1320 };
1321 const unlazy = (swiper, index) => {
1322 if (!swiper.slides[index]) return;
1323 const imageEl = swiper.slides[index].querySelector('[loading="lazy"]');
1324 if (imageEl) imageEl.removeAttribute('loading');
1325 };
1326 const preload = swiper => {
1327 if (!swiper || swiper.destroyed || !swiper.params) return;
1328 let amount = swiper.params.lazyPreloadPrevNext;
1329 const len = swiper.slides.length;
1330 if (!len || !amount || amount < 0) return;
1331 amount = Math.min(amount, len);
1332 const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView);
1333 const activeIndex = swiper.activeIndex;
1334 if (swiper.params.grid && swiper.params.grid.rows > 1) {
1335 const activeColumn = activeIndex;
1336 const preloadColumns = [activeColumn - amount];
1337 preloadColumns.push(...Array.from({
1338 length: amount
1339 }).map((_, i) => {
1340 return activeColumn + slidesPerView + i;
1341 }));
1342 swiper.slides.forEach((slideEl, i) => {
1343 if (preloadColumns.includes(slideEl.column)) unlazy(swiper, i);
1344 });
1345 return;
1346 }
1347 const slideIndexLastInView = activeIndex + slidesPerView - 1;
1348 if (swiper.params.rewind || swiper.params.loop) {
1349 for (let i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) {
1350 const realIndex = (i % len + len) % len;
1351 if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex);
1352 }
1353 } else {
1354 for (let i = Math.max(activeIndex - amount, 0); i <= Math.min(slideIndexLastInView + amount, len - 1); i += 1) {
1355 if (i !== activeIndex && (i > slideIndexLastInView || i < activeIndex)) {
1356 unlazy(swiper, i);
1357 }
1358 }
1359 }
1360 };
1361
1362 function getActiveIndexByTranslate(swiper) {
1363 const {
1364 slidesGrid,
1365 params
1366 } = swiper;
1367 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
1368 let activeIndex;
1369 for (let i = 0; i < slidesGrid.length; i += 1) {
1370 if (typeof slidesGrid[i + 1] !== 'undefined') {
1371 if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {
1372 activeIndex = i;
1373 } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
1374 activeIndex = i + 1;
1375 }
1376 } else if (translate >= slidesGrid[i]) {
1377 activeIndex = i;
1378 }
1379 }
1380 // Normalize slideIndex
1381 if (params.normalizeSlideIndex) {
1382 if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
1383 }
1384 return activeIndex;
1385 }
1386 function updateActiveIndex(newActiveIndex) {
1387 const swiper = this;
1388 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
1389 const {
1390 snapGrid,
1391 params,
1392 activeIndex: previousIndex,
1393 realIndex: previousRealIndex,
1394 snapIndex: previousSnapIndex
1395 } = swiper;
1396 let activeIndex = newActiveIndex;
1397 let snapIndex;
1398 const getVirtualRealIndex = aIndex => {
1399 let realIndex = aIndex - swiper.virtual.slidesBefore;
1400 if (realIndex < 0) {
1401 realIndex = swiper.virtual.slides.length + realIndex;
1402 }
1403 if (realIndex >= swiper.virtual.slides.length) {
1404 realIndex -= swiper.virtual.slides.length;
1405 }
1406 return realIndex;
1407 };
1408 if (typeof activeIndex === 'undefined') {
1409 activeIndex = getActiveIndexByTranslate(swiper);
1410 }
1411 if (snapGrid.indexOf(translate) >= 0) {
1412 snapIndex = snapGrid.indexOf(translate);
1413 } else {
1414 const skip = Math.min(params.slidesPerGroupSkip, activeIndex);
1415 snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
1416 }
1417 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
1418 if (activeIndex === previousIndex && !swiper.params.loop) {
1419 if (snapIndex !== previousSnapIndex) {
1420 swiper.snapIndex = snapIndex;
1421 swiper.emit('snapIndexChange');
1422 }
1423 return;
1424 }
1425 if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
1426 swiper.realIndex = getVirtualRealIndex(activeIndex);
1427 return;
1428 }
1429 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
1430
1431 // Get real index
1432 let realIndex;
1433 if (swiper.virtual && params.virtual.enabled && params.loop) {
1434 realIndex = getVirtualRealIndex(activeIndex);
1435 } else if (gridEnabled) {
1436 const firstSlideInColumn = swiper.slides.filter(slideEl => slideEl.column === activeIndex)[0];
1437 let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10);
1438 if (Number.isNaN(activeSlideIndex)) {
1439 activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0);
1440 }
1441 realIndex = Math.floor(activeSlideIndex / params.grid.rows);
1442 } else if (swiper.slides[activeIndex]) {
1443 const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index');
1444 if (slideIndex) {
1445 realIndex = parseInt(slideIndex, 10);
1446 } else {
1447 realIndex = activeIndex;
1448 }
1449 } else {
1450 realIndex = activeIndex;
1451 }
1452 Object.assign(swiper, {
1453 previousSnapIndex,
1454 snapIndex,
1455 previousRealIndex,
1456 realIndex,
1457 previousIndex,
1458 activeIndex
1459 });
1460 if (swiper.initialized) {
1461 preload(swiper);
1462 }
1463 swiper.emit('activeIndexChange');
1464 swiper.emit('snapIndexChange');
1465 if (swiper.initialized || swiper.params.runCallbacksOnInit) {
1466 if (previousRealIndex !== realIndex) {
1467 swiper.emit('realIndexChange');
1468 }
1469 swiper.emit('slideChange');
1470 }
1471 }
1472
1473 function updateClickedSlide(el, path) {
1474 const swiper = this;
1475 const params = swiper.params;
1476 let slide = el.closest(`.${params.slideClass}, swiper-slide`);
1477 if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) {
1478 [...path.slice(path.indexOf(el) + 1, path.length)].forEach(pathEl => {
1479 if (!slide && pathEl.matches && pathEl.matches(`.${params.slideClass}, swiper-slide`)) {
1480 slide = pathEl;
1481 }
1482 });
1483 }
1484 let slideFound = false;
1485 let slideIndex;
1486 if (slide) {
1487 for (let i = 0; i < swiper.slides.length; i += 1) {
1488 if (swiper.slides[i] === slide) {
1489 slideFound = true;
1490 slideIndex = i;
1491 break;
1492 }
1493 }
1494 }
1495 if (slide && slideFound) {
1496 swiper.clickedSlide = slide;
1497 if (swiper.virtual && swiper.params.virtual.enabled) {
1498 swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10);
1499 } else {
1500 swiper.clickedIndex = slideIndex;
1501 }
1502 } else {
1503 swiper.clickedSlide = undefined;
1504 swiper.clickedIndex = undefined;
1505 return;
1506 }
1507 if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
1508 swiper.slideToClickedSlide();
1509 }
1510 }
1511
1512 var update = {
1513 updateSize,
1514 updateSlides,
1515 updateAutoHeight,
1516 updateSlidesOffset,
1517 updateSlidesProgress,
1518 updateProgress,
1519 updateSlidesClasses,
1520 updateActiveIndex,
1521 updateClickedSlide
1522 };
1523
1524 function getSwiperTranslate(axis) {
1525 if (axis === void 0) {
1526 axis = this.isHorizontal() ? 'x' : 'y';
1527 }
1528 const swiper = this;
1529 const {
1530 params,
1531 rtlTranslate: rtl,
1532 translate,
1533 wrapperEl
1534 } = swiper;
1535 if (params.virtualTranslate) {
1536 return rtl ? -translate : translate;
1537 }
1538 if (params.cssMode) {
1539 return translate;
1540 }
1541 let currentTranslate = getTranslate(wrapperEl, axis);
1542 currentTranslate += swiper.cssOverflowAdjustment();
1543 if (rtl) currentTranslate = -currentTranslate;
1544 return currentTranslate || 0;
1545 }
1546
1547 function setTranslate(translate, byController) {
1548 const swiper = this;
1549 const {
1550 rtlTranslate: rtl,
1551 params,
1552 wrapperEl,
1553 progress
1554 } = swiper;
1555 let x = 0;
1556 let y = 0;
1557 const z = 0;
1558 if (swiper.isHorizontal()) {
1559 x = rtl ? -translate : translate;
1560 } else {
1561 y = translate;
1562 }
1563 if (params.roundLengths) {
1564 x = Math.floor(x);
1565 y = Math.floor(y);
1566 }
1567 swiper.previousTranslate = swiper.translate;
1568 swiper.translate = swiper.isHorizontal() ? x : y;
1569 if (params.cssMode) {
1570 wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
1571 } else if (!params.virtualTranslate) {
1572 if (swiper.isHorizontal()) {
1573 x -= swiper.cssOverflowAdjustment();
1574 } else {
1575 y -= swiper.cssOverflowAdjustment();
1576 }
1577 wrapperEl.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`;
1578 }
1579
1580 // Check if we need to update progress
1581 let newProgress;
1582 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
1583 if (translatesDiff === 0) {
1584 newProgress = 0;
1585 } else {
1586 newProgress = (translate - swiper.minTranslate()) / translatesDiff;
1587 }
1588 if (newProgress !== progress) {
1589 swiper.updateProgress(translate);
1590 }
1591 swiper.emit('setTranslate', swiper.translate, byController);
1592 }
1593
1594 function minTranslate() {
1595 return -this.snapGrid[0];
1596 }
1597
1598 function maxTranslate() {
1599 return -this.snapGrid[this.snapGrid.length - 1];
1600 }
1601
1602 function translateTo(translate, speed, runCallbacks, translateBounds, internal) {
1603 if (translate === void 0) {
1604 translate = 0;
1605 }
1606 if (speed === void 0) {
1607 speed = this.params.speed;
1608 }
1609 if (runCallbacks === void 0) {
1610 runCallbacks = true;
1611 }
1612 if (translateBounds === void 0) {
1613 translateBounds = true;
1614 }
1615 const swiper = this;
1616 const {
1617 params,
1618 wrapperEl
1619 } = swiper;
1620 if (swiper.animating && params.preventInteractionOnTransition) {
1621 return false;
1622 }
1623 const minTranslate = swiper.minTranslate();
1624 const maxTranslate = swiper.maxTranslate();
1625 let newTranslate;
1626 if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate;
1627
1628 // Update progress
1629 swiper.updateProgress(newTranslate);
1630 if (params.cssMode) {
1631 const isH = swiper.isHorizontal();
1632 if (speed === 0) {
1633 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
1634 } else {
1635 if (!swiper.support.smoothScroll) {
1636 animateCSSModeScroll({
1637 swiper,
1638 targetPosition: -newTranslate,
1639 side: isH ? 'left' : 'top'
1640 });
1641 return true;
1642 }
1643 wrapperEl.scrollTo({
1644 [isH ? 'left' : 'top']: -newTranslate,
1645 behavior: 'smooth'
1646 });
1647 }
1648 return true;
1649 }
1650 if (speed === 0) {
1651 swiper.setTransition(0);
1652 swiper.setTranslate(newTranslate);
1653 if (runCallbacks) {
1654 swiper.emit('beforeTransitionStart', speed, internal);
1655 swiper.emit('transitionEnd');
1656 }
1657 } else {
1658 swiper.setTransition(speed);
1659 swiper.setTranslate(newTranslate);
1660 if (runCallbacks) {
1661 swiper.emit('beforeTransitionStart', speed, internal);
1662 swiper.emit('transitionStart');
1663 }
1664 if (!swiper.animating) {
1665 swiper.animating = true;
1666 if (!swiper.onTranslateToWrapperTransitionEnd) {
1667 swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {
1668 if (!swiper || swiper.destroyed) return;
1669 if (e.target !== this) return;
1670 swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
1671 swiper.onTranslateToWrapperTransitionEnd = null;
1672 delete swiper.onTranslateToWrapperTransitionEnd;
1673 swiper.animating = false;
1674 if (runCallbacks) {
1675 swiper.emit('transitionEnd');
1676 }
1677 };
1678 }
1679 swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
1680 }
1681 }
1682 return true;
1683 }
1684
1685 var translate = {
1686 getTranslate: getSwiperTranslate,
1687 setTranslate,
1688 minTranslate,
1689 maxTranslate,
1690 translateTo
1691 };
1692
1693 function setTransition(duration, byController) {
1694 const swiper = this;
1695 if (!swiper.params.cssMode) {
1696 swiper.wrapperEl.style.transitionDuration = `${duration}ms`;
1697 swiper.wrapperEl.style.transitionDelay = duration === 0 ? `0ms` : '';
1698 }
1699 swiper.emit('setTransition', duration, byController);
1700 }
1701
1702 function transitionEmit(_ref) {
1703 let {
1704 swiper,
1705 runCallbacks,
1706 direction,
1707 step
1708 } = _ref;
1709 const {
1710 activeIndex,
1711 previousIndex
1712 } = swiper;
1713 let dir = direction;
1714 if (!dir) {
1715 if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
1716 }
1717 swiper.emit(`transition${step}`);
1718 if (runCallbacks && activeIndex !== previousIndex) {
1719 if (dir === 'reset') {
1720 swiper.emit(`slideResetTransition${step}`);
1721 return;
1722 }
1723 swiper.emit(`slideChangeTransition${step}`);
1724 if (dir === 'next') {
1725 swiper.emit(`slideNextTransition${step}`);
1726 } else {
1727 swiper.emit(`slidePrevTransition${step}`);
1728 }
1729 }
1730 }
1731
1732 function transitionStart(runCallbacks, direction) {
1733 if (runCallbacks === void 0) {
1734 runCallbacks = true;
1735 }
1736 const swiper = this;
1737 const {
1738 params
1739 } = swiper;
1740 if (params.cssMode) return;
1741 if (params.autoHeight) {
1742 swiper.updateAutoHeight();
1743 }
1744 transitionEmit({
1745 swiper,
1746 runCallbacks,
1747 direction,
1748 step: 'Start'
1749 });
1750 }
1751
1752 function transitionEnd(runCallbacks, direction) {
1753 if (runCallbacks === void 0) {
1754 runCallbacks = true;
1755 }
1756 const swiper = this;
1757 const {
1758 params
1759 } = swiper;
1760 swiper.animating = false;
1761 if (params.cssMode) return;
1762 swiper.setTransition(0);
1763 transitionEmit({
1764 swiper,
1765 runCallbacks,
1766 direction,
1767 step: 'End'
1768 });
1769 }
1770
1771 var transition = {
1772 setTransition,
1773 transitionStart,
1774 transitionEnd
1775 };
1776
1777 function slideTo(index, speed, runCallbacks, internal, initial) {
1778 if (index === void 0) {
1779 index = 0;
1780 }
1781 if (runCallbacks === void 0) {
1782 runCallbacks = true;
1783 }
1784 if (typeof index === 'string') {
1785 index = parseInt(index, 10);
1786 }
1787 const swiper = this;
1788 let slideIndex = index;
1789 if (slideIndex < 0) slideIndex = 0;
1790 const {
1791 params,
1792 snapGrid,
1793 slidesGrid,
1794 previousIndex,
1795 activeIndex,
1796 rtlTranslate: rtl,
1797 wrapperEl,
1798 enabled
1799 } = swiper;
1800 if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) {
1801 return false;
1802 }
1803 if (typeof speed === 'undefined') {
1804 speed = swiper.params.speed;
1805 }
1806 const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
1807 let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
1808 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
1809 const translate = -snapGrid[snapIndex];
1810 // Normalize slideIndex
1811 if (params.normalizeSlideIndex) {
1812 for (let i = 0; i < slidesGrid.length; i += 1) {
1813 const normalizedTranslate = -Math.floor(translate * 100);
1814 const normalizedGrid = Math.floor(slidesGrid[i] * 100);
1815 const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);
1816 if (typeof slidesGrid[i + 1] !== 'undefined') {
1817 if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) {
1818 slideIndex = i;
1819 } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) {
1820 slideIndex = i + 1;
1821 }
1822 } else if (normalizedTranslate >= normalizedGrid) {
1823 slideIndex = i;
1824 }
1825 }
1826 }
1827 // Directions locks
1828 if (swiper.initialized && slideIndex !== activeIndex) {
1829 if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) {
1830 return false;
1831 }
1832 if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
1833 if ((activeIndex || 0) !== slideIndex) {
1834 return false;
1835 }
1836 }
1837 }
1838 if (slideIndex !== (previousIndex || 0) && runCallbacks) {
1839 swiper.emit('beforeSlideChangeStart');
1840 }
1841
1842 // Update progress
1843 swiper.updateProgress(translate);
1844 let direction;
1845 if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset';
1846
1847 // Update Index
1848 if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
1849 swiper.updateActiveIndex(slideIndex);
1850 // Update Height
1851 if (params.autoHeight) {
1852 swiper.updateAutoHeight();
1853 }
1854 swiper.updateSlidesClasses();
1855 if (params.effect !== 'slide') {
1856 swiper.setTranslate(translate);
1857 }
1858 if (direction !== 'reset') {
1859 swiper.transitionStart(runCallbacks, direction);
1860 swiper.transitionEnd(runCallbacks, direction);
1861 }
1862 return false;
1863 }
1864 if (params.cssMode) {
1865 const isH = swiper.isHorizontal();
1866 const t = rtl ? translate : -translate;
1867 if (speed === 0) {
1868 const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
1869 if (isVirtual) {
1870 swiper.wrapperEl.style.scrollSnapType = 'none';
1871 swiper._immediateVirtual = true;
1872 }
1873 if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) {
1874 swiper._cssModeVirtualInitialSet = true;
1875 requestAnimationFrame(() => {
1876 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
1877 });
1878 } else {
1879 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
1880 }
1881 if (isVirtual) {
1882 requestAnimationFrame(() => {
1883 swiper.wrapperEl.style.scrollSnapType = '';
1884 swiper._immediateVirtual = false;
1885 });
1886 }
1887 } else {
1888 if (!swiper.support.smoothScroll) {
1889 animateCSSModeScroll({
1890 swiper,
1891 targetPosition: t,
1892 side: isH ? 'left' : 'top'
1893 });
1894 return true;
1895 }
1896 wrapperEl.scrollTo({
1897 [isH ? 'left' : 'top']: t,
1898 behavior: 'smooth'
1899 });
1900 }
1901 return true;
1902 }
1903 swiper.setTransition(speed);
1904 swiper.setTranslate(translate);
1905 swiper.updateActiveIndex(slideIndex);
1906 swiper.updateSlidesClasses();
1907 swiper.emit('beforeTransitionStart', speed, internal);
1908 swiper.transitionStart(runCallbacks, direction);
1909 if (speed === 0) {
1910 swiper.transitionEnd(runCallbacks, direction);
1911 } else if (!swiper.animating) {
1912 swiper.animating = true;
1913 if (!swiper.onSlideToWrapperTransitionEnd) {
1914 swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
1915 if (!swiper || swiper.destroyed) return;
1916 if (e.target !== this) return;
1917 swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
1918 swiper.onSlideToWrapperTransitionEnd = null;
1919 delete swiper.onSlideToWrapperTransitionEnd;
1920 swiper.transitionEnd(runCallbacks, direction);
1921 };
1922 }
1923 swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
1924 }
1925 return true;
1926 }
1927
1928 function slideToLoop(index, speed, runCallbacks, internal) {
1929 if (index === void 0) {
1930 index = 0;
1931 }
1932 if (runCallbacks === void 0) {
1933 runCallbacks = true;
1934 }
1935 if (typeof index === 'string') {
1936 const indexAsNumber = parseInt(index, 10);
1937 index = indexAsNumber;
1938 }
1939 const swiper = this;
1940 if (swiper.destroyed) return;
1941 if (typeof speed === 'undefined') {
1942 speed = swiper.params.speed;
1943 }
1944 const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
1945 let newIndex = index;
1946 if (swiper.params.loop) {
1947 if (swiper.virtual && swiper.params.virtual.enabled) {
1948 // eslint-disable-next-line
1949 newIndex = newIndex + swiper.virtual.slidesBefore;
1950 } else {
1951 let targetSlideIndex;
1952 if (gridEnabled) {
1953 const slideIndex = newIndex * swiper.params.grid.rows;
1954 targetSlideIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
1955 } else {
1956 targetSlideIndex = swiper.getSlideIndexByData(newIndex);
1957 }
1958 const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length;
1959 const {
1960 centeredSlides
1961 } = swiper.params;
1962 let slidesPerView = swiper.params.slidesPerView;
1963 if (slidesPerView === 'auto') {
1964 slidesPerView = swiper.slidesPerViewDynamic();
1965 } else {
1966 slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
1967 if (centeredSlides && slidesPerView % 2 === 0) {
1968 slidesPerView = slidesPerView + 1;
1969 }
1970 }
1971 let needLoopFix = cols - targetSlideIndex < slidesPerView;
1972 if (centeredSlides) {
1973 needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
1974 }
1975 if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) {
1976 needLoopFix = false;
1977 }
1978 if (needLoopFix) {
1979 const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
1980 swiper.loopFix({
1981 direction,
1982 slideTo: true,
1983 activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
1984 slideRealIndex: direction === 'next' ? swiper.realIndex : undefined
1985 });
1986 }
1987 if (gridEnabled) {
1988 const slideIndex = newIndex * swiper.params.grid.rows;
1989 newIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
1990 } else {
1991 newIndex = swiper.getSlideIndexByData(newIndex);
1992 }
1993 }
1994 }
1995 requestAnimationFrame(() => {
1996 swiper.slideTo(newIndex, speed, runCallbacks, internal);
1997 });
1998 return swiper;
1999 }
2000
2001 /* eslint no-unused-vars: "off" */
2002 function slideNext(speed, runCallbacks, internal) {
2003 if (runCallbacks === void 0) {
2004 runCallbacks = true;
2005 }
2006 const swiper = this;
2007 const {
2008 enabled,
2009 params,
2010 animating
2011 } = swiper;
2012 if (!enabled || swiper.destroyed) return swiper;
2013 if (typeof speed === 'undefined') {
2014 speed = swiper.params.speed;
2015 }
2016 let perGroup = params.slidesPerGroup;
2017 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
2018 perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
2019 }
2020 const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;
2021 const isVirtual = swiper.virtual && params.virtual.enabled;
2022 if (params.loop) {
2023 if (animating && !isVirtual && params.loopPreventsSliding) return false;
2024 swiper.loopFix({
2025 direction: 'next'
2026 });
2027 // eslint-disable-next-line
2028 swiper._clientLeft = swiper.wrapperEl.clientLeft;
2029 if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) {
2030 requestAnimationFrame(() => {
2031 swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
2032 });
2033 return true;
2034 }
2035 }
2036 if (params.rewind && swiper.isEnd) {
2037 return swiper.slideTo(0, speed, runCallbacks, internal);
2038 }
2039 return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
2040 }
2041
2042 /* eslint no-unused-vars: "off" */
2043 function slidePrev(speed, runCallbacks, internal) {
2044 if (runCallbacks === void 0) {
2045 runCallbacks = true;
2046 }
2047 const swiper = this;
2048 const {
2049 params,
2050 snapGrid,
2051 slidesGrid,
2052 rtlTranslate,
2053 enabled,
2054 animating
2055 } = swiper;
2056 if (!enabled || swiper.destroyed) return swiper;
2057 if (typeof speed === 'undefined') {
2058 speed = swiper.params.speed;
2059 }
2060 const isVirtual = swiper.virtual && params.virtual.enabled;
2061 if (params.loop) {
2062 if (animating && !isVirtual && params.loopPreventsSliding) return false;
2063 swiper.loopFix({
2064 direction: 'prev'
2065 });
2066 // eslint-disable-next-line
2067 swiper._clientLeft = swiper.wrapperEl.clientLeft;
2068 }
2069 const translate = rtlTranslate ? swiper.translate : -swiper.translate;
2070 function normalize(val) {
2071 if (val < 0) return -Math.floor(Math.abs(val));
2072 return Math.floor(val);
2073 }
2074 const normalizedTranslate = normalize(translate);
2075 const normalizedSnapGrid = snapGrid.map(val => normalize(val));
2076 let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
2077 if (typeof prevSnap === 'undefined' && params.cssMode) {
2078 let prevSnapIndex;
2079 snapGrid.forEach((snap, snapIndex) => {
2080 if (normalizedTranslate >= snap) {
2081 // prevSnap = snap;
2082 prevSnapIndex = snapIndex;
2083 }
2084 });
2085 if (typeof prevSnapIndex !== 'undefined') {
2086 prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
2087 }
2088 }
2089 let prevIndex = 0;
2090 if (typeof prevSnap !== 'undefined') {
2091 prevIndex = slidesGrid.indexOf(prevSnap);
2092 if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;
2093 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
2094 prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1;
2095 prevIndex = Math.max(prevIndex, 0);
2096 }
2097 }
2098 if (params.rewind && swiper.isBeginning) {
2099 const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
2100 return swiper.slideTo(lastIndex, speed, runCallbacks, internal);
2101 } else if (params.loop && swiper.activeIndex === 0 && params.cssMode) {
2102 requestAnimationFrame(() => {
2103 swiper.slideTo(prevIndex, speed, runCallbacks, internal);
2104 });
2105 return true;
2106 }
2107 return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
2108 }
2109
2110 /* eslint no-unused-vars: "off" */
2111 function slideReset(speed, runCallbacks, internal) {
2112 if (runCallbacks === void 0) {
2113 runCallbacks = true;
2114 }
2115 const swiper = this;
2116 if (swiper.destroyed) return;
2117 if (typeof speed === 'undefined') {
2118 speed = swiper.params.speed;
2119 }
2120 return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
2121 }
2122
2123 /* eslint no-unused-vars: "off" */
2124 function slideToClosest(speed, runCallbacks, internal, threshold) {
2125 if (runCallbacks === void 0) {
2126 runCallbacks = true;
2127 }
2128 if (threshold === void 0) {
2129 threshold = 0.5;
2130 }
2131 const swiper = this;
2132 if (swiper.destroyed) return;
2133 if (typeof speed === 'undefined') {
2134 speed = swiper.params.speed;
2135 }
2136 let index = swiper.activeIndex;
2137 const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
2138 const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
2139 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
2140 if (translate >= swiper.snapGrid[snapIndex]) {
2141 // The current translate is on or after the current snap index, so the choice
2142 // is between the current index and the one after it.
2143 const currentSnap = swiper.snapGrid[snapIndex];
2144 const nextSnap = swiper.snapGrid[snapIndex + 1];
2145 if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
2146 index += swiper.params.slidesPerGroup;
2147 }
2148 } else {
2149 // The current translate is before the current snap index, so the choice
2150 // is between the current index and the one before it.
2151 const prevSnap = swiper.snapGrid[snapIndex - 1];
2152 const currentSnap = swiper.snapGrid[snapIndex];
2153 if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) {
2154 index -= swiper.params.slidesPerGroup;
2155 }
2156 }
2157 index = Math.max(index, 0);
2158 index = Math.min(index, swiper.slidesGrid.length - 1);
2159 return swiper.slideTo(index, speed, runCallbacks, internal);
2160 }
2161
2162 function slideToClickedSlide() {
2163 const swiper = this;
2164 if (swiper.destroyed) return;
2165 const {
2166 params,
2167 slidesEl
2168 } = swiper;
2169 const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
2170 let slideToIndex = swiper.clickedIndex;
2171 let realIndex;
2172 const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`;
2173 if (params.loop) {
2174 if (swiper.animating) return;
2175 realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);
2176 if (params.centeredSlides) {
2177 if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
2178 swiper.loopFix();
2179 slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
2180 nextTick(() => {
2181 swiper.slideTo(slideToIndex);
2182 });
2183 } else {
2184 swiper.slideTo(slideToIndex);
2185 }
2186 } else if (slideToIndex > swiper.slides.length - slidesPerView) {
2187 swiper.loopFix();
2188 slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
2189 nextTick(() => {
2190 swiper.slideTo(slideToIndex);
2191 });
2192 } else {
2193 swiper.slideTo(slideToIndex);
2194 }
2195 } else {
2196 swiper.slideTo(slideToIndex);
2197 }
2198 }
2199
2200 var slide = {
2201 slideTo,
2202 slideToLoop,
2203 slideNext,
2204 slidePrev,
2205 slideReset,
2206 slideToClosest,
2207 slideToClickedSlide
2208 };
2209
2210 function loopCreate(slideRealIndex) {
2211 const swiper = this;
2212 const {
2213 params,
2214 slidesEl
2215 } = swiper;
2216 if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
2217 const initSlides = () => {
2218 const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
2219 slides.forEach((el, index) => {
2220 el.setAttribute('data-swiper-slide-index', index);
2221 });
2222 };
2223 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
2224 const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1);
2225 const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;
2226 const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;
2227 const addBlankSlides = amountOfSlides => {
2228 for (let i = 0; i < amountOfSlides; i += 1) {
2229 const slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]);
2230 swiper.slidesEl.append(slideEl);
2231 }
2232 };
2233 if (shouldFillGroup) {
2234 if (params.loopAddBlankSlides) {
2235 const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup;
2236 addBlankSlides(slidesToAdd);
2237 swiper.recalcSlides();
2238 swiper.updateSlides();
2239 } else {
2240 showWarning('Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');
2241 }
2242 initSlides();
2243 } else if (shouldFillGrid) {
2244 if (params.loopAddBlankSlides) {
2245 const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows;
2246 addBlankSlides(slidesToAdd);
2247 swiper.recalcSlides();
2248 swiper.updateSlides();
2249 } else {
2250 showWarning('Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');
2251 }
2252 initSlides();
2253 } else {
2254 initSlides();
2255 }
2256 swiper.loopFix({
2257 slideRealIndex,
2258 direction: params.centeredSlides ? undefined : 'next'
2259 });
2260 }
2261
2262 function loopFix(_temp) {
2263 let {
2264 slideRealIndex,
2265 slideTo = true,
2266 direction,
2267 setTranslate,
2268 activeSlideIndex,
2269 byController,
2270 byMousewheel
2271 } = _temp === void 0 ? {} : _temp;
2272 const swiper = this;
2273 if (!swiper.params.loop) return;
2274 swiper.emit('beforeLoopFix');
2275 const {
2276 slides,
2277 allowSlidePrev,
2278 allowSlideNext,
2279 slidesEl,
2280 params
2281 } = swiper;
2282 const {
2283 centeredSlides
2284 } = params;
2285 swiper.allowSlidePrev = true;
2286 swiper.allowSlideNext = true;
2287 if (swiper.virtual && params.virtual.enabled) {
2288 if (slideTo) {
2289 if (!params.centeredSlides && swiper.snapIndex === 0) {
2290 swiper.slideTo(swiper.virtual.slides.length, 0, false, true);
2291 } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) {
2292 swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true);
2293 } else if (swiper.snapIndex === swiper.snapGrid.length - 1) {
2294 swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true);
2295 }
2296 }
2297 swiper.allowSlidePrev = allowSlidePrev;
2298 swiper.allowSlideNext = allowSlideNext;
2299 swiper.emit('loopFix');
2300 return;
2301 }
2302 let slidesPerView = params.slidesPerView;
2303 if (slidesPerView === 'auto') {
2304 slidesPerView = swiper.slidesPerViewDynamic();
2305 } else {
2306 slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));
2307 if (centeredSlides && slidesPerView % 2 === 0) {
2308 slidesPerView = slidesPerView + 1;
2309 }
2310 }
2311 const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;
2312 let loopedSlides = slidesPerGroup;
2313 if (loopedSlides % slidesPerGroup !== 0) {
2314 loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
2315 }
2316 loopedSlides += params.loopAdditionalSlides;
2317 swiper.loopedSlides = loopedSlides;
2318 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
2319 if (slides.length < slidesPerView + loopedSlides) {
2320 showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters');
2321 } else if (gridEnabled && params.grid.fill === 'row') {
2322 showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`');
2323 }
2324 const prependSlidesIndexes = [];
2325 const appendSlidesIndexes = [];
2326 let activeIndex = swiper.activeIndex;
2327 if (typeof activeSlideIndex === 'undefined') {
2328 activeSlideIndex = swiper.getSlideIndex(slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
2329 } else {
2330 activeIndex = activeSlideIndex;
2331 }
2332 const isNext = direction === 'next' || !direction;
2333 const isPrev = direction === 'prev' || !direction;
2334 let slidesPrepended = 0;
2335 let slidesAppended = 0;
2336 const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length;
2337 const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex;
2338 const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0);
2339 // prepend last slides before start
2340 if (activeColIndexWithShift < loopedSlides) {
2341 slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup);
2342 for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
2343 const index = i - Math.floor(i / cols) * cols;
2344 if (gridEnabled) {
2345 const colIndexToPrepend = cols - index - 1;
2346 for (let i = slides.length - 1; i >= 0; i -= 1) {
2347 if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i);
2348 }
2349 // slides.forEach((slide, slideIndex) => {
2350 // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex);
2351 // });
2352 } else {
2353 prependSlidesIndexes.push(cols - index - 1);
2354 }
2355 }
2356 } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) {
2357 slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup);
2358 for (let i = 0; i < slidesAppended; i += 1) {
2359 const index = i - Math.floor(i / cols) * cols;
2360 if (gridEnabled) {
2361 slides.forEach((slide, slideIndex) => {
2362 if (slide.column === index) appendSlidesIndexes.push(slideIndex);
2363 });
2364 } else {
2365 appendSlidesIndexes.push(index);
2366 }
2367 }
2368 }
2369 swiper.__preventObserver__ = true;
2370 requestAnimationFrame(() => {
2371 swiper.__preventObserver__ = false;
2372 });
2373 if (isPrev) {
2374 prependSlidesIndexes.forEach(index => {
2375 slides[index].swiperLoopMoveDOM = true;
2376 slidesEl.prepend(slides[index]);
2377 slides[index].swiperLoopMoveDOM = false;
2378 });
2379 }
2380 if (isNext) {
2381 appendSlidesIndexes.forEach(index => {
2382 slides[index].swiperLoopMoveDOM = true;
2383 slidesEl.append(slides[index]);
2384 slides[index].swiperLoopMoveDOM = false;
2385 });
2386 }
2387 swiper.recalcSlides();
2388 if (params.slidesPerView === 'auto') {
2389 swiper.updateSlides();
2390 } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) {
2391 swiper.slides.forEach((slide, slideIndex) => {
2392 swiper.grid.updateSlide(slideIndex, slide, swiper.slides);
2393 });
2394 }
2395 if (params.watchSlidesProgress) {
2396 swiper.updateSlidesOffset();
2397 }
2398 if (slideTo) {
2399 if (prependSlidesIndexes.length > 0 && isPrev) {
2400 if (typeof slideRealIndex === 'undefined') {
2401 const currentSlideTranslate = swiper.slidesGrid[activeIndex];
2402 const newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended];
2403 const diff = newSlideTranslate - currentSlideTranslate;
2404 if (byMousewheel) {
2405 swiper.setTranslate(swiper.translate - diff);
2406 } else {
2407 swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true);
2408 if (setTranslate) {
2409 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
2410 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
2411 }
2412 }
2413 } else {
2414 if (setTranslate) {
2415 const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length;
2416 swiper.slideTo(swiper.activeIndex + shift, 0, false, true);
2417 swiper.touchEventsData.currentTranslate = swiper.translate;
2418 }
2419 }
2420 } else if (appendSlidesIndexes.length > 0 && isNext) {
2421 if (typeof slideRealIndex === 'undefined') {
2422 const currentSlideTranslate = swiper.slidesGrid[activeIndex];
2423 const newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended];
2424 const diff = newSlideTranslate - currentSlideTranslate;
2425 if (byMousewheel) {
2426 swiper.setTranslate(swiper.translate - diff);
2427 } else {
2428 swiper.slideTo(activeIndex - slidesAppended, 0, false, true);
2429 if (setTranslate) {
2430 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
2431 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
2432 }
2433 }
2434 } else {
2435 const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length;
2436 swiper.slideTo(swiper.activeIndex - shift, 0, false, true);
2437 }
2438 }
2439 }
2440 swiper.allowSlidePrev = allowSlidePrev;
2441 swiper.allowSlideNext = allowSlideNext;
2442 if (swiper.controller && swiper.controller.control && !byController) {
2443 const loopParams = {
2444 slideRealIndex,
2445 direction,
2446 setTranslate,
2447 activeSlideIndex,
2448 byController: true
2449 };
2450 if (Array.isArray(swiper.controller.control)) {
2451 swiper.controller.control.forEach(c => {
2452 if (!c.destroyed && c.params.loop) c.loopFix({
2453 ...loopParams,
2454 slideTo: c.params.slidesPerView === params.slidesPerView ? slideTo : false
2455 });
2456 });
2457 } else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) {
2458 swiper.controller.control.loopFix({
2459 ...loopParams,
2460 slideTo: swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false
2461 });
2462 }
2463 }
2464 swiper.emit('loopFix');
2465 }
2466
2467 function loopDestroy() {
2468 const swiper = this;
2469 const {
2470 params,
2471 slidesEl
2472 } = swiper;
2473 if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
2474 swiper.recalcSlides();
2475 const newSlidesOrder = [];
2476 swiper.slides.forEach(slideEl => {
2477 const index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex;
2478 newSlidesOrder[index] = slideEl;
2479 });
2480 swiper.slides.forEach(slideEl => {
2481 slideEl.removeAttribute('data-swiper-slide-index');
2482 });
2483 newSlidesOrder.forEach(slideEl => {
2484 slidesEl.append(slideEl);
2485 });
2486 swiper.recalcSlides();
2487 swiper.slideTo(swiper.realIndex, 0);
2488 }
2489
2490 var loop = {
2491 loopCreate,
2492 loopFix,
2493 loopDestroy
2494 };
2495
2496 function setGrabCursor(moving) {
2497 const swiper = this;
2498 if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
2499 const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl;
2500 if (swiper.isElement) {
2501 swiper.__preventObserver__ = true;
2502 }
2503 el.style.cursor = 'move';
2504 el.style.cursor = moving ? 'grabbing' : 'grab';
2505 if (swiper.isElement) {
2506 requestAnimationFrame(() => {
2507 swiper.__preventObserver__ = false;
2508 });
2509 }
2510 }
2511
2512 function unsetGrabCursor() {
2513 const swiper = this;
2514 if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
2515 return;
2516 }
2517 if (swiper.isElement) {
2518 swiper.__preventObserver__ = true;
2519 }
2520 swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = '';
2521 if (swiper.isElement) {
2522 requestAnimationFrame(() => {
2523 swiper.__preventObserver__ = false;
2524 });
2525 }
2526 }
2527
2528 var grabCursor = {
2529 setGrabCursor,
2530 unsetGrabCursor
2531 };
2532
2533 // Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd
2534 function closestElement(selector, base) {
2535 if (base === void 0) {
2536 base = this;
2537 }
2538 function __closestFrom(el) {
2539 if (!el || el === getDocument() || el === getWindow()) return null;
2540 if (el.assignedSlot) el = el.assignedSlot;
2541 const found = el.closest(selector);
2542 if (!found && !el.getRootNode) {
2543 return null;
2544 }
2545 return found || __closestFrom(el.getRootNode().host);
2546 }
2547 return __closestFrom(base);
2548 }
2549 function preventEdgeSwipe(swiper, event, startX) {
2550 const window = getWindow();
2551 const {
2552 params
2553 } = swiper;
2554 const edgeSwipeDetection = params.edgeSwipeDetection;
2555 const edgeSwipeThreshold = params.edgeSwipeThreshold;
2556 if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
2557 if (edgeSwipeDetection === 'prevent') {
2558 event.preventDefault();
2559 return true;
2560 }
2561 return false;
2562 }
2563 return true;
2564 }
2565 function onTouchStart(event) {
2566 const swiper = this;
2567 const document = getDocument();
2568 let e = event;
2569 if (e.originalEvent) e = e.originalEvent;
2570 const data = swiper.touchEventsData;
2571 if (e.type === 'pointerdown') {
2572 if (data.pointerId !== null && data.pointerId !== e.pointerId) {
2573 return;
2574 }
2575 data.pointerId = e.pointerId;
2576 } else if (e.type === 'touchstart' && e.targetTouches.length === 1) {
2577 data.touchId = e.targetTouches[0].identifier;
2578 }
2579 if (e.type === 'touchstart') {
2580 // don't proceed touch event
2581 preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX);
2582 return;
2583 }
2584 const {
2585 params,
2586 touches,
2587 enabled
2588 } = swiper;
2589 if (!enabled) return;
2590 if (!params.simulateTouch && e.pointerType === 'mouse') return;
2591 if (swiper.animating && params.preventInteractionOnTransition) {
2592 return;
2593 }
2594 if (!swiper.animating && params.cssMode && params.loop) {
2595 swiper.loopFix();
2596 }
2597 let targetEl = e.target;
2598 if (params.touchEventsTarget === 'wrapper') {
2599 if (!swiper.wrapperEl.contains(targetEl)) return;
2600 }
2601 if ('which' in e && e.which === 3) return;
2602 if ('button' in e && e.button > 0) return;
2603 if (data.isTouched && data.isMoved) return;
2604
2605 // change target el for shadow root component
2606 const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
2607 // eslint-disable-next-line
2608 const eventPath = e.composedPath ? e.composedPath() : e.path;
2609 if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
2610 targetEl = eventPath[0];
2611 }
2612 const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`;
2613 const isTargetShadow = !!(e.target && e.target.shadowRoot);
2614
2615 // use closestElement for shadow root element to get the actual closest for nested shadow root element
2616 if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) {
2617 swiper.allowClick = true;
2618 return;
2619 }
2620 if (params.swipeHandler) {
2621 if (!targetEl.closest(params.swipeHandler)) return;
2622 }
2623 touches.currentX = e.pageX;
2624 touches.currentY = e.pageY;
2625 const startX = touches.currentX;
2626 const startY = touches.currentY;
2627
2628 // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
2629
2630 if (!preventEdgeSwipe(swiper, e, startX)) {
2631 return;
2632 }
2633 Object.assign(data, {
2634 isTouched: true,
2635 isMoved: false,
2636 allowTouchCallbacks: true,
2637 isScrolling: undefined,
2638 startMoving: undefined
2639 });
2640 touches.startX = startX;
2641 touches.startY = startY;
2642 data.touchStartTime = now();
2643 swiper.allowClick = true;
2644 swiper.updateSize();
2645 swiper.swipeDirection = undefined;
2646 if (params.threshold > 0) data.allowThresholdMove = false;
2647 let preventDefault = true;
2648 if (targetEl.matches(data.focusableElements)) {
2649 preventDefault = false;
2650 if (targetEl.nodeName === 'SELECT') {
2651 data.isTouched = false;
2652 }
2653 }
2654 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl) {
2655 document.activeElement.blur();
2656 }
2657 const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
2658 if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) {
2659 e.preventDefault();
2660 }
2661 if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) {
2662 swiper.freeMode.onTouchStart();
2663 }
2664 swiper.emit('touchStart', e);
2665 }
2666
2667 function onTouchMove(event) {
2668 const document = getDocument();
2669 const swiper = this;
2670 const data = swiper.touchEventsData;
2671 const {
2672 params,
2673 touches,
2674 rtlTranslate: rtl,
2675 enabled
2676 } = swiper;
2677 if (!enabled) return;
2678 if (!params.simulateTouch && event.pointerType === 'mouse') return;
2679 let e = event;
2680 if (e.originalEvent) e = e.originalEvent;
2681 if (e.type === 'pointermove') {
2682 if (data.touchId !== null) return; // return from pointer if we use touch
2683 const id = e.pointerId;
2684 if (id !== data.pointerId) return;
2685 }
2686 let targetTouch;
2687 if (e.type === 'touchmove') {
2688 targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
2689 if (!targetTouch || targetTouch.identifier !== data.touchId) return;
2690 } else {
2691 targetTouch = e;
2692 }
2693 if (!data.isTouched) {
2694 if (data.startMoving && data.isScrolling) {
2695 swiper.emit('touchMoveOpposite', e);
2696 }
2697 return;
2698 }
2699 const pageX = targetTouch.pageX;
2700 const pageY = targetTouch.pageY;
2701 if (e.preventedByNestedSwiper) {
2702 touches.startX = pageX;
2703 touches.startY = pageY;
2704 return;
2705 }
2706 if (!swiper.allowTouchMove) {
2707 if (!e.target.matches(data.focusableElements)) {
2708 swiper.allowClick = false;
2709 }
2710 if (data.isTouched) {
2711 Object.assign(touches, {
2712 startX: pageX,
2713 startY: pageY,
2714 currentX: pageX,
2715 currentY: pageY
2716 });
2717 data.touchStartTime = now();
2718 }
2719 return;
2720 }
2721 if (params.touchReleaseOnEdges && !params.loop) {
2722 if (swiper.isVertical()) {
2723 // Vertical
2724 if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
2725 data.isTouched = false;
2726 data.isMoved = false;
2727 return;
2728 }
2729 } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
2730 return;
2731 }
2732 }
2733 if (document.activeElement) {
2734 if (e.target === document.activeElement && e.target.matches(data.focusableElements)) {
2735 data.isMoved = true;
2736 swiper.allowClick = false;
2737 return;
2738 }
2739 }
2740 if (data.allowTouchCallbacks) {
2741 swiper.emit('touchMove', e);
2742 }
2743 touches.previousX = touches.currentX;
2744 touches.previousY = touches.currentY;
2745 touches.currentX = pageX;
2746 touches.currentY = pageY;
2747 const diffX = touches.currentX - touches.startX;
2748 const diffY = touches.currentY - touches.startY;
2749 if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return;
2750 if (typeof data.isScrolling === 'undefined') {
2751 let touchAngle;
2752 if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
2753 data.isScrolling = false;
2754 } else {
2755 // eslint-disable-next-line
2756 if (diffX * diffX + diffY * diffY >= 25) {
2757 touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
2758 data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
2759 }
2760 }
2761 }
2762 if (data.isScrolling) {
2763 swiper.emit('touchMoveOpposite', e);
2764 }
2765 if (typeof data.startMoving === 'undefined') {
2766 if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
2767 data.startMoving = true;
2768 }
2769 }
2770 if (data.isScrolling || e.type === 'touchmove' && data.preventTouchMoveFromPointerMove) {
2771 data.isTouched = false;
2772 return;
2773 }
2774 if (!data.startMoving) {
2775 return;
2776 }
2777 swiper.allowClick = false;
2778 if (!params.cssMode && e.cancelable) {
2779 e.preventDefault();
2780 }
2781 if (params.touchMoveStopPropagation && !params.nested) {
2782 e.stopPropagation();
2783 }
2784 let diff = swiper.isHorizontal() ? diffX : diffY;
2785 let touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY;
2786 if (params.oneWayMovement) {
2787 diff = Math.abs(diff) * (rtl ? 1 : -1);
2788 touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1);
2789 }
2790 touches.diff = diff;
2791 diff *= params.touchRatio;
2792 if (rtl) {
2793 diff = -diff;
2794 touchesDiff = -touchesDiff;
2795 }
2796 const prevTouchesDirection = swiper.touchesDirection;
2797 swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
2798 swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next';
2799 const isLoop = swiper.params.loop && !params.cssMode;
2800 const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev;
2801 if (!data.isMoved) {
2802 if (isLoop && allowLoopFix) {
2803 swiper.loopFix({
2804 direction: swiper.swipeDirection
2805 });
2806 }
2807 data.startTranslate = swiper.getTranslate();
2808 swiper.setTransition(0);
2809 if (swiper.animating) {
2810 const evt = new window.CustomEvent('transitionend', {
2811 bubbles: true,
2812 cancelable: true,
2813 detail: {
2814 bySwiperTouchMove: true
2815 }
2816 });
2817 swiper.wrapperEl.dispatchEvent(evt);
2818 }
2819 data.allowMomentumBounce = false;
2820 // Grab Cursor
2821 if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
2822 swiper.setGrabCursor(true);
2823 }
2824 swiper.emit('sliderFirstMove', e);
2825 }
2826 let loopFixed;
2827 new Date().getTime();
2828 if (data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
2829 Object.assign(touches, {
2830 startX: pageX,
2831 startY: pageY,
2832 currentX: pageX,
2833 currentY: pageY,
2834 startTranslate: data.currentTranslate
2835 });
2836 data.loopSwapReset = true;
2837 data.startTranslate = data.currentTranslate;
2838 return;
2839 }
2840 swiper.emit('sliderMove', e);
2841 data.isMoved = true;
2842 data.currentTranslate = diff + data.startTranslate;
2843 let disableParentSwiper = true;
2844 let resistanceRatio = params.resistanceRatio;
2845 if (params.touchReleaseOnEdges) {
2846 resistanceRatio = 0;
2847 }
2848 if (diff > 0) {
2849 if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] : swiper.minTranslate())) {
2850 swiper.loopFix({
2851 direction: 'prev',
2852 setTranslate: true,
2853 activeSlideIndex: 0
2854 });
2855 }
2856 if (data.currentTranslate > swiper.minTranslate()) {
2857 disableParentSwiper = false;
2858 if (params.resistance) {
2859 data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio;
2860 }
2861 }
2862 } else if (diff < 0) {
2863 if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] : swiper.maxTranslate())) {
2864 swiper.loopFix({
2865 direction: 'next',
2866 setTranslate: true,
2867 activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10)))
2868 });
2869 }
2870 if (data.currentTranslate < swiper.maxTranslate()) {
2871 disableParentSwiper = false;
2872 if (params.resistance) {
2873 data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio;
2874 }
2875 }
2876 }
2877 if (disableParentSwiper) {
2878 e.preventedByNestedSwiper = true;
2879 }
2880
2881 // Directions locks
2882 if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
2883 data.currentTranslate = data.startTranslate;
2884 }
2885 if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
2886 data.currentTranslate = data.startTranslate;
2887 }
2888 if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {
2889 data.currentTranslate = data.startTranslate;
2890 }
2891
2892 // Threshold
2893 if (params.threshold > 0) {
2894 if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
2895 if (!data.allowThresholdMove) {
2896 data.allowThresholdMove = true;
2897 touches.startX = touches.currentX;
2898 touches.startY = touches.currentY;
2899 data.currentTranslate = data.startTranslate;
2900 touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
2901 return;
2902 }
2903 } else {
2904 data.currentTranslate = data.startTranslate;
2905 return;
2906 }
2907 }
2908 if (!params.followFinger || params.cssMode) return;
2909
2910 // Update active index in free mode
2911 if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) {
2912 swiper.updateActiveIndex();
2913 swiper.updateSlidesClasses();
2914 }
2915 if (params.freeMode && params.freeMode.enabled && swiper.freeMode) {
2916 swiper.freeMode.onTouchMove();
2917 }
2918 // Update progress
2919 swiper.updateProgress(data.currentTranslate);
2920 // Update translate
2921 swiper.setTranslate(data.currentTranslate);
2922 }
2923
2924 function onTouchEnd(event) {
2925 const swiper = this;
2926 const data = swiper.touchEventsData;
2927 let e = event;
2928 if (e.originalEvent) e = e.originalEvent;
2929 let targetTouch;
2930 const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel';
2931 if (!isTouchEvent) {
2932 if (data.touchId !== null) return; // return from pointer if we use touch
2933 if (e.pointerId !== data.pointerId) return;
2934 targetTouch = e;
2935 } else {
2936 targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
2937 if (!targetTouch || targetTouch.identifier !== data.touchId) return;
2938 }
2939 if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) {
2940 const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
2941 if (!proceed) {
2942 return;
2943 }
2944 }
2945 data.pointerId = null;
2946 data.touchId = null;
2947 const {
2948 params,
2949 touches,
2950 rtlTranslate: rtl,
2951 slidesGrid,
2952 enabled
2953 } = swiper;
2954 if (!enabled) return;
2955 if (!params.simulateTouch && e.pointerType === 'mouse') return;
2956 if (data.allowTouchCallbacks) {
2957 swiper.emit('touchEnd', e);
2958 }
2959 data.allowTouchCallbacks = false;
2960 if (!data.isTouched) {
2961 if (data.isMoved && params.grabCursor) {
2962 swiper.setGrabCursor(false);
2963 }
2964 data.isMoved = false;
2965 data.startMoving = false;
2966 return;
2967 }
2968
2969 // Return Grab Cursor
2970 if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
2971 swiper.setGrabCursor(false);
2972 }
2973
2974 // Time diff
2975 const touchEndTime = now();
2976 const timeDiff = touchEndTime - data.touchStartTime;
2977
2978 // Tap, doubleTap, Click
2979 if (swiper.allowClick) {
2980 const pathTree = e.path || e.composedPath && e.composedPath();
2981 swiper.updateClickedSlide(pathTree && pathTree[0] || e.target, pathTree);
2982 swiper.emit('tap click', e);
2983 if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
2984 swiper.emit('doubleTap doubleClick', e);
2985 }
2986 }
2987 data.lastClickTime = now();
2988 nextTick(() => {
2989 if (!swiper.destroyed) swiper.allowClick = true;
2990 });
2991 if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) {
2992 data.isTouched = false;
2993 data.isMoved = false;
2994 data.startMoving = false;
2995 return;
2996 }
2997 data.isTouched = false;
2998 data.isMoved = false;
2999 data.startMoving = false;
3000 let currentPos;
3001 if (params.followFinger) {
3002 currentPos = rtl ? swiper.translate : -swiper.translate;
3003 } else {
3004 currentPos = -data.currentTranslate;
3005 }
3006 if (params.cssMode) {
3007 return;
3008 }
3009 if (params.freeMode && params.freeMode.enabled) {
3010 swiper.freeMode.onTouchEnd({
3011 currentPos
3012 });
3013 return;
3014 }
3015
3016 // Find current slide
3017 const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop;
3018 let stopIndex = 0;
3019 let groupSize = swiper.slidesSizesGrid[0];
3020 for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
3021 const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
3022 if (typeof slidesGrid[i + increment] !== 'undefined') {
3023 if (swipeToLast || currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
3024 stopIndex = i;
3025 groupSize = slidesGrid[i + increment] - slidesGrid[i];
3026 }
3027 } else if (swipeToLast || currentPos >= slidesGrid[i]) {
3028 stopIndex = i;
3029 groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
3030 }
3031 }
3032 let rewindFirstIndex = null;
3033 let rewindLastIndex = null;
3034 if (params.rewind) {
3035 if (swiper.isBeginning) {
3036 rewindLastIndex = params.virtual && params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
3037 } else if (swiper.isEnd) {
3038 rewindFirstIndex = 0;
3039 }
3040 }
3041 // Find current slide size
3042 const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
3043 const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
3044 if (timeDiff > params.longSwipesMs) {
3045 // Long touches
3046 if (!params.longSwipes) {
3047 swiper.slideTo(swiper.activeIndex);
3048 return;
3049 }
3050 if (swiper.swipeDirection === 'next') {
3051 if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex);
3052 }
3053 if (swiper.swipeDirection === 'prev') {
3054 if (ratio > 1 - params.longSwipesRatio) {
3055 swiper.slideTo(stopIndex + increment);
3056 } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) {
3057 swiper.slideTo(rewindLastIndex);
3058 } else {
3059 swiper.slideTo(stopIndex);
3060 }
3061 }
3062 } else {
3063 // Short swipes
3064 if (!params.shortSwipes) {
3065 swiper.slideTo(swiper.activeIndex);
3066 return;
3067 }
3068 const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);
3069 if (!isNavButtonTarget) {
3070 if (swiper.swipeDirection === 'next') {
3071 swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment);
3072 }
3073 if (swiper.swipeDirection === 'prev') {
3074 swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex);
3075 }
3076 } else if (e.target === swiper.navigation.nextEl) {
3077 swiper.slideTo(stopIndex + increment);
3078 } else {
3079 swiper.slideTo(stopIndex);
3080 }
3081 }
3082 }
3083
3084 function onResize() {
3085 const swiper = this;
3086 const {
3087 params,
3088 el
3089 } = swiper;
3090 if (el && el.offsetWidth === 0) return;
3091
3092 // Breakpoints
3093 if (params.breakpoints) {
3094 swiper.setBreakpoint();
3095 }
3096
3097 // Save locks
3098 const {
3099 allowSlideNext,
3100 allowSlidePrev,
3101 snapGrid
3102 } = swiper;
3103 const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
3104
3105 // Disable locks on resize
3106 swiper.allowSlideNext = true;
3107 swiper.allowSlidePrev = true;
3108 swiper.updateSize();
3109 swiper.updateSlides();
3110 swiper.updateSlidesClasses();
3111 const isVirtualLoop = isVirtual && params.loop;
3112 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) {
3113 swiper.slideTo(swiper.slides.length - 1, 0, false, true);
3114 } else {
3115 if (swiper.params.loop && !isVirtual) {
3116 swiper.slideToLoop(swiper.realIndex, 0, false, true);
3117 } else {
3118 swiper.slideTo(swiper.activeIndex, 0, false, true);
3119 }
3120 }
3121 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
3122 clearTimeout(swiper.autoplay.resizeTimeout);
3123 swiper.autoplay.resizeTimeout = setTimeout(() => {
3124 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
3125 swiper.autoplay.resume();
3126 }
3127 }, 500);
3128 }
3129 // Return locks after resize
3130 swiper.allowSlidePrev = allowSlidePrev;
3131 swiper.allowSlideNext = allowSlideNext;
3132 if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
3133 swiper.checkOverflow();
3134 }
3135 }
3136
3137 function onClick(e) {
3138 const swiper = this;
3139 if (!swiper.enabled) return;
3140 if (!swiper.allowClick) {
3141 if (swiper.params.preventClicks) e.preventDefault();
3142 if (swiper.params.preventClicksPropagation && swiper.animating) {
3143 e.stopPropagation();
3144 e.stopImmediatePropagation();
3145 }
3146 }
3147 }
3148
3149 function onScroll() {
3150 const swiper = this;
3151 const {
3152 wrapperEl,
3153 rtlTranslate,
3154 enabled
3155 } = swiper;
3156 if (!enabled) return;
3157 swiper.previousTranslate = swiper.translate;
3158 if (swiper.isHorizontal()) {
3159 swiper.translate = -wrapperEl.scrollLeft;
3160 } else {
3161 swiper.translate = -wrapperEl.scrollTop;
3162 }
3163 // eslint-disable-next-line
3164 if (swiper.translate === 0) swiper.translate = 0;
3165 swiper.updateActiveIndex();
3166 swiper.updateSlidesClasses();
3167 let newProgress;
3168 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
3169 if (translatesDiff === 0) {
3170 newProgress = 0;
3171 } else {
3172 newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
3173 }
3174 if (newProgress !== swiper.progress) {
3175 swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
3176 }
3177 swiper.emit('setTranslate', swiper.translate, false);
3178 }
3179
3180 function onLoad(e) {
3181 const swiper = this;
3182 processLazyPreloader(swiper, e.target);
3183 if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) {
3184 return;
3185 }
3186 swiper.update();
3187 }
3188
3189 function onDocumentTouchStart() {
3190 const swiper = this;
3191 if (swiper.documentTouchHandlerProceeded) return;
3192 swiper.documentTouchHandlerProceeded = true;
3193 if (swiper.params.touchReleaseOnEdges) {
3194 swiper.el.style.touchAction = 'auto';
3195 }
3196 }
3197
3198 const events = (swiper, method) => {
3199 const document = getDocument();
3200 const {
3201 params,
3202 el,
3203 wrapperEl,
3204 device
3205 } = swiper;
3206 const capture = !!params.nested;
3207 const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
3208 const swiperMethod = method;
3209 if (!el || typeof el === 'string') return;
3210
3211 // Touch Events
3212 document[domMethod]('touchstart', swiper.onDocumentTouchStart, {
3213 passive: false,
3214 capture
3215 });
3216 el[domMethod]('touchstart', swiper.onTouchStart, {
3217 passive: false
3218 });
3219 el[domMethod]('pointerdown', swiper.onTouchStart, {
3220 passive: false
3221 });
3222 document[domMethod]('touchmove', swiper.onTouchMove, {
3223 passive: false,
3224 capture
3225 });
3226 document[domMethod]('pointermove', swiper.onTouchMove, {
3227 passive: false,
3228 capture
3229 });
3230 document[domMethod]('touchend', swiper.onTouchEnd, {
3231 passive: true
3232 });
3233 document[domMethod]('pointerup', swiper.onTouchEnd, {
3234 passive: true
3235 });
3236 document[domMethod]('pointercancel', swiper.onTouchEnd, {
3237 passive: true
3238 });
3239 document[domMethod]('touchcancel', swiper.onTouchEnd, {
3240 passive: true
3241 });
3242 document[domMethod]('pointerout', swiper.onTouchEnd, {
3243 passive: true
3244 });
3245 document[domMethod]('pointerleave', swiper.onTouchEnd, {
3246 passive: true
3247 });
3248 document[domMethod]('contextmenu', swiper.onTouchEnd, {
3249 passive: true
3250 });
3251
3252 // Prevent Links Clicks
3253 if (params.preventClicks || params.preventClicksPropagation) {
3254 el[domMethod]('click', swiper.onClick, true);
3255 }
3256 if (params.cssMode) {
3257 wrapperEl[domMethod]('scroll', swiper.onScroll);
3258 }
3259
3260 // Resize handler
3261 if (params.updateOnWindowResize) {
3262 swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);
3263 } else {
3264 swiper[swiperMethod]('observerUpdate', onResize, true);
3265 }
3266
3267 // Images loader
3268 el[domMethod]('load', swiper.onLoad, {
3269 capture: true
3270 });
3271 };
3272 function attachEvents() {
3273 const swiper = this;
3274 const {
3275 params
3276 } = swiper;
3277 swiper.onTouchStart = onTouchStart.bind(swiper);
3278 swiper.onTouchMove = onTouchMove.bind(swiper);
3279 swiper.onTouchEnd = onTouchEnd.bind(swiper);
3280 swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper);
3281 if (params.cssMode) {
3282 swiper.onScroll = onScroll.bind(swiper);
3283 }
3284 swiper.onClick = onClick.bind(swiper);
3285 swiper.onLoad = onLoad.bind(swiper);
3286 events(swiper, 'on');
3287 }
3288 function detachEvents() {
3289 const swiper = this;
3290 events(swiper, 'off');
3291 }
3292 var events$1 = {
3293 attachEvents,
3294 detachEvents
3295 };
3296
3297 const isGridEnabled = (swiper, params) => {
3298 return swiper.grid && params.grid && params.grid.rows > 1;
3299 };
3300 function setBreakpoint() {
3301 const swiper = this;
3302 const {
3303 realIndex,
3304 initialized,
3305 params,
3306 el
3307 } = swiper;
3308 const breakpoints = params.breakpoints;
3309 if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return;
3310
3311 // Get breakpoint for window width and update parameters
3312 const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);
3313 if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
3314 const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
3315 const breakpointParams = breakpointOnlyParams || swiper.originalParams;
3316 const wasMultiRow = isGridEnabled(swiper, params);
3317 const isMultiRow = isGridEnabled(swiper, breakpointParams);
3318 const wasGrabCursor = swiper.params.grabCursor;
3319 const isGrabCursor = breakpointParams.grabCursor;
3320 const wasEnabled = params.enabled;
3321 if (wasMultiRow && !isMultiRow) {
3322 el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);
3323 swiper.emitContainerClasses();
3324 } else if (!wasMultiRow && isMultiRow) {
3325 el.classList.add(`${params.containerModifierClass}grid`);
3326 if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {
3327 el.classList.add(`${params.containerModifierClass}grid-column`);
3328 }
3329 swiper.emitContainerClasses();
3330 }
3331 if (wasGrabCursor && !isGrabCursor) {
3332 swiper.unsetGrabCursor();
3333 } else if (!wasGrabCursor && isGrabCursor) {
3334 swiper.setGrabCursor();
3335 }
3336
3337 // Toggle navigation, pagination, scrollbar
3338 ['navigation', 'pagination', 'scrollbar'].forEach(prop => {
3339 if (typeof breakpointParams[prop] === 'undefined') return;
3340 const wasModuleEnabled = params[prop] && params[prop].enabled;
3341 const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled;
3342 if (wasModuleEnabled && !isModuleEnabled) {
3343 swiper[prop].disable();
3344 }
3345 if (!wasModuleEnabled && isModuleEnabled) {
3346 swiper[prop].enable();
3347 }
3348 });
3349 const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
3350 const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
3351 const wasLoop = params.loop;
3352 if (directionChanged && initialized) {
3353 swiper.changeDirection();
3354 }
3355 extend(swiper.params, breakpointParams);
3356 const isEnabled = swiper.params.enabled;
3357 const hasLoop = swiper.params.loop;
3358 Object.assign(swiper, {
3359 allowTouchMove: swiper.params.allowTouchMove,
3360 allowSlideNext: swiper.params.allowSlideNext,
3361 allowSlidePrev: swiper.params.allowSlidePrev
3362 });
3363 if (wasEnabled && !isEnabled) {
3364 swiper.disable();
3365 } else if (!wasEnabled && isEnabled) {
3366 swiper.enable();
3367 }
3368 swiper.currentBreakpoint = breakpoint;
3369 swiper.emit('_beforeBreakpoint', breakpointParams);
3370 if (initialized) {
3371 if (needsReLoop) {
3372 swiper.loopDestroy();
3373 swiper.loopCreate(realIndex);
3374 swiper.updateSlides();
3375 } else if (!wasLoop && hasLoop) {
3376 swiper.loopCreate(realIndex);
3377 swiper.updateSlides();
3378 } else if (wasLoop && !hasLoop) {
3379 swiper.loopDestroy();
3380 }
3381 }
3382 swiper.emit('breakpoint', breakpointParams);
3383 }
3384
3385 function getBreakpoint(breakpoints, base, containerEl) {
3386 if (base === void 0) {
3387 base = 'window';
3388 }
3389 if (!breakpoints || base === 'container' && !containerEl) return undefined;
3390 let breakpoint = false;
3391 const window = getWindow();
3392 const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;
3393 const points = Object.keys(breakpoints).map(point => {
3394 if (typeof point === 'string' && point.indexOf('@') === 0) {
3395 const minRatio = parseFloat(point.substr(1));
3396 const value = currentHeight * minRatio;
3397 return {
3398 value,
3399 point
3400 };
3401 }
3402 return {
3403 value: point,
3404 point
3405 };
3406 });
3407 points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10));
3408 for (let i = 0; i < points.length; i += 1) {
3409 const {
3410 point,
3411 value
3412 } = points[i];
3413 if (base === 'window') {
3414 if (window.matchMedia(`(min-width: ${value}px)`).matches) {
3415 breakpoint = point;
3416 }
3417 } else if (value <= containerEl.clientWidth) {
3418 breakpoint = point;
3419 }
3420 }
3421 return breakpoint || 'max';
3422 }
3423
3424 var breakpoints = {
3425 setBreakpoint,
3426 getBreakpoint
3427 };
3428
3429 function prepareClasses(entries, prefix) {
3430 const resultClasses = [];
3431 entries.forEach(item => {
3432 if (typeof item === 'object') {
3433 Object.keys(item).forEach(classNames => {
3434 if (item[classNames]) {
3435 resultClasses.push(prefix + classNames);
3436 }
3437 });
3438 } else if (typeof item === 'string') {
3439 resultClasses.push(prefix + item);
3440 }
3441 });
3442 return resultClasses;
3443 }
3444 function addClasses() {
3445 const swiper = this;
3446 const {
3447 classNames,
3448 params,
3449 rtl,
3450 el,
3451 device
3452 } = swiper;
3453 // prettier-ignore
3454 const suffixes = prepareClasses(['initialized', params.direction, {
3455 'free-mode': swiper.params.freeMode && params.freeMode.enabled
3456 }, {
3457 'autoheight': params.autoHeight
3458 }, {
3459 'rtl': rtl
3460 }, {
3461 'grid': params.grid && params.grid.rows > 1
3462 }, {
3463 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column'
3464 }, {
3465 'android': device.android
3466 }, {
3467 'ios': device.ios
3468 }, {
3469 'css-mode': params.cssMode
3470 }, {
3471 'centered': params.cssMode && params.centeredSlides
3472 }, {
3473 'watch-progress': params.watchSlidesProgress
3474 }], params.containerModifierClass);
3475 classNames.push(...suffixes);
3476 el.classList.add(...classNames);
3477 swiper.emitContainerClasses();
3478 }
3479
3480 function removeClasses() {
3481 const swiper = this;
3482 const {
3483 el,
3484 classNames
3485 } = swiper;
3486 if (!el || typeof el === 'string') return;
3487 el.classList.remove(...classNames);
3488 swiper.emitContainerClasses();
3489 }
3490
3491 var classes = {
3492 addClasses,
3493 removeClasses
3494 };
3495
3496 function checkOverflow() {
3497 const swiper = this;
3498 const {
3499 isLocked: wasLocked,
3500 params
3501 } = swiper;
3502 const {
3503 slidesOffsetBefore
3504 } = params;
3505 if (slidesOffsetBefore) {
3506 const lastSlideIndex = swiper.slides.length - 1;
3507 const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;
3508 swiper.isLocked = swiper.size > lastSlideRightEdge;
3509 } else {
3510 swiper.isLocked = swiper.snapGrid.length === 1;
3511 }
3512 if (params.allowSlideNext === true) {
3513 swiper.allowSlideNext = !swiper.isLocked;
3514 }
3515 if (params.allowSlidePrev === true) {
3516 swiper.allowSlidePrev = !swiper.isLocked;
3517 }
3518 if (wasLocked && wasLocked !== swiper.isLocked) {
3519 swiper.isEnd = false;
3520 }
3521 if (wasLocked !== swiper.isLocked) {
3522 swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
3523 }
3524 }
3525 var checkOverflow$1 = {
3526 checkOverflow
3527 };
3528
3529 var defaults = {
3530 init: true,
3531 direction: 'horizontal',
3532 oneWayMovement: false,
3533 swiperElementNodeName: 'SWIPER-CONTAINER',
3534 touchEventsTarget: 'wrapper',
3535 initialSlide: 0,
3536 speed: 300,
3537 cssMode: false,
3538 updateOnWindowResize: true,
3539 resizeObserver: true,
3540 nested: false,
3541 createElements: false,
3542 eventsPrefix: 'swiper',
3543 enabled: true,
3544 focusableElements: 'input, select, option, textarea, button, video, label',
3545 // Overrides
3546 width: null,
3547 height: null,
3548 //
3549 preventInteractionOnTransition: false,
3550 // ssr
3551 userAgent: null,
3552 url: null,
3553 // To support iOS's swipe-to-go-back gesture (when being used in-app).
3554 edgeSwipeDetection: false,
3555 edgeSwipeThreshold: 20,
3556 // Autoheight
3557 autoHeight: false,
3558 // Set wrapper width
3559 setWrapperSize: false,
3560 // Virtual Translate
3561 virtualTranslate: false,
3562 // Effects
3563 effect: 'slide',
3564 // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
3565
3566 // Breakpoints
3567 breakpoints: undefined,
3568 breakpointsBase: 'window',
3569 // Slides grid
3570 spaceBetween: 0,
3571 slidesPerView: 1,
3572 slidesPerGroup: 1,
3573 slidesPerGroupSkip: 0,
3574 slidesPerGroupAuto: false,
3575 centeredSlides: false,
3576 centeredSlidesBounds: false,
3577 slidesOffsetBefore: 0,
3578 // in px
3579 slidesOffsetAfter: 0,
3580 // in px
3581 normalizeSlideIndex: true,
3582 centerInsufficientSlides: false,
3583 // Disable swiper and hide navigation when container not overflow
3584 watchOverflow: true,
3585 // Round length
3586 roundLengths: false,
3587 // Touches
3588 touchRatio: 1,
3589 touchAngle: 45,
3590 simulateTouch: true,
3591 shortSwipes: true,
3592 longSwipes: true,
3593 longSwipesRatio: 0.5,
3594 longSwipesMs: 300,
3595 followFinger: true,
3596 allowTouchMove: true,
3597 threshold: 5,
3598 touchMoveStopPropagation: false,
3599 touchStartPreventDefault: true,
3600 touchStartForcePreventDefault: false,
3601 touchReleaseOnEdges: false,
3602 // Unique Navigation Elements
3603 uniqueNavElements: true,
3604 // Resistance
3605 resistance: true,
3606 resistanceRatio: 0.85,
3607 // Progress
3608 watchSlidesProgress: false,
3609 // Cursor
3610 grabCursor: false,
3611 // Clicks
3612 preventClicks: true,
3613 preventClicksPropagation: true,
3614 slideToClickedSlide: false,
3615 // loop
3616 loop: false,
3617 loopAddBlankSlides: true,
3618 loopAdditionalSlides: 0,
3619 loopPreventsSliding: true,
3620 // rewind
3621 rewind: false,
3622 // Swiping/no swiping
3623 allowSlidePrev: true,
3624 allowSlideNext: true,
3625 swipeHandler: null,
3626 // '.swipe-handler',
3627 noSwiping: true,
3628 noSwipingClass: 'swiper-no-swiping',
3629 noSwipingSelector: null,
3630 // Passive Listeners
3631 passiveListeners: true,
3632 maxBackfaceHiddenSlides: 10,
3633 // NS
3634 containerModifierClass: 'swiper-',
3635 // NEW
3636 slideClass: 'swiper-slide',
3637 slideBlankClass: 'swiper-slide-blank',
3638 slideActiveClass: 'swiper-slide-active',
3639 slideVisibleClass: 'swiper-slide-visible',
3640 slideFullyVisibleClass: 'swiper-slide-fully-visible',
3641 slideNextClass: 'swiper-slide-next',
3642 slidePrevClass: 'swiper-slide-prev',
3643 wrapperClass: 'swiper-wrapper',
3644 lazyPreloaderClass: 'swiper-lazy-preloader',
3645 lazyPreloadPrevNext: 0,
3646 // Callbacks
3647 runCallbacksOnInit: true,
3648 // Internals
3649 _emitClasses: false
3650 };
3651
3652 function moduleExtendParams(params, allModulesParams) {
3653 return function extendParams(obj) {
3654 if (obj === void 0) {
3655 obj = {};
3656 }
3657 const moduleParamName = Object.keys(obj)[0];
3658 const moduleParams = obj[moduleParamName];
3659 if (typeof moduleParams !== 'object' || moduleParams === null) {
3660 extend(allModulesParams, obj);
3661 return;
3662 }
3663 if (params[moduleParamName] === true) {
3664 params[moduleParamName] = {
3665 enabled: true
3666 };
3667 }
3668 if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) {
3669 params[moduleParamName].auto = true;
3670 }
3671 if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) {
3672 params[moduleParamName].auto = true;
3673 }
3674 if (!(moduleParamName in params && 'enabled' in moduleParams)) {
3675 extend(allModulesParams, obj);
3676 return;
3677 }
3678 if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
3679 params[moduleParamName].enabled = true;
3680 }
3681 if (!params[moduleParamName]) params[moduleParamName] = {
3682 enabled: false
3683 };
3684 extend(allModulesParams, obj);
3685 };
3686 }
3687
3688 /* eslint no-param-reassign: "off" */
3689 const prototypes = {
3690 eventsEmitter,
3691 update,
3692 translate,
3693 transition,
3694 slide,
3695 loop,
3696 grabCursor,
3697 events: events$1,
3698 breakpoints,
3699 checkOverflow: checkOverflow$1,
3700 classes
3701 };
3702 const extendedDefaults = {};
3703 class Swiper {
3704 constructor() {
3705 let el;
3706 let params;
3707 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3708 args[_key] = arguments[_key];
3709 }
3710 if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {
3711 params = args[0];
3712 } else {
3713 [el, params] = args;
3714 }
3715 if (!params) params = {};
3716 params = extend({}, params);
3717 if (el && !params.el) params.el = el;
3718 const document = getDocument();
3719 if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) {
3720 const swipers = [];
3721 document.querySelectorAll(params.el).forEach(containerEl => {
3722 const newParams = extend({}, params, {
3723 el: containerEl
3724 });
3725 swipers.push(new Swiper(newParams));
3726 });
3727 // eslint-disable-next-line no-constructor-return
3728 return swipers;
3729 }
3730
3731 // Swiper Instance
3732 const swiper = this;
3733 swiper.__swiper__ = true;
3734 swiper.support = getSupport();
3735 swiper.device = getDevice({
3736 userAgent: params.userAgent
3737 });
3738 swiper.browser = getBrowser();
3739 swiper.eventsListeners = {};
3740 swiper.eventsAnyListeners = [];
3741 swiper.modules = [...swiper.__modules__];
3742 if (params.modules && Array.isArray(params.modules)) {
3743 swiper.modules.push(...params.modules);
3744 }
3745 const allModulesParams = {};
3746 swiper.modules.forEach(mod => {
3747 mod({
3748 params,
3749 swiper,
3750 extendParams: moduleExtendParams(params, allModulesParams),
3751 on: swiper.on.bind(swiper),
3752 once: swiper.once.bind(swiper),
3753 off: swiper.off.bind(swiper),
3754 emit: swiper.emit.bind(swiper)
3755 });
3756 });
3757
3758 // Extend defaults with modules params
3759 const swiperParams = extend({}, defaults, allModulesParams);
3760
3761 // Extend defaults with passed params
3762 swiper.params = extend({}, swiperParams, extendedDefaults, params);
3763 swiper.originalParams = extend({}, swiper.params);
3764 swiper.passedParams = extend({}, params);
3765
3766 // add event listeners
3767 if (swiper.params && swiper.params.on) {
3768 Object.keys(swiper.params.on).forEach(eventName => {
3769 swiper.on(eventName, swiper.params.on[eventName]);
3770 });
3771 }
3772 if (swiper.params && swiper.params.onAny) {
3773 swiper.onAny(swiper.params.onAny);
3774 }
3775
3776 // Extend Swiper
3777 Object.assign(swiper, {
3778 enabled: swiper.params.enabled,
3779 el,
3780 // Classes
3781 classNames: [],
3782 // Slides
3783 slides: [],
3784 slidesGrid: [],
3785 snapGrid: [],
3786 slidesSizesGrid: [],
3787 // isDirection
3788 isHorizontal() {
3789 return swiper.params.direction === 'horizontal';
3790 },
3791 isVertical() {
3792 return swiper.params.direction === 'vertical';
3793 },
3794 // Indexes
3795 activeIndex: 0,
3796 realIndex: 0,
3797 //
3798 isBeginning: true,
3799 isEnd: false,
3800 // Props
3801 translate: 0,
3802 previousTranslate: 0,
3803 progress: 0,
3804 velocity: 0,
3805 animating: false,
3806 cssOverflowAdjustment() {
3807 // Returns 0 unless `translate` is > 2**23
3808 // Should be subtracted from css values to prevent overflow
3809 return Math.trunc(this.translate / 2 ** 23) * 2 ** 23;
3810 },
3811 // Locks
3812 allowSlideNext: swiper.params.allowSlideNext,
3813 allowSlidePrev: swiper.params.allowSlidePrev,
3814 // Touch Events
3815 touchEventsData: {
3816 isTouched: undefined,
3817 isMoved: undefined,
3818 allowTouchCallbacks: undefined,
3819 touchStartTime: undefined,
3820 isScrolling: undefined,
3821 currentTranslate: undefined,
3822 startTranslate: undefined,
3823 allowThresholdMove: undefined,
3824 // Form elements to match
3825 focusableElements: swiper.params.focusableElements,
3826 // Last click time
3827 lastClickTime: 0,
3828 clickTimeout: undefined,
3829 // Velocities
3830 velocities: [],
3831 allowMomentumBounce: undefined,
3832 startMoving: undefined,
3833 pointerId: null,
3834 touchId: null
3835 },
3836 // Clicks
3837 allowClick: true,
3838 // Touches
3839 allowTouchMove: swiper.params.allowTouchMove,
3840 touches: {
3841 startX: 0,
3842 startY: 0,
3843 currentX: 0,
3844 currentY: 0,
3845 diff: 0
3846 },
3847 // Images
3848 imagesToLoad: [],
3849 imagesLoaded: 0
3850 });
3851 swiper.emit('_swiper');
3852
3853 // Init
3854 if (swiper.params.init) {
3855 swiper.init();
3856 }
3857
3858 // Return app instance
3859 // eslint-disable-next-line no-constructor-return
3860 return swiper;
3861 }
3862 getDirectionLabel(property) {
3863 if (this.isHorizontal()) {
3864 return property;
3865 }
3866 // prettier-ignore
3867 return {
3868 'width': 'height',
3869 'margin-top': 'margin-left',
3870 'margin-bottom ': 'margin-right',
3871 'margin-left': 'margin-top',
3872 'margin-right': 'margin-bottom',
3873 'padding-left': 'padding-top',
3874 'padding-right': 'padding-bottom',
3875 'marginRight': 'marginBottom'
3876 }[property];
3877 }
3878 getSlideIndex(slideEl) {
3879 const {
3880 slidesEl,
3881 params
3882 } = this;
3883 const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
3884 const firstSlideIndex = elementIndex(slides[0]);
3885 return elementIndex(slideEl) - firstSlideIndex;
3886 }
3887 getSlideIndexByData(index) {
3888 return this.getSlideIndex(this.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index)[0]);
3889 }
3890 recalcSlides() {
3891 const swiper = this;
3892 const {
3893 slidesEl,
3894 params
3895 } = swiper;
3896 swiper.slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
3897 }
3898 enable() {
3899 const swiper = this;
3900 if (swiper.enabled) return;
3901 swiper.enabled = true;
3902 if (swiper.params.grabCursor) {
3903 swiper.setGrabCursor();
3904 }
3905 swiper.emit('enable');
3906 }
3907 disable() {
3908 const swiper = this;
3909 if (!swiper.enabled) return;
3910 swiper.enabled = false;
3911 if (swiper.params.grabCursor) {
3912 swiper.unsetGrabCursor();
3913 }
3914 swiper.emit('disable');
3915 }
3916 setProgress(progress, speed) {
3917 const swiper = this;
3918 progress = Math.min(Math.max(progress, 0), 1);
3919 const min = swiper.minTranslate();
3920 const max = swiper.maxTranslate();
3921 const current = (max - min) * progress + min;
3922 swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);
3923 swiper.updateActiveIndex();
3924 swiper.updateSlidesClasses();
3925 }
3926 emitContainerClasses() {
3927 const swiper = this;
3928 if (!swiper.params._emitClasses || !swiper.el) return;
3929 const cls = swiper.el.className.split(' ').filter(className => {
3930 return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;
3931 });
3932 swiper.emit('_containerClasses', cls.join(' '));
3933 }
3934 getSlideClasses(slideEl) {
3935 const swiper = this;
3936 if (swiper.destroyed) return '';
3937 return slideEl.className.split(' ').filter(className => {
3938 return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;
3939 }).join(' ');
3940 }
3941 emitSlidesClasses() {
3942 const swiper = this;
3943 if (!swiper.params._emitClasses || !swiper.el) return;
3944 const updates = [];
3945 swiper.slides.forEach(slideEl => {
3946 const classNames = swiper.getSlideClasses(slideEl);
3947 updates.push({
3948 slideEl,
3949 classNames
3950 });
3951 swiper.emit('_slideClass', slideEl, classNames);
3952 });
3953 swiper.emit('_slideClasses', updates);
3954 }
3955 slidesPerViewDynamic(view, exact) {
3956 if (view === void 0) {
3957 view = 'current';
3958 }
3959 if (exact === void 0) {
3960 exact = false;
3961 }
3962 const swiper = this;
3963 const {
3964 params,
3965 slides,
3966 slidesGrid,
3967 slidesSizesGrid,
3968 size: swiperSize,
3969 activeIndex
3970 } = swiper;
3971 let spv = 1;
3972 if (typeof params.slidesPerView === 'number') return params.slidesPerView;
3973 if (params.centeredSlides) {
3974 let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0;
3975 let breakLoop;
3976 for (let i = activeIndex + 1; i < slides.length; i += 1) {
3977 if (slides[i] && !breakLoop) {
3978 slideSize += Math.ceil(slides[i].swiperSlideSize);
3979 spv += 1;
3980 if (slideSize > swiperSize) breakLoop = true;
3981 }
3982 }
3983 for (let i = activeIndex - 1; i >= 0; i -= 1) {
3984 if (slides[i] && !breakLoop) {
3985 slideSize += slides[i].swiperSlideSize;
3986 spv += 1;
3987 if (slideSize > swiperSize) breakLoop = true;
3988 }
3989 }
3990 } else {
3991 // eslint-disable-next-line
3992 if (view === 'current') {
3993 for (let i = activeIndex + 1; i < slides.length; i += 1) {
3994 const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize;
3995 if (slideInView) {
3996 spv += 1;
3997 }
3998 }
3999 } else {
4000 // previous
4001 for (let i = activeIndex - 1; i >= 0; i -= 1) {
4002 const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize;
4003 if (slideInView) {
4004 spv += 1;
4005 }
4006 }
4007 }
4008 }
4009 return spv;
4010 }
4011 update() {
4012 const swiper = this;
4013 if (!swiper || swiper.destroyed) return;
4014 const {
4015 snapGrid,
4016 params
4017 } = swiper;
4018 // Breakpoints
4019 if (params.breakpoints) {
4020 swiper.setBreakpoint();
4021 }
4022 [...swiper.el.querySelectorAll('[loading="lazy"]')].forEach(imageEl => {
4023 if (imageEl.complete) {
4024 processLazyPreloader(swiper, imageEl);
4025 }
4026 });
4027 swiper.updateSize();
4028 swiper.updateSlides();
4029 swiper.updateProgress();
4030 swiper.updateSlidesClasses();
4031 function setTranslate() {
4032 const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
4033 const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
4034 swiper.setTranslate(newTranslate);
4035 swiper.updateActiveIndex();
4036 swiper.updateSlidesClasses();
4037 }
4038 let translated;
4039 if (params.freeMode && params.freeMode.enabled && !params.cssMode) {
4040 setTranslate();
4041 if (params.autoHeight) {
4042 swiper.updateAutoHeight();
4043 }
4044 } else {
4045 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) {
4046 const slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides;
4047 translated = swiper.slideTo(slides.length - 1, 0, false, true);
4048 } else {
4049 translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
4050 }
4051 if (!translated) {
4052 setTranslate();
4053 }
4054 }
4055 if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
4056 swiper.checkOverflow();
4057 }
4058 swiper.emit('update');
4059 }
4060 changeDirection(newDirection, needUpdate) {
4061 if (needUpdate === void 0) {
4062 needUpdate = true;
4063 }
4064 const swiper = this;
4065 const currentDirection = swiper.params.direction;
4066 if (!newDirection) {
4067 // eslint-disable-next-line
4068 newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
4069 }
4070 if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
4071 return swiper;
4072 }
4073 swiper.el.classList.remove(`${swiper.params.containerModifierClass}${currentDirection}`);
4074 swiper.el.classList.add(`${swiper.params.containerModifierClass}${newDirection}`);
4075 swiper.emitContainerClasses();
4076 swiper.params.direction = newDirection;
4077 swiper.slides.forEach(slideEl => {
4078 if (newDirection === 'vertical') {
4079 slideEl.style.width = '';
4080 } else {
4081 slideEl.style.height = '';
4082 }
4083 });
4084 swiper.emit('changeDirection');
4085 if (needUpdate) swiper.update();
4086 return swiper;
4087 }
4088 changeLanguageDirection(direction) {
4089 const swiper = this;
4090 if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return;
4091 swiper.rtl = direction === 'rtl';
4092 swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl;
4093 if (swiper.rtl) {
4094 swiper.el.classList.add(`${swiper.params.containerModifierClass}rtl`);
4095 swiper.el.dir = 'rtl';
4096 } else {
4097 swiper.el.classList.remove(`${swiper.params.containerModifierClass}rtl`);
4098 swiper.el.dir = 'ltr';
4099 }
4100 swiper.update();
4101 }
4102 mount(element) {
4103 const swiper = this;
4104 if (swiper.mounted) return true;
4105
4106 // Find el
4107 let el = element || swiper.params.el;
4108 if (typeof el === 'string') {
4109 el = document.querySelector(el);
4110 }
4111 if (!el) {
4112 return false;
4113 }
4114 el.swiper = swiper;
4115 if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) {
4116 swiper.isElement = true;
4117 }
4118 const getWrapperSelector = () => {
4119 return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`;
4120 };
4121 const getWrapper = () => {
4122 if (el && el.shadowRoot && el.shadowRoot.querySelector) {
4123 const res = el.shadowRoot.querySelector(getWrapperSelector());
4124 // Children needs to return slot items
4125 return res;
4126 }
4127 return elementChildren(el, getWrapperSelector())[0];
4128 };
4129 // Find Wrapper
4130 let wrapperEl = getWrapper();
4131 if (!wrapperEl && swiper.params.createElements) {
4132 wrapperEl = createElement('div', swiper.params.wrapperClass);
4133 el.append(wrapperEl);
4134 elementChildren(el, `.${swiper.params.slideClass}`).forEach(slideEl => {
4135 wrapperEl.append(slideEl);
4136 });
4137 }
4138 Object.assign(swiper, {
4139 el,
4140 wrapperEl,
4141 slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl,
4142 hostEl: swiper.isElement ? el.parentNode.host : el,
4143 mounted: true,
4144 // RTL
4145 rtl: el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl',
4146 rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl'),
4147 wrongRTL: elementStyle(wrapperEl, 'display') === '-webkit-box'
4148 });
4149 return true;
4150 }
4151 init(el) {
4152 const swiper = this;
4153 if (swiper.initialized) return swiper;
4154 const mounted = swiper.mount(el);
4155 if (mounted === false) return swiper;
4156 swiper.emit('beforeInit');
4157
4158 // Set breakpoint
4159 if (swiper.params.breakpoints) {
4160 swiper.setBreakpoint();
4161 }
4162
4163 // Add Classes
4164 swiper.addClasses();
4165
4166 // Update size
4167 swiper.updateSize();
4168
4169 // Update slides
4170 swiper.updateSlides();
4171 if (swiper.params.watchOverflow) {
4172 swiper.checkOverflow();
4173 }
4174
4175 // Set Grab Cursor
4176 if (swiper.params.grabCursor && swiper.enabled) {
4177 swiper.setGrabCursor();
4178 }
4179
4180 // Slide To Initial Slide
4181 if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
4182 swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true);
4183 } else {
4184 swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
4185 }
4186
4187 // Create loop
4188 if (swiper.params.loop) {
4189 swiper.loopCreate();
4190 }
4191
4192 // Attach events
4193 swiper.attachEvents();
4194 const lazyElements = [...swiper.el.querySelectorAll('[loading="lazy"]')];
4195 if (swiper.isElement) {
4196 lazyElements.push(...swiper.hostEl.querySelectorAll('[loading="lazy"]'));
4197 }
4198 lazyElements.forEach(imageEl => {
4199 if (imageEl.complete) {
4200 processLazyPreloader(swiper, imageEl);
4201 } else {
4202 imageEl.addEventListener('load', e => {
4203 processLazyPreloader(swiper, e.target);
4204 });
4205 }
4206 });
4207 preload(swiper);
4208
4209 // Init Flag
4210 swiper.initialized = true;
4211 preload(swiper);
4212
4213 // Emit
4214 swiper.emit('init');
4215 swiper.emit('afterInit');
4216 return swiper;
4217 }
4218 destroy(deleteInstance, cleanStyles) {
4219 if (deleteInstance === void 0) {
4220 deleteInstance = true;
4221 }
4222 if (cleanStyles === void 0) {
4223 cleanStyles = true;
4224 }
4225 const swiper = this;
4226 const {
4227 params,
4228 el,
4229 wrapperEl,
4230 slides
4231 } = swiper;
4232 if (typeof swiper.params === 'undefined' || swiper.destroyed) {
4233 return null;
4234 }
4235 swiper.emit('beforeDestroy');
4236
4237 // Init Flag
4238 swiper.initialized = false;
4239
4240 // Detach events
4241 swiper.detachEvents();
4242
4243 // Destroy loop
4244 if (params.loop) {
4245 swiper.loopDestroy();
4246 }
4247
4248 // Cleanup styles
4249 if (cleanStyles) {
4250 swiper.removeClasses();
4251 if (el && typeof el !== 'string') {
4252 el.removeAttribute('style');
4253 }
4254 if (wrapperEl) {
4255 wrapperEl.removeAttribute('style');
4256 }
4257 if (slides && slides.length) {
4258 slides.forEach(slideEl => {
4259 slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
4260 slideEl.removeAttribute('style');
4261 slideEl.removeAttribute('data-swiper-slide-index');
4262 });
4263 }
4264 }
4265 swiper.emit('destroy');
4266
4267 // Detach emitter events
4268 Object.keys(swiper.eventsListeners).forEach(eventName => {
4269 swiper.off(eventName);
4270 });
4271 if (deleteInstance !== false) {
4272 if (swiper.el && typeof swiper.el !== 'string') {
4273 swiper.el.swiper = null;
4274 }
4275 deleteProps(swiper);
4276 }
4277 swiper.destroyed = true;
4278 return null;
4279 }
4280 static extendDefaults(newDefaults) {
4281 extend(extendedDefaults, newDefaults);
4282 }
4283 static get extendedDefaults() {
4284 return extendedDefaults;
4285 }
4286 static get defaults() {
4287 return defaults;
4288 }
4289 static installModule(mod) {
4290 if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = [];
4291 const modules = Swiper.prototype.__modules__;
4292 if (typeof mod === 'function' && modules.indexOf(mod) < 0) {
4293 modules.push(mod);
4294 }
4295 }
4296 static use(module) {
4297 if (Array.isArray(module)) {
4298 module.forEach(m => Swiper.installModule(m));
4299 return Swiper;
4300 }
4301 Swiper.installModule(module);
4302 return Swiper;
4303 }
4304 }
4305 Object.keys(prototypes).forEach(prototypeGroup => {
4306 Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => {
4307 Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
4308 });
4309 });
4310 Swiper.use([Resize, Observer]);
4311
4312 function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
4313 if (swiper.params.createElements) {
4314 Object.keys(checkProps).forEach(key => {
4315 if (!params[key] && params.auto === true) {
4316 let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0];
4317 if (!element) {
4318 element = createElement('div', checkProps[key]);
4319 element.className = checkProps[key];
4320 swiper.el.append(element);
4321 }
4322 params[key] = element;
4323 originalParams[key] = element;
4324 }
4325 });
4326 }
4327 return params;
4328 }
4329
4330 function Navigation(_ref) {
4331 let {
4332 swiper,
4333 extendParams,
4334 on,
4335 emit
4336 } = _ref;
4337 extendParams({
4338 navigation: {
4339 nextEl: null,
4340 prevEl: null,
4341 hideOnClick: false,
4342 disabledClass: 'swiper-button-disabled',
4343 hiddenClass: 'swiper-button-hidden',
4344 lockClass: 'swiper-button-lock',
4345 navigationDisabledClass: 'swiper-navigation-disabled'
4346 }
4347 });
4348 swiper.navigation = {
4349 nextEl: null,
4350 prevEl: null
4351 };
4352 function getEl(el) {
4353 let res;
4354 if (el && typeof el === 'string' && swiper.isElement) {
4355 res = swiper.el.querySelector(el);
4356 if (res) return res;
4357 }
4358 if (el) {
4359 if (typeof el === 'string') res = [...document.querySelectorAll(el)];
4360 if (swiper.params.uniqueNavElements && typeof el === 'string' && res && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {
4361 res = swiper.el.querySelector(el);
4362 } else if (res && res.length === 1) {
4363 res = res[0];
4364 }
4365 }
4366 if (el && !res) return el;
4367 // if (Array.isArray(res) && res.length === 1) res = res[0];
4368 return res;
4369 }
4370 function toggleEl(el, disabled) {
4371 const params = swiper.params.navigation;
4372 el = makeElementsArray(el);
4373 el.forEach(subEl => {
4374 if (subEl) {
4375 subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' '));
4376 if (subEl.tagName === 'BUTTON') subEl.disabled = disabled;
4377 if (swiper.params.watchOverflow && swiper.enabled) {
4378 subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
4379 }
4380 }
4381 });
4382 }
4383 function update() {
4384 // Update Navigation Buttons
4385 const {
4386 nextEl,
4387 prevEl
4388 } = swiper.navigation;
4389 if (swiper.params.loop) {
4390 toggleEl(prevEl, false);
4391 toggleEl(nextEl, false);
4392 return;
4393 }
4394 toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind);
4395 toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind);
4396 }
4397 function onPrevClick(e) {
4398 e.preventDefault();
4399 if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return;
4400 swiper.slidePrev();
4401 emit('navigationPrev');
4402 }
4403 function onNextClick(e) {
4404 e.preventDefault();
4405 if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return;
4406 swiper.slideNext();
4407 emit('navigationNext');
4408 }
4409 function init() {
4410 const params = swiper.params.navigation;
4411 swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {
4412 nextEl: 'swiper-button-next',
4413 prevEl: 'swiper-button-prev'
4414 });
4415 if (!(params.nextEl || params.prevEl)) return;
4416 let nextEl = getEl(params.nextEl);
4417 let prevEl = getEl(params.prevEl);
4418 Object.assign(swiper.navigation, {
4419 nextEl,
4420 prevEl
4421 });
4422 nextEl = makeElementsArray(nextEl);
4423 prevEl = makeElementsArray(prevEl);
4424 const initButton = (el, dir) => {
4425 if (el) {
4426 el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
4427 }
4428 if (!swiper.enabled && el) {
4429 el.classList.add(...params.lockClass.split(' '));
4430 }
4431 };
4432 nextEl.forEach(el => initButton(el, 'next'));
4433 prevEl.forEach(el => initButton(el, 'prev'));
4434 }
4435 function destroy() {
4436 let {
4437 nextEl,
4438 prevEl
4439 } = swiper.navigation;
4440 nextEl = makeElementsArray(nextEl);
4441 prevEl = makeElementsArray(prevEl);
4442 const destroyButton = (el, dir) => {
4443 el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
4444 el.classList.remove(...swiper.params.navigation.disabledClass.split(' '));
4445 };
4446 nextEl.forEach(el => destroyButton(el, 'next'));
4447 prevEl.forEach(el => destroyButton(el, 'prev'));
4448 }
4449 on('init', () => {
4450 if (swiper.params.navigation.enabled === false) {
4451 // eslint-disable-next-line
4452 disable();
4453 } else {
4454 init();
4455 update();
4456 }
4457 });
4458 on('toEdge fromEdge lock unlock', () => {
4459 update();
4460 });
4461 on('destroy', () => {
4462 destroy();
4463 });
4464 on('enable disable', () => {
4465 let {
4466 nextEl,
4467 prevEl
4468 } = swiper.navigation;
4469 nextEl = makeElementsArray(nextEl);
4470 prevEl = makeElementsArray(prevEl);
4471 if (swiper.enabled) {
4472 update();
4473 return;
4474 }
4475 [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.add(swiper.params.navigation.lockClass));
4476 });
4477 on('click', (_s, e) => {
4478 let {
4479 nextEl,
4480 prevEl
4481 } = swiper.navigation;
4482 nextEl = makeElementsArray(nextEl);
4483 prevEl = makeElementsArray(prevEl);
4484 const targetEl = e.target;
4485 let targetIsButton = prevEl.includes(targetEl) || nextEl.includes(targetEl);
4486 if (swiper.isElement && !targetIsButton) {
4487 const path = e.path || e.composedPath && e.composedPath();
4488 if (path) {
4489 targetIsButton = path.find(pathEl => nextEl.includes(pathEl) || prevEl.includes(pathEl));
4490 }
4491 }
4492 if (swiper.params.navigation.hideOnClick && !targetIsButton) {
4493 if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
4494 let isHidden;
4495 if (nextEl.length) {
4496 isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass);
4497 } else if (prevEl.length) {
4498 isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass);
4499 }
4500 if (isHidden === true) {
4501 emit('navigationShow');
4502 } else {
4503 emit('navigationHide');
4504 }
4505 [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass));
4506 }
4507 });
4508 const enable = () => {
4509 swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' '));
4510 init();
4511 update();
4512 };
4513 const disable = () => {
4514 swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' '));
4515 destroy();
4516 };
4517 Object.assign(swiper.navigation, {
4518 enable,
4519 disable,
4520 update,
4521 init,
4522 destroy
4523 });
4524 }
4525
4526 const scImageSliderCss = "@font-face{font-family:\"swiper-icons\";src:url(\"data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA\") format(\"woff\");font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff;}.swiper,swiper-container{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-wrapper{transform:translate3d(0px, 0, 0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide,swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform, height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-slide,.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom,.swiper-3d .swiper-cube-shadow{transform-style:preserve-3d}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:rgba(0, 0, 0, 0.15)}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none;}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-horizontal.swiper-css-mode>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-vertical.swiper-css-mode>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-centered>.swiper-wrapper::before{content:\"\";flex-shrink:0;order:9999}.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}.swiper:not(.swiper-watch-progress) .swiper-lazy-preloader,swiper-container:not(.swiper-watch-progress) .swiper-lazy-preloader,.swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color:#fff}.swiper-lazy-preloader-black{--swiper-preloader-color:#000}@keyframes swiper-preloader-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}:host{display:block}.image-slider{user-select:none;}.image-slider__thumbs{margin-top:var(--sc-slider-spacing, var(--sc-spacing-small));display:flex;align-items:stretch}.image-slider__thumbs .swiper{flex:1}.image-slider__thumbs .image-slider__navigation{display:none}.image-slider__thumbs--has-navigation .image-slider__navigation{display:flex;outline:none;border:none;background:none}.image-slider__navigation{display:flex;flex-direction:column;justify-content:center;align-items:center;font-size:24px;cursor:pointer}.image-slider__navigation.image-slider--is-prev{padding-right:8px}.image-slider__navigation.image-slider--is-next{padding-left:8px}.image-slider__navigation.swiper-button-disabled{opacity:0.25;cursor:default}.image-slider__slider{height:var(--sc-product-slider-height, auto);cursor:grab}.image-slider__slider .swiper-slide-img{width:100%;height:100%;text-align:center;border-radius:var(--sc-border-radius-medium);background:rgba(0, 0, 0, 0.1)}.image-slider__slider .swiper-slide-img img{display:block;margin:auto;max-width:100%;height:auto;object-fit:contain;border-radius:var(--sc-border-radius-medium)}.image-slider__thumb{cursor:pointer;width:100%;background:rgba(0, 0, 0, 0.1);border-radius:var(--sc-border-radius-medium);border:none;padding:0}.image-slider__thumb img{width:100%;height:auto;display:block;object-fit:var(--sc-image-slideshow-thumb-object-fit, cover);aspect-ratio:var(--sc-image-slideshow-thumb-aspect-ratio, 4/3);border-radius:var(--sc-border-radius-medium)}.image-slider__thumb--is-active img{outline:var(--sc-image-slideshow-thumb-active-outline, 2px solid var(--sc-focus-ring-color-primary, var(--sc-color-primary-500)));outline-offset:-2px}.image-slider--is-fixed-height .image-slider__slider .swiper-slide-img{background:transparent}.image-slider--is-fixed-height .image-slider__slider .swiper-slide-img img{max-height:100%}";
4527 const ScImageSliderStyle0 = scImageSliderCss;
4528
4529 const ScImageSlider = class {
4530 constructor(hostRef) {
4531 registerInstance(this, hostRef);
4532 this.images = undefined;
4533 this.thumbnails = [];
4534 this.hasThumbnails = undefined;
4535 this.thumbnailsPerPage = 5;
4536 this.autoHeight = undefined;
4537 this.currentSliderIndex = 0;
4538 this.imagesData = [];
4539 this.thumbnailsData = [];
4540 }
4541 handleThumbPaginate() {
4542 if (!this.thumbsSwiper)
4543 return;
4544 const slideInView = this.currentSliderIndex >= this.thumbsSwiper.activeIndex && this.currentSliderIndex < this.thumbsSwiper.activeIndex + this.thumbnailsPerPage;
4545 if (!slideInView) {
4546 this.thumbsSwiper.slideTo(this.currentSliderIndex);
4547 }
4548 }
4549 parseImages(newValue) {
4550 if (newValue)
4551 this.imagesData = typeof newValue == 'string' ? JSON.parse(newValue) : newValue;
4552 }
4553 parseThumnails(newValue) {
4554 if (newValue)
4555 this.thumbnailsData = typeof newValue == 'string' ? JSON.parse(newValue) : newValue;
4556 }
4557 componentWillLoad() {
4558 this.parseImages(this.images);
4559 this.parseThumnails(this.thumbnails);
4560 }
4561 componentDidUpdate() {
4562 this.swiper.update();
4563 }
4564 componentDidLoad() {
4565 if (this.swiperContainerRef) {
4566 this.swiper = new Swiper(this.swiperContainerRef, {
4567 direction: 'horizontal',
4568 loop: false,
4569 autoHeight: this.autoHeight,
4570 centeredSlides: true,
4571 on: {
4572 slideChange: swiper => {
4573 this.currentSliderIndex = swiper.activeIndex;
4574 },
4575 },
4576 });
4577 }
4578 if (this.swiperThumbsRef) {
4579 this.thumbsSwiper = new Swiper(this.swiperThumbsRef, {
4580 modules: [Navigation],
4581 direction: 'horizontal',
4582 loop: false,
4583 slidesPerView: this.thumbnailsPerPage,
4584 slidesPerGroup: this.thumbnailsPerPage,
4585 spaceBetween: 10,
4586 centerInsufficientSlides: true,
4587 slideToClickedSlide: true,
4588 navigation: {
4589 nextEl: this.next,
4590 prevEl: this.previous,
4591 },
4592 });
4593 }
4594 }
4595 disconnectedCallback() {
4596 this.swiper.destroy(true, true);
4597 if (this.thumbsSwiper) {
4598 this.thumbsSwiper.destroy(true, true);
4599 }
4600 }
4601 render() {
4602 var _a, _b, _c;
4603 const thumbnails = ((_a = this.thumbnailsData) === null || _a === void 0 ? void 0 : _a.length) ? this.thumbnailsData : this.imagesData;
4604 return (h("div", { key: '967ef02013800e31193f75b73f9814f62199766d', class: { 'image-slider': true, 'image-slider--is-fixed-height': !this.autoHeight }, part: "base" }, h("div", { key: '03bc071e7b8b463349a2f7e34b74a1e8f8a25c44', class: "swiper", ref: el => (this.swiperContainerRef = el) }, h("div", { key: '732dd3e15aba2f3f023092d70ef892276e63423f', class: "swiper-wrapper" }, (this.imagesData || []).map(({ src, alt, srcset, width, height, sizes, title }, index) => (h("div", { key: index, class: "swiper-slide image-slider__slider" }, h("div", { class: "swiper-slide-img" }, h("img", { src: src, alt: alt, srcset: srcset, width: width, height: height, sizes: sizes, loading: index > 0 ? 'lazy' : 'eager', ...(title ? { title } : {}) }))))))), this.hasThumbnails && (h("div", { key: 'ed9381611e1e90ff3c0c0c21b98356724b9258c2', class: { 'image-slider__thumbs': true, 'image-slider__thumbs--has-navigation': this.images.length > 5 } }, h("button", { key: '1bcaabde8dc406f75353b69ad31cd388e00aec9b', disabled: (_b = this.thumbsSwiper) === null || _b === void 0 ? void 0 : _b.isBeginning, class: "image-slider__navigation image-slider--is-prev", ref: el => (this.previous = el) }, h("sc-visually-hidden", { key: '98cc8865505704882cda20a26ea2a3b8788fb305' }, wp.i18n.__('Go to previous product slide.', 'surecart')), h("sc-icon", { key: '283f888b2f854ea1ed997e5cc19d69195be84df3', name: "chevron-left", "aria-hidden": "true", "tab-index": "0" })), h("div", { key: 'a821288cd8f0ee22b831099f672bd8969f16531e', class: "swiper", ref: el => (this.swiperThumbsRef = el) }, h("div", { key: '120ddefadde2146c52a2163be62557ec78ac8bd7', class: "swiper-wrapper", role: "radiogroup", "aria-label": wp.i18n.sprintf(wp.i18n.__('Products slide options section. There are %d options present.', 'surecart'), (thumbnails === null || thumbnails === void 0 ? void 0 : thumbnails.length) || 0) }, (thumbnails || []).map(({ src, alt, srcset, width, height, sizes, title }, index) => (h("button", { class: { 'swiper-slide': true, 'image-slider__thumb': true, 'image-slider__thumb--is-active': this.currentSliderIndex === index }, onClick: () => { var _a, _b; return (_b = (_a = this.swiper) === null || _a === void 0 ? void 0 : _a.slideTo) === null || _b === void 0 ? void 0 : _b.call(_a, index); }, role: "radio", "aria-checked": this.currentSliderIndex === index ? 'true' : 'false', tabindex: "0" }, h("img", { src: src, alt: wp.i18n.sprintf(wp.i18n.__('Product image number %d, %s', 'sc-image-slider'), index + 1, alt), ...(title ? { title } : {}), srcset: srcset, width: width, height: height, sizes: sizes, loading: index > this.thumbnailsPerPage - 1 ? 'lazy' : 'eager' })))))), h("button", { key: 'b197abedf7f785c6ff26f2bfefe95c28b54497c0', disabled: (_c = this.thumbsSwiper) === null || _c === void 0 ? void 0 : _c.isEnd, class: "image-slider__navigation image-slider--is-next", ref: el => (this.next = el) }, h("sc-visually-hidden", { key: '2b9cac41b6a5826dc8a0f6a4d3f0b2510642c7f9' }, wp.i18n.__('Go to next product slide.', 'surecart')), h("sc-icon", { key: '1f91e01ecd5daeeaff25355df6d581e5c1db5a9e', name: "chevron-right", "aria-hidden": "true", "tab-index": "0" }))))));
4605 }
4606 static get watchers() { return {
4607 "currentSliderIndex": ["handleThumbPaginate"],
4608 "images": ["parseImages"],
4609 "thumbnails": ["parseThumnails"]
4610 }; }
4611 };
4612 ScImageSlider.style = ScImageSliderStyle0;
4613
4614 export { ScImageSlider as sc_image_slider };
4615
4616 //# sourceMappingURL=sc-image-slider.entry.js.map