PageSourceSearch

https://braunbuffel.com.my/cdn/shop/t/55/assets/vendor.min.js?v=28751473638119546311788090037

js braunbuffel.com.my collected 2026-10-07 16:03:21 UTC 106,902 bytes, 4,057 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.