@tarsis/toolkit 0.4.8 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/fonts/GT-Flexa-VF-Trial.woff2 +0 -0
  2. package/dist/fonts/GT-Maru-Light-Oblique-Trial.woff2 +0 -0
  3. package/dist/fonts/GT-Maru-Light-Trial.woff2 +0 -0
  4. package/dist/fonts/GT-Maru-Medium-Oblique-Trial.woff2 +0 -0
  5. package/dist/fonts/GT-Maru-Medium-Trial.woff2 +0 -0
  6. package/dist/fonts/GT-Maru-Mono-Black-Oblique-Trial.woff2 +0 -0
  7. package/dist/fonts/GT-Maru-Mono-Black-Trial.woff2 +0 -0
  8. package/dist/fonts/GT-Maru-Mono-Bold-Oblique-Trial.woff2 +0 -0
  9. package/dist/fonts/GT-Maru-Mono-Bold-Trial.woff2 +0 -0
  10. package/dist/fonts/GT-Maru-Mono-Light-Oblique-Trial.woff2 +0 -0
  11. package/dist/fonts/GT-Maru-Mono-Light-Trial.woff2 +0 -0
  12. package/dist/fonts/GT-Maru-Mono-Medium-Oblique-Trial.woff2 +0 -0
  13. package/dist/fonts/GT-Maru-Mono-Medium-Trial.woff2 +0 -0
  14. package/dist/fonts/gt/maru/GT-Maru-Light-Oblique-Trial.woff2 +0 -0
  15. package/dist/fonts/gt/maru/GT-Maru-Light-Trial.woff2 +0 -0
  16. package/dist/fonts/gt/maru/GT-Maru-Medium-Oblique-Trial.woff2 +0 -0
  17. package/dist/fonts/gt/maru/GT-Maru-Medium-Trial.woff2 +0 -0
  18. package/dist/fonts/gt/maru/GT-Maru-Mono-Black-Oblique-Trial.woff2 +0 -0
  19. package/dist/fonts/gt/maru/GT-Maru-Mono-Black-Trial.woff2 +0 -0
  20. package/dist/fonts/gt/maru/GT-Maru-Mono-Bold-Oblique-Trial.woff2 +0 -0
  21. package/dist/fonts/gt/maru/GT-Maru-Mono-Bold-Trial.woff2 +0 -0
  22. package/dist/fonts/gt/maru/GT-Maru-Mono-Light-Oblique-Trial.woff2 +0 -0
  23. package/dist/fonts/gt/maru/GT-Maru-Mono-Light-Trial.woff2 +0 -0
  24. package/dist/fonts/gt/maru/GT-Maru-Mono-Medium-Oblique-Trial.woff2 +0 -0
  25. package/dist/fonts/gt/maru/GT-Maru-Mono-Medium-Trial.woff2 +0 -0
  26. package/dist/fonts/gt/maru/gt-maru-black-oblique.woff2 +0 -0
  27. package/dist/fonts/gt/maru/gt-maru-black.woff2 +0 -0
  28. package/dist/fonts/gt/maru/gt-maru-bold-oblique.woff2 +0 -0
  29. package/dist/fonts/gt/maru/gt-maru-bold.woff2 +0 -0
  30. package/dist/fonts/gt/maru/gt-maru-mega-l.woff2 +0 -0
  31. package/dist/fonts/gt/maru/gt-maru-mega-m.woff2 +0 -0
  32. package/dist/fonts/gt/maru/gt-maru-mega-s.woff2 +0 -0
  33. package/dist/fonts/gt/maru/gt-maru-mono-regular-oblique.woff2 +0 -0
  34. package/dist/fonts/gt/maru/gt-maru-mono-regular.woff2 +0 -0
  35. package/dist/fonts/gt/maru/gt-maru-regular-oblique.woff2 +0 -0
  36. package/dist/fonts/gt/maru/gt-maru-regular.woff2 +0 -0
  37. package/dist/fonts/gt-flexa/GT-Flexa-VF-Trial.woff2 +0 -0
  38. package/dist/fonts/gt-maru-black-oblique.woff2 +0 -0
  39. package/dist/fonts/gt-maru-black.woff2 +0 -0
  40. package/dist/fonts/gt-maru-bold-oblique.woff2 +0 -0
  41. package/dist/fonts/gt-maru-bold.woff2 +0 -0
  42. package/dist/fonts/gt-maru-mega-l.woff2 +0 -0
  43. package/dist/fonts/gt-maru-mega-m.woff2 +0 -0
  44. package/dist/fonts/gt-maru-mega-s.woff2 +0 -0
  45. package/dist/fonts/gt-maru-mono-regular-oblique.woff2 +0 -0
  46. package/dist/fonts/gt-maru-mono-regular.woff2 +0 -0
  47. package/dist/fonts/gt-maru-regular-oblique.woff2 +0 -0
  48. package/dist/fonts/gt-maru-regular.woff2 +0 -0
  49. package/dist/fonts/maru/GT-Maru-Light-Oblique-Trial.woff2 +0 -0
  50. package/dist/fonts/maru/GT-Maru-Light-Trial.woff2 +0 -0
  51. package/dist/fonts/maru/GT-Maru-Medium-Oblique-Trial.woff2 +0 -0
  52. package/dist/fonts/maru/GT-Maru-Medium-Trial.woff2 +0 -0
  53. package/dist/fonts/maru/GT-Maru-Mono-Black-Oblique-Trial.woff2 +0 -0
  54. package/dist/fonts/maru/GT-Maru-Mono-Black-Trial.woff2 +0 -0
  55. package/dist/fonts/maru/GT-Maru-Mono-Bold-Oblique-Trial.woff2 +0 -0
  56. package/dist/fonts/maru/GT-Maru-Mono-Bold-Trial.woff2 +0 -0
  57. package/dist/fonts/maru/GT-Maru-Mono-Light-Oblique-Trial.woff2 +0 -0
  58. package/dist/fonts/maru/GT-Maru-Mono-Light-Trial.woff2 +0 -0
  59. package/dist/fonts/maru/GT-Maru-Mono-Medium-Oblique-Trial.woff2 +0 -0
  60. package/dist/fonts/maru/GT-Maru-Mono-Medium-Trial.woff2 +0 -0
  61. package/dist/fonts/maru/gt-maru-black-oblique.woff2 +0 -0
  62. package/dist/fonts/maru/gt-maru-black.woff2 +0 -0
  63. package/dist/fonts/maru/gt-maru-bold-oblique.woff2 +0 -0
  64. package/dist/fonts/maru/gt-maru-bold.woff2 +0 -0
  65. package/dist/fonts/maru/gt-maru-mega-l.woff2 +0 -0
  66. package/dist/fonts/maru/gt-maru-mega-m.woff2 +0 -0
  67. package/dist/fonts/maru/gt-maru-mega-s.woff2 +0 -0
  68. package/dist/fonts/maru/gt-maru-mono-regular-oblique.woff2 +0 -0
  69. package/dist/fonts/maru/gt-maru-mono-regular.woff2 +0 -0
  70. package/dist/fonts/maru/gt-maru-regular-oblique.woff2 +0 -0
  71. package/dist/fonts/maru/gt-maru-regular.woff2 +0 -0
  72. package/dist/gl-BlKJDzVL.cjs +3262 -0
  73. package/dist/gl-DA94DTyS.js +3258 -0
  74. package/dist/hooks.cjs +24 -0
  75. package/dist/hooks.d.ts +190 -0
  76. package/dist/hooks.js +1 -0
  77. package/dist/index-B9O5nl2I.js +113847 -0
  78. package/dist/index-B_kRoqUz.cjs +3912 -0
  79. package/dist/index-BlpASwt4.js +3910 -0
  80. package/dist/index-DrShaNFt.cjs +114199 -0
  81. package/dist/index.cjs +343 -41240
  82. package/dist/index.d.ts +470 -354
  83. package/dist/index.js +4 -40894
  84. package/dist/server.cjs +0 -3
  85. package/dist/server.d.ts +0 -2
  86. package/dist/server.js +1 -3
  87. package/dist/styles.css +961 -647
  88. package/dist/svg-6fNe-PW5.cjs +68 -0
  89. package/dist/svg-C0Ykxk94.js +60 -0
  90. package/dist/useWindowReady-CESjx5iD.cjs +9275 -0
  91. package/dist/useWindowReady-CIGrizO6.js +9185 -0
  92. package/dist/utils.cjs +39 -0
  93. package/dist/utils.d.ts +90 -0
  94. package/dist/utils.js +2 -0
  95. package/package.json +71 -70
  96. package/dist/gl-BytuN41l.cjs +0 -380
  97. package/dist/gl-D_Ly48gx.js +0 -357
@@ -0,0 +1,3912 @@
1
+ 'use strict';
2
+
3
+ const index$2 = require('./index-DrShaNFt.cjs');
4
+
5
+ function _mergeNamespaces(n, m) {
6
+ for (var i = 0; i < m.length; i++) {
7
+ const e = m[i];
8
+ if (typeof e !== 'string' && !Array.isArray(e)) { for (const k in e) {
9
+ if (k !== 'default' && !(k in n)) {
10
+ const d = Object.getOwnPropertyDescriptor(e, k);
11
+ if (d) {
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: () => e[k]
15
+ });
16
+ }
17
+ }
18
+ } }
19
+ }
20
+ return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' }));
21
+ }
22
+
23
+ var js = {exports: {}};
24
+
25
+ var flickity = {exports: {}};
26
+
27
+ var evEmitter$1 = {exports: {}};
28
+
29
+ /**
30
+ * EvEmitter v1.1.0
31
+ * Lil' event emitter
32
+ * MIT License
33
+ */
34
+ var evEmitter = evEmitter$1.exports;
35
+
36
+ var hasRequiredEvEmitter;
37
+
38
+ function requireEvEmitter () {
39
+ if (hasRequiredEvEmitter) return evEmitter$1.exports;
40
+ hasRequiredEvEmitter = 1;
41
+ (function (module) {
42
+ /* jshint unused: true, undef: true, strict: true */
43
+
44
+ ( function( global, factory ) {
45
+ // universal module definition
46
+ /* jshint strict: false */ /* globals define, module, window */
47
+ if ( module.exports ) {
48
+ // CommonJS - Browserify, Webpack
49
+ module.exports = factory();
50
+ } else {
51
+ // Browser globals
52
+ global.EvEmitter = factory();
53
+ }
54
+
55
+ }( typeof window != 'undefined' ? window : evEmitter, function() {
56
+
57
+ function EvEmitter() {}
58
+
59
+ var proto = EvEmitter.prototype;
60
+
61
+ proto.on = function( eventName, listener ) {
62
+ if ( !eventName || !listener ) {
63
+ return;
64
+ }
65
+ // set events hash
66
+ var events = this._events = this._events || {};
67
+ // set listeners array
68
+ var listeners = events[ eventName ] = events[ eventName ] || [];
69
+ // only add once
70
+ if ( listeners.indexOf( listener ) == -1 ) {
71
+ listeners.push( listener );
72
+ }
73
+
74
+ return this;
75
+ };
76
+
77
+ proto.once = function( eventName, listener ) {
78
+ if ( !eventName || !listener ) {
79
+ return;
80
+ }
81
+ // add event
82
+ this.on( eventName, listener );
83
+ // set once flag
84
+ // set onceEvents hash
85
+ var onceEvents = this._onceEvents = this._onceEvents || {};
86
+ // set onceListeners object
87
+ var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {};
88
+ // set flag
89
+ onceListeners[ listener ] = true;
90
+
91
+ return this;
92
+ };
93
+
94
+ proto.off = function( eventName, listener ) {
95
+ var listeners = this._events && this._events[ eventName ];
96
+ if ( !listeners || !listeners.length ) {
97
+ return;
98
+ }
99
+ var index = listeners.indexOf( listener );
100
+ if ( index != -1 ) {
101
+ listeners.splice( index, 1 );
102
+ }
103
+
104
+ return this;
105
+ };
106
+
107
+ proto.emitEvent = function( eventName, args ) {
108
+ var listeners = this._events && this._events[ eventName ];
109
+ if ( !listeners || !listeners.length ) {
110
+ return;
111
+ }
112
+ // copy over to avoid interference if .off() in listener
113
+ listeners = listeners.slice(0);
114
+ args = args || [];
115
+ // once stuff
116
+ var onceListeners = this._onceEvents && this._onceEvents[ eventName ];
117
+
118
+ for ( var i=0; i < listeners.length; i++ ) {
119
+ var listener = listeners[i];
120
+ var isOnce = onceListeners && onceListeners[ listener ];
121
+ if ( isOnce ) {
122
+ // remove listener
123
+ // remove before trigger to prevent recursion
124
+ this.off( eventName, listener );
125
+ // unset once flag
126
+ delete onceListeners[ listener ];
127
+ }
128
+ // trigger listener
129
+ listener.apply( this, args );
130
+ }
131
+
132
+ return this;
133
+ };
134
+
135
+ proto.allOff = function() {
136
+ delete this._events;
137
+ delete this._onceEvents;
138
+ };
139
+
140
+ return EvEmitter;
141
+
142
+ }));
143
+ } (evEmitter$1));
144
+ return evEmitter$1.exports;
145
+ }
146
+
147
+ var getSize = {exports: {}};
148
+
149
+ /*!
150
+ * getSize v2.0.3
151
+ * measure size of elements
152
+ * MIT license
153
+ */
154
+
155
+ var hasRequiredGetSize;
156
+
157
+ function requireGetSize () {
158
+ if (hasRequiredGetSize) return getSize.exports;
159
+ hasRequiredGetSize = 1;
160
+ (function (module) {
161
+ /* jshint browser: true, strict: true, undef: true, unused: true */
162
+ /* globals console: false */
163
+
164
+ ( function( window, factory ) {
165
+ /* jshint strict: false */ /* globals define, module */
166
+ if ( module.exports ) {
167
+ // CommonJS
168
+ module.exports = factory();
169
+ } else {
170
+ // browser global
171
+ window.getSize = factory();
172
+ }
173
+
174
+ })( window, function factory() {
175
+
176
+ // -------------------------- helpers -------------------------- //
177
+
178
+ // get a number from a string, not a percentage
179
+ function getStyleSize( value ) {
180
+ var num = parseFloat( value );
181
+ // not a percent like '100%', and a number
182
+ var isValid = value.indexOf('%') == -1 && !isNaN( num );
183
+ return isValid && num;
184
+ }
185
+
186
+ function noop() {}
187
+
188
+ var logError = typeof console == 'undefined' ? noop :
189
+ function( message ) {
190
+ console.error( message );
191
+ };
192
+
193
+ // -------------------------- measurements -------------------------- //
194
+
195
+ var measurements = [
196
+ 'paddingLeft',
197
+ 'paddingRight',
198
+ 'paddingTop',
199
+ 'paddingBottom',
200
+ 'marginLeft',
201
+ 'marginRight',
202
+ 'marginTop',
203
+ 'marginBottom',
204
+ 'borderLeftWidth',
205
+ 'borderRightWidth',
206
+ 'borderTopWidth',
207
+ 'borderBottomWidth'
208
+ ];
209
+
210
+ var measurementsLength = measurements.length;
211
+
212
+ function getZeroSize() {
213
+ var size = {
214
+ width: 0,
215
+ height: 0,
216
+ innerWidth: 0,
217
+ innerHeight: 0,
218
+ outerWidth: 0,
219
+ outerHeight: 0
220
+ };
221
+ for ( var i=0; i < measurementsLength; i++ ) {
222
+ var measurement = measurements[i];
223
+ size[ measurement ] = 0;
224
+ }
225
+ return size;
226
+ }
227
+
228
+ // -------------------------- getStyle -------------------------- //
229
+
230
+ /**
231
+ * getStyle, get style of element, check for Firefox bug
232
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=548397
233
+ */
234
+ function getStyle( elem ) {
235
+ var style = getComputedStyle( elem );
236
+ if ( !style ) {
237
+ logError( 'Style returned ' + style +
238
+ '. Are you running this code in a hidden iframe on Firefox? ' +
239
+ 'See https://bit.ly/getsizebug1' );
240
+ }
241
+ return style;
242
+ }
243
+
244
+ // -------------------------- setup -------------------------- //
245
+
246
+ var isSetup = false;
247
+
248
+ var isBoxSizeOuter;
249
+
250
+ /**
251
+ * setup
252
+ * check isBoxSizerOuter
253
+ * do on first getSize() rather than on page load for Firefox bug
254
+ */
255
+ function setup() {
256
+ // setup once
257
+ if ( isSetup ) {
258
+ return;
259
+ }
260
+ isSetup = true;
261
+
262
+ // -------------------------- box sizing -------------------------- //
263
+
264
+ /**
265
+ * Chrome & Safari measure the outer-width on style.width on border-box elems
266
+ * IE11 & Firefox<29 measures the inner-width
267
+ */
268
+ var div = document.createElement('div');
269
+ div.style.width = '200px';
270
+ div.style.padding = '1px 2px 3px 4px';
271
+ div.style.borderStyle = 'solid';
272
+ div.style.borderWidth = '1px 2px 3px 4px';
273
+ div.style.boxSizing = 'border-box';
274
+
275
+ var body = document.body || document.documentElement;
276
+ body.appendChild( div );
277
+ var style = getStyle( div );
278
+ // round value for browser zoom. desandro/masonry#928
279
+ isBoxSizeOuter = Math.round( getStyleSize( style.width ) ) == 200;
280
+ getSize.isBoxSizeOuter = isBoxSizeOuter;
281
+
282
+ body.removeChild( div );
283
+ }
284
+
285
+ // -------------------------- getSize -------------------------- //
286
+
287
+ function getSize( elem ) {
288
+ setup();
289
+
290
+ // use querySeletor if elem is string
291
+ if ( typeof elem == 'string' ) {
292
+ elem = document.querySelector( elem );
293
+ }
294
+
295
+ // do not proceed on non-objects
296
+ if ( !elem || typeof elem != 'object' || !elem.nodeType ) {
297
+ return;
298
+ }
299
+
300
+ var style = getStyle( elem );
301
+
302
+ // if hidden, everything is 0
303
+ if ( style.display == 'none' ) {
304
+ return getZeroSize();
305
+ }
306
+
307
+ var size = {};
308
+ size.width = elem.offsetWidth;
309
+ size.height = elem.offsetHeight;
310
+
311
+ var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box';
312
+
313
+ // get all measurements
314
+ for ( var i=0; i < measurementsLength; i++ ) {
315
+ var measurement = measurements[i];
316
+ var value = style[ measurement ];
317
+ var num = parseFloat( value );
318
+ // any 'auto', 'medium' value will be 0
319
+ size[ measurement ] = !isNaN( num ) ? num : 0;
320
+ }
321
+
322
+ var paddingWidth = size.paddingLeft + size.paddingRight;
323
+ var paddingHeight = size.paddingTop + size.paddingBottom;
324
+ var marginWidth = size.marginLeft + size.marginRight;
325
+ var marginHeight = size.marginTop + size.marginBottom;
326
+ var borderWidth = size.borderLeftWidth + size.borderRightWidth;
327
+ var borderHeight = size.borderTopWidth + size.borderBottomWidth;
328
+
329
+ var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
330
+
331
+ // overwrite width and height if we can get it from style
332
+ var styleWidth = getStyleSize( style.width );
333
+ if ( styleWidth !== false ) {
334
+ size.width = styleWidth +
335
+ // add padding and border unless it's already including it
336
+ ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
337
+ }
338
+
339
+ var styleHeight = getStyleSize( style.height );
340
+ if ( styleHeight !== false ) {
341
+ size.height = styleHeight +
342
+ // add padding and border unless it's already including it
343
+ ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
344
+ }
345
+
346
+ size.innerWidth = size.width - ( paddingWidth + borderWidth );
347
+ size.innerHeight = size.height - ( paddingHeight + borderHeight );
348
+
349
+ size.outerWidth = size.width + marginWidth;
350
+ size.outerHeight = size.height + marginHeight;
351
+
352
+ return size;
353
+ }
354
+
355
+ return getSize;
356
+
357
+ });
358
+ } (getSize));
359
+ return getSize.exports;
360
+ }
361
+
362
+ var utils = {exports: {}};
363
+
364
+ var matchesSelector = {exports: {}};
365
+
366
+ /**
367
+ * matchesSelector v2.0.2
368
+ * matchesSelector( element, '.selector' )
369
+ * MIT license
370
+ */
371
+
372
+ var hasRequiredMatchesSelector;
373
+
374
+ function requireMatchesSelector () {
375
+ if (hasRequiredMatchesSelector) return matchesSelector.exports;
376
+ hasRequiredMatchesSelector = 1;
377
+ (function (module) {
378
+ /*jshint browser: true, strict: true, undef: true, unused: true */
379
+
380
+ ( function( window, factory ) {
381
+ // universal module definition
382
+ if ( module.exports ) {
383
+ // CommonJS
384
+ module.exports = factory();
385
+ } else {
386
+ // browser global
387
+ window.matchesSelector = factory();
388
+ }
389
+
390
+ }( window, function factory() {
391
+
392
+ var matchesMethod = ( function() {
393
+ var ElemProto = window.Element.prototype;
394
+ // check for the standard method name first
395
+ if ( ElemProto.matches ) {
396
+ return 'matches';
397
+ }
398
+ // check un-prefixed
399
+ if ( ElemProto.matchesSelector ) {
400
+ return 'matchesSelector';
401
+ }
402
+ // check vendor prefixes
403
+ var prefixes = [ 'webkit', 'moz', 'ms', 'o' ];
404
+
405
+ for ( var i=0; i < prefixes.length; i++ ) {
406
+ var prefix = prefixes[i];
407
+ var method = prefix + 'MatchesSelector';
408
+ if ( ElemProto[ method ] ) {
409
+ return method;
410
+ }
411
+ }
412
+ })();
413
+
414
+ return function matchesSelector( elem, selector ) {
415
+ return elem[ matchesMethod ]( selector );
416
+ };
417
+
418
+ }));
419
+ } (matchesSelector));
420
+ return matchesSelector.exports;
421
+ }
422
+
423
+ /**
424
+ * Fizzy UI utils v2.0.7
425
+ * MIT license
426
+ */
427
+
428
+ var hasRequiredUtils;
429
+
430
+ function requireUtils () {
431
+ if (hasRequiredUtils) return utils.exports;
432
+ hasRequiredUtils = 1;
433
+ (function (module) {
434
+ /*jshint browser: true, undef: true, unused: true, strict: true */
435
+
436
+ ( function( window, factory ) {
437
+ // universal module definition
438
+ /*jshint strict: false */ /*globals define, module, require */
439
+
440
+ if ( module.exports ) {
441
+ // CommonJS
442
+ module.exports = factory(
443
+ window,
444
+ requireMatchesSelector()
445
+ );
446
+ } else {
447
+ // browser global
448
+ window.fizzyUIUtils = factory(
449
+ window,
450
+ window.matchesSelector
451
+ );
452
+ }
453
+
454
+ }( window, function factory( window, matchesSelector ) {
455
+
456
+ var utils = {};
457
+
458
+ // ----- extend ----- //
459
+
460
+ // extends objects
461
+ utils.extend = function( a, b ) {
462
+ for ( var prop in b ) {
463
+ a[ prop ] = b[ prop ];
464
+ }
465
+ return a;
466
+ };
467
+
468
+ // ----- modulo ----- //
469
+
470
+ utils.modulo = function( num, div ) {
471
+ return ( ( num % div ) + div ) % div;
472
+ };
473
+
474
+ // ----- makeArray ----- //
475
+
476
+ var arraySlice = Array.prototype.slice;
477
+
478
+ // turn element or nodeList into an array
479
+ utils.makeArray = function( obj ) {
480
+ if ( Array.isArray( obj ) ) {
481
+ // use object if already an array
482
+ return obj;
483
+ }
484
+ // return empty array if undefined or null. #6
485
+ if ( obj === null || obj === undefined ) {
486
+ return [];
487
+ }
488
+
489
+ var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
490
+ if ( isArrayLike ) {
491
+ // convert nodeList to array
492
+ return arraySlice.call( obj );
493
+ }
494
+
495
+ // array of single index
496
+ return [ obj ];
497
+ };
498
+
499
+ // ----- removeFrom ----- //
500
+
501
+ utils.removeFrom = function( ary, obj ) {
502
+ var index = ary.indexOf( obj );
503
+ if ( index != -1 ) {
504
+ ary.splice( index, 1 );
505
+ }
506
+ };
507
+
508
+ // ----- getParent ----- //
509
+
510
+ utils.getParent = function( elem, selector ) {
511
+ while ( elem.parentNode && elem != document.body ) {
512
+ elem = elem.parentNode;
513
+ if ( matchesSelector( elem, selector ) ) {
514
+ return elem;
515
+ }
516
+ }
517
+ };
518
+
519
+ // ----- getQueryElement ----- //
520
+
521
+ // use element as selector string
522
+ utils.getQueryElement = function( elem ) {
523
+ if ( typeof elem == 'string' ) {
524
+ return document.querySelector( elem );
525
+ }
526
+ return elem;
527
+ };
528
+
529
+ // ----- handleEvent ----- //
530
+
531
+ // enable .ontype to trigger from .addEventListener( elem, 'type' )
532
+ utils.handleEvent = function( event ) {
533
+ var method = 'on' + event.type;
534
+ if ( this[ method ] ) {
535
+ this[ method ]( event );
536
+ }
537
+ };
538
+
539
+ // ----- filterFindElements ----- //
540
+
541
+ utils.filterFindElements = function( elems, selector ) {
542
+ // make array of elems
543
+ elems = utils.makeArray( elems );
544
+ var ffElems = [];
545
+
546
+ elems.forEach( function( elem ) {
547
+ // check that elem is an actual element
548
+ if ( !( elem instanceof HTMLElement ) ) {
549
+ return;
550
+ }
551
+ // add elem if no selector
552
+ if ( !selector ) {
553
+ ffElems.push( elem );
554
+ return;
555
+ }
556
+ // filter & find items if we have a selector
557
+ // filter
558
+ if ( matchesSelector( elem, selector ) ) {
559
+ ffElems.push( elem );
560
+ }
561
+ // find children
562
+ var childElems = elem.querySelectorAll( selector );
563
+ // concat childElems to filterFound array
564
+ for ( var i=0; i < childElems.length; i++ ) {
565
+ ffElems.push( childElems[i] );
566
+ }
567
+ });
568
+
569
+ return ffElems;
570
+ };
571
+
572
+ // ----- debounceMethod ----- //
573
+
574
+ utils.debounceMethod = function( _class, methodName, threshold ) {
575
+ threshold = threshold || 100;
576
+ // original method
577
+ var method = _class.prototype[ methodName ];
578
+ var timeoutName = methodName + 'Timeout';
579
+
580
+ _class.prototype[ methodName ] = function() {
581
+ var timeout = this[ timeoutName ];
582
+ clearTimeout( timeout );
583
+
584
+ var args = arguments;
585
+ var _this = this;
586
+ this[ timeoutName ] = setTimeout( function() {
587
+ method.apply( _this, args );
588
+ delete _this[ timeoutName ];
589
+ }, threshold );
590
+ };
591
+ };
592
+
593
+ // ----- docReady ----- //
594
+
595
+ utils.docReady = function( callback ) {
596
+ var readyState = document.readyState;
597
+ if ( readyState == 'complete' || readyState == 'interactive' ) {
598
+ // do async to allow for other scripts to run. metafizzy/flickity#441
599
+ setTimeout( callback );
600
+ } else {
601
+ document.addEventListener( 'DOMContentLoaded', callback );
602
+ }
603
+ };
604
+
605
+ // ----- htmlInit ----- //
606
+
607
+ // http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/
608
+ utils.toDashed = function( str ) {
609
+ return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {
610
+ return $1 + '-' + $2;
611
+ }).toLowerCase();
612
+ };
613
+
614
+ var console = window.console;
615
+ /**
616
+ * allow user to initialize classes via [data-namespace] or .js-namespace class
617
+ * htmlInit( Widget, 'widgetName' )
618
+ * options are parsed from data-namespace-options
619
+ */
620
+ utils.htmlInit = function( WidgetClass, namespace ) {
621
+ utils.docReady( function() {
622
+ var dashedNamespace = utils.toDashed( namespace );
623
+ var dataAttr = 'data-' + dashedNamespace;
624
+ var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' );
625
+ var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace );
626
+ var elems = utils.makeArray( dataAttrElems )
627
+ .concat( utils.makeArray( jsDashElems ) );
628
+ var dataOptionsAttr = dataAttr + '-options';
629
+ var jQuery = window.jQuery;
630
+
631
+ elems.forEach( function( elem ) {
632
+ var attr = elem.getAttribute( dataAttr ) ||
633
+ elem.getAttribute( dataOptionsAttr );
634
+ var options;
635
+ try {
636
+ options = attr && JSON.parse( attr );
637
+ } catch ( error ) {
638
+ // log error, do not initialize
639
+ if ( console ) {
640
+ console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className +
641
+ ': ' + error );
642
+ }
643
+ return;
644
+ }
645
+ // initialize
646
+ var instance = new WidgetClass( elem, options );
647
+ // make available via $().data('namespace')
648
+ if ( jQuery ) {
649
+ jQuery.data( elem, namespace, instance );
650
+ }
651
+ });
652
+
653
+ });
654
+ };
655
+
656
+ // ----- ----- //
657
+
658
+ return utils;
659
+
660
+ }));
661
+ } (utils));
662
+ return utils.exports;
663
+ }
664
+
665
+ var cell = {exports: {}};
666
+
667
+ var hasRequiredCell;
668
+
669
+ function requireCell () {
670
+ if (hasRequiredCell) return cell.exports;
671
+ hasRequiredCell = 1;
672
+ (function (module) {
673
+ // Flickity.Cell
674
+ ( function( window, factory ) {
675
+ // universal module definition
676
+ if ( module.exports ) {
677
+ // CommonJS
678
+ module.exports = factory(
679
+ window,
680
+ requireGetSize()
681
+ );
682
+ } else {
683
+ // browser global
684
+ window.Flickity = window.Flickity || {};
685
+ window.Flickity.Cell = factory(
686
+ window,
687
+ window.getSize
688
+ );
689
+ }
690
+
691
+ }( window, function factory( window, getSize ) {
692
+
693
+ function Cell( elem, parent ) {
694
+ this.element = elem;
695
+ this.parent = parent;
696
+
697
+ this.create();
698
+ }
699
+
700
+ var proto = Cell.prototype;
701
+
702
+ proto.create = function() {
703
+ this.element.style.position = 'absolute';
704
+ this.element.setAttribute( 'aria-hidden', 'true' );
705
+ this.x = 0;
706
+ this.shift = 0;
707
+ this.element.style[ this.parent.originSide ] = 0;
708
+ };
709
+
710
+ proto.destroy = function() {
711
+ // reset style
712
+ this.unselect();
713
+ this.element.style.position = '';
714
+ var side = this.parent.originSide;
715
+ this.element.style[ side ] = '';
716
+ this.element.style.transform = '';
717
+ this.element.removeAttribute('aria-hidden');
718
+ };
719
+
720
+ proto.getSize = function() {
721
+ this.size = getSize( this.element );
722
+ };
723
+
724
+ proto.setPosition = function( x ) {
725
+ this.x = x;
726
+ this.updateTarget();
727
+ this.renderPosition( x );
728
+ };
729
+
730
+ // setDefaultTarget v1 method, backwards compatibility, remove in v3
731
+ proto.updateTarget = proto.setDefaultTarget = function() {
732
+ var marginProperty = this.parent.originSide == 'left' ? 'marginLeft' : 'marginRight';
733
+ this.target = this.x + this.size[ marginProperty ] +
734
+ this.size.width * this.parent.cellAlign;
735
+ };
736
+
737
+ proto.renderPosition = function( x ) {
738
+ // render position of cell with in slider
739
+ var sideOffset = this.parent.originSide === 'left' ? 1 : -1;
740
+
741
+ var adjustedX = this.parent.options.percentPosition ?
742
+ x * sideOffset * ( this.parent.size.innerWidth / this.size.width ) :
743
+ x * sideOffset;
744
+
745
+ this.element.style.transform = 'translateX(' +
746
+ this.parent.getPositionValue( adjustedX ) + ')';
747
+ };
748
+
749
+ proto.select = function() {
750
+ this.element.classList.add('is-selected');
751
+ this.element.removeAttribute('aria-hidden');
752
+ };
753
+
754
+ proto.unselect = function() {
755
+ this.element.classList.remove('is-selected');
756
+ this.element.setAttribute( 'aria-hidden', 'true' );
757
+ };
758
+
759
+ /**
760
+ * @param {Integer} shift - 0, 1, or -1
761
+ */
762
+ proto.wrapShift = function( shift ) {
763
+ this.shift = shift;
764
+ this.renderPosition( this.x + this.parent.slideableWidth * shift );
765
+ };
766
+
767
+ proto.remove = function() {
768
+ this.element.parentNode.removeChild( this.element );
769
+ };
770
+
771
+ return Cell;
772
+
773
+ } ) );
774
+ } (cell));
775
+ return cell.exports;
776
+ }
777
+
778
+ var slide = {exports: {}};
779
+
780
+ var hasRequiredSlide;
781
+
782
+ function requireSlide () {
783
+ if (hasRequiredSlide) return slide.exports;
784
+ hasRequiredSlide = 1;
785
+ (function (module) {
786
+ // slide
787
+ ( function( window, factory ) {
788
+ // universal module definition
789
+ if ( module.exports ) {
790
+ // CommonJS
791
+ module.exports = factory();
792
+ } else {
793
+ // browser global
794
+ window.Flickity = window.Flickity || {};
795
+ window.Flickity.Slide = factory();
796
+ }
797
+
798
+ }( window, function factory() {
799
+
800
+ function Slide( parent ) {
801
+ this.parent = parent;
802
+ this.isOriginLeft = parent.originSide == 'left';
803
+ this.cells = [];
804
+ this.outerWidth = 0;
805
+ this.height = 0;
806
+ }
807
+
808
+ var proto = Slide.prototype;
809
+
810
+ proto.addCell = function( cell ) {
811
+ this.cells.push( cell );
812
+ this.outerWidth += cell.size.outerWidth;
813
+ this.height = Math.max( cell.size.outerHeight, this.height );
814
+ // first cell stuff
815
+ if ( this.cells.length == 1 ) {
816
+ this.x = cell.x; // x comes from first cell
817
+ var beginMargin = this.isOriginLeft ? 'marginLeft' : 'marginRight';
818
+ this.firstMargin = cell.size[ beginMargin ];
819
+ }
820
+ };
821
+
822
+ proto.updateTarget = function() {
823
+ var endMargin = this.isOriginLeft ? 'marginRight' : 'marginLeft';
824
+ var lastCell = this.getLastCell();
825
+ var lastMargin = lastCell ? lastCell.size[ endMargin ] : 0;
826
+ var slideWidth = this.outerWidth - ( this.firstMargin + lastMargin );
827
+ this.target = this.x + this.firstMargin + slideWidth * this.parent.cellAlign;
828
+ };
829
+
830
+ proto.getLastCell = function() {
831
+ return this.cells[ this.cells.length - 1 ];
832
+ };
833
+
834
+ proto.select = function() {
835
+ this.cells.forEach( function( cell ) {
836
+ cell.select();
837
+ } );
838
+ };
839
+
840
+ proto.unselect = function() {
841
+ this.cells.forEach( function( cell ) {
842
+ cell.unselect();
843
+ } );
844
+ };
845
+
846
+ proto.getCellElements = function() {
847
+ return this.cells.map( function( cell ) {
848
+ return cell.element;
849
+ } );
850
+ };
851
+
852
+ return Slide;
853
+
854
+ } ) );
855
+ } (slide));
856
+ return slide.exports;
857
+ }
858
+
859
+ var animate = {exports: {}};
860
+
861
+ var hasRequiredAnimate;
862
+
863
+ function requireAnimate () {
864
+ if (hasRequiredAnimate) return animate.exports;
865
+ hasRequiredAnimate = 1;
866
+ (function (module) {
867
+ // animate
868
+ ( function( window, factory ) {
869
+ // universal module definition
870
+ if ( module.exports ) {
871
+ // CommonJS
872
+ module.exports = factory(
873
+ window,
874
+ requireUtils()
875
+ );
876
+ } else {
877
+ // browser global
878
+ window.Flickity = window.Flickity || {};
879
+ window.Flickity.animatePrototype = factory(
880
+ window,
881
+ window.fizzyUIUtils
882
+ );
883
+ }
884
+
885
+ }( window, function factory( window, utils ) {
886
+
887
+ // -------------------------- animate -------------------------- //
888
+
889
+ var proto = {};
890
+
891
+ proto.startAnimation = function() {
892
+ if ( this.isAnimating ) {
893
+ return;
894
+ }
895
+
896
+ this.isAnimating = true;
897
+ this.restingFrames = 0;
898
+ this.animate();
899
+ };
900
+
901
+ proto.animate = function() {
902
+ this.applyDragForce();
903
+ this.applySelectedAttraction();
904
+
905
+ var previousX = this.x;
906
+
907
+ this.integratePhysics();
908
+ this.positionSlider();
909
+ this.settle( previousX );
910
+ // animate next frame
911
+ if ( this.isAnimating ) {
912
+ var _this = this;
913
+ requestAnimationFrame( function animateFrame() {
914
+ _this.animate();
915
+ } );
916
+ }
917
+ };
918
+
919
+ proto.positionSlider = function() {
920
+ var x = this.x;
921
+ // wrap position around
922
+ if ( this.options.wrapAround && this.cells.length > 1 ) {
923
+ x = utils.modulo( x, this.slideableWidth );
924
+ x -= this.slideableWidth;
925
+ this.shiftWrapCells( x );
926
+ }
927
+
928
+ this.setTranslateX( x, this.isAnimating );
929
+ this.dispatchScrollEvent();
930
+ };
931
+
932
+ proto.setTranslateX = function( x, is3d ) {
933
+ x += this.cursorPosition;
934
+ // reverse if right-to-left and using transform
935
+ x = this.options.rightToLeft ? -x : x;
936
+ var translateX = this.getPositionValue( x );
937
+ // use 3D transforms for hardware acceleration on iOS
938
+ // but use 2D when settled, for better font-rendering
939
+ this.slider.style.transform = is3d ?
940
+ 'translate3d(' + translateX + ',0,0)' : 'translateX(' + translateX + ')';
941
+ };
942
+
943
+ proto.dispatchScrollEvent = function() {
944
+ var firstSlide = this.slides[0];
945
+ if ( !firstSlide ) {
946
+ return;
947
+ }
948
+ var positionX = -this.x - firstSlide.target;
949
+ var progress = positionX / this.slidesWidth;
950
+ this.dispatchEvent( 'scroll', null, [ progress, positionX ] );
951
+ };
952
+
953
+ proto.positionSliderAtSelected = function() {
954
+ if ( !this.cells.length ) {
955
+ return;
956
+ }
957
+ this.x = -this.selectedSlide.target;
958
+ this.velocity = 0; // stop wobble
959
+ this.positionSlider();
960
+ };
961
+
962
+ proto.getPositionValue = function( position ) {
963
+ if ( this.options.percentPosition ) {
964
+ // percent position, round to 2 digits, like 12.34%
965
+ return ( Math.round( ( position / this.size.innerWidth ) * 10000 ) * 0.01 ) + '%';
966
+ } else {
967
+ // pixel positioning
968
+ return Math.round( position ) + 'px';
969
+ }
970
+ };
971
+
972
+ proto.settle = function( previousX ) {
973
+ // keep track of frames where x hasn't moved
974
+ var isResting = !this.isPointerDown &&
975
+ Math.round( this.x * 100 ) == Math.round( previousX * 100 );
976
+ if ( isResting ) {
977
+ this.restingFrames++;
978
+ }
979
+ // stop animating if resting for 3 or more frames
980
+ if ( this.restingFrames > 2 ) {
981
+ this.isAnimating = false;
982
+ delete this.isFreeScrolling;
983
+ // render position with translateX when settled
984
+ this.positionSlider();
985
+ this.dispatchEvent( 'settle', null, [ this.selectedIndex ] );
986
+ }
987
+ };
988
+
989
+ proto.shiftWrapCells = function( x ) {
990
+ // shift before cells
991
+ var beforeGap = this.cursorPosition + x;
992
+ this._shiftCells( this.beforeShiftCells, beforeGap, -1 );
993
+ // shift after cells
994
+ var afterGap = this.size.innerWidth - ( x + this.slideableWidth + this.cursorPosition );
995
+ this._shiftCells( this.afterShiftCells, afterGap, 1 );
996
+ };
997
+
998
+ proto._shiftCells = function( cells, gap, shift ) {
999
+ for ( var i = 0; i < cells.length; i++ ) {
1000
+ var cell = cells[i];
1001
+ var cellShift = gap > 0 ? shift : 0;
1002
+ cell.wrapShift( cellShift );
1003
+ gap -= cell.size.outerWidth;
1004
+ }
1005
+ };
1006
+
1007
+ proto._unshiftCells = function( cells ) {
1008
+ if ( !cells || !cells.length ) {
1009
+ return;
1010
+ }
1011
+ for ( var i = 0; i < cells.length; i++ ) {
1012
+ cells[i].wrapShift( 0 );
1013
+ }
1014
+ };
1015
+
1016
+ // -------------------------- physics -------------------------- //
1017
+
1018
+ proto.integratePhysics = function() {
1019
+ this.x += this.velocity;
1020
+ this.velocity *= this.getFrictionFactor();
1021
+ };
1022
+
1023
+ proto.applyForce = function( force ) {
1024
+ this.velocity += force;
1025
+ };
1026
+
1027
+ proto.getFrictionFactor = function() {
1028
+ return 1 - this.options[ this.isFreeScrolling ? 'freeScrollFriction' : 'friction' ];
1029
+ };
1030
+
1031
+ proto.getRestingPosition = function() {
1032
+ // my thanks to Steven Wittens, who simplified this math greatly
1033
+ return this.x + this.velocity / ( 1 - this.getFrictionFactor() );
1034
+ };
1035
+
1036
+ proto.applyDragForce = function() {
1037
+ if ( !this.isDraggable || !this.isPointerDown ) {
1038
+ return;
1039
+ }
1040
+ // change the position to drag position by applying force
1041
+ var dragVelocity = this.dragX - this.x;
1042
+ var dragForce = dragVelocity - this.velocity;
1043
+ this.applyForce( dragForce );
1044
+ };
1045
+
1046
+ proto.applySelectedAttraction = function() {
1047
+ // do not attract if pointer down or no slides
1048
+ var dragDown = this.isDraggable && this.isPointerDown;
1049
+ if ( dragDown || this.isFreeScrolling || !this.slides.length ) {
1050
+ return;
1051
+ }
1052
+ var distance = this.selectedSlide.target * -1 - this.x;
1053
+ var force = distance * this.options.selectedAttraction;
1054
+ this.applyForce( force );
1055
+ };
1056
+
1057
+ return proto;
1058
+
1059
+ } ) );
1060
+ } (animate));
1061
+ return animate.exports;
1062
+ }
1063
+
1064
+ var hasRequiredFlickity;
1065
+
1066
+ function requireFlickity () {
1067
+ if (hasRequiredFlickity) return flickity.exports;
1068
+ hasRequiredFlickity = 1;
1069
+ (function (module) {
1070
+ // Flickity main
1071
+ /* eslint-disable max-params */
1072
+ ( function( window, factory ) {
1073
+ // universal module definition
1074
+ if ( module.exports ) {
1075
+ // CommonJS
1076
+ module.exports = factory(
1077
+ window,
1078
+ requireEvEmitter(),
1079
+ requireGetSize(),
1080
+ requireUtils(),
1081
+ requireCell(),
1082
+ requireSlide(),
1083
+ requireAnimate()
1084
+ );
1085
+ } else {
1086
+ // browser global
1087
+ var _Flickity = window.Flickity;
1088
+
1089
+ window.Flickity = factory(
1090
+ window,
1091
+ window.EvEmitter,
1092
+ window.getSize,
1093
+ window.fizzyUIUtils,
1094
+ _Flickity.Cell,
1095
+ _Flickity.Slide,
1096
+ _Flickity.animatePrototype
1097
+ );
1098
+ }
1099
+
1100
+ }( window, function factory( window, EvEmitter, getSize,
1101
+ utils, Cell, Slide, animatePrototype ) {
1102
+
1103
+ // vars
1104
+ var jQuery = window.jQuery;
1105
+ var getComputedStyle = window.getComputedStyle;
1106
+ var console = window.console;
1107
+
1108
+ function moveElements( elems, toElem ) {
1109
+ elems = utils.makeArray( elems );
1110
+ while ( elems.length ) {
1111
+ toElem.appendChild( elems.shift() );
1112
+ }
1113
+ }
1114
+
1115
+ // -------------------------- Flickity -------------------------- //
1116
+
1117
+ // globally unique identifiers
1118
+ var GUID = 0;
1119
+ // internal store of all Flickity intances
1120
+ var instances = {};
1121
+
1122
+ function Flickity( element, options ) {
1123
+ var queryElement = utils.getQueryElement( element );
1124
+ if ( !queryElement ) {
1125
+ if ( console ) {
1126
+ console.error( 'Bad element for Flickity: ' + ( queryElement || element ) );
1127
+ }
1128
+ return;
1129
+ }
1130
+ this.element = queryElement;
1131
+ // do not initialize twice on same element
1132
+ if ( this.element.flickityGUID ) {
1133
+ var instance = instances[ this.element.flickityGUID ];
1134
+ if ( instance ) instance.option( options );
1135
+ return instance;
1136
+ }
1137
+
1138
+ // add jQuery
1139
+ if ( jQuery ) {
1140
+ this.$element = jQuery( this.element );
1141
+ }
1142
+ // options
1143
+ this.options = utils.extend( {}, this.constructor.defaults );
1144
+ this.option( options );
1145
+
1146
+ // kick things off
1147
+ this._create();
1148
+ }
1149
+
1150
+ Flickity.defaults = {
1151
+ accessibility: true,
1152
+ // adaptiveHeight: false,
1153
+ cellAlign: 'center',
1154
+ // cellSelector: undefined,
1155
+ // contain: false,
1156
+ freeScrollFriction: 0.075, // friction when free-scrolling
1157
+ friction: 0.28, // friction when selecting
1158
+ namespaceJQueryEvents: true,
1159
+ // initialIndex: 0,
1160
+ percentPosition: true,
1161
+ resize: true,
1162
+ selectedAttraction: 0.025,
1163
+ setGallerySize: true,
1164
+ // watchCSS: false,
1165
+ // wrapAround: false
1166
+ };
1167
+
1168
+ // hash of methods triggered on _create()
1169
+ Flickity.createMethods = [];
1170
+
1171
+ var proto = Flickity.prototype;
1172
+ // inherit EventEmitter
1173
+ utils.extend( proto, EvEmitter.prototype );
1174
+
1175
+ proto._create = function() {
1176
+ // add id for Flickity.data
1177
+ var id = this.guid = ++GUID;
1178
+ this.element.flickityGUID = id; // expando
1179
+ instances[ id ] = this; // associate via id
1180
+ // initial properties
1181
+ this.selectedIndex = 0;
1182
+ // how many frames slider has been in same position
1183
+ this.restingFrames = 0;
1184
+ // initial physics properties
1185
+ this.x = 0;
1186
+ this.velocity = 0;
1187
+ this.originSide = this.options.rightToLeft ? 'right' : 'left';
1188
+ // create viewport & slider
1189
+ this.viewport = document.createElement('div');
1190
+ this.viewport.className = 'flickity-viewport';
1191
+ this._createSlider();
1192
+
1193
+ if ( this.options.resize || this.options.watchCSS ) {
1194
+ window.addEventListener( 'resize', this );
1195
+ }
1196
+
1197
+ // add listeners from on option
1198
+ for ( var eventName in this.options.on ) {
1199
+ var listener = this.options.on[ eventName ];
1200
+ this.on( eventName, listener );
1201
+ }
1202
+
1203
+ Flickity.createMethods.forEach( function( method ) {
1204
+ this[ method ]();
1205
+ }, this );
1206
+
1207
+ if ( this.options.watchCSS ) {
1208
+ this.watchCSS();
1209
+ } else {
1210
+ this.activate();
1211
+ }
1212
+
1213
+ };
1214
+
1215
+ /**
1216
+ * set options
1217
+ * @param {Object} opts - options to extend
1218
+ */
1219
+ proto.option = function( opts ) {
1220
+ utils.extend( this.options, opts );
1221
+ };
1222
+
1223
+ proto.activate = function() {
1224
+ if ( this.isActive ) {
1225
+ return;
1226
+ }
1227
+ this.isActive = true;
1228
+ this.element.classList.add('flickity-enabled');
1229
+ if ( this.options.rightToLeft ) {
1230
+ this.element.classList.add('flickity-rtl');
1231
+ }
1232
+
1233
+ this.getSize();
1234
+ // move initial cell elements so they can be loaded as cells
1235
+ var cellElems = this._filterFindCellElements( this.element.children );
1236
+ moveElements( cellElems, this.slider );
1237
+ this.viewport.appendChild( this.slider );
1238
+ this.element.appendChild( this.viewport );
1239
+ // get cells from children
1240
+ this.reloadCells();
1241
+
1242
+ if ( this.options.accessibility ) {
1243
+ // allow element to focusable
1244
+ this.element.tabIndex = 0;
1245
+ // listen for key presses
1246
+ this.element.addEventListener( 'keydown', this );
1247
+ }
1248
+
1249
+ this.emitEvent('activate');
1250
+ this.selectInitialIndex();
1251
+ // flag for initial activation, for using initialIndex
1252
+ this.isInitActivated = true;
1253
+ // ready event. #493
1254
+ this.dispatchEvent('ready');
1255
+ };
1256
+
1257
+ // slider positions the cells
1258
+ proto._createSlider = function() {
1259
+ // slider element does all the positioning
1260
+ var slider = document.createElement('div');
1261
+ slider.className = 'flickity-slider';
1262
+ slider.style[ this.originSide ] = 0;
1263
+ this.slider = slider;
1264
+ };
1265
+
1266
+ proto._filterFindCellElements = function( elems ) {
1267
+ return utils.filterFindElements( elems, this.options.cellSelector );
1268
+ };
1269
+
1270
+ // goes through all children
1271
+ proto.reloadCells = function() {
1272
+ // collection of item elements
1273
+ this.cells = this._makeCells( this.slider.children );
1274
+ this.positionCells();
1275
+ this._getWrapShiftCells();
1276
+ this.setGallerySize();
1277
+ };
1278
+
1279
+ /**
1280
+ * turn elements into Flickity.Cells
1281
+ * @param {[Array, NodeList, HTMLElement]} elems - elements to make into cells
1282
+ * @returns {Array} items - collection of new Flickity Cells
1283
+ */
1284
+ proto._makeCells = function( elems ) {
1285
+ var cellElems = this._filterFindCellElements( elems );
1286
+
1287
+ // create new Flickity for collection
1288
+ var cells = cellElems.map( function( cellElem ) {
1289
+ return new Cell( cellElem, this );
1290
+ }, this );
1291
+
1292
+ return cells;
1293
+ };
1294
+
1295
+ proto.getLastCell = function() {
1296
+ return this.cells[ this.cells.length - 1 ];
1297
+ };
1298
+
1299
+ proto.getLastSlide = function() {
1300
+ return this.slides[ this.slides.length - 1 ];
1301
+ };
1302
+
1303
+ // positions all cells
1304
+ proto.positionCells = function() {
1305
+ // size all cells
1306
+ this._sizeCells( this.cells );
1307
+ // position all cells
1308
+ this._positionCells( 0 );
1309
+ };
1310
+
1311
+ /**
1312
+ * position certain cells
1313
+ * @param {Integer} index - which cell to start with
1314
+ */
1315
+ proto._positionCells = function( index ) {
1316
+ index = index || 0;
1317
+ // also measure maxCellHeight
1318
+ // start 0 if positioning all cells
1319
+ this.maxCellHeight = index ? this.maxCellHeight || 0 : 0;
1320
+ var cellX = 0;
1321
+ // get cellX
1322
+ if ( index > 0 ) {
1323
+ var startCell = this.cells[ index - 1 ];
1324
+ cellX = startCell.x + startCell.size.outerWidth;
1325
+ }
1326
+ var len = this.cells.length;
1327
+ for ( var i = index; i < len; i++ ) {
1328
+ var cell = this.cells[i];
1329
+ cell.setPosition( cellX );
1330
+ cellX += cell.size.outerWidth;
1331
+ this.maxCellHeight = Math.max( cell.size.outerHeight, this.maxCellHeight );
1332
+ }
1333
+ // keep track of cellX for wrap-around
1334
+ this.slideableWidth = cellX;
1335
+ // slides
1336
+ this.updateSlides();
1337
+ // contain slides target
1338
+ this._containSlides();
1339
+ // update slidesWidth
1340
+ this.slidesWidth = len ? this.getLastSlide().target - this.slides[0].target : 0;
1341
+ };
1342
+
1343
+ /**
1344
+ * cell.getSize() on multiple cells
1345
+ * @param {Array} cells - cells to size
1346
+ */
1347
+ proto._sizeCells = function( cells ) {
1348
+ cells.forEach( function( cell ) {
1349
+ cell.getSize();
1350
+ } );
1351
+ };
1352
+
1353
+ // -------------------------- -------------------------- //
1354
+
1355
+ proto.updateSlides = function() {
1356
+ this.slides = [];
1357
+ if ( !this.cells.length ) {
1358
+ return;
1359
+ }
1360
+
1361
+ var slide = new Slide( this );
1362
+ this.slides.push( slide );
1363
+ var isOriginLeft = this.originSide == 'left';
1364
+ var nextMargin = isOriginLeft ? 'marginRight' : 'marginLeft';
1365
+
1366
+ var canCellFit = this._getCanCellFit();
1367
+
1368
+ this.cells.forEach( function( cell, i ) {
1369
+ // just add cell if first cell in slide
1370
+ if ( !slide.cells.length ) {
1371
+ slide.addCell( cell );
1372
+ return;
1373
+ }
1374
+
1375
+ var slideWidth = ( slide.outerWidth - slide.firstMargin ) +
1376
+ ( cell.size.outerWidth - cell.size[ nextMargin ] );
1377
+
1378
+ if ( canCellFit.call( this, i, slideWidth ) ) {
1379
+ slide.addCell( cell );
1380
+ } else {
1381
+ // doesn't fit, new slide
1382
+ slide.updateTarget();
1383
+
1384
+ slide = new Slide( this );
1385
+ this.slides.push( slide );
1386
+ slide.addCell( cell );
1387
+ }
1388
+ }, this );
1389
+ // last slide
1390
+ slide.updateTarget();
1391
+ // update .selectedSlide
1392
+ this.updateSelectedSlide();
1393
+ };
1394
+
1395
+ proto._getCanCellFit = function() {
1396
+ var groupCells = this.options.groupCells;
1397
+ if ( !groupCells ) {
1398
+ return function() {
1399
+ return false;
1400
+ };
1401
+ } else if ( typeof groupCells == 'number' ) {
1402
+ // group by number. 3 -> [0,1,2], [3,4,5], ...
1403
+ var number = parseInt( groupCells, 10 );
1404
+ return function( i ) {
1405
+ return ( i % number ) !== 0;
1406
+ };
1407
+ }
1408
+ // default, group by width of slide
1409
+ // parse '75%
1410
+ var percentMatch = typeof groupCells == 'string' &&
1411
+ groupCells.match( /^(\d+)%$/ );
1412
+ var percent = percentMatch ? parseInt( percentMatch[1], 10 ) / 100 : 1;
1413
+ return function( i, slideWidth ) {
1414
+ /* eslint-disable-next-line no-invalid-this */
1415
+ return slideWidth <= ( this.size.innerWidth + 1 ) * percent;
1416
+ };
1417
+ };
1418
+
1419
+ // alias _init for jQuery plugin .flickity()
1420
+ proto._init =
1421
+ proto.reposition = function() {
1422
+ this.positionCells();
1423
+ this.positionSliderAtSelected();
1424
+ };
1425
+
1426
+ proto.getSize = function() {
1427
+ this.size = getSize( this.element );
1428
+ this.setCellAlign();
1429
+ this.cursorPosition = this.size.innerWidth * this.cellAlign;
1430
+ };
1431
+
1432
+ var cellAlignShorthands = {
1433
+ // cell align, then based on origin side
1434
+ center: {
1435
+ left: 0.5,
1436
+ right: 0.5,
1437
+ },
1438
+ left: {
1439
+ left: 0,
1440
+ right: 1,
1441
+ },
1442
+ right: {
1443
+ right: 0,
1444
+ left: 1,
1445
+ },
1446
+ };
1447
+
1448
+ proto.setCellAlign = function() {
1449
+ var shorthand = cellAlignShorthands[ this.options.cellAlign ];
1450
+ this.cellAlign = shorthand ? shorthand[ this.originSide ] : this.options.cellAlign;
1451
+ };
1452
+
1453
+ proto.setGallerySize = function() {
1454
+ if ( this.options.setGallerySize ) {
1455
+ var height = this.options.adaptiveHeight && this.selectedSlide ?
1456
+ this.selectedSlide.height : this.maxCellHeight;
1457
+ this.viewport.style.height = height + 'px';
1458
+ }
1459
+ };
1460
+
1461
+ proto._getWrapShiftCells = function() {
1462
+ // only for wrap-around
1463
+ if ( !this.options.wrapAround ) {
1464
+ return;
1465
+ }
1466
+ // unshift previous cells
1467
+ this._unshiftCells( this.beforeShiftCells );
1468
+ this._unshiftCells( this.afterShiftCells );
1469
+ // get before cells
1470
+ // initial gap
1471
+ var gapX = this.cursorPosition;
1472
+ var cellIndex = this.cells.length - 1;
1473
+ this.beforeShiftCells = this._getGapCells( gapX, cellIndex, -1 );
1474
+ // get after cells
1475
+ // ending gap between last cell and end of gallery viewport
1476
+ gapX = this.size.innerWidth - this.cursorPosition;
1477
+ // start cloning at first cell, working forwards
1478
+ this.afterShiftCells = this._getGapCells( gapX, 0, 1 );
1479
+ };
1480
+
1481
+ proto._getGapCells = function( gapX, cellIndex, increment ) {
1482
+ // keep adding cells until the cover the initial gap
1483
+ var cells = [];
1484
+ while ( gapX > 0 ) {
1485
+ var cell = this.cells[ cellIndex ];
1486
+ if ( !cell ) {
1487
+ break;
1488
+ }
1489
+ cells.push( cell );
1490
+ cellIndex += increment;
1491
+ gapX -= cell.size.outerWidth;
1492
+ }
1493
+ return cells;
1494
+ };
1495
+
1496
+ // ----- contain ----- //
1497
+
1498
+ // contain cell targets so no excess sliding
1499
+ proto._containSlides = function() {
1500
+ if ( !this.options.contain || this.options.wrapAround || !this.cells.length ) {
1501
+ return;
1502
+ }
1503
+ var isRightToLeft = this.options.rightToLeft;
1504
+ var beginMargin = isRightToLeft ? 'marginRight' : 'marginLeft';
1505
+ var endMargin = isRightToLeft ? 'marginLeft' : 'marginRight';
1506
+ var contentWidth = this.slideableWidth - this.getLastCell().size[ endMargin ];
1507
+ // content is less than gallery size
1508
+ var isContentSmaller = contentWidth < this.size.innerWidth;
1509
+ // bounds
1510
+ var beginBound = this.cursorPosition + this.cells[0].size[ beginMargin ];
1511
+ var endBound = contentWidth - this.size.innerWidth * ( 1 - this.cellAlign );
1512
+ // contain each cell target
1513
+ this.slides.forEach( function( slide ) {
1514
+ if ( isContentSmaller ) {
1515
+ // all cells fit inside gallery
1516
+ slide.target = contentWidth * this.cellAlign;
1517
+ } else {
1518
+ // contain to bounds
1519
+ slide.target = Math.max( slide.target, beginBound );
1520
+ slide.target = Math.min( slide.target, endBound );
1521
+ }
1522
+ }, this );
1523
+ };
1524
+
1525
+ // ----- ----- //
1526
+
1527
+ /**
1528
+ * emits events via eventEmitter and jQuery events
1529
+ * @param {String} type - name of event
1530
+ * @param {Event} event - original event
1531
+ * @param {Array} args - extra arguments
1532
+ */
1533
+ proto.dispatchEvent = function( type, event, args ) {
1534
+ var emitArgs = event ? [ event ].concat( args ) : args;
1535
+ this.emitEvent( type, emitArgs );
1536
+
1537
+ if ( jQuery && this.$element ) {
1538
+ // default trigger with type if no event
1539
+ type += this.options.namespaceJQueryEvents ? '.flickity' : '';
1540
+ var $event = type;
1541
+ if ( event ) {
1542
+ // create jQuery event
1543
+ var jQEvent = new jQuery.Event( event );
1544
+ jQEvent.type = type;
1545
+ $event = jQEvent;
1546
+ }
1547
+ this.$element.trigger( $event, args );
1548
+ }
1549
+ };
1550
+
1551
+ // -------------------------- select -------------------------- //
1552
+
1553
+ /**
1554
+ * @param {Integer} index - index of the slide
1555
+ * @param {Boolean} isWrap - will wrap-around to last/first if at the end
1556
+ * @param {Boolean} isInstant - will immediately set position at selected cell
1557
+ */
1558
+ proto.select = function( index, isWrap, isInstant ) {
1559
+ if ( !this.isActive ) {
1560
+ return;
1561
+ }
1562
+ index = parseInt( index, 10 );
1563
+ this._wrapSelect( index );
1564
+
1565
+ if ( this.options.wrapAround || isWrap ) {
1566
+ index = utils.modulo( index, this.slides.length );
1567
+ }
1568
+ // bail if invalid index
1569
+ if ( !this.slides[ index ] ) {
1570
+ return;
1571
+ }
1572
+ var prevIndex = this.selectedIndex;
1573
+ this.selectedIndex = index;
1574
+ this.updateSelectedSlide();
1575
+ if ( isInstant ) {
1576
+ this.positionSliderAtSelected();
1577
+ } else {
1578
+ this.startAnimation();
1579
+ }
1580
+ if ( this.options.adaptiveHeight ) {
1581
+ this.setGallerySize();
1582
+ }
1583
+ // events
1584
+ this.dispatchEvent( 'select', null, [ index ] );
1585
+ // change event if new index
1586
+ if ( index != prevIndex ) {
1587
+ this.dispatchEvent( 'change', null, [ index ] );
1588
+ }
1589
+ // old v1 event name, remove in v3
1590
+ this.dispatchEvent('cellSelect');
1591
+ };
1592
+
1593
+ // wraps position for wrapAround, to move to closest slide. #113
1594
+ proto._wrapSelect = function( index ) {
1595
+ var len = this.slides.length;
1596
+ var isWrapping = this.options.wrapAround && len > 1;
1597
+ if ( !isWrapping ) {
1598
+ return index;
1599
+ }
1600
+ var wrapIndex = utils.modulo( index, len );
1601
+ // go to shortest
1602
+ var delta = Math.abs( wrapIndex - this.selectedIndex );
1603
+ var backWrapDelta = Math.abs( ( wrapIndex + len ) - this.selectedIndex );
1604
+ var forewardWrapDelta = Math.abs( ( wrapIndex - len ) - this.selectedIndex );
1605
+ if ( !this.isDragSelect && backWrapDelta < delta ) {
1606
+ index += len;
1607
+ } else if ( !this.isDragSelect && forewardWrapDelta < delta ) {
1608
+ index -= len;
1609
+ }
1610
+ // wrap position so slider is within normal area
1611
+ if ( index < 0 ) {
1612
+ this.x -= this.slideableWidth;
1613
+ } else if ( index >= len ) {
1614
+ this.x += this.slideableWidth;
1615
+ }
1616
+ };
1617
+
1618
+ proto.previous = function( isWrap, isInstant ) {
1619
+ this.select( this.selectedIndex - 1, isWrap, isInstant );
1620
+ };
1621
+
1622
+ proto.next = function( isWrap, isInstant ) {
1623
+ this.select( this.selectedIndex + 1, isWrap, isInstant );
1624
+ };
1625
+
1626
+ proto.updateSelectedSlide = function() {
1627
+ var slide = this.slides[ this.selectedIndex ];
1628
+ // selectedIndex could be outside of slides, if triggered before resize()
1629
+ if ( !slide ) {
1630
+ return;
1631
+ }
1632
+ // unselect previous selected slide
1633
+ this.unselectSelectedSlide();
1634
+ // update new selected slide
1635
+ this.selectedSlide = slide;
1636
+ slide.select();
1637
+ this.selectedCells = slide.cells;
1638
+ this.selectedElements = slide.getCellElements();
1639
+ // HACK: selectedCell & selectedElement is first cell in slide, backwards compatibility
1640
+ // Remove in v3?
1641
+ this.selectedCell = slide.cells[0];
1642
+ this.selectedElement = this.selectedElements[0];
1643
+ };
1644
+
1645
+ proto.unselectSelectedSlide = function() {
1646
+ if ( this.selectedSlide ) {
1647
+ this.selectedSlide.unselect();
1648
+ }
1649
+ };
1650
+
1651
+ proto.selectInitialIndex = function() {
1652
+ var initialIndex = this.options.initialIndex;
1653
+ // already activated, select previous selectedIndex
1654
+ if ( this.isInitActivated ) {
1655
+ this.select( this.selectedIndex, false, true );
1656
+ return;
1657
+ }
1658
+ // select with selector string
1659
+ if ( initialIndex && typeof initialIndex == 'string' ) {
1660
+ var cell = this.queryCell( initialIndex );
1661
+ if ( cell ) {
1662
+ this.selectCell( initialIndex, false, true );
1663
+ return;
1664
+ }
1665
+ }
1666
+
1667
+ var index = 0;
1668
+ // select with number
1669
+ if ( initialIndex && this.slides[ initialIndex ] ) {
1670
+ index = initialIndex;
1671
+ }
1672
+ // select instantly
1673
+ this.select( index, false, true );
1674
+ };
1675
+
1676
+ /**
1677
+ * select slide from number or cell element
1678
+ * @param {[Element, Number]} value - zero-based index or element to select
1679
+ * @param {Boolean} isWrap - enables wrapping around for extra index
1680
+ * @param {Boolean} isInstant - disables slide animation
1681
+ */
1682
+ proto.selectCell = function( value, isWrap, isInstant ) {
1683
+ // get cell
1684
+ var cell = this.queryCell( value );
1685
+ if ( !cell ) {
1686
+ return;
1687
+ }
1688
+
1689
+ var index = this.getCellSlideIndex( cell );
1690
+ this.select( index, isWrap, isInstant );
1691
+ };
1692
+
1693
+ proto.getCellSlideIndex = function( cell ) {
1694
+ // get index of slides that has cell
1695
+ for ( var i = 0; i < this.slides.length; i++ ) {
1696
+ var slide = this.slides[i];
1697
+ var index = slide.cells.indexOf( cell );
1698
+ if ( index != -1 ) {
1699
+ return i;
1700
+ }
1701
+ }
1702
+ };
1703
+
1704
+ // -------------------------- get cells -------------------------- //
1705
+
1706
+ /**
1707
+ * get Flickity.Cell, given an Element
1708
+ * @param {Element} elem - matching cell element
1709
+ * @returns {Flickity.Cell} cell - matching cell
1710
+ */
1711
+ proto.getCell = function( elem ) {
1712
+ // loop through cells to get the one that matches
1713
+ for ( var i = 0; i < this.cells.length; i++ ) {
1714
+ var cell = this.cells[i];
1715
+ if ( cell.element == elem ) {
1716
+ return cell;
1717
+ }
1718
+ }
1719
+ };
1720
+
1721
+ /**
1722
+ * get collection of Flickity.Cells, given Elements
1723
+ * @param {[Element, Array, NodeList]} elems - multiple elements
1724
+ * @returns {Array} cells - Flickity.Cells
1725
+ */
1726
+ proto.getCells = function( elems ) {
1727
+ elems = utils.makeArray( elems );
1728
+ var cells = [];
1729
+ elems.forEach( function( elem ) {
1730
+ var cell = this.getCell( elem );
1731
+ if ( cell ) {
1732
+ cells.push( cell );
1733
+ }
1734
+ }, this );
1735
+ return cells;
1736
+ };
1737
+
1738
+ /**
1739
+ * get cell elements
1740
+ * @returns {Array} cellElems
1741
+ */
1742
+ proto.getCellElements = function() {
1743
+ return this.cells.map( function( cell ) {
1744
+ return cell.element;
1745
+ } );
1746
+ };
1747
+
1748
+ /**
1749
+ * get parent cell from an element
1750
+ * @param {Element} elem - child element
1751
+ * @returns {Flickit.Cell} cell - parent cell
1752
+ */
1753
+ proto.getParentCell = function( elem ) {
1754
+ // first check if elem is cell
1755
+ var cell = this.getCell( elem );
1756
+ if ( cell ) {
1757
+ return cell;
1758
+ }
1759
+ // try to get parent cell elem
1760
+ elem = utils.getParent( elem, '.flickity-slider > *' );
1761
+ return this.getCell( elem );
1762
+ };
1763
+
1764
+ /**
1765
+ * get cells adjacent to a slide
1766
+ * @param {Integer} adjCount - number of adjacent slides
1767
+ * @param {Integer} index - index of slide to start
1768
+ * @returns {Array} cells - array of Flickity.Cells
1769
+ */
1770
+ proto.getAdjacentCellElements = function( adjCount, index ) {
1771
+ if ( !adjCount ) {
1772
+ return this.selectedSlide.getCellElements();
1773
+ }
1774
+ index = index === undefined ? this.selectedIndex : index;
1775
+
1776
+ var len = this.slides.length;
1777
+ if ( 1 + ( adjCount * 2 ) >= len ) {
1778
+ return this.getCellElements();
1779
+ }
1780
+
1781
+ var cellElems = [];
1782
+ for ( var i = index - adjCount; i <= index + adjCount; i++ ) {
1783
+ var slideIndex = this.options.wrapAround ? utils.modulo( i, len ) : i;
1784
+ var slide = this.slides[ slideIndex ];
1785
+ if ( slide ) {
1786
+ cellElems = cellElems.concat( slide.getCellElements() );
1787
+ }
1788
+ }
1789
+ return cellElems;
1790
+ };
1791
+
1792
+ /**
1793
+ * select slide from number or cell element
1794
+ * @param {[Element, String, Number]} selector - element, selector string, or index
1795
+ * @returns {Flickity.Cell} - matching cell
1796
+ */
1797
+ proto.queryCell = function( selector ) {
1798
+ if ( typeof selector == 'number' ) {
1799
+ // use number as index
1800
+ return this.cells[ selector ];
1801
+ }
1802
+ if ( typeof selector == 'string' ) {
1803
+ // do not select invalid selectors from hash: #123, #/. #791
1804
+ if ( selector.match( /^[#.]?[\d/]/ ) ) {
1805
+ return;
1806
+ }
1807
+ // use string as selector, get element
1808
+ selector = this.element.querySelector( selector );
1809
+ }
1810
+ // get cell from element
1811
+ return this.getCell( selector );
1812
+ };
1813
+
1814
+ // -------------------------- events -------------------------- //
1815
+
1816
+ proto.uiChange = function() {
1817
+ this.emitEvent('uiChange');
1818
+ };
1819
+
1820
+ // keep focus on element when child UI elements are clicked
1821
+ proto.childUIPointerDown = function( event ) {
1822
+ // HACK iOS does not allow touch events to bubble up?!
1823
+ if ( event.type != 'touchstart' ) {
1824
+ event.preventDefault();
1825
+ }
1826
+ this.focus();
1827
+ };
1828
+
1829
+ // ----- resize ----- //
1830
+
1831
+ proto.onresize = function() {
1832
+ this.watchCSS();
1833
+ this.resize();
1834
+ };
1835
+
1836
+ utils.debounceMethod( Flickity, 'onresize', 150 );
1837
+
1838
+ proto.resize = function() {
1839
+ // #1177 disable resize behavior when animating or dragging for iOS 15
1840
+ if ( !this.isActive || this.isAnimating || this.isDragging ) {
1841
+ return;
1842
+ }
1843
+ this.getSize();
1844
+ // wrap values
1845
+ if ( this.options.wrapAround ) {
1846
+ this.x = utils.modulo( this.x, this.slideableWidth );
1847
+ }
1848
+ this.positionCells();
1849
+ this._getWrapShiftCells();
1850
+ this.setGallerySize();
1851
+ this.emitEvent('resize');
1852
+ // update selected index for group slides, instant
1853
+ // TODO: position can be lost between groups of various numbers
1854
+ var selectedElement = this.selectedElements && this.selectedElements[0];
1855
+ this.selectCell( selectedElement, false, true );
1856
+ };
1857
+
1858
+ // watches the :after property, activates/deactivates
1859
+ proto.watchCSS = function() {
1860
+ var watchOption = this.options.watchCSS;
1861
+ if ( !watchOption ) {
1862
+ return;
1863
+ }
1864
+
1865
+ var afterContent = getComputedStyle( this.element, ':after' ).content;
1866
+ // activate if :after { content: 'flickity' }
1867
+ if ( afterContent.indexOf('flickity') != -1 ) {
1868
+ this.activate();
1869
+ } else {
1870
+ this.deactivate();
1871
+ }
1872
+ };
1873
+
1874
+ // ----- keydown ----- //
1875
+
1876
+ // go previous/next if left/right keys pressed
1877
+ proto.onkeydown = function( event ) {
1878
+ // only work if element is in focus
1879
+ var isNotFocused = document.activeElement && document.activeElement != this.element;
1880
+ if ( !this.options.accessibility || isNotFocused ) {
1881
+ return;
1882
+ }
1883
+
1884
+ var handler = Flickity.keyboardHandlers[ event.keyCode ];
1885
+ if ( handler ) {
1886
+ handler.call( this );
1887
+ }
1888
+ };
1889
+
1890
+ Flickity.keyboardHandlers = {
1891
+ // left arrow
1892
+ 37: function() {
1893
+ var leftMethod = this.options.rightToLeft ? 'next' : 'previous';
1894
+ this.uiChange();
1895
+ this[ leftMethod ]();
1896
+ },
1897
+ // right arrow
1898
+ 39: function() {
1899
+ var rightMethod = this.options.rightToLeft ? 'previous' : 'next';
1900
+ this.uiChange();
1901
+ this[ rightMethod ]();
1902
+ },
1903
+ };
1904
+
1905
+ // ----- focus ----- //
1906
+
1907
+ proto.focus = function() {
1908
+ // TODO remove scrollTo once focus options gets more support
1909
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus ...
1910
+ // #Browser_compatibility
1911
+ var prevScrollY = window.pageYOffset;
1912
+ this.element.focus({ preventScroll: true });
1913
+ // hack to fix scroll jump after focus, #76
1914
+ if ( window.pageYOffset != prevScrollY ) {
1915
+ window.scrollTo( window.pageXOffset, prevScrollY );
1916
+ }
1917
+ };
1918
+
1919
+ // -------------------------- destroy -------------------------- //
1920
+
1921
+ // deactivate all Flickity functionality, but keep stuff available
1922
+ proto.deactivate = function() {
1923
+ if ( !this.isActive ) {
1924
+ return;
1925
+ }
1926
+ this.element.classList.remove('flickity-enabled');
1927
+ this.element.classList.remove('flickity-rtl');
1928
+ this.unselectSelectedSlide();
1929
+ // destroy cells
1930
+ this.cells.forEach( function( cell ) {
1931
+ cell.destroy();
1932
+ } );
1933
+ this.element.removeChild( this.viewport );
1934
+ // move child elements back into element
1935
+ moveElements( this.slider.children, this.element );
1936
+ if ( this.options.accessibility ) {
1937
+ this.element.removeAttribute('tabIndex');
1938
+ this.element.removeEventListener( 'keydown', this );
1939
+ }
1940
+ // set flags
1941
+ this.isActive = false;
1942
+ this.emitEvent('deactivate');
1943
+ };
1944
+
1945
+ proto.destroy = function() {
1946
+ this.deactivate();
1947
+ window.removeEventListener( 'resize', this );
1948
+ this.allOff();
1949
+ this.emitEvent('destroy');
1950
+ if ( jQuery && this.$element ) {
1951
+ jQuery.removeData( this.element, 'flickity' );
1952
+ }
1953
+ delete this.element.flickityGUID;
1954
+ delete instances[ this.guid ];
1955
+ };
1956
+
1957
+ // -------------------------- prototype -------------------------- //
1958
+
1959
+ utils.extend( proto, animatePrototype );
1960
+
1961
+ // -------------------------- extras -------------------------- //
1962
+
1963
+ /**
1964
+ * get Flickity instance from element
1965
+ * @param {[Element, String]} elem - element or selector string
1966
+ * @returns {Flickity} - Flickity instance
1967
+ */
1968
+ Flickity.data = function( elem ) {
1969
+ elem = utils.getQueryElement( elem );
1970
+ var id = elem && elem.flickityGUID;
1971
+ return id && instances[ id ];
1972
+ };
1973
+
1974
+ utils.htmlInit( Flickity, 'flickity' );
1975
+
1976
+ if ( jQuery && jQuery.bridget ) {
1977
+ jQuery.bridget( 'flickity', Flickity );
1978
+ }
1979
+
1980
+ // set internal jQuery, for Webpack + jQuery v3, #478
1981
+ Flickity.setJQuery = function( jq ) {
1982
+ jQuery = jq;
1983
+ };
1984
+
1985
+ Flickity.Cell = Cell;
1986
+ Flickity.Slide = Slide;
1987
+
1988
+ return Flickity;
1989
+
1990
+ } ) );
1991
+ } (flickity));
1992
+ return flickity.exports;
1993
+ }
1994
+
1995
+ var drag = {exports: {}};
1996
+
1997
+ var unidragger = {exports: {}};
1998
+
1999
+ var unipointer = {exports: {}};
2000
+
2001
+ /*!
2002
+ * Unipointer v2.4.0
2003
+ * base class for doing one thing with pointer event
2004
+ * MIT license
2005
+ */
2006
+
2007
+ var hasRequiredUnipointer;
2008
+
2009
+ function requireUnipointer () {
2010
+ if (hasRequiredUnipointer) return unipointer.exports;
2011
+ hasRequiredUnipointer = 1;
2012
+ (function (module) {
2013
+ /*jshint browser: true, undef: true, unused: true, strict: true */
2014
+
2015
+ ( function( window, factory ) {
2016
+ // universal module definition
2017
+ /* jshint strict: false */ /*global define, module, require */
2018
+ if ( module.exports ) {
2019
+ // CommonJS
2020
+ module.exports = factory(
2021
+ window,
2022
+ requireEvEmitter()
2023
+ );
2024
+ } else {
2025
+ // browser global
2026
+ window.Unipointer = factory(
2027
+ window,
2028
+ window.EvEmitter
2029
+ );
2030
+ }
2031
+
2032
+ }( window, function factory( window, EvEmitter ) {
2033
+
2034
+ function noop() {}
2035
+
2036
+ function Unipointer() {}
2037
+
2038
+ // inherit EvEmitter
2039
+ var proto = Unipointer.prototype = Object.create( EvEmitter.prototype );
2040
+
2041
+ proto.bindStartEvent = function( elem ) {
2042
+ this._bindStartEvent( elem, true );
2043
+ };
2044
+
2045
+ proto.unbindStartEvent = function( elem ) {
2046
+ this._bindStartEvent( elem, false );
2047
+ };
2048
+
2049
+ /**
2050
+ * Add or remove start event
2051
+ * @param {Boolean} isAdd - remove if falsey
2052
+ */
2053
+ proto._bindStartEvent = function( elem, isAdd ) {
2054
+ // munge isAdd, default to true
2055
+ isAdd = isAdd === undefined ? true : isAdd;
2056
+ var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';
2057
+
2058
+ // default to mouse events
2059
+ var startEvent = 'mousedown';
2060
+ if ( 'ontouchstart' in window ) {
2061
+ // HACK prefer Touch Events as you can preventDefault on touchstart to
2062
+ // disable scroll in iOS & mobile Chrome metafizzy/flickity#1177
2063
+ startEvent = 'touchstart';
2064
+ } else if ( window.PointerEvent ) {
2065
+ // Pointer Events
2066
+ startEvent = 'pointerdown';
2067
+ }
2068
+ elem[ bindMethod ]( startEvent, this );
2069
+ };
2070
+
2071
+ // trigger handler methods for events
2072
+ proto.handleEvent = function( event ) {
2073
+ var method = 'on' + event.type;
2074
+ if ( this[ method ] ) {
2075
+ this[ method ]( event );
2076
+ }
2077
+ };
2078
+
2079
+ // returns the touch that we're keeping track of
2080
+ proto.getTouch = function( touches ) {
2081
+ for ( var i=0; i < touches.length; i++ ) {
2082
+ var touch = touches[i];
2083
+ if ( touch.identifier == this.pointerIdentifier ) {
2084
+ return touch;
2085
+ }
2086
+ }
2087
+ };
2088
+
2089
+ // ----- start event ----- //
2090
+
2091
+ proto.onmousedown = function( event ) {
2092
+ // dismiss clicks from right or middle buttons
2093
+ var button = event.button;
2094
+ if ( button && ( button !== 0 && button !== 1 ) ) {
2095
+ return;
2096
+ }
2097
+ this._pointerDown( event, event );
2098
+ };
2099
+
2100
+ proto.ontouchstart = function( event ) {
2101
+ this._pointerDown( event, event.changedTouches[0] );
2102
+ };
2103
+
2104
+ proto.onpointerdown = function( event ) {
2105
+ this._pointerDown( event, event );
2106
+ };
2107
+
2108
+ /**
2109
+ * pointer start
2110
+ * @param {Event} event
2111
+ * @param {Event or Touch} pointer
2112
+ */
2113
+ proto._pointerDown = function( event, pointer ) {
2114
+ // dismiss right click and other pointers
2115
+ // button = 0 is okay, 1-4 not
2116
+ if ( event.button || this.isPointerDown ) {
2117
+ return;
2118
+ }
2119
+
2120
+ this.isPointerDown = true;
2121
+ // save pointer identifier to match up touch events
2122
+ this.pointerIdentifier = pointer.pointerId !== undefined ?
2123
+ // pointerId for pointer events, touch.indentifier for touch events
2124
+ pointer.pointerId : pointer.identifier;
2125
+
2126
+ this.pointerDown( event, pointer );
2127
+ };
2128
+
2129
+ proto.pointerDown = function( event, pointer ) {
2130
+ this._bindPostStartEvents( event );
2131
+ this.emitEvent( 'pointerDown', [ event, pointer ] );
2132
+ };
2133
+
2134
+ // hash of events to be bound after start event
2135
+ var postStartEvents = {
2136
+ mousedown: [ 'mousemove', 'mouseup' ],
2137
+ touchstart: [ 'touchmove', 'touchend', 'touchcancel' ],
2138
+ pointerdown: [ 'pointermove', 'pointerup', 'pointercancel' ],
2139
+ };
2140
+
2141
+ proto._bindPostStartEvents = function( event ) {
2142
+ if ( !event ) {
2143
+ return;
2144
+ }
2145
+ // get proper events to match start event
2146
+ var events = postStartEvents[ event.type ];
2147
+ // bind events to node
2148
+ events.forEach( function( eventName ) {
2149
+ window.addEventListener( eventName, this );
2150
+ }, this );
2151
+ // save these arguments
2152
+ this._boundPointerEvents = events;
2153
+ };
2154
+
2155
+ proto._unbindPostStartEvents = function() {
2156
+ // check for _boundEvents, in case dragEnd triggered twice (old IE8 bug)
2157
+ if ( !this._boundPointerEvents ) {
2158
+ return;
2159
+ }
2160
+ this._boundPointerEvents.forEach( function( eventName ) {
2161
+ window.removeEventListener( eventName, this );
2162
+ }, this );
2163
+
2164
+ delete this._boundPointerEvents;
2165
+ };
2166
+
2167
+ // ----- move event ----- //
2168
+
2169
+ proto.onmousemove = function( event ) {
2170
+ this._pointerMove( event, event );
2171
+ };
2172
+
2173
+ proto.onpointermove = function( event ) {
2174
+ if ( event.pointerId == this.pointerIdentifier ) {
2175
+ this._pointerMove( event, event );
2176
+ }
2177
+ };
2178
+
2179
+ proto.ontouchmove = function( event ) {
2180
+ var touch = this.getTouch( event.changedTouches );
2181
+ if ( touch ) {
2182
+ this._pointerMove( event, touch );
2183
+ }
2184
+ };
2185
+
2186
+ /**
2187
+ * pointer move
2188
+ * @param {Event} event
2189
+ * @param {Event or Touch} pointer
2190
+ * @private
2191
+ */
2192
+ proto._pointerMove = function( event, pointer ) {
2193
+ this.pointerMove( event, pointer );
2194
+ };
2195
+
2196
+ // public
2197
+ proto.pointerMove = function( event, pointer ) {
2198
+ this.emitEvent( 'pointerMove', [ event, pointer ] );
2199
+ };
2200
+
2201
+ // ----- end event ----- //
2202
+
2203
+
2204
+ proto.onmouseup = function( event ) {
2205
+ this._pointerUp( event, event );
2206
+ };
2207
+
2208
+ proto.onpointerup = function( event ) {
2209
+ if ( event.pointerId == this.pointerIdentifier ) {
2210
+ this._pointerUp( event, event );
2211
+ }
2212
+ };
2213
+
2214
+ proto.ontouchend = function( event ) {
2215
+ var touch = this.getTouch( event.changedTouches );
2216
+ if ( touch ) {
2217
+ this._pointerUp( event, touch );
2218
+ }
2219
+ };
2220
+
2221
+ /**
2222
+ * pointer up
2223
+ * @param {Event} event
2224
+ * @param {Event or Touch} pointer
2225
+ * @private
2226
+ */
2227
+ proto._pointerUp = function( event, pointer ) {
2228
+ this._pointerDone();
2229
+ this.pointerUp( event, pointer );
2230
+ };
2231
+
2232
+ // public
2233
+ proto.pointerUp = function( event, pointer ) {
2234
+ this.emitEvent( 'pointerUp', [ event, pointer ] );
2235
+ };
2236
+
2237
+ // ----- pointer done ----- //
2238
+
2239
+ // triggered on pointer up & pointer cancel
2240
+ proto._pointerDone = function() {
2241
+ this._pointerReset();
2242
+ this._unbindPostStartEvents();
2243
+ this.pointerDone();
2244
+ };
2245
+
2246
+ proto._pointerReset = function() {
2247
+ // reset properties
2248
+ this.isPointerDown = false;
2249
+ delete this.pointerIdentifier;
2250
+ };
2251
+
2252
+ proto.pointerDone = noop;
2253
+
2254
+ // ----- pointer cancel ----- //
2255
+
2256
+ proto.onpointercancel = function( event ) {
2257
+ if ( event.pointerId == this.pointerIdentifier ) {
2258
+ this._pointerCancel( event, event );
2259
+ }
2260
+ };
2261
+
2262
+ proto.ontouchcancel = function( event ) {
2263
+ var touch = this.getTouch( event.changedTouches );
2264
+ if ( touch ) {
2265
+ this._pointerCancel( event, touch );
2266
+ }
2267
+ };
2268
+
2269
+ /**
2270
+ * pointer cancel
2271
+ * @param {Event} event
2272
+ * @param {Event or Touch} pointer
2273
+ * @private
2274
+ */
2275
+ proto._pointerCancel = function( event, pointer ) {
2276
+ this._pointerDone();
2277
+ this.pointerCancel( event, pointer );
2278
+ };
2279
+
2280
+ // public
2281
+ proto.pointerCancel = function( event, pointer ) {
2282
+ this.emitEvent( 'pointerCancel', [ event, pointer ] );
2283
+ };
2284
+
2285
+ // ----- ----- //
2286
+
2287
+ // utility function for getting x/y coords from event
2288
+ Unipointer.getPointerPoint = function( pointer ) {
2289
+ return {
2290
+ x: pointer.pageX,
2291
+ y: pointer.pageY
2292
+ };
2293
+ };
2294
+
2295
+ // ----- ----- //
2296
+
2297
+ return Unipointer;
2298
+
2299
+ }));
2300
+ } (unipointer));
2301
+ return unipointer.exports;
2302
+ }
2303
+
2304
+ /*!
2305
+ * Unidragger v2.4.0
2306
+ * Draggable base class
2307
+ * MIT license
2308
+ */
2309
+
2310
+ var hasRequiredUnidragger;
2311
+
2312
+ function requireUnidragger () {
2313
+ if (hasRequiredUnidragger) return unidragger.exports;
2314
+ hasRequiredUnidragger = 1;
2315
+ (function (module) {
2316
+ /*jshint browser: true, unused: true, undef: true, strict: true */
2317
+
2318
+ ( function( window, factory ) {
2319
+ // universal module definition
2320
+ /*jshint strict: false */ /*globals define, module, require */
2321
+
2322
+ if ( module.exports ) {
2323
+ // CommonJS
2324
+ module.exports = factory(
2325
+ window,
2326
+ requireUnipointer()
2327
+ );
2328
+ } else {
2329
+ // browser global
2330
+ window.Unidragger = factory(
2331
+ window,
2332
+ window.Unipointer
2333
+ );
2334
+ }
2335
+
2336
+ }( window, function factory( window, Unipointer ) {
2337
+
2338
+ // -------------------------- Unidragger -------------------------- //
2339
+
2340
+ function Unidragger() {}
2341
+
2342
+ // inherit Unipointer & EvEmitter
2343
+ var proto = Unidragger.prototype = Object.create( Unipointer.prototype );
2344
+
2345
+ // ----- bind start ----- //
2346
+
2347
+ proto.bindHandles = function() {
2348
+ this._bindHandles( true );
2349
+ };
2350
+
2351
+ proto.unbindHandles = function() {
2352
+ this._bindHandles( false );
2353
+ };
2354
+
2355
+ /**
2356
+ * Add or remove start event
2357
+ * @param {Boolean} isAdd
2358
+ */
2359
+ proto._bindHandles = function( isAdd ) {
2360
+ // munge isAdd, default to true
2361
+ isAdd = isAdd === undefined ? true : isAdd;
2362
+ // bind each handle
2363
+ var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';
2364
+ var touchAction = isAdd ? this._touchActionValue : '';
2365
+ for ( var i=0; i < this.handles.length; i++ ) {
2366
+ var handle = this.handles[i];
2367
+ this._bindStartEvent( handle, isAdd );
2368
+ handle[ bindMethod ]( 'click', this );
2369
+ // touch-action: none to override browser touch gestures. metafizzy/flickity#540
2370
+ if ( window.PointerEvent ) {
2371
+ handle.style.touchAction = touchAction;
2372
+ }
2373
+ }
2374
+ };
2375
+
2376
+ // prototype so it can be overwriteable by Flickity
2377
+ proto._touchActionValue = 'none';
2378
+
2379
+ // ----- start event ----- //
2380
+
2381
+ /**
2382
+ * pointer start
2383
+ * @param {Event} event
2384
+ * @param {Event or Touch} pointer
2385
+ */
2386
+ proto.pointerDown = function( event, pointer ) {
2387
+ var isOkay = this.okayPointerDown( event );
2388
+ if ( !isOkay ) {
2389
+ return;
2390
+ }
2391
+ // track start event position
2392
+ // Safari 9 overrides pageX and pageY. These values needs to be copied. flickity#842
2393
+ this.pointerDownPointer = {
2394
+ pageX: pointer.pageX,
2395
+ pageY: pointer.pageY,
2396
+ };
2397
+
2398
+ event.preventDefault();
2399
+ this.pointerDownBlur();
2400
+ // bind move and end events
2401
+ this._bindPostStartEvents( event );
2402
+ this.emitEvent( 'pointerDown', [ event, pointer ] );
2403
+ };
2404
+
2405
+ // nodes that have text fields
2406
+ var cursorNodes = {
2407
+ TEXTAREA: true,
2408
+ INPUT: true,
2409
+ SELECT: true,
2410
+ OPTION: true,
2411
+ };
2412
+
2413
+ // input types that do not have text fields
2414
+ var clickTypes = {
2415
+ radio: true,
2416
+ checkbox: true,
2417
+ button: true,
2418
+ submit: true,
2419
+ image: true,
2420
+ file: true,
2421
+ };
2422
+
2423
+ // dismiss inputs with text fields. flickity#403, flickity#404
2424
+ proto.okayPointerDown = function( event ) {
2425
+ var isCursorNode = cursorNodes[ event.target.nodeName ];
2426
+ var isClickType = clickTypes[ event.target.type ];
2427
+ var isOkay = !isCursorNode || isClickType;
2428
+ if ( !isOkay ) {
2429
+ this._pointerReset();
2430
+ }
2431
+ return isOkay;
2432
+ };
2433
+
2434
+ // kludge to blur previously focused input
2435
+ proto.pointerDownBlur = function() {
2436
+ var focused = document.activeElement;
2437
+ // do not blur body for IE10, metafizzy/flickity#117
2438
+ var canBlur = focused && focused.blur && focused != document.body;
2439
+ if ( canBlur ) {
2440
+ focused.blur();
2441
+ }
2442
+ };
2443
+
2444
+ // ----- move event ----- //
2445
+
2446
+ /**
2447
+ * drag move
2448
+ * @param {Event} event
2449
+ * @param {Event or Touch} pointer
2450
+ */
2451
+ proto.pointerMove = function( event, pointer ) {
2452
+ var moveVector = this._dragPointerMove( event, pointer );
2453
+ this.emitEvent( 'pointerMove', [ event, pointer, moveVector ] );
2454
+ this._dragMove( event, pointer, moveVector );
2455
+ };
2456
+
2457
+ // base pointer move logic
2458
+ proto._dragPointerMove = function( event, pointer ) {
2459
+ var moveVector = {
2460
+ x: pointer.pageX - this.pointerDownPointer.pageX,
2461
+ y: pointer.pageY - this.pointerDownPointer.pageY
2462
+ };
2463
+ // start drag if pointer has moved far enough to start drag
2464
+ if ( !this.isDragging && this.hasDragStarted( moveVector ) ) {
2465
+ this._dragStart( event, pointer );
2466
+ }
2467
+ return moveVector;
2468
+ };
2469
+
2470
+ // condition if pointer has moved far enough to start drag
2471
+ proto.hasDragStarted = function( moveVector ) {
2472
+ return Math.abs( moveVector.x ) > 3 || Math.abs( moveVector.y ) > 3;
2473
+ };
2474
+
2475
+ // ----- end event ----- //
2476
+
2477
+ /**
2478
+ * pointer up
2479
+ * @param {Event} event
2480
+ * @param {Event or Touch} pointer
2481
+ */
2482
+ proto.pointerUp = function( event, pointer ) {
2483
+ this.emitEvent( 'pointerUp', [ event, pointer ] );
2484
+ this._dragPointerUp( event, pointer );
2485
+ };
2486
+
2487
+ proto._dragPointerUp = function( event, pointer ) {
2488
+ if ( this.isDragging ) {
2489
+ this._dragEnd( event, pointer );
2490
+ } else {
2491
+ // pointer didn't move enough for drag to start
2492
+ this._staticClick( event, pointer );
2493
+ }
2494
+ };
2495
+
2496
+ // -------------------------- drag -------------------------- //
2497
+
2498
+ // dragStart
2499
+ proto._dragStart = function( event, pointer ) {
2500
+ this.isDragging = true;
2501
+ // prevent clicks
2502
+ this.isPreventingClicks = true;
2503
+ this.dragStart( event, pointer );
2504
+ };
2505
+
2506
+ proto.dragStart = function( event, pointer ) {
2507
+ this.emitEvent( 'dragStart', [ event, pointer ] );
2508
+ };
2509
+
2510
+ // dragMove
2511
+ proto._dragMove = function( event, pointer, moveVector ) {
2512
+ // do not drag if not dragging yet
2513
+ if ( !this.isDragging ) {
2514
+ return;
2515
+ }
2516
+
2517
+ this.dragMove( event, pointer, moveVector );
2518
+ };
2519
+
2520
+ proto.dragMove = function( event, pointer, moveVector ) {
2521
+ event.preventDefault();
2522
+ this.emitEvent( 'dragMove', [ event, pointer, moveVector ] );
2523
+ };
2524
+
2525
+ // dragEnd
2526
+ proto._dragEnd = function( event, pointer ) {
2527
+ // set flags
2528
+ this.isDragging = false;
2529
+ // re-enable clicking async
2530
+ setTimeout( function() {
2531
+ delete this.isPreventingClicks;
2532
+ }.bind( this ) );
2533
+
2534
+ this.dragEnd( event, pointer );
2535
+ };
2536
+
2537
+ proto.dragEnd = function( event, pointer ) {
2538
+ this.emitEvent( 'dragEnd', [ event, pointer ] );
2539
+ };
2540
+
2541
+ // ----- onclick ----- //
2542
+
2543
+ // handle all clicks and prevent clicks when dragging
2544
+ proto.onclick = function( event ) {
2545
+ if ( this.isPreventingClicks ) {
2546
+ event.preventDefault();
2547
+ }
2548
+ };
2549
+
2550
+ // ----- staticClick ----- //
2551
+
2552
+ // triggered after pointer down & up with no/tiny movement
2553
+ proto._staticClick = function( event, pointer ) {
2554
+ // ignore emulated mouse up clicks
2555
+ if ( this.isIgnoringMouseUp && event.type == 'mouseup' ) {
2556
+ return;
2557
+ }
2558
+
2559
+ this.staticClick( event, pointer );
2560
+
2561
+ // set flag for emulated clicks 300ms after touchend
2562
+ if ( event.type != 'mouseup' ) {
2563
+ this.isIgnoringMouseUp = true;
2564
+ // reset flag after 300ms
2565
+ setTimeout( function() {
2566
+ delete this.isIgnoringMouseUp;
2567
+ }.bind( this ), 400 );
2568
+ }
2569
+ };
2570
+
2571
+ proto.staticClick = function( event, pointer ) {
2572
+ this.emitEvent( 'staticClick', [ event, pointer ] );
2573
+ };
2574
+
2575
+ // ----- utils ----- //
2576
+
2577
+ Unidragger.getPointerPoint = Unipointer.getPointerPoint;
2578
+
2579
+ // ----- ----- //
2580
+
2581
+ return Unidragger;
2582
+
2583
+ }));
2584
+ } (unidragger));
2585
+ return unidragger.exports;
2586
+ }
2587
+
2588
+ var hasRequiredDrag;
2589
+
2590
+ function requireDrag () {
2591
+ if (hasRequiredDrag) return drag.exports;
2592
+ hasRequiredDrag = 1;
2593
+ (function (module) {
2594
+ // drag
2595
+ ( function( window, factory ) {
2596
+ // universal module definition
2597
+ if ( module.exports ) {
2598
+ // CommonJS
2599
+ module.exports = factory(
2600
+ window,
2601
+ requireFlickity(),
2602
+ requireUnidragger(),
2603
+ requireUtils()
2604
+ );
2605
+ } else {
2606
+ // browser global
2607
+ window.Flickity = factory(
2608
+ window,
2609
+ window.Flickity,
2610
+ window.Unidragger,
2611
+ window.fizzyUIUtils
2612
+ );
2613
+ }
2614
+
2615
+ }( window, function factory( window, Flickity, Unidragger, utils ) {
2616
+
2617
+ // ----- defaults ----- //
2618
+
2619
+ utils.extend( Flickity.defaults, {
2620
+ draggable: '>1',
2621
+ dragThreshold: 3,
2622
+ } );
2623
+
2624
+ // ----- create ----- //
2625
+
2626
+ Flickity.createMethods.push('_createDrag');
2627
+
2628
+ // -------------------------- drag prototype -------------------------- //
2629
+
2630
+ var proto = Flickity.prototype;
2631
+ utils.extend( proto, Unidragger.prototype );
2632
+ proto._touchActionValue = 'pan-y';
2633
+
2634
+ // -------------------------- -------------------------- //
2635
+
2636
+ proto._createDrag = function() {
2637
+ this.on( 'activate', this.onActivateDrag );
2638
+ this.on( 'uiChange', this._uiChangeDrag );
2639
+ this.on( 'deactivate', this.onDeactivateDrag );
2640
+ this.on( 'cellChange', this.updateDraggable );
2641
+ // TODO updateDraggable on resize? if groupCells & slides change
2642
+ };
2643
+
2644
+ proto.onActivateDrag = function() {
2645
+ this.handles = [ this.viewport ];
2646
+ this.bindHandles();
2647
+ this.updateDraggable();
2648
+ };
2649
+
2650
+ proto.onDeactivateDrag = function() {
2651
+ this.unbindHandles();
2652
+ this.element.classList.remove('is-draggable');
2653
+ };
2654
+
2655
+ proto.updateDraggable = function() {
2656
+ // disable dragging if less than 2 slides. #278
2657
+ if ( this.options.draggable == '>1' ) {
2658
+ this.isDraggable = this.slides.length > 1;
2659
+ } else {
2660
+ this.isDraggable = this.options.draggable;
2661
+ }
2662
+ if ( this.isDraggable ) {
2663
+ this.element.classList.add('is-draggable');
2664
+ } else {
2665
+ this.element.classList.remove('is-draggable');
2666
+ }
2667
+ };
2668
+
2669
+ // backwards compatibility
2670
+ proto.bindDrag = function() {
2671
+ this.options.draggable = true;
2672
+ this.updateDraggable();
2673
+ };
2674
+
2675
+ proto.unbindDrag = function() {
2676
+ this.options.draggable = false;
2677
+ this.updateDraggable();
2678
+ };
2679
+
2680
+ proto._uiChangeDrag = function() {
2681
+ delete this.isFreeScrolling;
2682
+ };
2683
+
2684
+ // -------------------------- pointer events -------------------------- //
2685
+
2686
+ proto.pointerDown = function( event, pointer ) {
2687
+ if ( !this.isDraggable ) {
2688
+ this._pointerDownDefault( event, pointer );
2689
+ return;
2690
+ }
2691
+ var isOkay = this.okayPointerDown( event );
2692
+ if ( !isOkay ) {
2693
+ return;
2694
+ }
2695
+
2696
+ this._pointerDownPreventDefault( event );
2697
+ this.pointerDownFocus( event );
2698
+ // blur
2699
+ if ( document.activeElement != this.element ) {
2700
+ // do not blur if already focused
2701
+ this.pointerDownBlur();
2702
+ }
2703
+
2704
+ // stop if it was moving
2705
+ this.dragX = this.x;
2706
+ this.viewport.classList.add('is-pointer-down');
2707
+ // track scrolling
2708
+ this.pointerDownScroll = getScrollPosition();
2709
+ window.addEventListener( 'scroll', this );
2710
+
2711
+ this._pointerDownDefault( event, pointer );
2712
+ };
2713
+
2714
+ // default pointerDown logic, used for staticClick
2715
+ proto._pointerDownDefault = function( event, pointer ) {
2716
+ // track start event position
2717
+ // Safari 9 overrides pageX and pageY. These values needs to be copied. #779
2718
+ this.pointerDownPointer = {
2719
+ pageX: pointer.pageX,
2720
+ pageY: pointer.pageY,
2721
+ };
2722
+ // bind move and end events
2723
+ this._bindPostStartEvents( event );
2724
+ this.dispatchEvent( 'pointerDown', event, [ pointer ] );
2725
+ };
2726
+
2727
+ var focusNodes = {
2728
+ INPUT: true,
2729
+ TEXTAREA: true,
2730
+ SELECT: true,
2731
+ };
2732
+
2733
+ proto.pointerDownFocus = function( event ) {
2734
+ var isFocusNode = focusNodes[ event.target.nodeName ];
2735
+ if ( !isFocusNode ) {
2736
+ this.focus();
2737
+ }
2738
+ };
2739
+
2740
+ proto._pointerDownPreventDefault = function( event ) {
2741
+ var isTouchStart = event.type == 'touchstart';
2742
+ var isTouchPointer = event.pointerType == 'touch';
2743
+ var isFocusNode = focusNodes[ event.target.nodeName ];
2744
+ if ( !isTouchStart && !isTouchPointer && !isFocusNode ) {
2745
+ event.preventDefault();
2746
+ }
2747
+ };
2748
+
2749
+ // ----- move ----- //
2750
+
2751
+ proto.hasDragStarted = function( moveVector ) {
2752
+ return Math.abs( moveVector.x ) > this.options.dragThreshold;
2753
+ };
2754
+
2755
+ // ----- up ----- //
2756
+
2757
+ proto.pointerUp = function( event, pointer ) {
2758
+ delete this.isTouchScrolling;
2759
+ this.viewport.classList.remove('is-pointer-down');
2760
+ this.dispatchEvent( 'pointerUp', event, [ pointer ] );
2761
+ this._dragPointerUp( event, pointer );
2762
+ };
2763
+
2764
+ proto.pointerDone = function() {
2765
+ window.removeEventListener( 'scroll', this );
2766
+ delete this.pointerDownScroll;
2767
+ };
2768
+
2769
+ // -------------------------- dragging -------------------------- //
2770
+
2771
+ proto.dragStart = function( event, pointer ) {
2772
+ if ( !this.isDraggable ) {
2773
+ return;
2774
+ }
2775
+ this.dragStartPosition = this.x;
2776
+ this.startAnimation();
2777
+ window.removeEventListener( 'scroll', this );
2778
+ this.dispatchEvent( 'dragStart', event, [ pointer ] );
2779
+ };
2780
+
2781
+ proto.pointerMove = function( event, pointer ) {
2782
+ var moveVector = this._dragPointerMove( event, pointer );
2783
+ this.dispatchEvent( 'pointerMove', event, [ pointer, moveVector ] );
2784
+ this._dragMove( event, pointer, moveVector );
2785
+ };
2786
+
2787
+ proto.dragMove = function( event, pointer, moveVector ) {
2788
+ if ( !this.isDraggable ) {
2789
+ return;
2790
+ }
2791
+ event.preventDefault();
2792
+
2793
+ this.previousDragX = this.dragX;
2794
+ // reverse if right-to-left
2795
+ var direction = this.options.rightToLeft ? -1 : 1;
2796
+ if ( this.options.wrapAround ) {
2797
+ // wrap around move. #589
2798
+ moveVector.x %= this.slideableWidth;
2799
+ }
2800
+ var dragX = this.dragStartPosition + moveVector.x * direction;
2801
+
2802
+ if ( !this.options.wrapAround && this.slides.length ) {
2803
+ // slow drag
2804
+ var originBound = Math.max( -this.slides[0].target, this.dragStartPosition );
2805
+ dragX = dragX > originBound ? ( dragX + originBound ) * 0.5 : dragX;
2806
+ var endBound = Math.min( -this.getLastSlide().target, this.dragStartPosition );
2807
+ dragX = dragX < endBound ? ( dragX + endBound ) * 0.5 : dragX;
2808
+ }
2809
+
2810
+ this.dragX = dragX;
2811
+
2812
+ this.dragMoveTime = new Date();
2813
+ this.dispatchEvent( 'dragMove', event, [ pointer, moveVector ] );
2814
+ };
2815
+
2816
+ proto.dragEnd = function( event, pointer ) {
2817
+ if ( !this.isDraggable ) {
2818
+ return;
2819
+ }
2820
+ if ( this.options.freeScroll ) {
2821
+ this.isFreeScrolling = true;
2822
+ }
2823
+ // set selectedIndex based on where flick will end up
2824
+ var index = this.dragEndRestingSelect();
2825
+
2826
+ if ( this.options.freeScroll && !this.options.wrapAround ) {
2827
+ // if free-scroll & not wrap around
2828
+ // do not free-scroll if going outside of bounding slides
2829
+ // so bounding slides can attract slider, and keep it in bounds
2830
+ var restingX = this.getRestingPosition();
2831
+ this.isFreeScrolling = -restingX > this.slides[0].target &&
2832
+ -restingX < this.getLastSlide().target;
2833
+ } else if ( !this.options.freeScroll && index == this.selectedIndex ) {
2834
+ // boost selection if selected index has not changed
2835
+ index += this.dragEndBoostSelect();
2836
+ }
2837
+ delete this.previousDragX;
2838
+ // apply selection
2839
+ // TODO refactor this, selecting here feels weird
2840
+ // HACK, set flag so dragging stays in correct direction
2841
+ this.isDragSelect = this.options.wrapAround;
2842
+ this.select( index );
2843
+ delete this.isDragSelect;
2844
+ this.dispatchEvent( 'dragEnd', event, [ pointer ] );
2845
+ };
2846
+
2847
+ proto.dragEndRestingSelect = function() {
2848
+ var restingX = this.getRestingPosition();
2849
+ // how far away from selected slide
2850
+ var distance = Math.abs( this.getSlideDistance( -restingX, this.selectedIndex ) );
2851
+ // get closet resting going up and going down
2852
+ var positiveResting = this._getClosestResting( restingX, distance, 1 );
2853
+ var negativeResting = this._getClosestResting( restingX, distance, -1 );
2854
+ // use closer resting for wrap-around
2855
+ var index = positiveResting.distance < negativeResting.distance ?
2856
+ positiveResting.index : negativeResting.index;
2857
+ return index;
2858
+ };
2859
+
2860
+ /**
2861
+ * given resting X and distance to selected cell
2862
+ * get the distance and index of the closest cell
2863
+ * @param {Number} restingX - estimated post-flick resting position
2864
+ * @param {Number} distance - distance to selected cell
2865
+ * @param {Integer} increment - +1 or -1, going up or down
2866
+ * @returns {Object} - { distance: {Number}, index: {Integer} }
2867
+ */
2868
+ proto._getClosestResting = function( restingX, distance, increment ) {
2869
+ var index = this.selectedIndex;
2870
+ var minDistance = Infinity;
2871
+ var condition = this.options.contain && !this.options.wrapAround ?
2872
+ // if contain, keep going if distance is equal to minDistance
2873
+ function( dist, minDist ) {
2874
+ return dist <= minDist;
2875
+ } : function( dist, minDist ) {
2876
+ return dist < minDist;
2877
+ };
2878
+ while ( condition( distance, minDistance ) ) {
2879
+ // measure distance to next cell
2880
+ index += increment;
2881
+ minDistance = distance;
2882
+ distance = this.getSlideDistance( -restingX, index );
2883
+ if ( distance === null ) {
2884
+ break;
2885
+ }
2886
+ distance = Math.abs( distance );
2887
+ }
2888
+ return {
2889
+ distance: minDistance,
2890
+ // selected was previous index
2891
+ index: index - increment,
2892
+ };
2893
+ };
2894
+
2895
+ /**
2896
+ * measure distance between x and a slide target
2897
+ * @param {Number} x - horizontal position
2898
+ * @param {Integer} index - slide index
2899
+ * @returns {Number} - slide distance
2900
+ */
2901
+ proto.getSlideDistance = function( x, index ) {
2902
+ var len = this.slides.length;
2903
+ // wrap around if at least 2 slides
2904
+ var isWrapAround = this.options.wrapAround && len > 1;
2905
+ var slideIndex = isWrapAround ? utils.modulo( index, len ) : index;
2906
+ var slide = this.slides[ slideIndex ];
2907
+ if ( !slide ) {
2908
+ return null;
2909
+ }
2910
+ // add distance for wrap-around slides
2911
+ var wrap = isWrapAround ? this.slideableWidth * Math.floor( index/len ) : 0;
2912
+ return x - ( slide.target + wrap );
2913
+ };
2914
+
2915
+ proto.dragEndBoostSelect = function() {
2916
+ // do not boost if no previousDragX or dragMoveTime
2917
+ if ( this.previousDragX === undefined || !this.dragMoveTime ||
2918
+ // or if drag was held for 100 ms
2919
+ new Date() - this.dragMoveTime > 100 ) {
2920
+ return 0;
2921
+ }
2922
+
2923
+ var distance = this.getSlideDistance( -this.dragX, this.selectedIndex );
2924
+ var delta = this.previousDragX - this.dragX;
2925
+ if ( distance > 0 && delta > 0 ) {
2926
+ // boost to next if moving towards the right, and positive velocity
2927
+ return 1;
2928
+ } else if ( distance < 0 && delta < 0 ) {
2929
+ // boost to previous if moving towards the left, and negative velocity
2930
+ return -1;
2931
+ }
2932
+ return 0;
2933
+ };
2934
+
2935
+ // ----- staticClick ----- //
2936
+
2937
+ proto.staticClick = function( event, pointer ) {
2938
+ // get clickedCell, if cell was clicked
2939
+ var clickedCell = this.getParentCell( event.target );
2940
+ var cellElem = clickedCell && clickedCell.element;
2941
+ var cellIndex = clickedCell && this.cells.indexOf( clickedCell );
2942
+ this.dispatchEvent( 'staticClick', event, [ pointer, cellElem, cellIndex ] );
2943
+ };
2944
+
2945
+ // ----- scroll ----- //
2946
+
2947
+ proto.onscroll = function() {
2948
+ var scroll = getScrollPosition();
2949
+ var scrollMoveX = this.pointerDownScroll.x - scroll.x;
2950
+ var scrollMoveY = this.pointerDownScroll.y - scroll.y;
2951
+ // cancel click/tap if scroll is too much
2952
+ if ( Math.abs( scrollMoveX ) > 3 || Math.abs( scrollMoveY ) > 3 ) {
2953
+ this._pointerDone();
2954
+ }
2955
+ };
2956
+
2957
+ // ----- utils ----- //
2958
+
2959
+ function getScrollPosition() {
2960
+ return {
2961
+ x: window.pageXOffset,
2962
+ y: window.pageYOffset,
2963
+ };
2964
+ }
2965
+
2966
+ // ----- ----- //
2967
+
2968
+ return Flickity;
2969
+
2970
+ } ) );
2971
+ } (drag));
2972
+ return drag.exports;
2973
+ }
2974
+
2975
+ var prevNextButton = {exports: {}};
2976
+
2977
+ var hasRequiredPrevNextButton;
2978
+
2979
+ function requirePrevNextButton () {
2980
+ if (hasRequiredPrevNextButton) return prevNextButton.exports;
2981
+ hasRequiredPrevNextButton = 1;
2982
+ (function (module) {
2983
+ // prev/next buttons
2984
+ ( function( window, factory ) {
2985
+ // universal module definition
2986
+ if ( module.exports ) {
2987
+ // CommonJS
2988
+ module.exports = factory(
2989
+ window,
2990
+ requireFlickity(),
2991
+ requireUnipointer(),
2992
+ requireUtils()
2993
+ );
2994
+ } else {
2995
+ // browser global
2996
+ factory(
2997
+ window,
2998
+ window.Flickity,
2999
+ window.Unipointer,
3000
+ window.fizzyUIUtils
3001
+ );
3002
+ }
3003
+
3004
+ }( window, function factory( window, Flickity, Unipointer, utils ) {
3005
+
3006
+ var svgURI = 'http://www.w3.org/2000/svg';
3007
+
3008
+ // -------------------------- PrevNextButton -------------------------- //
3009
+
3010
+ function PrevNextButton( direction, parent ) {
3011
+ this.direction = direction;
3012
+ this.parent = parent;
3013
+ this._create();
3014
+ }
3015
+
3016
+ PrevNextButton.prototype = Object.create( Unipointer.prototype );
3017
+
3018
+ PrevNextButton.prototype._create = function() {
3019
+ // properties
3020
+ this.isEnabled = true;
3021
+ this.isPrevious = this.direction == -1;
3022
+ var leftDirection = this.parent.options.rightToLeft ? 1 : -1;
3023
+ this.isLeft = this.direction == leftDirection;
3024
+
3025
+ var element = this.element = document.createElement('button');
3026
+ element.className = 'flickity-button flickity-prev-next-button';
3027
+ element.className += this.isPrevious ? ' previous' : ' next';
3028
+ // prevent button from submitting form http://stackoverflow.com/a/10836076/182183
3029
+ element.setAttribute( 'type', 'button' );
3030
+ // init as disabled
3031
+ this.disable();
3032
+
3033
+ element.setAttribute( 'aria-label', this.isPrevious ? 'Previous' : 'Next' );
3034
+
3035
+ // create arrow
3036
+ var svg = this.createSVG();
3037
+ element.appendChild( svg );
3038
+ // events
3039
+ this.parent.on( 'select', this.update.bind( this ) );
3040
+ this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) );
3041
+ };
3042
+
3043
+ PrevNextButton.prototype.activate = function() {
3044
+ this.bindStartEvent( this.element );
3045
+ this.element.addEventListener( 'click', this );
3046
+ // add to DOM
3047
+ this.parent.element.appendChild( this.element );
3048
+ };
3049
+
3050
+ PrevNextButton.prototype.deactivate = function() {
3051
+ // remove from DOM
3052
+ this.parent.element.removeChild( this.element );
3053
+ // click events
3054
+ this.unbindStartEvent( this.element );
3055
+ this.element.removeEventListener( 'click', this );
3056
+ };
3057
+
3058
+ PrevNextButton.prototype.createSVG = function() {
3059
+ var svg = document.createElementNS( svgURI, 'svg' );
3060
+ svg.setAttribute( 'class', 'flickity-button-icon' );
3061
+ svg.setAttribute( 'viewBox', '0 0 100 100' );
3062
+ var path = document.createElementNS( svgURI, 'path' );
3063
+ var pathMovements = getArrowMovements( this.parent.options.arrowShape );
3064
+ path.setAttribute( 'd', pathMovements );
3065
+ path.setAttribute( 'class', 'arrow' );
3066
+ // rotate arrow
3067
+ if ( !this.isLeft ) {
3068
+ path.setAttribute( 'transform', 'translate(100, 100) rotate(180) ' );
3069
+ }
3070
+ svg.appendChild( path );
3071
+ return svg;
3072
+ };
3073
+
3074
+ // get SVG path movmement
3075
+ function getArrowMovements( shape ) {
3076
+ // use shape as movement if string
3077
+ if ( typeof shape == 'string' ) {
3078
+ return shape;
3079
+ }
3080
+ // create movement string
3081
+ return 'M ' + shape.x0 + ',50' +
3082
+ ' L ' + shape.x1 + ',' + ( shape.y1 + 50 ) +
3083
+ ' L ' + shape.x2 + ',' + ( shape.y2 + 50 ) +
3084
+ ' L ' + shape.x3 + ',50 ' +
3085
+ ' L ' + shape.x2 + ',' + ( 50 - shape.y2 ) +
3086
+ ' L ' + shape.x1 + ',' + ( 50 - shape.y1 ) +
3087
+ ' Z';
3088
+ }
3089
+
3090
+ PrevNextButton.prototype.handleEvent = utils.handleEvent;
3091
+
3092
+ PrevNextButton.prototype.onclick = function() {
3093
+ if ( !this.isEnabled ) {
3094
+ return;
3095
+ }
3096
+ this.parent.uiChange();
3097
+ var method = this.isPrevious ? 'previous' : 'next';
3098
+ this.parent[ method ]();
3099
+ };
3100
+
3101
+ // ----- ----- //
3102
+
3103
+ PrevNextButton.prototype.enable = function() {
3104
+ if ( this.isEnabled ) {
3105
+ return;
3106
+ }
3107
+ this.element.disabled = false;
3108
+ this.isEnabled = true;
3109
+ };
3110
+
3111
+ PrevNextButton.prototype.disable = function() {
3112
+ if ( !this.isEnabled ) {
3113
+ return;
3114
+ }
3115
+ this.element.disabled = true;
3116
+ this.isEnabled = false;
3117
+ };
3118
+
3119
+ PrevNextButton.prototype.update = function() {
3120
+ // index of first or last slide, if previous or next
3121
+ var slides = this.parent.slides;
3122
+ // enable is wrapAround and at least 2 slides
3123
+ if ( this.parent.options.wrapAround && slides.length > 1 ) {
3124
+ this.enable();
3125
+ return;
3126
+ }
3127
+ var lastIndex = slides.length ? slides.length - 1 : 0;
3128
+ var boundIndex = this.isPrevious ? 0 : lastIndex;
3129
+ var method = this.parent.selectedIndex == boundIndex ? 'disable' : 'enable';
3130
+ this[ method ]();
3131
+ };
3132
+
3133
+ PrevNextButton.prototype.destroy = function() {
3134
+ this.deactivate();
3135
+ this.allOff();
3136
+ };
3137
+
3138
+ // -------------------------- Flickity prototype -------------------------- //
3139
+
3140
+ utils.extend( Flickity.defaults, {
3141
+ prevNextButtons: true,
3142
+ arrowShape: {
3143
+ x0: 10,
3144
+ x1: 60, y1: 50,
3145
+ x2: 70, y2: 40,
3146
+ x3: 30,
3147
+ },
3148
+ } );
3149
+
3150
+ Flickity.createMethods.push('_createPrevNextButtons');
3151
+ var proto = Flickity.prototype;
3152
+
3153
+ proto._createPrevNextButtons = function() {
3154
+ if ( !this.options.prevNextButtons ) {
3155
+ return;
3156
+ }
3157
+
3158
+ this.prevButton = new PrevNextButton( -1, this );
3159
+ this.nextButton = new PrevNextButton( 1, this );
3160
+
3161
+ this.on( 'activate', this.activatePrevNextButtons );
3162
+ };
3163
+
3164
+ proto.activatePrevNextButtons = function() {
3165
+ this.prevButton.activate();
3166
+ this.nextButton.activate();
3167
+ this.on( 'deactivate', this.deactivatePrevNextButtons );
3168
+ };
3169
+
3170
+ proto.deactivatePrevNextButtons = function() {
3171
+ this.prevButton.deactivate();
3172
+ this.nextButton.deactivate();
3173
+ this.off( 'deactivate', this.deactivatePrevNextButtons );
3174
+ };
3175
+
3176
+ // -------------------------- -------------------------- //
3177
+
3178
+ Flickity.PrevNextButton = PrevNextButton;
3179
+
3180
+ return Flickity;
3181
+
3182
+ } ) );
3183
+ } (prevNextButton));
3184
+ return prevNextButton.exports;
3185
+ }
3186
+
3187
+ var pageDots = {exports: {}};
3188
+
3189
+ var hasRequiredPageDots;
3190
+
3191
+ function requirePageDots () {
3192
+ if (hasRequiredPageDots) return pageDots.exports;
3193
+ hasRequiredPageDots = 1;
3194
+ (function (module) {
3195
+ // page dots
3196
+ ( function( window, factory ) {
3197
+ // universal module definition
3198
+ if ( module.exports ) {
3199
+ // CommonJS
3200
+ module.exports = factory(
3201
+ window,
3202
+ requireFlickity(),
3203
+ requireUnipointer(),
3204
+ requireUtils()
3205
+ );
3206
+ } else {
3207
+ // browser global
3208
+ factory(
3209
+ window,
3210
+ window.Flickity,
3211
+ window.Unipointer,
3212
+ window.fizzyUIUtils
3213
+ );
3214
+ }
3215
+
3216
+ }( window, function factory( window, Flickity, Unipointer, utils ) {
3217
+
3218
+ function PageDots( parent ) {
3219
+ this.parent = parent;
3220
+ this._create();
3221
+ }
3222
+
3223
+ PageDots.prototype = Object.create( Unipointer.prototype );
3224
+
3225
+ PageDots.prototype._create = function() {
3226
+ // create holder element
3227
+ this.holder = document.createElement('ol');
3228
+ this.holder.className = 'flickity-page-dots';
3229
+ // create dots, array of elements
3230
+ this.dots = [];
3231
+ // events
3232
+ this.handleClick = this.onClick.bind( this );
3233
+ this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) );
3234
+ };
3235
+
3236
+ PageDots.prototype.activate = function() {
3237
+ this.setDots();
3238
+ this.holder.addEventListener( 'click', this.handleClick );
3239
+ this.bindStartEvent( this.holder );
3240
+ // add to DOM
3241
+ this.parent.element.appendChild( this.holder );
3242
+ };
3243
+
3244
+ PageDots.prototype.deactivate = function() {
3245
+ this.holder.removeEventListener( 'click', this.handleClick );
3246
+ this.unbindStartEvent( this.holder );
3247
+ // remove from DOM
3248
+ this.parent.element.removeChild( this.holder );
3249
+ };
3250
+
3251
+ PageDots.prototype.setDots = function() {
3252
+ // get difference between number of slides and number of dots
3253
+ var delta = this.parent.slides.length - this.dots.length;
3254
+ if ( delta > 0 ) {
3255
+ this.addDots( delta );
3256
+ } else if ( delta < 0 ) {
3257
+ this.removeDots( -delta );
3258
+ }
3259
+ };
3260
+
3261
+ PageDots.prototype.addDots = function( count ) {
3262
+ var fragment = document.createDocumentFragment();
3263
+ var newDots = [];
3264
+ var length = this.dots.length;
3265
+ var max = length + count;
3266
+
3267
+ for ( var i = length; i < max; i++ ) {
3268
+ var dot = document.createElement('li');
3269
+ dot.className = 'dot';
3270
+ dot.setAttribute( 'aria-label', 'Page dot ' + ( i + 1 ) );
3271
+ fragment.appendChild( dot );
3272
+ newDots.push( dot );
3273
+ }
3274
+
3275
+ this.holder.appendChild( fragment );
3276
+ this.dots = this.dots.concat( newDots );
3277
+ };
3278
+
3279
+ PageDots.prototype.removeDots = function( count ) {
3280
+ // remove from this.dots collection
3281
+ var removeDots = this.dots.splice( this.dots.length - count, count );
3282
+ // remove from DOM
3283
+ removeDots.forEach( function( dot ) {
3284
+ this.holder.removeChild( dot );
3285
+ }, this );
3286
+ };
3287
+
3288
+ PageDots.prototype.updateSelected = function() {
3289
+ // remove selected class on previous
3290
+ if ( this.selectedDot ) {
3291
+ this.selectedDot.className = 'dot';
3292
+ this.selectedDot.removeAttribute('aria-current');
3293
+ }
3294
+ // don't proceed if no dots
3295
+ if ( !this.dots.length ) {
3296
+ return;
3297
+ }
3298
+ this.selectedDot = this.dots[ this.parent.selectedIndex ];
3299
+ this.selectedDot.className = 'dot is-selected';
3300
+ this.selectedDot.setAttribute( 'aria-current', 'step' );
3301
+ };
3302
+
3303
+ PageDots.prototype.onTap = // old method name, backwards-compatible
3304
+ PageDots.prototype.onClick = function( event ) {
3305
+ var target = event.target;
3306
+ // only care about dot clicks
3307
+ if ( target.nodeName != 'LI' ) {
3308
+ return;
3309
+ }
3310
+
3311
+ this.parent.uiChange();
3312
+ var index = this.dots.indexOf( target );
3313
+ this.parent.select( index );
3314
+ };
3315
+
3316
+ PageDots.prototype.destroy = function() {
3317
+ this.deactivate();
3318
+ this.allOff();
3319
+ };
3320
+
3321
+ Flickity.PageDots = PageDots;
3322
+
3323
+ // -------------------------- Flickity -------------------------- //
3324
+
3325
+ utils.extend( Flickity.defaults, {
3326
+ pageDots: true,
3327
+ } );
3328
+
3329
+ Flickity.createMethods.push('_createPageDots');
3330
+
3331
+ var proto = Flickity.prototype;
3332
+
3333
+ proto._createPageDots = function() {
3334
+ if ( !this.options.pageDots ) {
3335
+ return;
3336
+ }
3337
+ this.pageDots = new PageDots( this );
3338
+ // events
3339
+ this.on( 'activate', this.activatePageDots );
3340
+ this.on( 'select', this.updateSelectedPageDots );
3341
+ this.on( 'cellChange', this.updatePageDots );
3342
+ this.on( 'resize', this.updatePageDots );
3343
+ this.on( 'deactivate', this.deactivatePageDots );
3344
+ };
3345
+
3346
+ proto.activatePageDots = function() {
3347
+ this.pageDots.activate();
3348
+ };
3349
+
3350
+ proto.updateSelectedPageDots = function() {
3351
+ this.pageDots.updateSelected();
3352
+ };
3353
+
3354
+ proto.updatePageDots = function() {
3355
+ this.pageDots.setDots();
3356
+ };
3357
+
3358
+ proto.deactivatePageDots = function() {
3359
+ this.pageDots.deactivate();
3360
+ };
3361
+
3362
+ // ----- ----- //
3363
+
3364
+ Flickity.PageDots = PageDots;
3365
+
3366
+ return Flickity;
3367
+
3368
+ } ) );
3369
+ } (pageDots));
3370
+ return pageDots.exports;
3371
+ }
3372
+
3373
+ var player = {exports: {}};
3374
+
3375
+ var hasRequiredPlayer;
3376
+
3377
+ function requirePlayer () {
3378
+ if (hasRequiredPlayer) return player.exports;
3379
+ hasRequiredPlayer = 1;
3380
+ (function (module) {
3381
+ // player & autoPlay
3382
+ ( function( window, factory ) {
3383
+ // universal module definition
3384
+ if ( module.exports ) {
3385
+ // CommonJS
3386
+ module.exports = factory(
3387
+ requireEvEmitter(),
3388
+ requireUtils(),
3389
+ requireFlickity()
3390
+ );
3391
+ } else {
3392
+ // browser global
3393
+ factory(
3394
+ window.EvEmitter,
3395
+ window.fizzyUIUtils,
3396
+ window.Flickity
3397
+ );
3398
+ }
3399
+
3400
+ }( window, function factory( EvEmitter, utils, Flickity ) {
3401
+
3402
+ // -------------------------- Player -------------------------- //
3403
+
3404
+ function Player( parent ) {
3405
+ this.parent = parent;
3406
+ this.state = 'stopped';
3407
+ // visibility change event handler
3408
+ this.onVisibilityChange = this.visibilityChange.bind( this );
3409
+ this.onVisibilityPlay = this.visibilityPlay.bind( this );
3410
+ }
3411
+
3412
+ Player.prototype = Object.create( EvEmitter.prototype );
3413
+
3414
+ // start play
3415
+ Player.prototype.play = function() {
3416
+ if ( this.state == 'playing' ) {
3417
+ return;
3418
+ }
3419
+ // do not play if page is hidden, start playing when page is visible
3420
+ var isPageHidden = document.hidden;
3421
+ if ( isPageHidden ) {
3422
+ document.addEventListener( 'visibilitychange', this.onVisibilityPlay );
3423
+ return;
3424
+ }
3425
+
3426
+ this.state = 'playing';
3427
+ // listen to visibility change
3428
+ document.addEventListener( 'visibilitychange', this.onVisibilityChange );
3429
+ // start ticking
3430
+ this.tick();
3431
+ };
3432
+
3433
+ Player.prototype.tick = function() {
3434
+ // do not tick if not playing
3435
+ if ( this.state != 'playing' ) {
3436
+ return;
3437
+ }
3438
+
3439
+ var time = this.parent.options.autoPlay;
3440
+ // default to 3 seconds
3441
+ time = typeof time == 'number' ? time : 3000;
3442
+ var _this = this;
3443
+ // HACK: reset ticks if stopped and started within interval
3444
+ this.clear();
3445
+ this.timeout = setTimeout( function() {
3446
+ _this.parent.next( true );
3447
+ _this.tick();
3448
+ }, time );
3449
+ };
3450
+
3451
+ Player.prototype.stop = function() {
3452
+ this.state = 'stopped';
3453
+ this.clear();
3454
+ // remove visibility change event
3455
+ document.removeEventListener( 'visibilitychange', this.onVisibilityChange );
3456
+ };
3457
+
3458
+ Player.prototype.clear = function() {
3459
+ clearTimeout( this.timeout );
3460
+ };
3461
+
3462
+ Player.prototype.pause = function() {
3463
+ if ( this.state == 'playing' ) {
3464
+ this.state = 'paused';
3465
+ this.clear();
3466
+ }
3467
+ };
3468
+
3469
+ Player.prototype.unpause = function() {
3470
+ // re-start play if paused
3471
+ if ( this.state == 'paused' ) {
3472
+ this.play();
3473
+ }
3474
+ };
3475
+
3476
+ // pause if page visibility is hidden, unpause if visible
3477
+ Player.prototype.visibilityChange = function() {
3478
+ var isPageHidden = document.hidden;
3479
+ this[ isPageHidden ? 'pause' : 'unpause' ]();
3480
+ };
3481
+
3482
+ Player.prototype.visibilityPlay = function() {
3483
+ this.play();
3484
+ document.removeEventListener( 'visibilitychange', this.onVisibilityPlay );
3485
+ };
3486
+
3487
+ // -------------------------- Flickity -------------------------- //
3488
+
3489
+ utils.extend( Flickity.defaults, {
3490
+ pauseAutoPlayOnHover: true,
3491
+ } );
3492
+
3493
+ Flickity.createMethods.push('_createPlayer');
3494
+ var proto = Flickity.prototype;
3495
+
3496
+ proto._createPlayer = function() {
3497
+ this.player = new Player( this );
3498
+
3499
+ this.on( 'activate', this.activatePlayer );
3500
+ this.on( 'uiChange', this.stopPlayer );
3501
+ this.on( 'pointerDown', this.stopPlayer );
3502
+ this.on( 'deactivate', this.deactivatePlayer );
3503
+ };
3504
+
3505
+ proto.activatePlayer = function() {
3506
+ if ( !this.options.autoPlay ) {
3507
+ return;
3508
+ }
3509
+ this.player.play();
3510
+ this.element.addEventListener( 'mouseenter', this );
3511
+ };
3512
+
3513
+ // Player API, don't hate the ... thanks I know where the door is
3514
+
3515
+ proto.playPlayer = function() {
3516
+ this.player.play();
3517
+ };
3518
+
3519
+ proto.stopPlayer = function() {
3520
+ this.player.stop();
3521
+ };
3522
+
3523
+ proto.pausePlayer = function() {
3524
+ this.player.pause();
3525
+ };
3526
+
3527
+ proto.unpausePlayer = function() {
3528
+ this.player.unpause();
3529
+ };
3530
+
3531
+ proto.deactivatePlayer = function() {
3532
+ this.player.stop();
3533
+ this.element.removeEventListener( 'mouseenter', this );
3534
+ };
3535
+
3536
+ // ----- mouseenter/leave ----- //
3537
+
3538
+ // pause auto-play on hover
3539
+ proto.onmouseenter = function() {
3540
+ if ( !this.options.pauseAutoPlayOnHover ) {
3541
+ return;
3542
+ }
3543
+ this.player.pause();
3544
+ this.element.addEventListener( 'mouseleave', this );
3545
+ };
3546
+
3547
+ // resume auto-play on hover off
3548
+ proto.onmouseleave = function() {
3549
+ this.player.unpause();
3550
+ this.element.removeEventListener( 'mouseleave', this );
3551
+ };
3552
+
3553
+ // ----- ----- //
3554
+
3555
+ Flickity.Player = Player;
3556
+
3557
+ return Flickity;
3558
+
3559
+ } ) );
3560
+ } (player));
3561
+ return player.exports;
3562
+ }
3563
+
3564
+ var addRemoveCell = {exports: {}};
3565
+
3566
+ var hasRequiredAddRemoveCell;
3567
+
3568
+ function requireAddRemoveCell () {
3569
+ if (hasRequiredAddRemoveCell) return addRemoveCell.exports;
3570
+ hasRequiredAddRemoveCell = 1;
3571
+ (function (module) {
3572
+ // add, remove cell
3573
+ ( function( window, factory ) {
3574
+ // universal module definition
3575
+ if ( module.exports ) {
3576
+ // CommonJS
3577
+ module.exports = factory(
3578
+ window,
3579
+ requireFlickity(),
3580
+ requireUtils()
3581
+ );
3582
+ } else {
3583
+ // browser global
3584
+ factory(
3585
+ window,
3586
+ window.Flickity,
3587
+ window.fizzyUIUtils
3588
+ );
3589
+ }
3590
+
3591
+ }( window, function factory( window, Flickity, utils ) {
3592
+
3593
+ // append cells to a document fragment
3594
+ function getCellsFragment( cells ) {
3595
+ var fragment = document.createDocumentFragment();
3596
+ cells.forEach( function( cell ) {
3597
+ fragment.appendChild( cell.element );
3598
+ } );
3599
+ return fragment;
3600
+ }
3601
+
3602
+ // -------------------------- add/remove cell prototype -------------------------- //
3603
+
3604
+ var proto = Flickity.prototype;
3605
+
3606
+ /**
3607
+ * Insert, prepend, or append cells
3608
+ * @param {[Element, Array, NodeList]} elems - Elements to insert
3609
+ * @param {Integer} index - Zero-based number to insert
3610
+ */
3611
+ proto.insert = function( elems, index ) {
3612
+ var cells = this._makeCells( elems );
3613
+ if ( !cells || !cells.length ) {
3614
+ return;
3615
+ }
3616
+ var len = this.cells.length;
3617
+ // default to append
3618
+ index = index === undefined ? len : index;
3619
+ // add cells with document fragment
3620
+ var fragment = getCellsFragment( cells );
3621
+ // append to slider
3622
+ var isAppend = index == len;
3623
+ if ( isAppend ) {
3624
+ this.slider.appendChild( fragment );
3625
+ } else {
3626
+ var insertCellElement = this.cells[ index ].element;
3627
+ this.slider.insertBefore( fragment, insertCellElement );
3628
+ }
3629
+ // add to this.cells
3630
+ if ( index === 0 ) {
3631
+ // prepend, add to start
3632
+ this.cells = cells.concat( this.cells );
3633
+ } else if ( isAppend ) {
3634
+ // append, add to end
3635
+ this.cells = this.cells.concat( cells );
3636
+ } else {
3637
+ // insert in this.cells
3638
+ var endCells = this.cells.splice( index, len - index );
3639
+ this.cells = this.cells.concat( cells ).concat( endCells );
3640
+ }
3641
+
3642
+ this._sizeCells( cells );
3643
+ this.cellChange( index, true );
3644
+ };
3645
+
3646
+ proto.append = function( elems ) {
3647
+ this.insert( elems, this.cells.length );
3648
+ };
3649
+
3650
+ proto.prepend = function( elems ) {
3651
+ this.insert( elems, 0 );
3652
+ };
3653
+
3654
+ /**
3655
+ * Remove cells
3656
+ * @param {[Element, Array, NodeList]} elems - ELements to remove
3657
+ */
3658
+ proto.remove = function( elems ) {
3659
+ var cells = this.getCells( elems );
3660
+ if ( !cells || !cells.length ) {
3661
+ return;
3662
+ }
3663
+
3664
+ var minCellIndex = this.cells.length - 1;
3665
+ // remove cells from collection & DOM
3666
+ cells.forEach( function( cell ) {
3667
+ cell.remove();
3668
+ var index = this.cells.indexOf( cell );
3669
+ minCellIndex = Math.min( index, minCellIndex );
3670
+ utils.removeFrom( this.cells, cell );
3671
+ }, this );
3672
+
3673
+ this.cellChange( minCellIndex, true );
3674
+ };
3675
+
3676
+ /**
3677
+ * logic to be run after a cell's size changes
3678
+ * @param {Element} elem - cell's element
3679
+ */
3680
+ proto.cellSizeChange = function( elem ) {
3681
+ var cell = this.getCell( elem );
3682
+ if ( !cell ) {
3683
+ return;
3684
+ }
3685
+ cell.getSize();
3686
+
3687
+ var index = this.cells.indexOf( cell );
3688
+ this.cellChange( index );
3689
+ };
3690
+
3691
+ /**
3692
+ * logic any time a cell is changed: added, removed, or size changed
3693
+ * @param {Integer} changedCellIndex - index of the changed cell, optional
3694
+ * @param {Boolean} isPositioningSlider - Positions slider after selection
3695
+ */
3696
+ proto.cellChange = function( changedCellIndex, isPositioningSlider ) {
3697
+ var prevSelectedElem = this.selectedElement;
3698
+ this._positionCells( changedCellIndex );
3699
+ this._getWrapShiftCells();
3700
+ this.setGallerySize();
3701
+ // update selectedIndex
3702
+ // try to maintain position & select previous selected element
3703
+ var cell = this.getCell( prevSelectedElem );
3704
+ if ( cell ) {
3705
+ this.selectedIndex = this.getCellSlideIndex( cell );
3706
+ }
3707
+ this.selectedIndex = Math.min( this.slides.length - 1, this.selectedIndex );
3708
+
3709
+ this.emitEvent( 'cellChange', [ changedCellIndex ] );
3710
+ // position slider
3711
+ this.select( this.selectedIndex );
3712
+ // do not position slider after lazy load
3713
+ if ( isPositioningSlider ) {
3714
+ this.positionSliderAtSelected();
3715
+ }
3716
+ };
3717
+
3718
+ // ----- ----- //
3719
+
3720
+ return Flickity;
3721
+
3722
+ } ) );
3723
+ } (addRemoveCell));
3724
+ return addRemoveCell.exports;
3725
+ }
3726
+
3727
+ var lazyload = {exports: {}};
3728
+
3729
+ var hasRequiredLazyload;
3730
+
3731
+ function requireLazyload () {
3732
+ if (hasRequiredLazyload) return lazyload.exports;
3733
+ hasRequiredLazyload = 1;
3734
+ (function (module) {
3735
+ // lazyload
3736
+ ( function( window, factory ) {
3737
+ // universal module definition
3738
+ if ( module.exports ) {
3739
+ // CommonJS
3740
+ module.exports = factory(
3741
+ window,
3742
+ requireFlickity(),
3743
+ requireUtils()
3744
+ );
3745
+ } else {
3746
+ // browser global
3747
+ factory(
3748
+ window,
3749
+ window.Flickity,
3750
+ window.fizzyUIUtils
3751
+ );
3752
+ }
3753
+
3754
+ }( window, function factory( window, Flickity, utils ) {
3755
+
3756
+ Flickity.createMethods.push('_createLazyload');
3757
+ var proto = Flickity.prototype;
3758
+
3759
+ proto._createLazyload = function() {
3760
+ this.on( 'select', this.lazyLoad );
3761
+ };
3762
+
3763
+ proto.lazyLoad = function() {
3764
+ var lazyLoad = this.options.lazyLoad;
3765
+ if ( !lazyLoad ) {
3766
+ return;
3767
+ }
3768
+ // get adjacent cells, use lazyLoad option for adjacent count
3769
+ var adjCount = typeof lazyLoad == 'number' ? lazyLoad : 0;
3770
+ var cellElems = this.getAdjacentCellElements( adjCount );
3771
+ // get lazy images in those cells
3772
+ var lazyImages = [];
3773
+ cellElems.forEach( function( cellElem ) {
3774
+ var lazyCellImages = getCellLazyImages( cellElem );
3775
+ lazyImages = lazyImages.concat( lazyCellImages );
3776
+ } );
3777
+ // load lazy images
3778
+ lazyImages.forEach( function( img ) {
3779
+ new LazyLoader( img, this );
3780
+ }, this );
3781
+ };
3782
+
3783
+ function getCellLazyImages( cellElem ) {
3784
+ // check if cell element is lazy image
3785
+ if ( cellElem.nodeName == 'IMG' ) {
3786
+ var lazyloadAttr = cellElem.getAttribute('data-flickity-lazyload');
3787
+ var srcAttr = cellElem.getAttribute('data-flickity-lazyload-src');
3788
+ var srcsetAttr = cellElem.getAttribute('data-flickity-lazyload-srcset');
3789
+ if ( lazyloadAttr || srcAttr || srcsetAttr ) {
3790
+ return [ cellElem ];
3791
+ }
3792
+ }
3793
+ // select lazy images in cell
3794
+ var lazySelector = 'img[data-flickity-lazyload], ' +
3795
+ 'img[data-flickity-lazyload-src], img[data-flickity-lazyload-srcset]';
3796
+ var imgs = cellElem.querySelectorAll( lazySelector );
3797
+ return utils.makeArray( imgs );
3798
+ }
3799
+
3800
+ // -------------------------- LazyLoader -------------------------- //
3801
+
3802
+ /**
3803
+ * class to handle loading images
3804
+ * @param {Image} img - Image element
3805
+ * @param {Flickity} flickity - Flickity instance
3806
+ */
3807
+ function LazyLoader( img, flickity ) {
3808
+ this.img = img;
3809
+ this.flickity = flickity;
3810
+ this.load();
3811
+ }
3812
+
3813
+ LazyLoader.prototype.handleEvent = utils.handleEvent;
3814
+
3815
+ LazyLoader.prototype.load = function() {
3816
+ this.img.addEventListener( 'load', this );
3817
+ this.img.addEventListener( 'error', this );
3818
+ // get src & srcset
3819
+ var src = this.img.getAttribute('data-flickity-lazyload') ||
3820
+ this.img.getAttribute('data-flickity-lazyload-src');
3821
+ var srcset = this.img.getAttribute('data-flickity-lazyload-srcset');
3822
+ // set src & serset
3823
+ this.img.src = src;
3824
+ if ( srcset ) {
3825
+ this.img.setAttribute( 'srcset', srcset );
3826
+ }
3827
+ // remove attr
3828
+ this.img.removeAttribute('data-flickity-lazyload');
3829
+ this.img.removeAttribute('data-flickity-lazyload-src');
3830
+ this.img.removeAttribute('data-flickity-lazyload-srcset');
3831
+ };
3832
+
3833
+ LazyLoader.prototype.onload = function( event ) {
3834
+ this.complete( event, 'flickity-lazyloaded' );
3835
+ };
3836
+
3837
+ LazyLoader.prototype.onerror = function( event ) {
3838
+ this.complete( event, 'flickity-lazyerror' );
3839
+ };
3840
+
3841
+ LazyLoader.prototype.complete = function( event, className ) {
3842
+ // unbind events
3843
+ this.img.removeEventListener( 'load', this );
3844
+ this.img.removeEventListener( 'error', this );
3845
+
3846
+ var cell = this.flickity.getParentCell( this.img );
3847
+ var cellElem = cell && cell.element;
3848
+ this.flickity.cellSizeChange( cellElem );
3849
+
3850
+ this.img.classList.add( className );
3851
+ this.flickity.dispatchEvent( 'lazyLoad', event, cellElem );
3852
+ };
3853
+
3854
+ // ----- ----- //
3855
+
3856
+ Flickity.LazyLoader = LazyLoader;
3857
+
3858
+ return Flickity;
3859
+
3860
+ } ) );
3861
+ } (lazyload));
3862
+ return lazyload.exports;
3863
+ }
3864
+
3865
+ /*!
3866
+ * Flickity v2.3.0
3867
+ * Touch, responsive, flickable carousels
3868
+ *
3869
+ * Licensed GPLv3 for open source use
3870
+ * or Flickity Commercial License for commercial use
3871
+ *
3872
+ * https://flickity.metafizzy.co
3873
+ * Copyright 2015-2021 Metafizzy
3874
+ */
3875
+
3876
+ var hasRequiredJs;
3877
+
3878
+ function requireJs () {
3879
+ if (hasRequiredJs) return js.exports;
3880
+ hasRequiredJs = 1;
3881
+ (function (module) {
3882
+ ( function( window, factory ) {
3883
+ // universal module definition
3884
+ if ( module.exports ) {
3885
+ // CommonJS
3886
+ module.exports = factory(
3887
+ requireFlickity(),
3888
+ requireDrag(),
3889
+ requirePrevNextButton(),
3890
+ requirePageDots(),
3891
+ requirePlayer(),
3892
+ requireAddRemoveCell(),
3893
+ requireLazyload()
3894
+ );
3895
+ }
3896
+
3897
+ } )( window, function factory( Flickity ) {
3898
+ return Flickity;
3899
+ } );
3900
+ } (js));
3901
+ return js.exports;
3902
+ }
3903
+
3904
+ var jsExports = requireJs();
3905
+ const index = /*@__PURE__*/index$2.getDefaultExportFromCjs(jsExports);
3906
+
3907
+ const index$1 = /*#__PURE__*/_mergeNamespaces({
3908
+ __proto__: null,
3909
+ default: index
3910
+ }, [jsExports]);
3911
+
3912
+ exports.index = index$1;