@influence-society-web/deshotelsetdesiles 4.1.3

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.
@@ -0,0 +1,3651 @@
1
+ "use strict";
2
+ (() => {
3
+ // src/utils/constants.ts
4
+ var prefix = "data";
5
+ var SELECTORS = {
6
+ startingPriceList: `[${prefix}=starting-price-list]`,
7
+ price: `[${prefix}=price]`,
8
+ discount: `[${prefix}=discount]`,
9
+ discountContainer: `[${prefix}=discount-container]`,
10
+ currency: `[${prefix}=currency]`,
11
+ beHid: `[${prefix}-be-hid]`,
12
+ destination: `[${prefix}=destination]`,
13
+ offersList: `[${prefix}=offers-list]`,
14
+ /** Offer slug page: wrapper with existing main offer. Match both data="..." and data-... for Webflow. */
15
+ offerSlugDetail: `[${prefix}=offer-slug-detail], [data-offer-slug-detail]`,
16
+ /** Offer slug page: "Nos autres offres" list container. */
17
+ offerSlugOthersList: `[${prefix}=offer-slug-others-list], [data-offer-slug-others-list]`,
18
+ /** Offer slug page: card template inside offer-slug-others-list (use .offer-others_item if no data-list-item). */
19
+ offerSlugOthersListItem: ".offer-others_item",
20
+ /** Offer slug page: "Nos autres offres" section wrapper. Shown when other offers are rendered. */
21
+ offersMoreWrapper: `[${prefix}=offers-more-wrapper]`,
22
+ offersListContainer: `[${prefix}=offers-list-container]`,
23
+ listItem: `[${prefix}=list-item]`,
24
+ image: `[${prefix}=image]`,
25
+ name: `[${prefix}=name]`,
26
+ description: `[${prefix}=description]`,
27
+ hotelName: `[${prefix}=hotel-name]`,
28
+ hotelLink: `[${prefix}=hotel-link]`,
29
+ hotelStartingPriceContainer: `[${prefix}=hotel-starting-price-container]`,
30
+ moreDetails: `[${prefix}=more-details]`,
31
+ offersPopup: `[${prefix}=offers-popup]`,
32
+ offersPopupClose: `[${prefix}=close-btn]`,
33
+ hotelReserveLink: `[${prefix}=hotel-reserve-link]`,
34
+ hotelVillaReserveLink: `[${prefix}=hotel-villa-reserve-link]`,
35
+ hotelURLS: `[${prefix}=hotel-urls]`,
36
+ languageDropdown: `[${prefix}=language-dropdown]`,
37
+ selectedLanguage: `[${prefix}=selected-language]`,
38
+ loadingSpinner: `[${prefix}=loading-spinner]`,
39
+ cmsFilterEmptyState: `[fs-cmsfilter-element=empty]`,
40
+ startingfromItem: (id) => `[${prefix}-be-hid=${id}]`,
41
+ popupOverlay: `[fs-smartlightbox-element=trigger-close]`
42
+ };
43
+ var BE_HID_TO_SNIPPET_CODE = {
44
+ DHDICBeach: "gpgos12767",
45
+ DHDIJMalanga: "gptro12772",
46
+ DHDIToubana: "gpsai12770",
47
+ DHDIMahogany: "gpgos12769",
48
+ DHDILangleyres: "gpgua27143",
49
+ DHDIJungle: "mqros18592",
50
+ DHDIJade: "agste21689",
51
+ DHDIWINDLAND: "zzzzz25376",
52
+ DHDILeCapMaison: "lcgro30400",
53
+ DHDIChastenet: "agste21688",
54
+ DHDILPSoleil: "mqsai18593",
55
+ DHDISHANTI: "zzzzz25378",
56
+ DHDIPavillon: "zzzzz25377",
57
+ DHDIBELLEMARE: "zzzzz25379",
58
+ DHDIPrincemaurice: "mupos25678",
59
+ DHDIANAHITA: "zzzzz25380",
60
+ DHDISamana: "agstm21687",
61
+ FRANTHTLGrandCaseBe1: "frsai31536",
62
+ DHDITInn: "ageng20433",
63
+ DHDIBWaters: "agcro20496",
64
+ DHDICuisinartgolf: "gpang25884",
65
+ DMDESHTLSecretBayDom: "dmtib00001"
66
+ };
67
+ var GUADELOUPE = {
68
+ en: "Guadeloupe Islands",
69
+ fr: "Les \xCEles de Guadeloupe",
70
+ es: "Las islas de Guadalupe",
71
+ it: "Le isole della Guadalupa"
72
+ };
73
+ var DOMINIQUE = {
74
+ en: "La Dominique",
75
+ fr: "La Dominique",
76
+ es: "Dominica",
77
+ it: "Dominica"
78
+ };
79
+ var SAINT_LUCIE = {
80
+ en: "Saint Lucia",
81
+ fr: "Sainte-Lucie",
82
+ es: "Santa Luc\xEDa",
83
+ it: "Santa Lucia"
84
+ };
85
+ var MARTINIQUE = {
86
+ en: "Martinique",
87
+ fr: "Martinique",
88
+ es: "Martinica",
89
+ it: "Martinica"
90
+ };
91
+ var ILE_MAURICE = {
92
+ en: "Mauritius",
93
+ fr: "\xCEle Maurice",
94
+ es: "Mauricio",
95
+ it: "Mauritius"
96
+ };
97
+ var SAINT_MARTIN = {
98
+ en: "Saint Martin",
99
+ fr: "Saint-Martin",
100
+ es: "Saint-Martin",
101
+ it: "Saint Martin"
102
+ };
103
+ var ANTIGUA = {
104
+ en: "Antigua",
105
+ fr: "Antigua",
106
+ es: "Antigua",
107
+ it: "Antigua"
108
+ };
109
+ var ANGUILLA = {
110
+ en: "Anguilla",
111
+ fr: "Anguilla",
112
+ es: "Anguila",
113
+ it: "Anguilla"
114
+ };
115
+ var SNIPPET_CODE_TO_HOTEL = {
116
+ gpgos12767: {
117
+ destination: GUADELOUPE,
118
+ slug: "/hotels-et-villas/creole-beach-hotel-spa",
119
+ codeIPlanet: "FRAN414",
120
+ cmsId: "67c809b5f63deab8a71cf8e9"
121
+ },
122
+ gptro12772: {
123
+ destination: GUADELOUPE,
124
+ slug: "/hotels-et-villas/le-jardin-malanga",
125
+ codeIPlanet: "FRAN416",
126
+ cmsId: "67c809b5f63deab8a71cf90d"
127
+ },
128
+ gpsai12770: {
129
+ destination: GUADELOUPE,
130
+ slug: "/hotels-et-villas/la-toubana-hotel-spa",
131
+ codeIPlanet: "FRAN411",
132
+ cmsId: "67c809b5f63deab8a71cf8ef"
133
+ },
134
+ gpgos12769: {
135
+ destination: GUADELOUPE,
136
+ slug: "/hotels-et-villas/mahogany-hotel-residence-spa",
137
+ codeIPlanet: "FRAN423",
138
+ cmsId: "67c809b5f63deab8a71cf91f"
139
+ },
140
+ gpgua27143: {
141
+ destination: GUADELOUPE,
142
+ slug: "/hotels-et-villas/langley-resort-fort-royal",
143
+ codeIPlanet: "GPAN32",
144
+ cmsId: "67c809b5f63deab8a71cf8f0"
145
+ },
146
+ mqros18592: {
147
+ destination: DOMINIQUE,
148
+ slug: "/hotels-et-villas/jungle-bay-dominica",
149
+ codeIPlanet: "DMAN1",
150
+ cmsId: "67c809b5f63deab8a71cf8ed"
151
+ },
152
+ dmtib00001: {
153
+ destination: DOMINIQUE,
154
+ slug: "/hotels-et-villas/secret-bay-dominique",
155
+ codeIPlanet: "DMAN2",
156
+ cmsId: "67c809b5f63deab8a71cfefd"
157
+ },
158
+ agste21689: {
159
+ destination: SAINT_LUCIE,
160
+ slug: "/hotels-et-villas/jade-mountain",
161
+ codeIPlanet: "AGAN6",
162
+ cmsId: "67c809b5f63deab8a71cf92a"
163
+ },
164
+ zzzzz25376: {
165
+ destination: SAINT_LUCIE,
166
+ slug: "/hotels-et-villas/windjammer-landing",
167
+ codeIPlanet: "LCAN4",
168
+ cmsId: "67c809b5f63deab8a71cf92b"
169
+ },
170
+ lcgro30400: {
171
+ destination: SAINT_LUCIE,
172
+ slug: "/hotels-et-villas/cap-maison",
173
+ codeIPlanet: "LCLC8",
174
+ cmsId: "67c809b5f63deab8a71cf929"
175
+ },
176
+ agste21688: {
177
+ destination: SAINT_LUCIE,
178
+ slug: "/hotels-et-villas/anse-chastanet",
179
+ codeIPlanet: "AGAN5",
180
+ cmsId: "67c809b5f63deab8a71cf928"
181
+ },
182
+ mqsai18593: {
183
+ destination: MARTINIQUE,
184
+ slug: "/hotels-et-villas/plein-soleil",
185
+ codeIPlanet: "MQAN16",
186
+ cmsId: "67c809b5f63deab8a71cf925"
187
+ },
188
+ zzzzz25378: {
189
+ destination: ILE_MAURICE,
190
+ slug: "/hotels-et-villas/shanti-maurice",
191
+ codeIPlanet: "MUAN22",
192
+ cmsId: "67c809b5f63deab8a71cf933"
193
+ },
194
+ zzzzz25377: {
195
+ destination: ILE_MAURICE,
196
+ slug: "/hotels-et-villas/lux-le-morne",
197
+ codeIPlanet: "MUAN21",
198
+ cmsId: "67c809b5f63deab8a71cf931"
199
+ },
200
+ zzzzz25379: {
201
+ destination: ILE_MAURICE,
202
+ slug: "/hotels-et-villas/constance-belle-mare-plage",
203
+ codeIPlanet: "MUAN20",
204
+ cmsId: "67c809b5f63deab8a71cf92f"
205
+ },
206
+ mupos25678: {
207
+ destination: ILE_MAURICE,
208
+ slug: "/hotels-et-villas/constance-le-prince-maurice",
209
+ codeIPlanet: "MUAN24",
210
+ cmsId: "67c809b5f63deab8a71cf930"
211
+ },
212
+ zzzzz25380: {
213
+ destination: ILE_MAURICE,
214
+ slug: "/hotels-et-villas/anahita-the-resort",
215
+ codeIPlanet: "MUAN19",
216
+ cmsId: "67c809b5f63deab8a71cf92e"
217
+ },
218
+ agstm21687: {
219
+ destination: SAINT_MARTIN,
220
+ slug: "/hotels-et-villas/la-samanna",
221
+ codeIPlanet: "FRAN2350",
222
+ cmsId: "67c809b5f63deab8a71cf926"
223
+ },
224
+ frsai31536: {
225
+ destination: SAINT_MARTIN,
226
+ slug: "/hotels-et-villas/le-grand-case-beach-club",
227
+ codeIPlanet: "FRFRA3",
228
+ cmsId: "67c809b5f63deab8a71cf927"
229
+ },
230
+ ageng20433: {
231
+ destination: ANTIGUA,
232
+ slug: "/hotels-et-villas/the-inn-at-english-harbour",
233
+ codeIPlanet: "AGAN4",
234
+ cmsId: "67c809b5f63deab8a71cf8ec"
235
+ },
236
+ agcro20496: {
237
+ destination: ANTIGUA,
238
+ slug: "/hotels-et-villas/blue-waters",
239
+ codeIPlanet: "AGAN1",
240
+ cmsId: "67c809b5f63deab8a71cf8eb"
241
+ },
242
+ gpang25884: {
243
+ destination: ANGUILLA,
244
+ slug: "/hotels-et-villas/aurora-anguilla-resort-golf-club",
245
+ codeIPlanet: "GPAN30",
246
+ cmsId: "67c809b5f63deab8a71cf8ea"
247
+ }
248
+ };
249
+ var CURRENCY_TO_SYMBOL = {
250
+ AED: "\u062F.\u0625.",
251
+ AFN: "Af",
252
+ ALL: "L",
253
+ AMD: "\u058F",
254
+ ANG: "\u0192",
255
+ AOA: "Kz",
256
+ ARS: "AR$",
257
+ AUD: "AU$",
258
+ AWG: "\u0192",
259
+ AZN: "\u043C\u0430\u043D",
260
+ BAM: "KM",
261
+ BBD: "BBD$",
262
+ BDT: "\u09F3",
263
+ BGN: "\u043B\u0432.",
264
+ BHD: "BD",
265
+ BIF: "FBu",
266
+ BMD: "$",
267
+ BND: "B$",
268
+ BOB: "Bs.",
269
+ BRL: "R$",
270
+ BSD: "$",
271
+ BTN: "Nu.",
272
+ BWP: "P",
273
+ BYN: "Br",
274
+ BZD: "BZ$",
275
+ CAD: "CA$",
276
+ CDF: "FC",
277
+ CHF: "Fr.",
278
+ CKD: "$",
279
+ CLP: "CL$",
280
+ CNY: "CN\xA5",
281
+ COP: "CO$",
282
+ CRC: "\u20A1",
283
+ CUC: "CUC$",
284
+ CUP: "$MN",
285
+ CVE: "CV$",
286
+ CZK: "K\u010D",
287
+ DJF: "Fdj",
288
+ DKK: "kr.",
289
+ DOP: "RD$",
290
+ DZD: "DA",
291
+ EGP: "E\xA3",
292
+ EHP: "Ptas.",
293
+ ERN: "Nkf",
294
+ ETB: "Br",
295
+ EUR: "\u20AC",
296
+ FJD: "FJ$",
297
+ FKP: "FK\xA3",
298
+ FOK: "kr",
299
+ GBP: "\xA3",
300
+ GEL: "\u20BE",
301
+ GGP: "\xA3",
302
+ GHS: "GH\u20B5",
303
+ GIP: "\xA3",
304
+ GMD: "D",
305
+ GNF: "FG",
306
+ GTQ: "Q",
307
+ GYD: "G$",
308
+ HKD: "HK$",
309
+ HNL: "L",
310
+ HRK: "kn",
311
+ HTG: "G",
312
+ HUF: "Ft",
313
+ IDR: "Rp",
314
+ ILS: "\u20AA",
315
+ IMP: "\xA3",
316
+ INR: "Rs.",
317
+ IQD: "\u062F.\u0639.",
318
+ IRR: "\uFDFC",
319
+ ISK: "kr",
320
+ JEP: "\xA3",
321
+ JMD: "J$",
322
+ JOD: "JD",
323
+ JPY: "\xA5",
324
+ KES: "KSh",
325
+ KGS: "\u0441",
326
+ KHR: "\u17DB",
327
+ KID: "$",
328
+ KMF: "CF",
329
+ KPW: "\u20A9",
330
+ KRW: "\u20A9",
331
+ KWD: "KD",
332
+ KYD: "CI$",
333
+ KZT: "\u20B8",
334
+ LAK: "\u20ADN",
335
+ LBP: "LL.",
336
+ LKR: "Rs.",
337
+ LRD: "L$",
338
+ LSL: "L",
339
+ LYD: "LD",
340
+ MAD: "DH",
341
+ MDL: "L",
342
+ MGA: "Ar",
343
+ MKD: "den",
344
+ MMK: "Ks",
345
+ MNT: "\u20AE",
346
+ MOP: "MOP$",
347
+ MRU: "UM",
348
+ MUR: "Rs.",
349
+ MVR: "MRf",
350
+ MWK: "MK",
351
+ MXN: "MX$",
352
+ MYR: "RM",
353
+ MZN: "MTn",
354
+ NAD: "N$",
355
+ NGN: "\u20A6",
356
+ NIO: "C$",
357
+ NOK: "kr",
358
+ NPR: "Rs.",
359
+ NZD: "NZ$",
360
+ OMR: "OR",
361
+ PAB: "B/.",
362
+ PEN: "S/.",
363
+ PGK: "K",
364
+ PHP: "\u20B1",
365
+ PKR: "Rs.",
366
+ PLN: "z\u0142",
367
+ PND: "$",
368
+ PRB: "\u0440.",
369
+ PYG: "\u20B2",
370
+ QAR: "QR",
371
+ RON: "L",
372
+ RSD: "din",
373
+ RUB: "\u20BD",
374
+ RWF: "FRw",
375
+ SAR: "SR",
376
+ SBD: "SI$",
377
+ SCR: "Rs.",
378
+ SDG: "\xA3SD",
379
+ SEK: "kr",
380
+ SGD: "S$",
381
+ SHP: "\xA3",
382
+ SLL: "Le",
383
+ SLS: "Sl",
384
+ SOS: "Sh.So.",
385
+ SRD: "Sr$",
386
+ SSP: "SS\xA3",
387
+ STN: "Db",
388
+ SVC: "\u20A1",
389
+ SYP: "LS",
390
+ SZL: "L",
391
+ THB: "\u0E3F",
392
+ TJS: "SM",
393
+ TMT: "m.",
394
+ TND: "DT",
395
+ TOP: "T$",
396
+ TRY: "TL",
397
+ TTD: "TT$",
398
+ TVD: "$",
399
+ TWD: "NT$",
400
+ TZS: "TSh",
401
+ UAH: "\u20B4",
402
+ UGX: "USh",
403
+ USD: "$",
404
+ UYU: "$U",
405
+ UZS: "\u0441\u0443\u043C",
406
+ VED: "Bs.",
407
+ VES: "Bs.F",
408
+ VND: "\u20AB",
409
+ VUV: "VT",
410
+ WST: "T",
411
+ XAF: "Fr",
412
+ XCD: "$",
413
+ XOF: "\u20A3",
414
+ XPF: "\u20A3",
415
+ YER: "YR",
416
+ ZAR: "R",
417
+ ZMW: "ZK",
418
+ ZWB: "",
419
+ ZWL: "Z$",
420
+ Abkhazia: "",
421
+ Artsakh: "\u0564\u0580."
422
+ };
423
+ var LANG_TO_LOCALE = {
424
+ it: "it_IT",
425
+ es: "es_ES",
426
+ fr: "fr_FR",
427
+ en: "en_GB"
428
+ };
429
+ var apiBaseUrl = "https://deshotelsetdesiles.ccordier.workers.dev/v2/";
430
+ var hotelAndFlightURLBaseUrl = "https://deshotelsetdesiles.i-planet.fr/dhdi-public/searchform.cgi";
431
+ var DEFAULT_COUNTRY_CODE = "FR";
432
+ var GTM_GL = "1*q1lzz9*_gcl_au*MTMyMzcyMDY5NC4xNzM5Mjg5MzYx*_ga*NTAxMzI1MzMwLjE3MzkyODkzNjE.*_ga_Q0RXHLR7D4*MTczOTI5NzEzNC4zLjAuMTczOTI5NzE3Mi4yMi4wLjA.";
433
+
434
+ // ../../node_modules/.pnpm/@splidejs+splide@4.1.4/node_modules/@splidejs/splide/dist/js/splide.esm.js
435
+ function _defineProperties(target, props) {
436
+ for (var i = 0; i < props.length; i++) {
437
+ var descriptor = props[i];
438
+ descriptor.enumerable = descriptor.enumerable || false;
439
+ descriptor.configurable = true;
440
+ if ("value" in descriptor)
441
+ descriptor.writable = true;
442
+ Object.defineProperty(target, descriptor.key, descriptor);
443
+ }
444
+ }
445
+ function _createClass(Constructor, protoProps, staticProps) {
446
+ if (protoProps)
447
+ _defineProperties(Constructor.prototype, protoProps);
448
+ if (staticProps)
449
+ _defineProperties(Constructor, staticProps);
450
+ Object.defineProperty(Constructor, "prototype", { writable: false });
451
+ return Constructor;
452
+ }
453
+ var MEDIA_PREFERS_REDUCED_MOTION = "(prefers-reduced-motion: reduce)";
454
+ var CREATED = 1;
455
+ var MOUNTED = 2;
456
+ var IDLE = 3;
457
+ var MOVING = 4;
458
+ var SCROLLING = 5;
459
+ var DRAGGING = 6;
460
+ var DESTROYED = 7;
461
+ var STATES = {
462
+ CREATED,
463
+ MOUNTED,
464
+ IDLE,
465
+ MOVING,
466
+ SCROLLING,
467
+ DRAGGING,
468
+ DESTROYED
469
+ };
470
+ function empty(array) {
471
+ array.length = 0;
472
+ }
473
+ function slice(arrayLike, start, end) {
474
+ return Array.prototype.slice.call(arrayLike, start, end);
475
+ }
476
+ function apply(func) {
477
+ return func.bind.apply(func, [null].concat(slice(arguments, 1)));
478
+ }
479
+ var nextTick = setTimeout;
480
+ var noop = function noop2() {
481
+ };
482
+ function raf(func) {
483
+ return requestAnimationFrame(func);
484
+ }
485
+ function typeOf(type, subject) {
486
+ return typeof subject === type;
487
+ }
488
+ function isObject(subject) {
489
+ return !isNull(subject) && typeOf("object", subject);
490
+ }
491
+ var isArray = Array.isArray;
492
+ var isFunction = apply(typeOf, "function");
493
+ var isString = apply(typeOf, "string");
494
+ var isUndefined = apply(typeOf, "undefined");
495
+ function isNull(subject) {
496
+ return subject === null;
497
+ }
498
+ function isHTMLElement(subject) {
499
+ try {
500
+ return subject instanceof (subject.ownerDocument.defaultView || window).HTMLElement;
501
+ } catch (e) {
502
+ return false;
503
+ }
504
+ }
505
+ function toArray(value) {
506
+ return isArray(value) ? value : [value];
507
+ }
508
+ function forEach(values, iteratee) {
509
+ toArray(values).forEach(iteratee);
510
+ }
511
+ function includes(array, value) {
512
+ return array.indexOf(value) > -1;
513
+ }
514
+ function push(array, items) {
515
+ array.push.apply(array, toArray(items));
516
+ return array;
517
+ }
518
+ function toggleClass(elm, classes, add) {
519
+ if (elm) {
520
+ forEach(classes, function(name) {
521
+ if (name) {
522
+ elm.classList[add ? "add" : "remove"](name);
523
+ }
524
+ });
525
+ }
526
+ }
527
+ function addClass(elm, classes) {
528
+ toggleClass(elm, isString(classes) ? classes.split(" ") : classes, true);
529
+ }
530
+ function append(parent, children2) {
531
+ forEach(children2, parent.appendChild.bind(parent));
532
+ }
533
+ function before(nodes, ref) {
534
+ forEach(nodes, function(node) {
535
+ var parent = (ref || node).parentNode;
536
+ if (parent) {
537
+ parent.insertBefore(node, ref);
538
+ }
539
+ });
540
+ }
541
+ function matches(elm, selector) {
542
+ return isHTMLElement(elm) && (elm["msMatchesSelector"] || elm.matches).call(elm, selector);
543
+ }
544
+ function children(parent, selector) {
545
+ var children2 = parent ? slice(parent.children) : [];
546
+ return selector ? children2.filter(function(child2) {
547
+ return matches(child2, selector);
548
+ }) : children2;
549
+ }
550
+ function child(parent, selector) {
551
+ return selector ? children(parent, selector)[0] : parent.firstElementChild;
552
+ }
553
+ var ownKeys = Object.keys;
554
+ function forOwn(object, iteratee, right) {
555
+ if (object) {
556
+ (right ? ownKeys(object).reverse() : ownKeys(object)).forEach(function(key) {
557
+ key !== "__proto__" && iteratee(object[key], key);
558
+ });
559
+ }
560
+ return object;
561
+ }
562
+ function assign(object) {
563
+ slice(arguments, 1).forEach(function(source) {
564
+ forOwn(source, function(value, key) {
565
+ object[key] = source[key];
566
+ });
567
+ });
568
+ return object;
569
+ }
570
+ function merge(object) {
571
+ slice(arguments, 1).forEach(function(source) {
572
+ forOwn(source, function(value, key) {
573
+ if (isArray(value)) {
574
+ object[key] = value.slice();
575
+ } else if (isObject(value)) {
576
+ object[key] = merge({}, isObject(object[key]) ? object[key] : {}, value);
577
+ } else {
578
+ object[key] = value;
579
+ }
580
+ });
581
+ });
582
+ return object;
583
+ }
584
+ function omit(object, keys) {
585
+ forEach(keys || ownKeys(object), function(key) {
586
+ delete object[key];
587
+ });
588
+ }
589
+ function removeAttribute(elms, attrs) {
590
+ forEach(elms, function(elm) {
591
+ forEach(attrs, function(attr) {
592
+ elm && elm.removeAttribute(attr);
593
+ });
594
+ });
595
+ }
596
+ function setAttribute(elms, attrs, value) {
597
+ if (isObject(attrs)) {
598
+ forOwn(attrs, function(value2, name) {
599
+ setAttribute(elms, name, value2);
600
+ });
601
+ } else {
602
+ forEach(elms, function(elm) {
603
+ isNull(value) || value === "" ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value));
604
+ });
605
+ }
606
+ }
607
+ function create(tag, attrs, parent) {
608
+ var elm = document.createElement(tag);
609
+ if (attrs) {
610
+ isString(attrs) ? addClass(elm, attrs) : setAttribute(elm, attrs);
611
+ }
612
+ parent && append(parent, elm);
613
+ return elm;
614
+ }
615
+ function style(elm, prop, value) {
616
+ if (isUndefined(value)) {
617
+ return getComputedStyle(elm)[prop];
618
+ }
619
+ if (!isNull(value)) {
620
+ elm.style[prop] = "" + value;
621
+ }
622
+ }
623
+ function display(elm, display2) {
624
+ style(elm, "display", display2);
625
+ }
626
+ function focus(elm) {
627
+ elm["setActive"] && elm["setActive"]() || elm.focus({
628
+ preventScroll: true
629
+ });
630
+ }
631
+ function getAttribute(elm, attr) {
632
+ return elm.getAttribute(attr);
633
+ }
634
+ function hasClass(elm, className) {
635
+ return elm && elm.classList.contains(className);
636
+ }
637
+ function rect(target) {
638
+ return target.getBoundingClientRect();
639
+ }
640
+ function remove(nodes) {
641
+ forEach(nodes, function(node) {
642
+ if (node && node.parentNode) {
643
+ node.parentNode.removeChild(node);
644
+ }
645
+ });
646
+ }
647
+ function parseHtml(html) {
648
+ return child(new DOMParser().parseFromString(html, "text/html").body);
649
+ }
650
+ function prevent(e, stopPropagation) {
651
+ e.preventDefault();
652
+ if (stopPropagation) {
653
+ e.stopPropagation();
654
+ e.stopImmediatePropagation();
655
+ }
656
+ }
657
+ function query(parent, selector) {
658
+ return parent && parent.querySelector(selector);
659
+ }
660
+ function queryAll(parent, selector) {
661
+ return selector ? slice(parent.querySelectorAll(selector)) : [];
662
+ }
663
+ function removeClass(elm, classes) {
664
+ toggleClass(elm, classes, false);
665
+ }
666
+ function timeOf(e) {
667
+ return e.timeStamp;
668
+ }
669
+ function unit(value) {
670
+ return isString(value) ? value : value ? value + "px" : "";
671
+ }
672
+ var PROJECT_CODE = "splide";
673
+ var DATA_ATTRIBUTE = "data-" + PROJECT_CODE;
674
+ function assert(condition, message) {
675
+ if (!condition) {
676
+ throw new Error("[" + PROJECT_CODE + "] " + (message || ""));
677
+ }
678
+ }
679
+ var min = Math.min;
680
+ var max = Math.max;
681
+ var floor = Math.floor;
682
+ var ceil = Math.ceil;
683
+ var abs = Math.abs;
684
+ function approximatelyEqual(x, y, epsilon) {
685
+ return abs(x - y) < epsilon;
686
+ }
687
+ function between(number, x, y, exclusive) {
688
+ var minimum = min(x, y);
689
+ var maximum = max(x, y);
690
+ return exclusive ? minimum < number && number < maximum : minimum <= number && number <= maximum;
691
+ }
692
+ function clamp(number, x, y) {
693
+ var minimum = min(x, y);
694
+ var maximum = max(x, y);
695
+ return min(max(minimum, number), maximum);
696
+ }
697
+ function sign(x) {
698
+ return +(x > 0) - +(x < 0);
699
+ }
700
+ function format(string, replacements) {
701
+ forEach(replacements, function(replacement) {
702
+ string = string.replace("%s", "" + replacement);
703
+ });
704
+ return string;
705
+ }
706
+ function pad(number) {
707
+ return number < 10 ? "0" + number : "" + number;
708
+ }
709
+ var ids = {};
710
+ function uniqueId(prefix2) {
711
+ return "" + prefix2 + pad(ids[prefix2] = (ids[prefix2] || 0) + 1);
712
+ }
713
+ function EventBinder() {
714
+ var listeners = [];
715
+ function bind(targets, events, callback, options) {
716
+ forEachEvent(targets, events, function(target, event, namespace) {
717
+ var isEventTarget = "addEventListener" in target;
718
+ var remover = isEventTarget ? target.removeEventListener.bind(target, event, callback, options) : target["removeListener"].bind(target, callback);
719
+ isEventTarget ? target.addEventListener(event, callback, options) : target["addListener"](callback);
720
+ listeners.push([target, event, namespace, callback, remover]);
721
+ });
722
+ }
723
+ function unbind(targets, events, callback) {
724
+ forEachEvent(targets, events, function(target, event, namespace) {
725
+ listeners = listeners.filter(function(listener) {
726
+ if (listener[0] === target && listener[1] === event && listener[2] === namespace && (!callback || listener[3] === callback)) {
727
+ listener[4]();
728
+ return false;
729
+ }
730
+ return true;
731
+ });
732
+ });
733
+ }
734
+ function dispatch(target, type, detail) {
735
+ var e;
736
+ var bubbles = true;
737
+ if (typeof CustomEvent === "function") {
738
+ e = new CustomEvent(type, {
739
+ bubbles,
740
+ detail
741
+ });
742
+ } else {
743
+ e = document.createEvent("CustomEvent");
744
+ e.initCustomEvent(type, bubbles, false, detail);
745
+ }
746
+ target.dispatchEvent(e);
747
+ return e;
748
+ }
749
+ function forEachEvent(targets, events, iteratee) {
750
+ forEach(targets, function(target) {
751
+ target && forEach(events, function(events2) {
752
+ events2.split(" ").forEach(function(eventNS) {
753
+ var fragment = eventNS.split(".");
754
+ iteratee(target, fragment[0], fragment[1]);
755
+ });
756
+ });
757
+ });
758
+ }
759
+ function destroy() {
760
+ listeners.forEach(function(data) {
761
+ data[4]();
762
+ });
763
+ empty(listeners);
764
+ }
765
+ return {
766
+ bind,
767
+ unbind,
768
+ dispatch,
769
+ destroy
770
+ };
771
+ }
772
+ var EVENT_MOUNTED = "mounted";
773
+ var EVENT_READY = "ready";
774
+ var EVENT_MOVE = "move";
775
+ var EVENT_MOVED = "moved";
776
+ var EVENT_CLICK = "click";
777
+ var EVENT_ACTIVE = "active";
778
+ var EVENT_INACTIVE = "inactive";
779
+ var EVENT_VISIBLE = "visible";
780
+ var EVENT_HIDDEN = "hidden";
781
+ var EVENT_REFRESH = "refresh";
782
+ var EVENT_UPDATED = "updated";
783
+ var EVENT_RESIZE = "resize";
784
+ var EVENT_RESIZED = "resized";
785
+ var EVENT_DRAG = "drag";
786
+ var EVENT_DRAGGING = "dragging";
787
+ var EVENT_DRAGGED = "dragged";
788
+ var EVENT_SCROLL = "scroll";
789
+ var EVENT_SCROLLED = "scrolled";
790
+ var EVENT_OVERFLOW = "overflow";
791
+ var EVENT_DESTROY = "destroy";
792
+ var EVENT_ARROWS_MOUNTED = "arrows:mounted";
793
+ var EVENT_ARROWS_UPDATED = "arrows:updated";
794
+ var EVENT_PAGINATION_MOUNTED = "pagination:mounted";
795
+ var EVENT_PAGINATION_UPDATED = "pagination:updated";
796
+ var EVENT_NAVIGATION_MOUNTED = "navigation:mounted";
797
+ var EVENT_AUTOPLAY_PLAY = "autoplay:play";
798
+ var EVENT_AUTOPLAY_PLAYING = "autoplay:playing";
799
+ var EVENT_AUTOPLAY_PAUSE = "autoplay:pause";
800
+ var EVENT_LAZYLOAD_LOADED = "lazyload:loaded";
801
+ var EVENT_SLIDE_KEYDOWN = "sk";
802
+ var EVENT_SHIFTED = "sh";
803
+ var EVENT_END_INDEX_CHANGED = "ei";
804
+ function EventInterface(Splide2) {
805
+ var bus = Splide2 ? Splide2.event.bus : document.createDocumentFragment();
806
+ var binder = EventBinder();
807
+ function on(events, callback) {
808
+ binder.bind(bus, toArray(events).join(" "), function(e) {
809
+ callback.apply(callback, isArray(e.detail) ? e.detail : []);
810
+ });
811
+ }
812
+ function emit(event) {
813
+ binder.dispatch(bus, event, slice(arguments, 1));
814
+ }
815
+ if (Splide2) {
816
+ Splide2.event.on(EVENT_DESTROY, binder.destroy);
817
+ }
818
+ return assign(binder, {
819
+ bus,
820
+ on,
821
+ off: apply(binder.unbind, bus),
822
+ emit
823
+ });
824
+ }
825
+ function RequestInterval(interval, onInterval, onUpdate, limit) {
826
+ var now = Date.now;
827
+ var startTime;
828
+ var rate = 0;
829
+ var id;
830
+ var paused = true;
831
+ var count = 0;
832
+ function update() {
833
+ if (!paused) {
834
+ rate = interval ? min((now() - startTime) / interval, 1) : 1;
835
+ onUpdate && onUpdate(rate);
836
+ if (rate >= 1) {
837
+ onInterval();
838
+ startTime = now();
839
+ if (limit && ++count >= limit) {
840
+ return pause();
841
+ }
842
+ }
843
+ id = raf(update);
844
+ }
845
+ }
846
+ function start(resume) {
847
+ resume || cancel();
848
+ startTime = now() - (resume ? rate * interval : 0);
849
+ paused = false;
850
+ id = raf(update);
851
+ }
852
+ function pause() {
853
+ paused = true;
854
+ }
855
+ function rewind() {
856
+ startTime = now();
857
+ rate = 0;
858
+ if (onUpdate) {
859
+ onUpdate(rate);
860
+ }
861
+ }
862
+ function cancel() {
863
+ id && cancelAnimationFrame(id);
864
+ rate = 0;
865
+ id = 0;
866
+ paused = true;
867
+ }
868
+ function set(time) {
869
+ interval = time;
870
+ }
871
+ function isPaused() {
872
+ return paused;
873
+ }
874
+ return {
875
+ start,
876
+ rewind,
877
+ pause,
878
+ cancel,
879
+ set,
880
+ isPaused
881
+ };
882
+ }
883
+ function State(initialState) {
884
+ var state = initialState;
885
+ function set(value) {
886
+ state = value;
887
+ }
888
+ function is(states) {
889
+ return includes(toArray(states), state);
890
+ }
891
+ return {
892
+ set,
893
+ is
894
+ };
895
+ }
896
+ function Throttle(func, duration) {
897
+ var interval = RequestInterval(duration || 0, func, null, 1);
898
+ return function() {
899
+ interval.isPaused() && interval.start();
900
+ };
901
+ }
902
+ function Media(Splide2, Components2, options) {
903
+ var state = Splide2.state;
904
+ var breakpoints = options.breakpoints || {};
905
+ var reducedMotion = options.reducedMotion || {};
906
+ var binder = EventBinder();
907
+ var queries = [];
908
+ function setup() {
909
+ var isMin = options.mediaQuery === "min";
910
+ ownKeys(breakpoints).sort(function(n, m) {
911
+ return isMin ? +n - +m : +m - +n;
912
+ }).forEach(function(key) {
913
+ register(breakpoints[key], "(" + (isMin ? "min" : "max") + "-width:" + key + "px)");
914
+ });
915
+ register(reducedMotion, MEDIA_PREFERS_REDUCED_MOTION);
916
+ update();
917
+ }
918
+ function destroy(completely) {
919
+ if (completely) {
920
+ binder.destroy();
921
+ }
922
+ }
923
+ function register(options2, query2) {
924
+ var queryList = matchMedia(query2);
925
+ binder.bind(queryList, "change", update);
926
+ queries.push([options2, queryList]);
927
+ }
928
+ function update() {
929
+ var destroyed = state.is(DESTROYED);
930
+ var direction = options.direction;
931
+ var merged = queries.reduce(function(merged2, entry) {
932
+ return merge(merged2, entry[1].matches ? entry[0] : {});
933
+ }, {});
934
+ omit(options);
935
+ set(merged);
936
+ if (options.destroy) {
937
+ Splide2.destroy(options.destroy === "completely");
938
+ } else if (destroyed) {
939
+ destroy(true);
940
+ Splide2.mount();
941
+ } else {
942
+ direction !== options.direction && Splide2.refresh();
943
+ }
944
+ }
945
+ function reduce(enable) {
946
+ if (matchMedia(MEDIA_PREFERS_REDUCED_MOTION).matches) {
947
+ enable ? merge(options, reducedMotion) : omit(options, ownKeys(reducedMotion));
948
+ }
949
+ }
950
+ function set(opts, base, notify) {
951
+ merge(options, opts);
952
+ base && merge(Object.getPrototypeOf(options), opts);
953
+ if (notify || !state.is(CREATED)) {
954
+ Splide2.emit(EVENT_UPDATED, options);
955
+ }
956
+ }
957
+ return {
958
+ setup,
959
+ destroy,
960
+ reduce,
961
+ set
962
+ };
963
+ }
964
+ var ARROW = "Arrow";
965
+ var ARROW_LEFT = ARROW + "Left";
966
+ var ARROW_RIGHT = ARROW + "Right";
967
+ var ARROW_UP = ARROW + "Up";
968
+ var ARROW_DOWN = ARROW + "Down";
969
+ var RTL = "rtl";
970
+ var TTB = "ttb";
971
+ var ORIENTATION_MAP = {
972
+ width: ["height"],
973
+ left: ["top", "right"],
974
+ right: ["bottom", "left"],
975
+ x: ["y"],
976
+ X: ["Y"],
977
+ Y: ["X"],
978
+ ArrowLeft: [ARROW_UP, ARROW_RIGHT],
979
+ ArrowRight: [ARROW_DOWN, ARROW_LEFT]
980
+ };
981
+ function Direction(Splide2, Components2, options) {
982
+ function resolve(prop, axisOnly, direction) {
983
+ direction = direction || options.direction;
984
+ var index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1;
985
+ return ORIENTATION_MAP[prop] && ORIENTATION_MAP[prop][index] || prop.replace(/width|left|right/i, function(match, offset) {
986
+ var replacement = ORIENTATION_MAP[match.toLowerCase()][index] || match;
987
+ return offset > 0 ? replacement.charAt(0).toUpperCase() + replacement.slice(1) : replacement;
988
+ });
989
+ }
990
+ function orient(value) {
991
+ return value * (options.direction === RTL ? 1 : -1);
992
+ }
993
+ return {
994
+ resolve,
995
+ orient
996
+ };
997
+ }
998
+ var ROLE = "role";
999
+ var TAB_INDEX = "tabindex";
1000
+ var DISABLED = "disabled";
1001
+ var ARIA_PREFIX = "aria-";
1002
+ var ARIA_CONTROLS = ARIA_PREFIX + "controls";
1003
+ var ARIA_CURRENT = ARIA_PREFIX + "current";
1004
+ var ARIA_SELECTED = ARIA_PREFIX + "selected";
1005
+ var ARIA_LABEL = ARIA_PREFIX + "label";
1006
+ var ARIA_LABELLEDBY = ARIA_PREFIX + "labelledby";
1007
+ var ARIA_HIDDEN = ARIA_PREFIX + "hidden";
1008
+ var ARIA_ORIENTATION = ARIA_PREFIX + "orientation";
1009
+ var ARIA_ROLEDESCRIPTION = ARIA_PREFIX + "roledescription";
1010
+ var ARIA_LIVE = ARIA_PREFIX + "live";
1011
+ var ARIA_BUSY = ARIA_PREFIX + "busy";
1012
+ var ARIA_ATOMIC = ARIA_PREFIX + "atomic";
1013
+ var ALL_ATTRIBUTES = [ROLE, TAB_INDEX, DISABLED, ARIA_CONTROLS, ARIA_CURRENT, ARIA_LABEL, ARIA_LABELLEDBY, ARIA_HIDDEN, ARIA_ORIENTATION, ARIA_ROLEDESCRIPTION];
1014
+ var CLASS_PREFIX = PROJECT_CODE + "__";
1015
+ var STATUS_CLASS_PREFIX = "is-";
1016
+ var CLASS_ROOT = PROJECT_CODE;
1017
+ var CLASS_TRACK = CLASS_PREFIX + "track";
1018
+ var CLASS_LIST = CLASS_PREFIX + "list";
1019
+ var CLASS_SLIDE = CLASS_PREFIX + "slide";
1020
+ var CLASS_CLONE = CLASS_SLIDE + "--clone";
1021
+ var CLASS_CONTAINER = CLASS_SLIDE + "__container";
1022
+ var CLASS_ARROWS = CLASS_PREFIX + "arrows";
1023
+ var CLASS_ARROW = CLASS_PREFIX + "arrow";
1024
+ var CLASS_ARROW_PREV = CLASS_ARROW + "--prev";
1025
+ var CLASS_ARROW_NEXT = CLASS_ARROW + "--next";
1026
+ var CLASS_PAGINATION = CLASS_PREFIX + "pagination";
1027
+ var CLASS_PAGINATION_PAGE = CLASS_PAGINATION + "__page";
1028
+ var CLASS_PROGRESS = CLASS_PREFIX + "progress";
1029
+ var CLASS_PROGRESS_BAR = CLASS_PROGRESS + "__bar";
1030
+ var CLASS_TOGGLE = CLASS_PREFIX + "toggle";
1031
+ var CLASS_TOGGLE_PLAY = CLASS_TOGGLE + "__play";
1032
+ var CLASS_TOGGLE_PAUSE = CLASS_TOGGLE + "__pause";
1033
+ var CLASS_SPINNER = CLASS_PREFIX + "spinner";
1034
+ var CLASS_SR = CLASS_PREFIX + "sr";
1035
+ var CLASS_INITIALIZED = STATUS_CLASS_PREFIX + "initialized";
1036
+ var CLASS_ACTIVE = STATUS_CLASS_PREFIX + "active";
1037
+ var CLASS_PREV = STATUS_CLASS_PREFIX + "prev";
1038
+ var CLASS_NEXT = STATUS_CLASS_PREFIX + "next";
1039
+ var CLASS_VISIBLE = STATUS_CLASS_PREFIX + "visible";
1040
+ var CLASS_LOADING = STATUS_CLASS_PREFIX + "loading";
1041
+ var CLASS_FOCUS_IN = STATUS_CLASS_PREFIX + "focus-in";
1042
+ var CLASS_OVERFLOW = STATUS_CLASS_PREFIX + "overflow";
1043
+ var STATUS_CLASSES = [CLASS_ACTIVE, CLASS_VISIBLE, CLASS_PREV, CLASS_NEXT, CLASS_LOADING, CLASS_FOCUS_IN, CLASS_OVERFLOW];
1044
+ var CLASSES = {
1045
+ slide: CLASS_SLIDE,
1046
+ clone: CLASS_CLONE,
1047
+ arrows: CLASS_ARROWS,
1048
+ arrow: CLASS_ARROW,
1049
+ prev: CLASS_ARROW_PREV,
1050
+ next: CLASS_ARROW_NEXT,
1051
+ pagination: CLASS_PAGINATION,
1052
+ page: CLASS_PAGINATION_PAGE,
1053
+ spinner: CLASS_SPINNER
1054
+ };
1055
+ function closest(from, selector) {
1056
+ if (isFunction(from.closest)) {
1057
+ return from.closest(selector);
1058
+ }
1059
+ var elm = from;
1060
+ while (elm && elm.nodeType === 1) {
1061
+ if (matches(elm, selector)) {
1062
+ break;
1063
+ }
1064
+ elm = elm.parentElement;
1065
+ }
1066
+ return elm;
1067
+ }
1068
+ var FRICTION = 5;
1069
+ var LOG_INTERVAL = 200;
1070
+ var POINTER_DOWN_EVENTS = "touchstart mousedown";
1071
+ var POINTER_MOVE_EVENTS = "touchmove mousemove";
1072
+ var POINTER_UP_EVENTS = "touchend touchcancel mouseup click";
1073
+ function Elements(Splide2, Components2, options) {
1074
+ var _EventInterface = EventInterface(Splide2), on = _EventInterface.on, bind = _EventInterface.bind;
1075
+ var root = Splide2.root;
1076
+ var i18n = options.i18n;
1077
+ var elements = {};
1078
+ var slides = [];
1079
+ var rootClasses = [];
1080
+ var trackClasses = [];
1081
+ var track;
1082
+ var list;
1083
+ var isUsingKey;
1084
+ function setup() {
1085
+ collect();
1086
+ init();
1087
+ update();
1088
+ }
1089
+ function mount() {
1090
+ on(EVENT_REFRESH, destroy);
1091
+ on(EVENT_REFRESH, setup);
1092
+ on(EVENT_UPDATED, update);
1093
+ bind(document, POINTER_DOWN_EVENTS + " keydown", function(e) {
1094
+ isUsingKey = e.type === "keydown";
1095
+ }, {
1096
+ capture: true
1097
+ });
1098
+ bind(root, "focusin", function() {
1099
+ toggleClass(root, CLASS_FOCUS_IN, !!isUsingKey);
1100
+ });
1101
+ }
1102
+ function destroy(completely) {
1103
+ var attrs = ALL_ATTRIBUTES.concat("style");
1104
+ empty(slides);
1105
+ removeClass(root, rootClasses);
1106
+ removeClass(track, trackClasses);
1107
+ removeAttribute([track, list], attrs);
1108
+ removeAttribute(root, completely ? attrs : ["style", ARIA_ROLEDESCRIPTION]);
1109
+ }
1110
+ function update() {
1111
+ removeClass(root, rootClasses);
1112
+ removeClass(track, trackClasses);
1113
+ rootClasses = getClasses(CLASS_ROOT);
1114
+ trackClasses = getClasses(CLASS_TRACK);
1115
+ addClass(root, rootClasses);
1116
+ addClass(track, trackClasses);
1117
+ setAttribute(root, ARIA_LABEL, options.label);
1118
+ setAttribute(root, ARIA_LABELLEDBY, options.labelledby);
1119
+ }
1120
+ function collect() {
1121
+ track = find("." + CLASS_TRACK);
1122
+ list = child(track, "." + CLASS_LIST);
1123
+ assert(track && list, "A track/list element is missing.");
1124
+ push(slides, children(list, "." + CLASS_SLIDE + ":not(." + CLASS_CLONE + ")"));
1125
+ forOwn({
1126
+ arrows: CLASS_ARROWS,
1127
+ pagination: CLASS_PAGINATION,
1128
+ prev: CLASS_ARROW_PREV,
1129
+ next: CLASS_ARROW_NEXT,
1130
+ bar: CLASS_PROGRESS_BAR,
1131
+ toggle: CLASS_TOGGLE
1132
+ }, function(className, key) {
1133
+ elements[key] = find("." + className);
1134
+ });
1135
+ assign(elements, {
1136
+ root,
1137
+ track,
1138
+ list,
1139
+ slides
1140
+ });
1141
+ }
1142
+ function init() {
1143
+ var id = root.id || uniqueId(PROJECT_CODE);
1144
+ var role = options.role;
1145
+ root.id = id;
1146
+ track.id = track.id || id + "-track";
1147
+ list.id = list.id || id + "-list";
1148
+ if (!getAttribute(root, ROLE) && root.tagName !== "SECTION" && role) {
1149
+ setAttribute(root, ROLE, role);
1150
+ }
1151
+ setAttribute(root, ARIA_ROLEDESCRIPTION, i18n.carousel);
1152
+ setAttribute(list, ROLE, "presentation");
1153
+ }
1154
+ function find(selector) {
1155
+ var elm = query(root, selector);
1156
+ return elm && closest(elm, "." + CLASS_ROOT) === root ? elm : void 0;
1157
+ }
1158
+ function getClasses(base) {
1159
+ return [base + "--" + options.type, base + "--" + options.direction, options.drag && base + "--draggable", options.isNavigation && base + "--nav", base === CLASS_ROOT && CLASS_ACTIVE];
1160
+ }
1161
+ return assign(elements, {
1162
+ setup,
1163
+ mount,
1164
+ destroy
1165
+ });
1166
+ }
1167
+ var SLIDE = "slide";
1168
+ var LOOP = "loop";
1169
+ var FADE = "fade";
1170
+ function Slide$1(Splide2, index, slideIndex, slide) {
1171
+ var event = EventInterface(Splide2);
1172
+ var on = event.on, emit = event.emit, bind = event.bind;
1173
+ var Components = Splide2.Components, root = Splide2.root, options = Splide2.options;
1174
+ var isNavigation = options.isNavigation, updateOnMove = options.updateOnMove, i18n = options.i18n, pagination = options.pagination, slideFocus = options.slideFocus;
1175
+ var resolve = Components.Direction.resolve;
1176
+ var styles = getAttribute(slide, "style");
1177
+ var label = getAttribute(slide, ARIA_LABEL);
1178
+ var isClone = slideIndex > -1;
1179
+ var container = child(slide, "." + CLASS_CONTAINER);
1180
+ var destroyed;
1181
+ function mount() {
1182
+ if (!isClone) {
1183
+ slide.id = root.id + "-slide" + pad(index + 1);
1184
+ setAttribute(slide, ROLE, pagination ? "tabpanel" : "group");
1185
+ setAttribute(slide, ARIA_ROLEDESCRIPTION, i18n.slide);
1186
+ setAttribute(slide, ARIA_LABEL, label || format(i18n.slideLabel, [index + 1, Splide2.length]));
1187
+ }
1188
+ listen();
1189
+ }
1190
+ function listen() {
1191
+ bind(slide, "click", apply(emit, EVENT_CLICK, self));
1192
+ bind(slide, "keydown", apply(emit, EVENT_SLIDE_KEYDOWN, self));
1193
+ on([EVENT_MOVED, EVENT_SHIFTED, EVENT_SCROLLED], update);
1194
+ on(EVENT_NAVIGATION_MOUNTED, initNavigation);
1195
+ if (updateOnMove) {
1196
+ on(EVENT_MOVE, onMove);
1197
+ }
1198
+ }
1199
+ function destroy() {
1200
+ destroyed = true;
1201
+ event.destroy();
1202
+ removeClass(slide, STATUS_CLASSES);
1203
+ removeAttribute(slide, ALL_ATTRIBUTES);
1204
+ setAttribute(slide, "style", styles);
1205
+ setAttribute(slide, ARIA_LABEL, label || "");
1206
+ }
1207
+ function initNavigation() {
1208
+ var controls = Splide2.splides.map(function(target) {
1209
+ var Slide2 = target.splide.Components.Slides.getAt(index);
1210
+ return Slide2 ? Slide2.slide.id : "";
1211
+ }).join(" ");
1212
+ setAttribute(slide, ARIA_LABEL, format(i18n.slideX, (isClone ? slideIndex : index) + 1));
1213
+ setAttribute(slide, ARIA_CONTROLS, controls);
1214
+ setAttribute(slide, ROLE, slideFocus ? "button" : "");
1215
+ slideFocus && removeAttribute(slide, ARIA_ROLEDESCRIPTION);
1216
+ }
1217
+ function onMove() {
1218
+ if (!destroyed) {
1219
+ update();
1220
+ }
1221
+ }
1222
+ function update() {
1223
+ if (!destroyed) {
1224
+ var curr = Splide2.index;
1225
+ updateActivity();
1226
+ updateVisibility();
1227
+ toggleClass(slide, CLASS_PREV, index === curr - 1);
1228
+ toggleClass(slide, CLASS_NEXT, index === curr + 1);
1229
+ }
1230
+ }
1231
+ function updateActivity() {
1232
+ var active = isActive();
1233
+ if (active !== hasClass(slide, CLASS_ACTIVE)) {
1234
+ toggleClass(slide, CLASS_ACTIVE, active);
1235
+ setAttribute(slide, ARIA_CURRENT, isNavigation && active || "");
1236
+ emit(active ? EVENT_ACTIVE : EVENT_INACTIVE, self);
1237
+ }
1238
+ }
1239
+ function updateVisibility() {
1240
+ var visible = isVisible();
1241
+ var hidden = !visible && (!isActive() || isClone);
1242
+ if (!Splide2.state.is([MOVING, SCROLLING])) {
1243
+ setAttribute(slide, ARIA_HIDDEN, hidden || "");
1244
+ }
1245
+ setAttribute(queryAll(slide, options.focusableNodes || ""), TAB_INDEX, hidden ? -1 : "");
1246
+ if (slideFocus) {
1247
+ setAttribute(slide, TAB_INDEX, hidden ? -1 : 0);
1248
+ }
1249
+ if (visible !== hasClass(slide, CLASS_VISIBLE)) {
1250
+ toggleClass(slide, CLASS_VISIBLE, visible);
1251
+ emit(visible ? EVENT_VISIBLE : EVENT_HIDDEN, self);
1252
+ }
1253
+ if (!visible && document.activeElement === slide) {
1254
+ var Slide2 = Components.Slides.getAt(Splide2.index);
1255
+ Slide2 && focus(Slide2.slide);
1256
+ }
1257
+ }
1258
+ function style$1(prop, value, useContainer) {
1259
+ style(useContainer && container || slide, prop, value);
1260
+ }
1261
+ function isActive() {
1262
+ var curr = Splide2.index;
1263
+ return curr === index || options.cloneStatus && curr === slideIndex;
1264
+ }
1265
+ function isVisible() {
1266
+ if (Splide2.is(FADE)) {
1267
+ return isActive();
1268
+ }
1269
+ var trackRect = rect(Components.Elements.track);
1270
+ var slideRect = rect(slide);
1271
+ var left = resolve("left", true);
1272
+ var right = resolve("right", true);
1273
+ return floor(trackRect[left]) <= ceil(slideRect[left]) && floor(slideRect[right]) <= ceil(trackRect[right]);
1274
+ }
1275
+ function isWithin(from, distance) {
1276
+ var diff = abs(from - index);
1277
+ if (!isClone && (options.rewind || Splide2.is(LOOP))) {
1278
+ diff = min(diff, Splide2.length - diff);
1279
+ }
1280
+ return diff <= distance;
1281
+ }
1282
+ var self = {
1283
+ index,
1284
+ slideIndex,
1285
+ slide,
1286
+ container,
1287
+ isClone,
1288
+ mount,
1289
+ destroy,
1290
+ update,
1291
+ style: style$1,
1292
+ isWithin
1293
+ };
1294
+ return self;
1295
+ }
1296
+ function Slides(Splide2, Components2, options) {
1297
+ var _EventInterface2 = EventInterface(Splide2), on = _EventInterface2.on, emit = _EventInterface2.emit, bind = _EventInterface2.bind;
1298
+ var _Components2$Elements = Components2.Elements, slides = _Components2$Elements.slides, list = _Components2$Elements.list;
1299
+ var Slides2 = [];
1300
+ function mount() {
1301
+ init();
1302
+ on(EVENT_REFRESH, destroy);
1303
+ on(EVENT_REFRESH, init);
1304
+ }
1305
+ function init() {
1306
+ slides.forEach(function(slide, index) {
1307
+ register(slide, index, -1);
1308
+ });
1309
+ }
1310
+ function destroy() {
1311
+ forEach$1(function(Slide2) {
1312
+ Slide2.destroy();
1313
+ });
1314
+ empty(Slides2);
1315
+ }
1316
+ function update() {
1317
+ forEach$1(function(Slide2) {
1318
+ Slide2.update();
1319
+ });
1320
+ }
1321
+ function register(slide, index, slideIndex) {
1322
+ var object = Slide$1(Splide2, index, slideIndex, slide);
1323
+ object.mount();
1324
+ Slides2.push(object);
1325
+ Slides2.sort(function(Slide1, Slide2) {
1326
+ return Slide1.index - Slide2.index;
1327
+ });
1328
+ }
1329
+ function get(excludeClones) {
1330
+ return excludeClones ? filter(function(Slide2) {
1331
+ return !Slide2.isClone;
1332
+ }) : Slides2;
1333
+ }
1334
+ function getIn(page) {
1335
+ var Controller2 = Components2.Controller;
1336
+ var index = Controller2.toIndex(page);
1337
+ var max2 = Controller2.hasFocus() ? 1 : options.perPage;
1338
+ return filter(function(Slide2) {
1339
+ return between(Slide2.index, index, index + max2 - 1);
1340
+ });
1341
+ }
1342
+ function getAt(index) {
1343
+ return filter(index)[0];
1344
+ }
1345
+ function add(items, index) {
1346
+ forEach(items, function(slide) {
1347
+ if (isString(slide)) {
1348
+ slide = parseHtml(slide);
1349
+ }
1350
+ if (isHTMLElement(slide)) {
1351
+ var ref = slides[index];
1352
+ ref ? before(slide, ref) : append(list, slide);
1353
+ addClass(slide, options.classes.slide);
1354
+ observeImages(slide, apply(emit, EVENT_RESIZE));
1355
+ }
1356
+ });
1357
+ emit(EVENT_REFRESH);
1358
+ }
1359
+ function remove$1(matcher) {
1360
+ remove(filter(matcher).map(function(Slide2) {
1361
+ return Slide2.slide;
1362
+ }));
1363
+ emit(EVENT_REFRESH);
1364
+ }
1365
+ function forEach$1(iteratee, excludeClones) {
1366
+ get(excludeClones).forEach(iteratee);
1367
+ }
1368
+ function filter(matcher) {
1369
+ return Slides2.filter(isFunction(matcher) ? matcher : function(Slide2) {
1370
+ return isString(matcher) ? matches(Slide2.slide, matcher) : includes(toArray(matcher), Slide2.index);
1371
+ });
1372
+ }
1373
+ function style2(prop, value, useContainer) {
1374
+ forEach$1(function(Slide2) {
1375
+ Slide2.style(prop, value, useContainer);
1376
+ });
1377
+ }
1378
+ function observeImages(elm, callback) {
1379
+ var images = queryAll(elm, "img");
1380
+ var length = images.length;
1381
+ if (length) {
1382
+ images.forEach(function(img) {
1383
+ bind(img, "load error", function() {
1384
+ if (!--length) {
1385
+ callback();
1386
+ }
1387
+ });
1388
+ });
1389
+ } else {
1390
+ callback();
1391
+ }
1392
+ }
1393
+ function getLength(excludeClones) {
1394
+ return excludeClones ? slides.length : Slides2.length;
1395
+ }
1396
+ function isEnough() {
1397
+ return Slides2.length > options.perPage;
1398
+ }
1399
+ return {
1400
+ mount,
1401
+ destroy,
1402
+ update,
1403
+ register,
1404
+ get,
1405
+ getIn,
1406
+ getAt,
1407
+ add,
1408
+ remove: remove$1,
1409
+ forEach: forEach$1,
1410
+ filter,
1411
+ style: style2,
1412
+ getLength,
1413
+ isEnough
1414
+ };
1415
+ }
1416
+ function Layout(Splide2, Components2, options) {
1417
+ var _EventInterface3 = EventInterface(Splide2), on = _EventInterface3.on, bind = _EventInterface3.bind, emit = _EventInterface3.emit;
1418
+ var Slides2 = Components2.Slides;
1419
+ var resolve = Components2.Direction.resolve;
1420
+ var _Components2$Elements2 = Components2.Elements, root = _Components2$Elements2.root, track = _Components2$Elements2.track, list = _Components2$Elements2.list;
1421
+ var getAt = Slides2.getAt, styleSlides = Slides2.style;
1422
+ var vertical;
1423
+ var rootRect;
1424
+ var overflow;
1425
+ function mount() {
1426
+ init();
1427
+ bind(window, "resize load", Throttle(apply(emit, EVENT_RESIZE)));
1428
+ on([EVENT_UPDATED, EVENT_REFRESH], init);
1429
+ on(EVENT_RESIZE, resize);
1430
+ }
1431
+ function init() {
1432
+ vertical = options.direction === TTB;
1433
+ style(root, "maxWidth", unit(options.width));
1434
+ style(track, resolve("paddingLeft"), cssPadding(false));
1435
+ style(track, resolve("paddingRight"), cssPadding(true));
1436
+ resize(true);
1437
+ }
1438
+ function resize(force) {
1439
+ var newRect = rect(root);
1440
+ if (force || rootRect.width !== newRect.width || rootRect.height !== newRect.height) {
1441
+ style(track, "height", cssTrackHeight());
1442
+ styleSlides(resolve("marginRight"), unit(options.gap));
1443
+ styleSlides("width", cssSlideWidth());
1444
+ styleSlides("height", cssSlideHeight(), true);
1445
+ rootRect = newRect;
1446
+ emit(EVENT_RESIZED);
1447
+ if (overflow !== (overflow = isOverflow())) {
1448
+ toggleClass(root, CLASS_OVERFLOW, overflow);
1449
+ emit(EVENT_OVERFLOW, overflow);
1450
+ }
1451
+ }
1452
+ }
1453
+ function cssPadding(right) {
1454
+ var padding = options.padding;
1455
+ var prop = resolve(right ? "right" : "left");
1456
+ return padding && unit(padding[prop] || (isObject(padding) ? 0 : padding)) || "0px";
1457
+ }
1458
+ function cssTrackHeight() {
1459
+ var height = "";
1460
+ if (vertical) {
1461
+ height = cssHeight();
1462
+ assert(height, "height or heightRatio is missing.");
1463
+ height = "calc(" + height + " - " + cssPadding(false) + " - " + cssPadding(true) + ")";
1464
+ }
1465
+ return height;
1466
+ }
1467
+ function cssHeight() {
1468
+ return unit(options.height || rect(list).width * options.heightRatio);
1469
+ }
1470
+ function cssSlideWidth() {
1471
+ return options.autoWidth ? null : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize());
1472
+ }
1473
+ function cssSlideHeight() {
1474
+ return unit(options.fixedHeight) || (vertical ? options.autoHeight ? null : cssSlideSize() : cssHeight());
1475
+ }
1476
+ function cssSlideSize() {
1477
+ var gap = unit(options.gap);
1478
+ return "calc((100%" + (gap && " + " + gap) + ")/" + (options.perPage || 1) + (gap && " - " + gap) + ")";
1479
+ }
1480
+ function listSize() {
1481
+ return rect(list)[resolve("width")];
1482
+ }
1483
+ function slideSize(index, withoutGap) {
1484
+ var Slide2 = getAt(index || 0);
1485
+ return Slide2 ? rect(Slide2.slide)[resolve("width")] + (withoutGap ? 0 : getGap()) : 0;
1486
+ }
1487
+ function totalSize(index, withoutGap) {
1488
+ var Slide2 = getAt(index);
1489
+ if (Slide2) {
1490
+ var right = rect(Slide2.slide)[resolve("right")];
1491
+ var left = rect(list)[resolve("left")];
1492
+ return abs(right - left) + (withoutGap ? 0 : getGap());
1493
+ }
1494
+ return 0;
1495
+ }
1496
+ function sliderSize(withoutGap) {
1497
+ return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0, withoutGap);
1498
+ }
1499
+ function getGap() {
1500
+ var Slide2 = getAt(0);
1501
+ return Slide2 && parseFloat(style(Slide2.slide, resolve("marginRight"))) || 0;
1502
+ }
1503
+ function getPadding(right) {
1504
+ return parseFloat(style(track, resolve("padding" + (right ? "Right" : "Left")))) || 0;
1505
+ }
1506
+ function isOverflow() {
1507
+ return Splide2.is(FADE) || sliderSize(true) > listSize();
1508
+ }
1509
+ return {
1510
+ mount,
1511
+ resize,
1512
+ listSize,
1513
+ slideSize,
1514
+ sliderSize,
1515
+ totalSize,
1516
+ getPadding,
1517
+ isOverflow
1518
+ };
1519
+ }
1520
+ var MULTIPLIER = 2;
1521
+ function Clones(Splide2, Components2, options) {
1522
+ var event = EventInterface(Splide2);
1523
+ var on = event.on;
1524
+ var Elements2 = Components2.Elements, Slides2 = Components2.Slides;
1525
+ var resolve = Components2.Direction.resolve;
1526
+ var clones = [];
1527
+ var cloneCount;
1528
+ function mount() {
1529
+ on(EVENT_REFRESH, remount);
1530
+ on([EVENT_UPDATED, EVENT_RESIZE], observe);
1531
+ if (cloneCount = computeCloneCount()) {
1532
+ generate(cloneCount);
1533
+ Components2.Layout.resize(true);
1534
+ }
1535
+ }
1536
+ function remount() {
1537
+ destroy();
1538
+ mount();
1539
+ }
1540
+ function destroy() {
1541
+ remove(clones);
1542
+ empty(clones);
1543
+ event.destroy();
1544
+ }
1545
+ function observe() {
1546
+ var count = computeCloneCount();
1547
+ if (cloneCount !== count) {
1548
+ if (cloneCount < count || !count) {
1549
+ event.emit(EVENT_REFRESH);
1550
+ }
1551
+ }
1552
+ }
1553
+ function generate(count) {
1554
+ var slides = Slides2.get().slice();
1555
+ var length = slides.length;
1556
+ if (length) {
1557
+ while (slides.length < count) {
1558
+ push(slides, slides);
1559
+ }
1560
+ push(slides.slice(-count), slides.slice(0, count)).forEach(function(Slide2, index) {
1561
+ var isHead = index < count;
1562
+ var clone = cloneDeep(Slide2.slide, index);
1563
+ isHead ? before(clone, slides[0].slide) : append(Elements2.list, clone);
1564
+ push(clones, clone);
1565
+ Slides2.register(clone, index - count + (isHead ? 0 : length), Slide2.index);
1566
+ });
1567
+ }
1568
+ }
1569
+ function cloneDeep(elm, index) {
1570
+ var clone = elm.cloneNode(true);
1571
+ addClass(clone, options.classes.clone);
1572
+ clone.id = Splide2.root.id + "-clone" + pad(index + 1);
1573
+ return clone;
1574
+ }
1575
+ function computeCloneCount() {
1576
+ var clones2 = options.clones;
1577
+ if (!Splide2.is(LOOP)) {
1578
+ clones2 = 0;
1579
+ } else if (isUndefined(clones2)) {
1580
+ var fixedSize = options[resolve("fixedWidth")] && Components2.Layout.slideSize(0);
1581
+ var fixedCount = fixedSize && ceil(rect(Elements2.track)[resolve("width")] / fixedSize);
1582
+ clones2 = fixedCount || options[resolve("autoWidth")] && Splide2.length || options.perPage * MULTIPLIER;
1583
+ }
1584
+ return clones2;
1585
+ }
1586
+ return {
1587
+ mount,
1588
+ destroy
1589
+ };
1590
+ }
1591
+ function Move(Splide2, Components2, options) {
1592
+ var _EventInterface4 = EventInterface(Splide2), on = _EventInterface4.on, emit = _EventInterface4.emit;
1593
+ var set = Splide2.state.set;
1594
+ var _Components2$Layout = Components2.Layout, slideSize = _Components2$Layout.slideSize, getPadding = _Components2$Layout.getPadding, totalSize = _Components2$Layout.totalSize, listSize = _Components2$Layout.listSize, sliderSize = _Components2$Layout.sliderSize;
1595
+ var _Components2$Directio = Components2.Direction, resolve = _Components2$Directio.resolve, orient = _Components2$Directio.orient;
1596
+ var _Components2$Elements3 = Components2.Elements, list = _Components2$Elements3.list, track = _Components2$Elements3.track;
1597
+ var Transition;
1598
+ function mount() {
1599
+ Transition = Components2.Transition;
1600
+ on([EVENT_MOUNTED, EVENT_RESIZED, EVENT_UPDATED, EVENT_REFRESH], reposition);
1601
+ }
1602
+ function reposition() {
1603
+ if (!Components2.Controller.isBusy()) {
1604
+ Components2.Scroll.cancel();
1605
+ jump(Splide2.index);
1606
+ Components2.Slides.update();
1607
+ }
1608
+ }
1609
+ function move(dest, index, prev, callback) {
1610
+ if (dest !== index && canShift(dest > prev)) {
1611
+ cancel();
1612
+ translate(shift(getPosition(), dest > prev), true);
1613
+ }
1614
+ set(MOVING);
1615
+ emit(EVENT_MOVE, index, prev, dest);
1616
+ Transition.start(index, function() {
1617
+ set(IDLE);
1618
+ emit(EVENT_MOVED, index, prev, dest);
1619
+ callback && callback();
1620
+ });
1621
+ }
1622
+ function jump(index) {
1623
+ translate(toPosition(index, true));
1624
+ }
1625
+ function translate(position, preventLoop) {
1626
+ if (!Splide2.is(FADE)) {
1627
+ var destination = preventLoop ? position : loop(position);
1628
+ style(list, "transform", "translate" + resolve("X") + "(" + destination + "px)");
1629
+ position !== destination && emit(EVENT_SHIFTED);
1630
+ }
1631
+ }
1632
+ function loop(position) {
1633
+ if (Splide2.is(LOOP)) {
1634
+ var index = toIndex(position);
1635
+ var exceededMax = index > Components2.Controller.getEnd();
1636
+ var exceededMin = index < 0;
1637
+ if (exceededMin || exceededMax) {
1638
+ position = shift(position, exceededMax);
1639
+ }
1640
+ }
1641
+ return position;
1642
+ }
1643
+ function shift(position, backwards) {
1644
+ var excess = position - getLimit(backwards);
1645
+ var size = sliderSize();
1646
+ position -= orient(size * (ceil(abs(excess) / size) || 1)) * (backwards ? 1 : -1);
1647
+ return position;
1648
+ }
1649
+ function cancel() {
1650
+ translate(getPosition(), true);
1651
+ Transition.cancel();
1652
+ }
1653
+ function toIndex(position) {
1654
+ var Slides2 = Components2.Slides.get();
1655
+ var index = 0;
1656
+ var minDistance = Infinity;
1657
+ for (var i = 0; i < Slides2.length; i++) {
1658
+ var slideIndex = Slides2[i].index;
1659
+ var distance = abs(toPosition(slideIndex, true) - position);
1660
+ if (distance <= minDistance) {
1661
+ minDistance = distance;
1662
+ index = slideIndex;
1663
+ } else {
1664
+ break;
1665
+ }
1666
+ }
1667
+ return index;
1668
+ }
1669
+ function toPosition(index, trimming) {
1670
+ var position = orient(totalSize(index - 1) - offset(index));
1671
+ return trimming ? trim(position) : position;
1672
+ }
1673
+ function getPosition() {
1674
+ var left = resolve("left");
1675
+ return rect(list)[left] - rect(track)[left] + orient(getPadding(false));
1676
+ }
1677
+ function trim(position) {
1678
+ if (options.trimSpace && Splide2.is(SLIDE)) {
1679
+ position = clamp(position, 0, orient(sliderSize(true) - listSize()));
1680
+ }
1681
+ return position;
1682
+ }
1683
+ function offset(index) {
1684
+ var focus2 = options.focus;
1685
+ return focus2 === "center" ? (listSize() - slideSize(index, true)) / 2 : +focus2 * slideSize(index) || 0;
1686
+ }
1687
+ function getLimit(max2) {
1688
+ return toPosition(max2 ? Components2.Controller.getEnd() : 0, !!options.trimSpace);
1689
+ }
1690
+ function canShift(backwards) {
1691
+ var shifted = orient(shift(getPosition(), backwards));
1692
+ return backwards ? shifted >= 0 : shifted <= list[resolve("scrollWidth")] - rect(track)[resolve("width")];
1693
+ }
1694
+ function exceededLimit(max2, position) {
1695
+ position = isUndefined(position) ? getPosition() : position;
1696
+ var exceededMin = max2 !== true && orient(position) < orient(getLimit(false));
1697
+ var exceededMax = max2 !== false && orient(position) > orient(getLimit(true));
1698
+ return exceededMin || exceededMax;
1699
+ }
1700
+ return {
1701
+ mount,
1702
+ move,
1703
+ jump,
1704
+ translate,
1705
+ shift,
1706
+ cancel,
1707
+ toIndex,
1708
+ toPosition,
1709
+ getPosition,
1710
+ getLimit,
1711
+ exceededLimit,
1712
+ reposition
1713
+ };
1714
+ }
1715
+ function Controller(Splide2, Components2, options) {
1716
+ var _EventInterface5 = EventInterface(Splide2), on = _EventInterface5.on, emit = _EventInterface5.emit;
1717
+ var Move2 = Components2.Move;
1718
+ var getPosition = Move2.getPosition, getLimit = Move2.getLimit, toPosition = Move2.toPosition;
1719
+ var _Components2$Slides = Components2.Slides, isEnough = _Components2$Slides.isEnough, getLength = _Components2$Slides.getLength;
1720
+ var omitEnd = options.omitEnd;
1721
+ var isLoop = Splide2.is(LOOP);
1722
+ var isSlide = Splide2.is(SLIDE);
1723
+ var getNext = apply(getAdjacent, false);
1724
+ var getPrev = apply(getAdjacent, true);
1725
+ var currIndex = options.start || 0;
1726
+ var endIndex;
1727
+ var prevIndex = currIndex;
1728
+ var slideCount;
1729
+ var perMove;
1730
+ var perPage;
1731
+ function mount() {
1732
+ init();
1733
+ on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], init);
1734
+ on(EVENT_RESIZED, onResized);
1735
+ }
1736
+ function init() {
1737
+ slideCount = getLength(true);
1738
+ perMove = options.perMove;
1739
+ perPage = options.perPage;
1740
+ endIndex = getEnd();
1741
+ var index = clamp(currIndex, 0, omitEnd ? endIndex : slideCount - 1);
1742
+ if (index !== currIndex) {
1743
+ currIndex = index;
1744
+ Move2.reposition();
1745
+ }
1746
+ }
1747
+ function onResized() {
1748
+ if (endIndex !== getEnd()) {
1749
+ emit(EVENT_END_INDEX_CHANGED);
1750
+ }
1751
+ }
1752
+ function go(control, allowSameIndex, callback) {
1753
+ if (!isBusy()) {
1754
+ var dest = parse(control);
1755
+ var index = loop(dest);
1756
+ if (index > -1 && (allowSameIndex || index !== currIndex)) {
1757
+ setIndex(index);
1758
+ Move2.move(dest, index, prevIndex, callback);
1759
+ }
1760
+ }
1761
+ }
1762
+ function scroll(destination, duration, snap, callback) {
1763
+ Components2.Scroll.scroll(destination, duration, snap, function() {
1764
+ var index = loop(Move2.toIndex(getPosition()));
1765
+ setIndex(omitEnd ? min(index, endIndex) : index);
1766
+ callback && callback();
1767
+ });
1768
+ }
1769
+ function parse(control) {
1770
+ var index = currIndex;
1771
+ if (isString(control)) {
1772
+ var _ref = control.match(/([+\-<>])(\d+)?/) || [], indicator = _ref[1], number = _ref[2];
1773
+ if (indicator === "+" || indicator === "-") {
1774
+ index = computeDestIndex(currIndex + +("" + indicator + (+number || 1)), currIndex);
1775
+ } else if (indicator === ">") {
1776
+ index = number ? toIndex(+number) : getNext(true);
1777
+ } else if (indicator === "<") {
1778
+ index = getPrev(true);
1779
+ }
1780
+ } else {
1781
+ index = isLoop ? control : clamp(control, 0, endIndex);
1782
+ }
1783
+ return index;
1784
+ }
1785
+ function getAdjacent(prev, destination) {
1786
+ var number = perMove || (hasFocus() ? 1 : perPage);
1787
+ var dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex, !(perMove || hasFocus()));
1788
+ if (dest === -1 && isSlide) {
1789
+ if (!approximatelyEqual(getPosition(), getLimit(!prev), 1)) {
1790
+ return prev ? 0 : endIndex;
1791
+ }
1792
+ }
1793
+ return destination ? dest : loop(dest);
1794
+ }
1795
+ function computeDestIndex(dest, from, snapPage) {
1796
+ if (isEnough() || hasFocus()) {
1797
+ var index = computeMovableDestIndex(dest);
1798
+ if (index !== dest) {
1799
+ from = dest;
1800
+ dest = index;
1801
+ snapPage = false;
1802
+ }
1803
+ if (dest < 0 || dest > endIndex) {
1804
+ if (!perMove && (between(0, dest, from, true) || between(endIndex, from, dest, true))) {
1805
+ dest = toIndex(toPage(dest));
1806
+ } else {
1807
+ if (isLoop) {
1808
+ dest = snapPage ? dest < 0 ? -(slideCount % perPage || perPage) : slideCount : dest;
1809
+ } else if (options.rewind) {
1810
+ dest = dest < 0 ? endIndex : 0;
1811
+ } else {
1812
+ dest = -1;
1813
+ }
1814
+ }
1815
+ } else {
1816
+ if (snapPage && dest !== from) {
1817
+ dest = toIndex(toPage(from) + (dest < from ? -1 : 1));
1818
+ }
1819
+ }
1820
+ } else {
1821
+ dest = -1;
1822
+ }
1823
+ return dest;
1824
+ }
1825
+ function computeMovableDestIndex(dest) {
1826
+ if (isSlide && options.trimSpace === "move" && dest !== currIndex) {
1827
+ var position = getPosition();
1828
+ while (position === toPosition(dest, true) && between(dest, 0, Splide2.length - 1, !options.rewind)) {
1829
+ dest < currIndex ? --dest : ++dest;
1830
+ }
1831
+ }
1832
+ return dest;
1833
+ }
1834
+ function loop(index) {
1835
+ return isLoop ? (index + slideCount) % slideCount || 0 : index;
1836
+ }
1837
+ function getEnd() {
1838
+ var end = slideCount - (hasFocus() || isLoop && perMove ? 1 : perPage);
1839
+ while (omitEnd && end-- > 0) {
1840
+ if (toPosition(slideCount - 1, true) !== toPosition(end, true)) {
1841
+ end++;
1842
+ break;
1843
+ }
1844
+ }
1845
+ return clamp(end, 0, slideCount - 1);
1846
+ }
1847
+ function toIndex(page) {
1848
+ return clamp(hasFocus() ? page : perPage * page, 0, endIndex);
1849
+ }
1850
+ function toPage(index) {
1851
+ return hasFocus() ? min(index, endIndex) : floor((index >= endIndex ? slideCount - 1 : index) / perPage);
1852
+ }
1853
+ function toDest(destination) {
1854
+ var closest2 = Move2.toIndex(destination);
1855
+ return isSlide ? clamp(closest2, 0, endIndex) : closest2;
1856
+ }
1857
+ function setIndex(index) {
1858
+ if (index !== currIndex) {
1859
+ prevIndex = currIndex;
1860
+ currIndex = index;
1861
+ }
1862
+ }
1863
+ function getIndex(prev) {
1864
+ return prev ? prevIndex : currIndex;
1865
+ }
1866
+ function hasFocus() {
1867
+ return !isUndefined(options.focus) || options.isNavigation;
1868
+ }
1869
+ function isBusy() {
1870
+ return Splide2.state.is([MOVING, SCROLLING]) && !!options.waitForTransition;
1871
+ }
1872
+ return {
1873
+ mount,
1874
+ go,
1875
+ scroll,
1876
+ getNext,
1877
+ getPrev,
1878
+ getAdjacent,
1879
+ getEnd,
1880
+ setIndex,
1881
+ getIndex,
1882
+ toIndex,
1883
+ toPage,
1884
+ toDest,
1885
+ hasFocus,
1886
+ isBusy
1887
+ };
1888
+ }
1889
+ var XML_NAME_SPACE = "http://www.w3.org/2000/svg";
1890
+ var PATH = "m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z";
1891
+ var SIZE = 40;
1892
+ function Arrows(Splide2, Components2, options) {
1893
+ var event = EventInterface(Splide2);
1894
+ var on = event.on, bind = event.bind, emit = event.emit;
1895
+ var classes = options.classes, i18n = options.i18n;
1896
+ var Elements2 = Components2.Elements, Controller2 = Components2.Controller;
1897
+ var placeholder = Elements2.arrows, track = Elements2.track;
1898
+ var wrapper = placeholder;
1899
+ var prev = Elements2.prev;
1900
+ var next = Elements2.next;
1901
+ var created;
1902
+ var wrapperClasses;
1903
+ var arrows = {};
1904
+ function mount() {
1905
+ init();
1906
+ on(EVENT_UPDATED, remount);
1907
+ }
1908
+ function remount() {
1909
+ destroy();
1910
+ mount();
1911
+ }
1912
+ function init() {
1913
+ var enabled = options.arrows;
1914
+ if (enabled && !(prev && next)) {
1915
+ createArrows();
1916
+ }
1917
+ if (prev && next) {
1918
+ assign(arrows, {
1919
+ prev,
1920
+ next
1921
+ });
1922
+ display(wrapper, enabled ? "" : "none");
1923
+ addClass(wrapper, wrapperClasses = CLASS_ARROWS + "--" + options.direction);
1924
+ if (enabled) {
1925
+ listen();
1926
+ update();
1927
+ setAttribute([prev, next], ARIA_CONTROLS, track.id);
1928
+ emit(EVENT_ARROWS_MOUNTED, prev, next);
1929
+ }
1930
+ }
1931
+ }
1932
+ function destroy() {
1933
+ event.destroy();
1934
+ removeClass(wrapper, wrapperClasses);
1935
+ if (created) {
1936
+ remove(placeholder ? [prev, next] : wrapper);
1937
+ prev = next = null;
1938
+ } else {
1939
+ removeAttribute([prev, next], ALL_ATTRIBUTES);
1940
+ }
1941
+ }
1942
+ function listen() {
1943
+ on([EVENT_MOUNTED, EVENT_MOVED, EVENT_REFRESH, EVENT_SCROLLED, EVENT_END_INDEX_CHANGED], update);
1944
+ bind(next, "click", apply(go, ">"));
1945
+ bind(prev, "click", apply(go, "<"));
1946
+ }
1947
+ function go(control) {
1948
+ Controller2.go(control, true);
1949
+ }
1950
+ function createArrows() {
1951
+ wrapper = placeholder || create("div", classes.arrows);
1952
+ prev = createArrow(true);
1953
+ next = createArrow(false);
1954
+ created = true;
1955
+ append(wrapper, [prev, next]);
1956
+ !placeholder && before(wrapper, track);
1957
+ }
1958
+ function createArrow(prev2) {
1959
+ var arrow = '<button class="' + classes.arrow + " " + (prev2 ? classes.prev : classes.next) + '" type="button"><svg xmlns="' + XML_NAME_SPACE + '" viewBox="0 0 ' + SIZE + " " + SIZE + '" width="' + SIZE + '" height="' + SIZE + '" focusable="false"><path d="' + (options.arrowPath || PATH) + '" />';
1960
+ return parseHtml(arrow);
1961
+ }
1962
+ function update() {
1963
+ if (prev && next) {
1964
+ var index = Splide2.index;
1965
+ var prevIndex = Controller2.getPrev();
1966
+ var nextIndex = Controller2.getNext();
1967
+ var prevLabel = prevIndex > -1 && index < prevIndex ? i18n.last : i18n.prev;
1968
+ var nextLabel = nextIndex > -1 && index > nextIndex ? i18n.first : i18n.next;
1969
+ prev.disabled = prevIndex < 0;
1970
+ next.disabled = nextIndex < 0;
1971
+ setAttribute(prev, ARIA_LABEL, prevLabel);
1972
+ setAttribute(next, ARIA_LABEL, nextLabel);
1973
+ emit(EVENT_ARROWS_UPDATED, prev, next, prevIndex, nextIndex);
1974
+ }
1975
+ }
1976
+ return {
1977
+ arrows,
1978
+ mount,
1979
+ destroy,
1980
+ update
1981
+ };
1982
+ }
1983
+ var INTERVAL_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-interval";
1984
+ function Autoplay(Splide2, Components2, options) {
1985
+ var _EventInterface6 = EventInterface(Splide2), on = _EventInterface6.on, bind = _EventInterface6.bind, emit = _EventInterface6.emit;
1986
+ var interval = RequestInterval(options.interval, Splide2.go.bind(Splide2, ">"), onAnimationFrame);
1987
+ var isPaused = interval.isPaused;
1988
+ var Elements2 = Components2.Elements, _Components2$Elements4 = Components2.Elements, root = _Components2$Elements4.root, toggle = _Components2$Elements4.toggle;
1989
+ var autoplay = options.autoplay;
1990
+ var hovered;
1991
+ var focused;
1992
+ var stopped = autoplay === "pause";
1993
+ function mount() {
1994
+ if (autoplay) {
1995
+ listen();
1996
+ toggle && setAttribute(toggle, ARIA_CONTROLS, Elements2.track.id);
1997
+ stopped || play();
1998
+ update();
1999
+ }
2000
+ }
2001
+ function listen() {
2002
+ if (options.pauseOnHover) {
2003
+ bind(root, "mouseenter mouseleave", function(e) {
2004
+ hovered = e.type === "mouseenter";
2005
+ autoToggle();
2006
+ });
2007
+ }
2008
+ if (options.pauseOnFocus) {
2009
+ bind(root, "focusin focusout", function(e) {
2010
+ focused = e.type === "focusin";
2011
+ autoToggle();
2012
+ });
2013
+ }
2014
+ if (toggle) {
2015
+ bind(toggle, "click", function() {
2016
+ stopped ? play() : pause(true);
2017
+ });
2018
+ }
2019
+ on([EVENT_MOVE, EVENT_SCROLL, EVENT_REFRESH], interval.rewind);
2020
+ on(EVENT_MOVE, onMove);
2021
+ }
2022
+ function play() {
2023
+ if (isPaused() && Components2.Slides.isEnough()) {
2024
+ interval.start(!options.resetProgress);
2025
+ focused = hovered = stopped = false;
2026
+ update();
2027
+ emit(EVENT_AUTOPLAY_PLAY);
2028
+ }
2029
+ }
2030
+ function pause(stop) {
2031
+ if (stop === void 0) {
2032
+ stop = true;
2033
+ }
2034
+ stopped = !!stop;
2035
+ update();
2036
+ if (!isPaused()) {
2037
+ interval.pause();
2038
+ emit(EVENT_AUTOPLAY_PAUSE);
2039
+ }
2040
+ }
2041
+ function autoToggle() {
2042
+ if (!stopped) {
2043
+ hovered || focused ? pause(false) : play();
2044
+ }
2045
+ }
2046
+ function update() {
2047
+ if (toggle) {
2048
+ toggleClass(toggle, CLASS_ACTIVE, !stopped);
2049
+ setAttribute(toggle, ARIA_LABEL, options.i18n[stopped ? "play" : "pause"]);
2050
+ }
2051
+ }
2052
+ function onAnimationFrame(rate) {
2053
+ var bar = Elements2.bar;
2054
+ bar && style(bar, "width", rate * 100 + "%");
2055
+ emit(EVENT_AUTOPLAY_PLAYING, rate);
2056
+ }
2057
+ function onMove(index) {
2058
+ var Slide2 = Components2.Slides.getAt(index);
2059
+ interval.set(Slide2 && +getAttribute(Slide2.slide, INTERVAL_DATA_ATTRIBUTE) || options.interval);
2060
+ }
2061
+ return {
2062
+ mount,
2063
+ destroy: interval.cancel,
2064
+ play,
2065
+ pause,
2066
+ isPaused
2067
+ };
2068
+ }
2069
+ function Cover(Splide2, Components2, options) {
2070
+ var _EventInterface7 = EventInterface(Splide2), on = _EventInterface7.on;
2071
+ function mount() {
2072
+ if (options.cover) {
2073
+ on(EVENT_LAZYLOAD_LOADED, apply(toggle, true));
2074
+ on([EVENT_MOUNTED, EVENT_UPDATED, EVENT_REFRESH], apply(cover, true));
2075
+ }
2076
+ }
2077
+ function cover(cover2) {
2078
+ Components2.Slides.forEach(function(Slide2) {
2079
+ var img = child(Slide2.container || Slide2.slide, "img");
2080
+ if (img && img.src) {
2081
+ toggle(cover2, img, Slide2);
2082
+ }
2083
+ });
2084
+ }
2085
+ function toggle(cover2, img, Slide2) {
2086
+ Slide2.style("background", cover2 ? 'center/cover no-repeat url("' + img.src + '")' : "", true);
2087
+ display(img, cover2 ? "none" : "");
2088
+ }
2089
+ return {
2090
+ mount,
2091
+ destroy: apply(cover, false)
2092
+ };
2093
+ }
2094
+ var BOUNCE_DIFF_THRESHOLD = 10;
2095
+ var BOUNCE_DURATION = 600;
2096
+ var FRICTION_FACTOR = 0.6;
2097
+ var BASE_VELOCITY = 1.5;
2098
+ var MIN_DURATION = 800;
2099
+ function Scroll(Splide2, Components2, options) {
2100
+ var _EventInterface8 = EventInterface(Splide2), on = _EventInterface8.on, emit = _EventInterface8.emit;
2101
+ var set = Splide2.state.set;
2102
+ var Move2 = Components2.Move;
2103
+ var getPosition = Move2.getPosition, getLimit = Move2.getLimit, exceededLimit = Move2.exceededLimit, translate = Move2.translate;
2104
+ var isSlide = Splide2.is(SLIDE);
2105
+ var interval;
2106
+ var callback;
2107
+ var friction = 1;
2108
+ function mount() {
2109
+ on(EVENT_MOVE, clear);
2110
+ on([EVENT_UPDATED, EVENT_REFRESH], cancel);
2111
+ }
2112
+ function scroll(destination, duration, snap, onScrolled, noConstrain) {
2113
+ var from = getPosition();
2114
+ clear();
2115
+ if (snap && (!isSlide || !exceededLimit())) {
2116
+ var size = Components2.Layout.sliderSize();
2117
+ var offset = sign(destination) * size * floor(abs(destination) / size) || 0;
2118
+ destination = Move2.toPosition(Components2.Controller.toDest(destination % size)) + offset;
2119
+ }
2120
+ var noDistance = approximatelyEqual(from, destination, 1);
2121
+ friction = 1;
2122
+ duration = noDistance ? 0 : duration || max(abs(destination - from) / BASE_VELOCITY, MIN_DURATION);
2123
+ callback = onScrolled;
2124
+ interval = RequestInterval(duration, onEnd, apply(update, from, destination, noConstrain), 1);
2125
+ set(SCROLLING);
2126
+ emit(EVENT_SCROLL);
2127
+ interval.start();
2128
+ }
2129
+ function onEnd() {
2130
+ set(IDLE);
2131
+ callback && callback();
2132
+ emit(EVENT_SCROLLED);
2133
+ }
2134
+ function update(from, to, noConstrain, rate) {
2135
+ var position = getPosition();
2136
+ var target = from + (to - from) * easing(rate);
2137
+ var diff = (target - position) * friction;
2138
+ translate(position + diff);
2139
+ if (isSlide && !noConstrain && exceededLimit()) {
2140
+ friction *= FRICTION_FACTOR;
2141
+ if (abs(diff) < BOUNCE_DIFF_THRESHOLD) {
2142
+ scroll(getLimit(exceededLimit(true)), BOUNCE_DURATION, false, callback, true);
2143
+ }
2144
+ }
2145
+ }
2146
+ function clear() {
2147
+ if (interval) {
2148
+ interval.cancel();
2149
+ }
2150
+ }
2151
+ function cancel() {
2152
+ if (interval && !interval.isPaused()) {
2153
+ clear();
2154
+ onEnd();
2155
+ }
2156
+ }
2157
+ function easing(t) {
2158
+ var easingFunc = options.easingFunc;
2159
+ return easingFunc ? easingFunc(t) : 1 - Math.pow(1 - t, 4);
2160
+ }
2161
+ return {
2162
+ mount,
2163
+ destroy: clear,
2164
+ scroll,
2165
+ cancel
2166
+ };
2167
+ }
2168
+ var SCROLL_LISTENER_OPTIONS = {
2169
+ passive: false,
2170
+ capture: true
2171
+ };
2172
+ function Drag(Splide2, Components2, options) {
2173
+ var _EventInterface9 = EventInterface(Splide2), on = _EventInterface9.on, emit = _EventInterface9.emit, bind = _EventInterface9.bind, unbind = _EventInterface9.unbind;
2174
+ var state = Splide2.state;
2175
+ var Move2 = Components2.Move, Scroll2 = Components2.Scroll, Controller2 = Components2.Controller, track = Components2.Elements.track, reduce = Components2.Media.reduce;
2176
+ var _Components2$Directio2 = Components2.Direction, resolve = _Components2$Directio2.resolve, orient = _Components2$Directio2.orient;
2177
+ var getPosition = Move2.getPosition, exceededLimit = Move2.exceededLimit;
2178
+ var basePosition;
2179
+ var baseEvent;
2180
+ var prevBaseEvent;
2181
+ var isFree;
2182
+ var dragging;
2183
+ var exceeded = false;
2184
+ var clickPrevented;
2185
+ var disabled;
2186
+ var target;
2187
+ function mount() {
2188
+ bind(track, POINTER_MOVE_EVENTS, noop, SCROLL_LISTENER_OPTIONS);
2189
+ bind(track, POINTER_UP_EVENTS, noop, SCROLL_LISTENER_OPTIONS);
2190
+ bind(track, POINTER_DOWN_EVENTS, onPointerDown, SCROLL_LISTENER_OPTIONS);
2191
+ bind(track, "click", onClick, {
2192
+ capture: true
2193
+ });
2194
+ bind(track, "dragstart", prevent);
2195
+ on([EVENT_MOUNTED, EVENT_UPDATED], init);
2196
+ }
2197
+ function init() {
2198
+ var drag = options.drag;
2199
+ disable(!drag);
2200
+ isFree = drag === "free";
2201
+ }
2202
+ function onPointerDown(e) {
2203
+ clickPrevented = false;
2204
+ if (!disabled) {
2205
+ var isTouch = isTouchEvent(e);
2206
+ if (isDraggable(e.target) && (isTouch || !e.button)) {
2207
+ if (!Controller2.isBusy()) {
2208
+ target = isTouch ? track : window;
2209
+ dragging = state.is([MOVING, SCROLLING]);
2210
+ prevBaseEvent = null;
2211
+ bind(target, POINTER_MOVE_EVENTS, onPointerMove, SCROLL_LISTENER_OPTIONS);
2212
+ bind(target, POINTER_UP_EVENTS, onPointerUp, SCROLL_LISTENER_OPTIONS);
2213
+ Move2.cancel();
2214
+ Scroll2.cancel();
2215
+ save(e);
2216
+ } else {
2217
+ prevent(e, true);
2218
+ }
2219
+ }
2220
+ }
2221
+ }
2222
+ function onPointerMove(e) {
2223
+ if (!state.is(DRAGGING)) {
2224
+ state.set(DRAGGING);
2225
+ emit(EVENT_DRAG);
2226
+ }
2227
+ if (e.cancelable) {
2228
+ if (dragging) {
2229
+ Move2.translate(basePosition + constrain(diffCoord(e)));
2230
+ var expired = diffTime(e) > LOG_INTERVAL;
2231
+ var hasExceeded = exceeded !== (exceeded = exceededLimit());
2232
+ if (expired || hasExceeded) {
2233
+ save(e);
2234
+ }
2235
+ clickPrevented = true;
2236
+ emit(EVENT_DRAGGING);
2237
+ prevent(e);
2238
+ } else if (isSliderDirection(e)) {
2239
+ dragging = shouldStart(e);
2240
+ prevent(e);
2241
+ }
2242
+ }
2243
+ }
2244
+ function onPointerUp(e) {
2245
+ if (state.is(DRAGGING)) {
2246
+ state.set(IDLE);
2247
+ emit(EVENT_DRAGGED);
2248
+ }
2249
+ if (dragging) {
2250
+ move(e);
2251
+ prevent(e);
2252
+ }
2253
+ unbind(target, POINTER_MOVE_EVENTS, onPointerMove);
2254
+ unbind(target, POINTER_UP_EVENTS, onPointerUp);
2255
+ dragging = false;
2256
+ }
2257
+ function onClick(e) {
2258
+ if (!disabled && clickPrevented) {
2259
+ prevent(e, true);
2260
+ }
2261
+ }
2262
+ function save(e) {
2263
+ prevBaseEvent = baseEvent;
2264
+ baseEvent = e;
2265
+ basePosition = getPosition();
2266
+ }
2267
+ function move(e) {
2268
+ var velocity = computeVelocity(e);
2269
+ var destination = computeDestination(velocity);
2270
+ var rewind = options.rewind && options.rewindByDrag;
2271
+ reduce(false);
2272
+ if (isFree) {
2273
+ Controller2.scroll(destination, 0, options.snap);
2274
+ } else if (Splide2.is(FADE)) {
2275
+ Controller2.go(orient(sign(velocity)) < 0 ? rewind ? "<" : "-" : rewind ? ">" : "+");
2276
+ } else if (Splide2.is(SLIDE) && exceeded && rewind) {
2277
+ Controller2.go(exceededLimit(true) ? ">" : "<");
2278
+ } else {
2279
+ Controller2.go(Controller2.toDest(destination), true);
2280
+ }
2281
+ reduce(true);
2282
+ }
2283
+ function shouldStart(e) {
2284
+ var thresholds = options.dragMinThreshold;
2285
+ var isObj = isObject(thresholds);
2286
+ var mouse = isObj && thresholds.mouse || 0;
2287
+ var touch = (isObj ? thresholds.touch : +thresholds) || 10;
2288
+ return abs(diffCoord(e)) > (isTouchEvent(e) ? touch : mouse);
2289
+ }
2290
+ function isSliderDirection(e) {
2291
+ return abs(diffCoord(e)) > abs(diffCoord(e, true));
2292
+ }
2293
+ function computeVelocity(e) {
2294
+ if (Splide2.is(LOOP) || !exceeded) {
2295
+ var time = diffTime(e);
2296
+ if (time && time < LOG_INTERVAL) {
2297
+ return diffCoord(e) / time;
2298
+ }
2299
+ }
2300
+ return 0;
2301
+ }
2302
+ function computeDestination(velocity) {
2303
+ return getPosition() + sign(velocity) * min(abs(velocity) * (options.flickPower || 600), isFree ? Infinity : Components2.Layout.listSize() * (options.flickMaxPages || 1));
2304
+ }
2305
+ function diffCoord(e, orthogonal) {
2306
+ return coordOf(e, orthogonal) - coordOf(getBaseEvent(e), orthogonal);
2307
+ }
2308
+ function diffTime(e) {
2309
+ return timeOf(e) - timeOf(getBaseEvent(e));
2310
+ }
2311
+ function getBaseEvent(e) {
2312
+ return baseEvent === e && prevBaseEvent || baseEvent;
2313
+ }
2314
+ function coordOf(e, orthogonal) {
2315
+ return (isTouchEvent(e) ? e.changedTouches[0] : e)["page" + resolve(orthogonal ? "Y" : "X")];
2316
+ }
2317
+ function constrain(diff) {
2318
+ return diff / (exceeded && Splide2.is(SLIDE) ? FRICTION : 1);
2319
+ }
2320
+ function isDraggable(target2) {
2321
+ var noDrag = options.noDrag;
2322
+ return !matches(target2, "." + CLASS_PAGINATION_PAGE + ", ." + CLASS_ARROW) && (!noDrag || !matches(target2, noDrag));
2323
+ }
2324
+ function isTouchEvent(e) {
2325
+ return typeof TouchEvent !== "undefined" && e instanceof TouchEvent;
2326
+ }
2327
+ function isDragging() {
2328
+ return dragging;
2329
+ }
2330
+ function disable(value) {
2331
+ disabled = value;
2332
+ }
2333
+ return {
2334
+ mount,
2335
+ disable,
2336
+ isDragging
2337
+ };
2338
+ }
2339
+ var NORMALIZATION_MAP = {
2340
+ Spacebar: " ",
2341
+ Right: ARROW_RIGHT,
2342
+ Left: ARROW_LEFT,
2343
+ Up: ARROW_UP,
2344
+ Down: ARROW_DOWN
2345
+ };
2346
+ function normalizeKey(key) {
2347
+ key = isString(key) ? key : key.key;
2348
+ return NORMALIZATION_MAP[key] || key;
2349
+ }
2350
+ var KEYBOARD_EVENT = "keydown";
2351
+ function Keyboard(Splide2, Components2, options) {
2352
+ var _EventInterface10 = EventInterface(Splide2), on = _EventInterface10.on, bind = _EventInterface10.bind, unbind = _EventInterface10.unbind;
2353
+ var root = Splide2.root;
2354
+ var resolve = Components2.Direction.resolve;
2355
+ var target;
2356
+ var disabled;
2357
+ function mount() {
2358
+ init();
2359
+ on(EVENT_UPDATED, destroy);
2360
+ on(EVENT_UPDATED, init);
2361
+ on(EVENT_MOVE, onMove);
2362
+ }
2363
+ function init() {
2364
+ var keyboard = options.keyboard;
2365
+ if (keyboard) {
2366
+ target = keyboard === "global" ? window : root;
2367
+ bind(target, KEYBOARD_EVENT, onKeydown);
2368
+ }
2369
+ }
2370
+ function destroy() {
2371
+ unbind(target, KEYBOARD_EVENT);
2372
+ }
2373
+ function disable(value) {
2374
+ disabled = value;
2375
+ }
2376
+ function onMove() {
2377
+ var _disabled = disabled;
2378
+ disabled = true;
2379
+ nextTick(function() {
2380
+ disabled = _disabled;
2381
+ });
2382
+ }
2383
+ function onKeydown(e) {
2384
+ if (!disabled) {
2385
+ var key = normalizeKey(e);
2386
+ if (key === resolve(ARROW_LEFT)) {
2387
+ Splide2.go("<");
2388
+ } else if (key === resolve(ARROW_RIGHT)) {
2389
+ Splide2.go(">");
2390
+ }
2391
+ }
2392
+ }
2393
+ return {
2394
+ mount,
2395
+ destroy,
2396
+ disable
2397
+ };
2398
+ }
2399
+ var SRC_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-lazy";
2400
+ var SRCSET_DATA_ATTRIBUTE = SRC_DATA_ATTRIBUTE + "-srcset";
2401
+ var IMAGE_SELECTOR = "[" + SRC_DATA_ATTRIBUTE + "], [" + SRCSET_DATA_ATTRIBUTE + "]";
2402
+ function LazyLoad(Splide2, Components2, options) {
2403
+ var _EventInterface11 = EventInterface(Splide2), on = _EventInterface11.on, off = _EventInterface11.off, bind = _EventInterface11.bind, emit = _EventInterface11.emit;
2404
+ var isSequential = options.lazyLoad === "sequential";
2405
+ var events = [EVENT_MOVED, EVENT_SCROLLED];
2406
+ var entries = [];
2407
+ function mount() {
2408
+ if (options.lazyLoad) {
2409
+ init();
2410
+ on(EVENT_REFRESH, init);
2411
+ }
2412
+ }
2413
+ function init() {
2414
+ empty(entries);
2415
+ register();
2416
+ if (isSequential) {
2417
+ loadNext();
2418
+ } else {
2419
+ off(events);
2420
+ on(events, check);
2421
+ check();
2422
+ }
2423
+ }
2424
+ function register() {
2425
+ Components2.Slides.forEach(function(Slide2) {
2426
+ queryAll(Slide2.slide, IMAGE_SELECTOR).forEach(function(img) {
2427
+ var src = getAttribute(img, SRC_DATA_ATTRIBUTE);
2428
+ var srcset = getAttribute(img, SRCSET_DATA_ATTRIBUTE);
2429
+ if (src !== img.src || srcset !== img.srcset) {
2430
+ var className = options.classes.spinner;
2431
+ var parent = img.parentElement;
2432
+ var spinner = child(parent, "." + className) || create("span", className, parent);
2433
+ entries.push([img, Slide2, spinner]);
2434
+ img.src || display(img, "none");
2435
+ }
2436
+ });
2437
+ });
2438
+ }
2439
+ function check() {
2440
+ entries = entries.filter(function(data) {
2441
+ var distance = options.perPage * ((options.preloadPages || 1) + 1) - 1;
2442
+ return data[1].isWithin(Splide2.index, distance) ? load(data) : true;
2443
+ });
2444
+ entries.length || off(events);
2445
+ }
2446
+ function load(data) {
2447
+ var img = data[0];
2448
+ addClass(data[1].slide, CLASS_LOADING);
2449
+ bind(img, "load error", apply(onLoad, data));
2450
+ setAttribute(img, "src", getAttribute(img, SRC_DATA_ATTRIBUTE));
2451
+ setAttribute(img, "srcset", getAttribute(img, SRCSET_DATA_ATTRIBUTE));
2452
+ removeAttribute(img, SRC_DATA_ATTRIBUTE);
2453
+ removeAttribute(img, SRCSET_DATA_ATTRIBUTE);
2454
+ }
2455
+ function onLoad(data, e) {
2456
+ var img = data[0], Slide2 = data[1];
2457
+ removeClass(Slide2.slide, CLASS_LOADING);
2458
+ if (e.type !== "error") {
2459
+ remove(data[2]);
2460
+ display(img, "");
2461
+ emit(EVENT_LAZYLOAD_LOADED, img, Slide2);
2462
+ emit(EVENT_RESIZE);
2463
+ }
2464
+ isSequential && loadNext();
2465
+ }
2466
+ function loadNext() {
2467
+ entries.length && load(entries.shift());
2468
+ }
2469
+ return {
2470
+ mount,
2471
+ destroy: apply(empty, entries),
2472
+ check
2473
+ };
2474
+ }
2475
+ function Pagination(Splide2, Components2, options) {
2476
+ var event = EventInterface(Splide2);
2477
+ var on = event.on, emit = event.emit, bind = event.bind;
2478
+ var Slides2 = Components2.Slides, Elements2 = Components2.Elements, Controller2 = Components2.Controller;
2479
+ var hasFocus = Controller2.hasFocus, getIndex = Controller2.getIndex, go = Controller2.go;
2480
+ var resolve = Components2.Direction.resolve;
2481
+ var placeholder = Elements2.pagination;
2482
+ var items = [];
2483
+ var list;
2484
+ var paginationClasses;
2485
+ function mount() {
2486
+ destroy();
2487
+ on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], mount);
2488
+ var enabled = options.pagination;
2489
+ placeholder && display(placeholder, enabled ? "" : "none");
2490
+ if (enabled) {
2491
+ on([EVENT_MOVE, EVENT_SCROLL, EVENT_SCROLLED], update);
2492
+ createPagination();
2493
+ update();
2494
+ emit(EVENT_PAGINATION_MOUNTED, {
2495
+ list,
2496
+ items
2497
+ }, getAt(Splide2.index));
2498
+ }
2499
+ }
2500
+ function destroy() {
2501
+ if (list) {
2502
+ remove(placeholder ? slice(list.children) : list);
2503
+ removeClass(list, paginationClasses);
2504
+ empty(items);
2505
+ list = null;
2506
+ }
2507
+ event.destroy();
2508
+ }
2509
+ function createPagination() {
2510
+ var length = Splide2.length;
2511
+ var classes = options.classes, i18n = options.i18n, perPage = options.perPage;
2512
+ var max2 = hasFocus() ? Controller2.getEnd() + 1 : ceil(length / perPage);
2513
+ list = placeholder || create("ul", classes.pagination, Elements2.track.parentElement);
2514
+ addClass(list, paginationClasses = CLASS_PAGINATION + "--" + getDirection());
2515
+ setAttribute(list, ROLE, "tablist");
2516
+ setAttribute(list, ARIA_LABEL, i18n.select);
2517
+ setAttribute(list, ARIA_ORIENTATION, getDirection() === TTB ? "vertical" : "");
2518
+ for (var i = 0; i < max2; i++) {
2519
+ var li = create("li", null, list);
2520
+ var button = create("button", {
2521
+ class: classes.page,
2522
+ type: "button"
2523
+ }, li);
2524
+ var controls = Slides2.getIn(i).map(function(Slide2) {
2525
+ return Slide2.slide.id;
2526
+ });
2527
+ var text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX;
2528
+ bind(button, "click", apply(onClick, i));
2529
+ if (options.paginationKeyboard) {
2530
+ bind(button, "keydown", apply(onKeydown, i));
2531
+ }
2532
+ setAttribute(li, ROLE, "presentation");
2533
+ setAttribute(button, ROLE, "tab");
2534
+ setAttribute(button, ARIA_CONTROLS, controls.join(" "));
2535
+ setAttribute(button, ARIA_LABEL, format(text, i + 1));
2536
+ setAttribute(button, TAB_INDEX, -1);
2537
+ items.push({
2538
+ li,
2539
+ button,
2540
+ page: i
2541
+ });
2542
+ }
2543
+ }
2544
+ function onClick(page) {
2545
+ go(">" + page, true);
2546
+ }
2547
+ function onKeydown(page, e) {
2548
+ var length = items.length;
2549
+ var key = normalizeKey(e);
2550
+ var dir = getDirection();
2551
+ var nextPage = -1;
2552
+ if (key === resolve(ARROW_RIGHT, false, dir)) {
2553
+ nextPage = ++page % length;
2554
+ } else if (key === resolve(ARROW_LEFT, false, dir)) {
2555
+ nextPage = (--page + length) % length;
2556
+ } else if (key === "Home") {
2557
+ nextPage = 0;
2558
+ } else if (key === "End") {
2559
+ nextPage = length - 1;
2560
+ }
2561
+ var item = items[nextPage];
2562
+ if (item) {
2563
+ focus(item.button);
2564
+ go(">" + nextPage);
2565
+ prevent(e, true);
2566
+ }
2567
+ }
2568
+ function getDirection() {
2569
+ return options.paginationDirection || options.direction;
2570
+ }
2571
+ function getAt(index) {
2572
+ return items[Controller2.toPage(index)];
2573
+ }
2574
+ function update() {
2575
+ var prev = getAt(getIndex(true));
2576
+ var curr = getAt(getIndex());
2577
+ if (prev) {
2578
+ var button = prev.button;
2579
+ removeClass(button, CLASS_ACTIVE);
2580
+ removeAttribute(button, ARIA_SELECTED);
2581
+ setAttribute(button, TAB_INDEX, -1);
2582
+ }
2583
+ if (curr) {
2584
+ var _button = curr.button;
2585
+ addClass(_button, CLASS_ACTIVE);
2586
+ setAttribute(_button, ARIA_SELECTED, true);
2587
+ setAttribute(_button, TAB_INDEX, "");
2588
+ }
2589
+ emit(EVENT_PAGINATION_UPDATED, {
2590
+ list,
2591
+ items
2592
+ }, prev, curr);
2593
+ }
2594
+ return {
2595
+ items,
2596
+ mount,
2597
+ destroy,
2598
+ getAt,
2599
+ update
2600
+ };
2601
+ }
2602
+ var TRIGGER_KEYS = [" ", "Enter"];
2603
+ function Sync(Splide2, Components2, options) {
2604
+ var isNavigation = options.isNavigation, slideFocus = options.slideFocus;
2605
+ var events = [];
2606
+ function mount() {
2607
+ Splide2.splides.forEach(function(target) {
2608
+ if (!target.isParent) {
2609
+ sync(Splide2, target.splide);
2610
+ sync(target.splide, Splide2);
2611
+ }
2612
+ });
2613
+ if (isNavigation) {
2614
+ navigate();
2615
+ }
2616
+ }
2617
+ function destroy() {
2618
+ events.forEach(function(event) {
2619
+ event.destroy();
2620
+ });
2621
+ empty(events);
2622
+ }
2623
+ function remount() {
2624
+ destroy();
2625
+ mount();
2626
+ }
2627
+ function sync(splide, target) {
2628
+ var event = EventInterface(splide);
2629
+ event.on(EVENT_MOVE, function(index, prev, dest) {
2630
+ target.go(target.is(LOOP) ? dest : index);
2631
+ });
2632
+ events.push(event);
2633
+ }
2634
+ function navigate() {
2635
+ var event = EventInterface(Splide2);
2636
+ var on = event.on;
2637
+ on(EVENT_CLICK, onClick);
2638
+ on(EVENT_SLIDE_KEYDOWN, onKeydown);
2639
+ on([EVENT_MOUNTED, EVENT_UPDATED], update);
2640
+ events.push(event);
2641
+ event.emit(EVENT_NAVIGATION_MOUNTED, Splide2.splides);
2642
+ }
2643
+ function update() {
2644
+ setAttribute(Components2.Elements.list, ARIA_ORIENTATION, options.direction === TTB ? "vertical" : "");
2645
+ }
2646
+ function onClick(Slide2) {
2647
+ Splide2.go(Slide2.index);
2648
+ }
2649
+ function onKeydown(Slide2, e) {
2650
+ if (includes(TRIGGER_KEYS, normalizeKey(e))) {
2651
+ onClick(Slide2);
2652
+ prevent(e);
2653
+ }
2654
+ }
2655
+ return {
2656
+ setup: apply(Components2.Media.set, {
2657
+ slideFocus: isUndefined(slideFocus) ? isNavigation : slideFocus
2658
+ }, true),
2659
+ mount,
2660
+ destroy,
2661
+ remount
2662
+ };
2663
+ }
2664
+ function Wheel(Splide2, Components2, options) {
2665
+ var _EventInterface12 = EventInterface(Splide2), bind = _EventInterface12.bind;
2666
+ var lastTime = 0;
2667
+ function mount() {
2668
+ if (options.wheel) {
2669
+ bind(Components2.Elements.track, "wheel", onWheel, SCROLL_LISTENER_OPTIONS);
2670
+ }
2671
+ }
2672
+ function onWheel(e) {
2673
+ if (e.cancelable) {
2674
+ var deltaY = e.deltaY;
2675
+ var backwards = deltaY < 0;
2676
+ var timeStamp = timeOf(e);
2677
+ var _min = options.wheelMinThreshold || 0;
2678
+ var sleep = options.wheelSleep || 0;
2679
+ if (abs(deltaY) > _min && timeStamp - lastTime > sleep) {
2680
+ Splide2.go(backwards ? "<" : ">");
2681
+ lastTime = timeStamp;
2682
+ }
2683
+ shouldPrevent(backwards) && prevent(e);
2684
+ }
2685
+ }
2686
+ function shouldPrevent(backwards) {
2687
+ return !options.releaseWheel || Splide2.state.is(MOVING) || Components2.Controller.getAdjacent(backwards) !== -1;
2688
+ }
2689
+ return {
2690
+ mount
2691
+ };
2692
+ }
2693
+ var SR_REMOVAL_DELAY = 90;
2694
+ function Live(Splide2, Components2, options) {
2695
+ var _EventInterface13 = EventInterface(Splide2), on = _EventInterface13.on;
2696
+ var track = Components2.Elements.track;
2697
+ var enabled = options.live && !options.isNavigation;
2698
+ var sr = create("span", CLASS_SR);
2699
+ var interval = RequestInterval(SR_REMOVAL_DELAY, apply(toggle, false));
2700
+ function mount() {
2701
+ if (enabled) {
2702
+ disable(!Components2.Autoplay.isPaused());
2703
+ setAttribute(track, ARIA_ATOMIC, true);
2704
+ sr.textContent = "\u2026";
2705
+ on(EVENT_AUTOPLAY_PLAY, apply(disable, true));
2706
+ on(EVENT_AUTOPLAY_PAUSE, apply(disable, false));
2707
+ on([EVENT_MOVED, EVENT_SCROLLED], apply(toggle, true));
2708
+ }
2709
+ }
2710
+ function toggle(active) {
2711
+ setAttribute(track, ARIA_BUSY, active);
2712
+ if (active) {
2713
+ append(track, sr);
2714
+ interval.start();
2715
+ } else {
2716
+ remove(sr);
2717
+ interval.cancel();
2718
+ }
2719
+ }
2720
+ function destroy() {
2721
+ removeAttribute(track, [ARIA_LIVE, ARIA_ATOMIC, ARIA_BUSY]);
2722
+ remove(sr);
2723
+ }
2724
+ function disable(disabled) {
2725
+ if (enabled) {
2726
+ setAttribute(track, ARIA_LIVE, disabled ? "off" : "polite");
2727
+ }
2728
+ }
2729
+ return {
2730
+ mount,
2731
+ disable,
2732
+ destroy
2733
+ };
2734
+ }
2735
+ var ComponentConstructors = /* @__PURE__ */ Object.freeze({
2736
+ __proto__: null,
2737
+ Media,
2738
+ Direction,
2739
+ Elements,
2740
+ Slides,
2741
+ Layout,
2742
+ Clones,
2743
+ Move,
2744
+ Controller,
2745
+ Arrows,
2746
+ Autoplay,
2747
+ Cover,
2748
+ Scroll,
2749
+ Drag,
2750
+ Keyboard,
2751
+ LazyLoad,
2752
+ Pagination,
2753
+ Sync,
2754
+ Wheel,
2755
+ Live
2756
+ });
2757
+ var I18N = {
2758
+ prev: "Previous slide",
2759
+ next: "Next slide",
2760
+ first: "Go to first slide",
2761
+ last: "Go to last slide",
2762
+ slideX: "Go to slide %s",
2763
+ pageX: "Go to page %s",
2764
+ play: "Start autoplay",
2765
+ pause: "Pause autoplay",
2766
+ carousel: "carousel",
2767
+ slide: "slide",
2768
+ select: "Select a slide to show",
2769
+ slideLabel: "%s of %s"
2770
+ };
2771
+ var DEFAULTS = {
2772
+ type: "slide",
2773
+ role: "region",
2774
+ speed: 400,
2775
+ perPage: 1,
2776
+ cloneStatus: true,
2777
+ arrows: true,
2778
+ pagination: true,
2779
+ paginationKeyboard: true,
2780
+ interval: 5e3,
2781
+ pauseOnHover: true,
2782
+ pauseOnFocus: true,
2783
+ resetProgress: true,
2784
+ easing: "cubic-bezier(0.25, 1, 0.5, 1)",
2785
+ drag: true,
2786
+ direction: "ltr",
2787
+ trimSpace: true,
2788
+ focusableNodes: "a, button, textarea, input, select, iframe",
2789
+ live: true,
2790
+ classes: CLASSES,
2791
+ i18n: I18N,
2792
+ reducedMotion: {
2793
+ speed: 0,
2794
+ rewindSpeed: 0,
2795
+ autoplay: "pause"
2796
+ }
2797
+ };
2798
+ function Fade(Splide2, Components2, options) {
2799
+ var Slides2 = Components2.Slides;
2800
+ function mount() {
2801
+ EventInterface(Splide2).on([EVENT_MOUNTED, EVENT_REFRESH], init);
2802
+ }
2803
+ function init() {
2804
+ Slides2.forEach(function(Slide2) {
2805
+ Slide2.style("transform", "translateX(-" + 100 * Slide2.index + "%)");
2806
+ });
2807
+ }
2808
+ function start(index, done) {
2809
+ Slides2.style("transition", "opacity " + options.speed + "ms " + options.easing);
2810
+ nextTick(done);
2811
+ }
2812
+ return {
2813
+ mount,
2814
+ start,
2815
+ cancel: noop
2816
+ };
2817
+ }
2818
+ function Slide(Splide2, Components2, options) {
2819
+ var Move2 = Components2.Move, Controller2 = Components2.Controller, Scroll2 = Components2.Scroll;
2820
+ var list = Components2.Elements.list;
2821
+ var transition = apply(style, list, "transition");
2822
+ var endCallback;
2823
+ function mount() {
2824
+ EventInterface(Splide2).bind(list, "transitionend", function(e) {
2825
+ if (e.target === list && endCallback) {
2826
+ cancel();
2827
+ endCallback();
2828
+ }
2829
+ });
2830
+ }
2831
+ function start(index, done) {
2832
+ var destination = Move2.toPosition(index, true);
2833
+ var position = Move2.getPosition();
2834
+ var speed = getSpeed(index);
2835
+ if (abs(destination - position) >= 1 && speed >= 1) {
2836
+ if (options.useScroll) {
2837
+ Scroll2.scroll(destination, speed, false, done);
2838
+ } else {
2839
+ transition("transform " + speed + "ms " + options.easing);
2840
+ Move2.translate(destination, true);
2841
+ endCallback = done;
2842
+ }
2843
+ } else {
2844
+ Move2.jump(index);
2845
+ done();
2846
+ }
2847
+ }
2848
+ function cancel() {
2849
+ transition("");
2850
+ Scroll2.cancel();
2851
+ }
2852
+ function getSpeed(index) {
2853
+ var rewindSpeed = options.rewindSpeed;
2854
+ if (Splide2.is(SLIDE) && rewindSpeed) {
2855
+ var prev = Controller2.getIndex(true);
2856
+ var end = Controller2.getEnd();
2857
+ if (prev === 0 && index >= end || prev >= end && index === 0) {
2858
+ return rewindSpeed;
2859
+ }
2860
+ }
2861
+ return options.speed;
2862
+ }
2863
+ return {
2864
+ mount,
2865
+ start,
2866
+ cancel
2867
+ };
2868
+ }
2869
+ var _Splide = /* @__PURE__ */ function() {
2870
+ function _Splide2(target, options) {
2871
+ this.event = EventInterface();
2872
+ this.Components = {};
2873
+ this.state = State(CREATED);
2874
+ this.splides = [];
2875
+ this._o = {};
2876
+ this._E = {};
2877
+ var root = isString(target) ? query(document, target) : target;
2878
+ assert(root, root + " is invalid.");
2879
+ this.root = root;
2880
+ options = merge({
2881
+ label: getAttribute(root, ARIA_LABEL) || "",
2882
+ labelledby: getAttribute(root, ARIA_LABELLEDBY) || ""
2883
+ }, DEFAULTS, _Splide2.defaults, options || {});
2884
+ try {
2885
+ merge(options, JSON.parse(getAttribute(root, DATA_ATTRIBUTE)));
2886
+ } catch (e) {
2887
+ assert(false, "Invalid JSON");
2888
+ }
2889
+ this._o = Object.create(merge({}, options));
2890
+ }
2891
+ var _proto = _Splide2.prototype;
2892
+ _proto.mount = function mount(Extensions, Transition) {
2893
+ var _this = this;
2894
+ var state = this.state, Components2 = this.Components;
2895
+ assert(state.is([CREATED, DESTROYED]), "Already mounted!");
2896
+ state.set(CREATED);
2897
+ this._C = Components2;
2898
+ this._T = Transition || this._T || (this.is(FADE) ? Fade : Slide);
2899
+ this._E = Extensions || this._E;
2900
+ var Constructors = assign({}, ComponentConstructors, this._E, {
2901
+ Transition: this._T
2902
+ });
2903
+ forOwn(Constructors, function(Component, key) {
2904
+ var component = Component(_this, Components2, _this._o);
2905
+ Components2[key] = component;
2906
+ component.setup && component.setup();
2907
+ });
2908
+ forOwn(Components2, function(component) {
2909
+ component.mount && component.mount();
2910
+ });
2911
+ this.emit(EVENT_MOUNTED);
2912
+ addClass(this.root, CLASS_INITIALIZED);
2913
+ state.set(IDLE);
2914
+ this.emit(EVENT_READY);
2915
+ return this;
2916
+ };
2917
+ _proto.sync = function sync(splide) {
2918
+ this.splides.push({
2919
+ splide
2920
+ });
2921
+ splide.splides.push({
2922
+ splide: this,
2923
+ isParent: true
2924
+ });
2925
+ if (this.state.is(IDLE)) {
2926
+ this._C.Sync.remount();
2927
+ splide.Components.Sync.remount();
2928
+ }
2929
+ return this;
2930
+ };
2931
+ _proto.go = function go(control) {
2932
+ this._C.Controller.go(control);
2933
+ return this;
2934
+ };
2935
+ _proto.on = function on(events, callback) {
2936
+ this.event.on(events, callback);
2937
+ return this;
2938
+ };
2939
+ _proto.off = function off(events) {
2940
+ this.event.off(events);
2941
+ return this;
2942
+ };
2943
+ _proto.emit = function emit(event) {
2944
+ var _this$event;
2945
+ (_this$event = this.event).emit.apply(_this$event, [event].concat(slice(arguments, 1)));
2946
+ return this;
2947
+ };
2948
+ _proto.add = function add(slides, index) {
2949
+ this._C.Slides.add(slides, index);
2950
+ return this;
2951
+ };
2952
+ _proto.remove = function remove2(matcher) {
2953
+ this._C.Slides.remove(matcher);
2954
+ return this;
2955
+ };
2956
+ _proto.is = function is(type) {
2957
+ return this._o.type === type;
2958
+ };
2959
+ _proto.refresh = function refresh() {
2960
+ this.emit(EVENT_REFRESH);
2961
+ return this;
2962
+ };
2963
+ _proto.destroy = function destroy(completely) {
2964
+ if (completely === void 0) {
2965
+ completely = true;
2966
+ }
2967
+ var event = this.event, state = this.state;
2968
+ if (state.is(CREATED)) {
2969
+ EventInterface(this).on(EVENT_READY, this.destroy.bind(this, completely));
2970
+ } else {
2971
+ forOwn(this._C, function(component) {
2972
+ component.destroy && component.destroy(completely);
2973
+ }, true);
2974
+ event.emit(EVENT_DESTROY);
2975
+ event.destroy();
2976
+ completely && empty(this.splides);
2977
+ state.set(DESTROYED);
2978
+ }
2979
+ return this;
2980
+ };
2981
+ _createClass(_Splide2, [{
2982
+ key: "options",
2983
+ get: function get() {
2984
+ return this._o;
2985
+ },
2986
+ set: function set(options) {
2987
+ this._C.Media.set(options, true, true);
2988
+ }
2989
+ }, {
2990
+ key: "length",
2991
+ get: function get() {
2992
+ return this._C.Slides.getLength(true);
2993
+ }
2994
+ }, {
2995
+ key: "index",
2996
+ get: function get() {
2997
+ return this._C.Controller.getIndex();
2998
+ }
2999
+ }]);
3000
+ return _Splide2;
3001
+ }();
3002
+ var Splide = _Splide;
3003
+ Splide.defaults = {};
3004
+ Splide.STATES = STATES;
3005
+
3006
+ // src/utils/buildQueryParams.ts
3007
+ var buildQueryParams = (queryParams) => {
3008
+ let url = "?";
3009
+ for (const [key, value] of Object.entries(queryParams)) {
3010
+ if (value) {
3011
+ url += `${key}=${value}&`;
3012
+ }
3013
+ }
3014
+ return url;
3015
+ };
3016
+
3017
+ // src/utils/ApiClient.ts
3018
+ var ApiClient = class {
3019
+ /**
3020
+ *
3021
+ * @param queryParams to include as part of query for the request
3022
+ * @returns offers data for a group of hotels
3023
+ */
3024
+ async getGroupOffersData(queryParams) {
3025
+ const url = apiBaseUrl + "groupOffers" + buildQueryParams(queryParams);
3026
+ const response = await fetch(url);
3027
+ const body = await response.json();
3028
+ if (body.error || !body.data)
3029
+ return null;
3030
+ return body;
3031
+ }
3032
+ /**
3033
+ *
3034
+ * @param queryParams to include as part of query for the request
3035
+ * @returns offers data for a single hotel
3036
+ */
3037
+ async getSingleHotelOffersData(queryParams) {
3038
+ const url = apiBaseUrl + "offers" + buildQueryParams(queryParams);
3039
+ const response = await fetch(url);
3040
+ const body = await response.json();
3041
+ if (body.error || !body.data)
3042
+ return null;
3043
+ return body;
3044
+ }
3045
+ /**
3046
+ *
3047
+ * @param queryParams to include as part of query for the request
3048
+ * @returns Starting CMS offers data
3049
+ */
3050
+ async getCMSOffers() {
3051
+ const url = apiBaseUrl + "cmsOffers";
3052
+ const response = await fetch(url);
3053
+ const body = await response.json();
3054
+ if (!body.items)
3055
+ return null;
3056
+ return body;
3057
+ }
3058
+ /**
3059
+ * @returns all CMS countries
3060
+ */
3061
+ async getCountries() {
3062
+ const url = apiBaseUrl + "cmsCountries";
3063
+ const response = await fetch(url);
3064
+ const body = await response.json();
3065
+ if (!body.items)
3066
+ return null;
3067
+ return body;
3068
+ }
3069
+ };
3070
+
3071
+ // src/utils/countries/userCountry.ts
3072
+ var getUserCountryCode = async () => {
3073
+ return new Promise((resolve) => {
3074
+ geoip2.country(
3075
+ (successResponse) => {
3076
+ resolve(successResponse.country.iso_code);
3077
+ },
3078
+ () => {
3079
+ resolve(DEFAULT_COUNTRY_CODE);
3080
+ }
3081
+ );
3082
+ });
3083
+ };
3084
+
3085
+ // src/utils/utils.ts
3086
+ var listenForLanguageChange = () => {
3087
+ const isitProduction = isProduction();
3088
+ if (!isitProduction) {
3089
+ const currentStagingLang = localStorage.getItem("wglang") || "fr";
3090
+ window.Weglot.switchTo(currentStagingLang);
3091
+ }
3092
+ window.Weglot.on("languageChanged", () => {
3093
+ if (isitProduction) {
3094
+ window.location.reload();
3095
+ } else {
3096
+ const newLang = window.Weglot.getCurrentLang();
3097
+ localStorage.setItem("wglang", newLang);
3098
+ if (window.loadFromServer) {
3099
+ window.loadFromServer();
3100
+ }
3101
+ }
3102
+ });
3103
+ };
3104
+ var isProduction = () => {
3105
+ return window.location.hostname !== "deshotelsetdesiles.webflow.io";
3106
+ };
3107
+ var getLocale = () => {
3108
+ const lang = getLanguage();
3109
+ return LANG_TO_LOCALE[lang];
3110
+ };
3111
+ var getLanguage = () => {
3112
+ if (!isProduction()) {
3113
+ return localStorage.getItem("wglang") || "fr";
3114
+ }
3115
+ try {
3116
+ const language = window.Weglot.getCurrentLang();
3117
+ if (language) {
3118
+ return language;
3119
+ }
3120
+ } catch (error) {
3121
+ console.error("Error getting language", error);
3122
+ return "fr";
3123
+ }
3124
+ return "fr";
3125
+ };
3126
+ var offerSlug = (hotelId, offerName) => {
3127
+ return `${hotelId.toLowerCase().trim()}-${offerName.toLowerCase().trim()}`;
3128
+ };
3129
+ var hotelAndFlightURL = (currency, hotelID, accessCodeValue) => {
3130
+ const lang = getLanguage().toUpperCase();
3131
+ const hotelCode = SNIPPET_CODE_TO_HOTEL[hotelID].codeIPlanet.toUpperCase();
3132
+ let url = `${hotelAndFlightURLBaseUrl}?Lang=${lang}&currency=${currency.toUpperCase()}&HotelCode=${hotelCode}`;
3133
+ const gaTag = getCookie("_ga");
3134
+ const glTag = GTM_GL;
3135
+ const gclAuTag = getCookie("_gcl_au");
3136
+ url += `&_ga=${gaTag}&_gl=${glTag}&_gcl_au=${gclAuTag}`;
3137
+ if (accessCodeValue) {
3138
+ url = `${url}&HotelPromo=${accessCodeValue}`;
3139
+ }
3140
+ return url;
3141
+ };
3142
+ var getCookie = (name) => {
3143
+ const match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
3144
+ return match ? match[2] : null;
3145
+ };
3146
+
3147
+ // src/utils/bindQuotationData.ts
3148
+ var bindQuotationData = (container, rate, hotelId, cmsOfferData) => {
3149
+ const {
3150
+ quotation,
3151
+ rate: { distribution }
3152
+ } = rate;
3153
+ const { pricePerNight, currency, plainBookLink } = quotation;
3154
+ const { accessCode } = distribution || {};
3155
+ let accessCodeValue = "";
3156
+ if (accessCode && accessCode.length > 0) {
3157
+ [accessCodeValue] = accessCode;
3158
+ }
3159
+ updatePriceElement(container, pricePerNight, currency);
3160
+ const hotelReserveEls = container.querySelector(SELECTORS.hotelReserveLink);
3161
+ if (hotelReserveEls) {
3162
+ hotelReserveEls.addEventListener("click", (e) => {
3163
+ e.preventDefault();
3164
+ e.stopPropagation();
3165
+ window.open(plainBookLink, "_blank");
3166
+ });
3167
+ }
3168
+ const hotelVillaReserveEl = container.querySelector(
3169
+ SELECTORS.hotelVillaReserveLink
3170
+ );
3171
+ if (hotelVillaReserveEl) {
3172
+ hotelVillaReserveEl.addEventListener("click", (e) => {
3173
+ e.preventDefault();
3174
+ e.stopPropagation();
3175
+ window.open(hotelAndFlightURL(currency, hotelId, accessCodeValue), "_blank");
3176
+ });
3177
+ }
3178
+ if (cmsOfferData) {
3179
+ const {
3180
+ fieldData: { "discount-percentage": discountPercentage }
3181
+ } = cmsOfferData;
3182
+ const discountEl = container.querySelector(SELECTORS.discount);
3183
+ if (discountEl && discountPercentage)
3184
+ discountEl.innerHTML = `-${discountPercentage}%`;
3185
+ const discountContainerEl = container.querySelector(
3186
+ SELECTORS.discountContainer
3187
+ );
3188
+ if (discountContainerEl && !discountPercentage) {
3189
+ discountContainerEl.style.display = "none";
3190
+ }
3191
+ }
3192
+ };
3193
+ var updatePriceElement = (container, pricePerNight, currency) => {
3194
+ const priceEl = container.querySelector(SELECTORS.price);
3195
+ if (priceEl)
3196
+ priceEl.innerHTML = Math.floor(pricePerNight).toString();
3197
+ const currencyEl = container.querySelector(SELECTORS.currency);
3198
+ if (currencyEl)
3199
+ currencyEl.innerHTML = CURRENCY_TO_SYMBOL[currency];
3200
+ };
3201
+
3202
+ // src/utils/Hotels.ts
3203
+ var Hotel = class {
3204
+ /**
3205
+ *
3206
+ * @param listInstance The list instance to add the items to.
3207
+ * @param itemTemplateElement The template element to create the items from.
3208
+ * @param hotelsId The hotel ID to get the offers for.
3209
+ * @param offersListContainer The container for the offers list.
3210
+ */
3211
+ constructor(listInstance, itemTemplateElement, hotelsId, offersListContainer) {
3212
+ this.listInstance = listInstance;
3213
+ this.itemTemplateElement = itemTemplateElement;
3214
+ this.hotelsId = hotelsId;
3215
+ this.offersListContainer = offersListContainer;
3216
+ this.listInstance = listInstance;
3217
+ this.itemTemplateElement = itemTemplateElement.cloneNode(true);
3218
+ this.hotelsId = hotelsId;
3219
+ this.listInstance.innerHTML = "";
3220
+ this.offersPopupEl = document.querySelector(SELECTORS.offersPopup);
3221
+ this.countryCode = DEFAULT_COUNTRY_CODE;
3222
+ listenForLanguageChange();
3223
+ }
3224
+ // The popup element that displays the offer details
3225
+ offersPopupEl;
3226
+ /** The user's country code */
3227
+ countryCode;
3228
+ /** All available countries in CMS */
3229
+ availableCountries = {};
3230
+ /** A lookup object for the cms offers data */
3231
+ offerLookup = {};
3232
+ /** The api client */
3233
+ apiClient = new ApiClient();
3234
+ /**
3235
+ * Sets up the Splide slider for the offers list.
3236
+ */
3237
+ setupSplider() {
3238
+ const splide = new Splide("#is-splide3-second", {
3239
+ autoWidth: true,
3240
+ type: "loop",
3241
+ gap: "1.25rem",
3242
+ pagination: false,
3243
+ breakpoints: {
3244
+ 767: {
3245
+ gap: "0.625rem"
3246
+ }
3247
+ }
3248
+ });
3249
+ splide.mount();
3250
+ if (window.innerWidth >= 1110) {
3251
+ const slideCount = splide.length;
3252
+ const bar = splide.root.querySelector(".splide__progress-bar");
3253
+ const progress = splide.root.querySelector(".splide__progress");
3254
+ const arrows = splide.root.querySelector(".splide__arrows");
3255
+ if (slideCount <= 2) {
3256
+ splide.options = {
3257
+ type: "slide",
3258
+ drag: false
3259
+ };
3260
+ if (bar) {
3261
+ bar.style.display = "none";
3262
+ }
3263
+ if (progress) {
3264
+ progress.style.display = "none";
3265
+ }
3266
+ if (arrows) {
3267
+ arrows.style.display = "none";
3268
+ }
3269
+ splide.refresh();
3270
+ } else {
3271
+ const bar2 = splide.root.querySelector(".splide__progress-bar");
3272
+ splide.on("move", function() {
3273
+ const end = splide.Components.Controller.getEnd() + 1;
3274
+ const rate = Math.min((splide.index + 1) / end, 1);
3275
+ if (bar2) {
3276
+ bar2.style.width = String(100 * rate) + "%";
3277
+ }
3278
+ });
3279
+ const progress2 = splide.root.querySelector(".splide__progress");
3280
+ if (progress2) {
3281
+ progress2.addEventListener("click", function(event) {
3282
+ const clickedPosition = event.clientX - progress2.getBoundingClientRect().left;
3283
+ const slideIndex = Math.floor(clickedPosition / (progress2.offsetWidth / splide.length));
3284
+ splide.go(slideIndex);
3285
+ });
3286
+ }
3287
+ }
3288
+ }
3289
+ }
3290
+ /**
3291
+ * Creates an item from the template element.
3292
+ * @param rate The Rate data to create the item from.
3293
+ * @param templateElement The template element.
3294
+ *
3295
+ * @returns A new Collection Item element.
3296
+ */
3297
+ createItem(offerProperty, rate, templateElement) {
3298
+ const { rate: rateData } = rate;
3299
+ const { hid, title: hotelName, property } = offerProperty;
3300
+ const { destination, slug } = SNIPPET_CODE_TO_HOTEL[property];
3301
+ const { image, title, html_description } = rateData;
3302
+ const newItem = templateElement.cloneNode(true);
3303
+ newItem.removeAttribute("id");
3304
+ this.bindOffersMetaData(newItem, { destination, image, hotelName, title, slug });
3305
+ bindQuotationData(newItem, rate, hid || property);
3306
+ const moreDetailsLinks = newItem.querySelectorAll(SELECTORS.moreDetails);
3307
+ moreDetailsLinks.forEach((el) => {
3308
+ el.addEventListener("click", () => {
3309
+ if (this.offersPopupEl) {
3310
+ this.bindOffersMetaData(this.offersPopupEl, {
3311
+ destination,
3312
+ image,
3313
+ hotelName,
3314
+ title,
3315
+ slug,
3316
+ description: html_description
3317
+ });
3318
+ bindQuotationData(this.offersPopupEl, rate, hid || property);
3319
+ this.offersPopupEl.style["opacity"] = "1";
3320
+ this.offersPopupEl.style["display"] = "flex";
3321
+ const popupCloseBtn = newItem.querySelector(SELECTORS.offersPopupClose);
3322
+ if (popupCloseBtn) {
3323
+ popupCloseBtn.addEventListener("click", () => {
3324
+ if (this.offersPopupEl) {
3325
+ this.offersPopupEl.style["opacity"] = "0";
3326
+ this.offersPopupEl.style["display"] = "none";
3327
+ }
3328
+ });
3329
+ }
3330
+ const popupOverlay = this.offersPopupEl.querySelector(
3331
+ SELECTORS.popupOverlay
3332
+ );
3333
+ if (popupOverlay) {
3334
+ popupOverlay.addEventListener("click", (e) => {
3335
+ e.stopPropagation();
3336
+ e.preventDefault();
3337
+ if (this.offersPopupEl) {
3338
+ this.offersPopupEl.style["opacity"] = "0";
3339
+ this.offersPopupEl.style["display"] = "none";
3340
+ }
3341
+ });
3342
+ }
3343
+ }
3344
+ });
3345
+ });
3346
+ return newItem;
3347
+ }
3348
+ /**
3349
+ *
3350
+ * @param container for data item
3351
+ * @param destination for offer
3352
+ * @param image for offer
3353
+ * @param hotelName for hotel
3354
+ * @param title for offer
3355
+ */
3356
+ bindOffersMetaData(container, {
3357
+ destination,
3358
+ image,
3359
+ hotelName,
3360
+ title,
3361
+ slug,
3362
+ description
3363
+ }) {
3364
+ const destinationEl = container.querySelector(SELECTORS.destination);
3365
+ const imageEl = container.querySelector(SELECTORS.image);
3366
+ const hotelNameEl = container.querySelector(SELECTORS.hotelName);
3367
+ const nameEl = container.querySelector(SELECTORS.name);
3368
+ const descriptionEl = container.querySelector(SELECTORS.description);
3369
+ const hotelLinkEl = container.querySelector(SELECTORS.hotelLink);
3370
+ const language = getLanguage();
3371
+ if (destinationEl)
3372
+ destinationEl.textContent = destination[language];
3373
+ if (imageEl)
3374
+ imageEl.src = image?.url;
3375
+ if (hotelNameEl)
3376
+ hotelNameEl.innerHTML = hotelName;
3377
+ if (nameEl)
3378
+ nameEl.innerHTML = title;
3379
+ if (descriptionEl && description)
3380
+ descriptionEl.innerHTML = description;
3381
+ if (hotelLinkEl && slug) {
3382
+ hotelLinkEl.addEventListener("click", () => {
3383
+ window.location.href = slug;
3384
+ });
3385
+ }
3386
+ }
3387
+ /**
3388
+ * Retrieve hotel offers for given hotel ID
3389
+ * @param locale to query the data with
3390
+ */
3391
+ async getOffers() {
3392
+ const cmsOffersData = await this.apiClient.getCMSOffers();
3393
+ if (!cmsOffersData)
3394
+ return;
3395
+ const cmsCountries = await this.apiClient.getCountries();
3396
+ if (!cmsCountries)
3397
+ return;
3398
+ cmsCountries.items.forEach((c) => {
3399
+ this.availableCountries[c.id] = c.fieldData.title?.trim();
3400
+ });
3401
+ this.countryCode = await getUserCountryCode();
3402
+ const filteredOffers = cmsOffersData.items.filter(this.countryCodeFilter);
3403
+ const { offerMetaData } = this.generateOfferData(filteredOffers);
3404
+ const hotelOffersData = await this.getOffersData({
3405
+ property: this.hotelsId,
3406
+ locale: getLocale()
3407
+ });
3408
+ if (hotelOffersData?.data) {
3409
+ const { prop, rates } = hotelOffersData.data;
3410
+ let addedItems = 0;
3411
+ rates.forEach((item) => {
3412
+ const rateName = item.rate.name;
3413
+ const slug = offerSlug(this.hotelsId, rateName);
3414
+ if (!offerMetaData.includes(slug)) {
3415
+ return;
3416
+ }
3417
+ const itemEl = this.createItem(prop, item, this.itemTemplateElement);
3418
+ this.listInstance.appendChild(itemEl);
3419
+ addedItems += 1;
3420
+ });
3421
+ if (rates.length === 0 || addedItems === 0) {
3422
+ this.hideOffersListContainer();
3423
+ return;
3424
+ }
3425
+ } else {
3426
+ this.hideOffersListContainer();
3427
+ return;
3428
+ }
3429
+ this.setupSplider();
3430
+ }
3431
+ hideOffersListContainer() {
3432
+ if (this.offersListContainer) {
3433
+ this.offersListContainer.style.display = "none";
3434
+ }
3435
+ }
3436
+ /**
3437
+ * Filter the offers based on the country code
3438
+ * @param item
3439
+ */
3440
+ countryCodeFilter = (item) => {
3441
+ const { isArchived, isDraft, fieldData } = item;
3442
+ if (isArchived || isDraft)
3443
+ return false;
3444
+ if (!fieldData["supported-countries"] || fieldData["supported-countries"].length === 0)
3445
+ return true;
3446
+ const itemCountryCodes = fieldData["supported-countries"].map(
3447
+ (c) => this.availableCountries[c]
3448
+ );
3449
+ return itemCountryCodes.includes(this.countryCode);
3450
+ };
3451
+ /**
3452
+ *
3453
+ * @param filteredOffers to generate offer data from CMS offers
3454
+ * generate the offer metadata and create a lookup object for the cms offers data (useful when looking up for offers discount percentage)
3455
+ * @returns
3456
+ */
3457
+ generateOfferData(filteredOffers) {
3458
+ const offerMetaData = [];
3459
+ filteredOffers.forEach((offer) => {
3460
+ const {
3461
+ fieldData: { "hotel-or-property-api-id": hotelId, "offer-api-name": name }
3462
+ } = offer;
3463
+ const slug = offerSlug(hotelId, name);
3464
+ offerMetaData.push(slug);
3465
+ this.offerLookup[slug] = offer;
3466
+ });
3467
+ return { offerMetaData };
3468
+ }
3469
+ /**
3470
+ *
3471
+ * @param queryParams to include as part of query for the request
3472
+ * @returns Starting price data
3473
+ */
3474
+ async getOffersData(queryParams) {
3475
+ const url = apiBaseUrl + "offers" + buildQueryParams(queryParams);
3476
+ const response = await fetch(url);
3477
+ const body = await response.json();
3478
+ if (body.error || !body.data)
3479
+ return null;
3480
+ return body;
3481
+ }
3482
+ };
3483
+
3484
+ // src/utils/StartingPrice.ts
3485
+ var StartingPrice = class {
3486
+ // The hotel ids
3487
+ hotelsIds;
3488
+ // The elements that will be updated with the starting price data for each hotel
3489
+ itemElements;
3490
+ // The container elements for each hotel
3491
+ itemContainerElements = [];
3492
+ hotelStartingPriceDataMap = /* @__PURE__ */ new Map();
3493
+ constructor(container) {
3494
+ this.hotelsIds = [];
3495
+ this.itemElements = [];
3496
+ container.querySelectorAll(SELECTORS.beHid).forEach((item) => {
3497
+ const hid = item.getAttribute(`${prefix}-be-hid`)?.trim();
3498
+ if (hid && BE_HID_TO_SNIPPET_CODE[hid]) {
3499
+ this.hotelsIds.push(BE_HID_TO_SNIPPET_CODE[hid]);
3500
+ this.itemElements.push(item);
3501
+ this.itemContainerElements.push(item.parentElement);
3502
+ const priceElement = item.querySelector(SELECTORS.price);
3503
+ if (priceElement) {
3504
+ priceElement.style.display = "none";
3505
+ }
3506
+ } else if (hid && !BE_HID_TO_SNIPPET_CODE[hid]) {
3507
+ const hotelStartingPriceContainer = item.querySelector(
3508
+ SELECTORS.hotelStartingPriceContainer
3509
+ );
3510
+ if (hotelStartingPriceContainer) {
3511
+ this.hidePricingContainer(hotelStartingPriceContainer);
3512
+ }
3513
+ }
3514
+ });
3515
+ listenForLanguageChange();
3516
+ }
3517
+ /**
3518
+ *
3519
+ * get the starting price data for each hotel and update the elements with the data
3520
+ */
3521
+ async getHotelStartingPrice() {
3522
+ for (let index = 0; index < this.hotelsIds.length; index++) {
3523
+ const hid = this.hotelsIds[index];
3524
+ const element = this.itemElements[index];
3525
+ const hotelStartingPriceContainer = element.querySelector(SELECTORS.hotelStartingPriceContainer) || this.itemContainerElements[index];
3526
+ let startingPriceData = this.hotelStartingPriceDataMap.get(hid);
3527
+ if (startingPriceData === void 0) {
3528
+ startingPriceData = await this.getHotelStartingPriceData({
3529
+ property: hid,
3530
+ locale: getLocale()
3531
+ });
3532
+ }
3533
+ this.hotelStartingPriceDataMap.set(hid, startingPriceData);
3534
+ if (!startingPriceData) {
3535
+ this.hidePricingContainer(hotelStartingPriceContainer);
3536
+ continue;
3537
+ }
3538
+ const {
3539
+ quotation: { pricePerNight, currency }
3540
+ } = startingPriceData;
3541
+ if (!pricePerNight) {
3542
+ this.hidePricingContainer(hotelStartingPriceContainer);
3543
+ }
3544
+ const priceElement = element.querySelector(SELECTORS.price);
3545
+ if (priceElement) {
3546
+ priceElement.innerHTML = Math.floor(pricePerNight).toString();
3547
+ priceElement.style.display = "block";
3548
+ }
3549
+ const currencyElement = element.querySelector(SELECTORS.currency);
3550
+ if (currencyElement)
3551
+ currencyElement.innerHTML = CURRENCY_TO_SYMBOL[currency];
3552
+ }
3553
+ }
3554
+ /**
3555
+ *
3556
+ * @param queryParams to include as part of query for the request
3557
+ * @returns Starting price data
3558
+ */
3559
+ async getHotelStartingPriceData(queryParams) {
3560
+ const url = apiBaseUrl + "startingfrom" + buildQueryParams(queryParams);
3561
+ const response = await fetch(url);
3562
+ const body = await response.json();
3563
+ if (body.error || !body.data)
3564
+ return null;
3565
+ return body.data;
3566
+ }
3567
+ /**
3568
+ *
3569
+ * @param hotelStartingPriceContainer to hide
3570
+ */
3571
+ hidePricingContainer(hotelStartingPriceContainer) {
3572
+ if (hotelStartingPriceContainer) {
3573
+ hotelStartingPriceContainer.style.display = "none";
3574
+ }
3575
+ }
3576
+ };
3577
+
3578
+ // src/pages/HotelEtVilla.ts
3579
+ window.fsAttributes = window.fsAttributes || [];
3580
+ window.loadFromServer = () => {
3581
+ window.fsAttributes.push([
3582
+ "cmsslider",
3583
+ async () => {
3584
+ translateLinks();
3585
+ const offersList = document.querySelector(SELECTORS.offersList);
3586
+ const itemTemplateElement = offersList?.querySelector(SELECTORS.listItem);
3587
+ const offersListContainer = document.querySelector(
3588
+ SELECTORS.offersListContainer
3589
+ );
3590
+ const hotelId = getHotelId();
3591
+ if (!hotelId && offersListContainer) {
3592
+ offersListContainer.style.display = "none";
3593
+ return;
3594
+ }
3595
+ if (offersList && itemTemplateElement && hotelId) {
3596
+ const offers = new Hotel(offersList, itemTemplateElement, hotelId, offersListContainer);
3597
+ await offers.getOffers();
3598
+ }
3599
+ const startingPrice = new StartingPrice(window.document.body);
3600
+ await startingPrice.getHotelStartingPrice();
3601
+ }
3602
+ ]);
3603
+ };
3604
+ window.loadFromServer();
3605
+ var getHotelId = () => {
3606
+ const hotelIDContainer = document.querySelector(SELECTORS.beHid);
3607
+ const hotelBEHID = hotelIDContainer?.getAttribute(`${prefix}-be-hid`)?.trim();
3608
+ if (hotelBEHID) {
3609
+ return BE_HID_TO_SNIPPET_CODE[hotelBEHID];
3610
+ }
3611
+ return null;
3612
+ };
3613
+ var translateLinks = () => {
3614
+ const links = document.querySelectorAll(SELECTORS.hotelURLS);
3615
+ let lang = getLanguage().toUpperCase();
3616
+ links.forEach((link) => {
3617
+ const url = link.getAttribute("href");
3618
+ if (url) {
3619
+ let mainURL;
3620
+ try {
3621
+ mainURL = new URL(url);
3622
+ } catch (error) {
3623
+ console.error("Error parsing URL:", error);
3624
+ return;
3625
+ }
3626
+ const params = new URLSearchParams(mainURL.search);
3627
+ if (params.has("langue")) {
3628
+ params.set("langue", lang);
3629
+ params.set("referring_site", encodeURIComponent(window.location.href));
3630
+ }
3631
+ if (params.has("Lang")) {
3632
+ lang = lang === "IT" || lang === "ES" ? "EN" : lang;
3633
+ params.set("Lang", lang);
3634
+ }
3635
+ mainURL.search = params.toString();
3636
+ link.setAttribute("href", mainURL.toString());
3637
+ }
3638
+ });
3639
+ };
3640
+ })();
3641
+ /*! Bundled license information:
3642
+
3643
+ @splidejs/splide/dist/js/splide.esm.js:
3644
+ (*!
3645
+ * Splide.js
3646
+ * Version : 4.1.4
3647
+ * License : MIT
3648
+ * Copyright: 2022 Naotoshi Fujita
3649
+ *)
3650
+ */
3651
+ //# sourceMappingURL=HotelEtVilla.js.map