PageSourceSearch

https://www.colonygums.com/_includes/assets/js/bundle.js?2026-08-1315:0303:03:40

js colonygums.com collected 2026-10-02 22:55:21 UTC 146,409 bytes, 5,394 lines download raw bytes

1(function () {
2  'use strict';
3
4  // off-canvas open and close
5  document.querySelectorAll('[data-nav-toggle]').forEach((button) => {
6    button.addEventListener('click', () => {
7      document.body.classList.toggle('nav-is-open');
8    });
9  });
10
11  document.querySelectorAll('.has-child-link').forEach((link) => {
12    link.addEventListener('click', (e) => {
13      e.preventDefault();
14
15      //regardless of where we are and what happens, toggle the submenu
16      e.target.classList.toggle('open-subs');
17      e.target.parentNode.classList.toggle('down');
18    });
19  });
20
21  /*!
22   * Glide.js v3.7.1
23   * (c) 2013-2024 Jędrzej Chałubek (https://github.com/jedrzejchalubek/)
24   * Released under the MIT License.
25   */
vendor: 97,243 bytes, lines 25-3912
25
26
27  function ownKeys(object, enumerableOnly) {
28    var keys = Object.keys(object);
29
30    if (Object.getOwnPropertySymbols) {
31      var symbols = Object.getOwnPropertySymbols(object);
32
33      if (enumerableOnly) {
34        symbols = symbols.filter(function (sym) {
35          return Object.getOwnPropertyDescriptor(object, sym).enumerable;
36        });
37      }
38
39      keys.push.apply(keys, symbols);
40    }
41
42    return keys;
43  }
44
45  function _objectSpread2(target) {
46    for (var i = 1; i < arguments.length; i++) {
47      var source = arguments[i] != null ? arguments[i] : {};
48
49      if (i % 2) {
50        ownKeys(Object(source), true).forEach(function (key) {
51          _defineProperty(target, key, source[key]);
52        });
53      } else if (Object.getOwnPropertyDescriptors) {
54        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
55      } else {
56        ownKeys(Object(source)).forEach(function (key) {
57          Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
58        });
59      }
60    }
61
62    return target;
63  }
64
65  function _typeof(obj) {
66    "@babel/helpers - typeof";
67
68    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
69      _typeof = function (obj) {
70        return typeof obj;
71      };
72    } else {
73      _typeof = function (obj) {
74        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
75      };
76    }
77
78    return _typeof(obj);
79  }
80
81  function _classCallCheck(instance, Constructor) {
82    if (!(instance instanceof Constructor)) {
83      throw new TypeError("Cannot call a class as a function");
84    }
85  }
86
87  function _defineProperties(target, props) {
88    for (var i = 0; i < props.length; i++) {
89      var descriptor = props[i];
90      descriptor.enumerable = descriptor.enumerable || false;
91      descriptor.configurable = true;
92      if ("value" in descriptor) descriptor.writable = true;
93      Object.defineProperty(target, descriptor.key, descriptor);
94    }
95  }
96
97  function _createClass(Constructor, protoProps, staticProps) {
98    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
99    if (staticProps) _defineProperties(Constructor, staticProps);
100    return Constructor;
101  }
102
103  function _defineProperty(obj, key, value) {
104    if (key in obj) {
105      Object.defineProperty(obj, key, {
106        value: value,
107        enumerable: true,
108        configurable: true,
109        writable: true
110      });
111    } else {
112      obj[key] = value;
113    }
114
115    return obj;
116  }
117
118  function _inherits(subClass, superClass) {
119    if (typeof superClass !== "function" && superClass !== null) {
120      throw new TypeError("Super expression must either be null or a function");
121    }
122
123    subClass.prototype = Object.create(superClass && superClass.prototype, {
124      constructor: {
125        value: subClass,
126        writable: true,
127        configurable: true
128      }
129    });
130    if (superClass) _setPrototypeOf(subClass, superClass);
131  }
132
133  function _getPrototypeOf(o) {
134    _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
135      return o.__proto__ || Object.getPrototypeOf(o);
136    };
137    return _getPrototypeOf(o);
138  }
139
140  function _setPrototypeOf(o, p) {
141    _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
142      o.__proto__ = p;
143      return o;
144    };
145
146    return _setPrototypeOf(o, p);
147  }
148
149  function _isNativeReflectConstruct() {
150    if (typeof Reflect === "undefined" || !Reflect.construct) return false;
151    if (Reflect.construct.sham) return false;
152    if (typeof Proxy === "function") return true;
153
154    try {
155      Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
156      return true;
157    } catch (e) {
158      return false;
159    }
160  }
161
162  function _assertThisInitialized(self) {
163    if (self === void 0) {
164      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
165    }
166
167    return self;
168  }
169
170  function _possibleConstructorReturn(self, call) {
171    if (call && (typeof call === "object" || typeof call === "function")) {
172      return call;
173    } else if (call !== void 0) {
174      throw new TypeError("Derived constructors may only return object or undefined");
175    }
176
177    return _assertThisInitialized(self);
178  }
179
180  function _createSuper(Derived) {
181    var hasNativeReflectConstruct = _isNativeReflectConstruct();
182
183    return function _createSuperInternal() {
184      var Super = _getPrototypeOf(Derived),
185          result;
186
187      if (hasNativeReflectConstruct) {
188        var NewTarget = _getPrototypeOf(this).constructor;
189
190        result = Reflect.construct(Super, arguments, NewTarget);
191      } else {
192        result = Super.apply(this, arguments);
193      }
194
195      return _possibleConstructorReturn(this, result);
196    };
197  }
198
199  function _superPropBase(object, property) {
200    while (!Object.prototype.hasOwnProperty.call(object, property)) {
201      object = _getPrototypeOf(object);
202      if (object === null) break;
203    }
204
205    return object;
206  }
207
208  function _get() {
209    if (typeof Reflect !== "undefined" && Reflect.get) {
210      _get = Reflect.get;
211    } else {
212      _get = function _get(target, property, receiver) {
213        var base = _superPropBase(target, property);
214
215        if (!base) return;
216        var desc = Object.getOwnPropertyDescriptor(base, property);
217
218        if (desc.get) {
219          return desc.get.call(arguments.length < 3 ? target : receiver);
220        }
221
222        return desc.value;
223      };
224    }
225
226    return _get.apply(this, arguments);
227  }
228
229  var defaults = {
230    /**
231     * Type of the movement.
232     *
233     * Available types:
234     * `slider` - Rewinds slider to the start/end when it reaches the first or last slide.
235     * `carousel` - Changes slides without starting over when it reaches the first or last slide.
236     *
237     * @type {String}
238     */
239    type: 'slider',
240
241    /**
242     * Start at specific slide number defined with zero-based index.
243     *
244     * @type {Number}
245     */
246    startAt: 0,
247
248    /**
249     * A number of slides visible on the single viewport.
250     *
251     * @type {Number}
252     */
253    perView: 1,
254
255    /**
256     * Focus currently active slide at a specified position in the track.
257     *
258     * Available inputs:
259     * `center` - Current slide will be always focused at the center of a track.
260     * `0,1,2,3...` - Current slide will be focused on the specified zero-based index.
261     *
262     * @type {String|Number}
263     */
264    focusAt: 0,
265
266    /**
267     * A size of the gap added between slides.
268     *
269     * @type {Number}
270     */
271    gap: 10,
272
273    /**
274     * Change slides after a specified interval. Use `false` for turning off autoplay.
275     *
276     * @type {Number|Boolean}
277     */
278    autoplay: false,
279
280    /**
281     * Stop autoplay on mouseover event.
282     *
283     * @type {Boolean}
284     */
285    hoverpause: true,
286
287    /**
288     * Allow for changing slides with left and right keyboard arrows.
289     *
290     * @type {Boolean}
291     */
292    keyboard: true,
293
294    /**
295     * Stop running `perView` number of slides from the end. Use this
296     * option if you don't want to have an empty space after
297     * a slider. Works only with `slider` type and a
298     * non-centered `focusAt` setting.
299     *
300     * @type {Boolean}
301     */
302    bound: false,
303
304    /**
305     * Minimal swipe distance needed to change the slide. Use `false` for turning off a swiping.
306     *
307     * @type {Number|Boolean}
308     */
309    swipeThreshold: 80,
310
311    /**
312     * Minimal mouse drag distance needed to change the slide. Use `false` for turning off a dragging.
313     *
314     * @type {Number|Boolean}
315     */
316    dragThreshold: 120,
317
318    /**
319     * A number of slides moved on single swipe.
320     *
321     * Available types:
322     * `` - Moves slider by one slide per swipe
323     * `|` - Moves slider between views per swipe (number of slides defined in `perView` options)
324     *
325     * @type {String}
326     */
327    perSwipe: '',
328
329    /**
330     * Moving distance ratio of the slides on a swiping and dragging.
331     *
332     * @type {Number}
333     */
334    touchRatio: 0.5,
335
336    /**
337     * Angle required to activate slides moving on swiping or dragging.
338     *
339     * @type {Number}
340     */
341    touchAngle: 45,
342
343    /**
344     * Duration of the animation in milliseconds.
345     *
346     * @type {Number}
347     */
348    animationDuration: 400,
349
350    /**
351     * Allows looping the `slider` type. Slider will rewind to the first/last slide when it's at the start/end.
352     *
353     * @type {Boolean}
354     */
355    rewind: true,
356
357    /**
358     * Duration of the rewinding animation of the `slider` type in milliseconds.
359     *
360     * @type {Number}
361     */
362    rewindDuration: 800,
363
364    /**
365     * Easing function for the animation.
366     *
367     * @type {String}
368     */
369    animationTimingFunc: 'cubic-bezier(.165, .840, .440, 1)',
370
371    /**
372     * Wait for the animation to finish until the next user input can be processed
373     *
374     * @type {boolean}
375     */
376    waitForTransition: true,
377
378    /**
379     * Throttle costly events at most once per every wait milliseconds.
380     *
381     * @type {Number}
382     */
383    throttle: 10,
384
385    /**
386     * Moving direction mode.
387     *
388     * Available inputs:
389     * - 'ltr' - left to right movement,
390     * - 'rtl' - right to left movement.
391     *
392     * @type {String}
393     */
394    direction: 'ltr',
395
396    /**
397     * The distance value of the next and previous viewports which
398     * have to peek in the current view. Accepts number and
399     * pixels as a string. Left and right peeking can be
400     * set up separately with a directions object.
401     *
402     * For example:
403     * `100` - Peek 100px on the both sides.
404     * { before: 100, after: 50 }` - Peek 100px on the left side and 50px on the right side.
405     *
406     * @type {Number|String|Object}
407     */
408    peek: 0,
409
410    /**
411     * Defines how many clones of current viewport will be generated.
412     *
413     * @type {Number}
414     */
415    cloningRatio: 1,
416
417    /**
418     * Collection of options applied at specified media breakpoints.
419     * For example: display two slides per view under 800px.
420     * `{
421     *   '800px': {
422     *     perView: 2
423     *   }
424     * }`
425     */
426    breakpoints: {},
427
428    /**
429     * Collection of internally used HTML classes.
430     *
431     * @todo Refactor `slider` and `carousel` properties to single `type: { slider: '', carousel: '' }` object
432     * @type {Object}
433     */
434    classes: {
435      swipeable: 'glide--swipeable',
436      dragging: 'glide--dragging',
437      direction: {
438        ltr: 'glide--ltr',
439        rtl: 'glide--rtl'
440      },
441      type: {
442        slider: 'glide--slider',
443        carousel: 'glide--carousel'
444      },
445      slide: {
446        clone: 'glide__slide--clone',
447        active: 'glide__slide--active'
448      },
449      arrow: {
450        disabled: 'glide__arrow--disabled'
451      },
452      nav: {
453        active: 'glide__bullet--active'
454      }
455    }
456  };
457
458  /**
459   * Outputs warning message to the bowser console.
460   *
461   * @param  {String} msg
462   * @return {Void}
463   */
464  function warn(msg) {
465    console.error("[Glide warn]: ".concat(msg));
466  }
467
468  /**
469   * Converts value entered as number
470   * or string to integer value.
471   *
472   * @param {String} value
473   * @returns {Number}
474   */
475  function toInt(value) {
476    return parseInt(value);
477  }
478  /**
479   * Converts value entered as number
480   * or string to flat value.
481   *
482   * @param {String} value
483   * @returns {Number}
484   */
485
486  function toFloat(value) {
487    return parseFloat(value);
488  }
489  /**
490   * Indicates whether the specified value is a string.
491   *
492   * @param  {*}   value
493   * @return {Boolean}
494   */
495
496  function isString(value) {
497    return typeof value === 'string';
498  }
499  /**
500   * Indicates whether the specified value is an object.
501   *
502   * @param  {*} value
503   * @return {Boolean}
504   *
505   * @see https://github.com/jashkenas/underscore
506   */
507
508  function isObject(value) {
509    var type = _typeof(value);
510
511    return type === 'function' || type === 'object' && !!value; // eslint-disable-line no-mixed-operators
512  }
513  /**
514   * Indicates whether the specified value is a function.
515   *
516   * @param  {*} value
517   * @return {Boolean}
518   */
519
520  function isFunction(value) {
521    return typeof value === 'function';
522  }
523  /**
524   * Indicates whether the specified value is undefined.
525   *
526   * @param  {*} value
527   * @return {Boolean}
528   */
529
530  function isUndefined(value) {
531    return typeof value === 'undefined';
532  }
533  /**
534   * Indicates whether the specified value is an array.
535   *
536   * @param  {*} value
537   * @return {Boolean}
538   */
539
540  function isArray(value) {
541    return value.constructor === Array;
542  }
543
544  /**
545   * Creates and initializes specified collection of extensions.
546   * Each extension receives access to instance of glide and rest of components.
547   *
548   * @param {Object} glide
549   * @param {Object} extensions
550   *
551   * @returns {Object}
552   */
553
554  function mount(glide, extensions, events) {
555    var components = {};
556
557    for (var name in extensions) {
558      if (isFunction(extensions[name])) {
559        components[name] = extensions[name](glide, components, events);
560      } else {
561        warn('Extension must be a function');
562      }
563    }
564
565    for (var _name in components) {
566      if (isFunction(components[_name].mount)) {
567        components[_name].mount();
568      }
569    }
570
571    return components;
572  }
573
574  /**
575   * Defines getter and setter property on the specified object.
576   *
577   * @param  {Object} obj         Object where property has to be defined.
578   * @param  {String} prop        Name of the defined property.
579   * @param  {Object} definition  Get and set definitions for the property.
580   * @return {Void}
581   */
582  function define(obj, prop, definition) {
583    Object.defineProperty(obj, prop, definition);
584  }
585  /**
586   * Sorts aphabetically object keys.
587   *
588   * @param  {Object} obj
589   * @return {Object}
590   */
591
592  function sortKeys(obj) {
593    return Object.keys(obj).sort().reduce(function (r, k) {
594      r[k] = obj[k];
595      return r[k], r;
596    }, {});
597  }
598  /**
599   * Merges passed settings object with default options.
600   *
601   * @param  {Object} defaults
602   * @param  {Object} settings
603   * @return {Object}
604   */
605
606  function mergeOptions(defaults, settings) {
607    var options = Object.assign({}, defaults, settings); // `Object.assign` do not deeply merge objects, so we
608    // have to do it manually for every nested object
609    // in options. Although it does not look smart,
610    // it's smaller and faster than some fancy
611    // merging deep-merge algorithm script.
612
613    if (settings.hasOwnProperty('classes')) {
614      options.classes = Object.assign({}, defaults.classes, settings.classes);
615      var properties = ['direction', 'type', 'slide', 'arrow', 'nav'];
616      properties.forEach(function (property) {
617        if (settings.classes.hasOwnProperty(property)) {
618          options.classes[property] = _objectSpread2(_objectSpread2({}, defaults.classes[property]), settings.classes[property]);
619        }
620      });
621    }
622
623    if (settings.hasOwnProperty('breakpoints')) {
624      options.breakpoints = Object.assign({}, defaults.breakpoints, settings.breakpoints);
625    }
626
627    return options;
628  }
629
630  var EventsBus = /*#__PURE__*/function () {
631    /**
632     * Construct a EventBus instance.
633     *
634     * @param {Object} events
635     */
636    function EventsBus() {
637      var events = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
638
639      _classCallCheck(this, EventsBus);
640
641      this.events = events;
642      this.hop = events.hasOwnProperty;
643    }
644    /**
645     * Adds listener to the specifed event.
646     *
647     * @param {String|Array} event
648     * @param {Function} handler
649     */
650
651
652    _createClass(EventsBus, [{
653      key: "on",
654      value: function on(event, handler) {
655        if (isArray(event)) {
656          for (var i = 0; i < event.length; i++) {
657            this.on(event[i], handler);
658          }
659
660          return;
661        } // Create the event's object if not yet created
662
663
664        if (!this.hop.call(this.events, event)) {
665          this.events[event] = [];
666        } // Add the handler to queue
667
668
669        var index = this.events[event].push(handler) - 1; // Provide handle back for removal of event
670
671        return {
672          remove: function remove() {
673            delete this.events[event][index];
674          }
675        };
676      }
677      /**
678       * Runs registered handlers for specified event.
679       *
680       * @param {String|Array} event
681       * @param {Object=} context
682       */
683
684    }, {
685      key: "emit",
686      value: function emit(event, context) {
687        if (isArray(event)) {
688          for (var i = 0; i < event.length; i++) {
689            this.emit(event[i], context);
690          }
691
692          return;
693        } // If the event doesn't exist, or there's no handlers in queue, just leave
694
695
696        if (!this.hop.call(this.events, event)) {
697          return;
698        } // Cycle through events queue, fire!
699
700
701        this.events[event].forEach(function (item) {
702          item(context || {});
703        });
704      }
705    }]);
706
707    return EventsBus;
708  }();
709
710  var Glide$1 = /*#__PURE__*/function () {
711    /**
712     * Construct glide.
713     *
714     * @param  {String} selector
715     * @param  {Object} options
716     */
717    function Glide(selector) {
718      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
719
720      _classCallCheck(this, Glide);
721
722      this._c = {};
723      this._t = [];
724      this._e = new EventsBus();
725      this.disabled = false;
726      this.selector = selector;
727      this.settings = mergeOptions(defaults, options);
728      this.index = this.settings.startAt;
729    }
730    /**
731     * Initializes glide.
732     *
733     * @param {Object} extensions Collection of extensions to initialize.
734     * @return {Glide}
735     */
736
737
738    _createClass(Glide, [{
739      key: "mount",
740      value: function mount$1() {
741        var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
742
743        this._e.emit('mount.before');
744
745        if (isObject(extensions)) {
746          this._c = mount(this, extensions, this._e);
747        } else {
748          warn('You need to provide a object on `mount()`');
749        }
750
751        this._e.emit('mount.after');
752
753        return this;
754      }
755      /**
756       * Collects an instance `translate` transformers.
757       *
758       * @param  {Array} transformers Collection of transformers.
759       * @return {Void}
760       */
761
762    }, {
763      key: "mutate",
764      value: function mutate() {
765        var transformers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
766
767        if (isArray(transformers)) {
768          this._t = transformers;
769        } else {
770          warn('You need to provide a array on `mutate()`');
771        }
772
773        return this;
774      }
775      /**
776       * Updates glide with specified settings.
777       *
778       * @param {Object} settings
779       * @return {Glide}
780       */
781
782    }, {
783      key: "update",
784      value: function update() {
785        var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
786        this.settings = mergeOptions(this.settings, settings);
787
788        if (settings.hasOwnProperty('startAt')) {
789          this.index = settings.startAt;
790        }
791
792        this._e.emit('update');
793
794        return this;
795      }
796      /**
797       * Change slide with specified pattern. A pattern must be in the special format:
798       * `>` - Move one forward
799       * `<` - Move one backward
800       * `={i}` - Go to {i} zero-based slide (eq. '=1', will go to second slide)
801       * `>>` - Rewinds to end (last slide)
802       * `<<` - Rewinds to start (first slide)
803       * `|>` - Move one viewport forward
804       * `|<` - Move one viewport backward
805       *
806       * @param {String} pattern
807       * @return {Glide}
808       */
809
810    }, {
811      key: "go",
812      value: function go(pattern) {
813        this._c.Run.make(pattern);
814
815        return this;
816      }
817      /**
818       * Move track by specified distance.
819       *
820       * @param {String} distance
821       * @return {Glide}
822       */
823
824    }, {
825      key: "move",
826      value: function move(distance) {
827        this._c.Transition.disable();
828
829        this._c.Move.make(distance);
830
831        return this;
832      }
833      /**
834       * Destroy instance and revert all changes done by this._c.
835       *
836       * @return {Glide}
837       */
838
839    }, {
840      key: "destroy",
841      value: function destroy() {
842        this._e.emit('destroy');
843
844        return this;
845      }
846      /**
847       * Start instance autoplaying.
848       *
849       * @param {Boolean|Number} interval Run autoplaying with passed interval regardless of `autoplay` settings
850       * @return {Glide}
851       */
852
853    }, {
854      key: "play",
855      value: function play() {
856        var interval = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
857
858        if (interval) {
859          this.settings.autoplay = interval;
860        }
861
862        this._e.emit('play');
863
864        return this;
865      }
866      /**
867       * Stop instance autoplaying.
868       *
869       * @return {Glide}
870       */
871
872    }, {
873      key: "pause",
874      value: function pause() {
875        this._e.emit('pause');
876
877        return this;
878      }
879      /**
880       * Sets glide into a idle status.
881       *
882       * @return {Glide}
883       */
884
885    }, {
886      key: "disable",
887      value: function disable() {
888        this.disabled = true;
889        return this;
890      }
891      /**
892       * Sets glide into a active status.
893       *
894       * @return {Glide}
895       */
896
897    }, {
898      key: "enable",
899      value: function enable() {
900        this.disabled = false;
901        return this;
902      }
903      /**
904       * Adds cuutom event listener with handler.
905       *
906       * @param  {String|Array} event
907       * @param  {Function} handler
908       * @return {Glide}
909       */
910
911    }, {
912      key: "on",
913      value: function on(event, handler) {
914        this._e.on(event, handler);
915
916        return this;
917      }
918      /**
919       * Checks if glide is a precised type.
920       *
921       * @param  {String} name
922       * @return {Boolean}
923       */
924
925    }, {
926      key: "isType",
927      value: function isType(name) {
928        return this.settings.type === name;
929      }
930      /**
931       * Gets value of the core options.
932       *
933       * @return {Object}
934       */
935
936    }, {
937      key: "settings",
938      get: function get() {
939        return this._o;
940      }
941      /**
942       * Sets value of the core options.
943       *
944       * @param  {Object} o
945       * @return {Void}
946       */
947      ,
948      set: function set(o) {
949        if (isObject(o)) {
950          this._o = o;
951        } else {
952          warn('Options must be an `object` instance.');
953        }
954      }
955      /**
956       * Gets current index of the slider.
957       *
958       * @return {Object}
959       */
960
961    }, {
962      key: "index",
963      get: function get() {
964        return this._i;
965      }
966      /**
967       * Sets current index a slider.
968       *
969       * @return {Object}
970       */
971      ,
972      set: function set(i) {
973        this._i = toInt(i);
974      }
975      /**
976       * Gets type name of the slider.
977       *
978       * @return {String}
979       */
980
981    }, {
982      key: "type",
983      get: function get() {
984        return this.settings.type;
985      }
986      /**
987       * Gets value of the idle status.
988       *
989       * @return {Boolean}
990       */
991
992    }, {
993      key: "disabled",
994      get: function get() {
995        return this._d;
996      }
997      /**
998       * Sets value of the idle status.
999       *
1000       * @return {Boolean}
1001       */
1002      ,
1003      set: function set(status) {
1004        this._d = !!status;
1005      }
1006    }]);
1007
1008    return Glide;
1009  }();
1010
1011  function Run (Glide, Components, Events) {
1012    var Run = {
1013      /**
1014       * Initializes autorunning of the glide.
1015       *
1016       * @return {Void}
1017       */
1018      mount: function mount() {
1019        this._o = false;
1020      },
1021
1022      /**
1023       * Makes glides running based on the passed moving schema.
1024       *
1025       * @param {String} move
1026       */
1027      make: function make(move) {
1028        var _this = this;
1029
1030        if (!Glide.disabled) {
1031          !Glide.settings.waitForTransition || Glide.disable();
1032          this.move = move;
1033          Events.emit('run.before', this.move);
1034          this.calculate();
1035          Events.emit('run', this.move);
1036          Components.Transition.after(function () {
1037            if (_this.isStart()) {
1038              Events.emit('run.start', _this.move);
1039            }
1040
1041            if (_this.isEnd()) {
1042              Events.emit('run.end', _this.move);
1043            }
1044
1045            if (_this.isOffset()) {
1046              _this._o = false;
1047              Events.emit('run.offset', _this.move);
1048            }
1049
1050            Events.emit('run.after', _this.move);
1051            Glide.enable();
1052          });
1053        }
1054      },
1055
1056      /**
1057       * Calculates current index based on defined move.
1058       *
1059       * @return {Number|Undefined}
1060       */
1061      calculate: function calculate() {
1062        var move = this.move,
1063            length = this.length;
1064        var steps = move.steps,
1065            direction = move.direction; // By default assume that size of view is equal to one slide
1066
1067        var viewSize = 1; // While direction is `=` we want jump to
1068        // a specified index described in steps.
1069
1070        if (direction === '=') {
1071          // Check if bound is true, 
1072          // as we want to avoid whitespaces.
1073          if (Glide.settings.bound && toInt(steps) > length) {
1074            Glide.index = length;
1075            return;
1076          }
1077
1078          Glide.index = steps;
1079          return;
1080        } // When pattern is equal to `>>` we want
1081        // fast forward to the last slide.
1082
1083
1084        if (direction === '>' && steps === '>') {
1085          Glide.index = length;
1086          return;
1087        } // When pattern is equal to `<<` we want
1088        // fast forward to the first slide.
1089
1090
1091        if (direction === '<' && steps === '<') {
1092          Glide.index = 0;
1093          return;
1094        } // pagination movement
1095
1096
1097        if (direction === '|') {
1098          viewSize = Glide.settings.perView || 1;
1099        } // we are moving forward
1100
1101
1102        if (direction === '>' || direction === '|' && steps === '>') {
1103          var index = calculateForwardIndex(viewSize);
1104
1105          if (index > length) {
1106            this._o = true;
1107          }
1108
1109          Glide.index = normalizeForwardIndex(index, viewSize);
1110          return;
1111        } // we are moving backward
1112
1113
1114        if (direction === '<' || direction === '|' && steps === '<') {
1115          var _index = calculateBackwardIndex(viewSize);
1116
1117          if (_index < 0) {
1118            this._o = true;
1119          }
1120
1121          Glide.index = normalizeBackwardIndex(_index, viewSize);
1122          return;
1123        }
1124
1125        warn("Invalid direction pattern [".concat(direction).concat(steps, "] has been used"));
1126      },
1127
1128      /**
1129       * Checks if we are on the first slide.
1130       *
1131       * @return {Boolean}
1132       */
1133      isStart: function isStart() {
1134        return Glide.index <= 0;
1135      },
1136
1137      /**
1138       * Checks if we are on the last slide.
1139       *
1140       * @return {Boolean}
1141       */
1142      isEnd: function isEnd() {
1143        return Glide.index >= this.length;
1144      },
1145
1146      /**
1147       * Checks if we are making a offset run.
1148       *
1149       * @param {String} direction
1150       * @return {Boolean}
1151       */
1152      isOffset: function isOffset() {
1153        var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
1154
1155        if (!direction) {
1156          return this._o;
1157        }
1158
1159        if (!this._o) {
1160          return false;
1161        } // did we view to the right?
1162
1163
1164        if (direction === '|>') {
1165          return this.move.direction === '|' && this.move.steps === '>';
1166        } // did we view to the left?
1167
1168
1169        if (direction === '|<') {
1170          return this.move.direction === '|' && this.move.steps === '<';
1171        }
1172
1173        return this.move.direction === direction;
1174      },
1175
1176      /**
1177       * Checks if bound mode is active
1178       *
1179       * @return {Boolean}
1180       */
1181      isBound: function isBound() {
1182        return Glide.isType('slider') && Glide.settings.focusAt !== 'center' && Glide.settings.bound;
1183      }
1184    };
1185    /**
1186     * Returns index value to move forward/to the right
1187     *
1188     * @param viewSize
1189     * @returns {Number}
1190     */
1191
1192    function calculateForwardIndex(viewSize) {
1193      var index = Glide.index;
1194
1195      if (Glide.isType('carousel')) {
1196        return index + viewSize;
1197      }
1198
1199      return index + (viewSize - index % viewSize);
1200    }
1201    /**
1202     * Normalizes the given forward index based on glide settings, preventing it to exceed certain boundaries
1203     *
1204     * @param index
1205     * @param length
1206     * @param viewSize
1207     * @returns {Number}
1208     */
1209
1210
1211    function normalizeForwardIndex(index, viewSize) {
1212      var length = Run.length;
1213
1214      if (index <= length) {
1215        return index;
1216      }
1217
1218      if (Glide.isType('carousel')) {
1219        return index - (length + 1);
1220      }
1221
1222      if (Glide.settings.rewind) {
1223        // bound does funny things with the length, therefor we have to be certain
1224        // that we are on the last possible index value given by bound
1225        if (Run.isBound() && !Run.isEnd()) {
1226          return length;
1227        }
1228
1229        return 0;
1230      }
1231
1232      if (Run.isBound()) {
1233        return length;
1234      }
1235
1236      return Math.floor(length / viewSize) * viewSize;
1237    }
1238    /**
1239     * Calculates index value to move backward/to the left
1240     *
1241     * @param viewSize
1242     * @returns {Number}
1243     */
1244
1245
1246    function calculateBackwardIndex(viewSize) {
1247      var index = Glide.index;
1248
1249      if (Glide.isType('carousel')) {
1250        return index - viewSize;
1251      } // ensure our back navigation results in the same index as a forward navigation
1252      // to experience a homogeneous paging
1253
1254
1255      var view = Math.ceil(index / viewSize);
1256      return (view - 1) * viewSize;
1257    }
1258    /**
1259     * Normalizes the given backward index based on glide settings, preventing it to exceed certain boundaries
1260     *
1261     * @param index
1262     * @param length
1263     * @param viewSize
1264     * @returns {*}
1265     */
1266
1267
1268    function normalizeBackwardIndex(index, viewSize) {
1269      var length = Run.length;
1270
1271      if (index >= 0) {
1272        return index;
1273      }
1274
1275      if (Glide.isType('carousel')) {
1276        return index + (length + 1);
1277      }
1278
1279      if (Glide.settings.rewind) {
1280        // bound does funny things with the length, therefor we have to be certain
1281        // that we are on first possible index value before we to rewind to the length given by bound
1282        if (Run.isBound() && Run.isStart()) {
1283          return length;
1284        }
1285
1286        return Math.floor(length / viewSize) * viewSize;
1287      }
1288
1289      return 0;
1290    }
1291
1292    define(Run, 'move', {
1293      /**
1294       * Gets value of the move schema.
1295       *
1296       * @returns {Object}
1297       */
1298      get: function get() {
1299        return this._m;
1300      },
1301
1302      /**
1303       * Sets value of the move schema.
1304       *
1305       * @returns {Object}
1306       */
1307      set: function set(value) {
1308        var step = value.substr(1);
1309        this._m = {
1310          direction: value.substr(0, 1),
1311          steps: step ? toInt(step) ? toInt(step) : step : 0
1312        };
1313      }
1314    });
1315    define(Run, 'length', {
1316      /**
1317       * Gets value of the running distance based
1318       * on zero-indexing number of slides.
1319       *
1320       * @return {Number}
1321       */
1322      get: function get() {
1323        var settings = Glide.settings;
1324        var length = Components.Html.slides.length; // If the `bound` option is active, a maximum running distance should be
1325        // reduced by `perView` and `focusAt` settings. Running distance
1326        // should end before creating an empty space after instance.
1327
1328        if (this.isBound()) {
1329          return length - 1 - (toInt(settings.perView) - 1) + toInt(settings.focusAt);
1330        }
1331
1332        return length - 1;
1333      }
1334    });
1335    define(Run, 'offset', {
1336      /**
1337       * Gets status of the offsetting flag.
1338       *
1339       * @return {Boolean}
1340       */
1341      get: function get() {
1342        return this._o;
1343      }
1344    });
1345    return Run;
1346  }
1347
1348  /**
1349   * Returns a current time.
1350   *
1351   * @return {Number}
1352   */
1353  function now() {
1354    return new Date().getTime();
1355  }
1356
1357  /**
1358   * Returns a function, that, when invoked, will only be triggered
1359   * at most once during a given window of time.
1360   *
1361   * @param {Function} func
1362   * @param {Number} wait
1363   * @param {Object=} options
1364   * @return {Function}
1365   *
1366   * @see https://github.com/jashkenas/underscore
1367   */
1368
1369  function throttle(func, wait) {
1370    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1371    var timeout, context, args, result;
1372    var previous = 0;
1373
1374    var later = function later() {
1375      previous = options.leading === false ? 0 : now();
1376      timeout = null;
1377      result = func.apply(context, args);
1378      if (!timeout) context = args = null;
1379    };
1380
1381    var throttled = function throttled() {
1382      var at = now();
1383      if (!previous && options.leading === false) previous = at;
1384      var remaining = wait - (at - previous);
1385      context = this;
1386      args = arguments;
1387
1388      if (remaining <= 0 || remaining > wait) {
1389        if (timeout) {
1390          clearTimeout(timeout);
1391          timeout = null;
1392        }
1393
1394        previous = at;
1395        result = func.apply(context, args);
1396        if (!timeout) context = args = null;
1397      } else if (!timeout && options.trailing !== false) {
1398        timeout = setTimeout(later, remaining);
1399      }
1400
1401      return result;
1402    };
1403
1404    throttled.cancel = function () {
1405      clearTimeout(timeout);
1406      previous = 0;
1407      timeout = context = args = null;
1408    };
1409
1410    return throttled;
1411  }
1412
1413  var MARGIN_TYPE = {
1414    ltr: ['marginLeft', 'marginRight'],
1415    rtl: ['marginRight', 'marginLeft']
1416  };
1417  function Gaps (Glide, Components, Events) {
1418    var Gaps = {
1419      /**
1420       * Applies gaps between slides. First and last
1421       * slides do not receive it's edge margins.
1422       *
1423       * @param {HTMLCollection} slides
1424       * @return {Void}
1425       */
1426      apply: function apply(slides) {
1427        for (var i = 0, len = slides.length; i < len; i++) {
1428          var style = slides[i].style;
1429          var direction = Components.Direction.value;
1430
1431          if (i !== 0) {
1432            style[MARGIN_TYPE[direction][0]] = "".concat(this.value / 2, "px");
1433          } else {
1434            style[MARGIN_TYPE[direction][0]] = '';
1435          }
1436
1437          if (i !== slides.length - 1) {
1438            style[MARGIN_TYPE[direction][1]] = "".concat(this.value / 2, "px");
1439          } else {
1440            style[MARGIN_TYPE[direction][1]] = '';
1441          }
1442        }
1443      },
1444
1445      /**
1446       * Removes gaps from the slides.
1447       *
1448       * @param {HTMLCollection} slides
1449       * @returns {Void}
1450      */
1451      remove: function remove(slides) {
1452        for (var i = 0, len = slides.length; i < len; i++) {
1453          var style = slides[i].style;
1454          style.marginLeft = '';
1455          style.marginRight = '';
1456        }
1457      }
1458    };
1459    define(Gaps, 'value', {
1460      /**
1461       * Gets value of the gap.
1462       *
1463       * @returns {Number}
1464       */
1465      get: function get() {
1466        return toInt(Glide.settings.gap);
1467      }
1468    });
1469    define(Gaps, 'grow', {
1470      /**
1471       * Gets additional dimensions value caused by gaps.
1472       * Used to increase width of the slides wrapper.
1473       *
1474       * @returns {Number}
1475       */
1476      get: function get() {
1477        return Gaps.value * Components.Sizes.length;
1478      }
1479    });
1480    define(Gaps, 'reductor', {
1481      /**
1482       * Gets reduction value caused by gaps.
1483       * Used to subtract width of the slides.
1484       *
1485       * @returns {Number}
1486       */
1487      get: function get() {
1488        var perView = Glide.settings.perView;
1489        return Gaps.value * (perView - 1) / perView;
1490      }
1491    });
1492    /**
1493     * Apply calculated gaps:
1494     * - after building, so slides (including clones) will receive proper margins
1495     * - on updating via API, to recalculate gaps with new options
1496     */
1497
1498    Events.on(['build.after', 'update'], throttle(function () {
1499      Gaps.apply(Components.Html.wrapper.children);
1500    }, 30));
1501    /**
1502     * Remove gaps:
1503     * - on destroying to bring markup to its inital state
1504     */
1505
1506    Events.on('destroy', function () {
1507      Gaps.remove(Components.Html.wrapper.children);
1508    });
1509    return Gaps;
1510  }
1511
1512  /**
1513   * Finds siblings nodes of the passed node.
1514   *
1515   * @param  {Element} node
1516   * @return {Array}
1517   */
1518  function siblings(node) {
1519    if (node && node.parentNode) {
1520      var n = node.parentNode.firstChild;
1521      var matched = [];
1522
1523      for (; n; n = n.nextSibling) {
1524        if (n.nodeType === 1 && n !== node) {
1525          matched.push(n);
1526        }
1527      }
1528
1529      return matched;
1530    }
1531
1532    return [];
1533  }
1534  /**
1535   * Coerces a NodeList to an Array.
1536   *
1537   * @param  {NodeList} nodeList
1538   * @return {Array}
1539   */
1540
1541  function toArray(nodeList) {
1542    return Array.prototype.slice.call(nodeList);
1543  }
1544
1545  var TRACK_SELECTOR = '[data-glide-el="track"]';
1546  function Html (Glide, Components, Events) {
1547    var Html = {
1548      /**
1549       * Setup slider HTML nodes.
1550       *
1551       * @param {Glide} glide
1552       */
1553      mount: function mount() {
1554        this.root = Glide.selector;
1555        this.track = this.root.querySelector(TRACK_SELECTOR);
1556        this.collectSlides();
1557      },
1558
1559      /**
1560       * Collect slides
1561       */
1562      collectSlides: function collectSlides() {
1563        this.slides = toArray(this.wrapper.children).filter(function (slide) {
1564          return !slide.classList.contains(Glide.settings.classes.slide.clone);
1565        });
1566      }
1567    };
1568    define(Html, 'root', {
1569      /**
1570       * Gets node of the glide main element.
1571       *
1572       * @return {Object}
1573       */
1574      get: function get() {
1575        return Html._r;
1576      },
1577
1578      /**
1579       * Sets node of the glide main element.
1580       *
1581       * @return {Object}
1582       */
1583      set: function set(r) {
1584        if (isString(r)) {
1585          r = document.querySelector(r);
1586        }
1587
1588        if (r !== null) {
1589          Html._r = r;
1590        } else {
1591          warn('Root element must be a existing Html node');
1592        }
1593      }
1594    });
1595    define(Html, 'track', {
1596      /**
1597       * Gets node of the glide track with slides.
1598       *
1599       * @return {Object}
1600       */
1601      get: function get() {
1602        return Html._t;
1603      },
1604
1605      /**
1606       * Sets node of the glide track with slides.
1607       *
1608       * @return {Object}
1609       */
1610      set: function set(t) {
1611        Html._t = t;
1612      }
1613    });
1614    define(Html, 'wrapper', {
1615      /**
1616       * Gets node of the slides wrapper.
1617       *
1618       * @return {Object}
1619       */
1620      get: function get() {
1621        return Html.track.children[0];
1622      }
1623    });
1624    /**
1625     * Add/remove/reorder dynamic slides
1626     */
1627
1628    Events.on('update', function () {
1629      Html.collectSlides();
1630    });
1631    return Html;
1632  }
1633
1634  function Peek (Glide, Components, Events) {
1635    var Peek = {
1636      /**
1637       * Setups how much to peek based on settings.
1638       *
1639       * @return {Void}
1640       */
1641      mount: function mount() {
1642        this.value = Glide.settings.peek;
1643      }
1644    };
1645    define(Peek, 'value', {
1646      /**
1647       * Gets value of the peek.
1648       *
1649       * @returns {Number|Object}
1650       */
1651      get: function get() {
1652        return Peek._v;
1653      },
1654
1655      /**
1656       * Sets value of the peek.
1657       *
1658       * @param {Number|Object} value
1659       * @return {Void}
1660       */
1661      set: function set(value) {
1662        if (isObject(value)) {
1663          value.before = toInt(value.before);
1664          value.after = toInt(value.after);
1665        } else {
1666          value = toInt(value);
1667        }
1668
1669        Peek._v = value;
1670      }
1671    });
1672    define(Peek, 'reductor', {
1673      /**
1674       * Gets reduction value caused by peek.
1675       *
1676       * @returns {Number}
1677       */
1678      get: function get() {
1679        var value = Peek.value;
1680        var perView = Glide.settings.perView;
1681
1682        if (isObject(value)) {
1683          return value.before / perView + value.after / perView;
1684        }
1685
1686        return value * 2 / perView;
1687      }
1688    });
1689    /**
1690     * Recalculate peeking sizes on:
1691     * - when resizing window to update to proper percents
1692     */
1693
1694    Events.on(['resize', 'update'], function () {
1695      Peek.mount();
1696    });
1697    return Peek;
1698  }
1699
1700  function Move (Glide, Components, Events) {
1701    var Move = {
1702      /**
1703       * Constructs move component.
1704       *
1705       * @returns {Void}
1706       */
1707      mount: function mount() {
1708        this._o = 0;
1709      },
1710
1711      /**
1712       * Calculates a movement value based on passed offset and currently active index.
1713       *
1714       * @param  {Number} offset
1715       * @return {Void}
1716       */
1717      make: function make() {
1718        var _this = this;
1719
1720        var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1721        this.offset = offset;
1722        Events.emit('move', {
1723          movement: this.value
1724        });
1725        Components.Transition.after(function () {
1726          Events.emit('move.after', {
1727            movement: _this.value
1728          });
1729        });
1730      }
1731    };
1732    define(Move, 'offset', {
1733      /**
1734       * Gets an offset value used to modify current translate.
1735       *
1736       * @return {Object}
1737       */
1738      get: function get() {
1739        return Move._o;
1740      },
1741
1742      /**
1743       * Sets an offset value used to modify current translate.
1744       *
1745       * @return {Object}
1746       */
1747      set: function set(value) {
1748        Move._o = !isUndefined(value) ? toInt(value) : 0;
1749      }
1750    });
1751    define(Move, 'translate', {
1752      /**
1753       * Gets a raw movement value.
1754       *
1755       * @return {Number}
1756       */
1757      get: function get() {
1758        return Components.Sizes.slideWidth * Glide.index;
1759      }
1760    });
1761    define(Move, 'value', {
1762      /**
1763       * Gets an actual movement value corrected by offset.
1764       *
1765       * @return {Number}
1766       */
1767      get: function get() {
1768        var offset = this.offset;
1769        var translate = this.translate;
1770
1771        if (Components.Direction.is('rtl')) {
1772          return translate + offset;
1773        }
1774
1775        return translate - offset;
1776      }
1777    });
1778    /**
1779     * Make movement to proper slide on:
1780     * - before build, so glide will start at `startAt` index
1781     * - on each standard run to move to newly calculated index
1782     */
1783
1784    Events.on(['build.before', 'run'], function () {
1785      Move.make();
1786    });
1787    return Move;
1788  }
1789
1790  function Sizes (Glide, Components, Events) {
1791    var Sizes = {
1792      /**
1793       * Setups dimensions of slides.
1794       *
1795       * @return {Void}
1796       */
1797      setupSlides: function setupSlides() {
1798        var width = "".concat(this.slideWidth, "px");
1799        var slides = Components.Html.slides;
1800
1801        for (var i = 0; i < slides.length; i++) {
1802          slides[i].style.width = width;
1803        }
1804      },
1805
1806      /**
1807       * Setups dimensions of slides wrapper.
1808       *
1809       * @return {Void}
1810       */
1811      setupWrapper: function setupWrapper() {
1812        Components.Html.wrapper.style.width = "".concat(this.wrapperSize, "px");
1813      },
1814
1815      /**
1816       * Removes applied styles from HTML elements.
1817       *
1818       * @returns {Void}
1819       */
1820      remove: function remove() {
1821        var slides = Components.Html.slides;
1822
1823        for (var i = 0; i < slides.length; i++) {
1824          slides[i].style.width = '';
1825        }
1826
1827        Components.Html.wrapper.style.width = '';
1828      }
1829    };
1830    define(Sizes, 'length', {
1831      /**
1832       * Gets count number of the slides.
1833       *
1834       * @return {Number}
1835       */
1836      get: function get() {
1837        return Components.Html.slides.length;
1838      }
1839    });
1840    define(Sizes, 'width', {
1841      /**
1842       * Gets width value of the slider (visible area).
1843       *
1844       * @return {Number}
1845       */
1846      get: function get() {
1847        return Components.Html.track.offsetWidth;
1848      }
1849    });
1850    define(Sizes, 'wrapperSize', {
1851      /**
1852       * Gets size of the slides wrapper.
1853       *
1854       * @return {Number}
1855       */
1856      get: function get() {
1857        return Sizes.slideWidth * Sizes.length + Components.Gaps.grow + Components.Clones.grow;
1858      }
1859    });
1860    define(Sizes, 'slideWidth', {
1861      /**
1862       * Gets width value of a single slide.
1863       *
1864       * @return {Number}
1865       */
1866      get: function get() {
1867        return Sizes.width / Glide.settings.perView - Components.Peek.reductor - Components.Gaps.reductor;
1868      }
1869    });
1870    /**
1871     * Apply calculated glide's dimensions:
1872     * - before building, so other dimensions (e.g. translate) will be calculated propertly
1873     * - when resizing window to recalculate sildes dimensions
1874     * - on updating via API, to calculate dimensions based on new options
1875     */
1876
1877    Events.on(['build.before', 'resize', 'update'], function () {
1878      Sizes.setupSlides();
1879      Sizes.setupWrapper();
1880    });
1881    /**
1882     * Remove calculated glide's dimensions:
1883     * - on destoting to bring markup to its inital state
1884     */
1885
1886    Events.on('destroy', function () {
1887      Sizes.remove();
1888    });
1889    return Sizes;
1890  }
1891
1892  function Build (Glide, Components, Events) {
1893    var Build = {
1894      /**
1895       * Init glide building. Adds classes, sets
1896       * dimensions and setups initial state.
1897       *
1898       * @return {Void}
1899       */
1900      mount: function mount() {
1901        Events.emit('build.before');
1902        this.typeClass();
1903        this.activeClass();
1904        Events.emit('build.after');
1905      },
1906
1907      /**
1908       * Adds `type` class to the glide element.
1909       *
1910       * @return {Void}
1911       */
1912      typeClass: function typeClass() {
1913        Components.Html.root.classList.add(Glide.settings.classes.type[Glide.settings.type]);
1914      },
1915
1916      /**
1917       * Sets active class to current slide.
1918       *
1919       * @return {Void}
1920       */
1921      activeClass: function activeClass() {
1922        var classes = Glide.settings.classes;
1923        var slide = Components.Html.slides[Glide.index];
1924
1925        if (slide) {
1926          slide.classList.add(classes.slide.active);
1927          siblings(slide).forEach(function (sibling) {
1928            sibling.classList.remove(classes.slide.active);
1929          });
1930        }
1931      },
1932
1933      /**
1934       * Removes HTML classes applied at building.
1935       *
1936       * @return {Void}
1937       */
1938      removeClasses: function removeClasses() {
1939        var _Glide$settings$class = Glide.settings.classes,
1940            type = _Glide$settings$class.type,
1941            slide = _Glide$settings$class.slide;
1942        Components.Html.root.classList.remove(type[Glide.settings.type]);
1943        Components.Html.slides.forEach(function (sibling) {
1944          sibling.classList.remove(slide.active);
1945        });
1946      }
1947    };
1948    /**
1949     * Clear building classes:
1950     * - on destroying to bring HTML to its initial state
1951     * - on updating to remove classes before remounting component
1952     */
1953
1954    Events.on(['destroy', 'update'], function () {
1955      Build.removeClasses();
1956    });
1957    /**
1958     * Remount component:
1959     * - on resizing of the window to calculate new dimensions
1960     * - on updating settings via API
1961     */
1962
1963    Events.on(['resize', 'update'], function () {
1964      Build.mount();
1965    });
1966    /**
1967     * Swap active class of current slide:
1968     * - after each move to the new index
1969     */
1970
1971    Events.on('move.after', function () {
1972      Build.activeClass();
1973    });
1974    return Build;
1975  }
1976
1977  function Clones (Glide, Components, Events) {
1978    var Clones = {
1979      /**
1980       * Create pattern map and collect slides to be cloned.
1981       */
1982      mount: function mount() {
1983        this.items = [];
1984
1985        if (Glide.isType('carousel')) {
1986          this.items = this.collect();
1987        }
1988      },
1989
1990      /**
1991       * Collect clones with pattern.
1992       *
1993       * @return {[]}
1994       */
1995      collect: function collect() {
1996        var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1997        var slides = Components.Html.slides;
1998        var _Glide$settings = Glide.settings,
1999            perView = _Glide$settings.perView,
2000            classes = _Glide$settings.classes,
2001            cloningRatio = _Glide$settings.cloningRatio;
2002
2003        if (slides.length > 0) {
2004          var peekIncrementer = +!!Glide.settings.peek;
2005          var cloneCount = perView + peekIncrementer + Math.round(perView / 2);
2006          var append = slides.slice(0, cloneCount).reverse();
2007          var prepend = slides.slice(cloneCount * -1);
2008
2009          for (var r = 0; r < Math.max(cloningRatio, Math.floor(perView / slides.length)); r++) {
2010            for (var i = 0; i < append.length; i++) {
2011              var clone = append[i].cloneNode(true);
2012              clone.classList.add(classes.slide.clone);
2013              items.push(clone);
2014            }
2015
2016            for (var _i = 0; _i < prepend.length; _i++) {
2017              var _clone = prepend[_i].cloneNode(true);
2018
2019              _clone.classList.add(classes.slide.clone);
2020
2021              items.unshift(_clone);
2022            }
2023          }
2024        }
2025
2026        return items;
2027      },
2028
2029      /**
2030       * Append cloned slides with generated pattern.
2031       *
2032       * @return {Void}
2033       */
2034      append: function append() {
2035        var items = this.items;
2036        var _Components$Html = Components.Html,
2037            wrapper = _Components$Html.wrapper,
2038            slides = _Components$Html.slides;
2039        var half = Math.floor(items.length / 2);
2040        var prepend = items.slice(0, half).reverse();
2041        var append = items.slice(half * -1).reverse();
2042        var width = "".concat(Components.Sizes.slideWidth, "px");
2043
2044        for (var i = 0; i < append.length; i++) {
2045          wrapper.appendChild(append[i]);
2046        }
2047
2048        for (var _i2 = 0; _i2 < prepend.length; _i2++) {
2049          wrapper.insertBefore(prepend[_i2], slides[0]);
2050        }
2051
2052        for (var _i3 = 0; _i3 < items.length; _i3++) {
2053          items[_i3].style.width = width;
2054        }
2055      },
2056
2057      /**
2058       * Remove all cloned slides.
2059       *
2060       * @return {Void}
2061       */
2062      remove: function remove() {
2063        var items = this.items;
2064
2065        for (var i = 0; i < items.length; i++) {
2066          Components.Html.wrapper.removeChild(items[i]);
2067        }
2068      }
2069    };
2070    define(Clones, 'grow', {
2071      /**
2072       * Gets additional dimensions value caused by clones.
2073       *
2074       * @return {Number}
2075       */
2076      get: function get() {
2077        return (Components.Sizes.slideWidth + Components.Gaps.value) * Clones.items.length;
2078      }
2079    });
2080    /**
2081     * Append additional slide's clones:
2082     * - while glide's type is `carousel`
2083     */
2084
2085    Events.on('update', function () {
2086      Clones.remove();
2087      Clones.mount();
2088      Clones.append();
2089    });
2090    /**
2091     * Append additional slide's clones:
2092     * - while glide's type is `carousel`
2093     */
2094
2095    Events.on('build.before', function () {
2096      if (Glide.isType('carousel')) {
2097        Clones.append();
2098      }
2099    });
2100    /**
2101     * Remove clones HTMLElements:
2102     * - on destroying, to bring HTML to its initial state
2103     */
2104
2105    Events.on('destroy', function () {
2106      Clones.remove();
2107    });
2108    return Clones;
2109  }
2110
2111  var EventsBinder = /*#__PURE__*/function () {
2112    /**
2113     * Construct a EventsBinder instance.
2114     */
2115    function EventsBinder() {
2116      var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2117
2118      _classCallCheck(this, EventsBinder);
2119
2120      this.listeners = listeners;
2121    }
2122    /**
2123     * Adds events listeners to arrows HTML elements.
2124     *
2125     * @param  {String|Array} events
2126     * @param  {Element|Window|Document} el
2127     * @param  {Function} closure
2128     * @param  {Boolean|Object} capture
2129     * @return {Void}
2130     */
2131
2132
2133    _createClass(EventsBinder, [{
2134      key: "on",
2135      value: function on(events, el, closure) {
2136        var capture = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2137
2138        if (isString(events)) {
2139          events = [events];
2140        }
2141
2142        for (var i = 0; i < events.length; i++) {
2143          this.listeners[events[i]] = closure;
2144          el.addEventListener(events[i], this.listeners[events[i]], capture);
2145        }
2146      }
2147      /**
2148       * Removes event listeners from arrows HTML elements.
2149       *
2150       * @param  {String|Array} events
2151       * @param  {Element|Window|Document} el
2152       * @param  {Boolean|Object} capture
2153       * @return {Void}
2154       */
2155
2156    }, {
2157      key: "off",
2158      value: function off(events, el) {
2159        var capture = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2160
2161        if (isString(events)) {
2162          events = [events];
2163        }
2164
2165        for (var i = 0; i < events.length; i++) {
2166          el.removeEventListener(events[i], this.listeners[events[i]], capture);
2167        }
2168      }
2169      /**
2170       * Destroy collected listeners.
2171       *
2172       * @returns {Void}
2173       */
2174
2175    }, {
2176      key: "destroy",
2177      value: function destroy() {
2178        delete this.listeners;
2179      }
2180    }]);
2181
2182    return EventsBinder;
2183  }();
2184
2185  function Resize (Glide, Components, Events) {
2186    /**
2187     * Instance of the binder for DOM Events.
2188     *
2189     * @type {EventsBinder}
2190     */
2191    var Binder = new EventsBinder();
2192    var Resize = {
2193      /**
2194       * Initializes window bindings.
2195       */
2196      mount: function mount() {
2197        this.bind();
2198      },
2199
2200      /**
2201       * Binds `rezsize` listener to the window.
2202       * It's a costly event, so we are debouncing it.
2203       *
2204       * @return {Void}
2205       */
2206      bind: function bind() {
2207        Binder.on('resize', window, throttle(function () {
2208          Events.emit('resize');
2209        }, Glide.settings.throttle));
2210      },
2211
2212      /**
2213       * Unbinds listeners from the window.
2214       *
2215       * @return {Void}
2216       */
2217      unbind: function unbind() {
2218        Binder.off('resize', window);
2219      }
2220    };
2221    /**
2222     * Remove bindings from window:
2223     * - on destroying, to remove added EventListener
2224     */
2225
2226    Events.on('destroy', function () {
2227      Resize.unbind();
2228      Binder.destroy();
2229    });
2230    return Resize;
2231  }
2232
2233  var VALID_DIRECTIONS = ['ltr', 'rtl'];
2234  var FLIPED_MOVEMENTS = {
2235    '>': '<',
2236    '<': '>',
2237    '=': '='
2238  };
2239  function Direction (Glide, Components, Events) {
2240    var Direction = {
2241      /**
2242       * Setups gap value based on settings.
2243       *
2244       * @return {Void}
2245       */
2246      mount: function mount() {
2247        this.value = Glide.settings.direction;
2248      },
2249
2250      /**
2251       * Resolves pattern based on direction value
2252       *
2253       * @param {String} pattern
2254       * @returns {String}
2255       */
2256      resolve: function resolve(pattern) {
2257        var token = pattern.slice(0, 1);
2258
2259        if (this.is('rtl')) {
2260          return pattern.split(token).join(FLIPED_MOVEMENTS[token]);
2261        }
2262
2263        return pattern;
2264      },
2265
2266      /**
2267       * Checks value of direction mode.
2268       *
2269       * @param {String} direction
2270       * @returns {Boolean}
2271       */
2272      is: function is(direction) {
2273        return this.value === direction;
2274      },
2275
2276      /**
2277       * Applies direction class to the root HTML element.
2278       *
2279       * @return {Void}
2280       */
2281      addClass: function addClass() {
2282        Components.Html.root.classList.add(Glide.settings.classes.direction[this.value]);
2283      },
2284
2285      /**
2286       * Removes direction class from the root HTML element.
2287       *
2288       * @return {Void}
2289       */
2290      removeClass: function removeClass() {
2291        Components.Html.root.classList.remove(Glide.settings.classes.direction[this.value]);
2292      }
2293    };
2294    define(Direction, 'value', {
2295      /**
2296       * Gets value of the direction.
2297       *
2298       * @returns {Number}
2299       */
2300      get: function get() {
2301        return Direction._v;
2302      },
2303
2304      /**
2305       * Sets value of the direction.
2306       *
2307       * @param {String} value
2308       * @return {Void}
2309       */
2310      set: function set(value) {
2311        if (VALID_DIRECTIONS.indexOf(value) > -1) {
2312          Direction._v = value;
2313        } else {
2314          warn('Direction value must be `ltr` or `rtl`');
2315        }
2316      }
2317    });
2318    /**
2319     * Clear direction class:
2320     * - on destroy to bring HTML to its initial state
2321     * - on update to remove class before reappling bellow
2322     */
2323
2324    Events.on(['destroy', 'update'], function () {
2325      Direction.removeClass();
2326    });
2327    /**
2328     * Remount component:
2329     * - on update to reflect changes in direction value
2330     */
2331
2332    Events.on('update', function () {
2333      Direction.mount();
2334    });
2335    /**
2336     * Apply direction class:
2337     * - before building to apply class for the first time
2338     * - on updating to reapply direction class that may changed
2339     */
2340
2341    Events.on(['build.before', 'update'], function () {
2342      Direction.addClass();
2343    });
2344    return Direction;
2345  }
2346
2347  /**
2348   * Reflects value of glide movement.
2349   *
2350   * @param  {Object} Glide
2351   * @param  {Object} Components
2352   * @return {Object}
2353   */
2354  function Rtl (Glide, Components) {
2355    return {
2356      /**
2357       * Negates the passed translate if glide is in RTL option.
2358       *
2359       * @param  {Number} translate
2360       * @return {Number}
2361       */
2362      modify: function modify(translate) {
2363        if (Components.Direction.is('rtl')) {
2364          return -translate;
2365        }
2366
2367        return translate;
2368      }
2369    };
2370  }
2371
2372  /**
2373   * Updates glide movement with a `gap` settings.
2374   *
2375   * @param  {Object} Glide
2376   * @param  {Object} Components
2377   * @return {Object}
2378   */
2379  function Gap (Glide, Components) {
2380    return {
2381      /**
2382       * Modifies passed translate value with number in the `gap` settings.
2383       *
2384       * @param  {Number} translate
2385       * @return {Number}
2386       */
2387      modify: function modify(translate) {
2388        var multiplier = Math.floor(translate / Components.Sizes.slideWidth);
2389        return translate + Components.Gaps.value * multiplier;
2390      }
2391    };
2392  }
2393
2394  /**
2395   * Updates glide movement with width of additional clones width.
2396   *
2397   * @param  {Object} Glide
2398   * @param  {Object} Components
2399   * @return {Object}
2400   */
2401  function Grow (Glide, Components) {
2402    return {
2403      /**
2404       * Adds to the passed translate width of the half of clones.
2405       *
2406       * @param  {Number} translate
2407       * @return {Number}
2408       */
2409      modify: function modify(translate) {
2410        return translate + Components.Clones.grow / 2;
2411      }
2412    };
2413  }
2414
2415  /**
2416   * Updates glide movement with a `peek` settings.
2417   *
2418   * @param  {Object} Glide
2419   * @param  {Object} Components
2420   * @return {Object}
2421   */
2422
2423  function Peeking (Glide, Components) {
2424    return {
2425      /**
2426       * Modifies passed translate value with a `peek` setting.
2427       *
2428       * @param  {Number} translate
2429       * @return {Number}
2430       */
2431      modify: function modify(translate) {
2432        if (Glide.settings.focusAt >= 0) {
2433          var peek = Components.Peek.value;
2434
2435          if (isObject(peek)) {
2436            return translate - peek.before;
2437          }
2438
2439          return translate - peek;
2440        }
2441
2442        return translate;
2443      }
2444    };
2445  }
2446
2447  /**
2448   * Updates glide movement with a `focusAt` settings.
2449   *
2450   * @param  {Object} Glide
2451   * @param  {Object} Components
2452   * @return {Object}
2453   */
2454  function Focusing (Glide, Components) {
2455    return {
2456      /**
2457       * Modifies passed translate value with index in the `focusAt` setting.
2458       *
2459       * @param  {Number} translate
2460       * @return {Number}
2461       */
2462      modify: function modify(translate) {
2463        var gap = Components.Gaps.value;
2464        var width = Components.Sizes.width;
2465        var focusAt = Glide.settings.focusAt;
2466        var slideWidth = Components.Sizes.slideWidth;
2467
2468        if (focusAt === 'center') {
2469          return translate - (width / 2 - slideWidth / 2);
2470        }
2471
2472        return translate - slideWidth * focusAt - gap * focusAt;
2473      }
2474    };
2475  }
2476
2477  /**
2478   * Applies diffrent transformers on translate value.
2479   *
2480   * @param  {Object} Glide
2481   * @param  {Object} Components
2482   * @return {Object}
2483   */
2484
2485  function mutator (Glide, Components, Events) {
2486    /**
2487     * Merge instance transformers with collection of default transformers.
2488     * It's important that the Rtl component be last on the list,
2489     * so it reflects all previous transformations.
2490     *
2491     * @type {Array}
2492     */
2493    var TRANSFORMERS = [Gap, Grow, Peeking, Focusing].concat(Glide._t, [Rtl]);
2494    return {
2495      /**
2496       * Piplines translate value with registered transformers.
2497       *
2498       * @param  {Number} translate
2499       * @return {Number}
2500       */
2501      mutate: function mutate(translate) {
2502        for (var i = 0; i < TRANSFORMERS.length; i++) {
2503          var transformer = TRANSFORMERS[i];
2504
2505          if (isFunction(transformer) && isFunction(transformer().modify)) {
2506            translate = transformer(Glide, Components, Events).modify(translate);
2507          } else {
2508            warn('Transformer should be a function that returns an object with `modify()` method');
2509          }
2510        }
2511
2512        return translate;
2513      }
2514    };
2515  }
2516
2517  function Translate (Glide, Components, Events) {
2518    var Translate = {
2519      /**
2520       * Sets value of translate on HTML element.
2521       *
2522       * @param {Number} value
2523       * @return {Void}
2524       */
2525      set: function set(value) {
2526        var transform = mutator(Glide, Components).mutate(value);
2527        var translate3d = "translate3d(".concat(-1 * transform, "px, 0px, 0px)");
2528        Components.Html.wrapper.style.mozTransform = translate3d; // needed for supported Firefox 10-15
2529
2530        Components.Html.wrapper.style.webkitTransform = translate3d; // needed for supported Chrome 10-35, Safari 5.1-8, and Opera 15-22
2531
2532        Components.Html.wrapper.style.transform = translate3d;
2533      },
2534
2535      /**
2536       * Removes value of translate from HTML element.
2537       *
2538       * @return {Void}
2539       */
2540      remove: function remove() {
2541        Components.Html.wrapper.style.transform = '';
2542      },
2543
2544      /**
2545       * @return {number}
2546       */
2547      getStartIndex: function getStartIndex() {
2548        var length = Components.Sizes.length;
2549        var index = Glide.index;
2550        var perView = Glide.settings.perView;
2551
2552        if (Components.Run.isOffset('>') || Components.Run.isOffset('|>')) {
2553          return length + (index - perView);
2554        } // "modulo length" converts an index that equals length to zero
2555
2556
2557        return (index + perView) % length;
2558      },
2559
2560      /**
2561       * @return {number}
2562       */
2563      getTravelDistance: function getTravelDistance() {
2564        var travelDistance = Components.Sizes.slideWidth * Glide.settings.perView;
2565
2566        if (Components.Run.isOffset('>') || Components.Run.isOffset('|>')) {
2567          // reverse travel distance so that we don't have to change subtract operations
2568          return travelDistance * -1;
2569        }
2570
2571        return travelDistance;
2572      }
2573    };
2574    /**
2575     * Set new translate value:
2576     * - on move to reflect index change
2577     * - on updating via API to reflect possible changes in options
2578     */
2579
2580    Events.on('move', function (context) {
2581      if (!Glide.isType('carousel') || !Components.Run.isOffset()) {
2582        return Translate.set(context.movement);
2583      }
2584
2585      Components.Transition.after(function () {
2586        Events.emit('translate.jump');
2587        Translate.set(Components.Sizes.slideWidth * Glide.index);
2588      });
2589      var startWidth = Components.Sizes.slideWidth * Components.Translate.getStartIndex();
2590      return Translate.set(startWidth - Components.Translate.getTravelDistance());
2591    });
2592    /**
2593     * Remove translate:
2594     * - on destroying to bring markup to its inital state
2595     */
2596
2597    Events.on('destroy', function () {
2598      Translate.remove();
2599    });
2600    return Translate;
2601  }
2602
2603  function Transition (Glide, Components, Events) {
2604    /**
2605     * Holds inactivity status of transition.
2606     * When true transition is not applied.
2607     *
2608     * @type {Boolean}
2609     */
2610    var disabled = false;
2611    var Transition = {
2612      /**
2613       * Composes string of the CSS transition.
2614       *
2615       * @param {String} property
2616       * @return {String}
2617       */
2618      compose: function compose(property) {
2619        var settings = Glide.settings;
2620
2621        if (disabled) {
2622          return "".concat(property, " 0ms ").concat(settings.animationTimingFunc);
2623        }
2624
2625        return "".concat(property, " ").concat(this.duration, "ms ").concat(settings.animationTimingFunc);
2626      },
2627
2628      /**
2629       * Sets value of transition on HTML element.
2630       *
2631       * @param {String=} property
2632       * @return {Void}
2633       */
2634      set: function set() {
2635        var property = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
2636        Components.Html.wrapper.style.transition = this.compose(property);
2637      },
2638
2639      /**
2640       * Removes value of transition from HTML element.
2641       *
2642       * @return {Void}
2643       */
2644      remove: function remove() {
2645        Components.Html.wrapper.style.transition = '';
2646      },
2647
2648      /**
2649       * Runs callback after animation.
2650       *
2651       * @param  {Function} callback
2652       * @return {Void}
2653       */
2654      after: function after(callback) {
2655        setTimeout(function () {
2656          callback();
2657        }, this.duration);
2658      },
2659
2660      /**
2661       * Enable transition.
2662       *
2663       * @return {Void}
2664       */
2665      enable: function enable() {
2666        disabled = false;
2667        this.set();
2668      },
2669
2670      /**
2671       * Disable transition.
2672       *
2673       * @return {Void}
2674       */
2675      disable: function disable() {
2676        disabled = true;
2677        this.set();
2678      }
2679    };
2680    define(Transition, 'duration', {
2681      /**
2682       * Gets duration of the transition based
2683       * on currently running animation type.
2684       *
2685       * @return {Number}
2686       */
2687      get: function get() {
2688        var settings = Glide.settings;
2689
2690        if (Glide.isType('slider') && Components.Run.offset) {
2691          return settings.rewindDuration;
2692        }
2693
2694        return settings.animationDuration;
2695      }
2696    });
2697    /**
2698     * Set transition `style` value:
2699     * - on each moving, because it may be cleared by offset move
2700     */
2701
2702    Events.on('move', function () {
2703      Transition.set();
2704    });
2705    /**
2706     * Disable transition:
2707     * - before initial build to avoid transitioning from `0` to `startAt` index
2708     * - while resizing window and recalculating dimensions
2709     * - on jumping from offset transition at start and end edges in `carousel` type
2710     */
2711
2712    Events.on(['build.before', 'resize', 'translate.jump'], function () {
2713      Transition.disable();
2714    });
2715    /**
2716     * Enable transition:
2717     * - on each running, because it may be disabled by offset move
2718     */
2719
2720    Events.on('run', function () {
2721      Transition.enable();
2722    });
2723    /**
2724     * Remove transition:
2725     * - on destroying to bring markup to its inital state
2726     */
2727
2728    Events.on('destroy', function () {
2729      Transition.remove();
2730    });
2731    return Transition;
2732  }
2733
2734  /**
2735   * Test via a getter in the options object to see
2736   * if the passive property is accessed.
2737   *
2738   * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection
2739   */
2740  var supportsPassive = false;
2741
2742  try {
2743    var opts = Object.defineProperty({}, 'passive', {
2744      get: function get() {
2745        supportsPassive = true;
2746      }
2747    });
2748    window.addEventListener('testPassive', null, opts);
2749    window.removeEventListener('testPassive', null, opts);
2750  } catch (e) {}
2751
2752  var supportsPassive$1 = supportsPassive;
2753
2754  var START_EVENTS = ['touchstart', 'mousedown'];
2755  var MOVE_EVENTS = ['touchmove', 'mousemove'];
2756  var END_EVENTS = ['touchend', 'touchcancel', 'mouseup', 'mouseleave'];
2757  var MOUSE_EVENTS = ['mousedown', 'mousemove', 'mouseup', 'mouseleave'];
2758  function Swipe (Glide, Components, Events) {
2759    /**
2760     * Instance of the binder for DOM Events.
2761     *
2762     * @type {EventsBinder}
2763     */
2764    var Binder = new EventsBinder();
2765    var swipeSin = 0;
2766    var swipeStartX = 0;
2767    var swipeStartY = 0;
2768    var disabled = false;
2769    var capture = supportsPassive$1 ? {
2770      passive: true
2771    } : false;
2772    var Swipe = {
2773      /**
2774       * Initializes swipe bindings.
2775       *
2776       * @return {Void}
2777       */
2778      mount: function mount() {
2779        this.bindSwipeStart();
2780      },
2781
2782      /**
2783       * Handler for `swipestart` event. Calculates entry points of the user's tap.
2784       *
2785       * @param {Object} event
2786       * @return {Void}
2787       */
2788      start: function start(event) {
2789        if (!disabled && !Glide.disabled) {
2790          this.disable();
2791          var swipe = this.touches(event);
2792          swipeSin = null;
2793          swipeStartX = toInt(swipe.pageX);
2794          swipeStartY = toInt(swipe.pageY);
2795          this.bindSwipeMove();
2796          this.bindSwipeEnd();
2797          Events.emit('swipe.start');
2798        }
2799      },
2800
2801      /**
2802       * Handler for `swipemove` event. Calculates user's tap angle and distance.
2803       *
2804       * @param {Object} event
2805       */
2806      move: function move(event) {
2807        if (!Glide.disabled) {
2808          var _Glide$settings = Glide.settings,
2809              touchAngle = _Glide$settings.touchAngle,
2810              touchRatio = _Glide$settings.touchRatio,
2811              classes = _Glide$settings.classes;
2812          var swipe = this.touches(event);
2813          var subExSx = toInt(swipe.pageX) - swipeStartX;
2814          var subEySy = toInt(swipe.pageY) - swipeStartY;
2815          var powEX = Math.abs(subExSx << 2);
2816          var powEY = Math.abs(subEySy << 2);
2817          var swipeHypotenuse = Math.sqrt(powEX + powEY);
2818          var swipeCathetus = Math.sqrt(powEY);
2819          swipeSin = Math.asin(swipeCathetus / swipeHypotenuse);
2820
2821          if (swipeSin * 180 / Math.PI < touchAngle) {
2822            event.stopPropagation();
2823            Components.Move.make(subExSx * toFloat(touchRatio));
2824            Components.Html.root.classList.add(classes.dragging);
2825            Events.emit('swipe.move');
2826          } else {
2827            return false;
2828          }
2829        }
2830      },
2831
2832      /**
2833       * Handler for `swipeend` event. Finitializes user's tap and decides about glide move.
2834       *
2835       * @param {Object} event
2836       * @return {Void}
2837       */
2838      end: function end(event) {
2839        if (!Glide.disabled) {
2840          var _Glide$settings2 = Glide.settings,
2841              perSwipe = _Glide$settings2.perSwipe,
2842              touchAngle = _Glide$settings2.touchAngle,
2843              classes = _Glide$settings2.classes;
2844          var swipe = this.touches(event);
2845          var threshold = this.threshold(event);
2846          var swipeDistance = swipe.pageX - swipeStartX;
2847          var swipeDeg = swipeSin * 180 / Math.PI;
2848          this.enable();
2849
2850          if (swipeDistance > threshold && swipeDeg < touchAngle) {
2851            Components.Run.make(Components.Direction.resolve("".concat(perSwipe, "<")));
2852          } else if (swipeDistance < -threshold && swipeDeg < touchAngle) {
2853            Components.Run.make(Components.Direction.resolve("".concat(perSwipe, ">")));
2854          } else {
2855            // While swipe don't reach distance apply previous transform.
2856            Components.Move.make();
2857          }
2858
2859          Components.Html.root.classList.remove(classes.dragging);
2860          this.unbindSwipeMove();
2861          this.unbindSwipeEnd();
2862          Events.emit('swipe.end');
2863        }
2864      },
2865
2866      /**
2867       * Binds swipe's starting event.
2868       *
2869       * @return {Void}
2870       */
2871      bindSwipeStart: function bindSwipeStart() {
2872        var _this = this;
2873
2874        var _Glide$settings3 = Glide.settings,
2875            swipeThreshold = _Glide$settings3.swipeThreshold,
2876            dragThreshold = _Glide$settings3.dragThreshold;
2877
2878        if (swipeThreshold) {
2879          Binder.on(START_EVENTS[0], Components.Html.wrapper, function (event) {
2880            _this.start(event);
2881          }, capture);
2882        }
2883
2884        if (dragThreshold) {
2885          Binder.on(START_EVENTS[1], Components.Html.wrapper, function (event) {
2886            _this.start(event);
2887          }, capture);
2888        }
2889      },
2890
2891      /**
2892       * Unbinds swipe's starting event.
2893       *
2894       * @return {Void}
2895       */
2896      unbindSwipeStart: function unbindSwipeStart() {
2897        Binder.off(START_EVENTS[0], Components.Html.wrapper, capture);
2898        Binder.off(START_EVENTS[1], Components.Html.wrapper, capture);
2899      },
2900
2901      /**
2902       * Binds swipe's moving event.
2903       *
2904       * @return {Void}
2905       */
2906      bindSwipeMove: function bindSwipeMove() {
2907        var _this2 = this;
2908
2909        Binder.on(MOVE_EVENTS, Components.Html.wrapper, throttle(function (event) {
2910          _this2.move(event);
2911        }, Glide.settings.throttle), capture);
2912      },
2913
2914      /**
2915       * Unbinds swipe's moving event.
2916       *
2917       * @return {Void}
2918       */
2919      unbindSwipeMove: function unbindSwipeMove() {
2920        Binder.off(MOVE_EVENTS, Components.Html.wrapper, capture);
2921      },
2922
2923      /**
2924       * Binds swipe's ending event.
2925       *
2926       * @return {Void}
2927       */
2928      bindSwipeEnd: function bindSwipeEnd() {
2929        var _this3 = this;
2930
2931        Binder.on(END_EVENTS, Components.Html.wrapper, function (event) {
2932          _this3.end(event);
2933        });
2934      },
2935
2936      /**
2937       * Unbinds swipe's ending event.
2938       *
2939       * @return {Void}
2940       */
2941      unbindSwipeEnd: function unbindSwipeEnd() {
2942        Binder.off(END_EVENTS, Components.Html.wrapper);
2943      },
2944
2945      /**
2946       * Normalizes event touches points accorting to different types.
2947       *
2948       * @param {Object} event
2949       */
2950      touches: function touches(event) {
2951        if (MOUSE_EVENTS.indexOf(event.type) > -1) {
2952          return event;
2953        }
2954
2955        return event.touches[0] || event.changedTouches[0];
2956      },
2957
2958      /**
2959       * Gets value of minimum swipe distance settings based on event type.
2960       *
2961       * @return {Number}
2962       */
2963      threshold: function threshold(event) {
2964        var settings = Glide.settings;
2965
2966        if (MOUSE_EVENTS.indexOf(event.type) > -1) {
2967          return settings.dragThreshold;
2968        }
2969
2970        return settings.swipeThreshold;
2971      },
2972
2973      /**
2974       * Enables swipe event.
2975       *
2976       * @return {self}
2977       */
2978      enable: function enable() {
2979        disabled = false;
2980        Components.Transition.enable();
2981        return this;
2982      },
2983
2984      /**
2985       * Disables swipe event.
2986       *
2987       * @return {self}
2988       */
2989      disable: function disable() {
2990        disabled = true;
2991        Components.Transition.disable();
2992        return this;
2993      }
2994    };
2995    /**
2996     * Add component class:
2997     * - after initial building
2998     */
2999
3000    Events.on('build.after', function () {
3001      Components.Html.root.classList.add(Glide.settings.classes.swipeable);
3002    });
3003    /**
3004     * Remove swiping bindings:
3005     * - on destroying, to remove added EventListeners
3006     */
3007
3008    Events.on('destroy', function () {
3009      Swipe.unbindSwipeStart();
3010      Swipe.unbindSwipeMove();
3011      Swipe.unbindSwipeEnd();
3012      Binder.destroy();
3013    });
3014    return Swipe;
3015  }
3016
3017  function Images (Glide, Components, Events) {
3018    /**
3019     * Instance of the binder for DOM Events.
3020     *
3021     * @type {EventsBinder}
3022     */
3023    var Binder = new EventsBinder();
3024    var Images = {
3025      /**
3026       * Binds listener to glide wrapper.
3027       *
3028       * @return {Void}
3029       */
3030      mount: function mount() {
3031        this.bind();
3032      },
3033
3034      /**
3035       * Binds `dragstart` event on wrapper to prevent dragging images.
3036       *
3037       * @return {Void}
3038       */
3039      bind: function bind() {
3040        Binder.on('dragstart', Components.Html.wrapper, this.dragstart);
3041      },
3042
3043      /**
3044       * Unbinds `dragstart` event on wrapper.
3045       *
3046       * @return {Void}
3047       */
3048      unbind: function unbind() {
3049        Binder.off('dragstart', Components.Html.wrapper);
3050      },
3051
3052      /**
3053       * Event handler. Prevents dragging.
3054       *
3055       * @return {Void}
3056       */
3057      dragstart: function dragstart(event) {
3058        event.preventDefault();
3059      }
3060    };
3061    /**
3062     * Remove bindings from images:
3063     * - on destroying, to remove added EventListeners
3064     */
3065
3066    Events.on('destroy', function () {
3067      Images.unbind();
3068      Binder.destroy();
3069    });
3070    return Images;
3071  }
3072
3073  function Anchors (Glide, Components, Events) {
3074    /**
3075     * Instance of the binder for DOM Events.
3076     *
3077     * @type {EventsBinder}
3078     */
3079    var Binder = new EventsBinder();
3080    /**
3081     * Holds detaching status of anchors.
3082     * Prevents detaching of already detached anchors.
3083     *
3084     * @private
3085     * @type {Boolean}
3086     */
3087
3088    var detached = false;
3089    /**
3090     * Holds preventing status of anchors.
3091     * If `true` redirection after click will be disabled.
3092     *
3093     * @private
3094     * @type {Boolean}
3095     */
3096
3097    var prevented = false;
3098    var Anchors = {
3099      /**
3100       * Setups a initial state of anchors component.
3101       *
3102       * @returns {Void}
3103       */
3104      mount: function mount() {
3105        /**
3106         * Holds collection of anchors elements.
3107         *
3108         * @private
3109         * @type {HTMLCollection}
3110         */
3111        this._a = Components.Html.wrapper.querySelectorAll('a');
3112        this.bind();
3113      },
3114
3115      /**
3116       * Binds events to anchors inside a track.
3117       *
3118       * @return {Void}
3119       */
3120      bind: function bind() {
3121        Binder.on('click', Components.Html.wrapper, this.click);
3122      },
3123
3124      /**
3125       * Unbinds events attached to anchors inside a track.
3126       *
3127       * @return {Void}
3128       */
3129      unbind: function unbind() {
3130        Binder.off('click', Components.Html.wrapper);
3131      },
3132
3133      /**
3134       * Handler for click event. Prevents clicks when glide is in `prevent` status.
3135       *
3136       * @param  {Object} event
3137       * @return {Void}
3138       */
3139      click: function click(event) {
3140        if (prevented) {
3141          event.stopPropagation();
3142          event.preventDefault();
3143        }
3144      },
3145
3146      /**
3147       * Detaches anchors click event inside glide.
3148       *
3149       * @return {self}
3150       */
3151      detach: function detach() {
3152        prevented = true;
3153
3154        if (!detached) {
3155          for (var i = 0; i < this.items.length; i++) {
3156            this.items[i].draggable = false;
3157          }
3158
3159          detached = true;
3160        }
3161
3162        return this;
3163      },
3164
3165      /**
3166       * Attaches anchors click events inside glide.
3167       *
3168       * @return {self}
3169       */
3170      attach: function attach() {
3171        prevented = false;
3172
3173        if (detached) {
3174          for (var i = 0; i < this.items.length; i++) {
3175            this.items[i].draggable = true;
3176          }
3177
3178          detached = false;
3179        }
3180
3181        return this;
3182      }
3183    };
3184    define(Anchors, 'items', {
3185      /**
3186       * Gets collection of the arrows HTML elements.
3187       *
3188       * @return {HTMLElement[]}
3189       */
3190      get: function get() {
3191        return Anchors._a;
3192      }
3193    });
3194    /**
3195     * Detach anchors inside slides:
3196     * - on swiping, so they won't redirect to its `href` attributes
3197     */
3198
3199    Events.on('swipe.move', function () {
3200      Anchors.detach();
3201    });
3202    /**
3203     * Attach anchors inside slides:
3204     * - after swiping and transitions ends, so they can redirect after click again
3205     */
3206
3207    Events.on('swipe.end', function () {
3208      Components.Transition.after(function () {
3209        Anchors.attach();
3210      });
3211    });
3212    /**
3213     * Unbind anchors inside slides:
3214     * - on destroying, to bring anchors to its initial state
3215     */
3216
3217    Events.on('destroy', function () {
3218      Anchors.attach();
3219      Anchors.unbind();
3220      Binder.destroy();
3221    });
3222    return Anchors;
3223  }
3224
3225  var NAV_SELECTOR = '[data-glide-el="controls[nav]"]';
3226  var CONTROLS_SELECTOR = '[data-glide-el^="controls"]';
3227  var PREVIOUS_CONTROLS_SELECTOR = "".concat(CONTROLS_SELECTOR, " [data-glide-dir*=\"<\"]");
3228  var NEXT_CONTROLS_SELECTOR = "".concat(CONTROLS_SELECTOR, " [data-glide-dir*=\">\"]");
3229  function Controls (Glide, Components, Events) {
3230    /**
3231     * Instance of the binder for DOM Events.
3232     *
3233     * @type {EventsBinder}
3234     */
3235    var Binder = new EventsBinder();
3236    var capture = supportsPassive$1 ? {
3237      passive: true
3238    } : false;
3239    var Controls = {
3240      /**
3241       * Inits arrows. Binds events listeners
3242       * to the arrows HTML elements.
3243       *
3244       * @return {Void}
3245       */
3246      mount: function mount() {
3247        /**
3248         * Collection of navigation HTML elements.
3249         *
3250         * @private
3251         * @type {HTMLCollection}
3252         */
3253        this._n = Components.Html.root.querySelectorAll(NAV_SELECTOR);
3254        /**
3255         * Collection of controls HTML elements.
3256         *
3257         * @private
3258         * @type {HTMLCollection}
3259         */
3260
3261        this._c = Components.Html.root.querySelectorAll(CONTROLS_SELECTOR);
3262        /**
3263         * Collection of arrow control HTML elements.
3264         *
3265         * @private
3266         * @type {Object}
3267         */
3268
3269        this._arrowControls = {
3270          previous: Components.Html.root.querySelectorAll(PREVIOUS_CONTROLS_SELECTOR),
3271          next: Components.Html.root.querySelectorAll(NEXT_CONTROLS_SELECTOR)
3272        };
3273        this.addBindings();
3274      },
3275
3276      /**
3277       * Sets active class to current slide.
3278       *
3279       * @return {Void}
3280       */
3281      setActive: function setActive() {
3282        for (var i = 0; i < this._n.length; i++) {
3283          this.addClass(this._n[i].children);
3284        }
3285      },
3286
3287      /**
3288       * Removes active class to current slide.
3289       *
3290       * @return {Void}
3291       */
3292      removeActive: function removeActive() {
3293        for (var i = 0; i < this._n.length; i++) {
3294          this.removeClass(this._n[i].children);
3295        }
3296      },
3297
3298      /**
3299       * Toggles active class on items inside navigation.
3300       *
3301       * @param  {HTMLElement} controls
3302       * @return {Void}
3303       */
3304      addClass: function addClass(controls) {
3305        var settings = Glide.settings;
3306        var item = controls[Glide.index];
3307
3308        if (!item) {
3309          return;
3310        }
3311
3312        item.classList.add(settings.classes.nav.active);
3313        siblings(item).forEach(function (sibling) {
3314          sibling.classList.remove(settings.classes.nav.active);
3315        });
3316      },
3317
3318      /**
3319       * Removes active class from active control.
3320       *
3321       * @param  {HTMLElement} controls
3322       * @return {Void}
3323       */
3324      removeClass: function removeClass(controls) {
3325        var item = controls[Glide.index];
3326        item === null || item === void 0 ? void 0 : item.classList.remove(Glide.settings.classes.nav.active);
3327      },
3328
3329      /**
3330       * Calculates, removes or adds `Glide.settings.classes.disabledArrow` class on the control arrows
3331       */
3332      setArrowState: function setArrowState() {
3333        if (Glide.settings.rewind) {
3334          return;
3335        }
3336
3337        var next = Controls._arrowControls.next;
3338        var previous = Controls._arrowControls.previous;
3339        this.resetArrowState(next, previous);
3340
3341        if (Glide.index === 0) {
3342          this.disableArrow(previous);
3343        }
3344
3345        if (Glide.index === Components.Run.length) {
3346          this.disableArrow(next);
3347        }
3348      },
3349
3350      /**
3351       * Removes `Glide.settings.classes.disabledArrow` from given NodeList elements
3352       *
3353       * @param {NodeList[]} lists
3354       */
3355      resetArrowState: function resetArrowState() {
3356        var settings = Glide.settings;
3357
3358        for (var _len = arguments.length, lists = new Array(_len), _key = 0; _key < _len; _key++) {
3359          lists[_key] = arguments[_key];
3360        }
3361
3362        lists.forEach(function (list) {
3363          toArray(list).forEach(function (element) {
3364            element.classList.remove(settings.classes.arrow.disabled);
3365          });
3366        });
3367      },
3368
3369      /**
3370       * Adds `Glide.settings.classes.disabledArrow` to given NodeList elements
3371       *
3372       * @param {NodeList[]} lists
3373       */
3374      disableArrow: function disableArrow() {
3375        var settings = Glide.settings;
3376
3377        for (var _len2 = arguments.length, lists = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3378          lists[_key2] = arguments[_key2];
3379        }
3380
3381        lists.forEach(function (list) {
3382          toArray(list).forEach(function (element) {
3383            element.classList.add(settings.classes.arrow.disabled);
3384          });
3385        });
3386      },
3387
3388      /**
3389       * Adds handles to the each group of controls.
3390       *
3391       * @return {Void}
3392       */
3393      addBindings: function addBindings() {
3394        for (var i = 0; i < this._c.length; i++) {
3395          this.bind(this._c[i].children);
3396        }
3397      },
3398
3399      /**
3400       * Removes handles from the each group of controls.
3401       *
3402       * @return {Void}
3403       */
3404      removeBindings: function removeBindings() {
3405        for (var i = 0; i < this._c.length; i++) {
3406          this.unbind(this._c[i].children);
3407        }
3408      },
3409
3410      /**
3411       * Binds events to arrows HTML elements.
3412       *
3413       * @param {HTMLCollection} elements
3414       * @return {Void}
3415       */
3416      bind: function bind(elements) {
3417        for (var i = 0; i < elements.length; i++) {
3418          Binder.on('click', elements[i], this.click);
3419          Binder.on('touchstart', elements[i], this.click, capture);
3420        }
3421      },
3422
3423      /**
3424       * Unbinds events binded to the arrows HTML elements.
3425       *
3426       * @param {HTMLCollection} elements
3427       * @return {Void}
3428       */
3429      unbind: function unbind(elements) {
3430        for (var i = 0; i < elements.length; i++) {
3431          Binder.off(['click', 'touchstart'], elements[i]);
3432        }
3433      },
3434
3435      /**
3436       * Handles `click` event on the arrows HTML elements.
3437       * Moves slider in direction given via the
3438       * `data-glide-dir` attribute.
3439       *
3440       * @param {Object} event
3441       * @return {void}
3442       */
3443      click: function click(event) {
3444        if (!supportsPassive$1 && event.type === 'touchstart') {
3445          event.preventDefault();
3446        }
3447
3448        var direction = event.currentTarget.getAttribute('data-glide-dir');
3449        Components.Run.make(Components.Direction.resolve(direction));
3450      }
3451    };
3452    define(Controls, 'items', {
3453      /**
3454       * Gets collection of the controls HTML elements.
3455       *
3456       * @return {HTMLElement[]}
3457       */
3458      get: function get() {
3459        return Controls._c;
3460      }
3461    });
3462    /**
3463     * Swap active class of current navigation item:
3464     * - after mounting to set it to initial index
3465     * - after each move to the new index
3466     */
3467
3468    Events.on(['mount.after', 'move.after'], function () {
3469      Controls.setActive();
3470    });
3471    /**
3472     * Add or remove disabled class of arrow elements
3473     */
3474
3475    Events.on(['mount.after', 'run'], function () {
3476      Controls.setArrowState();
3477    });
3478    /**
3479     * Remove bindings and HTML Classes:
3480     * - on destroying, to bring markup to its initial state
3481     */
3482
3483    Events.on('destroy', function () {
3484      Controls.removeBindings();
3485      Controls.removeActive();
3486      Binder.destroy();
3487    });
3488    return Controls;
3489  }
3490
3491  function Keyboard (Glide, Components, Events) {
3492    /**
3493     * Instance of the binder for DOM Events.
3494     *
3495     * @type {EventsBinder}
3496     */
3497    var Binder = new EventsBinder();
3498    var Keyboard = {
3499      /**
3500       * Binds keyboard events on component mount.
3501       *
3502       * @return {Void}
3503       */
3504      mount: function mount() {
3505        if (Glide.settings.keyboard) {
3506          this.bind();
3507        }
3508      },
3509
3510      /**
3511       * Adds keyboard press events.
3512       *
3513       * @return {Void}
3514       */
3515      bind: function bind() {
3516        Binder.on('keyup', document, this.press);
3517      },
3518
3519      /**
3520       * Removes keyboard press events.
3521       *
3522       * @return {Void}
3523       */
3524      unbind: function unbind() {
3525        Binder.off('keyup', document);
3526      },
3527
3528      /**
3529       * Handles keyboard's arrows press and moving glide foward and backward.
3530       *
3531       * @param  {Object} event
3532       * @return {Void}
3533       */
3534      press: function press(event) {
3535        var perSwipe = Glide.settings.perSwipe;
3536        var arrowSymbols = {
3537          ArrowRight: '>',
3538          ArrowLeft: '<'
3539        };
3540
3541        if (['ArrowRight', 'ArrowLeft'].includes(event.code)) {
3542          Components.Run.make(Components.Direction.resolve("".concat(perSwipe).concat(arrowSymbols[event.code])));
3543        }
3544      }
3545    };
3546    /**
3547     * Remove bindings from keyboard:
3548     * - on destroying to remove added events
3549     * - on updating to remove events before remounting
3550     */
3551
3552    Events.on(['destroy', 'update'], function () {
3553      Keyboard.unbind();
3554    });
3555    /**
3556     * Remount component
3557     * - on updating to reflect potential changes in settings
3558     */
3559
3560    Events.on('update', function () {
3561      Keyboard.mount();
3562    });
3563    /**
3564     * Destroy binder:
3565     * - on destroying to remove listeners
3566     */
3567
3568    Events.on('destroy', function () {
3569      Binder.destroy();
3570    });
3571    return Keyboard;
3572  }
3573
3574  function Autoplay (Glide, Components, Events) {
3575    /**
3576     * Instance of the binder for DOM Events.
3577     *
3578     * @type {EventsBinder}
3579     */
3580    var Binder = new EventsBinder();
3581    var Autoplay = {
3582      /**
3583       * Initializes autoplaying and events.
3584       *
3585       * @return {Void}
3586       */
3587      mount: function mount() {
3588        this.enable();
3589        this.start();
3590
3591        if (Glide.settings.hoverpause) {
3592          this.bind();
3593        }
3594      },
3595
3596      /**
3597       * Enables autoplaying
3598       *
3599       * @returns {Void}
3600       */
3601      enable: function enable() {
3602        this._e = true;
3603      },
3604
3605      /**
3606       * Disables autoplaying.
3607       *
3608       * @returns {Void}
3609       */
3610      disable: function disable() {
3611        this._e = false;
3612      },
3613
3614      /**
3615       * Starts autoplaying in configured interval.
3616       *
3617       * @param {Boolean|Number} force Run autoplaying with passed interval regardless of `autoplay` settings
3618       * @return {Void}
3619       */
3620      start: function start() {
3621        var _this = this;
3622
3623        if (!this._e) {
3624          return;
3625        }
3626
3627        this.enable();
3628
3629        if (Glide.settings.autoplay) {
3630          if (isUndefined(this._i)) {
3631            this._i = setInterval(function () {
3632              _this.stop();
3633
3634              Components.Run.make('>');
3635
3636              _this.start();
3637
3638              Events.emit('autoplay');
3639            }, this.time);
3640          }
3641        }
3642      },
3643
3644      /**
3645       * Stops autorunning of the glide.
3646       *
3647       * @return {Void}
3648       */
3649      stop: function stop() {
3650        this._i = clearInterval(this._i);
3651      },
3652
3653      /**
3654       * Stops autoplaying while mouse is over glide's area.
3655       *
3656       * @return {Void}
3657       */
3658      bind: function bind() {
3659        var _this2 = this;
3660
3661        Binder.on('mouseover', Components.Html.root, function () {
3662          if (_this2._e) {
3663            _this2.stop();
3664          }
3665        });
3666        Binder.on('mouseout', Components.Html.root, function () {
3667          if (_this2._e) {
3668            _this2.start();
3669          }
3670        });
3671      },
3672
3673      /**
3674       * Unbind mouseover events.
3675       *
3676       * @returns {Void}
3677       */
3678      unbind: function unbind() {
3679        Binder.off(['mouseover', 'mouseout'], Components.Html.root);
3680      }
3681    };
3682    define(Autoplay, 'time', {
3683      /**
3684       * Gets time period value for the autoplay interval. Prioritizes
3685       * times in `data-glide-autoplay` attrubutes over options.
3686       *
3687       * @return {Number}
3688       */
3689      get: function get() {
3690        var autoplay = Components.Html.slides[Glide.index].getAttribute('data-glide-autoplay');
3691
3692        if (autoplay) {
3693          return toInt(autoplay);
3694        }
3695
3696        return toInt(Glide.settings.autoplay);
3697      }
3698    });
3699    /**
3700     * Stop autoplaying and unbind events:
3701     * - on destroying, to clear defined interval
3702     * - on updating via API to reset interval that may changed
3703     */
3704
3705    Events.on(['destroy', 'update'], function () {
3706      Autoplay.unbind();
3707    });
3708    /**
3709     * Stop autoplaying:
3710     * - before each run, to restart autoplaying
3711     * - on pausing via API
3712     * - on destroying, to clear defined interval
3713     * - while starting a swipe
3714     * - on updating via API to reset interval that may changed
3715     */
3716
3717    Events.on(['run.before', 'swipe.start', 'update'], function () {
3718      Autoplay.stop();
3719    });
3720    Events.on(['pause', 'destroy'], function () {
3721      Autoplay.disable();
3722      Autoplay.stop();
3723    });
3724    /**
3725     * Start autoplaying:
3726     * - after each run, to restart autoplaying
3727     * - on playing via API
3728     * - while ending a swipe
3729     */
3730
3731    Events.on(['run.after', 'swipe.end'], function () {
3732      Autoplay.start();
3733    });
3734    /**
3735     * Start autoplaying:
3736     * - after each run, to restart autoplaying
3737     * - on playing via API
3738     * - while ending a swipe
3739     */
3740
3741    Events.on(['play'], function () {
3742      Autoplay.enable();
3743      Autoplay.start();
3744    });
3745    /**
3746     * Remount autoplaying:
3747     * - on updating via API to reset interval that may changed
3748     */
3749
3750    Events.on('update', function () {
3751      Autoplay.mount();
3752    });
3753    /**
3754     * Destroy a binder:
3755     * - on destroying glide instance to clearup listeners
3756     */
3757
3758    Events.on('destroy', function () {
3759      Binder.destroy();
3760    });
3761    return Autoplay;
3762  }
3763
3764  /**
3765   * Sorts keys of breakpoint object so they will be ordered from lower to bigger.
3766   *
3767   * @param {Object} points
3768   * @returns {Object}
3769   */
3770
3771  function sortBreakpoints(points) {
3772    if (isObject(points)) {
3773      return sortKeys(points);
3774    } else {
3775      warn("Breakpoints option must be an object");
3776    }
3777
3778    return {};
3779  }
3780
3781  function Breakpoints (Glide, Components, Events) {
3782    /**
3783     * Instance of the binder for DOM Events.
3784     *
3785     * @type {EventsBinder}
3786     */
3787    var Binder = new EventsBinder();
3788    /**
3789     * Holds reference to settings.
3790     *
3791     * @type {Object}
3792     */
3793
3794    var settings = Glide.settings;
3795    /**
3796     * Holds reference to breakpoints object in settings. Sorts breakpoints
3797     * from smaller to larger. It is required in order to proper
3798     * matching currently active breakpoint settings.
3799     *
3800     * @type {Object}
3801     */
3802
3803    var points = sortBreakpoints(settings.breakpoints);
3804    /**
3805     * Cache initial settings before overwritting.
3806     *
3807     * @type {Object}
3808     */
3809
3810    var defaults = Object.assign({}, settings);
3811    var Breakpoints = {
3812      /**
3813       * Matches settings for currectly matching media breakpoint.
3814       *
3815       * @param {Object} points
3816       * @returns {Object}
3817       */
3818      match: function match(points) {
3819        if (typeof window.matchMedia !== 'undefined') {
3820          for (var point in points) {
3821            if (points.hasOwnProperty(point)) {
3822              if (window.matchMedia("(max-width: ".concat(point, "px)")).matches) {
3823                return points[point];
3824              }
3825            }
3826          }
3827        }
3828
3829        return defaults;
3830      }
3831    };
3832    /**
3833     * Overwrite instance settings with currently matching breakpoint settings.
3834     * This happens right after component initialization.
3835     */
3836
3837    Object.assign(settings, Breakpoints.match(points));
3838    /**
3839     * Update glide with settings of matched brekpoint:
3840     * - window resize to update slider
3841     */
3842
3843    Binder.on('resize', window, throttle(function () {
3844      Glide.settings = mergeOptions(settings, Breakpoints.match(points));
3845    }, Glide.settings.throttle));
3846    /**
3847     * Resort and update default settings:
3848     * - on reinit via API, so breakpoint matching will be performed with options
3849     */
3850
3851    Events.on('update', function () {
3852      points = sortBreakpoints(points);
3853      defaults = Object.assign({}, settings);
3854    });
3855    /**
3856     * Unbind resize listener:
3857     * - on destroying, to bring markup to its initial state
3858     */
3859
3860    Events.on('destroy', function () {
3861      Binder.off('resize', window);
3862    });
3863    return Breakpoints;
3864  }
3865
3866  var COMPONENTS = {
3867    // Required
3868    Html: Html,
3869    Translate: Translate,
3870    Transition: Transition,
3871    Direction: Direction,
3872    Peek: Peek,
3873    Sizes: Sizes,
3874    Gaps: Gaps,
3875    Move: Move,
3876    Clones: Clones,
3877    Resize: Resize,
3878    Build: Build,
3879    Run: Run,
3880    // Optional
3881    Swipe: Swipe,
3882    Images: Images,
3883    Anchors: Anchors,
3884    Controls: Controls,
3885    Keyboard: Keyboard,
3886    Autoplay: Autoplay,
3887    Breakpoints: Breakpoints
3888  };
3889
3890  var Glide = /*#__PURE__*/function (_Core) {
3891    _inherits(Glide, _Core);
3892
3893    var _super = _createSuper(Glide);
3894
3895    function Glide() {
3896      _classCallCheck(this, Glide);
3897
3898      return _super.apply(this, arguments);
3899    }
3900
3901    _createClass(Glide, [{
3902      key: "mount",
3903      value: function mount() {
3904        var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3905        return _get(_getPrototypeOf(Glide.prototype), "mount", this).call(this, Object.assign({}, COMPONENTS, extensions));
3906      }
3907    }]);
3908
3909    return Glide;
3910  }(Glide$1);
3911
3912  
3912var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3913
3914  /**
3915   * lodash (Custom Build) <https://lodash.com/>
3916   * Build: `lodash modularize exports="npm" -o ./`
3917   * Copyright jQuery Foundation and other contributors <https://jquery.org/>
3918   * Released under MIT license <https://lodash.com/license>
3919   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
3920   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
3921   */
3922
3923  /** Used as the `TypeError` message for "Functions" methods. */
vendor: 8,990 bytes, lines 3924-4182
3924  var FUNC_ERROR_TEXT = 'Expected a function';
3925
3926  /** Used as references for various `Number` constants. */
3927  var NAN = 0 / 0;
3928
3929  /** `Object#toString` result references. */
3930  var symbolTag = '[object Symbol]';
3931
3932  /** Used to match leading and trailing whitespace. */
3933  var reTrim = /^\s+|\s+$/g;
3934
3935  /** Used to detect bad signed hexadecimal string values. */
3936  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
3937
3938  /** Used to detect binary string values. */
3939  var reIsBinary = /^0b[01]+$/i;
3940
3941  /** Used to detect octal string values. */
3942  var reIsOctal = /^0o[0-7]+$/i;
3943
3944  /** Built-in method references without a dependency on `root`. */
3945  var freeParseInt = parseInt;
3946
3947  /** Detect free variable `global` from Node.js. */
3948  var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
3949
3950  /** Detect free variable `self`. */
3951  var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
3952
3953  /** Used as a reference to the global object. */
3954  var root = freeGlobal || freeSelf || Function('return this')();
3955
3956  /** Used for built-in method references. */
3957  var objectProto = Object.prototype;
3958
3959  /**
3960   * Used to resolve the
3961   * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
3962   * of values.
3963   */
3964  var objectToString = objectProto.toString;
3965
3966  /* Built-in method references for those with the same name as other `lodash` methods. */
3967  var nativeMax = Math.max,
3968      nativeMin = Math.min;
3969
3970  /**
3971   * Gets the timestamp of the number of milliseconds that have elapsed since
3972   * the Unix epoch (1 January 1970 00:00:00 UTC).
3973   *
3974   * @static
3975   * @memberOf _
3976   * @since 2.4.0
3977   * @category Date
3978   * @returns {number} Returns the timestamp.
3979   * @example
3980   *
3981   * _.defer(function(stamp) {
3982   *   console.log(_.now() - stamp);
3983   * }, _.now());
3984   * // => Logs the number of milliseconds it took for the deferred invocation.
3985   */
3986  var now$1 = function() {
3987    return root.Date.now();
3988  };
3989
3990  /**
3991   * Creates a debounced function that delays invoking `func` until after `wait`
3992   * milliseconds have elapsed since the last time the debounced function was
3993   * invoked. The debounced function comes with a `cancel` method to cancel
3994   * delayed `func` invocations and a `flush` method to immediately invoke them.
3995   * Provide `options` to indicate whether `func` should be invoked on the
3996   * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
3997   * with the last arguments provided to the debounced function. Subsequent
3998   * calls to the debounced function return the result of the last `func`
3999   * invocation.
4000   *
4001   * **Note:** If `leading` and `trailing` options are `true`, `func` is
4002   * invoked on the trailing edge of the timeout only if the debounced function
4003   * is invoked more than once during the `wait` timeout.
4004   *
4005   * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
4006   * until to the next tick, similar to `setTimeout` with a timeout of `0`.
4007   *
4008   * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
4009   * for details over the differences between `_.debounce` and `_.throttle`.
4010   *
4011   * @static
4012   * @memberOf _
4013   * @since 0.1.0
4014   * @category Function
4015   * @param {Function} func The function to debounce.
4016   * @param {number} [wait=0] The number of milliseconds to delay.
4017   * @param {Object} [options={}] The options object.
4018   * @param {boolean} [options.leading=false]
4019   *  Specify invoking on the leading edge of the timeout.
4020   * @param {number} [options.maxWait]
4021   *  The maximum time `func` is allowed to be delayed before it's invoked.
4022   * @param {boolean} [options.trailing=true]
4023   *  Specify invoking on the trailing edge of the timeout.
4024   * @returns {Function} Returns the new debounced function.
4025   * @example
4026   *
4027   * // Avoid costly calculations while the window size is in flux.
4028   * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
4029   *
4030   * // Invoke `sendMail` when clicked, debouncing subsequent calls.
4031   * jQuery(element).on('click', _.debounce(sendMail, 300, {
4032   *   'leading': true,
4033   *   'trailing': false
4034   * }));
4035   *
4036   * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
4037   * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
4038   * var source = new EventSource('/stream');
4039   * jQuery(source).on('message', debounced);
4040   *
4041   * // Cancel the trailing debounced invocation.
4042   * jQuery(window).on('popstate', debounced.cancel);
4043   */
4044  function debounce(func, wait, options) {
4045    var lastArgs,
4046        lastThis,
4047        maxWait,
4048        result,
4049        timerId,
4050        lastCallTime,
4051        lastInvokeTime = 0,
4052        leading = false,
4053        maxing = false,
4054        trailing = true;
4055
4056    if (typeof func != 'function') {
4057      throw new TypeError(FUNC_ERROR_TEXT);
4058    }
4059    wait = toNumber(wait) || 0;
4060    if (isObject$1(options)) {
4061      leading = !!options.leading;
4062      maxing = 'maxWait' in options;
4063      maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
4064      trailing = 'trailing' in options ? !!options.trailing : trailing;
4065    }
4066
4067    function invokeFunc(time) {
4068      var args = lastArgs,
4069          thisArg = lastThis;
4070
4071      lastArgs = lastThis = undefined;
4072      lastInvokeTime = time;
4073      result = func.apply(thisArg, args);
4074      return result;
4075    }
4076
4077    function leadingEdge(time) {
4078      // Reset any `maxWait` timer.
4079      lastInvokeTime = time;
4080      // Start the timer for the trailing edge.
4081      timerId = setTimeout(timerExpired, wait);
4082      // Invoke the leading edge.
4083      return leading ? invokeFunc(time) : result;
4084    }
4085
4086    function remainingWait(time) {
4087      var timeSinceLastCall = time - lastCallTime,
4088          timeSinceLastInvoke = time - lastInvokeTime,
4089          result = wait - timeSinceLastCall;
4090
4091      return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
4092    }
4093
4094    function shouldInvoke(time) {
4095      var timeSinceLastCall = time - lastCallTime,
4096          timeSinceLastInvoke = time - lastInvokeTime;
4097
4098      // Either this is the first call, activity has stopped and we're at the
4099      // trailing edge, the system time has gone backwards and we're treating
4100      // it as the trailing edge, or we've hit the `maxWait` limit.
4101      return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
4102        (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
4103    }
4104
4105    function timerExpired() {
4106      var time = now$1();
4107      if (shouldInvoke(time)) {
4108        return trailingEdge(time);
4109      }
4110      // Restart the timer.
4111      timerId = setTimeout(timerExpired, remainingWait(time));
4112    }
4113
4114    function trailingEdge(time) {
4115      timerId = undefined;
4116
4117      // Only invoke if we have `lastArgs` which means `func` has been
4118      // debounced at least once.
4119      if (trailing && lastArgs) {
4120        return invokeFunc(time);
4121      }
4122      lastArgs = lastThis = undefined;
4123      return result;
4124    }
4125
4126    function cancel() {
4127      if (timerId !== undefined) {
4128        clearTimeout(timerId);
4129      }
4130      lastInvokeTime = 0;
4131      lastArgs = lastCallTime = lastThis = timerId = undefined;
4132    }
4133
4134    function flush() {
4135      return timerId === undefined ? result : trailingEdge(now$1());
4136    }
4137
4138    function debounced() {
4139      var time = now$1(),
4140          isInvoking = shouldInvoke(time);
4141
4142      lastArgs = arguments;
4143      lastThis = this;
4144      lastCallTime = time;
4145
4146      if (isInvoking) {
4147        if (timerId === undefined) {
4148          return leadingEdge(lastCallTime);
4149        }
4150        if (maxing) {
4151          // Handle invocations in a tight loop.
4152          timerId = setTimeout(timerExpired, wait);
4153          return invokeFunc(lastCallTime);
4154        }
4155      }
4156      if (timerId === undefined) {
4157        timerId = setTimeout(timerExpired, wait);
4158      }
4159      return result;
4160    }
4161    debounced.cancel = cancel;
4162    debounced.flush = flush;
4163    return debounced;
4164  }
4165
4166  /**
4167   * Creates a throttled function that only invokes `func` at most once per
4168   * every `wait` milliseconds. The throttled function comes with a `cancel`
4169   * method to cancel delayed `func` invocations and a `flush` method to
4170   * immediately invoke them. Provide `options` to indicate whether `func`
4171   * should be invoked on the leading and/or trailing edge of the `wait`
4172   * timeout. The `func` is invoked with the last arguments provided to the
4173   * throttled function. Subsequent calls to the throttled function return the
4174   * result of the last `func` invocation.
4175   *
4176   * **Note:** If `leading` and `trailing` options are `true`, `func` is
4177   * invoked on the trailing edge of the timeout only if the throttled function
4178   * is invoked more than once during the `wait` timeout.
4179   *
4180   * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
4181   * until to the next tick, similar to `setTimeout` with a timeout of `0`.
4182   *
4183   * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
4184   * for details over the differences between `_.throttle` and `_.debounce`.
4185   *
4186   * @static
4187   * @memberOf _
4188   * @since 0.1.0
4189   * @category Function
4190   * @param {Function} func The function to throttle.
4191   * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
4192   * @param {Object} [options={}] The options object.
4193   * @param {boolean} [options.leading=true]
4194   *  Specify invoking on the leading edge of the timeout.
4195   * @param {boolean} [options.trailing=true]
4196   *  Specify invoking on the trailing edge of the timeout.
4197   * @returns {Function} Returns the new throttled function.
4198   * @example
4199   *
4200   * // Avoid excessively updating the position while scrolling.
4201   * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
4202   *
4203   * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
4204   * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
4205   * jQuery(element).on('click', throttled);
4206   *
4207   * // Cancel the trailing throttled invocation.
4208   * jQuery(window).on('popstate', throttled.cancel);
4209   */
4210  function throttle$1(func, wait, options) {
4211    var leading = true,
4212        trailing = true;
4213
4214    if (typeof func != 'function') {
4215      throw new TypeError(FUNC_ERROR_TEXT);
4216    }
4217    if (isObject$1(options)) {
4218      leading = 'leading' in options ? !!options.leading : leading;
4219      trailing = 'trailing' in options ? !!options.trailing : trailing;
4220    }
4221    return debounce(func, wait, {
4222      'leading': leading,
4223      'maxWait': wait,
4224      'trailing': trailing
4225    });
4226  }
4227
4228  /**
4229   * Checks if `value` is the
4230   * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
4231   * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
4232   *
4233   * @static
4234   * @memberOf _
4235   * @since 0.1.0
4236   * @category Lang
4237   * @param {*} value The value to check.
4238   * @returns {boolean} Returns `true` if `value` is an object, else `false`.
4239   * @example
4240   *
4241   * _.isObject({});
4242   * // => true
4243   *
4244   * _.isObject([1, 2, 3]);
4245   * // => true
4246   *
4247   * _.isObject(_.noop);
4248   * // => true
4249   *
4250   * _.isObject(null);
4251   * // => false
4252   */
4253  function isObject$1(value) {
4254    var type = typeof value;
4255    return !!value && (type == 'object' || type == 'function');
4256  }
4257
4258  /**
4259   * Checks if `value` is object-like. A value is object-like if it's not `null`
4260   * and has a `typeof` result of "object".
4261   *
4262   * @static
4263   * @memberOf _
4264   * @since 4.0.0
4265   * @category Lang
4266   * @param {*} value The value to check.
4267   * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
4268   * @example
4269   *
4270   * _.isObjectLike({});
4271   * // => true
4272   *
4273   * _.isObjectLike([1, 2, 3]);
4274   * // => true
4275   *
4276   * _.isObjectLike(_.noop);
4277   * // => false
4278   *
4279   * _.isObjectLike(null);
4280   * // => false
4281   */
4282  function isObjectLike(value) {
4283    return !!value && typeof value == 'object';
4284  }
4285
4286  /**
4287   * Checks if `value` is classified as a `Symbol` primitive or object.
4288   *
4289   * @static
4290   * @memberOf _
4291   * @since 4.0.0
4292   * @category Lang
4293   * @param {*} value The value to check.
4294   * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
4295   * @example
4296   *
4297   * _.isSymbol(Symbol.iterator);
4298   * // => true
4299   *
4300   * _.isSymbol('abc');
4301   * // => false
4302   */
4303  function isSymbol(value) {
4304    return typeof value == 'symbol' ||
4305      (isObjectLike(value) && objectToString.call(value) == symbolTag);
4306  }
4307
4308  /**
4309   * Converts `value` to a number.
4310   *
4311   * @static
4312   * @memberOf _
4313   * @since 4.0.0
4314   * @category Lang
4315   * @param {*} value The value to process.
4316   * @returns {number} Returns the number.
4317   * @example
4318   *
4319   * _.toNumber(3.2);
4320   * // => 3.2
4321   *
4322   * _.toNumber(Number.MIN_VALUE);
4323   * // => 5e-324
4324   *
4325   * _.toNumber(Infinity);
4326   * // => Infinity
4327   *
4328   * _.toNumber('3.2');
4329   * // => 3.2
4330   */
4331  function toNumber(value) {
4332    if (typeof value == 'number') {
4333      return value;
4334    }
4335    if (isSymbol(value)) {
4336      return NAN;
4337    }
4338    if (isObject$1(value)) {
4339      var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
4340      value = isObject$1(other) ? (other + '') : other;
4341    }
4342    if (typeof value != 'string') {
4343      return value === 0 ? value : +value;
4344    }
4345    value = value.replace(reTrim, '');
4346    var isBinary = reIsBinary.test(value);
4347    return (isBinary || reIsOctal.test(value))
4348      ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
4349      : (reIsBadHex.test(value) ? NAN : +value);
4350  }
4351
4352  var lodash_throttle = throttle$1;
4353
4354  /**
4355   * lodash (Custom Build) <https://lodash.com/>
4356   * Build: `lodash modularize exports="npm" -o ./`
4357   * Copyright jQuery Foundation and other contributors <https://jquery.org/>
4358   * Released under MIT license <https://lodash.com/license>
4359   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
4360   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4361   */
4362
4363  /** Used as the `TypeError` message for "Functions" methods. */
vendor: 11,599 bytes, lines 4364-4753
4364  var FUNC_ERROR_TEXT$1 = 'Expected a function';
4365
4366  /** Used as references for various `Number` constants. */
4367  var NAN$1 = 0 / 0;
4368
4369  /** `Object#toString` result references. */
4370  var symbolTag$1 = '[object Symbol]';
4371
4372  /** Used to match leading and trailing whitespace. */
4373  var reTrim$1 = /^\s+|\s+$/g;
4374
4375  /** Used to detect bad signed hexadecimal string values. */
4376  var reIsBadHex$1 = /^[-+]0x[0-9a-f]+$/i;
4377
4378  /** Used to detect binary string values. */
4379  var reIsBinary$1 = /^0b[01]+$/i;
4380
4381  /** Used to detect octal string values. */
4382  var reIsOctal$1 = /^0o[0-7]+$/i;
4383
4384  /** Built-in method references without a dependency on `root`. */
4385  var freeParseInt$1 = parseInt;
4386
4387  /** Detect free variable `global` from Node.js. */
4388  var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
4389
4390  /** Detect free variable `self`. */
4391  var freeSelf$1 = typeof self == 'object' && self && self.Object === Object && self;
4392
4393  /** Used as a reference to the global object. */
4394  var root$1 = freeGlobal$1 || freeSelf$1 || Function('return this')();
4395
4396  /** Used for built-in method references. */
4397  var objectProto$1 = Object.prototype;
4398
4399  /**
4400   * Used to resolve the
4401   * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
4402   * of values.
4403   */
4404  var objectToString$1 = objectProto$1.toString;
4405
4406  /* Built-in method references for those with the same name as other `lodash` methods. */
4407  var nativeMax$1 = Math.max,
4408      nativeMin$1 = Math.min;
4409
4410  /**
4411   * Gets the timestamp of the number of milliseconds that have elapsed since
4412   * the Unix epoch (1 January 1970 00:00:00 UTC).
4413   *
4414   * @static
4415   * @memberOf _
4416   * @since 2.4.0
4417   * @category Date
4418   * @returns {number} Returns the timestamp.
4419   * @example
4420   *
4421   * _.defer(function(stamp) {
4422   *   console.log(_.now() - stamp);
4423   * }, _.now());
4424   * // => Logs the number of milliseconds it took for the deferred invocation.
4425   */
4426  var now$2 = function() {
4427    return root$1.Date.now();
4428  };
4429
4430  /**
4431   * Creates a debounced function that delays invoking `func` until after `wait`
4432   * milliseconds have elapsed since the last time the debounced function was
4433   * invoked. The debounced function comes with a `cancel` method to cancel
4434   * delayed `func` invocations and a `flush` method to immediately invoke them.
4435   * Provide `options` to indicate whether `func` should be invoked on the
4436   * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
4437   * with the last arguments provided to the debounced function. Subsequent
4438   * calls to the debounced function return the result of the last `func`
4439   * invocation.
4440   *
4441   * **Note:** If `leading` and `trailing` options are `true`, `func` is
4442   * invoked on the trailing edge of the timeout only if the debounced function
4443   * is invoked more than once during the `wait` timeout.
4444   *
4445   * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
4446   * until to the next tick, similar to `setTimeout` with a timeout of `0`.
4447   *
4448   * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
4449   * for details over the differences between `_.debounce` and `_.throttle`.
4450   *
4451   * @static
4452   * @memberOf _
4453   * @since 0.1.0
4454   * @category Function
4455   * @param {Function} func The function to debounce.
4456   * @param {number} [wait=0] The number of milliseconds to delay.
4457   * @param {Object} [options={}] The options object.
4458   * @param {boolean} [options.leading=false]
4459   *  Specify invoking on the leading edge of the timeout.
4460   * @param {number} [options.maxWait]
4461   *  The maximum time `func` is allowed to be delayed before it's invoked.
4462   * @param {boolean} [options.trailing=true]
4463   *  Specify invoking on the trailing edge of the timeout.
4464   * @returns {Function} Returns the new debounced function.
4465   * @example
4466   *
4467   * // Avoid costly calculations while the window size is in flux.
4468   * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
4469   *
4470   * // Invoke `sendMail` when clicked, debouncing subsequent calls.
4471   * jQuery(element).on('click', _.debounce(sendMail, 300, {
4472   *   'leading': true,
4473   *   'trailing': false
4474   * }));
4475   *
4476   * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
4477   * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
4478   * var source = new EventSource('/stream');
4479   * jQuery(source).on('message', debounced);
4480   *
4481   * // Cancel the trailing debounced invocation.
4482   * jQuery(window).on('popstate', debounced.cancel);
4483   */
4484  function debounce$1(func, wait, options) {
4485    var lastArgs,
4486        lastThis,
4487        maxWait,
4488        result,
4489        timerId,
4490        lastCallTime,
4491        lastInvokeTime = 0,
4492        leading = false,
4493        maxing = false,
4494        trailing = true;
4495
4496    if (typeof func != 'function') {
4497      throw new TypeError(FUNC_ERROR_TEXT$1);
4498    }
4499    wait = toNumber$1(wait) || 0;
4500    if (isObject$2(options)) {
4501      leading = !!options.leading;
4502      maxing = 'maxWait' in options;
4503      maxWait = maxing ? nativeMax$1(toNumber$1(options.maxWait) || 0, wait) : maxWait;
4504      trailing = 'trailing' in options ? !!options.trailing : trailing;
4505    }
4506
4507    function invokeFunc(time) {
4508      var args = lastArgs,
4509          thisArg = lastThis;
4510
4511      lastArgs = lastThis = undefined;
4512      lastInvokeTime = time;
4513      result = func.apply(thisArg, args);
4514      return result;
4515    }
4516
4517    function leadingEdge(time) {
4518      // Reset any `maxWait` timer.
4519      lastInvokeTime = time;
4520      // Start the timer for the trailing edge.
4521      timerId = setTimeout(timerExpired, wait);
4522      // Invoke the leading edge.
4523      return leading ? invokeFunc(time) : result;
4524    }
4525
4526    function remainingWait(time) {
4527      var timeSinceLastCall = time - lastCallTime,
4528          timeSinceLastInvoke = time - lastInvokeTime,
4529          result = wait - timeSinceLastCall;
4530
4531      return maxing ? nativeMin$1(result, maxWait - timeSinceLastInvoke) : result;
4532    }
4533
4534    function shouldInvoke(time) {
4535      var timeSinceLastCall = time - lastCallTime,
4536          timeSinceLastInvoke = time - lastInvokeTime;
4537
4538      // Either this is the first call, activity has stopped and we're at the
4539      // trailing edge, the system time has gone backwards and we're treating
4540      // it as the trailing edge, or we've hit the `maxWait` limit.
4541      return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
4542        (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
4543    }
4544
4545    function timerExpired() {
4546      var time = now$2();
4547      if (shouldInvoke(time)) {
4548        return trailingEdge(time);
4549      }
4550      // Restart the timer.
4551      timerId = setTimeout(timerExpired, remainingWait(time));
4552    }
4553
4554    function trailingEdge(time) {
4555      timerId = undefined;
4556
4557      // Only invoke if we have `lastArgs` which means `func` has been
4558      // debounced at least once.
4559      if (trailing && lastArgs) {
4560        return invokeFunc(time);
4561      }
4562      lastArgs = lastThis = undefined;
4563      return result;
4564    }
4565
4566    function cancel() {
4567      if (timerId !== undefined) {
4568        clearTimeout(timerId);
4569      }
4570      lastInvokeTime = 0;
4571      lastArgs = lastCallTime = lastThis = timerId = undefined;
4572    }
4573
4574    function flush() {
4575      return timerId === undefined ? result : trailingEdge(now$2());
4576    }
4577
4578    function debounced() {
4579      var time = now$2(),
4580          isInvoking = shouldInvoke(time);
4581
4582      lastArgs = arguments;
4583      lastThis = this;
4584      lastCallTime = time;
4585
4586      if (isInvoking) {
4587        if (timerId === undefined) {
4588          return leadingEdge(lastCallTime);
4589        }
4590        if (maxing) {
4591          // Handle invocations in a tight loop.
4592          timerId = setTimeout(timerExpired, wait);
4593          return invokeFunc(lastCallTime);
4594        }
4595      }
4596      if (timerId === undefined) {
4597        timerId = setTimeout(timerExpired, wait);
4598      }
4599      return result;
4600    }
4601    debounced.cancel = cancel;
4602    debounced.flush = flush;
4603    return debounced;
4604  }
4605
4606  /**
4607   * Checks if `value` is the
4608   * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
4609   * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
4610   *
4611   * @static
4612   * @memberOf _
4613   * @since 0.1.0
4614   * @category Lang
4615   * @param {*} value The value to check.
4616   * @returns {boolean} Returns `true` if `value` is an object, else `false`.
4617   * @example
4618   *
4619   * _.isObject({});
4620   * // => true
4621   *
4622   * _.isObject([1, 2, 3]);
4623   * // => true
4624   *
4625   * _.isObject(_.noop);
4626   * // => true
4627   *
4628   * _.isObject(null);
4629   * // => false
4630   */
4631  function isObject$2(value) {
4632    var type = typeof value;
4633    return !!value && (type == 'object' || type == 'function');
4634  }
4635
4636  /**
4637   * Checks if `value` is object-like. A value is object-like if it's not `null`
4638   * and has a `typeof` result of "object".
4639   *
4640   * @static
4641   * @memberOf _
4642   * @since 4.0.0
4643   * @category Lang
4644   * @param {*} value The value to check.
4645   * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
4646   * @example
4647   *
4648   * _.isObjectLike({});
4649   * // => true
4650   *
4651   * _.isObjectLike([1, 2, 3]);
4652   * // => true
4653   *
4654   * _.isObjectLike(_.noop);
4655   * // => false
4656   *
4657   * _.isObjectLike(null);
4658   * // => false
4659   */
4660  function isObjectLike$1(value) {
4661    return !!value && typeof value == 'object';
4662  }
4663
4664  /**
4665   * Checks if `value` is classified as a `Symbol` primitive or object.
4666   *
4667   * @static
4668   * @memberOf _
4669   * @since 4.0.0
4670   * @category Lang
4671   * @param {*} value The value to check.
4672   * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
4673   * @example
4674   *
4675   * _.isSymbol(Symbol.iterator);
4676   * // => true
4677   *
4678   * _.isSymbol('abc');
4679   * // => false
4680   */
4681  function isSymbol$1(value) {
4682    return typeof value == 'symbol' ||
4683      (isObjectLike$1(value) && objectToString$1.call(value) == symbolTag$1);
4684  }
4685
4686  /**
4687   * Converts `value` to a number.
4688   *
4689   * @static
4690   * @memberOf _
4691   * @since 4.0.0
4692   * @category Lang
4693   * @param {*} value The value to process.
4694   * @returns {number} Returns the number.
4695   * @example
4696   *
4697   * _.toNumber(3.2);
4698   * // => 3.2
4699   *
4700   * _.toNumber(Number.MIN_VALUE);
4701   * // => 5e-324
4702   *
4703   * _.toNumber(Infinity);
4704   * // => Infinity
4705   *
4706   * _.toNumber('3.2');
4707   * // => 3.2
4708   */
4709  function toNumber$1(value) {
4710    if (typeof value == 'number') {
4711      return value;
4712    }
4713    if (isSymbol$1(value)) {
4714      return NAN$1;
4715    }
4716    if (isObject$2(value)) {
4717      var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
4718      value = isObject$2(other) ? (other + '') : other;
4719    }
4720    if (typeof value != 'string') {
4721      return value === 0 ? value : +value;
4722    }
4723    value = value.replace(reTrim$1, '');
4724    var isBinary = reIsBinary$1.test(value);
4725    return (isBinary || reIsOctal$1.test(value))
4726      ? freeParseInt$1(value.slice(2), isBinary ? 2 : 8)
4727      : (reIsBadHex$1.test(value) ? NAN$1 : +value);
4728  }
4729
4730  var lodash_debounce = debounce$1;
4731
4732  var callback = function callback() {};
4733
4734  function containsAOSNode(nodes) {
4735    var i = void 0,
4736        currentNode = void 0,
4737        result = void 0;
4738
4739    for (i = 0; i < nodes.length; i += 1) {
4740      currentNode = nodes[i];
4741
4742      if (currentNode.dataset && currentNode.dataset.aos) {
4743        return true;
4744      }
4745
4746      result = currentNode.children && containsAOSNode(currentNode.children);
4747
4748      if (result) {
4749        return true;
4750      }
4751    }
4752
4753    return false;
4754  }
4755
4756  function check(mutations) {
4757    if (!mutations) return;
4758
4759    mutations.forEach(function (mutation) {
4760      var addedNodes = Array.prototype.slice.call(mutation.addedNodes);
4761      var removedNodes = Array.prototype.slice.call(mutation.removedNodes);
4762      var allNodes = addedNodes.concat(removedNodes);
4763
4764      if (containsAOSNode(allNodes)) {
4765        return callback();
4766      }
4767    });
4768  }
4769
4770  function getMutationObserver() {
4771    return window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
4772  }
4773
4774  function isSupported() {
4775    return !!getMutationObserver();
4776  }
4777
4778  function ready(selector, fn) {
4779    var doc = window.document;
4780    var MutationObserver = getMutationObserver();
4781
4782    var observer = new MutationObserver(check);
4783    callback = fn;
4784
4785    observer.observe(doc.documentElement, {
4786      childList: true,
4787      subtree: true,
4788      removedNodes: true
4789    });
4790  }
4791
4792  var observer = { isSupported: isSupported, ready: ready };
4793
4794  var classCallCheck = function (instance, Constructor) {
4795    if (!(instance instanceof Constructor)) {
4796      throw new TypeError("Cannot call a class as a function");
4797    }
4798  };
4799
4800  var createClass = function () {
4801    function defineProperties(target, props) {
4802      for (var i = 0; i < props.length; i++) {
4803        var descriptor = props[i];
4804        descriptor.enumerable = descriptor.enumerable || false;
4805        descriptor.configurable = true;
4806        if ("value" in descriptor) descriptor.writable = true;
4807        Object.defineProperty(target, descriptor.key, descriptor);
4808      }
4809    }
4810
4811    return function (Constructor, protoProps, staticProps) {
4812      if (protoProps) defineProperties(Constructor.prototype, protoProps);
4813      if (staticProps) defineProperties(Constructor, staticProps);
4814      return Constructor;
4815    };
4816  }();
4817
4818  var _extends = Object.assign || function (target) {
4819    for (var i = 1; i < arguments.length; i++) {
4820      var source = arguments[i];
4821
4822      for (var key in source) {
4823        if (Object.prototype.hasOwnProperty.call(source, key)) {
4824          target[key] = source[key];
4825        }
4826      }
4827    }
4828
4829    return target;
4830  };
4831
4832  /**
4833   * Device detector
4834   */
4835
4836  var fullNameRe = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i;
4837  var prefixRe = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;
4838  var fullNameMobileRe = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i;
4839  var prefixMobileRe = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
4839sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;
4840
4841  function ua() {
4842    return navigator.userAgent || navigator.vendor || window.opera || '';
4843  }
4844
4845  var Detector = function () {
4846    function Detector() {
4847      classCallCheck(this, Detector);
4848    }
4849
4850    createClass(Detector, [{
4851      key: 'phone',
4852      value: function phone() {
4853        var a = ua();
4854        return !!(fullNameRe.test(a) || prefixRe.test(a.substr(0, 4)));
4855      }
4856    }, {
4857      key: 'mobile',
4858      value: function mobile() {
4859        var a = ua();
4860        return !!(fullNameMobileRe.test(a) || prefixMobileRe.test(a.substr(0, 4)));
4861      }
4862    }, {
4863      key: 'tablet',
4864      value: function tablet() {
4865        return this.mobile() && !this.phone();
4866      }
4867
4868      // http://browserhacks.com/#hack-acea075d0ac6954f275a70023906050c
4869
4870    }, {
4871      key: 'ie11',
4872      value: function ie11() {
4873        return '-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style;
4874      }
4875    }]);
4876    return Detector;
4877  }();
4878
4879  var detect = new Detector();
4880
4881  /**
4882   * Adds multiple classes on node
4883   * @param {DOMNode} node
4884   * @param {array}  classes
4885   */
4886  var addClasses = function addClasses(node, classes) {
4887    return classes && classes.forEach(function (className) {
4888      return node.classList.add(className);
4889    });
4890  };
4891
4892  /**
4893   * Removes multiple classes from node
4894   * @param {DOMNode} node
4895   * @param {array}  classes
4896   */
4897  var removeClasses = function removeClasses(node, classes) {
4898    return classes && classes.forEach(function (className) {
4899      return node.classList.remove(className);
4900    });
4901  };
4902
4903  var fireEvent = function fireEvent(eventName, data) {
4904    var customEvent = void 0;
4905
4906    if (detect.ie11()) {
4907      customEvent = document.createEvent('CustomEvent');
4908      customEvent.initCustomEvent(eventName, true, true, { detail: data });
4909    } else {
4910      customEvent = new CustomEvent(eventName, {
4911        detail: data
4912      });
4913    }
4914
4915    return document.dispatchEvent(customEvent);
4916  };
4917
4918  /**
4919   * Set or remove aos-animate class
4920   * @param {node} el         element
4921   * @param {int}  top        scrolled distance
4922   */
4923  var applyClasses = function applyClasses(el, top) {
4924    var options = el.options,
4925        position = el.position,
4926        node = el.node,
4927        data = el.data;
4928
4929
4930    var hide = function hide() {
4931      if (!el.animated) return;
4932
4933      removeClasses(node, options.animatedClassNames);
4934      fireEvent('aos:out', node);
4935
4936      if (el.options.id) {
4937        fireEvent('aos:in:' + el.options.id, node);
4938      }
4939
4940      el.animated = false;
4941    };
4942
4943    var show = function show() {
4944      if (el.animated) return;
4945
4946      addClasses(node, options.animatedClassNames);
4947
4948      fireEvent('aos:in', node);
4949      if (el.options.id) {
4950        fireEvent('aos:in:' + el.options.id, node);
4951      }
4952
4953      el.animated = true;
4954    };
4955
4956    if (options.mirror && top >= position.out && !options.once) {
4957      hide();
4958    } else if (top >= position.in) {
4959      show();
4960    } else if (el.animated && !options.once) {
4961      hide();
4962    }
4963  };
4964
4965  /**
4966   * Scroll logic - add or remove 'aos-animate' class on scroll
4967   *
4968   * @param  {array} $elements         array of elements nodes
4969   * @return {void}
4970   */
4971  var handleScroll = function handleScroll($elements) {
4972    return $elements.forEach(function (el, i) {
4973      return applyClasses(el, window.pageYOffset);
4974    });
4975  };
4976
4977  /**
4978   * Get offset of DOM element
4979   * like there were no transforms applied on it
4980   *
4981   * @param  {Node} el [DOM element]
4982   * @return {Object} [top and left offset]
4983   */
4984  var offset = function offset(el) {
4985    var _x = 0;
4986    var _y = 0;
4987
4988    while (el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop)) {
4989      _x += el.offsetLeft - (el.tagName != 'BODY' ? el.scrollLeft : 0);
4990      _y += el.offsetTop - (el.tagName != 'BODY' ? el.scrollTop : 0);
4991      el = el.offsetParent;
4992    }
4993
4994    return {
4995      top: _y,
4996      left: _x
4997    };
4998  };
4999
5000  /**
5001   * Get inline option with a fallback.
5002   *
5003   * @param  {Node} el [Dom element]
5004   * @param  {String} key [Option key]
5005   * @param  {String} fallback [Default (fallback) value]
5006   * @return {Mixed} [Option set with inline attributes or fallback value if not set]
5007   */
5008
5009  var getInlineOption = (function (el, key, fallback) {
5010    var attr = el.getAttribute('data-aos-' + key);
5011
5012    if (typeof attr !== 'undefined') {
5013      if (attr === 'true') {
5014        return true;
5015      } else if (attr === 'false') {
5016        return false;
5017      }
5018    }
5019
5020    return attr || fallback;
5021  });
5022
5023  /**
5024   * Calculate offset
5025   * basing on element's settings like:
5026   * - anchor
5027   * - offset
5028   *
5029   * @param  {Node} el [Dom element]
5030   * @return {Integer} [Final offset that will be used to trigger animation in good position]
5031   */
5032
5033  var getPositionIn = function getPositionIn(el, defaultOffset, defaultAnchorPlacement) {
5034    var windowHeight = window.innerHeight;
5035    var anchor = getInlineOption(el, 'anchor');
5036    var inlineAnchorPlacement = getInlineOption(el, 'anchor-placement');
5037    var additionalOffset = Number(getInlineOption(el, 'offset', inlineAnchorPlacement ? 0 : defaultOffset));
5038    var anchorPlacement = inlineAnchorPlacement || defaultAnchorPlacement;
5039    var finalEl = el;
5040
5041    if (anchor && document.querySelectorAll(anchor)) {
5042      finalEl = document.querySelectorAll(anchor)[0];
5043    }
5044
5045    var triggerPoint = offset(finalEl).top - windowHeight;
5046
5047    switch (anchorPlacement) {
5048      case 'top-bottom':
5049        // Default offset
5050        break;
5051      case 'center-bottom':
5052        triggerPoint += finalEl.offsetHeight / 2;
5053        break;
5054      case 'bottom-bottom':
5055        triggerPoint += finalEl.offsetHeight;
5056        break;
5057      case 'top-center':
5058        triggerPoint += windowHeight / 2;
5059        break;
5060      case 'center-center':
5061        triggerPoint += windowHeight / 2 + finalEl.offsetHeight / 2;
5062        break;
5063      case 'bottom-center':
5064        triggerPoint += windowHeight / 2 + finalEl.offsetHeight;
5065        break;
5066      case 'top-top':
5067        triggerPoint += windowHeight;
5068        break;
5069      case 'bottom-top':
5070        triggerPoint += windowHeight + finalEl.offsetHeight;
5071        break;
5072      case 'center-top':
5073        triggerPoint += windowHeight + finalEl.offsetHeight / 2;
5074        break;
5075    }
5076
5077    return triggerPoint + additionalOffset;
5078  };
5079
5080  var getPositionOut = function getPositionOut(el, defaultOffset) {
5081    var anchor = getInlineOption(el, 'anchor');
5082    var additionalOffset = getInlineOption(el, 'offset', defaultOffset);
5083    var finalEl = el;
5084
5085    if (anchor && document.querySelectorAll(anchor)) {
5086      finalEl = document.querySelectorAll(anchor)[0];
5087    }
5088
5089    var elementOffsetTop = offset(finalEl).top;
5090
5091    return elementOffsetTop + finalEl.offsetHeight - additionalOffset;
5092  };
5093
5094  /* Clearing variables */
5095
5096  var prepare = function prepare($elements, options) {
5097    $elements.forEach(function (el, i) {
5098      var mirror = getInlineOption(el.node, 'mirror', options.mirror);
5099      var once = getInlineOption(el.node, 'once', options.once);
5100      var id = getInlineOption(el.node, 'id');
5101      var customClassNames = options.useClassNames && el.node.getAttribute('data-aos');
5102
5103      var animatedClassNames = [options.animatedClassName].concat(customClassNames ? customClassNames.split(' ') : []).filter(function (className) {
5104        return typeof className === 'string';
5105      });
5106
5107      if (options.initClassName) {
5108        el.node.classList.add(options.initClassName);
5109      }
5110
5111      el.position = {
5112        in: getPositionIn(el.node, options.offset, options.anchorPlacement),
5113        out: mirror && getPositionOut(el.node, options.offset)
5114      };
5115
5116      el.options = {
5117        once: once,
5118        mirror: mirror,
5119        animatedClassNames: animatedClassNames,
5120        id: id
5121      };
5122    });
5123
5124    return $elements;
5125  };
5126
5127  /**
5128   * Generate initial array with elements as objects
5129   * This array will be extended later with elements attributes values
5130   * like 'position'
5131   */
5132  var elements = (function () {
5133    var elements = document.querySelectorAll('[data-aos]');
5134    return Array.prototype.map.call(elements, function (node) {
5135      return { node: node };
5136    });
5137  });
5138
5139  /**
5140   * *******************************************************
5141   * AOS (Animate on scroll) - wowjs alternative
5142   * made to animate elements on scroll in both directions
5143   * *******************************************************
5144   */
5145
5146  /**
5147   * Private variables
5148   */
5149  var $aosElements = [];
5150  var initialized = false;
5151
5152  /**
5153   * Default options
5154   */
5155  var options = {
5156    offset: 120,
5157    delay: 0,
5158    easing: 'ease',
5159    duration: 400,
5160    disable: false,
5161    once: false,
5162    mirror: false,
5163    anchorPlacement: 'top-bottom',
5164    startEvent: 'DOMContentLoaded',
5165    animatedClassName: 'aos-animate',
5166    initClassName: 'aos-init',
5167    useClassNames: false,
5168    disableMutationObserver: false,
5169    throttleDelay: 99,
5170    debounceDelay: 50
5171  };
5172
5173  // Detect not supported browsers (<=IE9)
5174  // http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
5175  var isBrowserNotSupported = function isBrowserNotSupported() {
5176    return document.all && !window.atob;
5177  };
5178
5179  var initializeScroll = function initializeScroll() {
5180    // Extend elements objects in $aosElements with their positions
5181    $aosElements = prepare($aosElements, options);
5182    // Perform scroll event, to refresh view and show/hide elements
5183    handleScroll($aosElements);
5184
5185    /**
5186     * Handle scroll event to animate elements on scroll
5187     */
5188    window.addEventListener('scroll', lodash_throttle(function () {
5189      handleScroll($aosElements, options.once);
5190    }, options.throttleDelay));
5191
5192    return $aosElements;
5193  };
5194
5195  /**
5196   * Refresh AOS
5197   */
5198  var refresh = function refresh() {
5199    var initialize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
5200
5201    // Allow refresh only when it was first initialized on startEvent
5202    if (initialize) initialized = true;
5203    if (initialized) initializeScroll();
5204  };
5205
5206  /**
5207   * Hard refresh
5208   * create array with new elements and trigger refresh
5209   */
5210  var refreshHard = function refreshHard() {
5211    $aosElements = elements();
5212
5213    if (isDisabled(options.disable) || isBrowserNotSupported()) {
5214      return disable();
5215    }
5216
5217    refresh();
5218  };
5219
5220  /**
5221   * Disable AOS
5222   * Remove all attributes to reset applied styles
5223   */
5224  var disable = function disable() {
5225    $aosElements.forEach(function (el, i) {
5226      el.node.removeAttribute('data-aos');
5227      el.node.removeAttribute('data-aos-easing');
5228      el.node.removeAttribute('data-aos-duration');
5229      el.node.removeAttribute('data-aos-delay');
5230
5231      if (options.initClassName) {
5232        el.node.classList.remove(options.initClassName);
5233      }
5234
5235      if (options.animatedClassName) {
5236        el.node.classList.remove(options.animatedClassName);
5237      }
5238    });
5239  };
5240
5241  /**
5242   * Check if AOS should be disabled based on provided setting
5243   */
5244  var isDisabled = function isDisabled(optionDisable) {
5245    return optionDisable === true || optionDisable === 'mobile' && detect.mobile() || optionDisable === 'phone' && detect.phone() || optionDisable === 'tablet' && detect.tablet() || typeof optionDisable === 'function' && optionDisable() === true;
5246  };
5247
5248  /**
5249   * Initializing AOS
5250   * - Create options merging defaults with user defined options
5251   * - Set attributes on <body> as global setting - css relies on it
5252   * - Attach preparing elements to options.startEvent,
5253   *   window resize and orientation change
5254   * - Attach function that handle scroll and everything connected to it
5255   *   to window scroll event and fire once document is ready to set initial state
5256   */
5257  var init = function init(settings) {
5258    options = _extends(options, settings);
5259
5260    // Create initial array with elements -> to be fullfilled later with prepare()
5261    $aosElements = elements();
5262
5263    /**
5264     * Disable mutation observing if not supported
5265     */
5266    if (!options.disableMutationObserver && !observer.isSupported()) {
5267      console.info('\n      aos: MutationObserver is not supported on this browser,\n      code mutations observing has been disabled.\n      You may have to call "refreshHard()" by yourself.\n    ');
5268      options.disableMutationObserver = true;
5269    }
5270
5271    /**
5272     * Observe [aos] elements
5273     * If something is loaded by AJAX
5274     * it'll refresh plugin automatically
5275     */
5276    if (!options.disableMutationObserver) {
5277      observer.ready('[data-aos]', refreshHard);
5278    }
5279
5280    /**
5281     * Don't init plugin if option `disable` is set
5282     * or when browser is not supported
5283     */
5284    if (isDisabled(options.disable) || isBrowserNotSupported()) {
5285      return disable();
5286    }
5287
5288    /**
5289     * Set global settings on body, based on options
5290     * so CSS can use it
5291     */
5292    document.querySelector('body').setAttribute('data-aos-easing', options.easing);
5293
5294    document.querySelector('body').setAttribute('data-aos-duration', options.duration);
5295
5296    document.querySelector('body').setAttribute('data-aos-delay', options.delay);
5297
5298    /**
5299     * Handle initializing
5300     */
5301    if (['DOMContentLoaded', 'load'].indexOf(options.startEvent) === -1) {
5302      // Listen to options.startEvent and initialize AOS
5303      document.addEventListener(options.startEvent, function () {
5304        refresh(true);
5305      });
5306    } else {
5307      window.addEventListener('load', function () {
5308        refresh(true);
5309      });
5310    }
5311
5312    if (options.startEvent === 'DOMContentLoaded' && ['complete', 'interactive'].indexOf(document.readyState) > -1) {
5313      // Initialize AOS if default startEvent was already fired
5314      refresh(true);
5315    }
5316
5317    /**
5318     * Refresh plugin on window resize or orientation change
5319     */
5320    window.addEventListener('resize', lodash_debounce(refresh, options.debounceDelay, true));
5321
5322    window.addEventListener('orientationchange', lodash_debounce(refresh, options.debounceDelay, true));
5323
5324    return $aosElements;
5325  };
5326
5327  /**
5328   * Export Public API
5329   */
5330
5331  var aos = {
5332    init: init,
5333    refresh: refresh,
5334    refreshHard: refreshHard
5335  };
5336
5337  if (document.querySelector('.glide')) {
5338    var glide = new Glide('.glide', {
5339      autoplay: 3000,
5340      gap: 0
5341    });
5342
5343    glide.mount();
5344  }
5345
5346  aos.init();
5347
5348  aos.init({
5349    offset: 200, // offset (in px) from the original trigger point
5350    delay: 0, // values from 0 to 3000, with step 50ms
5351    duration: 500, // values from 0 to 3000, with step 50ms
5352    easing: 'ease-in-out', // default easing for AOS animations
5353  });
5354
5355
5356
5357
5358  function handleTextNode(textNode) {
5359      if(textNode.nodeName !== '#text'
5360          || textNode.parentNode.nodeName === 'SCRIPT'
5361          || textNode.parentNode.nodeName === 'STYLE'
5362      ) {
5363          //Don't do anything except on text nodes, which are not children
5364          //  of <script> or <style>.
5365          return;
5366      }
5367      let origText = textNode.textContent;
5368      let newHtml=origText.replace(/\u00AE/gi
5369                                   ,'<sup>\u00AE</sup>');
5370      //Only change the DOM if we actually made a replacement in the text.
5371      //Compare the strings, as it should be faster than a second RegExp operation and
5372      //  lets us use the RegExp in only one place for maintainability.
5373      if( newHtml !== origText) {
5374          let newSpan = document.createElement('span');
5375          newSpan.innerHTML = newHtml;
5376          textNode.parentNode.replaceChild(newSpan,textNode);
5377      }
5378  }
5379
5380  let textNodes = [];
5381  //Create a NodeIterator to get the text nodes in the body of the document
5382  let nodeIter = document.createNodeIterator(document.body,NodeFilter.SHOW_TEXT);
5383  let currentNode;
5384  //Add the text nodes found to the list of text nodes to process.
5385  while(currentNode = nodeIter.nextNode()) {
5386      textNodes.push(currentNode);
5387  }
5388  //Process each text node
5389  textNodes.forEach(function(el){
5390      handleTextNode(el);
5391  });
5392
5393}());
5394//# sourceMappingURL=bundle.js.map

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.