@sonic-equipment/ui 0.0.119 → 120.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +5 -0
  2. package/dist/_virtual/index.js +7 -0
  3. package/dist/algolia/algolia-active-categories.js +38 -0
  4. package/dist/algolia/algolia-active-filters.js +33 -0
  5. package/dist/algolia/algolia-categories-filters.js +29 -0
  6. package/dist/algolia/algolia-dummy-refinement-list-consumer.js +20 -0
  7. package/dist/algolia/algolia-filter-panel.js +42 -0
  8. package/dist/algolia/algolia-filter-panel.module.css.js +3 -0
  9. package/dist/algolia/algolia-hit-type.js +6 -0
  10. package/dist/algolia/algolia-hits-provider.js +17 -0
  11. package/dist/algolia/algolia-index-config.js +175 -0
  12. package/dist/algolia/algolia-insight-instant-search-provider.js +14 -0
  13. package/dist/algolia/algolia-insights-provider.js +18 -0
  14. package/dist/algolia/algolia-instant-search-state-provider.js +16 -0
  15. package/dist/algolia/algolia-intialization.js +26 -0
  16. package/dist/algolia/algolia-multi-select-filter-section.js +27 -0
  17. package/dist/algolia/algolia-pagination.js +18 -0
  18. package/dist/algolia/algolia-provider.js +34 -0
  19. package/dist/algolia/algolia-query-string-routing.js +106 -0
  20. package/dist/algolia/algolia-results-count.js +14 -0
  21. package/dist/algolia/algolia-search-provider.js +139 -0
  22. package/dist/algolia/algolia-searchclient-offline.js +25 -0
  23. package/dist/algolia/algolia-sonic-searchclient.js +25 -0
  24. package/dist/algolia/algolia-sort-by.js +29 -0
  25. package/dist/algolia/filter-section.js +33 -0
  26. package/dist/algolia/filter-section.module.css.js +3 -0
  27. package/dist/algolia/use-algolia-hits.js +19 -0
  28. package/dist/algolia/use-algolia-insights-provider-global-state.js +9 -0
  29. package/dist/algolia/use-algolia-insights.js +181 -0
  30. package/dist/algolia/use-algolia-instant-search-state.js +25 -0
  31. package/dist/algolia/use-algolia-search.js +41 -0
  32. package/dist/background-overlay/background-overlay.js +36 -0
  33. package/dist/background-overlay/background-overlay.module.css.js +3 -0
  34. package/dist/badges/badge/badge.js +22 -0
  35. package/dist/badges/badge/badge.module.css.js +3 -0
  36. package/dist/badges/badge/icon-with-badge/icon-with-badge.js +8 -0
  37. package/dist/badges/badge/icon-with-badge/icon-with-badge.module.css.js +3 -0
  38. package/dist/badges/tag/tag.js +10 -0
  39. package/dist/badges/tag/tag.module.css.js +3 -0
  40. package/dist/breadcrumbs/breadcrumb.js +35 -0
  41. package/dist/breadcrumbs/breadcrumb.module.css.js +3 -0
  42. package/dist/buttons/add-to-cart-button/add-to-cart-button.js +113 -0
  43. package/dist/buttons/add-to-cart-button/add-to-cart-button.module.css.js +3 -0
  44. package/dist/buttons/add-to-cart-button/connected-add-to-cart-button.js +92 -0
  45. package/dist/buttons/button/button.js +21 -0
  46. package/dist/buttons/button/button.module.css.js +3 -0
  47. package/dist/buttons/favorite/connected-favorite-button.js +64 -0
  48. package/dist/buttons/favorite/favorite-button.js +15 -0
  49. package/dist/buttons/favorite/favorite-button.module.css.js +3 -0
  50. package/dist/buttons/icon-button/icon-button.js +15 -0
  51. package/dist/buttons/icon-button/icon-button.module.css.js +3 -0
  52. package/dist/buttons/link/link.js +10 -0
  53. package/dist/buttons/link/link.module.css.js +3 -0
  54. package/dist/buttons/print-button/print-button.js +9 -0
  55. package/dist/cards/category-card/category-card.js +15 -0
  56. package/dist/cards/category-card/category-card.module.css.js +3 -0
  57. package/dist/cards/orderline-card/connected-orderline-card.js +13 -0
  58. package/dist/cards/orderline-card/connected-remove-button.js +19 -0
  59. package/dist/cards/orderline-card/orderline-card.js +17 -0
  60. package/dist/cards/orderline-card/orderline-card.module.css.js +3 -0
  61. package/dist/cards/product-card/connected-product-card.js +11 -0
  62. package/dist/cards/product-card/product-card.js +15 -0
  63. package/dist/cards/product-card/product-card.module.css.js +3 -0
  64. package/dist/carousel/card-carousel/card-carousel.js +23 -0
  65. package/dist/carousel/card-carousel/card-carousel.module.css.js +3 -0
  66. package/dist/carousel/carousel-navigation-button.js +13 -0
  67. package/dist/carousel/carousel-navigation-button.module.css.js +3 -0
  68. package/dist/carousel/carousel.js +69 -0
  69. package/dist/carousel/carousel.module.css.js +3 -0
  70. package/dist/carousel/category-carousel/category-carousel.js +9 -0
  71. package/dist/carousel/category-carousel/category-carousel.module.css.js +3 -0
  72. package/dist/carousel/pagination/pagination.js +40 -0
  73. package/dist/carousel/pagination/pagination.module.css.js +3 -0
  74. package/dist/carousel/pagination/transitions.js +144 -0
  75. package/dist/carousel/usp-carousel/product-usp-carousel-slide.js +10 -0
  76. package/dist/carousel/usp-carousel/product-usp-carousel.js +9 -0
  77. package/dist/carousel/usp-carousel/usp-carousel.js +47 -0
  78. package/dist/carousel/usp-carousel/usp-carousel.module.css.js +3 -0
  79. package/dist/cart-totals/cart-totals-summary.js +11 -0
  80. package/dist/cart-totals/cart-totals-summary.module.css.js +3 -0
  81. package/dist/cart-totals/cart-totals.js +10 -0
  82. package/dist/cart-totals/cart-totals.module.css.js +3 -0
  83. package/dist/collapsables/accordion/accordion-item.js +18 -0
  84. package/dist/collapsables/accordion/accordion.js +15 -0
  85. package/dist/collapsables/accordion/accordion.module.css.js +3 -0
  86. package/dist/collapsables/show-all/show-all.js +33 -0
  87. package/dist/collapsables/show-all/show-all.module.css.js +3 -0
  88. package/dist/config.d.ts +1 -1
  89. package/dist/config.js +82 -0
  90. package/dist/country-selector/connected-country-selector.js +37 -0
  91. package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +42 -0
  92. package/dist/country-selector/country-selector-dialog/country-selector-dialog.module.css.js +3 -0
  93. package/dist/country-selector/country-selector-trigger/country-selector-trigger.js +16 -0
  94. package/dist/country-selector/country-selector-trigger/country-selector-trigger.module.css.js +3 -0
  95. package/dist/country-selector/use-countries-languages.js +72 -0
  96. package/dist/delivery-time/delivery-time.js +18 -0
  97. package/dist/delivery-time/delivery-time.module.css.js +3 -0
  98. package/dist/display/product-price/product-price.js +19 -0
  99. package/dist/display/product-price/product-price.module.css.js +3 -0
  100. package/dist/display/product-price/product-total-price.js +16 -0
  101. package/dist/display/product-price/product-total-price.module.css.js +3 -0
  102. package/dist/display/product-sku/product-sku.js +8 -0
  103. package/dist/display/product-sku/product-sku.module.css.js +3 -0
  104. package/dist/exports.d.ts +4 -4
  105. package/dist/filters/active-filters/active-filters.js +20 -0
  106. package/dist/filters/active-filters/active-filters.module.css.js +3 -0
  107. package/dist/filters/multi-select/multi-select.js +20 -0
  108. package/dist/filters/multi-select/multi-select.module.css.js +3 -0
  109. package/dist/filters/pagination/pagination.js +14 -0
  110. package/dist/filters/pagination/pagination.module.css.js +3 -0
  111. package/dist/forms/checkbox/checkbox.js +11 -0
  112. package/dist/forms/checkbox/checkbox.module.css.js +3 -0
  113. package/dist/forms/color-checkbox/color-checkbox.js +13 -0
  114. package/dist/forms/field-error/field-error.js +10 -0
  115. package/dist/forms/field-error/field-error.module.css.js +3 -0
  116. package/dist/forms/input/input.js +31 -0
  117. package/dist/forms/input/input.module.css.js +3 -0
  118. package/dist/forms/label/label.js +12 -0
  119. package/dist/forms/label/label.module.css.js +3 -0
  120. package/dist/forms/number-field/number-field.js +29 -0
  121. package/dist/forms/number-field/number-field.module.css.js +3 -0
  122. package/dist/forms/select/select.js +31 -0
  123. package/dist/forms/select/select.module.css.js +3 -0
  124. package/dist/forms/text-field/text-field.js +22 -0
  125. package/dist/forms/text-field/text-field.module.css.js +3 -0
  126. package/dist/forms/textarea/textarea.js +54 -0
  127. package/dist/forms/textarea/textarea.module.css.js +3 -0
  128. package/dist/global-search/categories-grid/categories-grid.js +14 -0
  129. package/dist/global-search/categories-grid/categories-grid.module.css.js +3 -0
  130. package/dist/global-search/global-search-provider/global-search-provider.js +15 -0
  131. package/dist/global-search/global-search-provider/use-search-disclosure.js +13 -0
  132. package/dist/global-search/global-search.js +43 -0
  133. package/dist/global-search/global-search.module.css.js +3 -0
  134. package/dist/global-search/plugins/categories-plugin.js +35 -0
  135. package/dist/global-search/plugins/popular-categories-plugin.js +32 -0
  136. package/dist/global-search/plugins/popular-searches-plugin.js +23 -0
  137. package/dist/global-search/plugins/query-suggestions-plugin.js +21 -0
  138. package/dist/global-search/plugins/quick-access-plugin.js +34 -0
  139. package/dist/global-search/plugins/recent-searches-plugin.js +16 -0
  140. package/dist/global-search/search-highlight/highlight.js +13 -0
  141. package/dist/global-search/search-input/connected-search-input.js +22 -0
  142. package/dist/global-search/search-input/search-input.js +29 -0
  143. package/dist/global-search/search-input/search-input.module.css.js +3 -0
  144. package/dist/global-search/search-result-panel/panel-content.js +13 -0
  145. package/dist/global-search/search-result-panel/search-result-panel.js +17 -0
  146. package/dist/global-search/search-result-panel/search-result-panel.module.css.js +3 -0
  147. package/dist/global-search/search-result-panel/sections/no-search-results.js +30 -0
  148. package/dist/global-search/search-result-panel/sections/no-search.js +56 -0
  149. package/dist/global-search/search-result-panel/sections/search-content.module.css.js +3 -0
  150. package/dist/global-search/search-result-panel/sections/section-container.js +8 -0
  151. package/dist/global-search/search-result-panel/sections/with-results.js +101 -0
  152. package/dist/global-search/search-section/search-list-item.js +25 -0
  153. package/dist/global-search/search-section/search-list-item.module.css.js +3 -0
  154. package/dist/global-search/search-section/search-list.js +9 -0
  155. package/dist/global-search/search-section/search-list.module.css.js +3 -0
  156. package/dist/global-search/search-section/search-section.js +9 -0
  157. package/dist/global-search/search-section/search-section.module.css.js +3 -0
  158. package/dist/header/cart-icon/connected-cart-icon.js +14 -0
  159. package/dist/icons/glyph/glyphs-arrow-boldcaps-left-icon.js +7 -0
  160. package/dist/icons/glyph/glyphs-arrow-boldcaps-right-icon.js +7 -0
  161. package/dist/icons/glyph/glyphs-arrow-semibold-right-icon.js +7 -0
  162. package/dist/icons/glyph/glyphs-chevrons-bold-down-icon.js +7 -0
  163. package/dist/icons/glyph/glyphs-chevrons-slim-down-icon.js +7 -0
  164. package/dist/icons/glyph/glyphs-chevrons-slim-left-icon.js +7 -0
  165. package/dist/icons/glyph/glyphs-chevrons-slim-right-icon.js +7 -0
  166. package/dist/icons/solid/solid-attention-icon.js +7 -0
  167. package/dist/icons/solid/solid-cart-icon.js +7 -0
  168. package/dist/icons/solid/solid-close-icon.js +7 -0
  169. package/dist/icons/solid/solid-event-icon.js +7 -0
  170. package/dist/icons/solid/solid-favorite-icon.js +7 -0
  171. package/dist/icons/solid/solid-home-icon.js +7 -0
  172. package/dist/icons/solid/solid-information-icon.js +7 -0
  173. package/dist/icons/solid/solid-news-icon.js +7 -0
  174. package/dist/icons/solid/solid-notice-icon.js +7 -0
  175. package/dist/icons/solid/solid-okay-icon.js +7 -0
  176. package/dist/icons/solid/solid-sale-icon.js +7 -0
  177. package/dist/icons/solid/solid-tag-icon.js +7 -0
  178. package/dist/icons/stroke/stroke-categories-icon.js +7 -0
  179. package/dist/icons/stroke/stroke-checkmark-icon.js +7 -0
  180. package/dist/icons/stroke/stroke-closebox-icon.js +7 -0
  181. package/dist/icons/stroke/stroke-collapse-icon.js +7 -0
  182. package/dist/icons/stroke/stroke-download-icon.js +7 -0
  183. package/dist/icons/stroke/stroke-expand-icon.js +7 -0
  184. package/dist/icons/stroke/stroke-favorite-icon.js +7 -0
  185. package/dist/icons/stroke/stroke-filter-icon.js +7 -0
  186. package/dist/icons/stroke/stroke-recent-icon.js +7 -0
  187. package/dist/icons/stroke/stroke-search-icon.js +7 -0
  188. package/dist/icons/stroke/stroke-trash-icon.js +7 -0
  189. package/dist/index.d.ts +2 -0
  190. package/dist/index.js +254 -12972
  191. package/dist/intl/formatted-message.js +6 -0
  192. package/dist/intl/intl-context.js +10 -0
  193. package/dist/intl/intl-provider.js +15 -0
  194. package/dist/intl/types.js +17 -0
  195. package/dist/intl/use-culture-code.js +14 -0
  196. package/dist/intl/use-formatted-message.js +17 -0
  197. package/dist/intl/use-language-code.js +11 -0
  198. package/dist/intl/utils.js +29 -0
  199. package/dist/lists/download-document-list/download-document-list.js +16 -0
  200. package/dist/lists/download-document-list/download-document-list.module.css.js +3 -0
  201. package/dist/lists/feature-list/feature-list.js +22 -0
  202. package/dist/lists/feature-list/feature-list.module.css.js +3 -0
  203. package/dist/lists/orderline-list/orderline-list.js +25 -0
  204. package/dist/lists/orderline-list/orderline-list.module.css.js +3 -0
  205. package/dist/lists/product-overview-grid/product-overview-grid.js +10 -0
  206. package/dist/lists/product-overview-grid/product-overview-grid.module.css.js +3 -0
  207. package/dist/lists/ul/list.js +11 -0
  208. package/dist/lists/ul/list.module.css.js +3 -0
  209. package/dist/loading/blank-page-spacer.js +8 -0
  210. package/dist/loading/blank-page-spacer.module.css.js +3 -0
  211. package/dist/loading/loading-overlay.js +9 -0
  212. package/dist/loading/loading-overlay.module.css.js +3 -0
  213. package/dist/loading/progress-circle.js +9 -0
  214. package/dist/loading/progress-circle.module.css.js +3 -0
  215. package/dist/media/image/image.js +46 -0
  216. package/dist/media/image/image.module.css.js +3 -0
  217. package/dist/media/image-grid/images-grid.js +32 -0
  218. package/dist/media/image-grid/images-grid.module.css.js +3 -0
  219. package/dist/media/image-lightbox/image-lightbox.js +35 -0
  220. package/dist/media/image-lightbox/image-lightbox.module.css.js +3 -0
  221. package/dist/media/zoom-image/zoom-image.js +33 -0
  222. package/dist/media/zoom-image/zoom-image.module.css.js +3 -0
  223. package/dist/modals/confirmation/confirmation-dialog.js +12 -0
  224. package/dist/modals/confirmation/confirmation-dialog.module.css.js +3 -0
  225. package/dist/modals/dialog/dialog.js +30 -0
  226. package/dist/modals/dialog/dialog.module.css.js +3 -0
  227. package/dist/modals/favorite/add-to-favorite-dialog.js +60 -0
  228. package/dist/modals/favorite/add-to-favorite-dialog.module.css.js +3 -0
  229. package/dist/modals/modal/modal.js +34 -0
  230. package/dist/modals/modal/modal.module.css.js +3 -0
  231. package/dist/modals/signin/sign-in-dialog.js +22 -0
  232. package/dist/modals/signin/sign-in-dialog.module.css.js +3 -0
  233. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/routers/history.js +341 -0
  234. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/stateMappings/simple.js +36 -0
  235. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/documentation.js +8 -0
  236. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/logger.js +32 -0
  237. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/noop.js +3 -0
  238. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/safelyRunOnBrowser.js +24 -0
  239. package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/formats.js +33 -0
  240. package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/index.js +25 -0
  241. package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/parse.js +269 -0
  242. package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/stringify.js +300 -0
  243. package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/utils.js +264 -0
  244. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/modules/free-mode.js +237 -0
  245. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/modules/navigation.js +200 -0
  246. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/modules/thumbs.js +193 -0
  247. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/create-element-if-not-defined.js +21 -0
  248. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/ssr-window.esm.js +145 -0
  249. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/swiper-core.js +3912 -0
  250. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/update-on-virtual-data.js +130 -0
  251. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/update-swiper.js +230 -0
  252. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/utils.js +287 -0
  253. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/swiper-react.js +389 -0
  254. package/dist/notifications/announcements/announcement-provider.js +32 -0
  255. package/dist/notifications/announcements/announcement-provider.module.css.js +3 -0
  256. package/dist/notifications/announcements/announcement.js +30 -0
  257. package/dist/notifications/announcements/announcement.module.css.js +3 -0
  258. package/dist/notifications/announcements/connected-announcement.js +27 -0
  259. package/dist/observers/intersection-observer.js +18 -0
  260. package/dist/pages/cart-page/cart-page.js +114 -0
  261. package/dist/pages/error-page/error-page.js +22 -0
  262. package/dist/pages/layouts/checkout-page-layout/checkout-page-layout.js +30 -0
  263. package/dist/pages/layouts/checkout-page-layout/checkout-page-layout.module.css.js +3 -0
  264. package/dist/pages/layouts/product-details-page-layout/product-details-page-layout.js +8 -0
  265. package/dist/pages/layouts/product-details-page-layout/product-details-page-layout.module.css.js +3 -0
  266. package/dist/pages/loading-page/loading-page.js +9 -0
  267. package/dist/pages/page/page.js +18 -0
  268. package/dist/pages/page/page.module.css.js +3 -0
  269. package/dist/pages/page-container/page-container.js +9 -0
  270. package/dist/pages/page-container/page-container.module.css.js +3 -0
  271. package/dist/pages/product-details-page/components/product-details-images/product-detail-images.js +35 -0
  272. package/dist/pages/product-details-page/components/product-details-images/product-detail-images.module.css.js +3 -0
  273. package/dist/pages/product-details-page/components/product-details-panel/product-details-panel.d.ts +3 -2
  274. package/dist/pages/product-details-page/components/product-details-panel/product-details-panel.js +35 -0
  275. package/dist/pages/product-details-page/components/product-details-panel/product-details-panel.module.css.js +3 -0
  276. package/dist/pages/product-details-page/components/product-details-recently-viewed/product-details-recently-viewed.d.ts +4 -0
  277. package/dist/pages/product-details-page/components/product-details-recently-viewed/product-details-recently-viewed.js +15 -0
  278. package/dist/pages/product-details-page/product-details-page.js +22 -0
  279. package/dist/pages/product-details-page/product-details.d.ts +6 -0
  280. package/dist/pages/product-details-page/product-details.js +25 -0
  281. package/dist/pages/product-listing-page/no-results/no-results.js +14 -0
  282. package/dist/pages/product-listing-page/no-results/no-results.module.css.js +3 -0
  283. package/dist/pages/product-listing-page/product-listing-page-category-carousel/product-listing-page-category-carousel.js +22 -0
  284. package/dist/pages/product-listing-page/product-listing-page-provider/product-listing-page-context.js +8 -0
  285. package/dist/pages/product-listing-page/product-listing-page-provider/product-listing-page-provider.js +13 -0
  286. package/dist/pages/product-listing-page/product-listing-page.js +29 -0
  287. package/dist/pages/product-listing-page/product-listing-page.module.css.js +3 -0
  288. package/dist/pages/product-listing-page/product-listing-product-overview/product-listing-product-overview.js +36 -0
  289. package/dist/pages/product-listing-page/product-listing.d.ts +6 -0
  290. package/dist/pages/product-listing-page/product-listing.js +42 -0
  291. package/dist/pages/search-result-page/search-result-product-overview/search-result-product-overview.js +38 -0
  292. package/dist/pages/search-result-page/search-results-page-category-carousel/search-results-page-category-carousel.js +22 -0
  293. package/dist/pages/search-result-page/search-results-page.js +49 -0
  294. package/dist/pages/search-result-page/search-results-page.module.css.js +3 -0
  295. package/dist/promos/promo-banner/promo-banner.js +11 -0
  296. package/dist/promos/promo-banner/promo-banner.module.css.js +3 -0
  297. package/dist/promos/promo-banners/promo-banners.js +16 -0
  298. package/dist/promos/promo-banners/promo-banners.module.css.js +3 -0
  299. package/dist/promos/promo-card/promo-card.js +11 -0
  300. package/dist/promos/promo-card/promo-card.module.css.js +3 -0
  301. package/dist/shared/api/bff/hooks/use-fetch-announcements.js +15 -0
  302. package/dist/shared/api/bff/hooks/use-fetch-product-details-page-data.js +14 -0
  303. package/dist/shared/api/bff/hooks/use-fetch-product-listing-page-data.js +14 -0
  304. package/dist/shared/api/bff/model/bff.model.d.ts +1 -1
  305. package/dist/shared/api/bff/model/bff.model.js +1 -0
  306. package/dist/shared/api/bff/services/bff-service.js +76 -0
  307. package/dist/shared/api/storefront/hooks/authentication/use-fetch-session.js +18 -0
  308. package/dist/shared/api/storefront/hooks/authentication/use-invalidate-session.js +9 -0
  309. package/dist/shared/api/storefront/hooks/authentication/use-is-authenticated.js +8 -0
  310. package/dist/shared/api/storefront/hooks/authentication/use-sign-in.js +21 -0
  311. package/dist/shared/api/storefront/hooks/authentication/use-sign-out.js +25 -0
  312. package/dist/shared/api/storefront/hooks/cart/use-add-product-to-current-cart.js +31 -0
  313. package/dist/shared/api/storefront/hooks/cart/use-delete-cart-line-by-id.js +23 -0
  314. package/dist/shared/api/storefront/hooks/cart/use-delete-current-cart.js +18 -0
  315. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-checkout-atp.js +15 -0
  316. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-count.js +8 -0
  317. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-lines-with-atp.js +11 -0
  318. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-lines.js +11 -0
  319. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-product-atp.js +15 -0
  320. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-promotions.js +15 -0
  321. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.js +26 -0
  322. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart.js +17 -0
  323. package/dist/shared/api/storefront/hooks/cart/use-invalidate-current-cart.js +9 -0
  324. package/dist/shared/api/storefront/hooks/cart/use-patch-cart.js +15 -0
  325. package/dist/shared/api/storefront/hooks/cart/use-place-order.js +15 -0
  326. package/dist/shared/api/storefront/hooks/cart/use-save-cart-for-later.js +17 -0
  327. package/dist/shared/api/storefront/hooks/cart/use-update-cart-line-by-id.js +30 -0
  328. package/dist/shared/api/storefront/hooks/translation/use-fetch-translations.js +15 -0
  329. package/dist/shared/api/storefront/hooks/website/use-fetch-countries-languages.js +15 -0
  330. package/dist/shared/api/storefront/hooks/website/use-fetch-countries-with-languages.js +15 -0
  331. package/dist/shared/api/storefront/hooks/website/use-fetch-countries.js +14 -0
  332. package/dist/shared/api/storefront/hooks/website/use-fetch-settings.js +18 -0
  333. package/dist/shared/api/storefront/hooks/website/use-update-locale.js +11 -0
  334. package/dist/shared/api/storefront/hooks/wishlist/use-add-wishlist-item-to-current-wishlist.js +34 -0
  335. package/dist/shared/api/storefront/hooks/wishlist/use-add-wishlist-item-to-wishlist.js +33 -0
  336. package/dist/shared/api/storefront/hooks/wishlist/use-create-wishlist.js +17 -0
  337. package/dist/shared/api/storefront/hooks/wishlist/use-delete-wishlist-item-from-wishlist.js +21 -0
  338. package/dist/shared/api/storefront/hooks/wishlist/use-fetch-all-wishlists-items.js +36 -0
  339. package/dist/shared/api/storefront/hooks/wishlist/use-fetch-wishlists.js +14 -0
  340. package/dist/shared/api/storefront/model/shop.model.js +42 -0
  341. package/dist/shared/api/storefront/services/authentication-service.js +80 -0
  342. package/dist/shared/api/storefront/services/cart-service.js +128 -0
  343. package/dist/shared/api/storefront/services/translation-service.js +16 -0
  344. package/dist/shared/api/storefront/services/website-service.js +83 -0
  345. package/dist/shared/api/storefront/services/wishlist-service.js +72 -0
  346. package/dist/shared/feature-flags/use-feature-flags.js +45 -0
  347. package/dist/shared/fetch/request.d.ts +5 -0
  348. package/dist/shared/fetch/request.js +263 -0
  349. package/dist/shared/hooks/use-breakpoint.js +24 -0
  350. package/dist/shared/hooks/use-cookie.js +27 -0
  351. package/dist/shared/hooks/use-debounced-callback.js +18 -0
  352. package/dist/shared/hooks/use-disclosure.js +24 -0
  353. package/dist/shared/hooks/use-enable-mobile-zoom.js +36 -0
  354. package/dist/shared/hooks/use-intersection-observer.js +66 -0
  355. package/dist/shared/hooks/use-is-breakpoint.js +19 -0
  356. package/dist/shared/hooks/use-local-storage.js +19 -0
  357. package/dist/shared/hooks/use-resize-observer.d.ts +2 -2
  358. package/dist/shared/hooks/use-resize-observer.js +30 -0
  359. package/dist/shared/hooks/use-scroll-lock.js +11 -0
  360. package/dist/shared/hooks/use-scroll-to.js +19 -0
  361. package/dist/shared/hooks/use-session-storage.js +19 -0
  362. package/dist/shared/hooks/use-watch-css-property.d.ts +1 -0
  363. package/dist/shared/hooks/use-watch-css-property.js +29 -0
  364. package/dist/shared/model/announcement.js +18 -0
  365. package/dist/shared/model/category.js +25 -0
  366. package/dist/shared/model/currency.js +29 -0
  367. package/dist/shared/model/hit.js +45 -0
  368. package/dist/shared/model/image.js +5 -0
  369. package/dist/shared/providers/cart-provider.js +13 -0
  370. package/dist/shared/providers/favorite-provider.js +33 -0
  371. package/dist/shared/providers/global-state-provider.js +83 -0
  372. package/dist/shared/providers/react-query-container.js +20 -0
  373. package/dist/shared/routing/route-button.js +7 -0
  374. package/dist/shared/routing/route-icon-button.js +7 -0
  375. package/dist/shared/routing/route-link.js +7 -0
  376. package/dist/shared/routing/route-provider.d.ts +3 -1
  377. package/dist/shared/routing/route-provider.js +48 -0
  378. package/dist/shared/routing/with-routing.js +36 -0
  379. package/dist/shared/utils/array.js +5 -0
  380. package/dist/shared/utils/breakpoints.js +33 -0
  381. package/dist/shared/utils/date.js +58 -0
  382. package/dist/shared/utils/environment.d.ts +2 -2
  383. package/dist/shared/utils/environment.js +61 -0
  384. package/dist/shared/utils/event-emitter.js +34 -0
  385. package/dist/shared/utils/local-storage.js +108 -0
  386. package/dist/shared/utils/merge.js +70 -0
  387. package/dist/shared/utils/price.js +6 -0
  388. package/dist/shared/utils/time.js +9 -0
  389. package/dist/shared/utils/uuid.js +15 -0
  390. package/dist/shared/utils/wait.js +5 -0
  391. package/dist/sidebar/sidebar-provider.js +46 -0
  392. package/dist/sidebar/sidebar-provider.module.css.js +3 -0
  393. package/dist/sidebar/sidebar.js +23 -0
  394. package/dist/sidebar/sidebar.module.css.js +3 -0
  395. package/dist/sidebar/toggle-sidebar-button.js +13 -0
  396. package/dist/sidebar/use-sidebar.js +38 -0
  397. package/dist/styles.css +5 -16
  398. package/dist/toast/toast-provider.js +9 -0
  399. package/dist/toast/toast-provider.module.css.js +3 -0
  400. package/dist/toast/toast.js +24 -0
  401. package/dist/toast/toast.module.css.js +3 -0
  402. package/dist/toast/use-toast.js +21 -0
  403. package/dist/tokens/tokens.js +8 -0
  404. package/dist/typography/heading/heading.js +27 -0
  405. package/dist/typography/heading/heading.module.css.js +3 -0
  406. package/package.json +3 -2
  407. package/dist/pages/product-listing-page/product-listing-page-provider/use-subcategories.d.ts +0 -4
@@ -0,0 +1,3912 @@
1
+ import { a as getWindow, g as getDocument } from './ssr-window.esm.js';
2
+ import { w as extend, e as elementChildren, h as elementIndex, c as createElement, p as elementStyle, x as deleteProps, a as elementParents, s as setCSSProperty, f as elementOuterSize, q as elementNextAll, r as elementPrevAll, j as getTranslate, t as animateCSSModeScroll, n as nextTick, u as showWarning, v as elementIsChildOf, d as now } from './utils.js';
3
+
4
+ let support;
5
+ function calcSupport() {
6
+ const window = getWindow();
7
+ const document = getDocument();
8
+ return {
9
+ smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style,
10
+ touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch)
11
+ };
12
+ }
13
+ function getSupport() {
14
+ if (!support) {
15
+ support = calcSupport();
16
+ }
17
+ return support;
18
+ }
19
+
20
+ let deviceCached;
21
+ function calcDevice(_temp) {
22
+ let {
23
+ userAgent
24
+ } = _temp === void 0 ? {} : _temp;
25
+ const support = getSupport();
26
+ const window = getWindow();
27
+ const platform = window.navigator.platform;
28
+ const ua = userAgent || window.navigator.userAgent;
29
+ const device = {
30
+ ios: false,
31
+ android: false
32
+ };
33
+ const screenWidth = window.screen.width;
34
+ const screenHeight = window.screen.height;
35
+ const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
36
+ let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
37
+ const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
38
+ const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
39
+ const windows = platform === 'Win32';
40
+ let macos = platform === 'MacIntel';
41
+
42
+ // iPadOs 13 fix
43
+ const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];
44
+ if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) {
45
+ ipad = ua.match(/(Version)\/([\d.]+)/);
46
+ if (!ipad) ipad = [0, 1, '13_0_0'];
47
+ macos = false;
48
+ }
49
+
50
+ // Android
51
+ if (android && !windows) {
52
+ device.os = 'android';
53
+ device.android = true;
54
+ }
55
+ if (ipad || iphone || ipod) {
56
+ device.os = 'ios';
57
+ device.ios = true;
58
+ }
59
+
60
+ // Export object
61
+ return device;
62
+ }
63
+ function getDevice(overrides) {
64
+ if (overrides === void 0) {
65
+ overrides = {};
66
+ }
67
+ if (!deviceCached) {
68
+ deviceCached = calcDevice(overrides);
69
+ }
70
+ return deviceCached;
71
+ }
72
+
73
+ let browser;
74
+ function calcBrowser() {
75
+ const window = getWindow();
76
+ const device = getDevice();
77
+ let needPerspectiveFix = false;
78
+ function isSafari() {
79
+ const ua = window.navigator.userAgent.toLowerCase();
80
+ return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
81
+ }
82
+ if (isSafari()) {
83
+ const ua = String(window.navigator.userAgent);
84
+ if (ua.includes('Version/')) {
85
+ const [major, minor] = ua.split('Version/')[1].split(' ')[0].split('.').map(num => Number(num));
86
+ needPerspectiveFix = major < 16 || major === 16 && minor < 2;
87
+ }
88
+ }
89
+ const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent);
90
+ const isSafariBrowser = isSafari();
91
+ const need3dFix = isSafariBrowser || isWebView && device.ios;
92
+ return {
93
+ isSafari: needPerspectiveFix || isSafariBrowser,
94
+ needPerspectiveFix,
95
+ need3dFix,
96
+ isWebView
97
+ };
98
+ }
99
+ function getBrowser() {
100
+ if (!browser) {
101
+ browser = calcBrowser();
102
+ }
103
+ return browser;
104
+ }
105
+
106
+ function Resize(_ref) {
107
+ let {
108
+ swiper,
109
+ on,
110
+ emit
111
+ } = _ref;
112
+ const window = getWindow();
113
+ let observer = null;
114
+ let animationFrame = null;
115
+ const resizeHandler = () => {
116
+ if (!swiper || swiper.destroyed || !swiper.initialized) return;
117
+ emit('beforeResize');
118
+ emit('resize');
119
+ };
120
+ const createObserver = () => {
121
+ if (!swiper || swiper.destroyed || !swiper.initialized) return;
122
+ observer = new ResizeObserver(entries => {
123
+ animationFrame = window.requestAnimationFrame(() => {
124
+ const {
125
+ width,
126
+ height
127
+ } = swiper;
128
+ let newWidth = width;
129
+ let newHeight = height;
130
+ entries.forEach(_ref2 => {
131
+ let {
132
+ contentBoxSize,
133
+ contentRect,
134
+ target
135
+ } = _ref2;
136
+ if (target && target !== swiper.el) return;
137
+ newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;
138
+ newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;
139
+ });
140
+ if (newWidth !== width || newHeight !== height) {
141
+ resizeHandler();
142
+ }
143
+ });
144
+ });
145
+ observer.observe(swiper.el);
146
+ };
147
+ const removeObserver = () => {
148
+ if (animationFrame) {
149
+ window.cancelAnimationFrame(animationFrame);
150
+ }
151
+ if (observer && observer.unobserve && swiper.el) {
152
+ observer.unobserve(swiper.el);
153
+ observer = null;
154
+ }
155
+ };
156
+ const orientationChangeHandler = () => {
157
+ if (!swiper || swiper.destroyed || !swiper.initialized) return;
158
+ emit('orientationchange');
159
+ };
160
+ on('init', () => {
161
+ if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') {
162
+ createObserver();
163
+ return;
164
+ }
165
+ window.addEventListener('resize', resizeHandler);
166
+ window.addEventListener('orientationchange', orientationChangeHandler);
167
+ });
168
+ on('destroy', () => {
169
+ removeObserver();
170
+ window.removeEventListener('resize', resizeHandler);
171
+ window.removeEventListener('orientationchange', orientationChangeHandler);
172
+ });
173
+ }
174
+
175
+ function Observer(_ref) {
176
+ let {
177
+ swiper,
178
+ extendParams,
179
+ on,
180
+ emit
181
+ } = _ref;
182
+ const observers = [];
183
+ const window = getWindow();
184
+ const attach = function (target, options) {
185
+ if (options === void 0) {
186
+ options = {};
187
+ }
188
+ const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
189
+ const observer = new ObserverFunc(mutations => {
190
+ // The observerUpdate event should only be triggered
191
+ // once despite the number of mutations. Additional
192
+ // triggers are redundant and are very costly
193
+ if (swiper.__preventObserver__) return;
194
+ if (mutations.length === 1) {
195
+ emit('observerUpdate', mutations[0]);
196
+ return;
197
+ }
198
+ const observerUpdate = function observerUpdate() {
199
+ emit('observerUpdate', mutations[0]);
200
+ };
201
+ if (window.requestAnimationFrame) {
202
+ window.requestAnimationFrame(observerUpdate);
203
+ } else {
204
+ window.setTimeout(observerUpdate, 0);
205
+ }
206
+ });
207
+ observer.observe(target, {
208
+ attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
209
+ childList: swiper.isElement || (typeof options.childList === 'undefined' ? true : options).childList,
210
+ characterData: typeof options.characterData === 'undefined' ? true : options.characterData
211
+ });
212
+ observers.push(observer);
213
+ };
214
+ const init = () => {
215
+ if (!swiper.params.observer) return;
216
+ if (swiper.params.observeParents) {
217
+ const containerParents = elementParents(swiper.hostEl);
218
+ for (let i = 0; i < containerParents.length; i += 1) {
219
+ attach(containerParents[i]);
220
+ }
221
+ }
222
+ // Observe container
223
+ attach(swiper.hostEl, {
224
+ childList: swiper.params.observeSlideChildren
225
+ });
226
+
227
+ // Observe wrapper
228
+ attach(swiper.wrapperEl, {
229
+ attributes: false
230
+ });
231
+ };
232
+ const destroy = () => {
233
+ observers.forEach(observer => {
234
+ observer.disconnect();
235
+ });
236
+ observers.splice(0, observers.length);
237
+ };
238
+ extendParams({
239
+ observer: false,
240
+ observeParents: false,
241
+ observeSlideChildren: false
242
+ });
243
+ on('init', init);
244
+ on('destroy', destroy);
245
+ }
246
+
247
+ /* eslint-disable no-underscore-dangle */
248
+
249
+ var eventsEmitter = {
250
+ on(events, handler, priority) {
251
+ const self = this;
252
+ if (!self.eventsListeners || self.destroyed) return self;
253
+ if (typeof handler !== 'function') return self;
254
+ const method = priority ? 'unshift' : 'push';
255
+ events.split(' ').forEach(event => {
256
+ if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
257
+ self.eventsListeners[event][method](handler);
258
+ });
259
+ return self;
260
+ },
261
+ once(events, handler, priority) {
262
+ const self = this;
263
+ if (!self.eventsListeners || self.destroyed) return self;
264
+ if (typeof handler !== 'function') return self;
265
+ function onceHandler() {
266
+ self.off(events, onceHandler);
267
+ if (onceHandler.__emitterProxy) {
268
+ delete onceHandler.__emitterProxy;
269
+ }
270
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
271
+ args[_key] = arguments[_key];
272
+ }
273
+ handler.apply(self, args);
274
+ }
275
+ onceHandler.__emitterProxy = handler;
276
+ return self.on(events, onceHandler, priority);
277
+ },
278
+ onAny(handler, priority) {
279
+ const self = this;
280
+ if (!self.eventsListeners || self.destroyed) return self;
281
+ if (typeof handler !== 'function') return self;
282
+ const method = priority ? 'unshift' : 'push';
283
+ if (self.eventsAnyListeners.indexOf(handler) < 0) {
284
+ self.eventsAnyListeners[method](handler);
285
+ }
286
+ return self;
287
+ },
288
+ offAny(handler) {
289
+ const self = this;
290
+ if (!self.eventsListeners || self.destroyed) return self;
291
+ if (!self.eventsAnyListeners) return self;
292
+ const index = self.eventsAnyListeners.indexOf(handler);
293
+ if (index >= 0) {
294
+ self.eventsAnyListeners.splice(index, 1);
295
+ }
296
+ return self;
297
+ },
298
+ off(events, handler) {
299
+ const self = this;
300
+ if (!self.eventsListeners || self.destroyed) return self;
301
+ if (!self.eventsListeners) return self;
302
+ events.split(' ').forEach(event => {
303
+ if (typeof handler === 'undefined') {
304
+ self.eventsListeners[event] = [];
305
+ } else if (self.eventsListeners[event]) {
306
+ self.eventsListeners[event].forEach((eventHandler, index) => {
307
+ if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {
308
+ self.eventsListeners[event].splice(index, 1);
309
+ }
310
+ });
311
+ }
312
+ });
313
+ return self;
314
+ },
315
+ emit() {
316
+ const self = this;
317
+ if (!self.eventsListeners || self.destroyed) return self;
318
+ if (!self.eventsListeners) return self;
319
+ let events;
320
+ let data;
321
+ let context;
322
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
323
+ args[_key2] = arguments[_key2];
324
+ }
325
+ if (typeof args[0] === 'string' || Array.isArray(args[0])) {
326
+ events = args[0];
327
+ data = args.slice(1, args.length);
328
+ context = self;
329
+ } else {
330
+ events = args[0].events;
331
+ data = args[0].data;
332
+ context = args[0].context || self;
333
+ }
334
+ data.unshift(context);
335
+ const eventsArray = Array.isArray(events) ? events : events.split(' ');
336
+ eventsArray.forEach(event => {
337
+ if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
338
+ self.eventsAnyListeners.forEach(eventHandler => {
339
+ eventHandler.apply(context, [event, ...data]);
340
+ });
341
+ }
342
+ if (self.eventsListeners && self.eventsListeners[event]) {
343
+ self.eventsListeners[event].forEach(eventHandler => {
344
+ eventHandler.apply(context, data);
345
+ });
346
+ }
347
+ });
348
+ return self;
349
+ }
350
+ };
351
+
352
+ function updateSize() {
353
+ const swiper = this;
354
+ let width;
355
+ let height;
356
+ const el = swiper.el;
357
+ if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
358
+ width = swiper.params.width;
359
+ } else {
360
+ width = el.clientWidth;
361
+ }
362
+ if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {
363
+ height = swiper.params.height;
364
+ } else {
365
+ height = el.clientHeight;
366
+ }
367
+ if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
368
+ return;
369
+ }
370
+
371
+ // Subtract paddings
372
+ width = width - parseInt(elementStyle(el, 'padding-left') || 0, 10) - parseInt(elementStyle(el, 'padding-right') || 0, 10);
373
+ height = height - parseInt(elementStyle(el, 'padding-top') || 0, 10) - parseInt(elementStyle(el, 'padding-bottom') || 0, 10);
374
+ if (Number.isNaN(width)) width = 0;
375
+ if (Number.isNaN(height)) height = 0;
376
+ Object.assign(swiper, {
377
+ width,
378
+ height,
379
+ size: swiper.isHorizontal() ? width : height
380
+ });
381
+ }
382
+
383
+ function updateSlides() {
384
+ const swiper = this;
385
+ function getDirectionPropertyValue(node, label) {
386
+ return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0);
387
+ }
388
+ const params = swiper.params;
389
+ const {
390
+ wrapperEl,
391
+ slidesEl,
392
+ size: swiperSize,
393
+ rtlTranslate: rtl,
394
+ wrongRTL
395
+ } = swiper;
396
+ const isVirtual = swiper.virtual && params.virtual.enabled;
397
+ const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
398
+ const slides = elementChildren(slidesEl, `.${swiper.params.slideClass}, swiper-slide`);
399
+ const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
400
+ let snapGrid = [];
401
+ const slidesGrid = [];
402
+ const slidesSizesGrid = [];
403
+ let offsetBefore = params.slidesOffsetBefore;
404
+ if (typeof offsetBefore === 'function') {
405
+ offsetBefore = params.slidesOffsetBefore.call(swiper);
406
+ }
407
+ let offsetAfter = params.slidesOffsetAfter;
408
+ if (typeof offsetAfter === 'function') {
409
+ offsetAfter = params.slidesOffsetAfter.call(swiper);
410
+ }
411
+ const previousSnapGridLength = swiper.snapGrid.length;
412
+ const previousSlidesGridLength = swiper.slidesGrid.length;
413
+ let spaceBetween = params.spaceBetween;
414
+ let slidePosition = -offsetBefore;
415
+ let prevSlideSize = 0;
416
+ let index = 0;
417
+ if (typeof swiperSize === 'undefined') {
418
+ return;
419
+ }
420
+ if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
421
+ spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
422
+ } else if (typeof spaceBetween === 'string') {
423
+ spaceBetween = parseFloat(spaceBetween);
424
+ }
425
+ swiper.virtualSize = -spaceBetween;
426
+
427
+ // reset margins
428
+ slides.forEach(slideEl => {
429
+ if (rtl) {
430
+ slideEl.style.marginLeft = '';
431
+ } else {
432
+ slideEl.style.marginRight = '';
433
+ }
434
+ slideEl.style.marginBottom = '';
435
+ slideEl.style.marginTop = '';
436
+ });
437
+
438
+ // reset cssMode offsets
439
+ if (params.centeredSlides && params.cssMode) {
440
+ setCSSProperty(wrapperEl, '--swiper-centered-offset-before', '');
441
+ setCSSProperty(wrapperEl, '--swiper-centered-offset-after', '');
442
+ }
443
+ const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
444
+ if (gridEnabled) {
445
+ swiper.grid.initSlides(slides);
446
+ } else if (swiper.grid) {
447
+ swiper.grid.unsetSlides();
448
+ }
449
+
450
+ // Calc slides
451
+ let slideSize;
452
+ const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => {
453
+ return typeof params.breakpoints[key].slidesPerView !== 'undefined';
454
+ }).length > 0;
455
+ for (let i = 0; i < slidesLength; i += 1) {
456
+ slideSize = 0;
457
+ let slide;
458
+ if (slides[i]) slide = slides[i];
459
+ if (gridEnabled) {
460
+ swiper.grid.updateSlide(i, slide, slides);
461
+ }
462
+ if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
463
+
464
+ if (params.slidesPerView === 'auto') {
465
+ if (shouldResetSlideSize) {
466
+ slides[i].style[swiper.getDirectionLabel('width')] = ``;
467
+ }
468
+ const slideStyles = getComputedStyle(slide);
469
+ const currentTransform = slide.style.transform;
470
+ const currentWebKitTransform = slide.style.webkitTransform;
471
+ if (currentTransform) {
472
+ slide.style.transform = 'none';
473
+ }
474
+ if (currentWebKitTransform) {
475
+ slide.style.webkitTransform = 'none';
476
+ }
477
+ if (params.roundLengths) {
478
+ slideSize = swiper.isHorizontal() ? elementOuterSize(slide, 'width') : elementOuterSize(slide, 'height');
479
+ } else {
480
+ // eslint-disable-next-line
481
+ const width = getDirectionPropertyValue(slideStyles, 'width');
482
+ const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');
483
+ const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');
484
+ const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');
485
+ const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');
486
+ const boxSizing = slideStyles.getPropertyValue('box-sizing');
487
+ if (boxSizing && boxSizing === 'border-box') {
488
+ slideSize = width + marginLeft + marginRight;
489
+ } else {
490
+ const {
491
+ clientWidth,
492
+ offsetWidth
493
+ } = slide;
494
+ slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
495
+ }
496
+ }
497
+ if (currentTransform) {
498
+ slide.style.transform = currentTransform;
499
+ }
500
+ if (currentWebKitTransform) {
501
+ slide.style.webkitTransform = currentWebKitTransform;
502
+ }
503
+ if (params.roundLengths) slideSize = Math.floor(slideSize);
504
+ } else {
505
+ slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
506
+ if (params.roundLengths) slideSize = Math.floor(slideSize);
507
+ if (slides[i]) {
508
+ slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`;
509
+ }
510
+ }
511
+ if (slides[i]) {
512
+ slides[i].swiperSlideSize = slideSize;
513
+ }
514
+ slidesSizesGrid.push(slideSize);
515
+ if (params.centeredSlides) {
516
+ slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
517
+ if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
518
+ if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
519
+ if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
520
+ if (params.roundLengths) slidePosition = Math.floor(slidePosition);
521
+ if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);
522
+ slidesGrid.push(slidePosition);
523
+ } else {
524
+ if (params.roundLengths) slidePosition = Math.floor(slidePosition);
525
+ if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);
526
+ slidesGrid.push(slidePosition);
527
+ slidePosition = slidePosition + slideSize + spaceBetween;
528
+ }
529
+ swiper.virtualSize += slideSize + spaceBetween;
530
+ prevSlideSize = slideSize;
531
+ index += 1;
532
+ }
533
+ swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;
534
+ if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
535
+ wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;
536
+ }
537
+ if (params.setWrapperSize) {
538
+ wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
539
+ }
540
+ if (gridEnabled) {
541
+ swiper.grid.updateWrapperSize(slideSize, snapGrid);
542
+ }
543
+
544
+ // Remove last grid elements depending on width
545
+ if (!params.centeredSlides) {
546
+ const newSlidesGrid = [];
547
+ for (let i = 0; i < snapGrid.length; i += 1) {
548
+ let slidesGridItem = snapGrid[i];
549
+ if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
550
+ if (snapGrid[i] <= swiper.virtualSize - swiperSize) {
551
+ newSlidesGrid.push(slidesGridItem);
552
+ }
553
+ }
554
+ snapGrid = newSlidesGrid;
555
+ if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
556
+ snapGrid.push(swiper.virtualSize - swiperSize);
557
+ }
558
+ }
559
+ if (isVirtual && params.loop) {
560
+ const size = slidesSizesGrid[0] + spaceBetween;
561
+ if (params.slidesPerGroup > 1) {
562
+ const groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup);
563
+ const groupSize = size * params.slidesPerGroup;
564
+ for (let i = 0; i < groups; i += 1) {
565
+ snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize);
566
+ }
567
+ }
568
+ for (let i = 0; i < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; i += 1) {
569
+ if (params.slidesPerGroup === 1) {
570
+ snapGrid.push(snapGrid[snapGrid.length - 1] + size);
571
+ }
572
+ slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size);
573
+ swiper.virtualSize += size;
574
+ }
575
+ }
576
+ if (snapGrid.length === 0) snapGrid = [0];
577
+ if (spaceBetween !== 0) {
578
+ const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight');
579
+ slides.filter((_, slideIndex) => {
580
+ if (!params.cssMode || params.loop) return true;
581
+ if (slideIndex === slides.length - 1) {
582
+ return false;
583
+ }
584
+ return true;
585
+ }).forEach(slideEl => {
586
+ slideEl.style[key] = `${spaceBetween}px`;
587
+ });
588
+ }
589
+ if (params.centeredSlides && params.centeredSlidesBounds) {
590
+ let allSlidesSize = 0;
591
+ slidesSizesGrid.forEach(slideSizeValue => {
592
+ allSlidesSize += slideSizeValue + (spaceBetween || 0);
593
+ });
594
+ allSlidesSize -= spaceBetween;
595
+ const maxSnap = allSlidesSize > swiperSize ? allSlidesSize - swiperSize : 0;
596
+ snapGrid = snapGrid.map(snap => {
597
+ if (snap <= 0) return -offsetBefore;
598
+ if (snap > maxSnap) return maxSnap + offsetAfter;
599
+ return snap;
600
+ });
601
+ }
602
+ if (params.centerInsufficientSlides) {
603
+ let allSlidesSize = 0;
604
+ slidesSizesGrid.forEach(slideSizeValue => {
605
+ allSlidesSize += slideSizeValue + (spaceBetween || 0);
606
+ });
607
+ allSlidesSize -= spaceBetween;
608
+ const offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0);
609
+ if (allSlidesSize + offsetSize < swiperSize) {
610
+ const allSlidesOffset = (swiperSize - allSlidesSize - offsetSize) / 2;
611
+ snapGrid.forEach((snap, snapIndex) => {
612
+ snapGrid[snapIndex] = snap - allSlidesOffset;
613
+ });
614
+ slidesGrid.forEach((snap, snapIndex) => {
615
+ slidesGrid[snapIndex] = snap + allSlidesOffset;
616
+ });
617
+ }
618
+ }
619
+ Object.assign(swiper, {
620
+ slides,
621
+ snapGrid,
622
+ slidesGrid,
623
+ slidesSizesGrid
624
+ });
625
+ if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) {
626
+ setCSSProperty(wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`);
627
+ setCSSProperty(wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`);
628
+ const addToSnapGrid = -swiper.snapGrid[0];
629
+ const addToSlidesGrid = -swiper.slidesGrid[0];
630
+ swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid);
631
+ swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid);
632
+ }
633
+ if (slidesLength !== previousSlidesLength) {
634
+ swiper.emit('slidesLengthChange');
635
+ }
636
+ if (snapGrid.length !== previousSnapGridLength) {
637
+ if (swiper.params.watchOverflow) swiper.checkOverflow();
638
+ swiper.emit('snapGridLengthChange');
639
+ }
640
+ if (slidesGrid.length !== previousSlidesGridLength) {
641
+ swiper.emit('slidesGridLengthChange');
642
+ }
643
+ if (params.watchSlidesProgress) {
644
+ swiper.updateSlidesOffset();
645
+ }
646
+ swiper.emit('slidesUpdated');
647
+ if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) {
648
+ const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;
649
+ const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass);
650
+ if (slidesLength <= params.maxBackfaceHiddenSlides) {
651
+ if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass);
652
+ } else if (hasClassBackfaceClassAdded) {
653
+ swiper.el.classList.remove(backFaceHiddenClass);
654
+ }
655
+ }
656
+ }
657
+
658
+ function updateAutoHeight(speed) {
659
+ const swiper = this;
660
+ const activeSlides = [];
661
+ const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
662
+ let newHeight = 0;
663
+ let i;
664
+ if (typeof speed === 'number') {
665
+ swiper.setTransition(speed);
666
+ } else if (speed === true) {
667
+ swiper.setTransition(swiper.params.speed);
668
+ }
669
+ const getSlideByIndex = index => {
670
+ if (isVirtual) {
671
+ return swiper.slides[swiper.getSlideIndexByData(index)];
672
+ }
673
+ return swiper.slides[index];
674
+ };
675
+ // Find slides currently in view
676
+ if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
677
+ if (swiper.params.centeredSlides) {
678
+ (swiper.visibleSlides || []).forEach(slide => {
679
+ activeSlides.push(slide);
680
+ });
681
+ } else {
682
+ for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
683
+ const index = swiper.activeIndex + i;
684
+ if (index > swiper.slides.length && !isVirtual) break;
685
+ activeSlides.push(getSlideByIndex(index));
686
+ }
687
+ }
688
+ } else {
689
+ activeSlides.push(getSlideByIndex(swiper.activeIndex));
690
+ }
691
+
692
+ // Find new height from highest slide in view
693
+ for (i = 0; i < activeSlides.length; i += 1) {
694
+ if (typeof activeSlides[i] !== 'undefined') {
695
+ const height = activeSlides[i].offsetHeight;
696
+ newHeight = height > newHeight ? height : newHeight;
697
+ }
698
+ }
699
+
700
+ // Update Height
701
+ if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`;
702
+ }
703
+
704
+ function updateSlidesOffset() {
705
+ const swiper = this;
706
+ const slides = swiper.slides;
707
+ // eslint-disable-next-line
708
+ const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0;
709
+ for (let i = 0; i < slides.length; i += 1) {
710
+ slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment();
711
+ }
712
+ }
713
+
714
+ const toggleSlideClasses$1 = (slideEl, condition, className) => {
715
+ if (condition && !slideEl.classList.contains(className)) {
716
+ slideEl.classList.add(className);
717
+ } else if (!condition && slideEl.classList.contains(className)) {
718
+ slideEl.classList.remove(className);
719
+ }
720
+ };
721
+ function updateSlidesProgress(translate) {
722
+ if (translate === void 0) {
723
+ translate = this && this.translate || 0;
724
+ }
725
+ const swiper = this;
726
+ const params = swiper.params;
727
+ const {
728
+ slides,
729
+ rtlTranslate: rtl,
730
+ snapGrid
731
+ } = swiper;
732
+ if (slides.length === 0) return;
733
+ if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
734
+ let offsetCenter = -translate;
735
+ if (rtl) offsetCenter = translate;
736
+ swiper.visibleSlidesIndexes = [];
737
+ swiper.visibleSlides = [];
738
+ let spaceBetween = params.spaceBetween;
739
+ if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
740
+ spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size;
741
+ } else if (typeof spaceBetween === 'string') {
742
+ spaceBetween = parseFloat(spaceBetween);
743
+ }
744
+ for (let i = 0; i < slides.length; i += 1) {
745
+ const slide = slides[i];
746
+ let slideOffset = slide.swiperSlideOffset;
747
+ if (params.cssMode && params.centeredSlides) {
748
+ slideOffset -= slides[0].swiperSlideOffset;
749
+ }
750
+ const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
751
+ const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
752
+ const slideBefore = -(offsetCenter - slideOffset);
753
+ const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
754
+ const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i];
755
+ const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
756
+ if (isVisible) {
757
+ swiper.visibleSlides.push(slide);
758
+ swiper.visibleSlidesIndexes.push(i);
759
+ }
760
+ toggleSlideClasses$1(slide, isVisible, params.slideVisibleClass);
761
+ toggleSlideClasses$1(slide, isFullyVisible, params.slideFullyVisibleClass);
762
+ slide.progress = rtl ? -slideProgress : slideProgress;
763
+ slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
764
+ }
765
+ }
766
+
767
+ function updateProgress(translate) {
768
+ const swiper = this;
769
+ if (typeof translate === 'undefined') {
770
+ const multiplier = swiper.rtlTranslate ? -1 : 1;
771
+ // eslint-disable-next-line
772
+ translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
773
+ }
774
+ const params = swiper.params;
775
+ const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
776
+ let {
777
+ progress,
778
+ isBeginning,
779
+ isEnd,
780
+ progressLoop
781
+ } = swiper;
782
+ const wasBeginning = isBeginning;
783
+ const wasEnd = isEnd;
784
+ if (translatesDiff === 0) {
785
+ progress = 0;
786
+ isBeginning = true;
787
+ isEnd = true;
788
+ } else {
789
+ progress = (translate - swiper.minTranslate()) / translatesDiff;
790
+ const isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1;
791
+ const isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1;
792
+ isBeginning = isBeginningRounded || progress <= 0;
793
+ isEnd = isEndRounded || progress >= 1;
794
+ if (isBeginningRounded) progress = 0;
795
+ if (isEndRounded) progress = 1;
796
+ }
797
+ if (params.loop) {
798
+ const firstSlideIndex = swiper.getSlideIndexByData(0);
799
+ const lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1);
800
+ const firstSlideTranslate = swiper.slidesGrid[firstSlideIndex];
801
+ const lastSlideTranslate = swiper.slidesGrid[lastSlideIndex];
802
+ const translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1];
803
+ const translateAbs = Math.abs(translate);
804
+ if (translateAbs >= firstSlideTranslate) {
805
+ progressLoop = (translateAbs - firstSlideTranslate) / translateMax;
806
+ } else {
807
+ progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax;
808
+ }
809
+ if (progressLoop > 1) progressLoop -= 1;
810
+ }
811
+ Object.assign(swiper, {
812
+ progress,
813
+ progressLoop,
814
+ isBeginning,
815
+ isEnd
816
+ });
817
+ if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);
818
+ if (isBeginning && !wasBeginning) {
819
+ swiper.emit('reachBeginning toEdge');
820
+ }
821
+ if (isEnd && !wasEnd) {
822
+ swiper.emit('reachEnd toEdge');
823
+ }
824
+ if (wasBeginning && !isBeginning || wasEnd && !isEnd) {
825
+ swiper.emit('fromEdge');
826
+ }
827
+ swiper.emit('progress', progress);
828
+ }
829
+
830
+ const toggleSlideClasses = (slideEl, condition, className) => {
831
+ if (condition && !slideEl.classList.contains(className)) {
832
+ slideEl.classList.add(className);
833
+ } else if (!condition && slideEl.classList.contains(className)) {
834
+ slideEl.classList.remove(className);
835
+ }
836
+ };
837
+ function updateSlidesClasses() {
838
+ const swiper = this;
839
+ const {
840
+ slides,
841
+ params,
842
+ slidesEl,
843
+ activeIndex
844
+ } = swiper;
845
+ const isVirtual = swiper.virtual && params.virtual.enabled;
846
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
847
+ const getFilteredSlide = selector => {
848
+ return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
849
+ };
850
+ let activeSlide;
851
+ let prevSlide;
852
+ let nextSlide;
853
+ if (isVirtual) {
854
+ if (params.loop) {
855
+ let slideIndex = activeIndex - swiper.virtual.slidesBefore;
856
+ if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex;
857
+ if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length;
858
+ activeSlide = getFilteredSlide(`[data-swiper-slide-index="${slideIndex}"]`);
859
+ } else {
860
+ activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`);
861
+ }
862
+ } else {
863
+ if (gridEnabled) {
864
+ activeSlide = slides.filter(slideEl => slideEl.column === activeIndex)[0];
865
+ nextSlide = slides.filter(slideEl => slideEl.column === activeIndex + 1)[0];
866
+ prevSlide = slides.filter(slideEl => slideEl.column === activeIndex - 1)[0];
867
+ } else {
868
+ activeSlide = slides[activeIndex];
869
+ }
870
+ }
871
+ if (activeSlide) {
872
+ if (!gridEnabled) {
873
+ // Next Slide
874
+ nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
875
+ if (params.loop && !nextSlide) {
876
+ nextSlide = slides[0];
877
+ }
878
+
879
+ // Prev Slide
880
+ prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
881
+ if (params.loop && !prevSlide === 0) {
882
+ prevSlide = slides[slides.length - 1];
883
+ }
884
+ }
885
+ }
886
+ slides.forEach(slideEl => {
887
+ toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass);
888
+ toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass);
889
+ toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass);
890
+ });
891
+ swiper.emitSlidesClasses();
892
+ }
893
+
894
+ const processLazyPreloader = (swiper, imageEl) => {
895
+ if (!swiper || swiper.destroyed || !swiper.params) return;
896
+ const slideSelector = () => swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`;
897
+ const slideEl = imageEl.closest(slideSelector());
898
+ if (slideEl) {
899
+ let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`);
900
+ if (!lazyEl && swiper.isElement) {
901
+ if (slideEl.shadowRoot) {
902
+ lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
903
+ } else {
904
+ // init later
905
+ requestAnimationFrame(() => {
906
+ if (slideEl.shadowRoot) {
907
+ lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
908
+ if (lazyEl) lazyEl.remove();
909
+ }
910
+ });
911
+ }
912
+ }
913
+ if (lazyEl) lazyEl.remove();
914
+ }
915
+ };
916
+ const unlazy = (swiper, index) => {
917
+ if (!swiper.slides[index]) return;
918
+ const imageEl = swiper.slides[index].querySelector('[loading="lazy"]');
919
+ if (imageEl) imageEl.removeAttribute('loading');
920
+ };
921
+ const preload = swiper => {
922
+ if (!swiper || swiper.destroyed || !swiper.params) return;
923
+ let amount = swiper.params.lazyPreloadPrevNext;
924
+ const len = swiper.slides.length;
925
+ if (!len || !amount || amount < 0) return;
926
+ amount = Math.min(amount, len);
927
+ const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView);
928
+ const activeIndex = swiper.activeIndex;
929
+ if (swiper.params.grid && swiper.params.grid.rows > 1) {
930
+ const activeColumn = activeIndex;
931
+ const preloadColumns = [activeColumn - amount];
932
+ preloadColumns.push(...Array.from({
933
+ length: amount
934
+ }).map((_, i) => {
935
+ return activeColumn + slidesPerView + i;
936
+ }));
937
+ swiper.slides.forEach((slideEl, i) => {
938
+ if (preloadColumns.includes(slideEl.column)) unlazy(swiper, i);
939
+ });
940
+ return;
941
+ }
942
+ const slideIndexLastInView = activeIndex + slidesPerView - 1;
943
+ if (swiper.params.rewind || swiper.params.loop) {
944
+ for (let i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) {
945
+ const realIndex = (i % len + len) % len;
946
+ if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex);
947
+ }
948
+ } else {
949
+ for (let i = Math.max(activeIndex - amount, 0); i <= Math.min(slideIndexLastInView + amount, len - 1); i += 1) {
950
+ if (i !== activeIndex && (i > slideIndexLastInView || i < activeIndex)) {
951
+ unlazy(swiper, i);
952
+ }
953
+ }
954
+ }
955
+ };
956
+
957
+ function getActiveIndexByTranslate(swiper) {
958
+ const {
959
+ slidesGrid,
960
+ params
961
+ } = swiper;
962
+ const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
963
+ let activeIndex;
964
+ for (let i = 0; i < slidesGrid.length; i += 1) {
965
+ if (typeof slidesGrid[i + 1] !== 'undefined') {
966
+ if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {
967
+ activeIndex = i;
968
+ } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
969
+ activeIndex = i + 1;
970
+ }
971
+ } else if (translate >= slidesGrid[i]) {
972
+ activeIndex = i;
973
+ }
974
+ }
975
+ // Normalize slideIndex
976
+ if (params.normalizeSlideIndex) {
977
+ if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
978
+ }
979
+ return activeIndex;
980
+ }
981
+ function updateActiveIndex(newActiveIndex) {
982
+ const swiper = this;
983
+ const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
984
+ const {
985
+ snapGrid,
986
+ params,
987
+ activeIndex: previousIndex,
988
+ realIndex: previousRealIndex,
989
+ snapIndex: previousSnapIndex
990
+ } = swiper;
991
+ let activeIndex = newActiveIndex;
992
+ let snapIndex;
993
+ const getVirtualRealIndex = aIndex => {
994
+ let realIndex = aIndex - swiper.virtual.slidesBefore;
995
+ if (realIndex < 0) {
996
+ realIndex = swiper.virtual.slides.length + realIndex;
997
+ }
998
+ if (realIndex >= swiper.virtual.slides.length) {
999
+ realIndex -= swiper.virtual.slides.length;
1000
+ }
1001
+ return realIndex;
1002
+ };
1003
+ if (typeof activeIndex === 'undefined') {
1004
+ activeIndex = getActiveIndexByTranslate(swiper);
1005
+ }
1006
+ if (snapGrid.indexOf(translate) >= 0) {
1007
+ snapIndex = snapGrid.indexOf(translate);
1008
+ } else {
1009
+ const skip = Math.min(params.slidesPerGroupSkip, activeIndex);
1010
+ snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
1011
+ }
1012
+ if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
1013
+ if (activeIndex === previousIndex && !swiper.params.loop) {
1014
+ if (snapIndex !== previousSnapIndex) {
1015
+ swiper.snapIndex = snapIndex;
1016
+ swiper.emit('snapIndexChange');
1017
+ }
1018
+ return;
1019
+ }
1020
+ if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
1021
+ swiper.realIndex = getVirtualRealIndex(activeIndex);
1022
+ return;
1023
+ }
1024
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
1025
+
1026
+ // Get real index
1027
+ let realIndex;
1028
+ if (swiper.virtual && params.virtual.enabled && params.loop) {
1029
+ realIndex = getVirtualRealIndex(activeIndex);
1030
+ } else if (gridEnabled) {
1031
+ const firstSlideInColumn = swiper.slides.filter(slideEl => slideEl.column === activeIndex)[0];
1032
+ let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10);
1033
+ if (Number.isNaN(activeSlideIndex)) {
1034
+ activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0);
1035
+ }
1036
+ realIndex = Math.floor(activeSlideIndex / params.grid.rows);
1037
+ } else if (swiper.slides[activeIndex]) {
1038
+ const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index');
1039
+ if (slideIndex) {
1040
+ realIndex = parseInt(slideIndex, 10);
1041
+ } else {
1042
+ realIndex = activeIndex;
1043
+ }
1044
+ } else {
1045
+ realIndex = activeIndex;
1046
+ }
1047
+ Object.assign(swiper, {
1048
+ previousSnapIndex,
1049
+ snapIndex,
1050
+ previousRealIndex,
1051
+ realIndex,
1052
+ previousIndex,
1053
+ activeIndex
1054
+ });
1055
+ if (swiper.initialized) {
1056
+ preload(swiper);
1057
+ }
1058
+ swiper.emit('activeIndexChange');
1059
+ swiper.emit('snapIndexChange');
1060
+ if (swiper.initialized || swiper.params.runCallbacksOnInit) {
1061
+ if (previousRealIndex !== realIndex) {
1062
+ swiper.emit('realIndexChange');
1063
+ }
1064
+ swiper.emit('slideChange');
1065
+ }
1066
+ }
1067
+
1068
+ function updateClickedSlide(el, path) {
1069
+ const swiper = this;
1070
+ const params = swiper.params;
1071
+ let slide = el.closest(`.${params.slideClass}, swiper-slide`);
1072
+ if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) {
1073
+ [...path.slice(path.indexOf(el) + 1, path.length)].forEach(pathEl => {
1074
+ if (!slide && pathEl.matches && pathEl.matches(`.${params.slideClass}, swiper-slide`)) {
1075
+ slide = pathEl;
1076
+ }
1077
+ });
1078
+ }
1079
+ let slideFound = false;
1080
+ let slideIndex;
1081
+ if (slide) {
1082
+ for (let i = 0; i < swiper.slides.length; i += 1) {
1083
+ if (swiper.slides[i] === slide) {
1084
+ slideFound = true;
1085
+ slideIndex = i;
1086
+ break;
1087
+ }
1088
+ }
1089
+ }
1090
+ if (slide && slideFound) {
1091
+ swiper.clickedSlide = slide;
1092
+ if (swiper.virtual && swiper.params.virtual.enabled) {
1093
+ swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10);
1094
+ } else {
1095
+ swiper.clickedIndex = slideIndex;
1096
+ }
1097
+ } else {
1098
+ swiper.clickedSlide = undefined;
1099
+ swiper.clickedIndex = undefined;
1100
+ return;
1101
+ }
1102
+ if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
1103
+ swiper.slideToClickedSlide();
1104
+ }
1105
+ }
1106
+
1107
+ var update = {
1108
+ updateSize,
1109
+ updateSlides,
1110
+ updateAutoHeight,
1111
+ updateSlidesOffset,
1112
+ updateSlidesProgress,
1113
+ updateProgress,
1114
+ updateSlidesClasses,
1115
+ updateActiveIndex,
1116
+ updateClickedSlide
1117
+ };
1118
+
1119
+ function getSwiperTranslate(axis) {
1120
+ if (axis === void 0) {
1121
+ axis = this.isHorizontal() ? 'x' : 'y';
1122
+ }
1123
+ const swiper = this;
1124
+ const {
1125
+ params,
1126
+ rtlTranslate: rtl,
1127
+ translate,
1128
+ wrapperEl
1129
+ } = swiper;
1130
+ if (params.virtualTranslate) {
1131
+ return rtl ? -translate : translate;
1132
+ }
1133
+ if (params.cssMode) {
1134
+ return translate;
1135
+ }
1136
+ let currentTranslate = getTranslate(wrapperEl, axis);
1137
+ currentTranslate += swiper.cssOverflowAdjustment();
1138
+ if (rtl) currentTranslate = -currentTranslate;
1139
+ return currentTranslate || 0;
1140
+ }
1141
+
1142
+ function setTranslate(translate, byController) {
1143
+ const swiper = this;
1144
+ const {
1145
+ rtlTranslate: rtl,
1146
+ params,
1147
+ wrapperEl,
1148
+ progress
1149
+ } = swiper;
1150
+ let x = 0;
1151
+ let y = 0;
1152
+ const z = 0;
1153
+ if (swiper.isHorizontal()) {
1154
+ x = rtl ? -translate : translate;
1155
+ } else {
1156
+ y = translate;
1157
+ }
1158
+ if (params.roundLengths) {
1159
+ x = Math.floor(x);
1160
+ y = Math.floor(y);
1161
+ }
1162
+ swiper.previousTranslate = swiper.translate;
1163
+ swiper.translate = swiper.isHorizontal() ? x : y;
1164
+ if (params.cssMode) {
1165
+ wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
1166
+ } else if (!params.virtualTranslate) {
1167
+ if (swiper.isHorizontal()) {
1168
+ x -= swiper.cssOverflowAdjustment();
1169
+ } else {
1170
+ y -= swiper.cssOverflowAdjustment();
1171
+ }
1172
+ wrapperEl.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`;
1173
+ }
1174
+
1175
+ // Check if we need to update progress
1176
+ let newProgress;
1177
+ const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
1178
+ if (translatesDiff === 0) {
1179
+ newProgress = 0;
1180
+ } else {
1181
+ newProgress = (translate - swiper.minTranslate()) / translatesDiff;
1182
+ }
1183
+ if (newProgress !== progress) {
1184
+ swiper.updateProgress(translate);
1185
+ }
1186
+ swiper.emit('setTranslate', swiper.translate, byController);
1187
+ }
1188
+
1189
+ function minTranslate() {
1190
+ return -this.snapGrid[0];
1191
+ }
1192
+
1193
+ function maxTranslate() {
1194
+ return -this.snapGrid[this.snapGrid.length - 1];
1195
+ }
1196
+
1197
+ function translateTo(translate, speed, runCallbacks, translateBounds, internal) {
1198
+ if (translate === void 0) {
1199
+ translate = 0;
1200
+ }
1201
+ if (speed === void 0) {
1202
+ speed = this.params.speed;
1203
+ }
1204
+ if (runCallbacks === void 0) {
1205
+ runCallbacks = true;
1206
+ }
1207
+ if (translateBounds === void 0) {
1208
+ translateBounds = true;
1209
+ }
1210
+ const swiper = this;
1211
+ const {
1212
+ params,
1213
+ wrapperEl
1214
+ } = swiper;
1215
+ if (swiper.animating && params.preventInteractionOnTransition) {
1216
+ return false;
1217
+ }
1218
+ const minTranslate = swiper.minTranslate();
1219
+ const maxTranslate = swiper.maxTranslate();
1220
+ let newTranslate;
1221
+ if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate;
1222
+
1223
+ // Update progress
1224
+ swiper.updateProgress(newTranslate);
1225
+ if (params.cssMode) {
1226
+ const isH = swiper.isHorizontal();
1227
+ if (speed === 0) {
1228
+ wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
1229
+ } else {
1230
+ if (!swiper.support.smoothScroll) {
1231
+ animateCSSModeScroll({
1232
+ swiper,
1233
+ targetPosition: -newTranslate,
1234
+ side: isH ? 'left' : 'top'
1235
+ });
1236
+ return true;
1237
+ }
1238
+ wrapperEl.scrollTo({
1239
+ [isH ? 'left' : 'top']: -newTranslate,
1240
+ behavior: 'smooth'
1241
+ });
1242
+ }
1243
+ return true;
1244
+ }
1245
+ if (speed === 0) {
1246
+ swiper.setTransition(0);
1247
+ swiper.setTranslate(newTranslate);
1248
+ if (runCallbacks) {
1249
+ swiper.emit('beforeTransitionStart', speed, internal);
1250
+ swiper.emit('transitionEnd');
1251
+ }
1252
+ } else {
1253
+ swiper.setTransition(speed);
1254
+ swiper.setTranslate(newTranslate);
1255
+ if (runCallbacks) {
1256
+ swiper.emit('beforeTransitionStart', speed, internal);
1257
+ swiper.emit('transitionStart');
1258
+ }
1259
+ if (!swiper.animating) {
1260
+ swiper.animating = true;
1261
+ if (!swiper.onTranslateToWrapperTransitionEnd) {
1262
+ swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {
1263
+ if (!swiper || swiper.destroyed) return;
1264
+ if (e.target !== this) return;
1265
+ swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
1266
+ swiper.onTranslateToWrapperTransitionEnd = null;
1267
+ delete swiper.onTranslateToWrapperTransitionEnd;
1268
+ swiper.animating = false;
1269
+ if (runCallbacks) {
1270
+ swiper.emit('transitionEnd');
1271
+ }
1272
+ };
1273
+ }
1274
+ swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
1275
+ }
1276
+ }
1277
+ return true;
1278
+ }
1279
+
1280
+ var translate = {
1281
+ getTranslate: getSwiperTranslate,
1282
+ setTranslate,
1283
+ minTranslate,
1284
+ maxTranslate,
1285
+ translateTo
1286
+ };
1287
+
1288
+ function setTransition(duration, byController) {
1289
+ const swiper = this;
1290
+ if (!swiper.params.cssMode) {
1291
+ swiper.wrapperEl.style.transitionDuration = `${duration}ms`;
1292
+ swiper.wrapperEl.style.transitionDelay = duration === 0 ? `0ms` : '';
1293
+ }
1294
+ swiper.emit('setTransition', duration, byController);
1295
+ }
1296
+
1297
+ function transitionEmit(_ref) {
1298
+ let {
1299
+ swiper,
1300
+ runCallbacks,
1301
+ direction,
1302
+ step
1303
+ } = _ref;
1304
+ const {
1305
+ activeIndex,
1306
+ previousIndex
1307
+ } = swiper;
1308
+ let dir = direction;
1309
+ if (!dir) {
1310
+ if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
1311
+ }
1312
+ swiper.emit(`transition${step}`);
1313
+ if (runCallbacks && activeIndex !== previousIndex) {
1314
+ if (dir === 'reset') {
1315
+ swiper.emit(`slideResetTransition${step}`);
1316
+ return;
1317
+ }
1318
+ swiper.emit(`slideChangeTransition${step}`);
1319
+ if (dir === 'next') {
1320
+ swiper.emit(`slideNextTransition${step}`);
1321
+ } else {
1322
+ swiper.emit(`slidePrevTransition${step}`);
1323
+ }
1324
+ }
1325
+ }
1326
+
1327
+ function transitionStart(runCallbacks, direction) {
1328
+ if (runCallbacks === void 0) {
1329
+ runCallbacks = true;
1330
+ }
1331
+ const swiper = this;
1332
+ const {
1333
+ params
1334
+ } = swiper;
1335
+ if (params.cssMode) return;
1336
+ if (params.autoHeight) {
1337
+ swiper.updateAutoHeight();
1338
+ }
1339
+ transitionEmit({
1340
+ swiper,
1341
+ runCallbacks,
1342
+ direction,
1343
+ step: 'Start'
1344
+ });
1345
+ }
1346
+
1347
+ function transitionEnd(runCallbacks, direction) {
1348
+ if (runCallbacks === void 0) {
1349
+ runCallbacks = true;
1350
+ }
1351
+ const swiper = this;
1352
+ const {
1353
+ params
1354
+ } = swiper;
1355
+ swiper.animating = false;
1356
+ if (params.cssMode) return;
1357
+ swiper.setTransition(0);
1358
+ transitionEmit({
1359
+ swiper,
1360
+ runCallbacks,
1361
+ direction,
1362
+ step: 'End'
1363
+ });
1364
+ }
1365
+
1366
+ var transition = {
1367
+ setTransition,
1368
+ transitionStart,
1369
+ transitionEnd
1370
+ };
1371
+
1372
+ function slideTo(index, speed, runCallbacks, internal, initial) {
1373
+ if (index === void 0) {
1374
+ index = 0;
1375
+ }
1376
+ if (runCallbacks === void 0) {
1377
+ runCallbacks = true;
1378
+ }
1379
+ if (typeof index === 'string') {
1380
+ index = parseInt(index, 10);
1381
+ }
1382
+ const swiper = this;
1383
+ let slideIndex = index;
1384
+ if (slideIndex < 0) slideIndex = 0;
1385
+ const {
1386
+ params,
1387
+ snapGrid,
1388
+ slidesGrid,
1389
+ previousIndex,
1390
+ activeIndex,
1391
+ rtlTranslate: rtl,
1392
+ wrapperEl,
1393
+ enabled
1394
+ } = swiper;
1395
+ if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) {
1396
+ return false;
1397
+ }
1398
+ if (typeof speed === 'undefined') {
1399
+ speed = swiper.params.speed;
1400
+ }
1401
+ const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
1402
+ let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
1403
+ if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
1404
+ const translate = -snapGrid[snapIndex];
1405
+ // Normalize slideIndex
1406
+ if (params.normalizeSlideIndex) {
1407
+ for (let i = 0; i < slidesGrid.length; i += 1) {
1408
+ const normalizedTranslate = -Math.floor(translate * 100);
1409
+ const normalizedGrid = Math.floor(slidesGrid[i] * 100);
1410
+ const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);
1411
+ if (typeof slidesGrid[i + 1] !== 'undefined') {
1412
+ if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) {
1413
+ slideIndex = i;
1414
+ } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) {
1415
+ slideIndex = i + 1;
1416
+ }
1417
+ } else if (normalizedTranslate >= normalizedGrid) {
1418
+ slideIndex = i;
1419
+ }
1420
+ }
1421
+ }
1422
+ // Directions locks
1423
+ if (swiper.initialized && slideIndex !== activeIndex) {
1424
+ if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) {
1425
+ return false;
1426
+ }
1427
+ if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
1428
+ if ((activeIndex || 0) !== slideIndex) {
1429
+ return false;
1430
+ }
1431
+ }
1432
+ }
1433
+ if (slideIndex !== (previousIndex || 0) && runCallbacks) {
1434
+ swiper.emit('beforeSlideChangeStart');
1435
+ }
1436
+
1437
+ // Update progress
1438
+ swiper.updateProgress(translate);
1439
+ let direction;
1440
+ if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset';
1441
+
1442
+ // initial virtual
1443
+ const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
1444
+ const isInitialVirtual = isVirtual && initial;
1445
+ // Update Index
1446
+ if (!isInitialVirtual && (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate)) {
1447
+ swiper.updateActiveIndex(slideIndex);
1448
+ // Update Height
1449
+ if (params.autoHeight) {
1450
+ swiper.updateAutoHeight();
1451
+ }
1452
+ swiper.updateSlidesClasses();
1453
+ if (params.effect !== 'slide') {
1454
+ swiper.setTranslate(translate);
1455
+ }
1456
+ if (direction !== 'reset') {
1457
+ swiper.transitionStart(runCallbacks, direction);
1458
+ swiper.transitionEnd(runCallbacks, direction);
1459
+ }
1460
+ return false;
1461
+ }
1462
+ if (params.cssMode) {
1463
+ const isH = swiper.isHorizontal();
1464
+ const t = rtl ? translate : -translate;
1465
+ if (speed === 0) {
1466
+ if (isVirtual) {
1467
+ swiper.wrapperEl.style.scrollSnapType = 'none';
1468
+ swiper._immediateVirtual = true;
1469
+ }
1470
+ if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) {
1471
+ swiper._cssModeVirtualInitialSet = true;
1472
+ requestAnimationFrame(() => {
1473
+ wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
1474
+ });
1475
+ } else {
1476
+ wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
1477
+ }
1478
+ if (isVirtual) {
1479
+ requestAnimationFrame(() => {
1480
+ swiper.wrapperEl.style.scrollSnapType = '';
1481
+ swiper._immediateVirtual = false;
1482
+ });
1483
+ }
1484
+ } else {
1485
+ if (!swiper.support.smoothScroll) {
1486
+ animateCSSModeScroll({
1487
+ swiper,
1488
+ targetPosition: t,
1489
+ side: isH ? 'left' : 'top'
1490
+ });
1491
+ return true;
1492
+ }
1493
+ wrapperEl.scrollTo({
1494
+ [isH ? 'left' : 'top']: t,
1495
+ behavior: 'smooth'
1496
+ });
1497
+ }
1498
+ return true;
1499
+ }
1500
+ swiper.setTransition(speed);
1501
+ swiper.setTranslate(translate);
1502
+ swiper.updateActiveIndex(slideIndex);
1503
+ swiper.updateSlidesClasses();
1504
+ swiper.emit('beforeTransitionStart', speed, internal);
1505
+ swiper.transitionStart(runCallbacks, direction);
1506
+ if (speed === 0) {
1507
+ swiper.transitionEnd(runCallbacks, direction);
1508
+ } else if (!swiper.animating) {
1509
+ swiper.animating = true;
1510
+ if (!swiper.onSlideToWrapperTransitionEnd) {
1511
+ swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
1512
+ if (!swiper || swiper.destroyed) return;
1513
+ if (e.target !== this) return;
1514
+ swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
1515
+ swiper.onSlideToWrapperTransitionEnd = null;
1516
+ delete swiper.onSlideToWrapperTransitionEnd;
1517
+ swiper.transitionEnd(runCallbacks, direction);
1518
+ };
1519
+ }
1520
+ swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
1521
+ }
1522
+ return true;
1523
+ }
1524
+
1525
+ function slideToLoop(index, speed, runCallbacks, internal) {
1526
+ if (index === void 0) {
1527
+ index = 0;
1528
+ }
1529
+ if (runCallbacks === void 0) {
1530
+ runCallbacks = true;
1531
+ }
1532
+ if (typeof index === 'string') {
1533
+ const indexAsNumber = parseInt(index, 10);
1534
+ index = indexAsNumber;
1535
+ }
1536
+ const swiper = this;
1537
+ if (swiper.destroyed) return;
1538
+ if (typeof speed === 'undefined') {
1539
+ speed = swiper.params.speed;
1540
+ }
1541
+ const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
1542
+ let newIndex = index;
1543
+ if (swiper.params.loop) {
1544
+ if (swiper.virtual && swiper.params.virtual.enabled) {
1545
+ // eslint-disable-next-line
1546
+ newIndex = newIndex + swiper.virtual.slidesBefore;
1547
+ } else {
1548
+ let targetSlideIndex;
1549
+ if (gridEnabled) {
1550
+ const slideIndex = newIndex * swiper.params.grid.rows;
1551
+ targetSlideIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
1552
+ } else {
1553
+ targetSlideIndex = swiper.getSlideIndexByData(newIndex);
1554
+ }
1555
+ const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length;
1556
+ const {
1557
+ centeredSlides
1558
+ } = swiper.params;
1559
+ let slidesPerView = swiper.params.slidesPerView;
1560
+ if (slidesPerView === 'auto') {
1561
+ slidesPerView = swiper.slidesPerViewDynamic();
1562
+ } else {
1563
+ slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
1564
+ if (centeredSlides && slidesPerView % 2 === 0) {
1565
+ slidesPerView = slidesPerView + 1;
1566
+ }
1567
+ }
1568
+ let needLoopFix = cols - targetSlideIndex < slidesPerView;
1569
+ if (centeredSlides) {
1570
+ needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
1571
+ }
1572
+ if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) {
1573
+ needLoopFix = false;
1574
+ }
1575
+ if (needLoopFix) {
1576
+ const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
1577
+ swiper.loopFix({
1578
+ direction,
1579
+ slideTo: true,
1580
+ activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
1581
+ slideRealIndex: direction === 'next' ? swiper.realIndex : undefined
1582
+ });
1583
+ }
1584
+ if (gridEnabled) {
1585
+ const slideIndex = newIndex * swiper.params.grid.rows;
1586
+ newIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
1587
+ } else {
1588
+ newIndex = swiper.getSlideIndexByData(newIndex);
1589
+ }
1590
+ }
1591
+ }
1592
+ requestAnimationFrame(() => {
1593
+ swiper.slideTo(newIndex, speed, runCallbacks, internal);
1594
+ });
1595
+ return swiper;
1596
+ }
1597
+
1598
+ /* eslint no-unused-vars: "off" */
1599
+ function slideNext(speed, runCallbacks, internal) {
1600
+ if (runCallbacks === void 0) {
1601
+ runCallbacks = true;
1602
+ }
1603
+ const swiper = this;
1604
+ const {
1605
+ enabled,
1606
+ params,
1607
+ animating
1608
+ } = swiper;
1609
+ if (!enabled || swiper.destroyed) return swiper;
1610
+ if (typeof speed === 'undefined') {
1611
+ speed = swiper.params.speed;
1612
+ }
1613
+ let perGroup = params.slidesPerGroup;
1614
+ if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
1615
+ perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
1616
+ }
1617
+ const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;
1618
+ const isVirtual = swiper.virtual && params.virtual.enabled;
1619
+ if (params.loop) {
1620
+ if (animating && !isVirtual && params.loopPreventsSliding) return false;
1621
+ swiper.loopFix({
1622
+ direction: 'next'
1623
+ });
1624
+ // eslint-disable-next-line
1625
+ swiper._clientLeft = swiper.wrapperEl.clientLeft;
1626
+ if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) {
1627
+ requestAnimationFrame(() => {
1628
+ swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
1629
+ });
1630
+ return true;
1631
+ }
1632
+ }
1633
+ if (params.rewind && swiper.isEnd) {
1634
+ return swiper.slideTo(0, speed, runCallbacks, internal);
1635
+ }
1636
+ return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
1637
+ }
1638
+
1639
+ /* eslint no-unused-vars: "off" */
1640
+ function slidePrev(speed, runCallbacks, internal) {
1641
+ if (runCallbacks === void 0) {
1642
+ runCallbacks = true;
1643
+ }
1644
+ const swiper = this;
1645
+ const {
1646
+ params,
1647
+ snapGrid,
1648
+ slidesGrid,
1649
+ rtlTranslate,
1650
+ enabled,
1651
+ animating
1652
+ } = swiper;
1653
+ if (!enabled || swiper.destroyed) return swiper;
1654
+ if (typeof speed === 'undefined') {
1655
+ speed = swiper.params.speed;
1656
+ }
1657
+ const isVirtual = swiper.virtual && params.virtual.enabled;
1658
+ if (params.loop) {
1659
+ if (animating && !isVirtual && params.loopPreventsSliding) return false;
1660
+ swiper.loopFix({
1661
+ direction: 'prev'
1662
+ });
1663
+ // eslint-disable-next-line
1664
+ swiper._clientLeft = swiper.wrapperEl.clientLeft;
1665
+ }
1666
+ const translate = rtlTranslate ? swiper.translate : -swiper.translate;
1667
+ function normalize(val) {
1668
+ if (val < 0) return -Math.floor(Math.abs(val));
1669
+ return Math.floor(val);
1670
+ }
1671
+ const normalizedTranslate = normalize(translate);
1672
+ const normalizedSnapGrid = snapGrid.map(val => normalize(val));
1673
+ let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
1674
+ if (typeof prevSnap === 'undefined' && params.cssMode) {
1675
+ let prevSnapIndex;
1676
+ snapGrid.forEach((snap, snapIndex) => {
1677
+ if (normalizedTranslate >= snap) {
1678
+ // prevSnap = snap;
1679
+ prevSnapIndex = snapIndex;
1680
+ }
1681
+ });
1682
+ if (typeof prevSnapIndex !== 'undefined') {
1683
+ prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
1684
+ }
1685
+ }
1686
+ let prevIndex = 0;
1687
+ if (typeof prevSnap !== 'undefined') {
1688
+ prevIndex = slidesGrid.indexOf(prevSnap);
1689
+ if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;
1690
+ if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
1691
+ prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1;
1692
+ prevIndex = Math.max(prevIndex, 0);
1693
+ }
1694
+ }
1695
+ if (params.rewind && swiper.isBeginning) {
1696
+ const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
1697
+ return swiper.slideTo(lastIndex, speed, runCallbacks, internal);
1698
+ } else if (params.loop && swiper.activeIndex === 0 && params.cssMode) {
1699
+ requestAnimationFrame(() => {
1700
+ swiper.slideTo(prevIndex, speed, runCallbacks, internal);
1701
+ });
1702
+ return true;
1703
+ }
1704
+ return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
1705
+ }
1706
+
1707
+ /* eslint no-unused-vars: "off" */
1708
+ function slideReset(speed, runCallbacks, internal) {
1709
+ if (runCallbacks === void 0) {
1710
+ runCallbacks = true;
1711
+ }
1712
+ const swiper = this;
1713
+ if (swiper.destroyed) return;
1714
+ if (typeof speed === 'undefined') {
1715
+ speed = swiper.params.speed;
1716
+ }
1717
+ return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
1718
+ }
1719
+
1720
+ /* eslint no-unused-vars: "off" */
1721
+ function slideToClosest(speed, runCallbacks, internal, threshold) {
1722
+ if (runCallbacks === void 0) {
1723
+ runCallbacks = true;
1724
+ }
1725
+ if (threshold === void 0) {
1726
+ threshold = 0.5;
1727
+ }
1728
+ const swiper = this;
1729
+ if (swiper.destroyed) return;
1730
+ if (typeof speed === 'undefined') {
1731
+ speed = swiper.params.speed;
1732
+ }
1733
+ let index = swiper.activeIndex;
1734
+ const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
1735
+ const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
1736
+ const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
1737
+ if (translate >= swiper.snapGrid[snapIndex]) {
1738
+ // The current translate is on or after the current snap index, so the choice
1739
+ // is between the current index and the one after it.
1740
+ const currentSnap = swiper.snapGrid[snapIndex];
1741
+ const nextSnap = swiper.snapGrid[snapIndex + 1];
1742
+ if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
1743
+ index += swiper.params.slidesPerGroup;
1744
+ }
1745
+ } else {
1746
+ // The current translate is before the current snap index, so the choice
1747
+ // is between the current index and the one before it.
1748
+ const prevSnap = swiper.snapGrid[snapIndex - 1];
1749
+ const currentSnap = swiper.snapGrid[snapIndex];
1750
+ if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) {
1751
+ index -= swiper.params.slidesPerGroup;
1752
+ }
1753
+ }
1754
+ index = Math.max(index, 0);
1755
+ index = Math.min(index, swiper.slidesGrid.length - 1);
1756
+ return swiper.slideTo(index, speed, runCallbacks, internal);
1757
+ }
1758
+
1759
+ function slideToClickedSlide() {
1760
+ const swiper = this;
1761
+ if (swiper.destroyed) return;
1762
+ const {
1763
+ params,
1764
+ slidesEl
1765
+ } = swiper;
1766
+ const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
1767
+ let slideToIndex = swiper.clickedIndex;
1768
+ let realIndex;
1769
+ const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`;
1770
+ if (params.loop) {
1771
+ if (swiper.animating) return;
1772
+ realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);
1773
+ if (params.centeredSlides) {
1774
+ if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
1775
+ swiper.loopFix();
1776
+ slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
1777
+ nextTick(() => {
1778
+ swiper.slideTo(slideToIndex);
1779
+ });
1780
+ } else {
1781
+ swiper.slideTo(slideToIndex);
1782
+ }
1783
+ } else if (slideToIndex > swiper.slides.length - slidesPerView) {
1784
+ swiper.loopFix();
1785
+ slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
1786
+ nextTick(() => {
1787
+ swiper.slideTo(slideToIndex);
1788
+ });
1789
+ } else {
1790
+ swiper.slideTo(slideToIndex);
1791
+ }
1792
+ } else {
1793
+ swiper.slideTo(slideToIndex);
1794
+ }
1795
+ }
1796
+
1797
+ var slide = {
1798
+ slideTo,
1799
+ slideToLoop,
1800
+ slideNext,
1801
+ slidePrev,
1802
+ slideReset,
1803
+ slideToClosest,
1804
+ slideToClickedSlide
1805
+ };
1806
+
1807
+ function loopCreate(slideRealIndex) {
1808
+ const swiper = this;
1809
+ const {
1810
+ params,
1811
+ slidesEl
1812
+ } = swiper;
1813
+ if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
1814
+ const initSlides = () => {
1815
+ const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
1816
+ slides.forEach((el, index) => {
1817
+ el.setAttribute('data-swiper-slide-index', index);
1818
+ });
1819
+ };
1820
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
1821
+ const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1);
1822
+ const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;
1823
+ const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;
1824
+ const addBlankSlides = amountOfSlides => {
1825
+ for (let i = 0; i < amountOfSlides; i += 1) {
1826
+ const slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]);
1827
+ swiper.slidesEl.append(slideEl);
1828
+ }
1829
+ };
1830
+ if (shouldFillGroup) {
1831
+ if (params.loopAddBlankSlides) {
1832
+ const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup;
1833
+ addBlankSlides(slidesToAdd);
1834
+ swiper.recalcSlides();
1835
+ swiper.updateSlides();
1836
+ } else {
1837
+ 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)');
1838
+ }
1839
+ initSlides();
1840
+ } else if (shouldFillGrid) {
1841
+ if (params.loopAddBlankSlides) {
1842
+ const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows;
1843
+ addBlankSlides(slidesToAdd);
1844
+ swiper.recalcSlides();
1845
+ swiper.updateSlides();
1846
+ } else {
1847
+ 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)');
1848
+ }
1849
+ initSlides();
1850
+ } else {
1851
+ initSlides();
1852
+ }
1853
+ swiper.loopFix({
1854
+ slideRealIndex,
1855
+ direction: params.centeredSlides ? undefined : 'next'
1856
+ });
1857
+ }
1858
+
1859
+ function loopFix(_temp) {
1860
+ let {
1861
+ slideRealIndex,
1862
+ slideTo = true,
1863
+ direction,
1864
+ setTranslate,
1865
+ activeSlideIndex,
1866
+ byController,
1867
+ byMousewheel
1868
+ } = _temp === void 0 ? {} : _temp;
1869
+ const swiper = this;
1870
+ if (!swiper.params.loop) return;
1871
+ swiper.emit('beforeLoopFix');
1872
+ const {
1873
+ slides,
1874
+ allowSlidePrev,
1875
+ allowSlideNext,
1876
+ slidesEl,
1877
+ params
1878
+ } = swiper;
1879
+ const {
1880
+ centeredSlides
1881
+ } = params;
1882
+ swiper.allowSlidePrev = true;
1883
+ swiper.allowSlideNext = true;
1884
+ if (swiper.virtual && params.virtual.enabled) {
1885
+ if (slideTo) {
1886
+ if (!params.centeredSlides && swiper.snapIndex === 0) {
1887
+ swiper.slideTo(swiper.virtual.slides.length, 0, false, true);
1888
+ } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) {
1889
+ swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true);
1890
+ } else if (swiper.snapIndex === swiper.snapGrid.length - 1) {
1891
+ swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true);
1892
+ }
1893
+ }
1894
+ swiper.allowSlidePrev = allowSlidePrev;
1895
+ swiper.allowSlideNext = allowSlideNext;
1896
+ swiper.emit('loopFix');
1897
+ return;
1898
+ }
1899
+ let slidesPerView = params.slidesPerView;
1900
+ if (slidesPerView === 'auto') {
1901
+ slidesPerView = swiper.slidesPerViewDynamic();
1902
+ } else {
1903
+ slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));
1904
+ if (centeredSlides && slidesPerView % 2 === 0) {
1905
+ slidesPerView = slidesPerView + 1;
1906
+ }
1907
+ }
1908
+ const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;
1909
+ let loopedSlides = slidesPerGroup;
1910
+ if (loopedSlides % slidesPerGroup !== 0) {
1911
+ loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
1912
+ }
1913
+ loopedSlides += params.loopAdditionalSlides;
1914
+ swiper.loopedSlides = loopedSlides;
1915
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
1916
+ if (slides.length < slidesPerView + loopedSlides) {
1917
+ 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');
1918
+ } else if (gridEnabled && params.grid.fill === 'row') {
1919
+ showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`');
1920
+ }
1921
+ const prependSlidesIndexes = [];
1922
+ const appendSlidesIndexes = [];
1923
+ let activeIndex = swiper.activeIndex;
1924
+ if (typeof activeSlideIndex === 'undefined') {
1925
+ activeSlideIndex = swiper.getSlideIndex(slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
1926
+ } else {
1927
+ activeIndex = activeSlideIndex;
1928
+ }
1929
+ const isNext = direction === 'next' || !direction;
1930
+ const isPrev = direction === 'prev' || !direction;
1931
+ let slidesPrepended = 0;
1932
+ let slidesAppended = 0;
1933
+ const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length;
1934
+ const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex;
1935
+ const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0);
1936
+ // prepend last slides before start
1937
+ if (activeColIndexWithShift < loopedSlides) {
1938
+ slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup);
1939
+ for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
1940
+ const index = i - Math.floor(i / cols) * cols;
1941
+ if (gridEnabled) {
1942
+ const colIndexToPrepend = cols - index - 1;
1943
+ for (let i = slides.length - 1; i >= 0; i -= 1) {
1944
+ if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i);
1945
+ }
1946
+ // slides.forEach((slide, slideIndex) => {
1947
+ // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex);
1948
+ // });
1949
+ } else {
1950
+ prependSlidesIndexes.push(cols - index - 1);
1951
+ }
1952
+ }
1953
+ } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) {
1954
+ slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup);
1955
+ for (let i = 0; i < slidesAppended; i += 1) {
1956
+ const index = i - Math.floor(i / cols) * cols;
1957
+ if (gridEnabled) {
1958
+ slides.forEach((slide, slideIndex) => {
1959
+ if (slide.column === index) appendSlidesIndexes.push(slideIndex);
1960
+ });
1961
+ } else {
1962
+ appendSlidesIndexes.push(index);
1963
+ }
1964
+ }
1965
+ }
1966
+ swiper.__preventObserver__ = true;
1967
+ requestAnimationFrame(() => {
1968
+ swiper.__preventObserver__ = false;
1969
+ });
1970
+ if (isPrev) {
1971
+ prependSlidesIndexes.forEach(index => {
1972
+ slides[index].swiperLoopMoveDOM = true;
1973
+ slidesEl.prepend(slides[index]);
1974
+ slides[index].swiperLoopMoveDOM = false;
1975
+ });
1976
+ }
1977
+ if (isNext) {
1978
+ appendSlidesIndexes.forEach(index => {
1979
+ slides[index].swiperLoopMoveDOM = true;
1980
+ slidesEl.append(slides[index]);
1981
+ slides[index].swiperLoopMoveDOM = false;
1982
+ });
1983
+ }
1984
+ swiper.recalcSlides();
1985
+ if (params.slidesPerView === 'auto') {
1986
+ swiper.updateSlides();
1987
+ } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) {
1988
+ swiper.slides.forEach((slide, slideIndex) => {
1989
+ swiper.grid.updateSlide(slideIndex, slide, swiper.slides);
1990
+ });
1991
+ }
1992
+ if (params.watchSlidesProgress) {
1993
+ swiper.updateSlidesOffset();
1994
+ }
1995
+ if (slideTo) {
1996
+ if (prependSlidesIndexes.length > 0 && isPrev) {
1997
+ if (typeof slideRealIndex === 'undefined') {
1998
+ const currentSlideTranslate = swiper.slidesGrid[activeIndex];
1999
+ const newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended];
2000
+ const diff = newSlideTranslate - currentSlideTranslate;
2001
+ if (byMousewheel) {
2002
+ swiper.setTranslate(swiper.translate - diff);
2003
+ } else {
2004
+ swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true);
2005
+ if (setTranslate) {
2006
+ swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
2007
+ swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
2008
+ }
2009
+ }
2010
+ } else {
2011
+ if (setTranslate) {
2012
+ const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length;
2013
+ swiper.slideTo(swiper.activeIndex + shift, 0, false, true);
2014
+ swiper.touchEventsData.currentTranslate = swiper.translate;
2015
+ }
2016
+ }
2017
+ } else if (appendSlidesIndexes.length > 0 && isNext) {
2018
+ if (typeof slideRealIndex === 'undefined') {
2019
+ const currentSlideTranslate = swiper.slidesGrid[activeIndex];
2020
+ const newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended];
2021
+ const diff = newSlideTranslate - currentSlideTranslate;
2022
+ if (byMousewheel) {
2023
+ swiper.setTranslate(swiper.translate - diff);
2024
+ } else {
2025
+ swiper.slideTo(activeIndex - slidesAppended, 0, false, true);
2026
+ if (setTranslate) {
2027
+ swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
2028
+ swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
2029
+ }
2030
+ }
2031
+ } else {
2032
+ const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length;
2033
+ swiper.slideTo(swiper.activeIndex - shift, 0, false, true);
2034
+ }
2035
+ }
2036
+ }
2037
+ swiper.allowSlidePrev = allowSlidePrev;
2038
+ swiper.allowSlideNext = allowSlideNext;
2039
+ if (swiper.controller && swiper.controller.control && !byController) {
2040
+ const loopParams = {
2041
+ slideRealIndex,
2042
+ direction,
2043
+ setTranslate,
2044
+ activeSlideIndex,
2045
+ byController: true
2046
+ };
2047
+ if (Array.isArray(swiper.controller.control)) {
2048
+ swiper.controller.control.forEach(c => {
2049
+ if (!c.destroyed && c.params.loop) c.loopFix({
2050
+ ...loopParams,
2051
+ slideTo: c.params.slidesPerView === params.slidesPerView ? slideTo : false
2052
+ });
2053
+ });
2054
+ } else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) {
2055
+ swiper.controller.control.loopFix({
2056
+ ...loopParams,
2057
+ slideTo: swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false
2058
+ });
2059
+ }
2060
+ }
2061
+ swiper.emit('loopFix');
2062
+ }
2063
+
2064
+ function loopDestroy() {
2065
+ const swiper = this;
2066
+ const {
2067
+ params,
2068
+ slidesEl
2069
+ } = swiper;
2070
+ if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
2071
+ swiper.recalcSlides();
2072
+ const newSlidesOrder = [];
2073
+ swiper.slides.forEach(slideEl => {
2074
+ const index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex;
2075
+ newSlidesOrder[index] = slideEl;
2076
+ });
2077
+ swiper.slides.forEach(slideEl => {
2078
+ slideEl.removeAttribute('data-swiper-slide-index');
2079
+ });
2080
+ newSlidesOrder.forEach(slideEl => {
2081
+ slidesEl.append(slideEl);
2082
+ });
2083
+ swiper.recalcSlides();
2084
+ swiper.slideTo(swiper.realIndex, 0);
2085
+ }
2086
+
2087
+ var loop = {
2088
+ loopCreate,
2089
+ loopFix,
2090
+ loopDestroy
2091
+ };
2092
+
2093
+ function setGrabCursor(moving) {
2094
+ const swiper = this;
2095
+ if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
2096
+ const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl;
2097
+ if (swiper.isElement) {
2098
+ swiper.__preventObserver__ = true;
2099
+ }
2100
+ el.style.cursor = 'move';
2101
+ el.style.cursor = moving ? 'grabbing' : 'grab';
2102
+ if (swiper.isElement) {
2103
+ requestAnimationFrame(() => {
2104
+ swiper.__preventObserver__ = false;
2105
+ });
2106
+ }
2107
+ }
2108
+
2109
+ function unsetGrabCursor() {
2110
+ const swiper = this;
2111
+ if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
2112
+ return;
2113
+ }
2114
+ if (swiper.isElement) {
2115
+ swiper.__preventObserver__ = true;
2116
+ }
2117
+ swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = '';
2118
+ if (swiper.isElement) {
2119
+ requestAnimationFrame(() => {
2120
+ swiper.__preventObserver__ = false;
2121
+ });
2122
+ }
2123
+ }
2124
+
2125
+ var grabCursor = {
2126
+ setGrabCursor,
2127
+ unsetGrabCursor
2128
+ };
2129
+
2130
+ // Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd
2131
+ function closestElement(selector, base) {
2132
+ if (base === void 0) {
2133
+ base = this;
2134
+ }
2135
+ function __closestFrom(el) {
2136
+ if (!el || el === getDocument() || el === getWindow()) return null;
2137
+ if (el.assignedSlot) el = el.assignedSlot;
2138
+ const found = el.closest(selector);
2139
+ if (!found && !el.getRootNode) {
2140
+ return null;
2141
+ }
2142
+ return found || __closestFrom(el.getRootNode().host);
2143
+ }
2144
+ return __closestFrom(base);
2145
+ }
2146
+ function preventEdgeSwipe(swiper, event, startX) {
2147
+ const window = getWindow();
2148
+ const {
2149
+ params
2150
+ } = swiper;
2151
+ const edgeSwipeDetection = params.edgeSwipeDetection;
2152
+ const edgeSwipeThreshold = params.edgeSwipeThreshold;
2153
+ if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
2154
+ if (edgeSwipeDetection === 'prevent') {
2155
+ event.preventDefault();
2156
+ return true;
2157
+ }
2158
+ return false;
2159
+ }
2160
+ return true;
2161
+ }
2162
+ function onTouchStart(event) {
2163
+ const swiper = this;
2164
+ const document = getDocument();
2165
+ let e = event;
2166
+ if (e.originalEvent) e = e.originalEvent;
2167
+ const data = swiper.touchEventsData;
2168
+ if (e.type === 'pointerdown') {
2169
+ if (data.pointerId !== null && data.pointerId !== e.pointerId) {
2170
+ return;
2171
+ }
2172
+ data.pointerId = e.pointerId;
2173
+ } else if (e.type === 'touchstart' && e.targetTouches.length === 1) {
2174
+ data.touchId = e.targetTouches[0].identifier;
2175
+ }
2176
+ if (e.type === 'touchstart') {
2177
+ // don't proceed touch event
2178
+ preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX);
2179
+ return;
2180
+ }
2181
+ const {
2182
+ params,
2183
+ touches,
2184
+ enabled
2185
+ } = swiper;
2186
+ if (!enabled) return;
2187
+ if (!params.simulateTouch && e.pointerType === 'mouse') return;
2188
+ if (swiper.animating && params.preventInteractionOnTransition) {
2189
+ return;
2190
+ }
2191
+ if (!swiper.animating && params.cssMode && params.loop) {
2192
+ swiper.loopFix();
2193
+ }
2194
+ let targetEl = e.target;
2195
+ if (params.touchEventsTarget === 'wrapper') {
2196
+ if (!elementIsChildOf(targetEl, swiper.wrapperEl)) return;
2197
+ }
2198
+ if ('which' in e && e.which === 3) return;
2199
+ if ('button' in e && e.button > 0) return;
2200
+ if (data.isTouched && data.isMoved) return;
2201
+
2202
+ // change target el for shadow root component
2203
+ const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
2204
+ // eslint-disable-next-line
2205
+ const eventPath = e.composedPath ? e.composedPath() : e.path;
2206
+ if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
2207
+ targetEl = eventPath[0];
2208
+ }
2209
+ const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`;
2210
+ const isTargetShadow = !!(e.target && e.target.shadowRoot);
2211
+
2212
+ // use closestElement for shadow root element to get the actual closest for nested shadow root element
2213
+ if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) {
2214
+ swiper.allowClick = true;
2215
+ return;
2216
+ }
2217
+ if (params.swipeHandler) {
2218
+ if (!targetEl.closest(params.swipeHandler)) return;
2219
+ }
2220
+ touches.currentX = e.pageX;
2221
+ touches.currentY = e.pageY;
2222
+ const startX = touches.currentX;
2223
+ const startY = touches.currentY;
2224
+
2225
+ // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
2226
+
2227
+ if (!preventEdgeSwipe(swiper, e, startX)) {
2228
+ return;
2229
+ }
2230
+ Object.assign(data, {
2231
+ isTouched: true,
2232
+ isMoved: false,
2233
+ allowTouchCallbacks: true,
2234
+ isScrolling: undefined,
2235
+ startMoving: undefined
2236
+ });
2237
+ touches.startX = startX;
2238
+ touches.startY = startY;
2239
+ data.touchStartTime = now();
2240
+ swiper.allowClick = true;
2241
+ swiper.updateSize();
2242
+ swiper.swipeDirection = undefined;
2243
+ if (params.threshold > 0) data.allowThresholdMove = false;
2244
+ let preventDefault = true;
2245
+ if (targetEl.matches(data.focusableElements)) {
2246
+ preventDefault = false;
2247
+ if (targetEl.nodeName === 'SELECT') {
2248
+ data.isTouched = false;
2249
+ }
2250
+ }
2251
+ if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl && (e.pointerType === 'mouse' || e.pointerType !== 'mouse' && !targetEl.matches(data.focusableElements))) {
2252
+ document.activeElement.blur();
2253
+ }
2254
+ const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
2255
+ if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) {
2256
+ e.preventDefault();
2257
+ }
2258
+ if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) {
2259
+ swiper.freeMode.onTouchStart();
2260
+ }
2261
+ swiper.emit('touchStart', e);
2262
+ }
2263
+
2264
+ function onTouchMove(event) {
2265
+ const document = getDocument();
2266
+ const swiper = this;
2267
+ const data = swiper.touchEventsData;
2268
+ const {
2269
+ params,
2270
+ touches,
2271
+ rtlTranslate: rtl,
2272
+ enabled
2273
+ } = swiper;
2274
+ if (!enabled) return;
2275
+ if (!params.simulateTouch && event.pointerType === 'mouse') return;
2276
+ let e = event;
2277
+ if (e.originalEvent) e = e.originalEvent;
2278
+ if (e.type === 'pointermove') {
2279
+ if (data.touchId !== null) return; // return from pointer if we use touch
2280
+ const id = e.pointerId;
2281
+ if (id !== data.pointerId) return;
2282
+ }
2283
+ let targetTouch;
2284
+ if (e.type === 'touchmove') {
2285
+ targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
2286
+ if (!targetTouch || targetTouch.identifier !== data.touchId) return;
2287
+ } else {
2288
+ targetTouch = e;
2289
+ }
2290
+ if (!data.isTouched) {
2291
+ if (data.startMoving && data.isScrolling) {
2292
+ swiper.emit('touchMoveOpposite', e);
2293
+ }
2294
+ return;
2295
+ }
2296
+ const pageX = targetTouch.pageX;
2297
+ const pageY = targetTouch.pageY;
2298
+ if (e.preventedByNestedSwiper) {
2299
+ touches.startX = pageX;
2300
+ touches.startY = pageY;
2301
+ return;
2302
+ }
2303
+ if (!swiper.allowTouchMove) {
2304
+ if (!e.target.matches(data.focusableElements)) {
2305
+ swiper.allowClick = false;
2306
+ }
2307
+ if (data.isTouched) {
2308
+ Object.assign(touches, {
2309
+ startX: pageX,
2310
+ startY: pageY,
2311
+ currentX: pageX,
2312
+ currentY: pageY
2313
+ });
2314
+ data.touchStartTime = now();
2315
+ }
2316
+ return;
2317
+ }
2318
+ if (params.touchReleaseOnEdges && !params.loop) {
2319
+ if (swiper.isVertical()) {
2320
+ // Vertical
2321
+ if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
2322
+ data.isTouched = false;
2323
+ data.isMoved = false;
2324
+ return;
2325
+ }
2326
+ } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
2327
+ return;
2328
+ }
2329
+ }
2330
+ if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== e.target && e.pointerType !== 'mouse') {
2331
+ document.activeElement.blur();
2332
+ }
2333
+ if (document.activeElement) {
2334
+ if (e.target === document.activeElement && e.target.matches(data.focusableElements)) {
2335
+ data.isMoved = true;
2336
+ swiper.allowClick = false;
2337
+ return;
2338
+ }
2339
+ }
2340
+ if (data.allowTouchCallbacks) {
2341
+ swiper.emit('touchMove', e);
2342
+ }
2343
+ touches.previousX = touches.currentX;
2344
+ touches.previousY = touches.currentY;
2345
+ touches.currentX = pageX;
2346
+ touches.currentY = pageY;
2347
+ const diffX = touches.currentX - touches.startX;
2348
+ const diffY = touches.currentY - touches.startY;
2349
+ if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return;
2350
+ if (typeof data.isScrolling === 'undefined') {
2351
+ let touchAngle;
2352
+ if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
2353
+ data.isScrolling = false;
2354
+ } else {
2355
+ // eslint-disable-next-line
2356
+ if (diffX * diffX + diffY * diffY >= 25) {
2357
+ touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
2358
+ data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
2359
+ }
2360
+ }
2361
+ }
2362
+ if (data.isScrolling) {
2363
+ swiper.emit('touchMoveOpposite', e);
2364
+ }
2365
+ if (typeof data.startMoving === 'undefined') {
2366
+ if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
2367
+ data.startMoving = true;
2368
+ }
2369
+ }
2370
+ if (data.isScrolling || e.type === 'touchmove' && data.preventTouchMoveFromPointerMove) {
2371
+ data.isTouched = false;
2372
+ return;
2373
+ }
2374
+ if (!data.startMoving) {
2375
+ return;
2376
+ }
2377
+ swiper.allowClick = false;
2378
+ if (!params.cssMode && e.cancelable) {
2379
+ e.preventDefault();
2380
+ }
2381
+ if (params.touchMoveStopPropagation && !params.nested) {
2382
+ e.stopPropagation();
2383
+ }
2384
+ let diff = swiper.isHorizontal() ? diffX : diffY;
2385
+ let touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY;
2386
+ if (params.oneWayMovement) {
2387
+ diff = Math.abs(diff) * (rtl ? 1 : -1);
2388
+ touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1);
2389
+ }
2390
+ touches.diff = diff;
2391
+ diff *= params.touchRatio;
2392
+ if (rtl) {
2393
+ diff = -diff;
2394
+ touchesDiff = -touchesDiff;
2395
+ }
2396
+ const prevTouchesDirection = swiper.touchesDirection;
2397
+ swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
2398
+ swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next';
2399
+ const isLoop = swiper.params.loop && !params.cssMode;
2400
+ const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev;
2401
+ if (!data.isMoved) {
2402
+ if (isLoop && allowLoopFix) {
2403
+ swiper.loopFix({
2404
+ direction: swiper.swipeDirection
2405
+ });
2406
+ }
2407
+ data.startTranslate = swiper.getTranslate();
2408
+ swiper.setTransition(0);
2409
+ if (swiper.animating) {
2410
+ const evt = new window.CustomEvent('transitionend', {
2411
+ bubbles: true,
2412
+ cancelable: true,
2413
+ detail: {
2414
+ bySwiperTouchMove: true
2415
+ }
2416
+ });
2417
+ swiper.wrapperEl.dispatchEvent(evt);
2418
+ }
2419
+ data.allowMomentumBounce = false;
2420
+ // Grab Cursor
2421
+ if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
2422
+ swiper.setGrabCursor(true);
2423
+ }
2424
+ swiper.emit('sliderFirstMove', e);
2425
+ }
2426
+ let loopFixed;
2427
+ new Date().getTime();
2428
+ if (data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
2429
+ Object.assign(touches, {
2430
+ startX: pageX,
2431
+ startY: pageY,
2432
+ currentX: pageX,
2433
+ currentY: pageY,
2434
+ startTranslate: data.currentTranslate
2435
+ });
2436
+ data.loopSwapReset = true;
2437
+ data.startTranslate = data.currentTranslate;
2438
+ return;
2439
+ }
2440
+ swiper.emit('sliderMove', e);
2441
+ data.isMoved = true;
2442
+ data.currentTranslate = diff + data.startTranslate;
2443
+ let disableParentSwiper = true;
2444
+ let resistanceRatio = params.resistanceRatio;
2445
+ if (params.touchReleaseOnEdges) {
2446
+ resistanceRatio = 0;
2447
+ }
2448
+ if (diff > 0) {
2449
+ if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] - (params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.activeIndex + 1] + swiper.params.spaceBetween : 0) - swiper.params.spaceBetween : swiper.minTranslate())) {
2450
+ swiper.loopFix({
2451
+ direction: 'prev',
2452
+ setTranslate: true,
2453
+ activeSlideIndex: 0
2454
+ });
2455
+ }
2456
+ if (data.currentTranslate > swiper.minTranslate()) {
2457
+ disableParentSwiper = false;
2458
+ if (params.resistance) {
2459
+ data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio;
2460
+ }
2461
+ }
2462
+ } else if (diff < 0) {
2463
+ if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween + (params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween : 0) : swiper.maxTranslate())) {
2464
+ swiper.loopFix({
2465
+ direction: 'next',
2466
+ setTranslate: true,
2467
+ activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10)))
2468
+ });
2469
+ }
2470
+ if (data.currentTranslate < swiper.maxTranslate()) {
2471
+ disableParentSwiper = false;
2472
+ if (params.resistance) {
2473
+ data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio;
2474
+ }
2475
+ }
2476
+ }
2477
+ if (disableParentSwiper) {
2478
+ e.preventedByNestedSwiper = true;
2479
+ }
2480
+
2481
+ // Directions locks
2482
+ if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
2483
+ data.currentTranslate = data.startTranslate;
2484
+ }
2485
+ if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
2486
+ data.currentTranslate = data.startTranslate;
2487
+ }
2488
+ if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {
2489
+ data.currentTranslate = data.startTranslate;
2490
+ }
2491
+
2492
+ // Threshold
2493
+ if (params.threshold > 0) {
2494
+ if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
2495
+ if (!data.allowThresholdMove) {
2496
+ data.allowThresholdMove = true;
2497
+ touches.startX = touches.currentX;
2498
+ touches.startY = touches.currentY;
2499
+ data.currentTranslate = data.startTranslate;
2500
+ touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
2501
+ return;
2502
+ }
2503
+ } else {
2504
+ data.currentTranslate = data.startTranslate;
2505
+ return;
2506
+ }
2507
+ }
2508
+ if (!params.followFinger || params.cssMode) return;
2509
+
2510
+ // Update active index in free mode
2511
+ if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) {
2512
+ swiper.updateActiveIndex();
2513
+ swiper.updateSlidesClasses();
2514
+ }
2515
+ if (params.freeMode && params.freeMode.enabled && swiper.freeMode) {
2516
+ swiper.freeMode.onTouchMove();
2517
+ }
2518
+ // Update progress
2519
+ swiper.updateProgress(data.currentTranslate);
2520
+ // Update translate
2521
+ swiper.setTranslate(data.currentTranslate);
2522
+ }
2523
+
2524
+ function onTouchEnd(event) {
2525
+ const swiper = this;
2526
+ const data = swiper.touchEventsData;
2527
+ let e = event;
2528
+ if (e.originalEvent) e = e.originalEvent;
2529
+ let targetTouch;
2530
+ const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel';
2531
+ if (!isTouchEvent) {
2532
+ if (data.touchId !== null) return; // return from pointer if we use touch
2533
+ if (e.pointerId !== data.pointerId) return;
2534
+ targetTouch = e;
2535
+ } else {
2536
+ targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
2537
+ if (!targetTouch || targetTouch.identifier !== data.touchId) return;
2538
+ }
2539
+ if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) {
2540
+ const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
2541
+ if (!proceed) {
2542
+ return;
2543
+ }
2544
+ }
2545
+ data.pointerId = null;
2546
+ data.touchId = null;
2547
+ const {
2548
+ params,
2549
+ touches,
2550
+ rtlTranslate: rtl,
2551
+ slidesGrid,
2552
+ enabled
2553
+ } = swiper;
2554
+ if (!enabled) return;
2555
+ if (!params.simulateTouch && e.pointerType === 'mouse') return;
2556
+ if (data.allowTouchCallbacks) {
2557
+ swiper.emit('touchEnd', e);
2558
+ }
2559
+ data.allowTouchCallbacks = false;
2560
+ if (!data.isTouched) {
2561
+ if (data.isMoved && params.grabCursor) {
2562
+ swiper.setGrabCursor(false);
2563
+ }
2564
+ data.isMoved = false;
2565
+ data.startMoving = false;
2566
+ return;
2567
+ }
2568
+
2569
+ // Return Grab Cursor
2570
+ if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
2571
+ swiper.setGrabCursor(false);
2572
+ }
2573
+
2574
+ // Time diff
2575
+ const touchEndTime = now();
2576
+ const timeDiff = touchEndTime - data.touchStartTime;
2577
+
2578
+ // Tap, doubleTap, Click
2579
+ if (swiper.allowClick) {
2580
+ const pathTree = e.path || e.composedPath && e.composedPath();
2581
+ swiper.updateClickedSlide(pathTree && pathTree[0] || e.target, pathTree);
2582
+ swiper.emit('tap click', e);
2583
+ if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
2584
+ swiper.emit('doubleTap doubleClick', e);
2585
+ }
2586
+ }
2587
+ data.lastClickTime = now();
2588
+ nextTick(() => {
2589
+ if (!swiper.destroyed) swiper.allowClick = true;
2590
+ });
2591
+ if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) {
2592
+ data.isTouched = false;
2593
+ data.isMoved = false;
2594
+ data.startMoving = false;
2595
+ return;
2596
+ }
2597
+ data.isTouched = false;
2598
+ data.isMoved = false;
2599
+ data.startMoving = false;
2600
+ let currentPos;
2601
+ if (params.followFinger) {
2602
+ currentPos = rtl ? swiper.translate : -swiper.translate;
2603
+ } else {
2604
+ currentPos = -data.currentTranslate;
2605
+ }
2606
+ if (params.cssMode) {
2607
+ return;
2608
+ }
2609
+ if (params.freeMode && params.freeMode.enabled) {
2610
+ swiper.freeMode.onTouchEnd({
2611
+ currentPos
2612
+ });
2613
+ return;
2614
+ }
2615
+
2616
+ // Find current slide
2617
+ const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop;
2618
+ let stopIndex = 0;
2619
+ let groupSize = swiper.slidesSizesGrid[0];
2620
+ for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
2621
+ const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
2622
+ if (typeof slidesGrid[i + increment] !== 'undefined') {
2623
+ if (swipeToLast || currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
2624
+ stopIndex = i;
2625
+ groupSize = slidesGrid[i + increment] - slidesGrid[i];
2626
+ }
2627
+ } else if (swipeToLast || currentPos >= slidesGrid[i]) {
2628
+ stopIndex = i;
2629
+ groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
2630
+ }
2631
+ }
2632
+ let rewindFirstIndex = null;
2633
+ let rewindLastIndex = null;
2634
+ if (params.rewind) {
2635
+ if (swiper.isBeginning) {
2636
+ rewindLastIndex = params.virtual && params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
2637
+ } else if (swiper.isEnd) {
2638
+ rewindFirstIndex = 0;
2639
+ }
2640
+ }
2641
+ // Find current slide size
2642
+ const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
2643
+ const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
2644
+ if (timeDiff > params.longSwipesMs) {
2645
+ // Long touches
2646
+ if (!params.longSwipes) {
2647
+ swiper.slideTo(swiper.activeIndex);
2648
+ return;
2649
+ }
2650
+ if (swiper.swipeDirection === 'next') {
2651
+ if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex);
2652
+ }
2653
+ if (swiper.swipeDirection === 'prev') {
2654
+ if (ratio > 1 - params.longSwipesRatio) {
2655
+ swiper.slideTo(stopIndex + increment);
2656
+ } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) {
2657
+ swiper.slideTo(rewindLastIndex);
2658
+ } else {
2659
+ swiper.slideTo(stopIndex);
2660
+ }
2661
+ }
2662
+ } else {
2663
+ // Short swipes
2664
+ if (!params.shortSwipes) {
2665
+ swiper.slideTo(swiper.activeIndex);
2666
+ return;
2667
+ }
2668
+ const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);
2669
+ if (!isNavButtonTarget) {
2670
+ if (swiper.swipeDirection === 'next') {
2671
+ swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment);
2672
+ }
2673
+ if (swiper.swipeDirection === 'prev') {
2674
+ swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex);
2675
+ }
2676
+ } else if (e.target === swiper.navigation.nextEl) {
2677
+ swiper.slideTo(stopIndex + increment);
2678
+ } else {
2679
+ swiper.slideTo(stopIndex);
2680
+ }
2681
+ }
2682
+ }
2683
+
2684
+ function onResize() {
2685
+ const swiper = this;
2686
+ const {
2687
+ params,
2688
+ el
2689
+ } = swiper;
2690
+ if (el && el.offsetWidth === 0) return;
2691
+
2692
+ // Breakpoints
2693
+ if (params.breakpoints) {
2694
+ swiper.setBreakpoint();
2695
+ }
2696
+
2697
+ // Save locks
2698
+ const {
2699
+ allowSlideNext,
2700
+ allowSlidePrev,
2701
+ snapGrid
2702
+ } = swiper;
2703
+ const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
2704
+
2705
+ // Disable locks on resize
2706
+ swiper.allowSlideNext = true;
2707
+ swiper.allowSlidePrev = true;
2708
+ swiper.updateSize();
2709
+ swiper.updateSlides();
2710
+ swiper.updateSlidesClasses();
2711
+ const isVirtualLoop = isVirtual && params.loop;
2712
+ if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) {
2713
+ swiper.slideTo(swiper.slides.length - 1, 0, false, true);
2714
+ } else {
2715
+ if (swiper.params.loop && !isVirtual) {
2716
+ swiper.slideToLoop(swiper.realIndex, 0, false, true);
2717
+ } else {
2718
+ swiper.slideTo(swiper.activeIndex, 0, false, true);
2719
+ }
2720
+ }
2721
+ if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
2722
+ clearTimeout(swiper.autoplay.resizeTimeout);
2723
+ swiper.autoplay.resizeTimeout = setTimeout(() => {
2724
+ if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
2725
+ swiper.autoplay.resume();
2726
+ }
2727
+ }, 500);
2728
+ }
2729
+ // Return locks after resize
2730
+ swiper.allowSlidePrev = allowSlidePrev;
2731
+ swiper.allowSlideNext = allowSlideNext;
2732
+ if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
2733
+ swiper.checkOverflow();
2734
+ }
2735
+ }
2736
+
2737
+ function onClick(e) {
2738
+ const swiper = this;
2739
+ if (!swiper.enabled) return;
2740
+ if (!swiper.allowClick) {
2741
+ if (swiper.params.preventClicks) e.preventDefault();
2742
+ if (swiper.params.preventClicksPropagation && swiper.animating) {
2743
+ e.stopPropagation();
2744
+ e.stopImmediatePropagation();
2745
+ }
2746
+ }
2747
+ }
2748
+
2749
+ function onScroll() {
2750
+ const swiper = this;
2751
+ const {
2752
+ wrapperEl,
2753
+ rtlTranslate,
2754
+ enabled
2755
+ } = swiper;
2756
+ if (!enabled) return;
2757
+ swiper.previousTranslate = swiper.translate;
2758
+ if (swiper.isHorizontal()) {
2759
+ swiper.translate = -wrapperEl.scrollLeft;
2760
+ } else {
2761
+ swiper.translate = -wrapperEl.scrollTop;
2762
+ }
2763
+ // eslint-disable-next-line
2764
+ if (swiper.translate === 0) swiper.translate = 0;
2765
+ swiper.updateActiveIndex();
2766
+ swiper.updateSlidesClasses();
2767
+ let newProgress;
2768
+ const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
2769
+ if (translatesDiff === 0) {
2770
+ newProgress = 0;
2771
+ } else {
2772
+ newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
2773
+ }
2774
+ if (newProgress !== swiper.progress) {
2775
+ swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
2776
+ }
2777
+ swiper.emit('setTranslate', swiper.translate, false);
2778
+ }
2779
+
2780
+ function onLoad(e) {
2781
+ const swiper = this;
2782
+ processLazyPreloader(swiper, e.target);
2783
+ if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) {
2784
+ return;
2785
+ }
2786
+ swiper.update();
2787
+ }
2788
+
2789
+ function onDocumentTouchStart() {
2790
+ const swiper = this;
2791
+ if (swiper.documentTouchHandlerProceeded) return;
2792
+ swiper.documentTouchHandlerProceeded = true;
2793
+ if (swiper.params.touchReleaseOnEdges) {
2794
+ swiper.el.style.touchAction = 'auto';
2795
+ }
2796
+ }
2797
+
2798
+ const events = (swiper, method) => {
2799
+ const document = getDocument();
2800
+ const {
2801
+ params,
2802
+ el,
2803
+ wrapperEl,
2804
+ device
2805
+ } = swiper;
2806
+ const capture = !!params.nested;
2807
+ const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
2808
+ const swiperMethod = method;
2809
+ if (!el || typeof el === 'string') return;
2810
+
2811
+ // Touch Events
2812
+ document[domMethod]('touchstart', swiper.onDocumentTouchStart, {
2813
+ passive: false,
2814
+ capture
2815
+ });
2816
+ el[domMethod]('touchstart', swiper.onTouchStart, {
2817
+ passive: false
2818
+ });
2819
+ el[domMethod]('pointerdown', swiper.onTouchStart, {
2820
+ passive: false
2821
+ });
2822
+ document[domMethod]('touchmove', swiper.onTouchMove, {
2823
+ passive: false,
2824
+ capture
2825
+ });
2826
+ document[domMethod]('pointermove', swiper.onTouchMove, {
2827
+ passive: false,
2828
+ capture
2829
+ });
2830
+ document[domMethod]('touchend', swiper.onTouchEnd, {
2831
+ passive: true
2832
+ });
2833
+ document[domMethod]('pointerup', swiper.onTouchEnd, {
2834
+ passive: true
2835
+ });
2836
+ document[domMethod]('pointercancel', swiper.onTouchEnd, {
2837
+ passive: true
2838
+ });
2839
+ document[domMethod]('touchcancel', swiper.onTouchEnd, {
2840
+ passive: true
2841
+ });
2842
+ document[domMethod]('pointerout', swiper.onTouchEnd, {
2843
+ passive: true
2844
+ });
2845
+ document[domMethod]('pointerleave', swiper.onTouchEnd, {
2846
+ passive: true
2847
+ });
2848
+ document[domMethod]('contextmenu', swiper.onTouchEnd, {
2849
+ passive: true
2850
+ });
2851
+
2852
+ // Prevent Links Clicks
2853
+ if (params.preventClicks || params.preventClicksPropagation) {
2854
+ el[domMethod]('click', swiper.onClick, true);
2855
+ }
2856
+ if (params.cssMode) {
2857
+ wrapperEl[domMethod]('scroll', swiper.onScroll);
2858
+ }
2859
+
2860
+ // Resize handler
2861
+ if (params.updateOnWindowResize) {
2862
+ swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);
2863
+ } else {
2864
+ swiper[swiperMethod]('observerUpdate', onResize, true);
2865
+ }
2866
+
2867
+ // Images loader
2868
+ el[domMethod]('load', swiper.onLoad, {
2869
+ capture: true
2870
+ });
2871
+ };
2872
+ function attachEvents() {
2873
+ const swiper = this;
2874
+ const {
2875
+ params
2876
+ } = swiper;
2877
+ swiper.onTouchStart = onTouchStart.bind(swiper);
2878
+ swiper.onTouchMove = onTouchMove.bind(swiper);
2879
+ swiper.onTouchEnd = onTouchEnd.bind(swiper);
2880
+ swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper);
2881
+ if (params.cssMode) {
2882
+ swiper.onScroll = onScroll.bind(swiper);
2883
+ }
2884
+ swiper.onClick = onClick.bind(swiper);
2885
+ swiper.onLoad = onLoad.bind(swiper);
2886
+ events(swiper, 'on');
2887
+ }
2888
+ function detachEvents() {
2889
+ const swiper = this;
2890
+ events(swiper, 'off');
2891
+ }
2892
+ var events$1 = {
2893
+ attachEvents,
2894
+ detachEvents
2895
+ };
2896
+
2897
+ const isGridEnabled = (swiper, params) => {
2898
+ return swiper.grid && params.grid && params.grid.rows > 1;
2899
+ };
2900
+ function setBreakpoint() {
2901
+ const swiper = this;
2902
+ const {
2903
+ realIndex,
2904
+ initialized,
2905
+ params,
2906
+ el
2907
+ } = swiper;
2908
+ const breakpoints = params.breakpoints;
2909
+ if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return;
2910
+
2911
+ // Get breakpoint for window width and update parameters
2912
+ const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);
2913
+ if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
2914
+ const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
2915
+ const breakpointParams = breakpointOnlyParams || swiper.originalParams;
2916
+ const wasMultiRow = isGridEnabled(swiper, params);
2917
+ const isMultiRow = isGridEnabled(swiper, breakpointParams);
2918
+ const wasGrabCursor = swiper.params.grabCursor;
2919
+ const isGrabCursor = breakpointParams.grabCursor;
2920
+ const wasEnabled = params.enabled;
2921
+ if (wasMultiRow && !isMultiRow) {
2922
+ el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);
2923
+ swiper.emitContainerClasses();
2924
+ } else if (!wasMultiRow && isMultiRow) {
2925
+ el.classList.add(`${params.containerModifierClass}grid`);
2926
+ if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {
2927
+ el.classList.add(`${params.containerModifierClass}grid-column`);
2928
+ }
2929
+ swiper.emitContainerClasses();
2930
+ }
2931
+ if (wasGrabCursor && !isGrabCursor) {
2932
+ swiper.unsetGrabCursor();
2933
+ } else if (!wasGrabCursor && isGrabCursor) {
2934
+ swiper.setGrabCursor();
2935
+ }
2936
+
2937
+ // Toggle navigation, pagination, scrollbar
2938
+ ['navigation', 'pagination', 'scrollbar'].forEach(prop => {
2939
+ if (typeof breakpointParams[prop] === 'undefined') return;
2940
+ const wasModuleEnabled = params[prop] && params[prop].enabled;
2941
+ const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled;
2942
+ if (wasModuleEnabled && !isModuleEnabled) {
2943
+ swiper[prop].disable();
2944
+ }
2945
+ if (!wasModuleEnabled && isModuleEnabled) {
2946
+ swiper[prop].enable();
2947
+ }
2948
+ });
2949
+ const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
2950
+ const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
2951
+ const wasLoop = params.loop;
2952
+ if (directionChanged && initialized) {
2953
+ swiper.changeDirection();
2954
+ }
2955
+ extend(swiper.params, breakpointParams);
2956
+ const isEnabled = swiper.params.enabled;
2957
+ const hasLoop = swiper.params.loop;
2958
+ Object.assign(swiper, {
2959
+ allowTouchMove: swiper.params.allowTouchMove,
2960
+ allowSlideNext: swiper.params.allowSlideNext,
2961
+ allowSlidePrev: swiper.params.allowSlidePrev
2962
+ });
2963
+ if (wasEnabled && !isEnabled) {
2964
+ swiper.disable();
2965
+ } else if (!wasEnabled && isEnabled) {
2966
+ swiper.enable();
2967
+ }
2968
+ swiper.currentBreakpoint = breakpoint;
2969
+ swiper.emit('_beforeBreakpoint', breakpointParams);
2970
+ if (initialized) {
2971
+ if (needsReLoop) {
2972
+ swiper.loopDestroy();
2973
+ swiper.loopCreate(realIndex);
2974
+ swiper.updateSlides();
2975
+ } else if (!wasLoop && hasLoop) {
2976
+ swiper.loopCreate(realIndex);
2977
+ swiper.updateSlides();
2978
+ } else if (wasLoop && !hasLoop) {
2979
+ swiper.loopDestroy();
2980
+ }
2981
+ }
2982
+ swiper.emit('breakpoint', breakpointParams);
2983
+ }
2984
+
2985
+ function getBreakpoint(breakpoints, base, containerEl) {
2986
+ if (base === void 0) {
2987
+ base = 'window';
2988
+ }
2989
+ if (!breakpoints || base === 'container' && !containerEl) return undefined;
2990
+ let breakpoint = false;
2991
+ const window = getWindow();
2992
+ const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;
2993
+ const points = Object.keys(breakpoints).map(point => {
2994
+ if (typeof point === 'string' && point.indexOf('@') === 0) {
2995
+ const minRatio = parseFloat(point.substr(1));
2996
+ const value = currentHeight * minRatio;
2997
+ return {
2998
+ value,
2999
+ point
3000
+ };
3001
+ }
3002
+ return {
3003
+ value: point,
3004
+ point
3005
+ };
3006
+ });
3007
+ points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10));
3008
+ for (let i = 0; i < points.length; i += 1) {
3009
+ const {
3010
+ point,
3011
+ value
3012
+ } = points[i];
3013
+ if (base === 'window') {
3014
+ if (window.matchMedia(`(min-width: ${value}px)`).matches) {
3015
+ breakpoint = point;
3016
+ }
3017
+ } else if (value <= containerEl.clientWidth) {
3018
+ breakpoint = point;
3019
+ }
3020
+ }
3021
+ return breakpoint || 'max';
3022
+ }
3023
+
3024
+ var breakpoints = {
3025
+ setBreakpoint,
3026
+ getBreakpoint
3027
+ };
3028
+
3029
+ function prepareClasses(entries, prefix) {
3030
+ const resultClasses = [];
3031
+ entries.forEach(item => {
3032
+ if (typeof item === 'object') {
3033
+ Object.keys(item).forEach(classNames => {
3034
+ if (item[classNames]) {
3035
+ resultClasses.push(prefix + classNames);
3036
+ }
3037
+ });
3038
+ } else if (typeof item === 'string') {
3039
+ resultClasses.push(prefix + item);
3040
+ }
3041
+ });
3042
+ return resultClasses;
3043
+ }
3044
+ function addClasses() {
3045
+ const swiper = this;
3046
+ const {
3047
+ classNames,
3048
+ params,
3049
+ rtl,
3050
+ el,
3051
+ device
3052
+ } = swiper;
3053
+ // prettier-ignore
3054
+ const suffixes = prepareClasses(['initialized', params.direction, {
3055
+ 'free-mode': swiper.params.freeMode && params.freeMode.enabled
3056
+ }, {
3057
+ 'autoheight': params.autoHeight
3058
+ }, {
3059
+ 'rtl': rtl
3060
+ }, {
3061
+ 'grid': params.grid && params.grid.rows > 1
3062
+ }, {
3063
+ 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column'
3064
+ }, {
3065
+ 'android': device.android
3066
+ }, {
3067
+ 'ios': device.ios
3068
+ }, {
3069
+ 'css-mode': params.cssMode
3070
+ }, {
3071
+ 'centered': params.cssMode && params.centeredSlides
3072
+ }, {
3073
+ 'watch-progress': params.watchSlidesProgress
3074
+ }], params.containerModifierClass);
3075
+ classNames.push(...suffixes);
3076
+ el.classList.add(...classNames);
3077
+ swiper.emitContainerClasses();
3078
+ }
3079
+
3080
+ function removeClasses() {
3081
+ const swiper = this;
3082
+ const {
3083
+ el,
3084
+ classNames
3085
+ } = swiper;
3086
+ if (!el || typeof el === 'string') return;
3087
+ el.classList.remove(...classNames);
3088
+ swiper.emitContainerClasses();
3089
+ }
3090
+
3091
+ var classes = {
3092
+ addClasses,
3093
+ removeClasses
3094
+ };
3095
+
3096
+ function checkOverflow() {
3097
+ const swiper = this;
3098
+ const {
3099
+ isLocked: wasLocked,
3100
+ params
3101
+ } = swiper;
3102
+ const {
3103
+ slidesOffsetBefore
3104
+ } = params;
3105
+ if (slidesOffsetBefore) {
3106
+ const lastSlideIndex = swiper.slides.length - 1;
3107
+ const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;
3108
+ swiper.isLocked = swiper.size > lastSlideRightEdge;
3109
+ } else {
3110
+ swiper.isLocked = swiper.snapGrid.length === 1;
3111
+ }
3112
+ if (params.allowSlideNext === true) {
3113
+ swiper.allowSlideNext = !swiper.isLocked;
3114
+ }
3115
+ if (params.allowSlidePrev === true) {
3116
+ swiper.allowSlidePrev = !swiper.isLocked;
3117
+ }
3118
+ if (wasLocked && wasLocked !== swiper.isLocked) {
3119
+ swiper.isEnd = false;
3120
+ }
3121
+ if (wasLocked !== swiper.isLocked) {
3122
+ swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
3123
+ }
3124
+ }
3125
+ var checkOverflow$1 = {
3126
+ checkOverflow
3127
+ };
3128
+
3129
+ var defaults = {
3130
+ init: true,
3131
+ direction: 'horizontal',
3132
+ oneWayMovement: false,
3133
+ swiperElementNodeName: 'SWIPER-CONTAINER',
3134
+ touchEventsTarget: 'wrapper',
3135
+ initialSlide: 0,
3136
+ speed: 300,
3137
+ cssMode: false,
3138
+ updateOnWindowResize: true,
3139
+ resizeObserver: true,
3140
+ nested: false,
3141
+ createElements: false,
3142
+ eventsPrefix: 'swiper',
3143
+ enabled: true,
3144
+ focusableElements: 'input, select, option, textarea, button, video, label',
3145
+ // Overrides
3146
+ width: null,
3147
+ height: null,
3148
+ //
3149
+ preventInteractionOnTransition: false,
3150
+ // ssr
3151
+ userAgent: null,
3152
+ url: null,
3153
+ // To support iOS's swipe-to-go-back gesture (when being used in-app).
3154
+ edgeSwipeDetection: false,
3155
+ edgeSwipeThreshold: 20,
3156
+ // Autoheight
3157
+ autoHeight: false,
3158
+ // Set wrapper width
3159
+ setWrapperSize: false,
3160
+ // Virtual Translate
3161
+ virtualTranslate: false,
3162
+ // Effects
3163
+ effect: 'slide',
3164
+ // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
3165
+
3166
+ // Breakpoints
3167
+ breakpoints: undefined,
3168
+ breakpointsBase: 'window',
3169
+ // Slides grid
3170
+ spaceBetween: 0,
3171
+ slidesPerView: 1,
3172
+ slidesPerGroup: 1,
3173
+ slidesPerGroupSkip: 0,
3174
+ slidesPerGroupAuto: false,
3175
+ centeredSlides: false,
3176
+ centeredSlidesBounds: false,
3177
+ slidesOffsetBefore: 0,
3178
+ // in px
3179
+ slidesOffsetAfter: 0,
3180
+ // in px
3181
+ normalizeSlideIndex: true,
3182
+ centerInsufficientSlides: false,
3183
+ // Disable swiper and hide navigation when container not overflow
3184
+ watchOverflow: true,
3185
+ // Round length
3186
+ roundLengths: false,
3187
+ // Touches
3188
+ touchRatio: 1,
3189
+ touchAngle: 45,
3190
+ simulateTouch: true,
3191
+ shortSwipes: true,
3192
+ longSwipes: true,
3193
+ longSwipesRatio: 0.5,
3194
+ longSwipesMs: 300,
3195
+ followFinger: true,
3196
+ allowTouchMove: true,
3197
+ threshold: 5,
3198
+ touchMoveStopPropagation: false,
3199
+ touchStartPreventDefault: true,
3200
+ touchStartForcePreventDefault: false,
3201
+ touchReleaseOnEdges: false,
3202
+ // Unique Navigation Elements
3203
+ uniqueNavElements: true,
3204
+ // Resistance
3205
+ resistance: true,
3206
+ resistanceRatio: 0.85,
3207
+ // Progress
3208
+ watchSlidesProgress: false,
3209
+ // Cursor
3210
+ grabCursor: false,
3211
+ // Clicks
3212
+ preventClicks: true,
3213
+ preventClicksPropagation: true,
3214
+ slideToClickedSlide: false,
3215
+ // loop
3216
+ loop: false,
3217
+ loopAddBlankSlides: true,
3218
+ loopAdditionalSlides: 0,
3219
+ loopPreventsSliding: true,
3220
+ // rewind
3221
+ rewind: false,
3222
+ // Swiping/no swiping
3223
+ allowSlidePrev: true,
3224
+ allowSlideNext: true,
3225
+ swipeHandler: null,
3226
+ // '.swipe-handler',
3227
+ noSwiping: true,
3228
+ noSwipingClass: 'swiper-no-swiping',
3229
+ noSwipingSelector: null,
3230
+ // Passive Listeners
3231
+ passiveListeners: true,
3232
+ maxBackfaceHiddenSlides: 10,
3233
+ // NS
3234
+ containerModifierClass: 'swiper-',
3235
+ // NEW
3236
+ slideClass: 'swiper-slide',
3237
+ slideBlankClass: 'swiper-slide-blank',
3238
+ slideActiveClass: 'swiper-slide-active',
3239
+ slideVisibleClass: 'swiper-slide-visible',
3240
+ slideFullyVisibleClass: 'swiper-slide-fully-visible',
3241
+ slideNextClass: 'swiper-slide-next',
3242
+ slidePrevClass: 'swiper-slide-prev',
3243
+ wrapperClass: 'swiper-wrapper',
3244
+ lazyPreloaderClass: 'swiper-lazy-preloader',
3245
+ lazyPreloadPrevNext: 0,
3246
+ // Callbacks
3247
+ runCallbacksOnInit: true,
3248
+ // Internals
3249
+ _emitClasses: false
3250
+ };
3251
+
3252
+ function moduleExtendParams(params, allModulesParams) {
3253
+ return function extendParams(obj) {
3254
+ if (obj === void 0) {
3255
+ obj = {};
3256
+ }
3257
+ const moduleParamName = Object.keys(obj)[0];
3258
+ const moduleParams = obj[moduleParamName];
3259
+ if (typeof moduleParams !== 'object' || moduleParams === null) {
3260
+ extend(allModulesParams, obj);
3261
+ return;
3262
+ }
3263
+ if (params[moduleParamName] === true) {
3264
+ params[moduleParamName] = {
3265
+ enabled: true
3266
+ };
3267
+ }
3268
+ if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) {
3269
+ params[moduleParamName].auto = true;
3270
+ }
3271
+ if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) {
3272
+ params[moduleParamName].auto = true;
3273
+ }
3274
+ if (!(moduleParamName in params && 'enabled' in moduleParams)) {
3275
+ extend(allModulesParams, obj);
3276
+ return;
3277
+ }
3278
+ if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
3279
+ params[moduleParamName].enabled = true;
3280
+ }
3281
+ if (!params[moduleParamName]) params[moduleParamName] = {
3282
+ enabled: false
3283
+ };
3284
+ extend(allModulesParams, obj);
3285
+ };
3286
+ }
3287
+
3288
+ /* eslint no-param-reassign: "off" */
3289
+ const prototypes = {
3290
+ eventsEmitter,
3291
+ update,
3292
+ translate,
3293
+ transition,
3294
+ slide,
3295
+ loop,
3296
+ grabCursor,
3297
+ events: events$1,
3298
+ breakpoints,
3299
+ checkOverflow: checkOverflow$1,
3300
+ classes
3301
+ };
3302
+ const extendedDefaults = {};
3303
+ class Swiper {
3304
+ constructor() {
3305
+ let el;
3306
+ let params;
3307
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3308
+ args[_key] = arguments[_key];
3309
+ }
3310
+ if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {
3311
+ params = args[0];
3312
+ } else {
3313
+ [el, params] = args;
3314
+ }
3315
+ if (!params) params = {};
3316
+ params = extend({}, params);
3317
+ if (el && !params.el) params.el = el;
3318
+ const document = getDocument();
3319
+ if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) {
3320
+ const swipers = [];
3321
+ document.querySelectorAll(params.el).forEach(containerEl => {
3322
+ const newParams = extend({}, params, {
3323
+ el: containerEl
3324
+ });
3325
+ swipers.push(new Swiper(newParams));
3326
+ });
3327
+ // eslint-disable-next-line no-constructor-return
3328
+ return swipers;
3329
+ }
3330
+
3331
+ // Swiper Instance
3332
+ const swiper = this;
3333
+ swiper.__swiper__ = true;
3334
+ swiper.support = getSupport();
3335
+ swiper.device = getDevice({
3336
+ userAgent: params.userAgent
3337
+ });
3338
+ swiper.browser = getBrowser();
3339
+ swiper.eventsListeners = {};
3340
+ swiper.eventsAnyListeners = [];
3341
+ swiper.modules = [...swiper.__modules__];
3342
+ if (params.modules && Array.isArray(params.modules)) {
3343
+ swiper.modules.push(...params.modules);
3344
+ }
3345
+ const allModulesParams = {};
3346
+ swiper.modules.forEach(mod => {
3347
+ mod({
3348
+ params,
3349
+ swiper,
3350
+ extendParams: moduleExtendParams(params, allModulesParams),
3351
+ on: swiper.on.bind(swiper),
3352
+ once: swiper.once.bind(swiper),
3353
+ off: swiper.off.bind(swiper),
3354
+ emit: swiper.emit.bind(swiper)
3355
+ });
3356
+ });
3357
+
3358
+ // Extend defaults with modules params
3359
+ const swiperParams = extend({}, defaults, allModulesParams);
3360
+
3361
+ // Extend defaults with passed params
3362
+ swiper.params = extend({}, swiperParams, extendedDefaults, params);
3363
+ swiper.originalParams = extend({}, swiper.params);
3364
+ swiper.passedParams = extend({}, params);
3365
+
3366
+ // add event listeners
3367
+ if (swiper.params && swiper.params.on) {
3368
+ Object.keys(swiper.params.on).forEach(eventName => {
3369
+ swiper.on(eventName, swiper.params.on[eventName]);
3370
+ });
3371
+ }
3372
+ if (swiper.params && swiper.params.onAny) {
3373
+ swiper.onAny(swiper.params.onAny);
3374
+ }
3375
+
3376
+ // Extend Swiper
3377
+ Object.assign(swiper, {
3378
+ enabled: swiper.params.enabled,
3379
+ el,
3380
+ // Classes
3381
+ classNames: [],
3382
+ // Slides
3383
+ slides: [],
3384
+ slidesGrid: [],
3385
+ snapGrid: [],
3386
+ slidesSizesGrid: [],
3387
+ // isDirection
3388
+ isHorizontal() {
3389
+ return swiper.params.direction === 'horizontal';
3390
+ },
3391
+ isVertical() {
3392
+ return swiper.params.direction === 'vertical';
3393
+ },
3394
+ // Indexes
3395
+ activeIndex: 0,
3396
+ realIndex: 0,
3397
+ //
3398
+ isBeginning: true,
3399
+ isEnd: false,
3400
+ // Props
3401
+ translate: 0,
3402
+ previousTranslate: 0,
3403
+ progress: 0,
3404
+ velocity: 0,
3405
+ animating: false,
3406
+ cssOverflowAdjustment() {
3407
+ // Returns 0 unless `translate` is > 2**23
3408
+ // Should be subtracted from css values to prevent overflow
3409
+ return Math.trunc(this.translate / 2 ** 23) * 2 ** 23;
3410
+ },
3411
+ // Locks
3412
+ allowSlideNext: swiper.params.allowSlideNext,
3413
+ allowSlidePrev: swiper.params.allowSlidePrev,
3414
+ // Touch Events
3415
+ touchEventsData: {
3416
+ isTouched: undefined,
3417
+ isMoved: undefined,
3418
+ allowTouchCallbacks: undefined,
3419
+ touchStartTime: undefined,
3420
+ isScrolling: undefined,
3421
+ currentTranslate: undefined,
3422
+ startTranslate: undefined,
3423
+ allowThresholdMove: undefined,
3424
+ // Form elements to match
3425
+ focusableElements: swiper.params.focusableElements,
3426
+ // Last click time
3427
+ lastClickTime: 0,
3428
+ clickTimeout: undefined,
3429
+ // Velocities
3430
+ velocities: [],
3431
+ allowMomentumBounce: undefined,
3432
+ startMoving: undefined,
3433
+ pointerId: null,
3434
+ touchId: null
3435
+ },
3436
+ // Clicks
3437
+ allowClick: true,
3438
+ // Touches
3439
+ allowTouchMove: swiper.params.allowTouchMove,
3440
+ touches: {
3441
+ startX: 0,
3442
+ startY: 0,
3443
+ currentX: 0,
3444
+ currentY: 0,
3445
+ diff: 0
3446
+ },
3447
+ // Images
3448
+ imagesToLoad: [],
3449
+ imagesLoaded: 0
3450
+ });
3451
+ swiper.emit('_swiper');
3452
+
3453
+ // Init
3454
+ if (swiper.params.init) {
3455
+ swiper.init();
3456
+ }
3457
+
3458
+ // Return app instance
3459
+ // eslint-disable-next-line no-constructor-return
3460
+ return swiper;
3461
+ }
3462
+ getDirectionLabel(property) {
3463
+ if (this.isHorizontal()) {
3464
+ return property;
3465
+ }
3466
+ // prettier-ignore
3467
+ return {
3468
+ 'width': 'height',
3469
+ 'margin-top': 'margin-left',
3470
+ 'margin-bottom ': 'margin-right',
3471
+ 'margin-left': 'margin-top',
3472
+ 'margin-right': 'margin-bottom',
3473
+ 'padding-left': 'padding-top',
3474
+ 'padding-right': 'padding-bottom',
3475
+ 'marginRight': 'marginBottom'
3476
+ }[property];
3477
+ }
3478
+ getSlideIndex(slideEl) {
3479
+ const {
3480
+ slidesEl,
3481
+ params
3482
+ } = this;
3483
+ const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
3484
+ const firstSlideIndex = elementIndex(slides[0]);
3485
+ return elementIndex(slideEl) - firstSlideIndex;
3486
+ }
3487
+ getSlideIndexByData(index) {
3488
+ return this.getSlideIndex(this.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index)[0]);
3489
+ }
3490
+ recalcSlides() {
3491
+ const swiper = this;
3492
+ const {
3493
+ slidesEl,
3494
+ params
3495
+ } = swiper;
3496
+ swiper.slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
3497
+ }
3498
+ enable() {
3499
+ const swiper = this;
3500
+ if (swiper.enabled) return;
3501
+ swiper.enabled = true;
3502
+ if (swiper.params.grabCursor) {
3503
+ swiper.setGrabCursor();
3504
+ }
3505
+ swiper.emit('enable');
3506
+ }
3507
+ disable() {
3508
+ const swiper = this;
3509
+ if (!swiper.enabled) return;
3510
+ swiper.enabled = false;
3511
+ if (swiper.params.grabCursor) {
3512
+ swiper.unsetGrabCursor();
3513
+ }
3514
+ swiper.emit('disable');
3515
+ }
3516
+ setProgress(progress, speed) {
3517
+ const swiper = this;
3518
+ progress = Math.min(Math.max(progress, 0), 1);
3519
+ const min = swiper.minTranslate();
3520
+ const max = swiper.maxTranslate();
3521
+ const current = (max - min) * progress + min;
3522
+ swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);
3523
+ swiper.updateActiveIndex();
3524
+ swiper.updateSlidesClasses();
3525
+ }
3526
+ emitContainerClasses() {
3527
+ const swiper = this;
3528
+ if (!swiper.params._emitClasses || !swiper.el) return;
3529
+ const cls = swiper.el.className.split(' ').filter(className => {
3530
+ return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;
3531
+ });
3532
+ swiper.emit('_containerClasses', cls.join(' '));
3533
+ }
3534
+ getSlideClasses(slideEl) {
3535
+ const swiper = this;
3536
+ if (swiper.destroyed) return '';
3537
+ return slideEl.className.split(' ').filter(className => {
3538
+ return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;
3539
+ }).join(' ');
3540
+ }
3541
+ emitSlidesClasses() {
3542
+ const swiper = this;
3543
+ if (!swiper.params._emitClasses || !swiper.el) return;
3544
+ const updates = [];
3545
+ swiper.slides.forEach(slideEl => {
3546
+ const classNames = swiper.getSlideClasses(slideEl);
3547
+ updates.push({
3548
+ slideEl,
3549
+ classNames
3550
+ });
3551
+ swiper.emit('_slideClass', slideEl, classNames);
3552
+ });
3553
+ swiper.emit('_slideClasses', updates);
3554
+ }
3555
+ slidesPerViewDynamic(view, exact) {
3556
+ if (view === void 0) {
3557
+ view = 'current';
3558
+ }
3559
+ if (exact === void 0) {
3560
+ exact = false;
3561
+ }
3562
+ const swiper = this;
3563
+ const {
3564
+ params,
3565
+ slides,
3566
+ slidesGrid,
3567
+ slidesSizesGrid,
3568
+ size: swiperSize,
3569
+ activeIndex
3570
+ } = swiper;
3571
+ let spv = 1;
3572
+ if (typeof params.slidesPerView === 'number') return params.slidesPerView;
3573
+ if (params.centeredSlides) {
3574
+ let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0;
3575
+ let breakLoop;
3576
+ for (let i = activeIndex + 1; i < slides.length; i += 1) {
3577
+ if (slides[i] && !breakLoop) {
3578
+ slideSize += Math.ceil(slides[i].swiperSlideSize);
3579
+ spv += 1;
3580
+ if (slideSize > swiperSize) breakLoop = true;
3581
+ }
3582
+ }
3583
+ for (let i = activeIndex - 1; i >= 0; i -= 1) {
3584
+ if (slides[i] && !breakLoop) {
3585
+ slideSize += slides[i].swiperSlideSize;
3586
+ spv += 1;
3587
+ if (slideSize > swiperSize) breakLoop = true;
3588
+ }
3589
+ }
3590
+ } else {
3591
+ // eslint-disable-next-line
3592
+ if (view === 'current') {
3593
+ for (let i = activeIndex + 1; i < slides.length; i += 1) {
3594
+ const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize;
3595
+ if (slideInView) {
3596
+ spv += 1;
3597
+ }
3598
+ }
3599
+ } else {
3600
+ // previous
3601
+ for (let i = activeIndex - 1; i >= 0; i -= 1) {
3602
+ const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize;
3603
+ if (slideInView) {
3604
+ spv += 1;
3605
+ }
3606
+ }
3607
+ }
3608
+ }
3609
+ return spv;
3610
+ }
3611
+ update() {
3612
+ const swiper = this;
3613
+ if (!swiper || swiper.destroyed) return;
3614
+ const {
3615
+ snapGrid,
3616
+ params
3617
+ } = swiper;
3618
+ // Breakpoints
3619
+ if (params.breakpoints) {
3620
+ swiper.setBreakpoint();
3621
+ }
3622
+ [...swiper.el.querySelectorAll('[loading="lazy"]')].forEach(imageEl => {
3623
+ if (imageEl.complete) {
3624
+ processLazyPreloader(swiper, imageEl);
3625
+ }
3626
+ });
3627
+ swiper.updateSize();
3628
+ swiper.updateSlides();
3629
+ swiper.updateProgress();
3630
+ swiper.updateSlidesClasses();
3631
+ function setTranslate() {
3632
+ const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
3633
+ const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
3634
+ swiper.setTranslate(newTranslate);
3635
+ swiper.updateActiveIndex();
3636
+ swiper.updateSlidesClasses();
3637
+ }
3638
+ let translated;
3639
+ if (params.freeMode && params.freeMode.enabled && !params.cssMode) {
3640
+ setTranslate();
3641
+ if (params.autoHeight) {
3642
+ swiper.updateAutoHeight();
3643
+ }
3644
+ } else {
3645
+ if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) {
3646
+ const slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides;
3647
+ translated = swiper.slideTo(slides.length - 1, 0, false, true);
3648
+ } else {
3649
+ translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
3650
+ }
3651
+ if (!translated) {
3652
+ setTranslate();
3653
+ }
3654
+ }
3655
+ if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
3656
+ swiper.checkOverflow();
3657
+ }
3658
+ swiper.emit('update');
3659
+ }
3660
+ changeDirection(newDirection, needUpdate) {
3661
+ if (needUpdate === void 0) {
3662
+ needUpdate = true;
3663
+ }
3664
+ const swiper = this;
3665
+ const currentDirection = swiper.params.direction;
3666
+ if (!newDirection) {
3667
+ // eslint-disable-next-line
3668
+ newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
3669
+ }
3670
+ if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
3671
+ return swiper;
3672
+ }
3673
+ swiper.el.classList.remove(`${swiper.params.containerModifierClass}${currentDirection}`);
3674
+ swiper.el.classList.add(`${swiper.params.containerModifierClass}${newDirection}`);
3675
+ swiper.emitContainerClasses();
3676
+ swiper.params.direction = newDirection;
3677
+ swiper.slides.forEach(slideEl => {
3678
+ if (newDirection === 'vertical') {
3679
+ slideEl.style.width = '';
3680
+ } else {
3681
+ slideEl.style.height = '';
3682
+ }
3683
+ });
3684
+ swiper.emit('changeDirection');
3685
+ if (needUpdate) swiper.update();
3686
+ return swiper;
3687
+ }
3688
+ changeLanguageDirection(direction) {
3689
+ const swiper = this;
3690
+ if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return;
3691
+ swiper.rtl = direction === 'rtl';
3692
+ swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl;
3693
+ if (swiper.rtl) {
3694
+ swiper.el.classList.add(`${swiper.params.containerModifierClass}rtl`);
3695
+ swiper.el.dir = 'rtl';
3696
+ } else {
3697
+ swiper.el.classList.remove(`${swiper.params.containerModifierClass}rtl`);
3698
+ swiper.el.dir = 'ltr';
3699
+ }
3700
+ swiper.update();
3701
+ }
3702
+ mount(element) {
3703
+ const swiper = this;
3704
+ if (swiper.mounted) return true;
3705
+
3706
+ // Find el
3707
+ let el = element || swiper.params.el;
3708
+ if (typeof el === 'string') {
3709
+ el = document.querySelector(el);
3710
+ }
3711
+ if (!el) {
3712
+ return false;
3713
+ }
3714
+ el.swiper = swiper;
3715
+ if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) {
3716
+ swiper.isElement = true;
3717
+ }
3718
+ const getWrapperSelector = () => {
3719
+ return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`;
3720
+ };
3721
+ const getWrapper = () => {
3722
+ if (el && el.shadowRoot && el.shadowRoot.querySelector) {
3723
+ const res = el.shadowRoot.querySelector(getWrapperSelector());
3724
+ // Children needs to return slot items
3725
+ return res;
3726
+ }
3727
+ return elementChildren(el, getWrapperSelector())[0];
3728
+ };
3729
+ // Find Wrapper
3730
+ let wrapperEl = getWrapper();
3731
+ if (!wrapperEl && swiper.params.createElements) {
3732
+ wrapperEl = createElement('div', swiper.params.wrapperClass);
3733
+ el.append(wrapperEl);
3734
+ elementChildren(el, `.${swiper.params.slideClass}`).forEach(slideEl => {
3735
+ wrapperEl.append(slideEl);
3736
+ });
3737
+ }
3738
+ Object.assign(swiper, {
3739
+ el,
3740
+ wrapperEl,
3741
+ slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl,
3742
+ hostEl: swiper.isElement ? el.parentNode.host : el,
3743
+ mounted: true,
3744
+ // RTL
3745
+ rtl: el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl',
3746
+ rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl'),
3747
+ wrongRTL: elementStyle(wrapperEl, 'display') === '-webkit-box'
3748
+ });
3749
+ return true;
3750
+ }
3751
+ init(el) {
3752
+ const swiper = this;
3753
+ if (swiper.initialized) return swiper;
3754
+ const mounted = swiper.mount(el);
3755
+ if (mounted === false) return swiper;
3756
+ swiper.emit('beforeInit');
3757
+
3758
+ // Set breakpoint
3759
+ if (swiper.params.breakpoints) {
3760
+ swiper.setBreakpoint();
3761
+ }
3762
+
3763
+ // Add Classes
3764
+ swiper.addClasses();
3765
+
3766
+ // Update size
3767
+ swiper.updateSize();
3768
+
3769
+ // Update slides
3770
+ swiper.updateSlides();
3771
+ if (swiper.params.watchOverflow) {
3772
+ swiper.checkOverflow();
3773
+ }
3774
+
3775
+ // Set Grab Cursor
3776
+ if (swiper.params.grabCursor && swiper.enabled) {
3777
+ swiper.setGrabCursor();
3778
+ }
3779
+
3780
+ // Slide To Initial Slide
3781
+ if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
3782
+ swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true);
3783
+ } else {
3784
+ swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
3785
+ }
3786
+
3787
+ // Create loop
3788
+ if (swiper.params.loop) {
3789
+ swiper.loopCreate();
3790
+ }
3791
+
3792
+ // Attach events
3793
+ swiper.attachEvents();
3794
+ const lazyElements = [...swiper.el.querySelectorAll('[loading="lazy"]')];
3795
+ if (swiper.isElement) {
3796
+ lazyElements.push(...swiper.hostEl.querySelectorAll('[loading="lazy"]'));
3797
+ }
3798
+ lazyElements.forEach(imageEl => {
3799
+ if (imageEl.complete) {
3800
+ processLazyPreloader(swiper, imageEl);
3801
+ } else {
3802
+ imageEl.addEventListener('load', e => {
3803
+ processLazyPreloader(swiper, e.target);
3804
+ });
3805
+ }
3806
+ });
3807
+ preload(swiper);
3808
+
3809
+ // Init Flag
3810
+ swiper.initialized = true;
3811
+ preload(swiper);
3812
+
3813
+ // Emit
3814
+ swiper.emit('init');
3815
+ swiper.emit('afterInit');
3816
+ return swiper;
3817
+ }
3818
+ destroy(deleteInstance, cleanStyles) {
3819
+ if (deleteInstance === void 0) {
3820
+ deleteInstance = true;
3821
+ }
3822
+ if (cleanStyles === void 0) {
3823
+ cleanStyles = true;
3824
+ }
3825
+ const swiper = this;
3826
+ const {
3827
+ params,
3828
+ el,
3829
+ wrapperEl,
3830
+ slides
3831
+ } = swiper;
3832
+ if (typeof swiper.params === 'undefined' || swiper.destroyed) {
3833
+ return null;
3834
+ }
3835
+ swiper.emit('beforeDestroy');
3836
+
3837
+ // Init Flag
3838
+ swiper.initialized = false;
3839
+
3840
+ // Detach events
3841
+ swiper.detachEvents();
3842
+
3843
+ // Destroy loop
3844
+ if (params.loop) {
3845
+ swiper.loopDestroy();
3846
+ }
3847
+
3848
+ // Cleanup styles
3849
+ if (cleanStyles) {
3850
+ swiper.removeClasses();
3851
+ if (el && typeof el !== 'string') {
3852
+ el.removeAttribute('style');
3853
+ }
3854
+ if (wrapperEl) {
3855
+ wrapperEl.removeAttribute('style');
3856
+ }
3857
+ if (slides && slides.length) {
3858
+ slides.forEach(slideEl => {
3859
+ slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
3860
+ slideEl.removeAttribute('style');
3861
+ slideEl.removeAttribute('data-swiper-slide-index');
3862
+ });
3863
+ }
3864
+ }
3865
+ swiper.emit('destroy');
3866
+
3867
+ // Detach emitter events
3868
+ Object.keys(swiper.eventsListeners).forEach(eventName => {
3869
+ swiper.off(eventName);
3870
+ });
3871
+ if (deleteInstance !== false) {
3872
+ if (swiper.el && typeof swiper.el !== 'string') {
3873
+ swiper.el.swiper = null;
3874
+ }
3875
+ deleteProps(swiper);
3876
+ }
3877
+ swiper.destroyed = true;
3878
+ return null;
3879
+ }
3880
+ static extendDefaults(newDefaults) {
3881
+ extend(extendedDefaults, newDefaults);
3882
+ }
3883
+ static get extendedDefaults() {
3884
+ return extendedDefaults;
3885
+ }
3886
+ static get defaults() {
3887
+ return defaults;
3888
+ }
3889
+ static installModule(mod) {
3890
+ if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = [];
3891
+ const modules = Swiper.prototype.__modules__;
3892
+ if (typeof mod === 'function' && modules.indexOf(mod) < 0) {
3893
+ modules.push(mod);
3894
+ }
3895
+ }
3896
+ static use(module) {
3897
+ if (Array.isArray(module)) {
3898
+ module.forEach(m => Swiper.installModule(m));
3899
+ return Swiper;
3900
+ }
3901
+ Swiper.installModule(module);
3902
+ return Swiper;
3903
+ }
3904
+ }
3905
+ Object.keys(prototypes).forEach(prototypeGroup => {
3906
+ Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => {
3907
+ Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
3908
+ });
3909
+ });
3910
+ Swiper.use([Resize, Observer]);
3911
+
3912
+ export { Swiper as S, defaults as d };