@itcenteratunihelsinki/huds-lib 0.8.41 → 0.8.43

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