bootstrap.js 125 KB
Newer Older
1
/*!
Mark Otto's avatar
Mark Otto committed
2
  * Bootstrap v4.1.3 (https://getbootstrap.com/)
Mark Otto's avatar
dist    
Mark Otto committed
3
  * Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
Mark Otto's avatar
dist    
Mark Otto committed
4
5
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  */
Mark Otto's avatar
dist    
Mark Otto committed
6
(function (global, factory) {
Mark Otto's avatar
dist    
Mark Otto committed
7
8
9
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) :
  typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
  (factory((global.bootstrap = {}),global.jQuery,global.Popper));
Mark Otto's avatar
dist    
Mark Otto committed
10
}(this, (function (exports,$,Popper) { 'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
11

Mark Otto's avatar
dist    
Mark Otto committed
12
13
  $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
Jacob Thornton's avatar
Jacob Thornton committed
14

Mark Otto's avatar
dist    
Mark Otto committed
15
16
17
18
19
20
21
22
  function _defineProperties(target, props) {
    for (var i = 0; i < props.length; i++) {
      var descriptor = props[i];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor) descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
Mark Otto's avatar
Mark Otto committed
23
24
  }

Mark Otto's avatar
dist    
Mark Otto committed
25
26
27
28
29
  function _createClass(Constructor, protoProps, staticProps) {
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
    if (staticProps) _defineProperties(Constructor, staticProps);
    return Constructor;
  }
Mark Otto's avatar
dist    
Mark Otto committed
30

Mark Otto's avatar
dist    
Mark Otto committed
31
32
33
34
35
36
37
38
39
40
  function _defineProperty(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
Mark Otto's avatar
dist    
Mark Otto committed
41
42
    }

Mark Otto's avatar
dist    
Mark Otto committed
43
    return obj;
Jacob Thornton's avatar
Jacob Thornton committed
44
45
  }

Mark Otto's avatar
dist    
Mark Otto committed
46
47
48
49
  function _objectSpread(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i] != null ? arguments[i] : {};
      var ownKeys = Object.keys(source);
Mark Otto's avatar
dist    
Mark Otto committed
50

Mark Otto's avatar
dist    
Mark Otto committed
51
52
53
54
      if (typeof Object.getOwnPropertySymbols === 'function') {
        ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
          return Object.getOwnPropertyDescriptor(source, sym).enumerable;
        }));
Jacob Thornton's avatar
Jacob Thornton committed
55
56
      }

Mark Otto's avatar
dist    
Mark Otto committed
57
58
59
      ownKeys.forEach(function (key) {
        _defineProperty(target, key, source[key]);
      });
Jacob Thornton's avatar
Jacob Thornton committed
60
61
    }

Mark Otto's avatar
dist    
Mark Otto committed
62
    return target;
Jacob Thornton's avatar
Jacob Thornton committed
63
64
  }

Mark Otto's avatar
dist    
Mark Otto committed
65
66
67
68
  function _inheritsLoose(subClass, superClass) {
    subClass.prototype = Object.create(superClass.prototype);
    subClass.prototype.constructor = subClass;
    subClass.__proto__ = superClass;
Jacob Thornton's avatar
Jacob Thornton committed
69
70
71
72
  }

  /**
   * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
73
   * Bootstrap (v4.1.3): util.js
Mark Otto's avatar
dist    
Mark Otto committed
74
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
Jacob Thornton's avatar
Jacob Thornton committed
75
76
77
   * --------------------------------------------------------------------------
   */

XhmikosR's avatar
Dist    
XhmikosR committed
78
79
80
81
82
  /**
   * ------------------------------------------------------------------------
   * Private TransitionEnd Helpers
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
83

XhmikosR's avatar
Dist    
XhmikosR committed
84
85
86
  var TRANSITION_END = 'transitionend';
  var MAX_UID = 1000000;
  var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
Jacob Thornton's avatar
Jacob Thornton committed
87

XhmikosR's avatar
Dist    
XhmikosR committed
88
89
90
  function toType(obj) {
    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  }
Mark Otto's avatar
dist    
Mark Otto committed
91

XhmikosR's avatar
Dist    
XhmikosR committed
92
93
94
95
96
97
98
  function getSpecialTransitionEndEvent() {
    return {
      bindType: TRANSITION_END,
      delegateType: TRANSITION_END,
      handle: function handle(event) {
        if ($(event.target).is(this)) {
          return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
Mark Otto's avatar
dist    
Mark Otto committed
99
        }
Mark Otto's avatar
dist    
Mark Otto committed
100

XhmikosR's avatar
Dist    
XhmikosR committed
101
102
103
104
        return undefined; // eslint-disable-line no-undefined
      }
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
105

XhmikosR's avatar
Dist    
XhmikosR committed
106
107
  function transitionEndEmulator(duration) {
    var _this = this;
Mark Otto's avatar
dist    
Mark Otto committed
108

XhmikosR's avatar
Dist    
XhmikosR committed
109
110
111
112
113
114
115
116
117
118
119
    var called = false;
    $(this).one(Util.TRANSITION_END, function () {
      called = true;
    });
    setTimeout(function () {
      if (!called) {
        Util.triggerTransitionEnd(_this);
      }
    }, duration);
    return this;
  }
Mark Otto's avatar
dist    
Mark Otto committed
120

XhmikosR's avatar
Dist    
XhmikosR committed
121
122
123
124
125
126
127
128
129
  function setTransitionEndSupport() {
    $.fn.emulateTransitionEnd = transitionEndEmulator;
    $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  }
  /**
   * --------------------------------------------------------------------------
   * Public Util Api
   * --------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
130

XhmikosR's avatar
Dist    
XhmikosR committed
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193

  var Util = {
    TRANSITION_END: 'bsTransitionEnd',
    getUID: function getUID(prefix) {
      do {
        // eslint-disable-next-line no-bitwise
        prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
      } while (document.getElementById(prefix));

      return prefix;
    },
    getSelectorFromElement: function getSelectorFromElement(element) {
      var selector = element.getAttribute('data-target');

      if (!selector || selector === '#') {
        var hrefAttr = element.getAttribute('href');
        selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
      }

      return selector && document.querySelector(selector) ? selector : null;
    },
    getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
      if (!element) {
        return 0;
      } // Get transition-duration of the element


      var transitionDuration = $(element).css('transition-duration');
      var transitionDelay = $(element).css('transition-delay');
      var floatTransitionDuration = parseFloat(transitionDuration);
      var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found

      if (!floatTransitionDuration && !floatTransitionDelay) {
        return 0;
      } // If multiple durations are defined, take the first


      transitionDuration = transitionDuration.split(',')[0];
      transitionDelay = transitionDelay.split(',')[0];
      return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
    },
    reflow: function reflow(element) {
      return element.offsetHeight;
    },
    triggerTransitionEnd: function triggerTransitionEnd(element) {
      $(element).trigger(TRANSITION_END);
    },
    // TODO: Remove in v5
    supportsTransitionEnd: function supportsTransitionEnd() {
      return Boolean(TRANSITION_END);
    },
    isElement: function isElement(obj) {
      return (obj[0] || obj).nodeType;
    },
    typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
      for (var property in configTypes) {
        if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
          var expectedTypes = configTypes[property];
          var value = config[property];
          var valueType = value && Util.isElement(value) ? 'element' : toType(value);

          if (!new RegExp(expectedTypes).test(valueType)) {
            throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
Jacob Thornton's avatar
Jacob Thornton committed
194
          }
Jacob Thornton's avatar
Jacob Thornton committed
195
196
        }
      }
XhmikosR's avatar
Dist    
XhmikosR committed
197
198
199
    }
  };
  setTransitionEndSupport();
Mark Otto's avatar
dist    
Mark Otto committed
200

Jacob Thornton's avatar
Jacob Thornton committed
201
  /**
Mark Otto's avatar
dist    
Mark Otto committed
202
   * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
203
   * Bootstrap (v4.1.3): alert.js
Mark Otto's avatar
dist    
Mark Otto committed
204
205
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
206
   */
Mark Otto's avatar
dist    
Mark Otto committed
207

XhmikosR's avatar
Dist    
XhmikosR committed
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME = 'alert';
  var VERSION = '4.1.3';
  var DATA_KEY = 'bs.alert';
  var EVENT_KEY = "." + DATA_KEY;
  var DATA_API_KEY = '.data-api';
  var JQUERY_NO_CONFLICT = $.fn[NAME];
  var Selector = {
    DISMISS: '[data-dismiss="alert"]'
  };
  var Event = {
    CLOSE: "close" + EVENT_KEY,
    CLOSED: "closed" + EVENT_KEY,
    CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  };
  var ClassName = {
    ALERT: 'alert',
    FADE: 'fade',
    SHOW: 'show'
Mark Otto's avatar
dist    
Mark Otto committed
232
233
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
234
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
235
236
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
237

XhmikosR's avatar
Dist    
XhmikosR committed
238
  };
Jacob Thornton's avatar
Jacob Thornton committed
239

XhmikosR's avatar
Dist    
XhmikosR committed
240
241
242
243
244
245
  var Alert =
  /*#__PURE__*/
  function () {
    function Alert(element) {
      this._element = element;
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
246
247


XhmikosR's avatar
Dist    
XhmikosR committed
248
    var _proto = Alert.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
249

XhmikosR's avatar
Dist    
XhmikosR committed
250
251
252
    // Public
    _proto.close = function close(element) {
      var rootElement = this._element;
Jacob Thornton's avatar
Jacob Thornton committed
253

XhmikosR's avatar
Dist    
XhmikosR committed
254
255
256
      if (element) {
        rootElement = this._getRootElement(element);
      }
Mark Otto's avatar
dist    
Mark Otto committed
257

XhmikosR's avatar
Dist    
XhmikosR committed
258
      var customEvent = this._triggerCloseEvent(rootElement);
Mark Otto's avatar
grunt    
Mark Otto committed
259

XhmikosR's avatar
Dist    
XhmikosR committed
260
261
262
      if (customEvent.isDefaultPrevented()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
263

XhmikosR's avatar
Dist    
XhmikosR committed
264
265
      this._removeElement(rootElement);
    };
Jacob Thornton's avatar
Jacob Thornton committed
266

XhmikosR's avatar
Dist    
XhmikosR committed
267
268
269
270
    _proto.dispose = function dispose() {
      $.removeData(this._element, DATA_KEY);
      this._element = null;
    }; // Private
Mark Otto's avatar
grunt    
Mark Otto committed
271

Jacob Thornton's avatar
Jacob Thornton committed
272

XhmikosR's avatar
Dist    
XhmikosR committed
273
274
275
    _proto._getRootElement = function _getRootElement(element) {
      var selector = Util.getSelectorFromElement(element);
      var parent = false;
Mark Otto's avatar
grunt    
Mark Otto committed
276

XhmikosR's avatar
Dist    
XhmikosR committed
277
278
279
      if (selector) {
        parent = document.querySelector(selector);
      }
Mark Otto's avatar
grunt    
Mark Otto committed
280

XhmikosR's avatar
Dist    
XhmikosR committed
281
282
283
      if (!parent) {
        parent = $(element).closest("." + ClassName.ALERT)[0];
      }
Jacob Thornton's avatar
Jacob Thornton committed
284

XhmikosR's avatar
Dist    
XhmikosR committed
285
286
      return parent;
    };
Jacob Thornton's avatar
Jacob Thornton committed
287

XhmikosR's avatar
Dist    
XhmikosR committed
288
289
290
291
292
    _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
      var closeEvent = $.Event(Event.CLOSE);
      $(element).trigger(closeEvent);
      return closeEvent;
    };
Jacob Thornton's avatar
Jacob Thornton committed
293

XhmikosR's avatar
Dist    
XhmikosR committed
294
295
    _proto._removeElement = function _removeElement(element) {
      var _this = this;
Mark Otto's avatar
grunt    
Mark Otto committed
296

XhmikosR's avatar
Dist    
XhmikosR committed
297
      $(element).removeClass(ClassName.SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
298

XhmikosR's avatar
Dist    
XhmikosR committed
299
300
      if (!$(element).hasClass(ClassName.FADE)) {
        this._destroyElement(element);
Mark Otto's avatar
dist    
Mark Otto committed
301

XhmikosR's avatar
Dist    
XhmikosR committed
302
303
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
304

XhmikosR's avatar
Dist    
XhmikosR committed
305
306
307
308
309
      var transitionDuration = Util.getTransitionDurationFromElement(element);
      $(element).one(Util.TRANSITION_END, function (event) {
        return _this._destroyElement(element, event);
      }).emulateTransitionEnd(transitionDuration);
    };
Jacob Thornton's avatar
Jacob Thornton committed
310

XhmikosR's avatar
Dist    
XhmikosR committed
311
312
313
    _proto._destroyElement = function _destroyElement(element) {
      $(element).detach().trigger(Event.CLOSED).remove();
    }; // Static
Jacob Thornton's avatar
Jacob Thornton committed
314
315


XhmikosR's avatar
Dist    
XhmikosR committed
316
317
318
319
    Alert._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var $element = $(this);
        var data = $element.data(DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
320

XhmikosR's avatar
Dist    
XhmikosR committed
321
322
323
324
        if (!data) {
          data = new Alert(this);
          $element.data(DATA_KEY, data);
        }
Jacob Thornton's avatar
Jacob Thornton committed
325

XhmikosR's avatar
Dist    
XhmikosR committed
326
327
328
329
330
        if (config === 'close') {
          data[config](this);
        }
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
331

XhmikosR's avatar
Dist    
XhmikosR committed
332
333
334
335
336
    Alert._handleDismiss = function _handleDismiss(alertInstance) {
      return function (event) {
        if (event) {
          event.preventDefault();
        }
Jacob Thornton's avatar
Jacob Thornton committed
337

XhmikosR's avatar
Dist    
XhmikosR committed
338
        alertInstance.close(this);
Mark Otto's avatar
grunt    
Mark Otto committed
339
      };
XhmikosR's avatar
Dist    
XhmikosR committed
340
    };
Mark Otto's avatar
grunt    
Mark Otto committed
341

XhmikosR's avatar
Dist    
XhmikosR committed
342
343
344
345
346
347
    _createClass(Alert, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION;
      }
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
348

XhmikosR's avatar
Dist    
XhmikosR committed
349
350
351
352
353
354
355
    return Alert;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
356

Mark Otto's avatar
dist    
Mark Otto committed
357

XhmikosR's avatar
Dist    
XhmikosR committed
358
359
360
361
362
363
  $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
364

XhmikosR's avatar
Dist    
XhmikosR committed
365
366
  $.fn[NAME] = Alert._jQueryInterface;
  $.fn[NAME].Constructor = Alert;
Jacob Thornton's avatar
Jacob Thornton committed
367

XhmikosR's avatar
Dist    
XhmikosR committed
368
369
370
371
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return Alert._jQueryInterface;
  };
Jacob Thornton's avatar
Jacob Thornton committed
372
373

  /**
Mark Otto's avatar
dist    
Mark Otto committed
374
   * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
375
   * Bootstrap (v4.1.3): button.js
Mark Otto's avatar
dist    
Mark Otto committed
376
377
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
378
   */
Mark Otto's avatar
dist    
Mark Otto committed
379

XhmikosR's avatar
Dist    
XhmikosR committed
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$1 = 'button';
  var VERSION$1 = '4.1.3';
  var DATA_KEY$1 = 'bs.button';
  var EVENT_KEY$1 = "." + DATA_KEY$1;
  var DATA_API_KEY$1 = '.data-api';
  var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  var ClassName$1 = {
    ACTIVE: 'active',
    BUTTON: 'btn',
    FOCUS: 'focus'
  };
  var Selector$1 = {
    DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
    DATA_TOGGLE: '[data-toggle="buttons"]',
    INPUT: 'input',
    ACTIVE: '.active',
    BUTTON: '.btn'
  };
  var Event$1 = {
    CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
    FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1)
Mark Otto's avatar
dist    
Mark Otto committed
407
408
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
409
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
410
411
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
412

XhmikosR's avatar
Dist    
XhmikosR committed
413
  };
Jacob Thornton's avatar
Jacob Thornton committed
414

XhmikosR's avatar
Dist    
XhmikosR committed
415
416
417
418
419
420
  var Button =
  /*#__PURE__*/
  function () {
    function Button(element) {
      this._element = element;
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
421
422


XhmikosR's avatar
Dist    
XhmikosR committed
423
    var _proto = Button.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
424

XhmikosR's avatar
Dist    
XhmikosR committed
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
    // Public
    _proto.toggle = function toggle() {
      var triggerChangeEvent = true;
      var addAriaPressed = true;
      var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLE)[0];

      if (rootElement) {
        var input = this._element.querySelector(Selector$1.INPUT);

        if (input) {
          if (input.type === 'radio') {
            if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
              triggerChangeEvent = false;
            } else {
              var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
Jacob Thornton's avatar
Jacob Thornton committed
440

XhmikosR's avatar
Dist    
XhmikosR committed
441
442
              if (activeElement) {
                $(activeElement).removeClass(ClassName$1.ACTIVE);
Mark Otto's avatar
dist    
Mark Otto committed
443
              }
XhmikosR's avatar
Dist    
XhmikosR committed
444
445
            }
          }
Mark Otto's avatar
dist    
Mark Otto committed
446

XhmikosR's avatar
Dist    
XhmikosR committed
447
448
449
          if (triggerChangeEvent) {
            if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
              return;
Johann-S's avatar
build    
Johann-S committed
450
            }
Mark Otto's avatar
dist    
Mark Otto committed
451

XhmikosR's avatar
Dist    
XhmikosR committed
452
453
            input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
            $(input).trigger('change');
Jacob Thornton's avatar
Jacob Thornton committed
454
455
          }

XhmikosR's avatar
Dist    
XhmikosR committed
456
457
          input.focus();
          addAriaPressed = false;
Jacob Thornton's avatar
Jacob Thornton committed
458
        }
XhmikosR's avatar
Dist    
XhmikosR committed
459
      }
Mark Otto's avatar
grunt    
Mark Otto committed
460

XhmikosR's avatar
Dist    
XhmikosR committed
461
462
463
      if (addAriaPressed) {
        this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
      }
Mark Otto's avatar
grunt    
Mark Otto committed
464

XhmikosR's avatar
Dist    
XhmikosR committed
465
466
467
468
      if (triggerChangeEvent) {
        $(this._element).toggleClass(ClassName$1.ACTIVE);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
469

XhmikosR's avatar
Dist    
XhmikosR committed
470
471
472
473
    _proto.dispose = function dispose() {
      $.removeData(this._element, DATA_KEY$1);
      this._element = null;
    }; // Static
Jacob Thornton's avatar
Jacob Thornton committed
474
475


XhmikosR's avatar
Dist    
XhmikosR committed
476
477
478
    Button._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY$1);
Jacob Thornton's avatar
Jacob Thornton committed
479

XhmikosR's avatar
Dist    
XhmikosR committed
480
481
482
483
        if (!data) {
          data = new Button(this);
          $(this).data(DATA_KEY$1, data);
        }
Mark Otto's avatar
grunt    
Mark Otto committed
484

XhmikosR's avatar
Dist    
XhmikosR committed
485
486
        if (config === 'toggle') {
          data[config]();
Mark Otto's avatar
grunt    
Mark Otto committed
487
        }
XhmikosR's avatar
Dist    
XhmikosR committed
488
489
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
490

XhmikosR's avatar
Dist    
XhmikosR committed
491
492
493
494
495
496
    _createClass(Button, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$1;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
497

XhmikosR's avatar
Dist    
XhmikosR committed
498
499
500
501
502
503
504
    return Button;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
505
506


XhmikosR's avatar
Dist    
XhmikosR committed
507
508
509
  $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
    event.preventDefault();
    var button = event.target;
Jacob Thornton's avatar
Jacob Thornton committed
510

XhmikosR's avatar
Dist    
XhmikosR committed
511
512
513
    if (!$(button).hasClass(ClassName$1.BUTTON)) {
      button = $(button).closest(Selector$1.BUTTON);
    }
Mark Otto's avatar
dist    
Mark Otto committed
514

XhmikosR's avatar
Dist    
XhmikosR committed
515
516
517
518
519
520
521
522
523
524
    Button._jQueryInterface.call($(button), 'toggle');
  }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
    var button = $(event.target).closest(Selector$1.BUTTON)[0];
    $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
525

XhmikosR's avatar
Dist    
XhmikosR committed
526
527
  $.fn[NAME$1] = Button._jQueryInterface;
  $.fn[NAME$1].Constructor = Button;
Jacob Thornton's avatar
Jacob Thornton committed
528

XhmikosR's avatar
Dist    
XhmikosR committed
529
530
531
532
  $.fn[NAME$1].noConflict = function () {
    $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
    return Button._jQueryInterface;
  };
Jacob Thornton's avatar
Jacob Thornton committed
533
534

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
535
536
537
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
538
   */
Mark Otto's avatar
dist    
Mark Otto committed
539

XhmikosR's avatar
Dist    
XhmikosR committed
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
  var NAME$2 = 'carousel';
  var VERSION$2 = '4.1.3';
  var DATA_KEY$2 = 'bs.carousel';
  var EVENT_KEY$2 = "." + DATA_KEY$2;
  var DATA_API_KEY$2 = '.data-api';
  var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key

  var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key

  var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch

  var SWIPE_THRESHOLD = 40;
  var Default = {
    interval: 5000,
    keyboard: true,
    slide: false,
    pause: 'hover',
    wrap: true,
    touch: true
  };
  var DefaultType = {
    interval: '(number|boolean)',
    keyboard: 'boolean',
    slide: '(boolean|string)',
    pause: '(string|boolean)',
    wrap: 'boolean',
    touch: 'boolean'
  };
  var Direction = {
    NEXT: 'next',
    PREV: 'prev',
    LEFT: 'left',
    RIGHT: 'right'
  };
  var Event$2 = {
    SLIDE: "slide" + EVENT_KEY$2,
    SLID: "slid" + EVENT_KEY$2,
    KEYDOWN: "keydown" + EVENT_KEY$2,
    MOUSEENTER: "mouseenter" + EVENT_KEY$2,
    MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
    TOUCHSTART: "touchstart" + EVENT_KEY$2,
    TOUCHMOVE: "touchmove" + EVENT_KEY$2,
    TOUCHEND: "touchend" + EVENT_KEY$2,
    POINTERDOWN: "pointerdown" + EVENT_KEY$2,
    POINTERMOVE: "pointermove" + EVENT_KEY$2,
    POINTERUP: "pointerup" + EVENT_KEY$2,
    POINTERLEAVE: "pointerleave" + EVENT_KEY$2,
    POINTERCANCEL: "pointercancel" + EVENT_KEY$2,
    DRAG_START: "dragstart" + EVENT_KEY$2,
    LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
    CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  };
  var ClassName$2 = {
    CAROUSEL: 'carousel',
    ACTIVE: 'active',
    SLIDE: 'slide',
    RIGHT: 'carousel-item-right',
    LEFT: 'carousel-item-left',
    NEXT: 'carousel-item-next',
    PREV: 'carousel-item-prev',
    ITEM: 'carousel-item',
    POINTER_EVENT: 'pointer-event'
  };
  var Selector$2 = {
    ACTIVE: '.active',
    ACTIVE_ITEM: '.active.carousel-item',
    ITEM: '.carousel-item',
    ITEM_IMG: '.carousel-item img',
    NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
    INDICATORS: '.carousel-indicators',
    DATA_SLIDE: '[data-slide], [data-slide-to]',
    DATA_RIDE: '[data-ride="carousel"]'
  };
  var PointerType = {
    TOUCH: 'touch',
    PEN: 'pen'
Mark Otto's avatar
dist    
Mark Otto committed
617
618
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
619
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
620
621
     * ------------------------------------------------------------------------
     */
Mark Otto's avatar
dist    
Mark Otto committed
622

XhmikosR's avatar
Dist    
XhmikosR committed
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
  };

  var Carousel =
  /*#__PURE__*/
  function () {
    function Carousel(element, config) {
      this._items = null;
      this._interval = null;
      this._activeElement = null;
      this._isPaused = false;
      this._isSliding = false;
      this.touchTimeout = null;
      this.touchStartX = 0;
      this.touchDeltaX = 0;
      this._config = this._getConfig(config);
      this._element = element;
      this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
      this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
      this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);

      this._addEventListeners();
    } // Getters


    var _proto = Carousel.prototype;

    // Public
    _proto.next = function next() {
      if (!this._isSliding) {
        this._slide(Direction.NEXT);
      }
Mark Otto's avatar
dist    
Mark Otto committed
654
    };
Jacob Thornton's avatar
Jacob Thornton committed
655

XhmikosR's avatar
Dist    
XhmikosR committed
656
657
658
659
660
661
    _proto.nextWhenVisible = function nextWhenVisible() {
      // Don't call next when the page isn't visible
      // or the carousel or its parent isn't visible
      if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
        this.next();
      }
Mark Otto's avatar
grunt    
Mark Otto committed
662
663
    };

XhmikosR's avatar
Dist    
XhmikosR committed
664
665
666
667
668
    _proto.prev = function prev() {
      if (!this._isSliding) {
        this._slide(Direction.PREV);
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
669

XhmikosR's avatar
Dist    
XhmikosR committed
670
671
672
673
    _proto.pause = function pause(event) {
      if (!event) {
        this._isPaused = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
674

XhmikosR's avatar
Dist    
XhmikosR committed
675
676
677
678
      if (this._element.querySelector(Selector$2.NEXT_PREV)) {
        Util.triggerTransitionEnd(this._element);
        this.cycle(true);
      }
Mark Otto's avatar
grunt    
Mark Otto committed
679

XhmikosR's avatar
Dist    
XhmikosR committed
680
681
682
      clearInterval(this._interval);
      this._interval = null;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
683

XhmikosR's avatar
Dist    
XhmikosR committed
684
685
686
687
    _proto.cycle = function cycle(event) {
      if (!event) {
        this._isPaused = false;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
688

XhmikosR's avatar
Dist    
XhmikosR committed
689
      if (this._interval) {
Mark Otto's avatar
dist    
Mark Otto committed
690
691
        clearInterval(this._interval);
        this._interval = null;
XhmikosR's avatar
Dist    
XhmikosR committed
692
      }
Mark Otto's avatar
grunt    
Mark Otto committed
693

XhmikosR's avatar
Dist    
XhmikosR committed
694
695
696
697
      if (this._config.interval && !this._isPaused) {
        this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
698

XhmikosR's avatar
Dist    
XhmikosR committed
699
700
    _proto.to = function to(index) {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
701

XhmikosR's avatar
Dist    
XhmikosR committed
702
      this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
Jacob Thornton's avatar
Jacob Thornton committed
703

XhmikosR's avatar
Dist    
XhmikosR committed
704
      var activeIndex = this._getItemIndex(this._activeElement);
Jacob Thornton's avatar
Jacob Thornton committed
705

XhmikosR's avatar
Dist    
XhmikosR committed
706
707
708
      if (index > this._items.length - 1 || index < 0) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
709

XhmikosR's avatar
Dist    
XhmikosR committed
710
711
712
713
714
715
      if (this._isSliding) {
        $(this._element).one(Event$2.SLID, function () {
          return _this.to(index);
        });
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
716

XhmikosR's avatar
Dist    
XhmikosR committed
717
718
719
720
721
      if (activeIndex === index) {
        this.pause();
        this.cycle();
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
722

XhmikosR's avatar
Dist    
XhmikosR committed
723
      var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
Mark Otto's avatar
dist    
Mark Otto committed
724

XhmikosR's avatar
Dist    
XhmikosR committed
725
726
      this._slide(direction, this._items[index]);
    };
Mark Otto's avatar
dist    
Mark Otto committed
727

XhmikosR's avatar
Dist    
XhmikosR committed
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
    _proto.dispose = function dispose() {
      $(this._element).off(EVENT_KEY$2);
      $.removeData(this._element, DATA_KEY$2);
      this._items = null;
      this._config = null;
      this._element = null;
      this._interval = null;
      this._isPaused = null;
      this._isSliding = null;
      this._activeElement = null;
      this._indicatorsElement = null;
    }; // Private


    _proto._getConfig = function _getConfig(config) {
      config = _objectSpread({}, Default, config);
      Util.typeCheckConfig(NAME$2, config, DefaultType);
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
747

XhmikosR's avatar
Dist    
XhmikosR committed
748
749
    _proto._handleSwipe = function _handleSwipe() {
      var absDeltax = Math.abs(this.touchDeltaX);
Mark Otto's avatar
dist    
Mark Otto committed
750

XhmikosR's avatar
Dist    
XhmikosR committed
751
752
753
      if (absDeltax <= SWIPE_THRESHOLD) {
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
754

XhmikosR's avatar
Dist    
XhmikosR committed
755
      var direction = absDeltax / this.touchDeltaX; // swipe left
Jacob Thornton's avatar
Jacob Thornton committed
756

XhmikosR's avatar
Dist    
XhmikosR committed
757
758
759
      if (direction > 0) {
        this.prev();
      } // swipe right
Mark Otto's avatar
dist    
Mark Otto committed
760
761


XhmikosR's avatar
Dist    
XhmikosR committed
762
763
764
765
      if (direction < 0) {
        this.next();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
766

XhmikosR's avatar
Dist    
XhmikosR committed
767
768
    _proto._addEventListeners = function _addEventListeners() {
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
769

XhmikosR's avatar
Dist    
XhmikosR committed
770
771
772
773
774
      if (this._config.keyboard) {
        $(this._element).on(Event$2.KEYDOWN, function (event) {
          return _this2._keydown(event);
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
775

XhmikosR's avatar
Dist    
XhmikosR committed
776
777
778
779
780
781
782
      if (this._config.pause === 'hover') {
        $(this._element).on(Event$2.MOUSEENTER, function (event) {
          return _this2.pause(event);
        }).on(Event$2.MOUSELEAVE, function (event) {
          return _this2.cycle(event);
        });
      }
Jacob Thornton's avatar
Jacob Thornton committed
783

XhmikosR's avatar
Dist    
XhmikosR committed
784
785
      this._addTouchEventListeners();
    };
Jacob Thornton's avatar
Jacob Thornton committed
786

XhmikosR's avatar
Dist    
XhmikosR committed
787
788
    _proto._addTouchEventListeners = function _addTouchEventListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
789

XhmikosR's avatar
Dist    
XhmikosR committed
790
791
792
      if (!this._touchSupported) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
793

XhmikosR's avatar
Dist    
XhmikosR committed
794
795
796
797
798
      var start = function start(event) {
        if (_this3._pointerEvent && (event.originalEvent.pointerType === PointerType.TOUCH || event.originalEvent.pointerType === PointerType.PEN)) {
          _this3.touchStartX = event.originalEvent.clientX;
        } else if (!_this3._pointerEvent) {
          _this3.touchStartX = event.originalEvent.touches[0].clientX;
Mark Otto's avatar
dist    
Mark Otto committed
799
800
        }
      };
Jacob Thornton's avatar
Jacob Thornton committed
801

XhmikosR's avatar
Dist    
XhmikosR committed
802
803
804
805
806
807
808
      var move = function move(event) {
        // ensure swiping with one touch and not pinching
        if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
          _this3.touchDeltaX = 0;
        } else {
          _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
        }
Mark Otto's avatar
dist    
Mark Otto committed
809
      };
Jacob Thornton's avatar
Jacob Thornton committed
810

XhmikosR's avatar
Dist    
XhmikosR committed
811
812
813
814
      var end = function end(event) {
        if (_this3._pointerEvent && (event.originalEvent.pointerType === PointerType.TOUCH || event.originalEvent.pointerType === PointerType.PEN)) {
          _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
        }
Jacob Thornton's avatar
Jacob Thornton committed
815

XhmikosR's avatar
Dist    
XhmikosR committed
816
        _this3._handleSwipe();
Mark Otto's avatar
dist    
Mark Otto committed
817

XhmikosR's avatar
Dist    
XhmikosR committed
818
819
820
821
822
823
824
825
826
        if (_this3._config.pause === 'hover') {
          // If it's a touch-enabled device, mouseenter/leave are fired as
          // part of the mouse compatibility events on first tap - the carousel
          // would stop cycling until user tapped out of it;
          // here, we listen for touchend, explicitly pause the carousel
          // (as if it's the second time we tap on it, mouseenter compat event
          // is NOT fired) and after a timeout (to allow for mouse compatibility
          // events to fire) we explicitly restart cycling
          _this3.pause();
Mark Otto's avatar
dist    
Mark Otto committed
827

XhmikosR's avatar
Dist    
XhmikosR committed
828
829
830
          if (_this3.touchTimeout) {
            clearTimeout(_this3.touchTimeout);
          }
Jacob Thornton's avatar
Jacob Thornton committed
831

XhmikosR's avatar
Dist    
XhmikosR committed
832
833
834
835
          _this3.touchTimeout = setTimeout(function (event) {
            return _this3.cycle(event);
          }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
        }
Mark Otto's avatar
dist    
Mark Otto committed
836
      };
Jacob Thornton's avatar
Jacob Thornton committed
837

XhmikosR's avatar
Dist    
XhmikosR committed
838
839
840
      $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
        return e.preventDefault();
      });
Jacob Thornton's avatar
Jacob Thornton committed
841

XhmikosR's avatar
Dist    
XhmikosR committed
842
843
844
845
846
847
848
      if (this._pointerEvent) {
        $(this._element).on(Event$2.POINTERDOWN, function (event) {
          return start(event);
        });
        $(this._element).on(Event$2.POINTERUP, function (event) {
          return end(event);
        });
Jacob Thornton's avatar
Jacob Thornton committed
849

XhmikosR's avatar
Dist    
XhmikosR committed
850
851
852
853
        this._element.classList.add(ClassName$2.POINTER_EVENT);
      } else {
        $(this._element).on(Event$2.TOUCHSTART, function (event) {
          return start(event);
Mark Otto's avatar
dist    
Mark Otto committed
854
        });
XhmikosR's avatar
Dist    
XhmikosR committed
855
856
857
858
859
860
861
862
        $(this._element).on(Event$2.TOUCHMOVE, function (event) {
          return move(event);
        });
        $(this._element).on(Event$2.TOUCHEND, function (event) {
          return end(event);
        });
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
863

XhmikosR's avatar
Dist    
XhmikosR committed
864
865
866
867
    _proto._keydown = function _keydown(event) {
      if (/input|textarea/i.test(event.target.tagName)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
868

XhmikosR's avatar
Dist    
XhmikosR committed
869
870
871
872
873
      switch (event.which) {
        case ARROW_LEFT_KEYCODE:
          event.preventDefault();
          this.prev();
          break;
Mark Otto's avatar
dist    
Mark Otto committed
874

XhmikosR's avatar
Dist    
XhmikosR committed
875
876
877
878
        case ARROW_RIGHT_KEYCODE:
          event.preventDefault();
          this.next();
          break;
Mark Otto's avatar
dist    
Mark Otto committed
879

XhmikosR's avatar
Dist    
XhmikosR committed
880
881
882
        default:
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
883

XhmikosR's avatar
Dist    
XhmikosR committed
884
885
886
887
    _proto._getItemIndex = function _getItemIndex(element) {
      this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
      return this._items.indexOf(element);
    };
Mark Otto's avatar
grunt    
Mark Otto committed
888

XhmikosR's avatar
Dist    
XhmikosR committed
889
890
891
    _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
      var isNextDirection = direction === Direction.NEXT;
      var isPrevDirection = direction === Direction.PREV;
Mark Otto's avatar
grunt    
Mark Otto committed
892

XhmikosR's avatar
Dist    
XhmikosR committed
893
      var activeIndex = this._getItemIndex(activeElement);
Jacob Thornton's avatar
Jacob Thornton committed
894

XhmikosR's avatar
Dist    
XhmikosR committed
895
896
      var lastItemIndex = this._items.length - 1;
      var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
Mark Otto's avatar
dist    
Mark Otto committed
897

XhmikosR's avatar
Dist    
XhmikosR committed
898
899
900
      if (isGoingToWrap && !this._config.wrap) {
        return activeElement;
      }
Jacob Thornton's avatar
Jacob Thornton committed
901

XhmikosR's avatar
Dist    
XhmikosR committed
902
903
904
905
      var delta = direction === Direction.PREV ? -1 : 1;
      var itemIndex = (activeIndex + delta) % this._items.length;
      return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
    };
Jacob Thornton's avatar
Jacob Thornton committed
906

XhmikosR's avatar
Dist    
XhmikosR committed
907
908
    _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
      var targetIndex = this._getItemIndex(relatedTarget);
Mark Otto's avatar
grunt    
Mark Otto committed
909

XhmikosR's avatar
Dist    
XhmikosR committed
910
      var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
Jacob Thornton's avatar
Jacob Thornton committed
911

XhmikosR's avatar
Dist    
XhmikosR committed
912
913
914
915
916
917
918
919
920
      var slideEvent = $.Event(Event$2.SLIDE, {
        relatedTarget: relatedTarget,
        direction: eventDirectionName,
        from: fromIndex,
        to: targetIndex
      });
      $(this._element).trigger(slideEvent);
      return slideEvent;
    };
Jacob Thornton's avatar
Jacob Thornton committed
921

XhmikosR's avatar
Dist    
XhmikosR committed
922
923
924
925
    _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
      if (this._indicatorsElement) {
        var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
        $(indicators).removeClass(ClassName$2.ACTIVE);
Jacob Thornton's avatar
Jacob Thornton committed
926

XhmikosR's avatar
Dist    
XhmikosR committed
927
        var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
Jacob Thornton's avatar
Jacob Thornton committed
928

XhmikosR's avatar
Dist    
XhmikosR committed
929
930
        if (nextIndicator) {
          $(nextIndicator).addClass(ClassName$2.ACTIVE);
Mark Otto's avatar
dist    
Mark Otto committed
931
        }
XhmikosR's avatar
Dist    
XhmikosR committed
932
933
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
934

XhmikosR's avatar
Dist    
XhmikosR committed
935
936
    _proto._slide = function _slide(direction, element) {
      var _this4 = this;
Jacob Thornton's avatar
Jacob Thornton committed
937

XhmikosR's avatar
Dist    
XhmikosR committed
938
      var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
Mark Otto's avatar
dist    
Mark Otto committed
939

XhmikosR's avatar
Dist    
XhmikosR committed
940
      var activeElementIndex = this._getItemIndex(activeElement);
Mark Otto's avatar
dist    
Mark Otto committed
941

XhmikosR's avatar
Dist    
XhmikosR committed
942
      var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
Mark Otto's avatar
dist    
Mark Otto committed
943

XhmikosR's avatar
Dist    
XhmikosR committed
944
      var nextElementIndex = this._getItemIndex(nextElement);
Jacob Thornton's avatar
Jacob Thornton committed
945

XhmikosR's avatar
Dist    
XhmikosR committed
946
947
948
949
      var isCycling = Boolean(this._interval);
      var directionalClassName;
      var orderClassName;
      var eventDirectionName;
Jacob Thornton's avatar
Jacob Thornton committed
950

XhmikosR's avatar
Dist    
XhmikosR committed
951
952
953
954
955
956
957
958
959
      if (direction === Direction.NEXT) {
        directionalClassName = ClassName$2.LEFT;
        orderClassName = ClassName$2.NEXT;
        eventDirectionName = Direction.LEFT;
      } else {
        directionalClassName = ClassName$2.RIGHT;
        orderClassName = ClassName$2.PREV;
        eventDirectionName = Direction.RIGHT;
      }
Jacob Thornton's avatar
Jacob Thornton committed
960

XhmikosR's avatar
Dist    
XhmikosR committed
961
962
963
964
      if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
        this._isSliding = false;
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
965

XhmikosR's avatar
Dist    
XhmikosR committed
966
      var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
Mark Otto's avatar
dist    
Mark Otto committed
967

XhmikosR's avatar
Dist    
XhmikosR committed
968
969
970
      if (slideEvent.isDefaultPrevented()) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
971

XhmikosR's avatar
Dist    
XhmikosR committed
972
973
974
975
      if (!activeElement || !nextElement) {
        // Some weirdness is happening, so we bail
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
976

XhmikosR's avatar
Dist    
XhmikosR committed
977
      this._isSliding = true;
Jacob Thornton's avatar
Jacob Thornton committed
978

XhmikosR's avatar
Dist    
XhmikosR committed
979
980
981
      if (isCycling) {
        this.pause();
      }
Mark Otto's avatar
dist    
Mark Otto committed
982

XhmikosR's avatar
Dist    
XhmikosR committed
983
      this._setActiveIndicatorElement(nextElement);
Mark Otto's avatar
dist    
Mark Otto committed
984

XhmikosR's avatar
Dist    
XhmikosR committed
985
986
987
988
989
990
      var slidEvent = $.Event(Event$2.SLID, {
        relatedTarget: nextElement,
        direction: eventDirectionName,
        from: activeElementIndex,
        to: nextElementIndex
      });
Mark Otto's avatar
dist    
Mark Otto committed
991

XhmikosR's avatar
Dist    
XhmikosR committed
992
993
994
995
996
997
998
999
1000
      if ($(this._element).hasClass(ClassName$2.SLIDE)) {
        $(nextElement).addClass(orderClassName);
        Util.reflow(nextElement);
        $(activeElement).addClass(directionalClassName);
        $(nextElement).addClass(directionalClassName);
        var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);

        if (nextElementInterval) {
          this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
For faster browsing, not all history is shown. View entire blame