Projekt

Obecné

Profil

Stáhnout (223 KB) Statistiky
| Větev: | Revize:
1 5fded919 cagy
/*!
2
  * Bootstrap v4.4.1 (https://getbootstrap.com/)
3
  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5
  */
6
(function (global, factory) {
7
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) :
8
  typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) :
9
  (global = global || self, factory(global.bootstrap = {}, global.jQuery));
10
}(this, (function (exports, $) { 'use strict';
11
12
  $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
13
14
  function _defineProperties(target, props) {
15
    for (var i = 0; i < props.length; i++) {
16
      var descriptor = props[i];
17
      descriptor.enumerable = descriptor.enumerable || false;
18
      descriptor.configurable = true;
19
      if ("value" in descriptor) descriptor.writable = true;
20
      Object.defineProperty(target, descriptor.key, descriptor);
21
    }
22
  }
23
24
  function _createClass(Constructor, protoProps, staticProps) {
25
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
26
    if (staticProps) _defineProperties(Constructor, staticProps);
27
    return Constructor;
28
  }
29
30
  function _defineProperty(obj, key, value) {
31
    if (key in obj) {
32
      Object.defineProperty(obj, key, {
33
        value: value,
34
        enumerable: true,
35
        configurable: true,
36
        writable: true
37
      });
38
    } else {
39
      obj[key] = value;
40
    }
41
42
    return obj;
43
  }
44
45
  function ownKeys(object, enumerableOnly) {
46
    var keys = Object.keys(object);
47
48
    if (Object.getOwnPropertySymbols) {
49
      var symbols = Object.getOwnPropertySymbols(object);
50
      if (enumerableOnly) symbols = symbols.filter(function (sym) {
51
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
52
      });
53
      keys.push.apply(keys, symbols);
54
    }
55
56
    return keys;
57
  }
58
59
  function _objectSpread2(target) {
60
    for (var i = 1; i < arguments.length; i++) {
61
      var source = arguments[i] != null ? arguments[i] : {};
62
63
      if (i % 2) {
64
        ownKeys(Object(source), true).forEach(function (key) {
65
          _defineProperty(target, key, source[key]);
66
        });
67
      } else if (Object.getOwnPropertyDescriptors) {
68
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
69
      } else {
70
        ownKeys(Object(source)).forEach(function (key) {
71
          Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
72
        });
73
      }
74
    }
75
76
    return target;
77
  }
78
79
  function _inheritsLoose(subClass, superClass) {
80
    subClass.prototype = Object.create(superClass.prototype);
81
    subClass.prototype.constructor = subClass;
82
    subClass.__proto__ = superClass;
83
  }
84
85
  /**
86
   * --------------------------------------------------------------------------
87
   * Bootstrap (v4.4.1): util.js
88
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
89
   * --------------------------------------------------------------------------
90
   */
91
  /**
92
   * ------------------------------------------------------------------------
93
   * Private TransitionEnd Helpers
94
   * ------------------------------------------------------------------------
95
   */
96
97
  var TRANSITION_END = 'transitionend';
98
  var MAX_UID = 1000000;
99
  var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
100
101
  function toType(obj) {
102
    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
103
  }
104
105
  function getSpecialTransitionEndEvent() {
106
    return {
107
      bindType: TRANSITION_END,
108
      delegateType: TRANSITION_END,
109
      handle: function handle(event) {
110
        if ($(event.target).is(this)) {
111
          return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
112
        }
113
114
        return undefined; // eslint-disable-line no-undefined
115
      }
116
    };
117
  }
118
119
  function transitionEndEmulator(duration) {
120
    var _this = this;
121
122
    var called = false;
123
    $(this).one(Util.TRANSITION_END, function () {
124
      called = true;
125
    });
126
    setTimeout(function () {
127
      if (!called) {
128
        Util.triggerTransitionEnd(_this);
129
      }
130
    }, duration);
131
    return this;
132
  }
133
134
  function setTransitionEndSupport() {
135
    $.fn.emulateTransitionEnd = transitionEndEmulator;
136
    $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
137
  }
138
  /**
139
   * --------------------------------------------------------------------------
140
   * Public Util Api
141
   * --------------------------------------------------------------------------
142
   */
143
144
145
  var Util = {
146
    TRANSITION_END: 'bsTransitionEnd',
147
    getUID: function getUID(prefix) {
148
      do {
149
        // eslint-disable-next-line no-bitwise
150
        prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
151
      } while (document.getElementById(prefix));
152
153
      return prefix;
154
    },
155
    getSelectorFromElement: function getSelectorFromElement(element) {
156
      var selector = element.getAttribute('data-target');
157
158
      if (!selector || selector === '#') {
159
        var hrefAttr = element.getAttribute('href');
160
        selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
161
      }
162
163
      try {
164
        return document.querySelector(selector) ? selector : null;
165
      } catch (err) {
166
        return null;
167
      }
168
    },
169
    getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
170
      if (!element) {
171
        return 0;
172
      } // Get transition-duration of the element
173
174
175
      var transitionDuration = $(element).css('transition-duration');
176
      var transitionDelay = $(element).css('transition-delay');
177
      var floatTransitionDuration = parseFloat(transitionDuration);
178
      var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
179
180
      if (!floatTransitionDuration && !floatTransitionDelay) {
181
        return 0;
182
      } // If multiple durations are defined, take the first
183
184
185
      transitionDuration = transitionDuration.split(',')[0];
186
      transitionDelay = transitionDelay.split(',')[0];
187
      return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
188
    },
189
    reflow: function reflow(element) {
190
      return element.offsetHeight;
191
    },
192
    triggerTransitionEnd: function triggerTransitionEnd(element) {
193
      $(element).trigger(TRANSITION_END);
194
    },
195
    // TODO: Remove in v5
196
    supportsTransitionEnd: function supportsTransitionEnd() {
197
      return Boolean(TRANSITION_END);
198
    },
199
    isElement: function isElement(obj) {
200
      return (obj[0] || obj).nodeType;
201
    },
202
    typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
203
      for (var property in configTypes) {
204
        if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
205
          var expectedTypes = configTypes[property];
206
          var value = config[property];
207
          var valueType = value && Util.isElement(value) ? 'element' : toType(value);
208
209
          if (!new RegExp(expectedTypes).test(valueType)) {
210
            throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
211
          }
212
        }
213
      }
214
    },
215
    findShadowRoot: function findShadowRoot(element) {
216
      if (!document.documentElement.attachShadow) {
217
        return null;
218
      } // Can find the shadow root otherwise it'll return the document
219
220
221
      if (typeof element.getRootNode === 'function') {
222
        var root = element.getRootNode();
223
        return root instanceof ShadowRoot ? root : null;
224
      }
225
226
      if (element instanceof ShadowRoot) {
227
        return element;
228
      } // when we don't find a shadow root
229
230
231
      if (!element.parentNode) {
232
        return null;
233
      }
234
235
      return Util.findShadowRoot(element.parentNode);
236
    },
237
    jQueryDetection: function jQueryDetection() {
238
      if (typeof $ === 'undefined') {
239
        throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
240
      }
241
242
      var version = $.fn.jquery.split(' ')[0].split('.');
243
      var minMajor = 1;
244
      var ltMajor = 2;
245
      var minMinor = 9;
246
      var minPatch = 1;
247
      var maxMajor = 4;
248
249
      if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
250
        throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
251
      }
252
    }
253
  };
254
  Util.jQueryDetection();
255
  setTransitionEndSupport();
256
257
  /**
258
   * ------------------------------------------------------------------------
259
   * Constants
260
   * ------------------------------------------------------------------------
261
   */
262
263
  var NAME = 'alert';
264
  var VERSION = '4.4.1';
265
  var DATA_KEY = 'bs.alert';
266
  var EVENT_KEY = "." + DATA_KEY;
267
  var DATA_API_KEY = '.data-api';
268
  var JQUERY_NO_CONFLICT = $.fn[NAME];
269
  var Selector = {
270
    DISMISS: '[data-dismiss="alert"]'
271
  };
272
  var Event = {
273
    CLOSE: "close" + EVENT_KEY,
274
    CLOSED: "closed" + EVENT_KEY,
275
    CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
276
  };
277
  var ClassName = {
278
    ALERT: 'alert',
279
    FADE: 'fade',
280
    SHOW: 'show'
281
  };
282
  /**
283
   * ------------------------------------------------------------------------
284
   * Class Definition
285
   * ------------------------------------------------------------------------
286
   */
287
288
  var Alert =
289
  /*#__PURE__*/
290
  function () {
291
    function Alert(element) {
292
      this._element = element;
293
    } // Getters
294
295
296
    var _proto = Alert.prototype;
297
298
    // Public
299
    _proto.close = function close(element) {
300
      var rootElement = this._element;
301
302
      if (element) {
303
        rootElement = this._getRootElement(element);
304
      }
305
306
      var customEvent = this._triggerCloseEvent(rootElement);
307
308
      if (customEvent.isDefaultPrevented()) {
309
        return;
310
      }
311
312
      this._removeElement(rootElement);
313
    };
314
315
    _proto.dispose = function dispose() {
316
      $.removeData(this._element, DATA_KEY);
317
      this._element = null;
318
    } // Private
319
    ;
320
321
    _proto._getRootElement = function _getRootElement(element) {
322
      var selector = Util.getSelectorFromElement(element);
323
      var parent = false;
324
325
      if (selector) {
326
        parent = document.querySelector(selector);
327
      }
328
329
      if (!parent) {
330
        parent = $(element).closest("." + ClassName.ALERT)[0];
331
      }
332
333
      return parent;
334
    };
335
336
    _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
337
      var closeEvent = $.Event(Event.CLOSE);
338
      $(element).trigger(closeEvent);
339
      return closeEvent;
340
    };
341
342
    _proto._removeElement = function _removeElement(element) {
343
      var _this = this;
344
345
      $(element).removeClass(ClassName.SHOW);
346
347
      if (!$(element).hasClass(ClassName.FADE)) {
348
        this._destroyElement(element);
349
350
        return;
351
      }
352
353
      var transitionDuration = Util.getTransitionDurationFromElement(element);
354
      $(element).one(Util.TRANSITION_END, function (event) {
355
        return _this._destroyElement(element, event);
356
      }).emulateTransitionEnd(transitionDuration);
357
    };
358
359
    _proto._destroyElement = function _destroyElement(element) {
360
      $(element).detach().trigger(Event.CLOSED).remove();
361
    } // Static
362
    ;
363
364
    Alert._jQueryInterface = function _jQueryInterface(config) {
365
      return this.each(function () {
366
        var $element = $(this);
367
        var data = $element.data(DATA_KEY);
368
369
        if (!data) {
370
          data = new Alert(this);
371
          $element.data(DATA_KEY, data);
372
        }
373
374
        if (config === 'close') {
375
          data[config](this);
376
        }
377
      });
378
    };
379
380
    Alert._handleDismiss = function _handleDismiss(alertInstance) {
381
      return function (event) {
382
        if (event) {
383
          event.preventDefault();
384
        }
385
386
        alertInstance.close(this);
387
      };
388
    };
389
390
    _createClass(Alert, null, [{
391
      key: "VERSION",
392
      get: function get() {
393
        return VERSION;
394
      }
395
    }]);
396
397
    return Alert;
398
  }();
399
  /**
400
   * ------------------------------------------------------------------------
401
   * Data Api implementation
402
   * ------------------------------------------------------------------------
403
   */
404
405
406
  $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
407
  /**
408
   * ------------------------------------------------------------------------
409
   * jQuery
410
   * ------------------------------------------------------------------------
411
   */
412
413
  $.fn[NAME] = Alert._jQueryInterface;
414
  $.fn[NAME].Constructor = Alert;
415
416
  $.fn[NAME].noConflict = function () {
417
    $.fn[NAME] = JQUERY_NO_CONFLICT;
418
    return Alert._jQueryInterface;
419
  };
420
421
  /**
422
   * ------------------------------------------------------------------------
423
   * Constants
424
   * ------------------------------------------------------------------------
425
   */
426
427
  var NAME$1 = 'button';
428
  var VERSION$1 = '4.4.1';
429
  var DATA_KEY$1 = 'bs.button';
430
  var EVENT_KEY$1 = "." + DATA_KEY$1;
431
  var DATA_API_KEY$1 = '.data-api';
432
  var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
433
  var ClassName$1 = {
434
    ACTIVE: 'active',
435
    BUTTON: 'btn',
436
    FOCUS: 'focus'
437
  };
438
  var Selector$1 = {
439
    DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
440
    DATA_TOGGLES: '[data-toggle="buttons"]',
441
    DATA_TOGGLE: '[data-toggle="button"]',
442
    DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
443
    INPUT: 'input:not([type="hidden"])',
444
    ACTIVE: '.active',
445
    BUTTON: '.btn'
446
  };
447
  var Event$1 = {
448
    CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
449
    FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
450
    LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
451
  };
452
  /**
453
   * ------------------------------------------------------------------------
454
   * Class Definition
455
   * ------------------------------------------------------------------------
456
   */
457
458
  var Button =
459
  /*#__PURE__*/
460
  function () {
461
    function Button(element) {
462
      this._element = element;
463
    } // Getters
464
465
466
    var _proto = Button.prototype;
467
468
    // Public
469
    _proto.toggle = function toggle() {
470
      var triggerChangeEvent = true;
471
      var addAriaPressed = true;
472
      var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
473
474
      if (rootElement) {
475
        var input = this._element.querySelector(Selector$1.INPUT);
476
477
        if (input) {
478
          if (input.type === 'radio') {
479
            if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
480
              triggerChangeEvent = false;
481
            } else {
482
              var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
483
484
              if (activeElement) {
485
                $(activeElement).removeClass(ClassName$1.ACTIVE);
486
              }
487
            }
488
          } else if (input.type === 'checkbox') {
489
            if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
490
              triggerChangeEvent = false;
491
            }
492
          } else {
493
            // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
494
            triggerChangeEvent = false;
495
          }
496
497
          if (triggerChangeEvent) {
498
            input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
499
            $(input).trigger('change');
500
          }
501
502
          input.focus();
503
          addAriaPressed = false;
504
        }
505
      }
506
507
      if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
508
        if (addAriaPressed) {
509
          this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
510
        }
511
512
        if (triggerChangeEvent) {
513
          $(this._element).toggleClass(ClassName$1.ACTIVE);
514
        }
515
      }
516
    };
517
518
    _proto.dispose = function dispose() {
519
      $.removeData(this._element, DATA_KEY$1);
520
      this._element = null;
521
    } // Static
522
    ;
523
524
    Button._jQueryInterface = function _jQueryInterface(config) {
525
      return this.each(function () {
526
        var data = $(this).data(DATA_KEY$1);
527
528
        if (!data) {
529
          data = new Button(this);
530
          $(this).data(DATA_KEY$1, data);
531
        }
532
533
        if (config === 'toggle') {
534
          data[config]();
535
        }
536
      });
537
    };
538
539
    _createClass(Button, null, [{
540
      key: "VERSION",
541
      get: function get() {
542
        return VERSION$1;
543
      }
544
    }]);
545
546
    return Button;
547
  }();
548
  /**
549
   * ------------------------------------------------------------------------
550
   * Data Api implementation
551
   * ------------------------------------------------------------------------
552
   */
553
554
555
  $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
556
    var button = event.target;
557
558
    if (!$(button).hasClass(ClassName$1.BUTTON)) {
559
      button = $(button).closest(Selector$1.BUTTON)[0];
560
    }
561
562
    if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
563
      event.preventDefault(); // work around Firefox bug #1540995
564
    } else {
565
      var inputBtn = button.querySelector(Selector$1.INPUT);
566
567
      if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
568
        event.preventDefault(); // work around Firefox bug #1540995
569
570
        return;
571
      }
572
573
      Button._jQueryInterface.call($(button), 'toggle');
574
    }
575
  }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
576
    var button = $(event.target).closest(Selector$1.BUTTON)[0];
577
    $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
578
  });
579
  $(window).on(Event$1.LOAD_DATA_API, function () {
580
    // ensure correct active class is set to match the controls' actual values/states
581
    // find all checkboxes/readio buttons inside data-toggle groups
582
    var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
583
584
    for (var i = 0, len = buttons.length; i < len; i++) {
585
      var button = buttons[i];
586
      var input = button.querySelector(Selector$1.INPUT);
587
588
      if (input.checked || input.hasAttribute('checked')) {
589
        button.classList.add(ClassName$1.ACTIVE);
590
      } else {
591
        button.classList.remove(ClassName$1.ACTIVE);
592
      }
593
    } // find all button toggles
594
595
596
    buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
597
598
    for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
599
      var _button = buttons[_i];
600
601
      if (_button.getAttribute('aria-pressed') === 'true') {
602
        _button.classList.add(ClassName$1.ACTIVE);
603
      } else {
604
        _button.classList.remove(ClassName$1.ACTIVE);
605
      }
606
    }
607
  });
608
  /**
609
   * ------------------------------------------------------------------------
610
   * jQuery
611
   * ------------------------------------------------------------------------
612
   */
613
614
  $.fn[NAME$1] = Button._jQueryInterface;
615
  $.fn[NAME$1].Constructor = Button;
616
617
  $.fn[NAME$1].noConflict = function () {
618
    $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
619
    return Button._jQueryInterface;
620
  };
621
622
  /**
623
   * ------------------------------------------------------------------------
624
   * Constants
625
   * ------------------------------------------------------------------------
626
   */
627
628
  var NAME$2 = 'carousel';
629
  var VERSION$2 = '4.4.1';
630
  var DATA_KEY$2 = 'bs.carousel';
631
  var EVENT_KEY$2 = "." + DATA_KEY$2;
632
  var DATA_API_KEY$2 = '.data-api';
633
  var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
634
  var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
635
636
  var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
637
638
  var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
639
640
  var SWIPE_THRESHOLD = 40;
641
  var Default = {
642
    interval: 5000,
643
    keyboard: true,
644
    slide: false,
645
    pause: 'hover',
646
    wrap: true,
647
    touch: true
648
  };
649
  var DefaultType = {
650
    interval: '(number|boolean)',
651
    keyboard: 'boolean',
652
    slide: '(boolean|string)',
653
    pause: '(string|boolean)',
654
    wrap: 'boolean',
655
    touch: 'boolean'
656
  };
657
  var Direction = {
658
    NEXT: 'next',
659
    PREV: 'prev',
660
    LEFT: 'left',
661
    RIGHT: 'right'
662
  };
663
  var Event$2 = {
664
    SLIDE: "slide" + EVENT_KEY$2,
665
    SLID: "slid" + EVENT_KEY$2,
666
    KEYDOWN: "keydown" + EVENT_KEY$2,
667
    MOUSEENTER: "mouseenter" + EVENT_KEY$2,
668
    MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
669
    TOUCHSTART: "touchstart" + EVENT_KEY$2,
670
    TOUCHMOVE: "touchmove" + EVENT_KEY$2,
671
    TOUCHEND: "touchend" + EVENT_KEY$2,
672
    POINTERDOWN: "pointerdown" + EVENT_KEY$2,
673
    POINTERUP: "pointerup" + EVENT_KEY$2,
674
    DRAG_START: "dragstart" + EVENT_KEY$2,
675
    LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
676
    CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
677
  };
678
  var ClassName$2 = {
679
    CAROUSEL: 'carousel',
680
    ACTIVE: 'active',
681
    SLIDE: 'slide',
682
    RIGHT: 'carousel-item-right',
683
    LEFT: 'carousel-item-left',
684
    NEXT: 'carousel-item-next',
685
    PREV: 'carousel-item-prev',
686
    ITEM: 'carousel-item',
687
    POINTER_EVENT: 'pointer-event'
688
  };
689
  var Selector$2 = {
690
    ACTIVE: '.active',
691
    ACTIVE_ITEM: '.active.carousel-item',
692
    ITEM: '.carousel-item',
693
    ITEM_IMG: '.carousel-item img',
694
    NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
695
    INDICATORS: '.carousel-indicators',
696
    DATA_SLIDE: '[data-slide], [data-slide-to]',
697
    DATA_RIDE: '[data-ride="carousel"]'
698
  };
699
  var PointerType = {
700
    TOUCH: 'touch',
701
    PEN: 'pen'
702
  };
703
  /**
704
   * ------------------------------------------------------------------------
705
   * Class Definition
706
   * ------------------------------------------------------------------------
707
   */
708
709
  var Carousel =
710
  /*#__PURE__*/
711
  function () {
712
    function Carousel(element, config) {
713
      this._items = null;
714
      this._interval = null;
715
      this._activeElement = null;
716
      this._isPaused = false;
717
      this._isSliding = false;
718
      this.touchTimeout = null;
719
      this.touchStartX = 0;
720
      this.touchDeltaX = 0;
721
      this._config = this._getConfig(config);
722
      this._element = element;
723
      this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
724
      this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
725
      this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
726
727
      this._addEventListeners();
728
    } // Getters
729
730
731
    var _proto = Carousel.prototype;
732
733
    // Public
734
    _proto.next = function next() {
735
      if (!this._isSliding) {
736
        this._slide(Direction.NEXT);
737
      }
738
    };
739
740
    _proto.nextWhenVisible = function nextWhenVisible() {
741
      // Don't call next when the page isn't visible
742
      // or the carousel or its parent isn't visible
743
      if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
744
        this.next();
745
      }
746
    };
747
748
    _proto.prev = function prev() {
749
      if (!this._isSliding) {
750
        this._slide(Direction.PREV);
751
      }
752
    };
753
754
    _proto.pause = function pause(event) {
755
      if (!event) {
756
        this._isPaused = true;
757
      }
758
759
      if (this._element.querySelector(Selector$2.NEXT_PREV)) {
760
        Util.triggerTransitionEnd(this._element);
761
        this.cycle(true);
762
      }
763
764
      clearInterval(this._interval);
765
      this._interval = null;
766
    };
767
768
    _proto.cycle = function cycle(event) {
769
      if (!event) {
770
        this._isPaused = false;
771
      }
772
773
      if (this._interval) {
774
        clearInterval(this._interval);
775
        this._interval = null;
776
      }
777
778
      if (this._config.interval && !this._isPaused) {
779
        this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
780
      }
781
    };
782
783
    _proto.to = function to(index) {
784
      var _this = this;
785
786
      this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
787
788
      var activeIndex = this._getItemIndex(this._activeElement);
789
790
      if (index > this._items.length - 1 || index < 0) {
791
        return;
792
      }
793
794
      if (this._isSliding) {
795
        $(this._element).one(Event$2.SLID, function () {
796
          return _this.to(index);
797
        });
798
        return;
799
      }
800
801
      if (activeIndex === index) {
802
        this.pause();
803
        this.cycle();
804
        return;
805
      }
806
807
      var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
808
809
      this._slide(direction, this._items[index]);
810
    };
811
812
    _proto.dispose = function dispose() {
813
      $(this._element).off(EVENT_KEY$2);
814
      $.removeData(this._element, DATA_KEY$2);
815
      this._items = null;
816
      this._config = null;
817
      this._element = null;
818
      this._interval = null;
819
      this._isPaused = null;
820
      this._isSliding = null;
821
      this._activeElement = null;
822
      this._indicatorsElement = null;
823
    } // Private
824
    ;
825
826
    _proto._getConfig = function _getConfig(config) {
827
      config = _objectSpread2({}, Default, {}, config);
828
      Util.typeCheckConfig(NAME$2, config, DefaultType);
829
      return config;
830
    };
831
832
    _proto._handleSwipe = function _handleSwipe() {
833
      var absDeltax = Math.abs(this.touchDeltaX);
834
835
      if (absDeltax <= SWIPE_THRESHOLD) {
836
        return;
837
      }
838
839
      var direction = absDeltax / this.touchDeltaX;
840
      this.touchDeltaX = 0; // swipe left
841
842
      if (direction > 0) {
843
        this.prev();
844
      } // swipe right
845
846
847
      if (direction < 0) {
848
        this.next();
849
      }
850
    };
851
852
    _proto._addEventListeners = function _addEventListeners() {
853
      var _this2 = this;
854
855
      if (this._config.keyboard) {
856
        $(this._element).on(Event$2.KEYDOWN, function (event) {
857
          return _this2._keydown(event);
858
        });
859
      }
860
861
      if (this._config.pause === 'hover') {
862
        $(this._element).on(Event$2.MOUSEENTER, function (event) {
863
          return _this2.pause(event);
864
        }).on(Event$2.MOUSELEAVE, function (event) {
865
          return _this2.cycle(event);
866
        });
867
      }
868
869
      if (this._config.touch) {
870
        this._addTouchEventListeners();
871
      }
872
    };
873
874
    _proto._addTouchEventListeners = function _addTouchEventListeners() {
875
      var _this3 = this;
876
877
      if (!this._touchSupported) {
878
        return;
879
      }
880
881
      var start = function start(event) {
882
        if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
883
          _this3.touchStartX = event.originalEvent.clientX;
884
        } else if (!_this3._pointerEvent) {
885
          _this3.touchStartX = event.originalEvent.touches[0].clientX;
886
        }
887
      };
888
889
      var move = function move(event) {
890
        // ensure swiping with one touch and not pinching
891
        if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
892
          _this3.touchDeltaX = 0;
893
        } else {
894
          _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
895
        }
896
      };
897
898
      var end = function end(event) {
899
        if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
900
          _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
901
        }
902
903
        _this3._handleSwipe();
904
905
        if (_this3._config.pause === 'hover') {
906
          // If it's a touch-enabled device, mouseenter/leave are fired as
907
          // part of the mouse compatibility events on first tap - the carousel
908
          // would stop cycling until user tapped out of it;
909
          // here, we listen for touchend, explicitly pause the carousel
910
          // (as if it's the second time we tap on it, mouseenter compat event
911
          // is NOT fired) and after a timeout (to allow for mouse compatibility
912
          // events to fire) we explicitly restart cycling
913
          _this3.pause();
914
915
          if (_this3.touchTimeout) {
916
            clearTimeout(_this3.touchTimeout);
917
          }
918
919
          _this3.touchTimeout = setTimeout(function (event) {
920
            return _this3.cycle(event);
921
          }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
922
        }
923
      };
924
925
      $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
926
        return e.preventDefault();
927
      });
928
929
      if (this._pointerEvent) {
930
        $(this._element).on(Event$2.POINTERDOWN, function (event) {
931
          return start(event);
932
        });
933
        $(this._element).on(Event$2.POINTERUP, function (event) {
934
          return end(event);
935
        });
936
937
        this._element.classList.add(ClassName$2.POINTER_EVENT);
938
      } else {
939
        $(this._element).on(Event$2.TOUCHSTART, function (event) {
940
          return start(event);
941
        });
942
        $(this._element).on(Event$2.TOUCHMOVE, function (event) {
943
          return move(event);
944
        });
945
        $(this._element).on(Event$2.TOUCHEND, function (event) {
946
          return end(event);
947
        });
948
      }
949
    };
950
951
    _proto._keydown = function _keydown(event) {
952
      if (/input|textarea/i.test(event.target.tagName)) {
953
        return;
954
      }
955
956
      switch (event.which) {
957
        case ARROW_LEFT_KEYCODE:
958
          event.preventDefault();
959
          this.prev();
960
          break;
961
962
        case ARROW_RIGHT_KEYCODE:
963
          event.preventDefault();
964
          this.next();
965
          break;
966
      }
967
    };
968
969
    _proto._getItemIndex = function _getItemIndex(element) {
970
      this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
971
      return this._items.indexOf(element);
972
    };
973
974
    _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
975
      var isNextDirection = direction === Direction.NEXT;
976
      var isPrevDirection = direction === Direction.PREV;
977
978
      var activeIndex = this._getItemIndex(activeElement);
979
980
      var lastItemIndex = this._items.length - 1;
981
      var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
982
983
      if (isGoingToWrap && !this._config.wrap) {
984
        return activeElement;
985
      }
986
987
      var delta = direction === Direction.PREV ? -1 : 1;
988
      var itemIndex = (activeIndex + delta) % this._items.length;
989
      return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
990
    };
991
992
    _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
993
      var targetIndex = this._getItemIndex(relatedTarget);
994
995
      var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
996
997
      var slideEvent = $.Event(Event$2.SLIDE, {
998
        relatedTarget: relatedTarget,
999
        direction: eventDirectionName,
1000
        from: fromIndex,
1001
        to: targetIndex
1002
      });
1003
      $(this._element).trigger(slideEvent);
1004
      return slideEvent;
1005
    };
1006
1007
    _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
1008
      if (this._indicatorsElement) {
1009
        var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
1010
        $(indicators).removeClass(ClassName$2.ACTIVE);
1011
1012
        var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
1013
1014
        if (nextIndicator) {
1015
          $(nextIndicator).addClass(ClassName$2.ACTIVE);
1016
        }
1017
      }
1018
    };
1019
1020
    _proto._slide = function _slide(direction, element) {
1021
      var _this4 = this;
1022
1023
      var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
1024
1025
      var activeElementIndex = this._getItemIndex(activeElement);
1026
1027
      var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
1028
1029
      var nextElementIndex = this._getItemIndex(nextElement);
1030
1031
      var isCycling = Boolean(this._interval);
1032
      var directionalClassName;
1033
      var orderClassName;
1034
      var eventDirectionName;
1035
1036
      if (direction === Direction.NEXT) {
1037
        directionalClassName = ClassName$2.LEFT;
1038
        orderClassName = ClassName$2.NEXT;
1039
        eventDirectionName = Direction.LEFT;
1040
      } else {
1041
        directionalClassName = ClassName$2.RIGHT;
1042
        orderClassName = ClassName$2.PREV;
1043
        eventDirectionName = Direction.RIGHT;
1044
      }
1045
1046
      if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
1047
        this._isSliding = false;
1048
        return;
1049
      }
1050
1051
      var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
1052
1053
      if (slideEvent.isDefaultPrevented()) {
1054
        return;
1055
      }
1056
1057
      if (!activeElement || !nextElement) {
1058
        // Some weirdness is happening, so we bail
1059
        return;
1060
      }
1061
1062
      this._isSliding = true;
1063
1064
      if (isCycling) {
1065
        this.pause();
1066
      }
1067
1068
      this._setActiveIndicatorElement(nextElement);
1069
1070
      var slidEvent = $.Event(Event$2.SLID, {
1071
        relatedTarget: nextElement,
1072
        direction: eventDirectionName,
1073
        from: activeElementIndex,
1074
        to: nextElementIndex
1075
      });
1076
1077
      if ($(this._element).hasClass(ClassName$2.SLIDE)) {
1078
        $(nextElement).addClass(orderClassName);
1079
        Util.reflow(nextElement);
1080
        $(activeElement).addClass(directionalClassName);
1081
        $(nextElement).addClass(directionalClassName);
1082
        var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
1083
1084
        if (nextElementInterval) {
1085
          this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
1086
          this._config.interval = nextElementInterval;
1087
        } else {
1088
          this._config.interval = this._config.defaultInterval || this._config.interval;
1089
        }
1090
1091
        var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
1092
        $(activeElement).one(Util.TRANSITION_END, function () {
1093
          $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
1094
          $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
1095
          _this4._isSliding = false;
1096
          setTimeout(function () {
1097
            return $(_this4._element).trigger(slidEvent);
1098
          }, 0);
1099
        }).emulateTransitionEnd(transitionDuration);
1100
      } else {
1101
        $(activeElement).removeClass(ClassName$2.ACTIVE);
1102
        $(nextElement).addClass(ClassName$2.ACTIVE);
1103
        this._isSliding = false;
1104
        $(this._element).trigger(slidEvent);
1105
      }
1106
1107
      if (isCycling) {
1108
        this.cycle();
1109
      }
1110
    } // Static
1111
    ;
1112
1113
    Carousel._jQueryInterface = function _jQueryInterface(config) {
1114
      return this.each(function () {
1115
        var data = $(this).data(DATA_KEY$2);
1116
1117
        var _config = _objectSpread2({}, Default, {}, $(this).data());
1118
1119
        if (typeof config === 'object') {
1120
          _config = _objectSpread2({}, _config, {}, config);
1121
        }
1122
1123
        var action = typeof config === 'string' ? config : _config.slide;
1124
1125
        if (!data) {
1126
          data = new Carousel(this, _config);
1127
          $(this).data(DATA_KEY$2, data);
1128
        }
1129
1130
        if (typeof config === 'number') {
1131
          data.to(config);
1132
        } else if (typeof action === 'string') {
1133
          if (typeof data[action] === 'undefined') {
1134
            throw new TypeError("No method named \"" + action + "\"");
1135
          }
1136
1137
          data[action]();
1138
        } else if (_config.interval && _config.ride) {
1139
          data.pause();
1140
          data.cycle();
1141
        }
1142
      });
1143
    };
1144
1145
    Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
1146
      var selector = Util.getSelectorFromElement(this);
1147
1148
      if (!selector) {
1149
        return;
1150
      }
1151
1152
      var target = $(selector)[0];
1153
1154
      if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
1155
        return;
1156
      }
1157
1158
      var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
1159
1160
      var slideIndex = this.getAttribute('data-slide-to');
1161
1162
      if (slideIndex) {
1163
        config.interval = false;
1164
      }
1165
1166
      Carousel._jQueryInterface.call($(target), config);
1167
1168
      if (slideIndex) {
1169
        $(target).data(DATA_KEY$2).to(slideIndex);
1170
      }
1171
1172
      event.preventDefault();
1173
    };
1174
1175
    _createClass(Carousel, null, [{
1176
      key: "VERSION",
1177
      get: function get() {
1178
        return VERSION$2;
1179
      }
1180
    }, {
1181
      key: "Default",
1182
      get: function get() {
1183
        return Default;
1184
      }
1185
    }]);
1186
1187
    return Carousel;
1188
  }();
1189
  /**
1190
   * ------------------------------------------------------------------------
1191
   * Data Api implementation
1192
   * ------------------------------------------------------------------------
1193
   */
1194
1195
1196
  $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
1197
  $(window).on(Event$2.LOAD_DATA_API, function () {
1198
    var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
1199
1200
    for (var i = 0, len = carousels.length; i < len; i++) {
1201
      var $carousel = $(carousels[i]);
1202
1203
      Carousel._jQueryInterface.call($carousel, $carousel.data());
1204
    }
1205
  });
1206
  /**
1207
   * ------------------------------------------------------------------------
1208
   * jQuery
1209
   * ------------------------------------------------------------------------
1210
   */
1211
1212
  $.fn[NAME$2] = Carousel._jQueryInterface;
1213
  $.fn[NAME$2].Constructor = Carousel;
1214
1215
  $.fn[NAME$2].noConflict = function () {
1216
    $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
1217
    return Carousel._jQueryInterface;
1218
  };
1219
1220
  /**
1221
   * ------------------------------------------------------------------------
1222
   * Constants
1223
   * ------------------------------------------------------------------------
1224
   */
1225
1226
  var NAME$3 = 'collapse';
1227
  var VERSION$3 = '4.4.1';
1228
  var DATA_KEY$3 = 'bs.collapse';
1229
  var EVENT_KEY$3 = "." + DATA_KEY$3;
1230
  var DATA_API_KEY$3 = '.data-api';
1231
  var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
1232
  var Default$1 = {
1233
    toggle: true,
1234
    parent: ''
1235
  };
1236
  var DefaultType$1 = {
1237
    toggle: 'boolean',
1238
    parent: '(string|element)'
1239
  };
1240
  var Event$3 = {
1241
    SHOW: "show" + EVENT_KEY$3,
1242
    SHOWN: "shown" + EVENT_KEY$3,
1243
    HIDE: "hide" + EVENT_KEY$3,
1244
    HIDDEN: "hidden" + EVENT_KEY$3,
1245
    CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
1246
  };
1247
  var ClassName$3 = {
1248
    SHOW: 'show',
1249
    COLLAPSE: 'collapse',
1250
    COLLAPSING: 'collapsing',
1251
    COLLAPSED: 'collapsed'
1252
  };
1253
  var Dimension = {
1254
    WIDTH: 'width',
1255
    HEIGHT: 'height'
1256
  };
1257
  var Selector$3 = {
1258
    ACTIVES: '.show, .collapsing',
1259
    DATA_TOGGLE: '[data-toggle="collapse"]'
1260
  };
1261
  /**
1262
   * ------------------------------------------------------------------------
1263
   * Class Definition
1264
   * ------------------------------------------------------------------------
1265
   */
1266
1267
  var Collapse =
1268
  /*#__PURE__*/
1269
  function () {
1270
    function Collapse(element, config) {
1271
      this._isTransitioning = false;
1272
      this._element = element;
1273
      this._config = this._getConfig(config);
1274
      this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
1275
      var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
1276
1277
      for (var i = 0, len = toggleList.length; i < len; i++) {
1278
        var elem = toggleList[i];
1279
        var selector = Util.getSelectorFromElement(elem);
1280
        var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
1281
          return foundElem === element;
1282
        });
1283
1284
        if (selector !== null && filterElement.length > 0) {
1285
          this._selector = selector;
1286
1287
          this._triggerArray.push(elem);
1288
        }
1289
      }
1290
1291
      this._parent = this._config.parent ? this._getParent() : null;
1292
1293
      if (!this._config.parent) {
1294
        this._addAriaAndCollapsedClass(this._element, this._triggerArray);
1295
      }
1296
1297
      if (this._config.toggle) {
1298
        this.toggle();
1299
      }
1300
    } // Getters
1301
1302
1303
    var _proto = Collapse.prototype;
1304
1305
    // Public
1306
    _proto.toggle = function toggle() {
1307
      if ($(this._element).hasClass(ClassName$3.SHOW)) {
1308
        this.hide();
1309
      } else {
1310
        this.show();
1311
      }
1312
    };
1313
1314
    _proto.show = function show() {
1315
      var _this = this;
1316
1317
      if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
1318
        return;
1319
      }
1320
1321
      var actives;
1322
      var activesData;
1323
1324
      if (this._parent) {
1325
        actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
1326
          if (typeof _this._config.parent === 'string') {
1327
            return elem.getAttribute('data-parent') === _this._config.parent;
1328
          }
1329
1330
          return elem.classList.contains(ClassName$3.COLLAPSE);
1331
        });
1332
1333
        if (actives.length === 0) {
1334
          actives = null;
1335
        }
1336
      }
1337
1338
      if (actives) {
1339
        activesData = $(actives).not(this._selector).data(DATA_KEY$3);
1340
1341
        if (activesData && activesData._isTransitioning) {
1342
          return;
1343
        }
1344
      }
1345
1346
      var startEvent = $.Event(Event$3.SHOW);
1347
      $(this._element).trigger(startEvent);
1348
1349
      if (startEvent.isDefaultPrevented()) {
1350
        return;
1351
      }
1352
1353
      if (actives) {
1354
        Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
1355
1356
        if (!activesData) {
1357
          $(actives).data(DATA_KEY$3, null);
1358
        }
1359
      }
1360
1361
      var dimension = this._getDimension();
1362
1363
      $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
1364
      this._element.style[dimension] = 0;
1365
1366
      if (this._triggerArray.length) {
1367
        $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
1368
      }
1369
1370
      this.setTransitioning(true);
1371
1372
      var complete = function complete() {
1373
        $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
1374
        _this._element.style[dimension] = '';
1375
1376
        _this.setTransitioning(false);
1377
1378
        $(_this._element).trigger(Event$3.SHOWN);
1379
      };
1380
1381
      var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
1382
      var scrollSize = "scroll" + capitalizedDimension;
1383
      var transitionDuration = Util.getTransitionDurationFromElement(this._element);
1384
      $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
1385
      this._element.style[dimension] = this._element[scrollSize] + "px";
1386
    };
1387
1388
    _proto.hide = function hide() {
1389
      var _this2 = this;
1390
1391
      if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
1392
        return;
1393
      }
1394
1395
      var startEvent = $.Event(Event$3.HIDE);
1396
      $(this._element).trigger(startEvent);
1397
1398
      if (startEvent.isDefaultPrevented()) {
1399
        return;
1400
      }
1401
1402
      var dimension = this._getDimension();
1403
1404
      this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
1405
      Util.reflow(this._element);
1406
      $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
1407
      var triggerArrayLength = this._triggerArray.length;
1408
1409
      if (triggerArrayLength > 0) {
1410
        for (var i = 0; i < triggerArrayLength; i++) {
1411
          var trigger = this._triggerArray[i];
1412
          var selector = Util.getSelectorFromElement(trigger);
1413
1414
          if (selector !== null) {
1415
            var $elem = $([].slice.call(document.querySelectorAll(selector)));
1416
1417
            if (!$elem.hasClass(ClassName$3.SHOW)) {
1418
              $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
1419
            }
1420
          }
1421
        }
1422
      }
1423
1424
      this.setTransitioning(true);
1425
1426
      var complete = function complete() {
1427
        _this2.setTransitioning(false);
1428
1429
        $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
1430
      };
1431
1432
      this._element.style[dimension] = '';
1433
      var transitionDuration = Util.getTransitionDurationFromElement(this._element);
1434
      $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
1435
    };
1436
1437
    _proto.setTransitioning = function setTransitioning(isTransitioning) {
1438
      this._isTransitioning = isTransitioning;
1439
    };
1440
1441
    _proto.dispose = function dispose() {
1442
      $.removeData(this._element, DATA_KEY$3);
1443
      this._config = null;
1444
      this._parent = null;
1445
      this._element = null;
1446
      this._triggerArray = null;
1447
      this._isTransitioning = null;
1448
    } // Private
1449
    ;
1450
1451
    _proto._getConfig = function _getConfig(config) {
1452
      config = _objectSpread2({}, Default$1, {}, config);
1453
      config.toggle = Boolean(config.toggle); // Coerce string values
1454
1455
      Util.typeCheckConfig(NAME$3, config, DefaultType$1);
1456
      return config;
1457
    };
1458
1459
    _proto._getDimension = function _getDimension() {
1460
      var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
1461
      return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
1462
    };
1463
1464
    _proto._getParent = function _getParent() {
1465
      var _this3 = this;
1466
1467
      var parent;
1468
1469
      if (Util.isElement(this._config.parent)) {
1470
        parent = this._config.parent; // It's a jQuery object
1471
1472
        if (typeof this._config.parent.jquery !== 'undefined') {
1473
          parent = this._config.parent[0];
1474
        }
1475
      } else {
1476
        parent = document.querySelector(this._config.parent);
1477
      }
1478
1479
      var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
1480
      var children = [].slice.call(parent.querySelectorAll(selector));
1481
      $(children).each(function (i, element) {
1482
        _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
1483
      });
1484
      return parent;
1485
    };
1486
1487
    _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
1488
      var isOpen = $(element).hasClass(ClassName$3.SHOW);
1489
1490
      if (triggerArray.length) {
1491
        $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
1492
      }
1493
    } // Static
1494
    ;
1495
1496
    Collapse._getTargetFromElement = function _getTargetFromElement(element) {
1497
      var selector = Util.getSelectorFromElement(element);
1498
      return selector ? document.querySelector(selector) : null;
1499
    };
1500
1501
    Collapse._jQueryInterface = function _jQueryInterface(config) {
1502
      return this.each(function () {
1503
        var $this = $(this);
1504
        var data = $this.data(DATA_KEY$3);
1505
1506
        var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
1507
1508
        if (!data && _config.toggle && /show|hide/.test(config)) {
1509
          _config.toggle = false;
1510
        }
1511
1512
        if (!data) {
1513
          data = new Collapse(this, _config);
1514
          $this.data(DATA_KEY$3, data);
1515
        }
1516
1517
        if (typeof config === 'string') {
1518
          if (typeof data[config] === 'undefined') {
1519
            throw new TypeError("No method named \"" + config + "\"");
1520
          }
1521
1522
          data[config]();
1523
        }
1524
      });
1525
    };
1526
1527
    _createClass(Collapse, null, [{
1528
      key: "VERSION",
1529
      get: function get() {
1530
        return VERSION$3;
1531
      }
1532
    }, {
1533
      key: "Default",
1534
      get: function get() {
1535
        return Default$1;
1536
      }
1537
    }]);
1538
1539
    return Collapse;
1540
  }();
1541
  /**
1542
   * ------------------------------------------------------------------------
1543
   * Data Api implementation
1544
   * ------------------------------------------------------------------------
1545
   */
1546
1547
1548
  $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
1549
    // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
1550
    if (event.currentTarget.tagName === 'A') {
1551
      event.preventDefault();
1552
    }
1553
1554
    var $trigger = $(this);
1555
    var selector = Util.getSelectorFromElement(this);
1556
    var selectors = [].slice.call(document.querySelectorAll(selector));
1557
    $(selectors).each(function () {
1558
      var $target = $(this);
1559
      var data = $target.data(DATA_KEY$3);
1560
      var config = data ? 'toggle' : $trigger.data();
1561
1562
      Collapse._jQueryInterface.call($target, config);
1563
    });
1564
  });
1565
  /**
1566
   * ------------------------------------------------------------------------
1567
   * jQuery
1568
   * ------------------------------------------------------------------------
1569
   */
1570
1571
  $.fn[NAME$3] = Collapse._jQueryInterface;
1572
  $.fn[NAME$3].Constructor = Collapse;
1573
1574
  $.fn[NAME$3].noConflict = function () {
1575
    $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
1576
    return Collapse._jQueryInterface;
1577
  };
1578
1579
  /**!
1580
   * @fileOverview Kickass library to create and place poppers near their reference elements.
1581
   * @version 1.16.0
1582
   * @license
1583
   * Copyright (c) 2016 Federico Zivolo and contributors
1584
   *
1585
   * Permission is hereby granted, free of charge, to any person obtaining a copy
1586
   * of this software and associated documentation files (the "Software"), to deal
1587
   * in the Software without restriction, including without limitation the rights
1588
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1589
   * copies of the Software, and to permit persons to whom the Software is
1590
   * furnished to do so, subject to the following conditions:
1591
   *
1592
   * The above copyright notice and this permission notice shall be included in all
1593
   * copies or substantial portions of the Software.
1594
   *
1595
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1596
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1597
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1598
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1599
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1600
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1601
   * SOFTWARE.
1602
   */
1603
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
1604
1605
  var timeoutDuration = function () {
1606
    var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
1607
    for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
1608
      if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
1609
        return 1;
1610
      }
1611
    }
1612
    return 0;
1613
  }();
1614
1615
  function microtaskDebounce(fn) {
1616
    var called = false;
1617
    return function () {
1618
      if (called) {
1619
        return;
1620
      }
1621
      called = true;
1622
      window.Promise.resolve().then(function () {
1623
        called = false;
1624
        fn();
1625
      });
1626
    };
1627
  }
1628
1629
  function taskDebounce(fn) {
1630
    var scheduled = false;
1631
    return function () {
1632
      if (!scheduled) {
1633
        scheduled = true;
1634
        setTimeout(function () {
1635
          scheduled = false;
1636
          fn();
1637
        }, timeoutDuration);
1638
      }
1639
    };
1640
  }
1641
1642
  var supportsMicroTasks = isBrowser && window.Promise;
1643
1644
  /**
1645
  * Create a debounced version of a method, that's asynchronously deferred
1646
  * but called in the minimum time possible.
1647
  *
1648
  * @method
1649
  * @memberof Popper.Utils
1650
  * @argument {Function} fn
1651
  * @returns {Function}
1652
  */
1653
  var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
1654
1655
  /**
1656
   * Check if the given variable is a function
1657
   * @method
1658
   * @memberof Popper.Utils
1659
   * @argument {Any} functionToCheck - variable to check
1660
   * @returns {Boolean} answer to: is a function?
1661
   */
1662
  function isFunction(functionToCheck) {
1663
    var getType = {};
1664
    return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
1665
  }
1666
1667
  /**
1668
   * Get CSS computed property of the given element
1669
   * @method
1670
   * @memberof Popper.Utils
1671
   * @argument {Eement} element
1672
   * @argument {String} property
1673
   */
1674
  function getStyleComputedProperty(element, property) {
1675
    if (element.nodeType !== 1) {
1676
      return [];
1677
    }
1678
    // NOTE: 1 DOM access here
1679
    var window = element.ownerDocument.defaultView;
1680
    var css = window.getComputedStyle(element, null);
1681
    return property ? css[property] : css;
1682
  }
1683
1684
  /**
1685
   * Returns the parentNode or the host of the element
1686
   * @method
1687
   * @memberof Popper.Utils
1688
   * @argument {Element} element
1689
   * @returns {Element} parent
1690
   */
1691
  function getParentNode(element) {
1692
    if (element.nodeName === 'HTML') {
1693
      return element;
1694
    }
1695
    return element.parentNode || element.host;
1696
  }
1697
1698
  /**
1699
   * Returns the scrolling parent of the given element
1700
   * @method
1701
   * @memberof Popper.Utils
1702
   * @argument {Element} element
1703
   * @returns {Element} scroll parent
1704
   */
1705
  function getScrollParent(element) {
1706
    // Return body, `getScroll` will take care to get the correct `scrollTop` from it
1707
    if (!element) {
1708
      return document.body;
1709
    }
1710
1711
    switch (element.nodeName) {
1712
      case 'HTML':
1713
      case 'BODY':
1714
        return element.ownerDocument.body;
1715
      case '#document':
1716
        return element.body;
1717
    }
1718
1719
    // Firefox want us to check `-x` and `-y` variations as well
1720
1721
    var _getStyleComputedProp = getStyleComputedProperty(element),
1722
        overflow = _getStyleComputedProp.overflow,
1723
        overflowX = _getStyleComputedProp.overflowX,
1724
        overflowY = _getStyleComputedProp.overflowY;
1725
1726
    if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
1727
      return element;
1728
    }
1729
1730
    return getScrollParent(getParentNode(element));
1731
  }
1732
1733
  /**
1734
   * Returns the reference node of the reference object, or the reference object itself.
1735
   * @method
1736
   * @memberof Popper.Utils
1737
   * @param {Element|Object} reference - the reference element (the popper will be relative to this)
1738
   * @returns {Element} parent
1739
   */
1740
  function getReferenceNode(reference) {
1741
    return reference && reference.referenceNode ? reference.referenceNode : reference;
1742
  }
1743
1744
  var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
1745
  var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
1746
1747
  /**
1748
   * Determines if the browser is Internet Explorer
1749
   * @method
1750
   * @memberof Popper.Utils
1751
   * @param {Number} version to check
1752
   * @returns {Boolean} isIE
1753
   */
1754
  function isIE(version) {
1755
    if (version === 11) {
1756
      return isIE11;
1757
    }
1758
    if (version === 10) {
1759
      return isIE10;
1760
    }
1761
    return isIE11 || isIE10;
1762
  }
1763
1764
  /**
1765
   * Returns the offset parent of the given element
1766
   * @method
1767
   * @memberof Popper.Utils
1768
   * @argument {Element} element
1769
   * @returns {Element} offset parent
1770
   */
1771
  function getOffsetParent(element) {
1772
    if (!element) {
1773
      return document.documentElement;
1774
    }
1775
1776
    var noOffsetParent = isIE(10) ? document.body : null;
1777
1778
    // NOTE: 1 DOM access here
1779
    var offsetParent = element.offsetParent || null;
1780
    // Skip hidden elements which don't have an offsetParent
1781
    while (offsetParent === noOffsetParent && element.nextElementSibling) {
1782
      offsetParent = (element = element.nextElementSibling).offsetParent;
1783
    }
1784
1785
    var nodeName = offsetParent && offsetParent.nodeName;
1786
1787
    if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
1788
      return element ? element.ownerDocument.documentElement : document.documentElement;
1789
    }
1790
1791
    // .offsetParent will return the closest TH, TD or TABLE in case
1792
    // no offsetParent is present, I hate this job...
1793
    if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
1794
      return getOffsetParent(offsetParent);
1795
    }
1796
1797
    return offsetParent;
1798
  }
1799
1800
  function isOffsetContainer(element) {
1801
    var nodeName = element.nodeName;
1802
1803
    if (nodeName === 'BODY') {
1804
      return false;
1805
    }
1806
    return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
1807
  }
1808
1809
  /**
1810
   * Finds the root node (document, shadowDOM root) of the given element
1811
   * @method
1812
   * @memberof Popper.Utils
1813
   * @argument {Element} node
1814
   * @returns {Element} root node
1815
   */
1816
  function getRoot(node) {
1817
    if (node.parentNode !== null) {
1818
      return getRoot(node.parentNode);
1819
    }
1820
1821
    return node;
1822
  }
1823
1824
  /**
1825
   * Finds the offset parent common to the two provided nodes
1826
   * @method
1827
   * @memberof Popper.Utils
1828
   * @argument {Element} element1
1829
   * @argument {Element} element2
1830
   * @returns {Element} common offset parent
1831
   */
1832
  function findCommonOffsetParent(element1, element2) {
1833
    // This check is needed to avoid errors in case one of the elements isn't defined for any reason
1834
    if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
1835
      return document.documentElement;
1836
    }
1837
1838
    // Here we make sure to give as "start" the element that comes first in the DOM
1839
    var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
1840
    var start = order ? element1 : element2;
1841
    var end = order ? element2 : element1;
1842
1843
    // Get common ancestor container
1844
    var range = document.createRange();
1845
    range.setStart(start, 0);
1846
    range.setEnd(end, 0);
1847
    var commonAncestorContainer = range.commonAncestorContainer;
1848
1849
    // Both nodes are inside #document
1850
1851
    if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
1852
      if (isOffsetContainer(commonAncestorContainer)) {
1853
        return commonAncestorContainer;
1854
      }
1855
1856
      return getOffsetParent(commonAncestorContainer);
1857
    }
1858
1859
    // one of the nodes is inside shadowDOM, find which one
1860
    var element1root = getRoot(element1);
1861
    if (element1root.host) {
1862
      return findCommonOffsetParent(element1root.host, element2);
1863
    } else {
1864
      return findCommonOffsetParent(element1, getRoot(element2).host);
1865
    }
1866
  }
1867
1868
  /**
1869
   * Gets the scroll value of the given element in the given side (top and left)
1870
   * @method
1871
   * @memberof Popper.Utils
1872
   * @argument {Element} element
1873
   * @argument {String} side `top` or `left`
1874
   * @returns {number} amount of scrolled pixels
1875
   */
1876
  function getScroll(element) {
1877
    var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
1878
1879
    var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
1880
    var nodeName = element.nodeName;
1881
1882
    if (nodeName === 'BODY' || nodeName === 'HTML') {
1883
      var html = element.ownerDocument.documentElement;
1884
      var scrollingElement = element.ownerDocument.scrollingElement || html;
1885
      return scrollingElement[upperSide];
1886
    }
1887
1888
    return element[upperSide];
1889
  }
1890
1891
  /*
1892
   * Sum or subtract the element scroll values (left and top) from a given rect object
1893
   * @method
1894
   * @memberof Popper.Utils
1895
   * @param {Object} rect - Rect object you want to change
1896
   * @param {HTMLElement} element - The element from the function reads the scroll values
1897
   * @param {Boolean} subtract - set to true if you want to subtract the scroll values
1898
   * @return {Object} rect - The modifier rect object
1899
   */
1900
  function includeScroll(rect, element) {
1901
    var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1902
1903
    var scrollTop = getScroll(element, 'top');
1904
    var scrollLeft = getScroll(element, 'left');
1905
    var modifier = subtract ? -1 : 1;
1906
    rect.top += scrollTop * modifier;
1907
    rect.bottom += scrollTop * modifier;
1908
    rect.left += scrollLeft * modifier;
1909
    rect.right += scrollLeft * modifier;
1910
    return rect;
1911
  }
1912
1913
  /*
1914
   * Helper to detect borders of a given element
1915
   * @method
1916
   * @memberof Popper.Utils
1917
   * @param {CSSStyleDeclaration} styles
1918
   * Result of `getStyleComputedProperty` on the given element
1919
   * @param {String} axis - `x` or `y`
1920
   * @return {number} borders - The borders size of the given axis
1921
   */
1922
1923
  function getBordersSize(styles, axis) {
1924
    var sideA = axis === 'x' ? 'Left' : 'Top';
1925
    var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
1926
1927
    return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
1928
  }
1929
1930
  function getSize(axis, body, html, computedStyle) {
1931
    return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
1932
  }
1933
1934
  function getWindowSizes(document) {
1935
    var body = document.body;
1936
    var html = document.documentElement;
1937
    var computedStyle = isIE(10) && getComputedStyle(html);
1938
1939
    return {
1940
      height: getSize('Height', body, html, computedStyle),
1941
      width: getSize('Width', body, html, computedStyle)
1942
    };
1943
  }
1944
1945
  var classCallCheck = function (instance, Constructor) {
1946
    if (!(instance instanceof Constructor)) {
1947
      throw new TypeError("Cannot call a class as a function");
1948
    }
1949
  };
1950
1951
  var createClass = function () {
1952
    function defineProperties(target, props) {
1953
      for (var i = 0; i < props.length; i++) {
1954
        var descriptor = props[i];
1955
        descriptor.enumerable = descriptor.enumerable || false;
1956
        descriptor.configurable = true;
1957
        if ("value" in descriptor) descriptor.writable = true;
1958
        Object.defineProperty(target, descriptor.key, descriptor);
1959
      }
1960
    }
1961
1962
    return function (Constructor, protoProps, staticProps) {
1963
      if (protoProps) defineProperties(Constructor.prototype, protoProps);
1964
      if (staticProps) defineProperties(Constructor, staticProps);
1965
      return Constructor;
1966
    };
1967
  }();
1968
1969
1970
1971
1972
1973
  var defineProperty = function (obj, key, value) {
1974
    if (key in obj) {
1975
      Object.defineProperty(obj, key, {
1976
        value: value,
1977
        enumerable: true,
1978
        configurable: true,
1979
        writable: true
1980
      });
1981
    } else {
1982
      obj[key] = value;
1983
    }
1984
1985
    return obj;
1986
  };
1987
1988
  var _extends = Object.assign || function (target) {
1989
    for (var i = 1; i < arguments.length; i++) {
1990
      var source = arguments[i];
1991
1992
      for (var key in source) {
1993
        if (Object.prototype.hasOwnProperty.call(source, key)) {
1994
          target[key] = source[key];
1995
        }
1996
      }
1997
    }
1998
1999
    return target;
2000
  };
2001
2002
  /**
2003
   * Given element offsets, generate an output similar to getBoundingClientRect
2004
   * @method
2005
   * @memberof Popper.Utils
2006
   * @argument {Object} offsets
2007
   * @returns {Object} ClientRect like output
2008
   */
2009
  function getClientRect(offsets) {
2010
    return _extends({}, offsets, {
2011
      right: offsets.left + offsets.width,
2012
      bottom: offsets.top + offsets.height
2013
    });
2014
  }
2015
2016
  /**
2017
   * Get bounding client rect of given element
2018
   * @method
2019
   * @memberof Popper.Utils
2020
   * @param {HTMLElement} element
2021
   * @return {Object} client rect
2022
   */
2023
  function getBoundingClientRect(element) {
2024
    var rect = {};
2025
2026
    // IE10 10 FIX: Please, don't ask, the element isn't
2027
    // considered in DOM in some circumstances...
2028
    // This isn't reproducible in IE10 compatibility mode of IE11
2029
    try {
2030
      if (isIE(10)) {
2031
        rect = element.getBoundingClientRect();
2032
        var scrollTop = getScroll(element, 'top');
2033
        var scrollLeft = getScroll(element, 'left');
2034
        rect.top += scrollTop;
2035
        rect.left += scrollLeft;
2036
        rect.bottom += scrollTop;
2037
        rect.right += scrollLeft;
2038
      } else {
2039
        rect = element.getBoundingClientRect();
2040
      }
2041
    } catch (e) {}
2042
2043
    var result = {
2044
      left: rect.left,
2045
      top: rect.top,
2046
      width: rect.right - rect.left,
2047
      height: rect.bottom - rect.top
2048
    };
2049
2050
    // subtract scrollbar size from sizes
2051
    var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
2052
    var width = sizes.width || element.clientWidth || result.width;
2053
    var height = sizes.height || element.clientHeight || result.height;
2054
2055
    var horizScrollbar = element.offsetWidth - width;
2056
    var vertScrollbar = element.offsetHeight - height;
2057
2058
    // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
2059
    // we make this check conditional for performance reasons
2060
    if (horizScrollbar || vertScrollbar) {
2061
      var styles = getStyleComputedProperty(element);
2062
      horizScrollbar -= getBordersSize(styles, 'x');
2063
      vertScrollbar -= getBordersSize(styles, 'y');
2064
2065
      result.width -= horizScrollbar;
2066
      result.height -= vertScrollbar;
2067
    }
2068
2069
    return getClientRect(result);
2070
  }
2071
2072
  function getOffsetRectRelativeToArbitraryNode(children, parent) {
2073
    var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2074
2075
    var isIE10 = isIE(10);
2076
    var isHTML = parent.nodeName === 'HTML';
2077
    var childrenRect = getBoundingClientRect(children);
2078
    var parentRect = getBoundingClientRect(parent);
2079
    var scrollParent = getScrollParent(children);
2080
2081
    var styles = getStyleComputedProperty(parent);
2082
    var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
2083
    var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
2084
2085
    // In cases where the parent is fixed, we must ignore negative scroll in offset calc
2086
    if (fixedPosition && isHTML) {
2087
      parentRect.top = Math.max(parentRect.top, 0);
2088
      parentRect.left = Math.max(parentRect.left, 0);
2089
    }
2090
    var offsets = getClientRect({
2091
      top: childrenRect.top - parentRect.top - borderTopWidth,
2092
      left: childrenRect.left - parentRect.left - borderLeftWidth,
2093
      width: childrenRect.width,
2094
      height: childrenRect.height
2095
    });
2096
    offsets.marginTop = 0;
2097
    offsets.marginLeft = 0;
2098
2099
    // Subtract margins of documentElement in case it's being used as parent
2100
    // we do this only on HTML because it's the only element that behaves
2101
    // differently when margins are applied to it. The margins are included in
2102
    // the box of the documentElement, in the other cases not.
2103
    if (!isIE10 && isHTML) {
2104
      var marginTop = parseFloat(styles.marginTop, 10);
2105
      var marginLeft = parseFloat(styles.marginLeft, 10);
2106
2107
      offsets.top -= borderTopWidth - marginTop;
2108
      offsets.bottom -= borderTopWidth - marginTop;
2109
      offsets.left -= borderLeftWidth - marginLeft;
2110
      offsets.right -= borderLeftWidth - marginLeft;
2111
2112
      // Attach marginTop and marginLeft because in some circumstances we may need them
2113
      offsets.marginTop = marginTop;
2114
      offsets.marginLeft = marginLeft;
2115
    }
2116
2117
    if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
2118
      offsets = includeScroll(offsets, parent);
2119
    }
2120
2121
    return offsets;
2122
  }
2123
2124
  function getViewportOffsetRectRelativeToArtbitraryNode(element) {
2125
    var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2126
2127
    var html = element.ownerDocument.documentElement;
2128
    var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
2129
    var width = Math.max(html.clientWidth, window.innerWidth || 0);
2130
    var height = Math.max(html.clientHeight, window.innerHeight || 0);
2131
2132
    var scrollTop = !excludeScroll ? getScroll(html) : 0;
2133
    var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
2134
2135
    var offset = {
2136
      top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
2137
      left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
2138
      width: width,
2139
      height: height
2140
    };
2141
2142
    return getClientRect(offset);
2143
  }
2144
2145
  /**
2146
   * Check if the given element is fixed or is inside a fixed parent
2147
   * @method
2148
   * @memberof Popper.Utils
2149
   * @argument {Element} element
2150
   * @argument {Element} customContainer
2151
   * @returns {Boolean} answer to "isFixed?"
2152
   */
2153
  function isFixed(element) {
2154
    var nodeName = element.nodeName;
2155
    if (nodeName === 'BODY' || nodeName === 'HTML') {
2156
      return false;
2157
    }
2158
    if (getStyleComputedProperty(element, 'position') === 'fixed') {
2159
      return true;
2160
    }
2161
    var parentNode = getParentNode(element);
2162
    if (!parentNode) {
2163
      return false;
2164
    }
2165
    return isFixed(parentNode);
2166
  }
2167
2168
  /**
2169
   * Finds the first parent of an element that has a transformed property defined
2170
   * @method
2171
   * @memberof Popper.Utils
2172
   * @argument {Element} element
2173
   * @returns {Element} first transformed parent or documentElement
2174
   */
2175
2176
  function getFixedPositionOffsetParent(element) {
2177
    // This check is needed to avoid errors in case one of the elements isn't defined for any reason
2178
    if (!element || !element.parentElement || isIE()) {
2179
      return document.documentElement;
2180
    }
2181
    var el = element.parentElement;
2182
    while (el && getStyleComputedProperty(el, 'transform') === 'none') {
2183
      el = el.parentElement;
2184
    }
2185
    return el || document.documentElement;
2186
  }
2187
2188
  /**
2189
   * Computed the boundaries limits and return them
2190
   * @method
2191
   * @memberof Popper.Utils
2192
   * @param {HTMLElement} popper
2193
   * @param {HTMLElement} reference
2194
   * @param {number} padding
2195
   * @param {HTMLElement} boundariesElement - Element used to define the boundaries
2196
   * @param {Boolean} fixedPosition - Is in fixed position mode
2197
   * @returns {Object} Coordinates of the boundaries
2198
   */
2199
  function getBoundaries(popper, reference, padding, boundariesElement) {
2200
    var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
2201
2202
    // NOTE: 1 DOM access here
2203
2204
    var boundaries = { top: 0, left: 0 };
2205
    var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
2206
2207
    // Handle viewport case
2208
    if (boundariesElement === 'viewport') {
2209
      boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
2210
    } else {
2211
      // Handle other cases based on DOM element used as boundaries
2212
      var boundariesNode = void 0;
2213
      if (boundariesElement === 'scrollParent') {
2214
        boundariesNode = getScrollParent(getParentNode(reference));
2215
        if (boundariesNode.nodeName === 'BODY') {
2216
          boundariesNode = popper.ownerDocument.documentElement;
2217
        }
2218
      } else if (boundariesElement === 'window') {
2219
        boundariesNode = popper.ownerDocument.documentElement;
2220
      } else {
2221
        boundariesNode = boundariesElement;
2222
      }
2223
2224
      var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
2225
2226
      // In case of HTML, we need a different computation
2227
      if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
2228
        var _getWindowSizes = getWindowSizes(popper.ownerDocument),
2229
            height = _getWindowSizes.height,
2230
            width = _getWindowSizes.width;
2231
2232
        boundaries.top += offsets.top - offsets.marginTop;
2233
        boundaries.bottom = height + offsets.top;
2234
        boundaries.left += offsets.left - offsets.marginLeft;
2235
        boundaries.right = width + offsets.left;
2236
      } else {
2237
        // for all the other DOM elements, this one is good
2238
        boundaries = offsets;
2239
      }
2240
    }
2241
2242
    // Add paddings
2243
    padding = padding || 0;
2244
    var isPaddingNumber = typeof padding === 'number';
2245
    boundaries.left += isPaddingNumber ? padding : padding.left || 0;
2246
    boundaries.top += isPaddingNumber ? padding : padding.top || 0;
2247
    boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
2248
    boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
2249
2250
    return boundaries;
2251
  }
2252
2253
  function getArea(_ref) {
2254
    var width = _ref.width,
2255
        height = _ref.height;
2256
2257
    return width * height;
2258
  }
2259
2260
  /**
2261
   * Utility used to transform the `auto` placement to the placement with more
2262
   * available space.
2263
   * @method
2264
   * @memberof Popper.Utils
2265
   * @argument {Object} data - The data object generated by update method
2266
   * @argument {Object} options - Modifiers configuration and options
2267
   * @returns {Object} The data object, properly modified
2268
   */
2269
  function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
2270
    var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
2271
2272
    if (placement.indexOf('auto') === -1) {
2273
      return placement;
2274
    }
2275
2276
    var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
2277
2278
    var rects = {
2279
      top: {
2280
        width: boundaries.width,
2281
        height: refRect.top - boundaries.top
2282
      },
2283
      right: {
2284
        width: boundaries.right - refRect.right,
2285
        height: boundaries.height
2286
      },
2287
      bottom: {
2288
        width: boundaries.width,
2289
        height: boundaries.bottom - refRect.bottom
2290
      },
2291
      left: {
2292
        width: refRect.left - boundaries.left,
2293
        height: boundaries.height
2294
      }
2295
    };
2296
2297
    var sortedAreas = Object.keys(rects).map(function (key) {
2298
      return _extends({
2299
        key: key
2300
      }, rects[key], {
2301
        area: getArea(rects[key])
2302
      });
2303
    }).sort(function (a, b) {
2304
      return b.area - a.area;
2305
    });
2306
2307
    var filteredAreas = sortedAreas.filter(function (_ref2) {
2308
      var width = _ref2.width,
2309
          height = _ref2.height;
2310
      return width >= popper.clientWidth && height >= popper.clientHeight;
2311
    });
2312
2313
    var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
2314
2315
    var variation = placement.split('-')[1];
2316
2317
    return computedPlacement + (variation ? '-' + variation : '');
2318
  }
2319
2320
  /**
2321
   * Get offsets to the reference element
2322
   * @method
2323
   * @memberof Popper.Utils
2324
   * @param {Object} state
2325
   * @param {Element} popper - the popper element
2326
   * @param {Element} reference - the reference element (the popper will be relative to this)
2327
   * @param {Element} fixedPosition - is in fixed position mode
2328
   * @returns {Object} An object containing the offsets which will be applied to the popper
2329
   */
2330
  function getReferenceOffsets(state, popper, reference) {
2331
    var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
2332
2333
    var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
2334
    return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
2335
  }
2336
2337
  /**
2338
   * Get the outer sizes of the given element (offset size + margins)
2339
   * @method
2340
   * @memberof Popper.Utils
2341
   * @argument {Element} element
2342
   * @returns {Object} object containing width and height properties
2343
   */
2344
  function getOuterSizes(element) {
2345
    var window = element.ownerDocument.defaultView;
2346
    var styles = window.getComputedStyle(element);
2347
    var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
2348
    var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
2349
    var result = {
2350
      width: element.offsetWidth + y,
2351
      height: element.offsetHeight + x
2352
    };
2353
    return result;
2354
  }
2355
2356
  /**
2357
   * Get the opposite placement of the given one
2358
   * @method
2359
   * @memberof Popper.Utils
2360
   * @argument {String} placement
2361
   * @returns {String} flipped placement
2362
   */
2363
  function getOppositePlacement(placement) {
2364
    var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
2365
    return placement.replace(/left|right|bottom|top/g, function (matched) {
2366
      return hash[matched];
2367
    });
2368
  }
2369
2370
  /**
2371
   * Get offsets to the popper
2372
   * @method
2373
   * @memberof Popper.Utils
2374
   * @param {Object} position - CSS position the Popper will get applied
2375
   * @param {HTMLElement} popper - the popper element
2376
   * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
2377
   * @param {String} placement - one of the valid placement options
2378
   * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
2379
   */
2380
  function getPopperOffsets(popper, referenceOffsets, placement) {
2381
    placement = placement.split('-')[0];
2382
2383
    // Get popper node sizes
2384
    var popperRect = getOuterSizes(popper);
2385
2386
    // Add position, width and height to our offsets object
2387
    var popperOffsets = {
2388
      width: popperRect.width,
2389
      height: popperRect.height
2390
    };
2391
2392
    // depending by the popper placement we have to compute its offsets slightly differently
2393
    var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
2394
    var mainSide = isHoriz ? 'top' : 'left';
2395
    var secondarySide = isHoriz ? 'left' : 'top';
2396
    var measurement = isHoriz ? 'height' : 'width';
2397
    var secondaryMeasurement = !isHoriz ? 'height' : 'width';
2398
2399
    popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
2400
    if (placement === secondarySide) {
2401
      popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
2402
    } else {
2403
      popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
2404
    }
2405
2406
    return popperOffsets;
2407
  }
2408
2409
  /**
2410
   * Mimics the `find` method of Array
2411
   * @method
2412
   * @memberof Popper.Utils
2413
   * @argument {Array} arr
2414
   * @argument prop
2415
   * @argument value
2416
   * @returns index or -1
2417
   */
2418
  function find(arr, check) {
2419
    // use native find if supported
2420
    if (Array.prototype.find) {
2421
      return arr.find(check);
2422
    }
2423
2424
    // use `filter` to obtain the same behavior of `find`
2425
    return arr.filter(check)[0];
2426
  }
2427
2428
  /**
2429
   * Return the index of the matching object
2430
   * @method
2431
   * @memberof Popper.Utils
2432
   * @argument {Array} arr
2433
   * @argument prop
2434
   * @argument value
2435
   * @returns index or -1
2436
   */
2437
  function findIndex(arr, prop, value) {
2438
    // use native findIndex if supported
2439
    if (Array.prototype.findIndex) {
2440
      return arr.findIndex(function (cur) {
2441
        return cur[prop] === value;
2442
      });
2443
    }
2444
2445
    // use `find` + `indexOf` if `findIndex` isn't supported
2446
    var match = find(arr, function (obj) {
2447
      return obj[prop] === value;
2448
    });
2449
    return arr.indexOf(match);
2450
  }
2451
2452
  /**
2453
   * Loop trough the list of modifiers and run them in order,
2454
   * each of them will then edit the data object.
2455
   * @method
2456
   * @memberof Popper.Utils
2457
   * @param {dataObject} data
2458
   * @param {Array} modifiers
2459
   * @param {String} ends - Optional modifier name used as stopper
2460
   * @returns {dataObject}
2461
   */
2462
  function runModifiers(modifiers, data, ends) {
2463
    var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
2464
2465
    modifiersToRun.forEach(function (modifier) {
2466
      if (modifier['function']) {
2467
        // eslint-disable-line dot-notation
2468
        console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
2469
      }
2470
      var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
2471
      if (modifier.enabled && isFunction(fn)) {
2472
        // Add properties to offsets to make them a complete clientRect object
2473
        // we do this before each modifier to make sure the previous one doesn't
2474
        // mess with these values
2475
        data.offsets.popper = getClientRect(data.offsets.popper);
2476
        data.offsets.reference = getClientRect(data.offsets.reference);
2477
2478
        data = fn(data, modifier);
2479
      }
2480
    });
2481
2482
    return data;
2483
  }
2484
2485
  /**
2486
   * Updates the position of the popper, computing the new offsets and applying
2487
   * the new style.<br />
2488
   * Prefer `scheduleUpdate` over `update` because of performance reasons.
2489
   * @method
2490
   * @memberof Popper
2491
   */
2492
  function update() {
2493
    // if popper is destroyed, don't perform any further update
2494
    if (this.state.isDestroyed) {
2495
      return;
2496
    }
2497
2498
    var data = {
2499
      instance: this,
2500
      styles: {},
2501
      arrowStyles: {},
2502
      attributes: {},
2503
      flipped: false,
2504
      offsets: {}
2505
    };
2506
2507
    // compute reference element offsets
2508
    data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
2509
2510
    // compute auto placement, store placement inside the data object,
2511
    // modifiers will be able to edit `placement` if needed
2512
    // and refer to originalPlacement to know the original value
2513
    data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
2514
2515
    // store the computed placement inside `originalPlacement`
2516
    data.originalPlacement = data.placement;
2517
2518
    data.positionFixed = this.options.positionFixed;
2519
2520
    // compute the popper offsets
2521
    data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
2522
2523
    data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
2524
2525
    // run the modifiers
2526
    data = runModifiers(this.modifiers, data);
2527
2528
    // the first `update` will call `onCreate` callback
2529
    // the other ones will call `onUpdate` callback
2530
    if (!this.state.isCreated) {
2531
      this.state.isCreated = true;
2532
      this.options.onCreate(data);
2533
    } else {
2534
      this.options.onUpdate(data);
2535
    }
2536
  }
2537
2538
  /**
2539
   * Helper used to know if the given modifier is enabled.
2540
   * @method
2541
   * @memberof Popper.Utils
2542
   * @returns {Boolean}
2543
   */
2544
  function isModifierEnabled(modifiers, modifierName) {
2545
    return modifiers.some(function (_ref) {
2546
      var name = _ref.name,
2547
          enabled = _ref.enabled;
2548
      return enabled && name === modifierName;
2549
    });
2550
  }
2551
2552
  /**
2553
   * Get the prefixed supported property name
2554
   * @method
2555
   * @memberof Popper.Utils
2556
   * @argument {String} property (camelCase)
2557
   * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
2558
   */
2559
  function getSupportedPropertyName(property) {
2560
    var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
2561
    var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
2562
2563
    for (var i = 0; i < prefixes.length; i++) {
2564
      var prefix = prefixes[i];
2565
      var toCheck = prefix ? '' + prefix + upperProp : property;
2566
      if (typeof document.body.style[toCheck] !== 'undefined') {
2567
        return toCheck;
2568
      }
2569
    }
2570
    return null;
2571
  }
2572
2573
  /**
2574
   * Destroys the popper.
2575
   * @method
2576
   * @memberof Popper
2577
   */
2578
  function destroy() {
2579
    this.state.isDestroyed = true;
2580
2581
    // touch DOM only if `applyStyle` modifier is enabled
2582
    if (isModifierEnabled(this.modifiers, 'applyStyle')) {
2583
      this.popper.removeAttribute('x-placement');
2584
      this.popper.style.position = '';
2585
      this.popper.style.top = '';
2586
      this.popper.style.left = '';
2587
      this.popper.style.right = '';
2588
      this.popper.style.bottom = '';
2589
      this.popper.style.willChange = '';
2590
      this.popper.style[getSupportedPropertyName('transform')] = '';
2591
    }
2592
2593
    this.disableEventListeners();
2594
2595
    // remove the popper if user explicitly asked for the deletion on destroy
2596
    // do not use `remove` because IE11 doesn't support it
2597
    if (this.options.removeOnDestroy) {
2598
      this.popper.parentNode.removeChild(this.popper);
2599
    }
2600
    return this;
2601
  }
2602
2603
  /**
2604
   * Get the window associated with the element
2605
   * @argument {Element} element
2606
   * @returns {Window}
2607
   */
2608
  function getWindow(element) {
2609
    var ownerDocument = element.ownerDocument;
2610
    return ownerDocument ? ownerDocument.defaultView : window;
2611
  }
2612
2613
  function attachToScrollParents(scrollParent, event, callback, scrollParents) {
2614
    var isBody = scrollParent.nodeName === 'BODY';
2615
    var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
2616
    target.addEventListener(event, callback, { passive: true });
2617
2618
    if (!isBody) {
2619
      attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
2620
    }
2621
    scrollParents.push(target);
2622
  }
2623
2624
  /**
2625
   * Setup needed event listeners used to update the popper position
2626
   * @method
2627
   * @memberof Popper.Utils
2628
   * @private
2629
   */
2630
  function setupEventListeners(reference, options, state, updateBound) {
2631
    // Resize event listener on window
2632
    state.updateBound = updateBound;
2633
    getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
2634
2635
    // Scroll event listener on scroll parents
2636
    var scrollElement = getScrollParent(reference);
2637
    attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
2638
    state.scrollElement = scrollElement;
2639
    state.eventsEnabled = true;
2640
2641
    return state;
2642
  }
2643
2644
  /**
2645
   * It will add resize/scroll events and start recalculating
2646
   * position of the popper element when they are triggered.
2647
   * @method
2648
   * @memberof Popper
2649
   */
2650
  function enableEventListeners() {
2651
    if (!this.state.eventsEnabled) {
2652
      this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
2653
    }
2654
  }
2655
2656
  /**
2657
   * Remove event listeners used to update the popper position
2658
   * @method
2659
   * @memberof Popper.Utils
2660
   * @private
2661
   */
2662
  function removeEventListeners(reference, state) {
2663
    // Remove resize event listener on window
2664
    getWindow(reference).removeEventListener('resize', state.updateBound);
2665
2666
    // Remove scroll event listener on scroll parents
2667
    state.scrollParents.forEach(function (target) {
2668
      target.removeEventListener('scroll', state.updateBound);
2669
    });
2670
2671
    // Reset state
2672
    state.updateBound = null;
2673
    state.scrollParents = [];
2674
    state.scrollElement = null;
2675
    state.eventsEnabled = false;
2676
    return state;
2677
  }
2678
2679
  /**
2680
   * It will remove resize/scroll events and won't recalculate popper position
2681
   * when they are triggered. It also won't trigger `onUpdate` callback anymore,
2682
   * unless you call `update` method manually.
2683
   * @method
2684
   * @memberof Popper
2685
   */
2686
  function disableEventListeners() {
2687
    if (this.state.eventsEnabled) {
2688
      cancelAnimationFrame(this.scheduleUpdate);
2689
      this.state = removeEventListeners(this.reference, this.state);
2690
    }
2691
  }
2692
2693
  /**
2694
   * Tells if a given input is a number
2695
   * @method
2696
   * @memberof Popper.Utils
2697
   * @param {*} input to check
2698
   * @return {Boolean}
2699
   */
2700
  function isNumeric(n) {
2701
    return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
2702
  }
2703
2704
  /**
2705
   * Set the style to the given popper
2706
   * @method
2707
   * @memberof Popper.Utils
2708
   * @argument {Element} element - Element to apply the style to
2709
   * @argument {Object} styles
2710
   * Object with a list of properties and values which will be applied to the element
2711
   */
2712
  function setStyles(element, styles) {
2713
    Object.keys(styles).forEach(function (prop) {
2714
      var unit = '';
2715
      // add unit if the value is numeric and is one of the following
2716
      if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
2717
        unit = 'px';
2718
      }
2719
      element.style[prop] = styles[prop] + unit;
2720
    });
2721
  }
2722
2723
  /**
2724
   * Set the attributes to the given popper
2725
   * @method
2726
   * @memberof Popper.Utils
2727
   * @argument {Element} element - Element to apply the attributes to
2728
   * @argument {Object} styles
2729
   * Object with a list of properties and values which will be applied to the element
2730
   */
2731
  function setAttributes(element, attributes) {
2732
    Object.keys(attributes).forEach(function (prop) {
2733
      var value = attributes[prop];
2734
      if (value !== false) {
2735
        element.setAttribute(prop, attributes[prop]);
2736
      } else {
2737
        element.removeAttribute(prop);
2738
      }
2739
    });
2740
  }
2741
2742
  /**
2743
   * @function
2744
   * @memberof Modifiers
2745
   * @argument {Object} data - The data object generated by `update` method
2746
   * @argument {Object} data.styles - List of style properties - values to apply to popper element
2747
   * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
2748
   * @argument {Object} options - Modifiers configuration and options
2749
   * @returns {Object} The same data object
2750
   */
2751
  function applyStyle(data) {
2752
    // any property present in `data.styles` will be applied to the popper,
2753
    // in this way we can make the 3rd party modifiers add custom styles to it
2754
    // Be aware, modifiers could override the properties defined in the previous
2755
    // lines of this modifier!
2756
    setStyles(data.instance.popper, data.styles);
2757
2758
    // any property present in `data.attributes` will be applied to the popper,
2759
    // they will be set as HTML attributes of the element
2760
    setAttributes(data.instance.popper, data.attributes);
2761
2762
    // if arrowElement is defined and arrowStyles has some properties
2763
    if (data.arrowElement && Object.keys(data.arrowStyles).length) {
2764
      setStyles(data.arrowElement, data.arrowStyles);
2765
    }
2766
2767
    return data;
2768
  }
2769
2770
  /**
2771
   * Set the x-placement attribute before everything else because it could be used
2772
   * to add margins to the popper margins needs to be calculated to get the
2773
   * correct popper offsets.
2774
   * @method
2775
   * @memberof Popper.modifiers
2776
   * @param {HTMLElement} reference - The reference element used to position the popper
2777
   * @param {HTMLElement} popper - The HTML element used as popper
2778
   * @param {Object} options - Popper.js options
2779
   */
2780
  function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
2781
    // compute reference element offsets
2782
    var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
2783
2784
    // compute auto placement, store placement inside the data object,
2785
    // modifiers will be able to edit `placement` if needed
2786
    // and refer to originalPlacement to know the original value
2787
    var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
2788
2789
    popper.setAttribute('x-placement', placement);
2790
2791
    // Apply `position` to popper before anything else because
2792
    // without the position applied we can't guarantee correct computations
2793
    setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
2794
2795
    return options;
2796
  }
2797
2798
  /**
2799
   * @function
2800
   * @memberof Popper.Utils
2801
   * @argument {Object} data - The data object generated by `update` method
2802
   * @argument {Boolean} shouldRound - If the offsets should be rounded at all
2803
   * @returns {Object} The popper's position offsets rounded
2804
   *
2805
   * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
2806
   * good as it can be within reason.
2807
   * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
2808
   *
2809
   * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
2810
   * as well on High DPI screens).
2811
   *
2812
   * Firefox prefers no rounding for positioning and does not have blurriness on
2813
   * high DPI screens.
2814
   *
2815
   * Only horizontal placement and left/right values need to be considered.
2816
   */
2817
  function getRoundedOffsets(data, shouldRound) {
2818
    var _data$offsets = data.offsets,
2819
        popper = _data$offsets.popper,
2820
        reference = _data$offsets.reference;
2821
    var round = Math.round,
2822
        floor = Math.floor;
2823
2824
    var noRound = function noRound(v) {
2825
      return v;
2826
    };
2827
2828
    var referenceWidth = round(reference.width);
2829
    var popperWidth = round(popper.width);
2830
2831
    var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
2832
    var isVariation = data.placement.indexOf('-') !== -1;
2833
    var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
2834
    var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
2835
2836
    var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
2837
    var verticalToInteger = !shouldRound ? noRound : round;
2838
2839
    return {
2840
      left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
2841
      top: verticalToInteger(popper.top),
2842
      bottom: verticalToInteger(popper.bottom),
2843
      right: horizontalToInteger(popper.right)
2844
    };
2845
  }
2846
2847
  var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
2848
2849
  /**
2850
   * @function
2851
   * @memberof Modifiers
2852
   * @argument {Object} data - The data object generated by `update` method
2853
   * @argument {Object} options - Modifiers configuration and options
2854
   * @returns {Object} The data object, properly modified
2855
   */
2856
  function computeStyle(data, options) {
2857
    var x = options.x,
2858
        y = options.y;
2859
    var popper = data.offsets.popper;
2860
2861
    // Remove this legacy support in Popper.js v2
2862
2863
    var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
2864
      return modifier.name === 'applyStyle';
2865
    }).gpuAcceleration;
2866
    if (legacyGpuAccelerationOption !== undefined) {
2867
      console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
2868
    }
2869
    var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
2870
2871
    var offsetParent = getOffsetParent(data.instance.popper);
2872
    var offsetParentRect = getBoundingClientRect(offsetParent);
2873
2874
    // Styles
2875
    var styles = {
2876
      position: popper.position
2877
    };
2878
2879
    var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
2880
2881
    var sideA = x === 'bottom' ? 'top' : 'bottom';
2882
    var sideB = y === 'right' ? 'left' : 'right';
2883
2884
    // if gpuAcceleration is set to `true` and transform is supported,
2885
    //  we use `translate3d` to apply the position to the popper we
2886
    // automatically use the supported prefixed version if needed
2887
    var prefixedProperty = getSupportedPropertyName('transform');
2888
2889
    // now, let's make a step back and look at this code closely (wtf?)
2890
    // If the content of the popper grows once it's been positioned, it
2891
    // may happen that the popper gets misplaced because of the new content
2892
    // overflowing its reference element
2893
    // To avoid this problem, we provide two options (x and y), which allow
2894
    // the consumer to define the offset origin.
2895
    // If we position a popper on top of a reference element, we can set
2896
    // `x` to `top` to make the popper grow towards its top instead of
2897
    // its bottom.
2898
    var left = void 0,
2899
        top = void 0;
2900
    if (sideA === 'bottom') {
2901
      // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
2902
      // and not the bottom of the html element
2903
      if (offsetParent.nodeName === 'HTML') {
2904
        top = -offsetParent.clientHeight + offsets.bottom;
2905
      } else {
2906
        top = -offsetParentRect.height + offsets.bottom;
2907
      }
2908
    } else {
2909
      top = offsets.top;
2910
    }
2911
    if (sideB === 'right') {
2912
      if (offsetParent.nodeName === 'HTML') {
2913
        left = -offsetParent.clientWidth + offsets.right;
2914
      } else {
2915
        left = -offsetParentRect.width + offsets.right;
2916
      }
2917
    } else {
2918
      left = offsets.left;
2919
    }
2920
    if (gpuAcceleration && prefixedProperty) {
2921
      styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
2922
      styles[sideA] = 0;
2923
      styles[sideB] = 0;
2924
      styles.willChange = 'transform';
2925
    } else {
2926
      // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
2927
      var invertTop = sideA === 'bottom' ? -1 : 1;
2928
      var invertLeft = sideB === 'right' ? -1 : 1;
2929
      styles[sideA] = top * invertTop;
2930
      styles[sideB] = left * invertLeft;
2931
      styles.willChange = sideA + ', ' + sideB;
2932
    }
2933
2934
    // Attributes
2935
    var attributes = {
2936
      'x-placement': data.placement
2937
    };
2938
2939
    // Update `data` attributes, styles and arrowStyles
2940
    data.attributes = _extends({}, attributes, data.attributes);
2941
    data.styles = _extends({}, styles, data.styles);
2942
    data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
2943
2944
    return data;
2945
  }
2946
2947
  /**
2948
   * Helper used to know if the given modifier depends from another one.<br />
2949
   * It checks if the needed modifier is listed and enabled.
2950
   * @method
2951
   * @memberof Popper.Utils
2952
   * @param {Array} modifiers - list of modifiers
2953
   * @param {String} requestingName - name of requesting modifier
2954
   * @param {String} requestedName - name of requested modifier
2955
   * @returns {Boolean}
2956
   */
2957
  function isModifierRequired(modifiers, requestingName, requestedName) {
2958
    var requesting = find(modifiers, function (_ref) {
2959
      var name = _ref.name;
2960
      return name === requestingName;
2961
    });
2962
2963
    var isRequired = !!requesting && modifiers.some(function (modifier) {
2964
      return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
2965
    });
2966
2967
    if (!isRequired) {
2968
      var _requesting = '`' + requestingName + '`';
2969
      var requested = '`' + requestedName + '`';
2970
      console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
2971
    }
2972
    return isRequired;
2973
  }
2974
2975
  /**
2976
   * @function
2977
   * @memberof Modifiers
2978
   * @argument {Object} data - The data object generated by update method
2979
   * @argument {Object} options - Modifiers configuration and options
2980
   * @returns {Object} The data object, properly modified
2981
   */
2982
  function arrow(data, options) {
2983
    var _data$offsets$arrow;
2984
2985
    // arrow depends on keepTogether in order to work
2986
    if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
2987
      return data;
2988
    }
2989
2990
    var arrowElement = options.element;
2991
2992
    // if arrowElement is a string, suppose it's a CSS selector
2993
    if (typeof arrowElement === 'string') {
2994
      arrowElement = data.instance.popper.querySelector(arrowElement);
2995
2996
      // if arrowElement is not found, don't run the modifier
2997
      if (!arrowElement) {
2998
        return data;
2999
      }
3000
    } else {
3001
      // if the arrowElement isn't a query selector we must check that the
3002
      // provided DOM node is child of its popper node
3003
      if (!data.instance.popper.contains(arrowElement)) {
3004
        console.warn('WARNING: `arrow.element` must be child of its popper element!');
3005
        return data;
3006
      }
3007
    }
3008
3009
    var placement = data.placement.split('-')[0];
3010
    var _data$offsets = data.offsets,
3011
        popper = _data$offsets.popper,
3012
        reference = _data$offsets.reference;
3013
3014
    var isVertical = ['left', 'right'].indexOf(placement) !== -1;
3015
3016
    var len = isVertical ? 'height' : 'width';
3017
    var sideCapitalized = isVertical ? 'Top' : 'Left';
3018
    var side = sideCapitalized.toLowerCase();
3019
    var altSide = isVertical ? 'left' : 'top';
3020
    var opSide = isVertical ? 'bottom' : 'right';
3021
    var arrowElementSize = getOuterSizes(arrowElement)[len];
3022
3023
    //
3024
    // extends keepTogether behavior making sure the popper and its
3025
    // reference have enough pixels in conjunction
3026
    //
3027
3028
    // top/left side
3029
    if (reference[opSide] - arrowElementSize < popper[side]) {
3030
      data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
3031
    }
3032
    // bottom/right side
3033
    if (reference[side] + arrowElementSize > popper[opSide]) {
3034
      data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
3035
    }
3036
    data.offsets.popper = getClientRect(data.offsets.popper);
3037
3038
    // compute center of the popper
3039
    var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
3040
3041
    // Compute the sideValue using the updated popper offsets
3042
    // take popper margin in account because we don't have this info available
3043
    var css = getStyleComputedProperty(data.instance.popper);
3044
    var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10);
3045
    var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10);
3046
    var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
3047
3048
    // prevent arrowElement from being placed not contiguously to its popper
3049
    sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
3050
3051
    data.arrowElement = arrowElement;
3052
    data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
3053
3054
    return data;
3055
  }
3056
3057
  /**
3058
   * Get the opposite placement variation of the given one
3059
   * @method
3060
   * @memberof Popper.Utils
3061
   * @argument {String} placement variation
3062
   * @returns {String} flipped placement variation
3063
   */
3064
  function getOppositeVariation(variation) {
3065
    if (variation === 'end') {
3066
      return 'start';
3067
    } else if (variation === 'start') {
3068
      return 'end';
3069
    }
3070
    return variation;
3071
  }
3072
3073
  /**
3074
   * List of accepted placements to use as values of the `placement` option.<br />
3075
   * Valid placements are:
3076
   * - `auto`
3077
   * - `top`
3078
   * - `right`
3079
   * - `bottom`
3080
   * - `left`
3081
   *
3082
   * Each placement can have a variation from this list:
3083
   * - `-start`
3084
   * - `-end`
3085
   *
3086
   * Variations are interpreted easily if you think of them as the left to right
3087
   * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
3088
   * is right.<br />
3089
   * Vertically (`left` and `right`), `start` is top and `end` is bottom.
3090
   *
3091
   * Some valid examples are:
3092
   * - `top-end` (on top of reference, right aligned)
3093
   * - `right-start` (on right of reference, top aligned)
3094
   * - `bottom` (on bottom, centered)
3095
   * - `auto-end` (on the side with more space available, alignment depends by placement)
3096
   *
3097
   * @static
3098
   * @type {Array}
3099
   * @enum {String}
3100
   * @readonly
3101
   * @method placements
3102
   * @memberof Popper
3103
   */
3104
  var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
3105
3106
  // Get rid of `auto` `auto-start` and `auto-end`
3107
  var validPlacements = placements.slice(3);
3108
3109
  /**
3110
   * Given an initial placement, returns all the subsequent placements
3111
   * clockwise (or counter-clockwise).
3112
   *
3113
   * @method
3114
   * @memberof Popper.Utils
3115
   * @argument {String} placement - A valid placement (it accepts variations)
3116
   * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
3117
   * @returns {Array} placements including their variations
3118
   */
3119
  function clockwise(placement) {
3120
    var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3121
3122
    var index = validPlacements.indexOf(placement);
3123
    var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
3124
    return counter ? arr.reverse() : arr;
3125
  }
3126
3127
  var BEHAVIORS = {
3128
    FLIP: 'flip',
3129
    CLOCKWISE: 'clockwise',
3130
    COUNTERCLOCKWISE: 'counterclockwise'
3131
  };
3132
3133
  /**
3134
   * @function
3135
   * @memberof Modifiers
3136
   * @argument {Object} data - The data object generated by update method
3137
   * @argument {Object} options - Modifiers configuration and options
3138
   * @returns {Object} The data object, properly modified
3139
   */
3140
  function flip(data, options) {
3141
    // if `inner` modifier is enabled, we can't use the `flip` modifier
3142
    if (isModifierEnabled(data.instance.modifiers, 'inner')) {
3143
      return data;
3144
    }
3145
3146
    if (data.flipped && data.placement === data.originalPlacement) {
3147
      // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
3148
      return data;
3149
    }
3150
3151
    var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
3152
3153
    var placement = data.placement.split('-')[0];
3154
    var placementOpposite = getOppositePlacement(placement);
3155
    var variation = data.placement.split('-')[1] || '';
3156
3157
    var flipOrder = [];
3158
3159
    switch (options.behavior) {
3160
      case BEHAVIORS.FLIP:
3161
        flipOrder = [placement, placementOpposite];
3162
        break;
3163
      case BEHAVIORS.CLOCKWISE:
3164
        flipOrder = clockwise(placement);
3165
        break;
3166
      case BEHAVIORS.COUNTERCLOCKWISE:
3167
        flipOrder = clockwise(placement, true);
3168
        break;
3169
      default:
3170
        flipOrder = options.behavior;
3171
    }
3172
3173
    flipOrder.forEach(function (step, index) {
3174
      if (placement !== step || flipOrder.length === index + 1) {
3175
        return data;
3176
      }
3177
3178
      placement = data.placement.split('-')[0];
3179
      placementOpposite = getOppositePlacement(placement);
3180
3181
      var popperOffsets = data.offsets.popper;
3182
      var refOffsets = data.offsets.reference;
3183
3184
      // using floor because the reference offsets may contain decimals we are not going to consider here
3185
      var floor = Math.floor;
3186
      var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
3187
3188
      var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
3189
      var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
3190
      var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
3191
      var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
3192
3193
      var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
3194
3195
      // flip the variation if required
3196
      var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
3197
3198
      // flips variation if reference element overflows boundaries
3199
      var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
3200
3201
      // flips variation if popper content overflows boundaries
3202
      var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
3203
3204
      var flippedVariation = flippedVariationByRef || flippedVariationByContent;
3205
3206
      if (overlapsRef || overflowsBoundaries || flippedVariation) {
3207
        // this boolean to detect any flip loop
3208
        data.flipped = true;
3209
3210
        if (overlapsRef || overflowsBoundaries) {
3211
          placement = flipOrder[index + 1];
3212
        }
3213
3214
        if (flippedVariation) {
3215
          variation = getOppositeVariation(variation);
3216
        }
3217
3218
        data.placement = placement + (variation ? '-' + variation : '');
3219
3220
        // this object contains `position`, we want to preserve it along with
3221
        // any additional property we may add in the future
3222
        data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
3223
3224
        data = runModifiers(data.instance.modifiers, data, 'flip');
3225
      }
3226
    });
3227
    return data;
3228
  }
3229
3230
  /**
3231
   * @function
3232
   * @memberof Modifiers
3233
   * @argument {Object} data - The data object generated by update method
3234
   * @argument {Object} options - Modifiers configuration and options
3235
   * @returns {Object} The data object, properly modified
3236
   */
3237
  function keepTogether(data) {
3238
    var _data$offsets = data.offsets,
3239
        popper = _data$offsets.popper,
3240
        reference = _data$offsets.reference;
3241
3242
    var placement = data.placement.split('-')[0];
3243
    var floor = Math.floor;
3244
    var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
3245
    var side = isVertical ? 'right' : 'bottom';
3246
    var opSide = isVertical ? 'left' : 'top';
3247
    var measurement = isVertical ? 'width' : 'height';
3248
3249
    if (popper[side] < floor(reference[opSide])) {
3250
      data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
3251
    }
3252
    if (popper[opSide] > floor(reference[side])) {
3253
      data.offsets.popper[opSide] = floor(reference[side]);
3254
    }
3255
3256
    return data;
3257
  }
3258
3259
  /**
3260
   * Converts a string containing value + unit into a px value number
3261
   * @function
3262
   * @memberof {modifiers~offset}
3263
   * @private
3264
   * @argument {String} str - Value + unit string
3265
   * @argument {String} measurement - `height` or `width`
3266
   * @argument {Object} popperOffsets
3267
   * @argument {Object} referenceOffsets
3268
   * @returns {Number|String}
3269
   * Value in pixels, or original string if no values were extracted
3270
   */
3271
  function toValue(str, measurement, popperOffsets, referenceOffsets) {
3272
    // separate value from unit
3273
    var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
3274
    var value = +split[1];
3275
    var unit = split[2];
3276
3277
    // If it's not a number it's an operator, I guess
3278
    if (!value) {
3279
      return str;
3280
    }
3281
3282
    if (unit.indexOf('%') === 0) {
3283
      var element = void 0;
3284
      switch (unit) {
3285
        case '%p':
3286
          element = popperOffsets;
3287
          break;
3288
        case '%':
3289
        case '%r':
3290
        default:
3291
          element = referenceOffsets;
3292
      }
3293
3294
      var rect = getClientRect(element);
3295
      return rect[measurement] / 100 * value;
3296
    } else if (unit === 'vh' || unit === 'vw') {
3297
      // if is a vh or vw, we calculate the size based on the viewport
3298
      var size = void 0;
3299
      if (unit === 'vh') {
3300
        size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
3301
      } else {
3302
        size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
3303
      }
3304
      return size / 100 * value;
3305
    } else {
3306
      // if is an explicit pixel unit, we get rid of the unit and keep the value
3307
      // if is an implicit unit, it's px, and we return just the value
3308
      return value;
3309
    }
3310
  }
3311
3312
  /**
3313
   * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
3314
   * @function
3315
   * @memberof {modifiers~offset}
3316
   * @private
3317
   * @argument {String} offset
3318
   * @argument {Object} popperOffsets
3319
   * @argument {Object} referenceOffsets
3320
   * @argument {String} basePlacement
3321
   * @returns {Array} a two cells array with x and y offsets in numbers
3322
   */
3323
  function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
3324
    var offsets = [0, 0];
3325
3326
    // Use height if placement is left or right and index is 0 otherwise use width
3327
    // in this way the first offset will use an axis and the second one
3328
    // will use the other one
3329
    var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
3330
3331
    // Split the offset string to obtain a list of values and operands
3332
    // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
3333
    var fragments = offset.split(/(\+|\-)/).map(function (frag) {
3334
      return frag.trim();
3335
    });
3336
3337
    // Detect if the offset string contains a pair of values or a single one
3338
    // they could be separated by comma or space
3339
    var divider = fragments.indexOf(find(fragments, function (frag) {
3340
      return frag.search(/,|\s/) !== -1;
3341
    }));
3342
3343
    if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
3344
      console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
3345
    }
3346
3347
    // If divider is found, we divide the list of values and operands to divide
3348
    // them by ofset X and Y.
3349
    var splitRegex = /\s*,\s*|\s+/;
3350
    var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
3351
3352
    // Convert the values with units to absolute pixels to allow our computations
3353
    ops = ops.map(function (op, index) {
3354
      // Most of the units rely on the orientation of the popper
3355
      var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
3356
      var mergeWithPrevious = false;
3357
      return op
3358
      // This aggregates any `+` or `-` sign that aren't considered operators
3359
      // e.g.: 10 + +5 => [10, +, +5]
3360
      .reduce(function (a, b) {
3361
        if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
3362
          a[a.length - 1] = b;
3363
          mergeWithPrevious = true;
3364
          return a;
3365
        } else if (mergeWithPrevious) {
3366
          a[a.length - 1] += b;
3367
          mergeWithPrevious = false;
3368
          return a;
3369
        } else {
3370
          return a.concat(b);
3371
        }
3372
      }, [])
3373
      // Here we convert the string values into number values (in px)
3374
      .map(function (str) {
3375
        return toValue(str, measurement, popperOffsets, referenceOffsets);
3376
      });
3377
    });
3378
3379
    // Loop trough the offsets arrays and execute the operations
3380
    ops.forEach(function (op, index) {
3381
      op.forEach(function (frag, index2) {
3382
        if (isNumeric(frag)) {
3383
          offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
3384
        }
3385
      });
3386
    });
3387
    return offsets;
3388
  }
3389
3390
  /**
3391
   * @function
3392
   * @memberof Modifiers
3393
   * @argument {Object} data - The data object generated by update method
3394
   * @argument {Object} options - Modifiers configuration and options
3395
   * @argument {Number|String} options.offset=0
3396
   * The offset value as described in the modifier description
3397
   * @returns {Object} The data object, properly modified
3398
   */
3399
  function offset(data, _ref) {
3400
    var offset = _ref.offset;
3401
    var placement = data.placement,
3402
        _data$offsets = data.offsets,
3403
        popper = _data$offsets.popper,
3404
        reference = _data$offsets.reference;
3405
3406
    var basePlacement = placement.split('-')[0];
3407
3408
    var offsets = void 0;
3409
    if (isNumeric(+offset)) {
3410
      offsets = [+offset, 0];
3411
    } else {
3412
      offsets = parseOffset(offset, popper, reference, basePlacement);
3413
    }
3414
3415
    if (basePlacement === 'left') {
3416
      popper.top += offsets[0];
3417
      popper.left -= offsets[1];
3418
    } else if (basePlacement === 'right') {
3419
      popper.top += offsets[0];
3420
      popper.left += offsets[1];
3421
    } else if (basePlacement === 'top') {
3422
      popper.left += offsets[0];
3423
      popper.top -= offsets[1];
3424
    } else if (basePlacement === 'bottom') {
3425
      popper.left += offsets[0];
3426
      popper.top += offsets[1];
3427
    }
3428
3429
    data.popper = popper;
3430
    return data;
3431
  }
3432
3433
  /**
3434
   * @function
3435
   * @memberof Modifiers
3436
   * @argument {Object} data - The data object generated by `update` method
3437
   * @argument {Object} options - Modifiers configuration and options
3438
   * @returns {Object} The data object, properly modified
3439
   */
3440
  function preventOverflow(data, options) {
3441
    var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
3442
3443
    // If offsetParent is the reference element, we really want to
3444
    // go one step up and use the next offsetParent as reference to
3445
    // avoid to make this modifier completely useless and look like broken
3446
    if (data.instance.reference === boundariesElement) {
3447
      boundariesElement = getOffsetParent(boundariesElement);
3448
    }
3449
3450
    // NOTE: DOM access here
3451
    // resets the popper's position so that the document size can be calculated excluding
3452
    // the size of the popper element itself
3453
    var transformProp = getSupportedPropertyName('transform');
3454
    var popperStyles = data.instance.popper.style; // assignment to help minification
3455
    var top = popperStyles.top,
3456
        left = popperStyles.left,
3457
        transform = popperStyles[transformProp];
3458
3459
    popperStyles.top = '';
3460
    popperStyles.left = '';
3461
    popperStyles[transformProp] = '';
3462
3463
    var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
3464
3465
    // NOTE: DOM access here
3466
    // restores the original style properties after the offsets have been computed
3467
    popperStyles.top = top;
3468
    popperStyles.left = left;
3469
    popperStyles[transformProp] = transform;
3470
3471
    options.boundaries = boundaries;
3472
3473
    var order = options.priority;
3474
    var popper = data.offsets.popper;
3475
3476
    var check = {
3477
      primary: function primary(placement) {
3478
        var value = popper[placement];
3479
        if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
3480
          value = Math.max(popper[placement], boundaries[placement]);
3481
        }
3482
        return defineProperty({}, placement, value);
3483
      },
3484
      secondary: function secondary(placement) {
3485
        var mainSide = placement === 'right' ? 'left' : 'top';
3486
        var value = popper[mainSide];
3487
        if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
3488
          value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
3489
        }
3490
        return defineProperty({}, mainSide, value);
3491
      }
3492
    };
3493
3494
    order.forEach(function (placement) {
3495
      var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
3496
      popper = _extends({}, popper, check[side](placement));
3497
    });
3498
3499
    data.offsets.popper = popper;
3500
3501
    return data;
3502
  }
3503
3504
  /**
3505
   * @function
3506
   * @memberof Modifiers
3507
   * @argument {Object} data - The data object generated by `update` method
3508
   * @argument {Object} options - Modifiers configuration and options
3509
   * @returns {Object} The data object, properly modified
3510
   */
3511
  function shift(data) {
3512
    var placement = data.placement;
3513
    var basePlacement = placement.split('-')[0];
3514
    var shiftvariation = placement.split('-')[1];
3515
3516
    // if shift shiftvariation is specified, run the modifier
3517
    if (shiftvariation) {
3518
      var _data$offsets = data.offsets,
3519
          reference = _data$offsets.reference,
3520
          popper = _data$offsets.popper;
3521
3522
      var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
3523
      var side = isVertical ? 'left' : 'top';
3524
      var measurement = isVertical ? 'width' : 'height';
3525
3526
      var shiftOffsets = {
3527
        start: defineProperty({}, side, reference[side]),
3528
        end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
3529
      };
3530
3531
      data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
3532
    }
3533
3534
    return data;
3535
  }
3536
3537
  /**
3538
   * @function
3539
   * @memberof Modifiers
3540
   * @argument {Object} data - The data object generated by update method
3541
   * @argument {Object} options - Modifiers configuration and options
3542
   * @returns {Object} The data object, properly modified
3543
   */
3544
  function hide(data) {
3545
    if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
3546
      return data;
3547
    }
3548
3549
    var refRect = data.offsets.reference;
3550
    var bound = find(data.instance.modifiers, function (modifier) {
3551
      return modifier.name === 'preventOverflow';
3552
    }).boundaries;
3553
3554
    if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
3555
      // Avoid unnecessary DOM access if visibility hasn't changed
3556
      if (data.hide === true) {
3557
        return data;
3558
      }
3559
3560
      data.hide = true;
3561
      data.attributes['x-out-of-boundaries'] = '';
3562
    } else {
3563
      // Avoid unnecessary DOM access if visibility hasn't changed
3564
      if (data.hide === false) {
3565
        return data;
3566
      }
3567
3568
      data.hide = false;
3569
      data.attributes['x-out-of-boundaries'] = false;
3570
    }
3571
3572
    return data;
3573
  }
3574
3575
  /**
3576
   * @function
3577
   * @memberof Modifiers
3578
   * @argument {Object} data - The data object generated by `update` method
3579
   * @argument {Object} options - Modifiers configuration and options
3580
   * @returns {Object} The data object, properly modified
3581
   */
3582
  function inner(data) {
3583
    var placement = data.placement;
3584
    var basePlacement = placement.split('-')[0];
3585
    var _data$offsets = data.offsets,
3586
        popper = _data$offsets.popper,
3587
        reference = _data$offsets.reference;
3588
3589
    var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
3590
3591
    var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
3592
3593
    popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
3594
3595
    data.placement = getOppositePlacement(placement);
3596
    data.offsets.popper = getClientRect(popper);
3597
3598
    return data;
3599
  }
3600
3601
  /**
3602
   * Modifier function, each modifier can have a function of this type assigned
3603
   * to its `fn` property.<br />
3604
   * These functions will be called on each update, this means that you must
3605
   * make sure they are performant enough to avoid performance bottlenecks.
3606
   *
3607
   * @function ModifierFn
3608
   * @argument {dataObject} data - The data object generated by `update` method
3609
   * @argument {Object} options - Modifiers configuration and options
3610
   * @returns {dataObject} The data object, properly modified
3611
   */
3612
3613
  /**
3614
   * Modifiers are plugins used to alter the behavior of your poppers.<br />
3615
   * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
3616
   * needed by the library.
3617
   *
3618
   * Usually you don't want to override the `order`, `fn` and `onLoad` props.
3619
   * All the other properties are configurations that could be tweaked.
3620
   * @namespace modifiers
3621
   */
3622
  var modifiers = {
3623
    /**
3624
     * Modifier used to shift the popper on the start or end of its reference
3625
     * element.<br />
3626
     * It will read the variation of the `placement` property.<br />
3627
     * It can be one either `-end` or `-start`.
3628
     * @memberof modifiers
3629
     * @inner
3630
     */
3631
    shift: {
3632
      /** @prop {number} order=100 - Index used to define the order of execution */
3633
      order: 100,
3634
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3635
      enabled: true,
3636
      /** @prop {ModifierFn} */
3637
      fn: shift
3638
    },
3639
3640
    /**
3641
     * The `offset` modifier can shift your popper on both its axis.
3642
     *
3643
     * It accepts the following units:
3644
     * - `px` or unit-less, interpreted as pixels
3645
     * - `%` or `%r`, percentage relative to the length of the reference element
3646
     * - `%p`, percentage relative to the length of the popper element
3647
     * - `vw`, CSS viewport width unit
3648
     * - `vh`, CSS viewport height unit
3649
     *
3650
     * For length is intended the main axis relative to the placement of the popper.<br />
3651
     * This means that if the placement is `top` or `bottom`, the length will be the
3652
     * `width`. In case of `left` or `right`, it will be the `height`.
3653
     *
3654
     * You can provide a single value (as `Number` or `String`), or a pair of values
3655
     * as `String` divided by a comma or one (or more) white spaces.<br />
3656
     * The latter is a deprecated method because it leads to confusion and will be
3657
     * removed in v2.<br />
3658
     * Additionally, it accepts additions and subtractions between different units.
3659
     * Note that multiplications and divisions aren't supported.
3660
     *
3661
     * Valid examples are:
3662
     * ```
3663
     * 10
3664
     * '10%'
3665
     * '10, 10'
3666
     * '10%, 10'
3667
     * '10 + 10%'
3668
     * '10 - 5vh + 3%'
3669
     * '-10px + 5vh, 5px - 6%'
3670
     * ```
3671
     * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
3672
     * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
3673
     * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
3674
     *
3675
     * @memberof modifiers
3676
     * @inner
3677
     */
3678
    offset: {
3679
      /** @prop {number} order=200 - Index used to define the order of execution */
3680
      order: 200,
3681
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3682
      enabled: true,
3683
      /** @prop {ModifierFn} */
3684
      fn: offset,
3685
      /** @prop {Number|String} offset=0
3686
       * The offset value as described in the modifier description
3687
       */
3688
      offset: 0
3689
    },
3690
3691
    /**
3692
     * Modifier used to prevent the popper from being positioned outside the boundary.
3693
     *
3694
     * A scenario exists where the reference itself is not within the boundaries.<br />
3695
     * We can say it has "escaped the boundaries" — or just "escaped".<br />
3696
     * In this case we need to decide whether the popper should either:
3697
     *
3698
     * - detach from the reference and remain "trapped" in the boundaries, or
3699
     * - if it should ignore the boundary and "escape with its reference"
3700
     *
3701
     * When `escapeWithReference` is set to`true` and reference is completely
3702
     * outside its boundaries, the popper will overflow (or completely leave)
3703
     * the boundaries in order to remain attached to the edge of the reference.
3704
     *
3705
     * @memberof modifiers
3706
     * @inner
3707
     */
3708
    preventOverflow: {
3709
      /** @prop {number} order=300 - Index used to define the order of execution */
3710
      order: 300,
3711
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3712
      enabled: true,
3713
      /** @prop {ModifierFn} */
3714
      fn: preventOverflow,
3715
      /**
3716
       * @prop {Array} [priority=['left','right','top','bottom']]
3717
       * Popper will try to prevent overflow following these priorities by default,
3718
       * then, it could overflow on the left and on top of the `boundariesElement`
3719
       */
3720
      priority: ['left', 'right', 'top', 'bottom'],
3721
      /**
3722
       * @prop {number} padding=5
3723
       * Amount of pixel used to define a minimum distance between the boundaries
3724
       * and the popper. This makes sure the popper always has a little padding
3725
       * between the edges of its container
3726
       */
3727
      padding: 5,
3728
      /**
3729
       * @prop {String|HTMLElement} boundariesElement='scrollParent'
3730
       * Boundaries used by the modifier. Can be `scrollParent`, `window`,
3731
       * `viewport` or any DOM element.
3732
       */
3733
      boundariesElement: 'scrollParent'
3734
    },
3735
3736
    /**
3737
     * Modifier used to make sure the reference and its popper stay near each other
3738
     * without leaving any gap between the two. Especially useful when the arrow is
3739
     * enabled and you want to ensure that it points to its reference element.
3740
     * It cares only about the first axis. You can still have poppers with margin
3741
     * between the popper and its reference element.
3742
     * @memberof modifiers
3743
     * @inner
3744
     */
3745
    keepTogether: {
3746
      /** @prop {number} order=400 - Index used to define the order of execution */
3747
      order: 400,
3748
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3749
      enabled: true,
3750
      /** @prop {ModifierFn} */
3751
      fn: keepTogether
3752
    },
3753
3754
    /**
3755
     * This modifier is used to move the `arrowElement` of the popper to make
3756
     * sure it is positioned between the reference element and its popper element.
3757
     * It will read the outer size of the `arrowElement` node to detect how many
3758
     * pixels of conjunction are needed.
3759
     *
3760
     * It has no effect if no `arrowElement` is provided.
3761
     * @memberof modifiers
3762
     * @inner
3763
     */
3764
    arrow: {
3765
      /** @prop {number} order=500 - Index used to define the order of execution */
3766
      order: 500,
3767
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3768
      enabled: true,
3769
      /** @prop {ModifierFn} */
3770
      fn: arrow,
3771
      /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
3772
      element: '[x-arrow]'
3773
    },
3774
3775
    /**
3776
     * Modifier used to flip the popper's placement when it starts to overlap its
3777
     * reference element.
3778
     *
3779
     * Requires the `preventOverflow` modifier before it in order to work.
3780
     *
3781
     * **NOTE:** this modifier will interrupt the current update cycle and will
3782
     * restart it if it detects the need to flip the placement.
3783
     * @memberof modifiers
3784
     * @inner
3785
     */
3786
    flip: {
3787
      /** @prop {number} order=600 - Index used to define the order of execution */
3788
      order: 600,
3789
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3790
      enabled: true,
3791
      /** @prop {ModifierFn} */
3792
      fn: flip,
3793
      /**
3794
       * @prop {String|Array} behavior='flip'
3795
       * The behavior used to change the popper's placement. It can be one of
3796
       * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
3797
       * placements (with optional variations)
3798
       */
3799
      behavior: 'flip',
3800
      /**
3801
       * @prop {number} padding=5
3802
       * The popper will flip if it hits the edges of the `boundariesElement`
3803
       */
3804
      padding: 5,
3805
      /**
3806
       * @prop {String|HTMLElement} boundariesElement='viewport'
3807
       * The element which will define the boundaries of the popper position.
3808
       * The popper will never be placed outside of the defined boundaries
3809
       * (except if `keepTogether` is enabled)
3810
       */
3811
      boundariesElement: 'viewport',
3812
      /**
3813
       * @prop {Boolean} flipVariations=false
3814
       * The popper will switch placement variation between `-start` and `-end` when
3815
       * the reference element overlaps its boundaries.
3816
       *
3817
       * The original placement should have a set variation.
3818
       */
3819
      flipVariations: false,
3820
      /**
3821
       * @prop {Boolean} flipVariationsByContent=false
3822
       * The popper will switch placement variation between `-start` and `-end` when
3823
       * the popper element overlaps its reference boundaries.
3824
       *
3825
       * The original placement should have a set variation.
3826
       */
3827
      flipVariationsByContent: false
3828
    },
3829
3830
    /**
3831
     * Modifier used to make the popper flow toward the inner of the reference element.
3832
     * By default, when this modifier is disabled, the popper will be placed outside
3833
     * the reference element.
3834
     * @memberof modifiers
3835
     * @inner
3836
     */
3837
    inner: {
3838
      /** @prop {number} order=700 - Index used to define the order of execution */
3839
      order: 700,
3840
      /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
3841
      enabled: false,
3842
      /** @prop {ModifierFn} */
3843
      fn: inner
3844
    },
3845
3846
    /**
3847
     * Modifier used to hide the popper when its reference element is outside of the
3848
     * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
3849
     * be used to hide with a CSS selector the popper when its reference is
3850
     * out of boundaries.
3851
     *
3852
     * Requires the `preventOverflow` modifier before it in order to work.
3853
     * @memberof modifiers
3854
     * @inner
3855
     */
3856
    hide: {
3857
      /** @prop {number} order=800 - Index used to define the order of execution */
3858
      order: 800,
3859
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3860
      enabled: true,
3861
      /** @prop {ModifierFn} */
3862
      fn: hide
3863
    },
3864
3865
    /**
3866
     * Computes the style that will be applied to the popper element to gets
3867
     * properly positioned.
3868
     *
3869
     * Note that this modifier will not touch the DOM, it just prepares the styles
3870
     * so that `applyStyle` modifier can apply it. This separation is useful
3871
     * in case you need to replace `applyStyle` with a custom implementation.
3872
     *
3873
     * This modifier has `850` as `order` value to maintain backward compatibility
3874
     * with previous versions of Popper.js. Expect the modifiers ordering method
3875
     * to change in future major versions of the library.
3876
     *
3877
     * @memberof modifiers
3878
     * @inner
3879
     */
3880
    computeStyle: {
3881
      /** @prop {number} order=850 - Index used to define the order of execution */
3882
      order: 850,
3883
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3884
      enabled: true,
3885
      /** @prop {ModifierFn} */
3886
      fn: computeStyle,
3887
      /**
3888
       * @prop {Boolean} gpuAcceleration=true
3889
       * If true, it uses the CSS 3D transformation to position the popper.
3890
       * Otherwise, it will use the `top` and `left` properties
3891
       */
3892
      gpuAcceleration: true,
3893
      /**
3894
       * @prop {string} [x='bottom']
3895
       * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
3896
       * Change this if your popper should grow in a direction different from `bottom`
3897
       */
3898
      x: 'bottom',
3899
      /**
3900
       * @prop {string} [x='left']
3901
       * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
3902
       * Change this if your popper should grow in a direction different from `right`
3903
       */
3904
      y: 'right'
3905
    },
3906
3907
    /**
3908
     * Applies the computed styles to the popper element.
3909
     *
3910
     * All the DOM manipulations are limited to this modifier. This is useful in case
3911
     * you want to integrate Popper.js inside a framework or view library and you
3912
     * want to delegate all the DOM manipulations to it.
3913
     *
3914
     * Note that if you disable this modifier, you must make sure the popper element
3915
     * has its position set to `absolute` before Popper.js can do its work!
3916
     *
3917
     * Just disable this modifier and define your own to achieve the desired effect.
3918
     *
3919
     * @memberof modifiers
3920
     * @inner
3921
     */
3922
    applyStyle: {
3923
      /** @prop {number} order=900 - Index used to define the order of execution */
3924
      order: 900,
3925
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3926
      enabled: true,
3927
      /** @prop {ModifierFn} */
3928
      fn: applyStyle,
3929
      /** @prop {Function} */
3930
      onLoad: applyStyleOnLoad,
3931
      /**
3932
       * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
3933
       * @prop {Boolean} gpuAcceleration=true
3934
       * If true, it uses the CSS 3D transformation to position the popper.
3935
       * Otherwise, it will use the `top` and `left` properties
3936
       */
3937
      gpuAcceleration: undefined
3938
    }
3939
  };
3940
3941
  /**
3942
   * The `dataObject` is an object containing all the information used by Popper.js.
3943
   * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
3944
   * @name dataObject
3945
   * @property {Object} data.instance The Popper.js instance
3946
   * @property {String} data.placement Placement applied to popper
3947
   * @property {String} data.originalPlacement Placement originally defined on init
3948
   * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
3949
   * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
3950
   * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
3951
   * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
3952
   * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
3953
   * @property {Object} data.boundaries Offsets of the popper boundaries
3954
   * @property {Object} data.offsets The measurements of popper, reference and arrow elements
3955
   * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
3956
   * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
3957
   * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
3958
   */
3959
3960
  /**
3961
   * Default options provided to Popper.js constructor.<br />
3962
   * These can be overridden using the `options` argument of Popper.js.<br />
3963
   * To override an option, simply pass an object with the same
3964
   * structure of the `options` object, as the 3rd argument. For example:
3965
   * ```
3966
   * new Popper(ref, pop, {
3967
   *   modifiers: {
3968
   *     preventOverflow: { enabled: false }
3969
   *   }
3970
   * })
3971
   * ```
3972
   * @type {Object}
3973
   * @static
3974
   * @memberof Popper
3975
   */
3976
  var Defaults = {
3977
    /**
3978
     * Popper's placement.
3979
     * @prop {Popper.placements} placement='bottom'
3980
     */
3981
    placement: 'bottom',
3982
3983
    /**
3984
     * Set this to true if you want popper to position it self in 'fixed' mode
3985
     * @prop {Boolean} positionFixed=false
3986
     */
3987
    positionFixed: false,
3988
3989
    /**
3990
     * Whether events (resize, scroll) are initially enabled.
3991
     * @prop {Boolean} eventsEnabled=true
3992
     */
3993
    eventsEnabled: true,
3994
3995
    /**
3996
     * Set to true if you want to automatically remove the popper when
3997
     * you call the `destroy` method.
3998
     * @prop {Boolean} removeOnDestroy=false
3999
     */
4000
    removeOnDestroy: false,
4001
4002
    /**
4003
     * Callback called when the popper is created.<br />
4004
     * By default, it is set to no-op.<br />
4005
     * Access Popper.js instance with `data.instance`.
4006
     * @prop {onCreate}
4007
     */
4008
    onCreate: function onCreate() {},
4009
4010
    /**
4011
     * Callback called when the popper is updated. This callback is not called
4012
     * on the initialization/creation of the popper, but only on subsequent
4013
     * updates.<br />
4014
     * By default, it is set to no-op.<br />
4015
     * Access Popper.js instance with `data.instance`.
4016
     * @prop {onUpdate}
4017
     */
4018
    onUpdate: function onUpdate() {},
4019
4020
    /**
4021
     * List of modifiers used to modify the offsets before they are applied to the popper.
4022
     * They provide most of the functionalities of Popper.js.
4023
     * @prop {modifiers}
4024
     */
4025
    modifiers: modifiers
4026
  };
4027
4028
  /**
4029
   * @callback onCreate
4030
   * @param {dataObject} data
4031
   */
4032
4033
  /**
4034
   * @callback onUpdate
4035
   * @param {dataObject} data
4036
   */
4037
4038
  // Utils
4039
  // Methods
4040
  var Popper = function () {
4041
    /**
4042
     * Creates a new Popper.js instance.
4043
     * @class Popper
4044
     * @param {Element|referenceObject} reference - The reference element used to position the popper
4045
     * @param {Element} popper - The HTML / XML element used as the popper
4046
     * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
4047
     * @return {Object} instance - The generated Popper.js instance
4048
     */
4049
    function Popper(reference, popper) {
4050
      var _this = this;
4051
4052
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
4053
      classCallCheck(this, Popper);
4054
4055
      this.scheduleUpdate = function () {
4056
        return requestAnimationFrame(_this.update);
4057
      };
4058
4059
      // make update() debounced, so that it only runs at most once-per-tick
4060
      this.update = debounce(this.update.bind(this));
4061
4062
      // with {} we create a new object with the options inside it
4063
      this.options = _extends({}, Popper.Defaults, options);
4064
4065
      // init state
4066
      this.state = {
4067
        isDestroyed: false,
4068
        isCreated: false,
4069
        scrollParents: []
4070
      };
4071
4072
      // get reference and popper elements (allow jQuery wrappers)
4073
      this.reference = reference && reference.jquery ? reference[0] : reference;
4074
      this.popper = popper && popper.jquery ? popper[0] : popper;
4075
4076
      // Deep merge modifiers options
4077
      this.options.modifiers = {};
4078
      Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
4079
        _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
4080
      });
4081
4082
      // Refactoring modifiers' list (Object => Array)
4083
      this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
4084
        return _extends({
4085
          name: name
4086
        }, _this.options.modifiers[name]);
4087
      })
4088
      // sort the modifiers by order
4089
      .sort(function (a, b) {
4090
        return a.order - b.order;
4091
      });
4092
4093
      // modifiers have the ability to execute arbitrary code when Popper.js get inited
4094
      // such code is executed in the same order of its modifier
4095
      // they could add new properties to their options configuration
4096
      // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
4097
      this.modifiers.forEach(function (modifierOptions) {
4098
        if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
4099
          modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
4100
        }
4101
      });
4102
4103
      // fire the first update to position the popper in the right place
4104
      this.update();
4105
4106
      var eventsEnabled = this.options.eventsEnabled;
4107
      if (eventsEnabled) {
4108
        // setup event listeners, they will take care of update the position in specific situations
4109
        this.enableEventListeners();
4110
      }
4111
4112
      this.state.eventsEnabled = eventsEnabled;
4113
    }
4114
4115
    // We can't use class properties because they don't get listed in the
4116
    // class prototype and break stuff like Sinon stubs
4117
4118
4119
    createClass(Popper, [{
4120
      key: 'update',
4121
      value: function update$$1() {
4122
        return update.call(this);
4123
      }
4124
    }, {
4125
      key: 'destroy',
4126
      value: function destroy$$1() {
4127
        return destroy.call(this);
4128
      }
4129
    }, {
4130
      key: 'enableEventListeners',
4131
      value: function enableEventListeners$$1() {
4132
        return enableEventListeners.call(this);
4133
      }
4134
    }, {
4135
      key: 'disableEventListeners',
4136
      value: function disableEventListeners$$1() {
4137
        return disableEventListeners.call(this);
4138
      }
4139
4140
      /**
4141
       * Schedules an update. It will run on the next UI update available.
4142
       * @method scheduleUpdate
4143
       * @memberof Popper
4144
       */
4145
4146
4147
      /**
4148
       * Collection of utilities useful when writing custom modifiers.
4149
       * Starting from version 1.7, this method is available only if you
4150
       * include `popper-utils.js` before `popper.js`.
4151
       *
4152
       * **DEPRECATION**: This way to access PopperUtils is deprecated
4153
       * and will be removed in v2! Use the PopperUtils module directly instead.
4154
       * Due to the high instability of the methods contained in Utils, we can't
4155
       * guarantee them to follow semver. Use them at your own risk!
4156
       * @static
4157
       * @private
4158
       * @type {Object}
4159
       * @deprecated since version 1.8
4160
       * @member Utils
4161
       * @memberof Popper
4162
       */
4163
4164
    }]);
4165
    return Popper;
4166
  }();
4167
4168
  /**
4169
   * The `referenceObject` is an object that provides an interface compatible with Popper.js
4170
   * and lets you use it as replacement of a real DOM node.<br />
4171
   * You can use this method to position a popper relatively to a set of coordinates
4172
   * in case you don't have a DOM node to use as reference.
4173
   *
4174
   * ```
4175
   * new Popper(referenceObject, popperNode);
4176
   * ```
4177
   *
4178
   * NB: This feature isn't supported in Internet Explorer 10.
4179
   * @name referenceObject
4180
   * @property {Function} data.getBoundingClientRect
4181
   * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
4182
   * @property {number} data.clientWidth
4183
   * An ES6 getter that will return the width of the virtual reference element.
4184
   * @property {number} data.clientHeight
4185
   * An ES6 getter that will return the height of the virtual reference element.
4186
   */
4187
4188
4189
  Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
4190
  Popper.placements = placements;
4191
  Popper.Defaults = Defaults;
4192
4193
  /**
4194
   * ------------------------------------------------------------------------
4195
   * Constants
4196
   * ------------------------------------------------------------------------
4197
   */
4198
4199
  var NAME$4 = 'dropdown';
4200
  var VERSION$4 = '4.4.1';
4201
  var DATA_KEY$4 = 'bs.dropdown';
4202
  var EVENT_KEY$4 = "." + DATA_KEY$4;
4203
  var DATA_API_KEY$4 = '.data-api';
4204
  var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
4205
  var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
4206
4207
  var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
4208
4209
  var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
4210
4211
  var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
4212
4213
  var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
4214
4215
  var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
4216
4217
  var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
4218
  var Event$4 = {
4219
    HIDE: "hide" + EVENT_KEY$4,
4220
    HIDDEN: "hidden" + EVENT_KEY$4,
4221
    SHOW: "show" + EVENT_KEY$4,
4222
    SHOWN: "shown" + EVENT_KEY$4,
4223
    CLICK: "click" + EVENT_KEY$4,
4224
    CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
4225
    KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
4226
    KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
4227
  };
4228
  var ClassName$4 = {
4229
    DISABLED: 'disabled',
4230
    SHOW: 'show',
4231
    DROPUP: 'dropup',
4232
    DROPRIGHT: 'dropright',
4233
    DROPLEFT: 'dropleft',
4234
    MENURIGHT: 'dropdown-menu-right',
4235
    MENULEFT: 'dropdown-menu-left',
4236
    POSITION_STATIC: 'position-static'
4237
  };
4238
  var Selector$4 = {
4239
    DATA_TOGGLE: '[data-toggle="dropdown"]',
4240
    FORM_CHILD: '.dropdown form',
4241
    MENU: '.dropdown-menu',
4242
    NAVBAR_NAV: '.navbar-nav',
4243
    VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
4244
  };
4245
  var AttachmentMap = {
4246
    TOP: 'top-start',
4247
    TOPEND: 'top-end',
4248
    BOTTOM: 'bottom-start',
4249
    BOTTOMEND: 'bottom-end',
4250
    RIGHT: 'right-start',
4251
    RIGHTEND: 'right-end',
4252
    LEFT: 'left-start',
4253
    LEFTEND: 'left-end'
4254
  };
4255
  var Default$2 = {
4256
    offset: 0,
4257
    flip: true,
4258
    boundary: 'scrollParent',
4259
    reference: 'toggle',
4260
    display: 'dynamic',
4261
    popperConfig: null
4262
  };
4263
  var DefaultType$2 = {
4264
    offset: '(number|string|function)',
4265
    flip: 'boolean',
4266
    boundary: '(string|element)',
4267
    reference: '(string|element)',
4268
    display: 'string',
4269
    popperConfig: '(null|object)'
4270
  };
4271
  /**
4272
   * ------------------------------------------------------------------------
4273
   * Class Definition
4274
   * ------------------------------------------------------------------------
4275
   */
4276
4277
  var Dropdown =
4278
  /*#__PURE__*/
4279
  function () {
4280
    function Dropdown(element, config) {
4281
      this._element = element;
4282
      this._popper = null;
4283
      this._config = this._getConfig(config);
4284
      this._menu = this._getMenuElement();
4285
      this._inNavbar = this._detectNavbar();
4286
4287
      this._addEventListeners();
4288
    } // Getters
4289
4290
4291
    var _proto = Dropdown.prototype;
4292
4293
    // Public
4294
    _proto.toggle = function toggle() {
4295
      if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
4296
        return;
4297
      }
4298
4299
      var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
4300
4301
      Dropdown._clearMenus();
4302
4303
      if (isActive) {
4304
        return;
4305
      }
4306
4307
      this.show(true);
4308
    };
4309
4310
    _proto.show = function show(usePopper) {
4311
      if (usePopper === void 0) {
4312
        usePopper = false;
4313
      }
4314
4315
      if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
4316
        return;
4317
      }
4318
4319
      var relatedTarget = {
4320
        relatedTarget: this._element
4321
      };
4322
      var showEvent = $.Event(Event$4.SHOW, relatedTarget);
4323
4324
      var parent = Dropdown._getParentFromElement(this._element);
4325
4326
      $(parent).trigger(showEvent);
4327
4328
      if (showEvent.isDefaultPrevented()) {
4329
        return;
4330
      } // Disable totally Popper.js for Dropdown in Navbar
4331
4332
4333
      if (!this._inNavbar && usePopper) {
4334
        /**
4335
         * Check for Popper dependency
4336
         * Popper - https://popper.js.org
4337
         */
4338
        if (typeof Popper === 'undefined') {
4339
          throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
4340
        }
4341
4342
        var referenceElement = this._element;
4343
4344
        if (this._config.reference === 'parent') {
4345
          referenceElement = parent;
4346
        } else if (Util.isElement(this._config.reference)) {
4347
          referenceElement = this._config.reference; // Check if it's jQuery element
4348
4349
          if (typeof this._config.reference.jquery !== 'undefined') {
4350
            referenceElement = this._config.reference[0];
4351
          }
4352
        } // If boundary is not `scrollParent`, then set position to `static`
4353
        // to allow the menu to "escape" the scroll parent's boundaries
4354
        // https://github.com/twbs/bootstrap/issues/24251
4355
4356
4357
        if (this._config.boundary !== 'scrollParent') {
4358
          $(parent).addClass(ClassName$4.POSITION_STATIC);
4359
        }
4360
4361
        this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
4362
      } // If this is a touch-enabled device we add extra
4363
      // empty mouseover listeners to the body's immediate children;
4364
      // only needed because of broken event delegation on iOS
4365
      // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
4366
4367
4368
      if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
4369
        $(document.body).children().on('mouseover', null, $.noop);
4370
      }
4371
4372
      this._element.focus();
4373
4374
      this._element.setAttribute('aria-expanded', true);
4375
4376
      $(this._menu).toggleClass(ClassName$4.SHOW);
4377
      $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
4378
    };
4379
4380
    _proto.hide = function hide() {
4381
      if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
4382
        return;
4383
      }
4384
4385
      var relatedTarget = {
4386
        relatedTarget: this._element
4387
      };
4388
      var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
4389
4390
      var parent = Dropdown._getParentFromElement(this._element);
4391
4392
      $(parent).trigger(hideEvent);
4393
4394
      if (hideEvent.isDefaultPrevented()) {
4395
        return;
4396
      }
4397
4398
      if (this._popper) {
4399
        this._popper.destroy();
4400
      }
4401
4402
      $(this._menu).toggleClass(ClassName$4.SHOW);
4403
      $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
4404
    };
4405
4406
    _proto.dispose = function dispose() {
4407
      $.removeData(this._element, DATA_KEY$4);
4408
      $(this._element).off(EVENT_KEY$4);
4409
      this._element = null;
4410
      this._menu = null;
4411
4412
      if (this._popper !== null) {
4413
        this._popper.destroy();
4414
4415
        this._popper = null;
4416
      }
4417
    };
4418
4419
    _proto.update = function update() {
4420
      this._inNavbar = this._detectNavbar();
4421
4422
      if (this._popper !== null) {
4423
        this._popper.scheduleUpdate();
4424
      }
4425
    } // Private
4426
    ;
4427
4428
    _proto._addEventListeners = function _addEventListeners() {
4429
      var _this = this;
4430
4431
      $(this._element).on(Event$4.CLICK, function (event) {
4432
        event.preventDefault();
4433
        event.stopPropagation();
4434
4435
        _this.toggle();
4436
      });
4437
    };
4438
4439
    _proto._getConfig = function _getConfig(config) {
4440
      config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
4441
      Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
4442
      return config;
4443
    };
4444
4445
    _proto._getMenuElement = function _getMenuElement() {
4446
      if (!this._menu) {
4447
        var parent = Dropdown._getParentFromElement(this._element);
4448
4449
        if (parent) {
4450
          this._menu = parent.querySelector(Selector$4.MENU);
4451
        }
4452
      }
4453
4454
      return this._menu;
4455
    };
4456
4457
    _proto._getPlacement = function _getPlacement() {
4458
      var $parentDropdown = $(this._element.parentNode);
4459
      var placement = AttachmentMap.BOTTOM; // Handle dropup
4460
4461
      if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
4462
        placement = AttachmentMap.TOP;
4463
4464
        if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
4465
          placement = AttachmentMap.TOPEND;
4466
        }
4467
      } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
4468
        placement = AttachmentMap.RIGHT;
4469
      } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
4470
        placement = AttachmentMap.LEFT;
4471
      } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
4472
        placement = AttachmentMap.BOTTOMEND;
4473
      }
4474
4475
      return placement;
4476
    };
4477
4478
    _proto._detectNavbar = function _detectNavbar() {
4479
      return $(this._element).closest('.navbar').length > 0;
4480
    };
4481
4482
    _proto._getOffset = function _getOffset() {
4483
      var _this2 = this;
4484
4485
      var offset = {};
4486
4487
      if (typeof this._config.offset === 'function') {
4488
        offset.fn = function (data) {
4489
          data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
4490
          return data;
4491
        };
4492
      } else {
4493
        offset.offset = this._config.offset;
4494
      }
4495
4496
      return offset;
4497
    };
4498
4499
    _proto._getPopperConfig = function _getPopperConfig() {
4500
      var popperConfig = {
4501
        placement: this._getPlacement(),
4502
        modifiers: {
4503
          offset: this._getOffset(),
4504
          flip: {
4505
            enabled: this._config.flip
4506
          },
4507
          preventOverflow: {
4508
            boundariesElement: this._config.boundary
4509
          }
4510
        }
4511
      }; // Disable Popper.js if we have a static display
4512
4513
      if (this._config.display === 'static') {
4514
        popperConfig.modifiers.applyStyle = {
4515
          enabled: false
4516
        };
4517
      }
4518
4519
      return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
4520
    } // Static
4521
    ;
4522
4523
    Dropdown._jQueryInterface = function _jQueryInterface(config) {
4524
      return this.each(function () {
4525
        var data = $(this).data(DATA_KEY$4);
4526
4527
        var _config = typeof config === 'object' ? config : null;
4528
4529
        if (!data) {
4530
          data = new Dropdown(this, _config);
4531
          $(this).data(DATA_KEY$4, data);
4532
        }
4533
4534
        if (typeof config === 'string') {
4535
          if (typeof data[config] === 'undefined') {
4536
            throw new TypeError("No method named \"" + config + "\"");
4537
          }
4538
4539
          data[config]();
4540
        }
4541
      });
4542
    };
4543
4544
    Dropdown._clearMenus = function _clearMenus(event) {
4545
      if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
4546
        return;
4547
      }
4548
4549
      var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
4550
4551
      for (var i = 0, len = toggles.length; i < len; i++) {
4552
        var parent = Dropdown._getParentFromElement(toggles[i]);
4553
4554
        var context = $(toggles[i]).data(DATA_KEY$4);
4555
        var relatedTarget = {
4556
          relatedTarget: toggles[i]
4557
        };
4558
4559
        if (event && event.type === 'click') {
4560
          relatedTarget.clickEvent = event;
4561
        }
4562
4563
        if (!context) {
4564
          continue;
4565
        }
4566
4567
        var dropdownMenu = context._menu;
4568
4569
        if (!$(parent).hasClass(ClassName$4.SHOW)) {
4570
          continue;
4571
        }
4572
4573
        if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
4574
          continue;
4575
        }
4576
4577
        var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
4578
        $(parent).trigger(hideEvent);
4579
4580
        if (hideEvent.isDefaultPrevented()) {
4581
          continue;
4582
        } // If this is a touch-enabled device we remove the extra
4583
        // empty mouseover listeners we added for iOS support
4584
4585
4586
        if ('ontouchstart' in document.documentElement) {
4587
          $(document.body).children().off('mouseover', null, $.noop);
4588
        }
4589
4590
        toggles[i].setAttribute('aria-expanded', 'false');
4591
4592
        if (context._popper) {
4593
          context._popper.destroy();
4594
        }
4595
4596
        $(dropdownMenu).removeClass(ClassName$4.SHOW);
4597
        $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
4598
      }
4599
    };
4600
4601
    Dropdown._getParentFromElement = function _getParentFromElement(element) {
4602
      var parent;
4603
      var selector = Util.getSelectorFromElement(element);
4604
4605
      if (selector) {
4606
        parent = document.querySelector(selector);
4607
      }
4608
4609
      return parent || element.parentNode;
4610
    } // eslint-disable-next-line complexity
4611
    ;
4612
4613
    Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
4614
      // If not input/textarea:
4615
      //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
4616
      // If input/textarea:
4617
      //  - If space key => not a dropdown command
4618
      //  - If key is other than escape
4619
      //    - If key is not up or down => not a dropdown command
4620
      //    - If trigger inside the menu => not a dropdown command
4621
      if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
4622
        return;
4623
      }
4624
4625
      event.preventDefault();
4626
      event.stopPropagation();
4627
4628
      if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
4629
        return;
4630
      }
4631
4632
      var parent = Dropdown._getParentFromElement(this);
4633
4634
      var isActive = $(parent).hasClass(ClassName$4.SHOW);
4635
4636
      if (!isActive && event.which === ESCAPE_KEYCODE) {
4637
        return;
4638
      }
4639
4640
      if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
4641
        if (event.which === ESCAPE_KEYCODE) {
4642
          var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
4643
          $(toggle).trigger('focus');
4644
        }
4645
4646
        $(this).trigger('click');
4647
        return;
4648
      }
4649
4650
      var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
4651
        return $(item).is(':visible');
4652
      });
4653
4654
      if (items.length === 0) {
4655
        return;
4656
      }
4657
4658
      var index = items.indexOf(event.target);
4659
4660
      if (event.which === ARROW_UP_KEYCODE && index > 0) {
4661
        // Up
4662
        index--;
4663
      }
4664
4665
      if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
4666
        // Down
4667
        index++;
4668
      }
4669
4670
      if (index < 0) {
4671
        index = 0;
4672
      }
4673
4674
      items[index].focus();
4675
    };
4676
4677
    _createClass(Dropdown, null, [{
4678
      key: "VERSION",
4679
      get: function get() {
4680
        return VERSION$4;
4681
      }
4682
    }, {
4683
      key: "Default",
4684
      get: function get() {
4685
        return Default$2;
4686
      }
4687
    }, {
4688
      key: "DefaultType",
4689
      get: function get() {
4690
        return DefaultType$2;
4691
      }
4692
    }]);
4693
4694
    return Dropdown;
4695
  }();
4696
  /**
4697
   * ------------------------------------------------------------------------
4698
   * Data Api implementation
4699
   * ------------------------------------------------------------------------
4700
   */
4701
4702
4703
  $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
4704
    event.preventDefault();
4705
    event.stopPropagation();
4706
4707
    Dropdown._jQueryInterface.call($(this), 'toggle');
4708
  }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
4709
    e.stopPropagation();
4710
  });
4711
  /**
4712
   * ------------------------------------------------------------------------
4713
   * jQuery
4714
   * ------------------------------------------------------------------------
4715
   */
4716
4717
  $.fn[NAME$4] = Dropdown._jQueryInterface;
4718
  $.fn[NAME$4].Constructor = Dropdown;
4719
4720
  $.fn[NAME$4].noConflict = function () {
4721
    $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
4722
    return Dropdown._jQueryInterface;
4723
  };
4724
4725
  /**
4726
   * ------------------------------------------------------------------------
4727
   * Constants
4728
   * ------------------------------------------------------------------------
4729
   */
4730
4731
  var NAME$5 = 'modal';
4732
  var VERSION$5 = '4.4.1';
4733
  var DATA_KEY$5 = 'bs.modal';
4734
  var EVENT_KEY$5 = "." + DATA_KEY$5;
4735
  var DATA_API_KEY$5 = '.data-api';
4736
  var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
4737
  var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
4738
4739
  var Default$3 = {
4740
    backdrop: true,
4741
    keyboard: true,
4742
    focus: true,
4743
    show: true
4744
  };
4745
  var DefaultType$3 = {
4746
    backdrop: '(boolean|string)',
4747
    keyboard: 'boolean',
4748
    focus: 'boolean',
4749
    show: 'boolean'
4750
  };
4751
  var Event$5 = {
4752
    HIDE: "hide" + EVENT_KEY$5,
4753
    HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
4754
    HIDDEN: "hidden" + EVENT_KEY$5,
4755
    SHOW: "show" + EVENT_KEY$5,
4756
    SHOWN: "shown" + EVENT_KEY$5,
4757
    FOCUSIN: "focusin" + EVENT_KEY$5,
4758
    RESIZE: "resize" + EVENT_KEY$5,
4759
    CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
4760
    KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
4761
    MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
4762
    MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
4763
    CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
4764
  };
4765
  var ClassName$5 = {
4766
    SCROLLABLE: 'modal-dialog-scrollable',
4767
    SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
4768
    BACKDROP: 'modal-backdrop',
4769
    OPEN: 'modal-open',
4770
    FADE: 'fade',
4771
    SHOW: 'show',
4772
    STATIC: 'modal-static'
4773
  };
4774
  var Selector$5 = {
4775
    DIALOG: '.modal-dialog',
4776
    MODAL_BODY: '.modal-body',
4777
    DATA_TOGGLE: '[data-toggle="modal"]',
4778
    DATA_DISMISS: '[data-dismiss="modal"]',
4779
    FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
4780
    STICKY_CONTENT: '.sticky-top'
4781
  };
4782
  /**
4783
   * ------------------------------------------------------------------------
4784
   * Class Definition
4785
   * ------------------------------------------------------------------------
4786
   */
4787
4788
  var Modal =
4789
  /*#__PURE__*/
4790
  function () {
4791
    function Modal(element, config) {
4792
      this._config = this._getConfig(config);
4793
      this._element = element;
4794
      this._dialog = element.querySelector(Selector$5.DIALOG);
4795
      this._backdrop = null;
4796
      this._isShown = false;
4797
      this._isBodyOverflowing = false;
4798
      this._ignoreBackdropClick = false;
4799
      this._isTransitioning = false;
4800
      this._scrollbarWidth = 0;
4801
    } // Getters
4802
4803
4804
    var _proto = Modal.prototype;
4805
4806
    // Public
4807
    _proto.toggle = function toggle(relatedTarget) {
4808
      return this._isShown ? this.hide() : this.show(relatedTarget);
4809
    };
4810
4811
    _proto.show = function show(relatedTarget) {
4812
      var _this = this;
4813
4814
      if (this._isShown || this._isTransitioning) {
4815
        return;
4816
      }
4817
4818
      if ($(this._element).hasClass(ClassName$5.FADE)) {
4819
        this._isTransitioning = true;
4820
      }
4821
4822
      var showEvent = $.Event(Event$5.SHOW, {
4823
        relatedTarget: relatedTarget
4824
      });
4825
      $(this._element).trigger(showEvent);
4826
4827
      if (this._isShown || showEvent.isDefaultPrevented()) {
4828
        return;
4829
      }
4830
4831
      this._isShown = true;
4832
4833
      this._checkScrollbar();
4834
4835
      this._setScrollbar();
4836
4837
      this._adjustDialog();
4838
4839
      this._setEscapeEvent();
4840
4841
      this._setResizeEvent();
4842
4843
      $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
4844
        return _this.hide(event);
4845
      });
4846
      $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
4847
        $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
4848
          if ($(event.target).is(_this._element)) {
4849
            _this._ignoreBackdropClick = true;
4850
          }
4851
        });
4852
      });
4853
4854
      this._showBackdrop(function () {
4855
        return _this._showElement(relatedTarget);
4856
      });
4857
    };
4858
4859
    _proto.hide = function hide(event) {
4860
      var _this2 = this;
4861
4862
      if (event) {
4863
        event.preventDefault();
4864
      }
4865
4866
      if (!this._isShown || this._isTransitioning) {
4867
        return;
4868
      }
4869
4870
      var hideEvent = $.Event(Event$5.HIDE);
4871
      $(this._element).trigger(hideEvent);
4872
4873
      if (!this._isShown || hideEvent.isDefaultPrevented()) {
4874
        return;
4875
      }
4876
4877
      this._isShown = false;
4878
      var transition = $(this._element).hasClass(ClassName$5.FADE);
4879
4880
      if (transition) {
4881
        this._isTransitioning = true;
4882
      }
4883
4884
      this._setEscapeEvent();
4885
4886
      this._setResizeEvent();
4887
4888
      $(document).off(Event$5.FOCUSIN);
4889
      $(this._element).removeClass(ClassName$5.SHOW);
4890
      $(this._element).off(Event$5.CLICK_DISMISS);
4891
      $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
4892
4893
      if (transition) {
4894
        var transitionDuration = Util.getTransitionDurationFromElement(this._element);
4895
        $(this._element).one(Util.TRANSITION_END, function (event) {
4896
          return _this2._hideModal(event);
4897
        }).emulateTransitionEnd(transitionDuration);
4898
      } else {
4899
        this._hideModal();
4900
      }
4901
    };
4902
4903
    _proto.dispose = function dispose() {
4904
      [window, this._element, this._dialog].forEach(function (htmlElement) {
4905
        return $(htmlElement).off(EVENT_KEY$5);
4906
      });
4907
      /**
4908
       * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
4909
       * Do not move `document` in `htmlElements` array
4910
       * It will remove `Event.CLICK_DATA_API` event that should remain
4911
       */
4912
4913
      $(document).off(Event$5.FOCUSIN);
4914
      $.removeData(this._element, DATA_KEY$5);
4915
      this._config = null;
4916
      this._element = null;
4917
      this._dialog = null;
4918
      this._backdrop = null;
4919
      this._isShown = null;
4920
      this._isBodyOverflowing = null;
4921
      this._ignoreBackdropClick = null;
4922
      this._isTransitioning = null;
4923
      this._scrollbarWidth = null;
4924
    };
4925
4926
    _proto.handleUpdate = function handleUpdate() {
4927
      this._adjustDialog();
4928
    } // Private
4929
    ;
4930
4931
    _proto._getConfig = function _getConfig(config) {
4932
      config = _objectSpread2({}, Default$3, {}, config);
4933
      Util.typeCheckConfig(NAME$5, config, DefaultType$3);
4934
      return config;
4935
    };
4936
4937
    _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
4938
      var _this3 = this;
4939
4940
      if (this._config.backdrop === 'static') {
4941
        var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
4942
        $(this._element).trigger(hideEventPrevented);
4943
4944
        if (hideEventPrevented.defaultPrevented) {
4945
          return;
4946
        }
4947
4948
        this._element.classList.add(ClassName$5.STATIC);
4949
4950
        var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
4951
        $(this._element).one(Util.TRANSITION_END, function () {
4952
          _this3._element.classList.remove(ClassName$5.STATIC);
4953
        }).emulateTransitionEnd(modalTransitionDuration);
4954
4955
        this._element.focus();
4956
      } else {
4957
        this.hide();
4958
      }
4959
    };
4960
4961
    _proto._showElement = function _showElement(relatedTarget) {
4962
      var _this4 = this;
4963
4964
      var transition = $(this._element).hasClass(ClassName$5.FADE);
4965
      var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
4966
4967
      if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
4968
        // Don't move modal's DOM position
4969
        document.body.appendChild(this._element);
4970
      }
4971
4972
      this._element.style.display = 'block';
4973
4974
      this._element.removeAttribute('aria-hidden');
4975
4976
      this._element.setAttribute('aria-modal', true);
4977
4978
      if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
4979
        modalBody.scrollTop = 0;
4980
      } else {
4981
        this._element.scrollTop = 0;
4982
      }
4983
4984
      if (transition) {
4985
        Util.reflow(this._element);
4986
      }
4987
4988
      $(this._element).addClass(ClassName$5.SHOW);
4989
4990
      if (this._config.focus) {
4991
        this._enforceFocus();
4992
      }
4993
4994
      var shownEvent = $.Event(Event$5.SHOWN, {
4995
        relatedTarget: relatedTarget
4996
      });
4997
4998
      var transitionComplete = function transitionComplete() {
4999
        if (_this4._config.focus) {
5000
          _this4._element.focus();
5001
        }
5002
5003
        _this4._isTransitioning = false;
5004
        $(_this4._element).trigger(shownEvent);
5005
      };
5006
5007
      if (transition) {
5008
        var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
5009
        $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
5010
      } else {
5011
        transitionComplete();
5012
      }
5013
    };
5014
5015
    _proto._enforceFocus = function _enforceFocus() {
5016
      var _this5 = this;
5017
5018
      $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
5019
      .on(Event$5.FOCUSIN, function (event) {
5020
        if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
5021
          _this5._element.focus();
5022
        }
5023
      });
5024
    };
5025
5026
    _proto._setEscapeEvent = function _setEscapeEvent() {
5027
      var _this6 = this;
5028
5029
      if (this._isShown && this._config.keyboard) {
5030
        $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
5031
          if (event.which === ESCAPE_KEYCODE$1) {
5032
            _this6._triggerBackdropTransition();
5033
          }
5034
        });
5035
      } else if (!this._isShown) {
5036
        $(this._element).off(Event$5.KEYDOWN_DISMISS);
5037
      }
5038
    };
5039
5040
    _proto._setResizeEvent = function _setResizeEvent() {
5041
      var _this7 = this;
5042
5043
      if (this._isShown) {
5044
        $(window).on(Event$5.RESIZE, function (event) {
5045
          return _this7.handleUpdate(event);
5046
        });
5047
      } else {
5048
        $(window).off(Event$5.RESIZE);
5049
      }
5050
    };
5051
5052
    _proto._hideModal = function _hideModal() {
5053
      var _this8 = this;
5054
5055
      this._element.style.display = 'none';
5056
5057
      this._element.setAttribute('aria-hidden', true);
5058
5059
      this._element.removeAttribute('aria-modal');
5060
5061
      this._isTransitioning = false;
5062
5063
      this._showBackdrop(function () {
5064
        $(document.body).removeClass(ClassName$5.OPEN);
5065
5066
        _this8._resetAdjustments();
5067
5068
        _this8._resetScrollbar();
5069
5070
        $(_this8._element).trigger(Event$5.HIDDEN);
5071
      });
5072
    };
5073
5074
    _proto._removeBackdrop = function _removeBackdrop() {
5075
      if (this._backdrop) {
5076
        $(this._backdrop).remove();
5077
        this._backdrop = null;
5078
      }
5079
    };
5080
5081
    _proto._showBackdrop = function _showBackdrop(callback) {
5082
      var _this9 = this;
5083
5084
      var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
5085
5086
      if (this._isShown && this._config.backdrop) {
5087
        this._backdrop = document.createElement('div');
5088
        this._backdrop.className = ClassName$5.BACKDROP;
5089
5090
        if (animate) {
5091
          this._backdrop.classList.add(animate);
5092
        }
5093
5094
        $(this._backdrop).appendTo(document.body);
5095
        $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
5096
          if (_this9._ignoreBackdropClick) {
5097
            _this9._ignoreBackdropClick = false;
5098
            return;
5099
          }
5100
5101
          if (event.target !== event.currentTarget) {
5102
            return;
5103
          }
5104
5105
          _this9._triggerBackdropTransition();
5106
        });
5107
5108
        if (animate) {
5109
          Util.reflow(this._backdrop);
5110
        }
5111
5112
        $(this._backdrop).addClass(ClassName$5.SHOW);
5113
5114
        if (!callback) {
5115
          return;
5116
        }
5117
5118
        if (!animate) {
5119
          callback();
5120
          return;
5121
        }
5122
5123
        var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
5124
        $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
5125
      } else if (!this._isShown && this._backdrop) {
5126
        $(this._backdrop).removeClass(ClassName$5.SHOW);
5127
5128
        var callbackRemove = function callbackRemove() {
5129
          _this9._removeBackdrop();
5130
5131
          if (callback) {
5132
            callback();
5133
          }
5134
        };
5135
5136
        if ($(this._element).hasClass(ClassName$5.FADE)) {
5137
          var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
5138
5139
          $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
5140
        } else {
5141
          callbackRemove();
5142
        }
5143
      } else if (callback) {
5144
        callback();
5145
      }
5146
    } // ----------------------------------------------------------------------
5147
    // the following methods are used to handle overflowing modals
5148
    // todo (fat): these should probably be refactored out of modal.js
5149
    // ----------------------------------------------------------------------
5150
    ;
5151
5152
    _proto._adjustDialog = function _adjustDialog() {
5153
      var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
5154
5155
      if (!this._isBodyOverflowing && isModalOverflowing) {
5156
        this._element.style.paddingLeft = this._scrollbarWidth + "px";
5157
      }
5158
5159
      if (this._isBodyOverflowing && !isModalOverflowing) {
5160
        this._element.style.paddingRight = this._scrollbarWidth + "px";
5161
      }
5162
    };
5163
5164
    _proto._resetAdjustments = function _resetAdjustments() {
5165
      this._element.style.paddingLeft = '';
5166
      this._element.style.paddingRight = '';
5167
    };
5168
5169
    _proto._checkScrollbar = function _checkScrollbar() {
5170
      var rect = document.body.getBoundingClientRect();
5171
      this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
5172
      this._scrollbarWidth = this._getScrollbarWidth();
5173
    };
5174
5175
    _proto._setScrollbar = function _setScrollbar() {
5176
      var _this10 = this;
5177
5178
      if (this._isBodyOverflowing) {
5179
        // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
5180
        //   while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
5181
        var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
5182
        var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
5183
5184
        $(fixedContent).each(function (index, element) {
5185
          var actualPadding = element.style.paddingRight;
5186
          var calculatedPadding = $(element).css('padding-right');
5187
          $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
5188
        }); // Adjust sticky content margin
5189
5190
        $(stickyContent).each(function (index, element) {
5191
          var actualMargin = element.style.marginRight;
5192
          var calculatedMargin = $(element).css('margin-right');
5193
          $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
5194
        }); // Adjust body padding
5195
5196
        var actualPadding = document.body.style.paddingRight;
5197
        var calculatedPadding = $(document.body).css('padding-right');
5198
        $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
5199
      }
5200
5201
      $(document.body).addClass(ClassName$5.OPEN);
5202
    };
5203
5204
    _proto._resetScrollbar = function _resetScrollbar() {
5205
      // Restore fixed content padding
5206
      var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
5207
      $(fixedContent).each(function (index, element) {
5208
        var padding = $(element).data('padding-right');
5209
        $(element).removeData('padding-right');
5210
        element.style.paddingRight = padding ? padding : '';
5211
      }); // Restore sticky content
5212
5213
      var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
5214
      $(elements).each(function (index, element) {
5215
        var margin = $(element).data('margin-right');
5216
5217
        if (typeof margin !== 'undefined') {
5218
          $(element).css('margin-right', margin).removeData('margin-right');
5219
        }
5220
      }); // Restore body padding
5221
5222
      var padding = $(document.body).data('padding-right');
5223
      $(document.body).removeData('padding-right');
5224
      document.body.style.paddingRight = padding ? padding : '';
5225
    };
5226
5227
    _proto._getScrollbarWidth = function _getScrollbarWidth() {
5228
      // thx d.walsh
5229
      var scrollDiv = document.createElement('div');
5230
      scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
5231
      document.body.appendChild(scrollDiv);
5232
      var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
5233
      document.body.removeChild(scrollDiv);
5234
      return scrollbarWidth;
5235
    } // Static
5236
    ;
5237
5238
    Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
5239
      return this.each(function () {
5240
        var data = $(this).data(DATA_KEY$5);
5241
5242
        var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
5243
5244
        if (!data) {
5245
          data = new Modal(this, _config);
5246
          $(this).data(DATA_KEY$5, data);
5247
        }
5248
5249
        if (typeof config === 'string') {
5250
          if (typeof data[config] === 'undefined') {
5251
            throw new TypeError("No method named \"" + config + "\"");
5252
          }
5253
5254
          data[config](relatedTarget);
5255
        } else if (_config.show) {
5256
          data.show(relatedTarget);
5257
        }
5258
      });
5259
    };
5260
5261
    _createClass(Modal, null, [{
5262
      key: "VERSION",
5263
      get: function get() {
5264
        return VERSION$5;
5265
      }
5266
    }, {
5267
      key: "Default",
5268
      get: function get() {
5269
        return Default$3;
5270
      }
5271
    }]);
5272
5273
    return Modal;
5274
  }();
5275
  /**
5276
   * ------------------------------------------------------------------------
5277
   * Data Api implementation
5278
   * ------------------------------------------------------------------------
5279
   */
5280
5281
5282
  $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
5283
    var _this11 = this;
5284
5285
    var target;
5286
    var selector = Util.getSelectorFromElement(this);
5287
5288
    if (selector) {
5289
      target = document.querySelector(selector);
5290
    }
5291
5292
    var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
5293
5294
    if (this.tagName === 'A' || this.tagName === 'AREA') {
5295
      event.preventDefault();
5296
    }
5297
5298
    var $target = $(target).one(Event$5.SHOW, function (showEvent) {
5299
      if (showEvent.isDefaultPrevented()) {
5300
        // Only register focus restorer if modal will actually get shown
5301
        return;
5302
      }
5303
5304
      $target.one(Event$5.HIDDEN, function () {
5305
        if ($(_this11).is(':visible')) {
5306
          _this11.focus();
5307
        }
5308
      });
5309
    });
5310
5311
    Modal._jQueryInterface.call($(target), config, this);
5312
  });
5313
  /**
5314
   * ------------------------------------------------------------------------
5315
   * jQuery
5316
   * ------------------------------------------------------------------------
5317
   */
5318
5319
  $.fn[NAME$5] = Modal._jQueryInterface;
5320
  $.fn[NAME$5].Constructor = Modal;
5321
5322
  $.fn[NAME$5].noConflict = function () {
5323
    $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
5324
    return Modal._jQueryInterface;
5325
  };
5326
5327
  /**
5328
   * --------------------------------------------------------------------------
5329
   * Bootstrap (v4.4.1): tools/sanitizer.js
5330
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5331
   * --------------------------------------------------------------------------
5332
   */
5333
  var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
5334
  var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
5335
  var DefaultWhitelist = {
5336
    // Global attributes allowed on any supplied element below.
5337
    '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
5338
    a: ['target', 'href', 'title', 'rel'],
5339
    area: [],
5340
    b: [],
5341
    br: [],
5342
    col: [],
5343
    code: [],
5344
    div: [],
5345
    em: [],
5346
    hr: [],
5347
    h1: [],
5348
    h2: [],
5349
    h3: [],
5350
    h4: [],
5351
    h5: [],
5352
    h6: [],
5353
    i: [],
5354
    img: ['src', 'alt', 'title', 'width', 'height'],
5355
    li: [],
5356
    ol: [],
5357
    p: [],
5358
    pre: [],
5359
    s: [],
5360
    small: [],
5361
    span: [],
5362
    sub: [],
5363
    sup: [],
5364
    strong: [],
5365
    u: [],
5366
    ul: []
5367
  };
5368
  /**
5369
   * A pattern that recognizes a commonly useful subset of URLs that are safe.
5370
   *
5371
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
5372
   */
5373
5374
  var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
5375
  /**
5376
   * A pattern that matches safe data URLs. Only matches image, video and audio types.
5377
   *
5378
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
5379
   */
5380
5381
  var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
5382
5383
  function allowedAttribute(attr, allowedAttributeList) {
5384
    var attrName = attr.nodeName.toLowerCase();
5385
5386
    if (allowedAttributeList.indexOf(attrName) !== -1) {
5387
      if (uriAttrs.indexOf(attrName) !== -1) {
5388
        return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
5389
      }
5390
5391
      return true;
5392
    }
5393
5394
    var regExp = allowedAttributeList.filter(function (attrRegex) {
5395
      return attrRegex instanceof RegExp;
5396
    }); // Check if a regular expression validates the attribute.
5397
5398
    for (var i = 0, l = regExp.length; i < l; i++) {
5399
      if (attrName.match(regExp[i])) {
5400
        return true;
5401
      }
5402
    }
5403
5404
    return false;
5405
  }
5406
5407
  function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
5408
    if (unsafeHtml.length === 0) {
5409
      return unsafeHtml;
5410
    }
5411
5412
    if (sanitizeFn && typeof sanitizeFn === 'function') {
5413
      return sanitizeFn(unsafeHtml);
5414
    }
5415
5416
    var domParser = new window.DOMParser();
5417
    var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
5418
    var whitelistKeys = Object.keys(whiteList);
5419
    var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
5420
5421
    var _loop = function _loop(i, len) {
5422
      var el = elements[i];
5423
      var elName = el.nodeName.toLowerCase();
5424
5425
      if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
5426
        el.parentNode.removeChild(el);
5427
        return "continue";
5428
      }
5429
5430
      var attributeList = [].slice.call(el.attributes);
5431
      var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
5432
      attributeList.forEach(function (attr) {
5433
        if (!allowedAttribute(attr, whitelistedAttributes)) {
5434
          el.removeAttribute(attr.nodeName);
5435
        }
5436
      });
5437
    };
5438
5439
    for (var i = 0, len = elements.length; i < len; i++) {
5440
      var _ret = _loop(i);
5441
5442
      if (_ret === "continue") continue;
5443
    }
5444
5445
    return createdDocument.body.innerHTML;
5446
  }
5447
5448
  /**
5449
   * ------------------------------------------------------------------------
5450
   * Constants
5451
   * ------------------------------------------------------------------------
5452
   */
5453
5454
  var NAME$6 = 'tooltip';
5455
  var VERSION$6 = '4.4.1';
5456
  var DATA_KEY$6 = 'bs.tooltip';
5457
  var EVENT_KEY$6 = "." + DATA_KEY$6;
5458
  var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
5459
  var CLASS_PREFIX = 'bs-tooltip';
5460
  var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
5461
  var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
5462
  var DefaultType$4 = {
5463
    animation: 'boolean',
5464
    template: 'string',
5465
    title: '(string|element|function)',
5466
    trigger: 'string',
5467
    delay: '(number|object)',
5468
    html: 'boolean',
5469
    selector: '(string|boolean)',
5470
    placement: '(string|function)',
5471
    offset: '(number|string|function)',
5472
    container: '(string|element|boolean)',
5473
    fallbackPlacement: '(string|array)',
5474
    boundary: '(string|element)',
5475
    sanitize: 'boolean',
5476
    sanitizeFn: '(null|function)',
5477
    whiteList: 'object',
5478
    popperConfig: '(null|object)'
5479
  };
5480
  var AttachmentMap$1 = {
5481
    AUTO: 'auto',
5482
    TOP: 'top',
5483
    RIGHT: 'right',
5484
    BOTTOM: 'bottom',
5485
    LEFT: 'left'
5486
  };
5487
  var Default$4 = {
5488
    animation: true,
5489
    template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
5490
    trigger: 'hover focus',
5491
    title: '',
5492
    delay: 0,
5493
    html: false,
5494
    selector: false,
5495
    placement: 'top',
5496
    offset: 0,
5497
    container: false,
5498
    fallbackPlacement: 'flip',
5499
    boundary: 'scrollParent',
5500
    sanitize: true,
5501
    sanitizeFn: null,
5502
    whiteList: DefaultWhitelist,
5503
    popperConfig: null
5504
  };
5505
  var HoverState = {
5506
    SHOW: 'show',
5507
    OUT: 'out'
5508
  };
5509
  var Event$6 = {
5510
    HIDE: "hide" + EVENT_KEY$6,
5511
    HIDDEN: "hidden" + EVENT_KEY$6,
5512
    SHOW: "show" + EVENT_KEY$6,
5513
    SHOWN: "shown" + EVENT_KEY$6,
5514
    INSERTED: "inserted" + EVENT_KEY$6,
5515
    CLICK: "click" + EVENT_KEY$6,
5516
    FOCUSIN: "focusin" + EVENT_KEY$6,
5517
    FOCUSOUT: "focusout" + EVENT_KEY$6,
5518
    MOUSEENTER: "mouseenter" + EVENT_KEY$6,
5519
    MOUSELEAVE: "mouseleave" + EVENT_KEY$6
5520
  };
5521
  var ClassName$6 = {
5522
    FADE: 'fade',
5523
    SHOW: 'show'
5524
  };
5525
  var Selector$6 = {
5526
    TOOLTIP: '.tooltip',
5527
    TOOLTIP_INNER: '.tooltip-inner',
5528
    ARROW: '.arrow'
5529
  };
5530
  var Trigger = {
5531
    HOVER: 'hover',
5532
    FOCUS: 'focus',
5533
    CLICK: 'click',
5534
    MANUAL: 'manual'
5535
  };
5536
  /**
5537
   * ------------------------------------------------------------------------
5538
   * Class Definition
5539
   * ------------------------------------------------------------------------
5540
   */
5541
5542
  var Tooltip =
5543
  /*#__PURE__*/
5544
  function () {
5545
    function Tooltip(element, config) {
5546
      if (typeof Popper === 'undefined') {
5547
        throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
5548
      } // private
5549
5550
5551
      this._isEnabled = true;
5552
      this._timeout = 0;
5553
      this._hoverState = '';
5554
      this._activeTrigger = {};
5555
      this._popper = null; // Protected
5556
5557
      this.element = element;
5558
      this.config = this._getConfig(config);
5559
      this.tip = null;
5560
5561
      this._setListeners();
5562
    } // Getters
5563
5564
5565
    var _proto = Tooltip.prototype;
5566
5567
    // Public
5568
    _proto.enable = function enable() {
5569
      this._isEnabled = true;
5570
    };
5571
5572
    _proto.disable = function disable() {
5573
      this._isEnabled = false;
5574
    };
5575
5576
    _proto.toggleEnabled = function toggleEnabled() {
5577
      this._isEnabled = !this._isEnabled;
5578
    };
5579
5580
    _proto.toggle = function toggle(event) {
5581
      if (!this._isEnabled) {
5582
        return;
5583
      }
5584
5585
      if (event) {
5586
        var dataKey = this.constructor.DATA_KEY;
5587
        var context = $(event.currentTarget).data(dataKey);
5588
5589
        if (!context) {
5590
          context = new this.constructor(event.currentTarget, this._getDelegateConfig());
5591
          $(event.currentTarget).data(dataKey, context);
5592
        }
5593
5594
        context._activeTrigger.click = !context._activeTrigger.click;
5595
5596
        if (context._isWithActiveTrigger()) {
5597
          context._enter(null, context);
5598
        } else {
5599
          context._leave(null, context);
5600
        }
5601
      } else {
5602
        if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
5603
          this._leave(null, this);
5604
5605
          return;
5606
        }
5607
5608
        this._enter(null, this);
5609
      }
5610
    };
5611
5612
    _proto.dispose = function dispose() {
5613
      clearTimeout(this._timeout);
5614
      $.removeData(this.element, this.constructor.DATA_KEY);
5615
      $(this.element).off(this.constructor.EVENT_KEY);
5616
      $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
5617
5618
      if (this.tip) {
5619
        $(this.tip).remove();
5620
      }
5621
5622
      this._isEnabled = null;
5623
      this._timeout = null;
5624
      this._hoverState = null;
5625
      this._activeTrigger = null;
5626
5627
      if (this._popper) {
5628
        this._popper.destroy();
5629
      }
5630
5631
      this._popper = null;
5632
      this.element = null;
5633
      this.config = null;
5634
      this.tip = null;
5635
    };
5636
5637
    _proto.show = function show() {
5638
      var _this = this;
5639
5640
      if ($(this.element).css('display') === 'none') {
5641
        throw new Error('Please use show on visible elements');
5642
      }
5643
5644
      var showEvent = $.Event(this.constructor.Event.SHOW);
5645
5646
      if (this.isWithContent() && this._isEnabled) {
5647
        $(this.element).trigger(showEvent);
5648
        var shadowRoot = Util.findShadowRoot(this.element);
5649
        var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
5650
5651
        if (showEvent.isDefaultPrevented() || !isInTheDom) {
5652
          return;
5653
        }
5654
5655
        var tip = this.getTipElement();
5656
        var tipId = Util.getUID(this.constructor.NAME);
5657
        tip.setAttribute('id', tipId);
5658
        this.element.setAttribute('aria-describedby', tipId);
5659
        this.setContent();
5660
5661
        if (this.config.animation) {
5662
          $(tip).addClass(ClassName$6.FADE);
5663
        }
5664
5665
        var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
5666
5667
        var attachment = this._getAttachment(placement);
5668
5669
        this.addAttachmentClass(attachment);
5670
5671
        var container = this._getContainer();
5672
5673
        $(tip).data(this.constructor.DATA_KEY, this);
5674
5675
        if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
5676
          $(tip).appendTo(container);
5677
        }
5678
5679
        $(this.element).trigger(this.constructor.Event.INSERTED);
5680
        this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
5681
        $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
5682
        // empty mouseover listeners to the body's immediate children;
5683
        // only needed because of broken event delegation on iOS
5684
        // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
5685
5686
        if ('ontouchstart' in document.documentElement) {
5687
          $(document.body).children().on('mouseover', null, $.noop);
5688
        }
5689
5690
        var complete = function complete() {
5691
          if (_this.config.animation) {
5692
            _this._fixTransition();
5693
          }
5694
5695
          var prevHoverState = _this._hoverState;
5696
          _this._hoverState = null;
5697
          $(_this.element).trigger(_this.constructor.Event.SHOWN);
5698
5699
          if (prevHoverState === HoverState.OUT) {
5700
            _this._leave(null, _this);
5701
          }
5702
        };
5703
5704
        if ($(this.tip).hasClass(ClassName$6.FADE)) {
5705
          var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
5706
          $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
5707
        } else {
5708
          complete();
5709
        }
5710
      }
5711
    };
5712
5713
    _proto.hide = function hide(callback) {
5714
      var _this2 = this;
5715
5716
      var tip = this.getTipElement();
5717
      var hideEvent = $.Event(this.constructor.Event.HIDE);
5718
5719
      var complete = function complete() {
5720
        if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
5721
          tip.parentNode.removeChild(tip);
5722
        }
5723
5724
        _this2._cleanTipClass();
5725
5726
        _this2.element.removeAttribute('aria-describedby');
5727
5728
        $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
5729
5730
        if (_this2._popper !== null) {
5731
          _this2._popper.destroy();
5732
        }
5733
5734
        if (callback) {
5735
          callback();
5736
        }
5737
      };
5738
5739
      $(this.element).trigger(hideEvent);
5740
5741
      if (hideEvent.isDefaultPrevented()) {
5742
        return;
5743
      }
5744
5745
      $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
5746
      // empty mouseover listeners we added for iOS support
5747
5748
      if ('ontouchstart' in document.documentElement) {
5749
        $(document.body).children().off('mouseover', null, $.noop);
5750
      }
5751
5752
      this._activeTrigger[Trigger.CLICK] = false;
5753
      this._activeTrigger[Trigger.FOCUS] = false;
5754
      this._activeTrigger[Trigger.HOVER] = false;
5755
5756
      if ($(this.tip).hasClass(ClassName$6.FADE)) {
5757
        var transitionDuration = Util.getTransitionDurationFromElement(tip);
5758
        $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
5759
      } else {
5760
        complete();
5761
      }
5762
5763
      this._hoverState = '';
5764
    };
5765
5766
    _proto.update = function update() {
5767
      if (this._popper !== null) {
5768
        this._popper.scheduleUpdate();
5769
      }
5770
    } // Protected
5771
    ;
5772
5773
    _proto.isWithContent = function isWithContent() {
5774
      return Boolean(this.getTitle());
5775
    };
5776
5777
    _proto.addAttachmentClass = function addAttachmentClass(attachment) {
5778
      $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
5779
    };
5780
5781
    _proto.getTipElement = function getTipElement() {
5782
      this.tip = this.tip || $(this.config.template)[0];
5783
      return this.tip;
5784
    };
5785
5786
    _proto.setContent = function setContent() {
5787
      var tip = this.getTipElement();
5788
      this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
5789
      $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
5790
    };
5791
5792
    _proto.setElementContent = function setElementContent($element, content) {
5793
      if (typeof content === 'object' && (content.nodeType || content.jquery)) {
5794
        // Content is a DOM node or a jQuery
5795
        if (this.config.html) {
5796
          if (!$(content).parent().is($element)) {
5797
            $element.empty().append(content);
5798
          }
5799
        } else {
5800
          $element.text($(content).text());
5801
        }
5802
5803
        return;
5804
      }
5805
5806
      if (this.config.html) {
5807
        if (this.config.sanitize) {
5808
          content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
5809
        }
5810
5811
        $element.html(content);
5812
      } else {
5813
        $element.text(content);
5814
      }
5815
    };
5816
5817
    _proto.getTitle = function getTitle() {
5818
      var title = this.element.getAttribute('data-original-title');
5819
5820
      if (!title) {
5821
        title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
5822
      }
5823
5824
      return title;
5825
    } // Private
5826
    ;
5827
5828
    _proto._getPopperConfig = function _getPopperConfig(attachment) {
5829
      var _this3 = this;
5830
5831
      var defaultBsConfig = {
5832
        placement: attachment,
5833
        modifiers: {
5834
          offset: this._getOffset(),
5835
          flip: {
5836
            behavior: this.config.fallbackPlacement
5837
          },
5838
          arrow: {
5839
            element: Selector$6.ARROW
5840
          },
5841
          preventOverflow: {
5842
            boundariesElement: this.config.boundary
5843
          }
5844
        },
5845
        onCreate: function onCreate(data) {
5846
          if (data.originalPlacement !== data.placement) {
5847
            _this3._handlePopperPlacementChange(data);
5848
          }
5849
        },
5850
        onUpdate: function onUpdate(data) {
5851
          return _this3._handlePopperPlacementChange(data);
5852
        }
5853
      };
5854
      return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
5855
    };
5856
5857
    _proto._getOffset = function _getOffset() {
5858
      var _this4 = this;
5859
5860
      var offset = {};
5861
5862
      if (typeof this.config.offset === 'function') {
5863
        offset.fn = function (data) {
5864
          data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
5865
          return data;
5866
        };
5867
      } else {
5868
        offset.offset = this.config.offset;
5869
      }
5870
5871
      return offset;
5872
    };
5873
5874
    _proto._getContainer = function _getContainer() {
5875
      if (this.config.container === false) {
5876
        return document.body;
5877
      }
5878
5879
      if (Util.isElement(this.config.container)) {
5880
        return $(this.config.container);
5881
      }
5882
5883
      return $(document).find(this.config.container);
5884
    };
5885
5886
    _proto._getAttachment = function _getAttachment(placement) {
5887
      return AttachmentMap$1[placement.toUpperCase()];
5888
    };
5889
5890
    _proto._setListeners = function _setListeners() {
5891
      var _this5 = this;
5892
5893
      var triggers = this.config.trigger.split(' ');
5894
      triggers.forEach(function (trigger) {
5895
        if (trigger === 'click') {
5896
          $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
5897
            return _this5.toggle(event);
5898
          });
5899
        } else if (trigger !== Trigger.MANUAL) {
5900
          var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
5901
          var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
5902
          $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
5903
            return _this5._enter(event);
5904
          }).on(eventOut, _this5.config.selector, function (event) {
5905
            return _this5._leave(event);
5906
          });
5907
        }
5908
      });
5909
5910
      this._hideModalHandler = function () {
5911
        if (_this5.element) {
5912
          _this5.hide();
5913
        }
5914
      };
5915
5916
      $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
5917
5918
      if (this.config.selector) {
5919
        this.config = _objectSpread2({}, this.config, {
5920
          trigger: 'manual',
5921
          selector: ''
5922
        });
5923
      } else {
5924
        this._fixTitle();
5925
      }
5926
    };
5927
5928
    _proto._fixTitle = function _fixTitle() {
5929
      var titleType = typeof this.element.getAttribute('data-original-title');
5930
5931
      if (this.element.getAttribute('title') || titleType !== 'string') {
5932
        this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
5933
        this.element.setAttribute('title', '');
5934
      }
5935
    };
5936
5937
    _proto._enter = function _enter(event, context) {
5938
      var dataKey = this.constructor.DATA_KEY;
5939
      context = context || $(event.currentTarget).data(dataKey);
5940
5941
      if (!context) {
5942
        context = new this.constructor(event.currentTarget, this._getDelegateConfig());
5943
        $(event.currentTarget).data(dataKey, context);
5944
      }
5945
5946
      if (event) {
5947
        context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
5948
      }
5949
5950
      if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
5951
        context._hoverState = HoverState.SHOW;
5952
        return;
5953
      }
5954
5955
      clearTimeout(context._timeout);
5956
      context._hoverState = HoverState.SHOW;
5957
5958
      if (!context.config.delay || !context.config.delay.show) {
5959
        context.show();
5960
        return;
5961
      }
5962
5963
      context._timeout = setTimeout(function () {
5964
        if (context._hoverState === HoverState.SHOW) {
5965
          context.show();
5966
        }
5967
      }, context.config.delay.show);
5968
    };
5969
5970
    _proto._leave = function _leave(event, context) {
5971
      var dataKey = this.constructor.DATA_KEY;
5972
      context = context || $(event.currentTarget).data(dataKey);
5973
5974
      if (!context) {
5975
        context = new this.constructor(event.currentTarget, this._getDelegateConfig());
5976
        $(event.currentTarget).data(dataKey, context);
5977
      }
5978
5979
      if (event) {
5980
        context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
5981
      }
5982
5983
      if (context._isWithActiveTrigger()) {
5984
        return;
5985
      }
5986
5987
      clearTimeout(context._timeout);
5988
      context._hoverState = HoverState.OUT;
5989
5990
      if (!context.config.delay || !context.config.delay.hide) {
5991
        context.hide();
5992
        return;
5993
      }
5994
5995
      context._timeout = setTimeout(function () {
5996
        if (context._hoverState === HoverState.OUT) {
5997
          context.hide();
5998
        }
5999
      }, context.config.delay.hide);
6000
    };
6001
6002
    _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
6003
      for (var trigger in this._activeTrigger) {
6004
        if (this._activeTrigger[trigger]) {
6005
          return true;
6006
        }
6007
      }
6008
6009
      return false;
6010
    };
6011
6012
    _proto._getConfig = function _getConfig(config) {
6013
      var dataAttributes = $(this.element).data();
6014
      Object.keys(dataAttributes).forEach(function (dataAttr) {
6015
        if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
6016
          delete dataAttributes[dataAttr];
6017
        }
6018
      });
6019
      config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
6020
6021
      if (typeof config.delay === 'number') {
6022
        config.delay = {
6023
          show: config.delay,
6024
          hide: config.delay
6025
        };
6026
      }
6027
6028
      if (typeof config.title === 'number') {
6029
        config.title = config.title.toString();
6030
      }
6031
6032
      if (typeof config.content === 'number') {
6033
        config.content = config.content.toString();
6034
      }
6035
6036
      Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
6037
6038
      if (config.sanitize) {
6039
        config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
6040
      }
6041
6042
      return config;
6043
    };
6044
6045
    _proto._getDelegateConfig = function _getDelegateConfig() {
6046
      var config = {};
6047
6048
      if (this.config) {
6049
        for (var key in this.config) {
6050
          if (this.constructor.Default[key] !== this.config[key]) {
6051
            config[key] = this.config[key];
6052
          }
6053
        }
6054
      }
6055
6056
      return config;
6057
    };
6058
6059
    _proto._cleanTipClass = function _cleanTipClass() {
6060
      var $tip = $(this.getTipElement());
6061
      var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
6062
6063
      if (tabClass !== null && tabClass.length) {
6064
        $tip.removeClass(tabClass.join(''));
6065
      }
6066
    };
6067
6068
    _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
6069
      var popperInstance = popperData.instance;
6070
      this.tip = popperInstance.popper;
6071
6072
      this._cleanTipClass();
6073
6074
      this.addAttachmentClass(this._getAttachment(popperData.placement));
6075
    };
6076
6077
    _proto._fixTransition = function _fixTransition() {
6078
      var tip = this.getTipElement();
6079
      var initConfigAnimation = this.config.animation;
6080
6081
      if (tip.getAttribute('x-placement') !== null) {
6082
        return;
6083
      }
6084
6085
      $(tip).removeClass(ClassName$6.FADE);
6086
      this.config.animation = false;
6087
      this.hide();
6088
      this.show();
6089
      this.config.animation = initConfigAnimation;
6090
    } // Static
6091
    ;
6092
6093
    Tooltip._jQueryInterface = function _jQueryInterface(config) {
6094
      return this.each(function () {
6095
        var data = $(this).data(DATA_KEY$6);
6096
6097
        var _config = typeof config === 'object' && config;
6098
6099
        if (!data && /dispose|hide/.test(config)) {
6100
          return;
6101
        }
6102
6103
        if (!data) {
6104
          data = new Tooltip(this, _config);
6105
          $(this).data(DATA_KEY$6, data);
6106
        }
6107
6108
        if (typeof config === 'string') {
6109
          if (typeof data[config] === 'undefined') {
6110
            throw new TypeError("No method named \"" + config + "\"");
6111
          }
6112
6113
          data[config]();
6114
        }
6115
      });
6116
    };
6117
6118
    _createClass(Tooltip, null, [{
6119
      key: "VERSION",
6120
      get: function get() {
6121
        return VERSION$6;
6122
      }
6123
    }, {
6124
      key: "Default",
6125
      get: function get() {
6126
        return Default$4;
6127
      }
6128
    }, {
6129
      key: "NAME",
6130
      get: function get() {
6131
        return NAME$6;
6132
      }
6133
    }, {
6134
      key: "DATA_KEY",
6135
      get: function get() {
6136
        return DATA_KEY$6;
6137
      }
6138
    }, {
6139
      key: "Event",
6140
      get: function get() {
6141
        return Event$6;
6142
      }
6143
    }, {
6144
      key: "EVENT_KEY",
6145
      get: function get() {
6146
        return EVENT_KEY$6;
6147
      }
6148
    }, {
6149
      key: "DefaultType",
6150
      get: function get() {
6151
        return DefaultType$4;
6152
      }
6153
    }]);
6154
6155
    return Tooltip;
6156
  }();
6157
  /**
6158
   * ------------------------------------------------------------------------
6159
   * jQuery
6160
   * ------------------------------------------------------------------------
6161
   */
6162
6163
6164
  $.fn[NAME$6] = Tooltip._jQueryInterface;
6165
  $.fn[NAME$6].Constructor = Tooltip;
6166
6167
  $.fn[NAME$6].noConflict = function () {
6168
    $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
6169
    return Tooltip._jQueryInterface;
6170
  };
6171
6172
  /**
6173
   * ------------------------------------------------------------------------
6174
   * Constants
6175
   * ------------------------------------------------------------------------
6176
   */
6177
6178
  var NAME$7 = 'popover';
6179
  var VERSION$7 = '4.4.1';
6180
  var DATA_KEY$7 = 'bs.popover';
6181
  var EVENT_KEY$7 = "." + DATA_KEY$7;
6182
  var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
6183
  var CLASS_PREFIX$1 = 'bs-popover';
6184
  var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
6185
6186
  var Default$5 = _objectSpread2({}, Tooltip.Default, {
6187
    placement: 'right',
6188
    trigger: 'click',
6189
    content: '',
6190
    template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
6191
  });
6192
6193
  var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
6194
    content: '(string|element|function)'
6195
  });
6196
6197
  var ClassName$7 = {
6198
    FADE: 'fade',
6199
    SHOW: 'show'
6200
  };
6201
  var Selector$7 = {
6202
    TITLE: '.popover-header',
6203
    CONTENT: '.popover-body'
6204
  };
6205
  var Event$7 = {
6206
    HIDE: "hide" + EVENT_KEY$7,
6207
    HIDDEN: "hidden" + EVENT_KEY$7,
6208
    SHOW: "show" + EVENT_KEY$7,
6209
    SHOWN: "shown" + EVENT_KEY$7,
6210
    INSERTED: "inserted" + EVENT_KEY$7,
6211
    CLICK: "click" + EVENT_KEY$7,
6212
    FOCUSIN: "focusin" + EVENT_KEY$7,
6213
    FOCUSOUT: "focusout" + EVENT_KEY$7,
6214
    MOUSEENTER: "mouseenter" + EVENT_KEY$7,
6215
    MOUSELEAVE: "mouseleave" + EVENT_KEY$7
6216
  };
6217
  /**
6218
   * ------------------------------------------------------------------------
6219
   * Class Definition
6220
   * ------------------------------------------------------------------------
6221
   */
6222
6223
  var Popover =
6224
  /*#__PURE__*/
6225
  function (_Tooltip) {
6226
    _inheritsLoose(Popover, _Tooltip);
6227
6228
    function Popover() {
6229
      return _Tooltip.apply(this, arguments) || this;
6230
    }
6231
6232
    var _proto = Popover.prototype;
6233
6234
    // Overrides
6235
    _proto.isWithContent = function isWithContent() {
6236
      return this.getTitle() || this._getContent();
6237
    };
6238
6239
    _proto.addAttachmentClass = function addAttachmentClass(attachment) {
6240
      $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
6241
    };
6242
6243
    _proto.getTipElement = function getTipElement() {
6244
      this.tip = this.tip || $(this.config.template)[0];
6245
      return this.tip;
6246
    };
6247
6248
    _proto.setContent = function setContent() {
6249
      var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
6250
6251
      this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
6252
6253
      var content = this._getContent();
6254
6255
      if (typeof content === 'function') {
6256
        content = content.call(this.element);
6257
      }
6258
6259
      this.setElementContent($tip.find(Selector$7.CONTENT), content);
6260
      $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
6261
    } // Private
6262
    ;
6263
6264
    _proto._getContent = function _getContent() {
6265
      return this.element.getAttribute('data-content') || this.config.content;
6266
    };
6267
6268
    _proto._cleanTipClass = function _cleanTipClass() {
6269
      var $tip = $(this.getTipElement());
6270
      var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
6271
6272
      if (tabClass !== null && tabClass.length > 0) {
6273
        $tip.removeClass(tabClass.join(''));
6274
      }
6275
    } // Static
6276
    ;
6277
6278
    Popover._jQueryInterface = function _jQueryInterface(config) {
6279
      return this.each(function () {
6280
        var data = $(this).data(DATA_KEY$7);
6281
6282
        var _config = typeof config === 'object' ? config : null;
6283
6284
        if (!data && /dispose|hide/.test(config)) {
6285
          return;
6286
        }
6287
6288
        if (!data) {
6289
          data = new Popover(this, _config);
6290
          $(this).data(DATA_KEY$7, data);
6291
        }
6292
6293
        if (typeof config === 'string') {
6294
          if (typeof data[config] === 'undefined') {
6295
            throw new TypeError("No method named \"" + config + "\"");
6296
          }
6297
6298
          data[config]();
6299
        }
6300
      });
6301
    };
6302
6303
    _createClass(Popover, null, [{
6304
      key: "VERSION",
6305
      // Getters
6306
      get: function get() {
6307
        return VERSION$7;
6308
      }
6309
    }, {
6310
      key: "Default",
6311
      get: function get() {
6312
        return Default$5;
6313
      }
6314
    }, {
6315
      key: "NAME",
6316
      get: function get() {
6317
        return NAME$7;
6318
      }
6319
    }, {
6320
      key: "DATA_KEY",
6321
      get: function get() {
6322
        return DATA_KEY$7;
6323
      }
6324
    }, {
6325
      key: "Event",
6326
      get: function get() {
6327
        return Event$7;
6328
      }
6329
    }, {
6330
      key: "EVENT_KEY",
6331
      get: function get() {
6332
        return EVENT_KEY$7;
6333
      }
6334
    }, {
6335
      key: "DefaultType",
6336
      get: function get() {
6337
        return DefaultType$5;
6338
      }
6339
    }]);
6340
6341
    return Popover;
6342
  }(Tooltip);
6343
  /**
6344
   * ------------------------------------------------------------------------
6345
   * jQuery
6346
   * ------------------------------------------------------------------------
6347
   */
6348
6349
6350
  $.fn[NAME$7] = Popover._jQueryInterface;
6351
  $.fn[NAME$7].Constructor = Popover;
6352
6353
  $.fn[NAME$7].noConflict = function () {
6354
    $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
6355
    return Popover._jQueryInterface;
6356
  };
6357
6358
  /**
6359
   * ------------------------------------------------------------------------
6360
   * Constants
6361
   * ------------------------------------------------------------------------
6362
   */
6363
6364
  var NAME$8 = 'scrollspy';
6365
  var VERSION$8 = '4.4.1';
6366
  var DATA_KEY$8 = 'bs.scrollspy';
6367
  var EVENT_KEY$8 = "." + DATA_KEY$8;
6368
  var DATA_API_KEY$6 = '.data-api';
6369
  var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
6370
  var Default$6 = {
6371
    offset: 10,
6372
    method: 'auto',
6373
    target: ''
6374
  };
6375
  var DefaultType$6 = {
6376
    offset: 'number',
6377
    method: 'string',
6378
    target: '(string|element)'
6379
  };
6380
  var Event$8 = {
6381
    ACTIVATE: "activate" + EVENT_KEY$8,
6382
    SCROLL: "scroll" + EVENT_KEY$8,
6383
    LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
6384
  };
6385
  var ClassName$8 = {
6386
    DROPDOWN_ITEM: 'dropdown-item',
6387
    DROPDOWN_MENU: 'dropdown-menu',
6388
    ACTIVE: 'active'
6389
  };
6390
  var Selector$8 = {
6391
    DATA_SPY: '[data-spy="scroll"]',
6392
    ACTIVE: '.active',
6393
    NAV_LIST_GROUP: '.nav, .list-group',
6394
    NAV_LINKS: '.nav-link',
6395
    NAV_ITEMS: '.nav-item',
6396
    LIST_ITEMS: '.list-group-item',
6397
    DROPDOWN: '.dropdown',
6398
    DROPDOWN_ITEMS: '.dropdown-item',
6399
    DROPDOWN_TOGGLE: '.dropdown-toggle'
6400
  };
6401
  var OffsetMethod = {
6402
    OFFSET: 'offset',
6403
    POSITION: 'position'
6404
  };
6405
  /**
6406
   * ------------------------------------------------------------------------
6407
   * Class Definition
6408
   * ------------------------------------------------------------------------
6409
   */
6410
6411
  var ScrollSpy =
6412
  /*#__PURE__*/
6413
  function () {
6414
    function ScrollSpy(element, config) {
6415
      var _this = this;
6416
6417
      this._element = element;
6418
      this._scrollElement = element.tagName === 'BODY' ? window : element;
6419
      this._config = this._getConfig(config);
6420
      this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
6421
      this._offsets = [];
6422
      this._targets = [];
6423
      this._activeTarget = null;
6424
      this._scrollHeight = 0;
6425
      $(this._scrollElement).on(Event$8.SCROLL, function (event) {
6426
        return _this._process(event);
6427
      });
6428
      this.refresh();
6429
6430
      this._process();
6431
    } // Getters
6432
6433
6434
    var _proto = ScrollSpy.prototype;
6435
6436
    // Public
6437
    _proto.refresh = function refresh() {
6438
      var _this2 = this;
6439
6440
      var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
6441
      var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
6442
      var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
6443
      this._offsets = [];
6444
      this._targets = [];
6445
      this._scrollHeight = this._getScrollHeight();
6446
      var targets = [].slice.call(document.querySelectorAll(this._selector));
6447
      targets.map(function (element) {
6448
        var target;
6449
        var targetSelector = Util.getSelectorFromElement(element);
6450
6451
        if (targetSelector) {
6452
          target = document.querySelector(targetSelector);
6453
        }
6454
6455
        if (target) {
6456
          var targetBCR = target.getBoundingClientRect();
6457
6458
          if (targetBCR.width || targetBCR.height) {
6459
            // TODO (fat): remove sketch reliance on jQuery position/offset
6460
            return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
6461
          }
6462
        }
6463
6464
        return null;
6465
      }).filter(function (item) {
6466
        return item;
6467
      }).sort(function (a, b) {
6468
        return a[0] - b[0];
6469
      }).forEach(function (item) {
6470
        _this2._offsets.push(item[0]);
6471
6472
        _this2._targets.push(item[1]);
6473
      });
6474
    };
6475
6476
    _proto.dispose = function dispose() {
6477
      $.removeData(this._element, DATA_KEY$8);
6478
      $(this._scrollElement).off(EVENT_KEY$8);
6479
      this._element = null;
6480
      this._scrollElement = null;
6481
      this._config = null;
6482
      this._selector = null;
6483
      this._offsets = null;
6484
      this._targets = null;
6485
      this._activeTarget = null;
6486
      this._scrollHeight = null;
6487
    } // Private
6488
    ;
6489
6490
    _proto._getConfig = function _getConfig(config) {
6491
      config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
6492
6493
      if (typeof config.target !== 'string') {
6494
        var id = $(config.target).attr('id');
6495
6496
        if (!id) {
6497
          id = Util.getUID(NAME$8);
6498
          $(config.target).attr('id', id);
6499
        }
6500
6501
        config.target = "#" + id;
6502
      }
6503
6504
      Util.typeCheckConfig(NAME$8, config, DefaultType$6);
6505
      return config;
6506
    };
6507
6508
    _proto._getScrollTop = function _getScrollTop() {
6509
      return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
6510
    };
6511
6512
    _proto._getScrollHeight = function _getScrollHeight() {
6513
      return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6514
    };
6515
6516
    _proto._getOffsetHeight = function _getOffsetHeight() {
6517
      return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
6518
    };
6519
6520
    _proto._process = function _process() {
6521
      var scrollTop = this._getScrollTop() + this._config.offset;
6522
6523
      var scrollHeight = this._getScrollHeight();
6524
6525
      var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
6526
6527
      if (this._scrollHeight !== scrollHeight) {
6528
        this.refresh();
6529
      }
6530
6531
      if (scrollTop >= maxScroll) {
6532
        var target = this._targets[this._targets.length - 1];
6533
6534
        if (this._activeTarget !== target) {
6535
          this._activate(target);
6536
        }
6537
6538
        return;
6539
      }
6540
6541
      if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
6542
        this._activeTarget = null;
6543
6544
        this._clear();
6545
6546
        return;
6547
      }
6548
6549
      var offsetLength = this._offsets.length;
6550
6551
      for (var i = offsetLength; i--;) {
6552
        var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
6553
6554
        if (isActiveTarget) {
6555
          this._activate(this._targets[i]);
6556
        }
6557
      }
6558
    };
6559
6560
    _proto._activate = function _activate(target) {
6561
      this._activeTarget = target;
6562
6563
      this._clear();
6564
6565
      var queries = this._selector.split(',').map(function (selector) {
6566
        return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
6567
      });
6568
6569
      var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
6570
6571
      if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
6572
        $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
6573
        $link.addClass(ClassName$8.ACTIVE);
6574
      } else {
6575
        // Set triggered link as active
6576
        $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
6577
        // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
6578
6579
        $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
6580
6581
        $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
6582
      }
6583
6584
      $(this._scrollElement).trigger(Event$8.ACTIVATE, {
6585
        relatedTarget: target
6586
      });
6587
    };
6588
6589
    _proto._clear = function _clear() {
6590
      [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
6591
        return node.classList.contains(ClassName$8.ACTIVE);
6592
      }).forEach(function (node) {
6593
        return node.classList.remove(ClassName$8.ACTIVE);
6594
      });
6595
    } // Static
6596
    ;
6597
6598
    ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
6599
      return this.each(function () {
6600
        var data = $(this).data(DATA_KEY$8);
6601
6602
        var _config = typeof config === 'object' && config;
6603
6604
        if (!data) {
6605
          data = new ScrollSpy(this, _config);
6606
          $(this).data(DATA_KEY$8, data);
6607
        }
6608
6609
        if (typeof config === 'string') {
6610
          if (typeof data[config] === 'undefined') {
6611
            throw new TypeError("No method named \"" + config + "\"");
6612
          }
6613
6614
          data[config]();
6615
        }
6616
      });
6617
    };
6618
6619
    _createClass(ScrollSpy, null, [{
6620
      key: "VERSION",
6621
      get: function get() {
6622
        return VERSION$8;
6623
      }
6624
    }, {
6625
      key: "Default",
6626
      get: function get() {
6627
        return Default$6;
6628
      }
6629
    }]);
6630
6631
    return ScrollSpy;
6632
  }();
6633
  /**
6634
   * ------------------------------------------------------------------------
6635
   * Data Api implementation
6636
   * ------------------------------------------------------------------------
6637
   */
6638
6639
6640
  $(window).on(Event$8.LOAD_DATA_API, function () {
6641
    var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
6642
    var scrollSpysLength = scrollSpys.length;
6643
6644
    for (var i = scrollSpysLength; i--;) {
6645
      var $spy = $(scrollSpys[i]);
6646
6647
      ScrollSpy._jQueryInterface.call($spy, $spy.data());
6648
    }
6649
  });
6650
  /**
6651
   * ------------------------------------------------------------------------
6652
   * jQuery
6653
   * ------------------------------------------------------------------------
6654
   */
6655
6656
  $.fn[NAME$8] = ScrollSpy._jQueryInterface;
6657
  $.fn[NAME$8].Constructor = ScrollSpy;
6658
6659
  $.fn[NAME$8].noConflict = function () {
6660
    $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
6661
    return ScrollSpy._jQueryInterface;
6662
  };
6663
6664
  /**
6665
   * ------------------------------------------------------------------------
6666
   * Constants
6667
   * ------------------------------------------------------------------------
6668
   */
6669
6670
  var NAME$9 = 'tab';
6671
  var VERSION$9 = '4.4.1';
6672
  var DATA_KEY$9 = 'bs.tab';
6673
  var EVENT_KEY$9 = "." + DATA_KEY$9;
6674
  var DATA_API_KEY$7 = '.data-api';
6675
  var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
6676
  var Event$9 = {
6677
    HIDE: "hide" + EVENT_KEY$9,
6678
    HIDDEN: "hidden" + EVENT_KEY$9,
6679
    SHOW: "show" + EVENT_KEY$9,
6680
    SHOWN: "shown" + EVENT_KEY$9,
6681
    CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
6682
  };
6683
  var ClassName$9 = {
6684
    DROPDOWN_MENU: 'dropdown-menu',
6685
    ACTIVE: 'active',
6686
    DISABLED: 'disabled',
6687
    FADE: 'fade',
6688
    SHOW: 'show'
6689
  };
6690
  var Selector$9 = {
6691
    DROPDOWN: '.dropdown',
6692
    NAV_LIST_GROUP: '.nav, .list-group',
6693
    ACTIVE: '.active',
6694
    ACTIVE_UL: '> li > .active',
6695
    DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
6696
    DROPDOWN_TOGGLE: '.dropdown-toggle',
6697
    DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
6698
  };
6699
  /**
6700
   * ------------------------------------------------------------------------
6701
   * Class Definition
6702
   * ------------------------------------------------------------------------
6703
   */
6704
6705
  var Tab =
6706
  /*#__PURE__*/
6707
  function () {
6708
    function Tab(element) {
6709
      this._element = element;
6710
    } // Getters
6711
6712
6713
    var _proto = Tab.prototype;
6714
6715
    // Public
6716
    _proto.show = function show() {
6717
      var _this = this;
6718
6719
      if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
6720
        return;
6721
      }
6722
6723
      var target;
6724
      var previous;
6725
      var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
6726
      var selector = Util.getSelectorFromElement(this._element);
6727
6728
      if (listElement) {
6729
        var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
6730
        previous = $.makeArray($(listElement).find(itemSelector));
6731
        previous = previous[previous.length - 1];
6732
      }
6733
6734
      var hideEvent = $.Event(Event$9.HIDE, {
6735
        relatedTarget: this._element
6736
      });
6737
      var showEvent = $.Event(Event$9.SHOW, {
6738
        relatedTarget: previous
6739
      });
6740
6741
      if (previous) {
6742
        $(previous).trigger(hideEvent);
6743
      }
6744
6745
      $(this._element).trigger(showEvent);
6746
6747
      if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
6748
        return;
6749
      }
6750
6751
      if (selector) {
6752
        target = document.querySelector(selector);
6753
      }
6754
6755
      this._activate(this._element, listElement);
6756
6757
      var complete = function complete() {
6758
        var hiddenEvent = $.Event(Event$9.HIDDEN, {
6759
          relatedTarget: _this._element
6760
        });
6761
        var shownEvent = $.Event(Event$9.SHOWN, {
6762
          relatedTarget: previous
6763
        });
6764
        $(previous).trigger(hiddenEvent);
6765
        $(_this._element).trigger(shownEvent);
6766
      };
6767
6768
      if (target) {
6769
        this._activate(target, target.parentNode, complete);
6770
      } else {
6771
        complete();
6772
      }
6773
    };
6774
6775
    _proto.dispose = function dispose() {
6776
      $.removeData(this._element, DATA_KEY$9);
6777
      this._element = null;
6778
    } // Private
6779
    ;
6780
6781
    _proto._activate = function _activate(element, container, callback) {
6782
      var _this2 = this;
6783
6784
      var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
6785
      var active = activeElements[0];
6786
      var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
6787
6788
      var complete = function complete() {
6789
        return _this2._transitionComplete(element, active, callback);
6790
      };
6791
6792
      if (active && isTransitioning) {
6793
        var transitionDuration = Util.getTransitionDurationFromElement(active);
6794
        $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
6795
      } else {
6796
        complete();
6797
      }
6798
    };
6799
6800
    _proto._transitionComplete = function _transitionComplete(element, active, callback) {
6801
      if (active) {
6802
        $(active).removeClass(ClassName$9.ACTIVE);
6803
        var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
6804
6805
        if (dropdownChild) {
6806
          $(dropdownChild).removeClass(ClassName$9.ACTIVE);
6807
        }
6808
6809
        if (active.getAttribute('role') === 'tab') {
6810
          active.setAttribute('aria-selected', false);
6811
        }
6812
      }
6813
6814
      $(element).addClass(ClassName$9.ACTIVE);
6815
6816
      if (element.getAttribute('role') === 'tab') {
6817
        element.setAttribute('aria-selected', true);
6818
      }
6819
6820
      Util.reflow(element);
6821
6822
      if (element.classList.contains(ClassName$9.FADE)) {
6823
        element.classList.add(ClassName$9.SHOW);
6824
      }
6825
6826
      if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
6827
        var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
6828
6829
        if (dropdownElement) {
6830
          var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
6831
          $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
6832
        }
6833
6834
        element.setAttribute('aria-expanded', true);
6835
      }
6836
6837
      if (callback) {
6838
        callback();
6839
      }
6840
    } // Static
6841
    ;
6842
6843
    Tab._jQueryInterface = function _jQueryInterface(config) {
6844
      return this.each(function () {
6845
        var $this = $(this);
6846
        var data = $this.data(DATA_KEY$9);
6847
6848
        if (!data) {
6849
          data = new Tab(this);
6850
          $this.data(DATA_KEY$9, data);
6851
        }
6852
6853
        if (typeof config === 'string') {
6854
          if (typeof data[config] === 'undefined') {
6855
            throw new TypeError("No method named \"" + config + "\"");
6856
          }
6857
6858
          data[config]();
6859
        }
6860
      });
6861
    };
6862
6863
    _createClass(Tab, null, [{
6864
      key: "VERSION",
6865
      get: function get() {
6866
        return VERSION$9;
6867
      }
6868
    }]);
6869
6870
    return Tab;
6871
  }();
6872
  /**
6873
   * ------------------------------------------------------------------------
6874
   * Data Api implementation
6875
   * ------------------------------------------------------------------------
6876
   */
6877
6878
6879
  $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
6880
    event.preventDefault();
6881
6882
    Tab._jQueryInterface.call($(this), 'show');
6883
  });
6884
  /**
6885
   * ------------------------------------------------------------------------
6886
   * jQuery
6887
   * ------------------------------------------------------------------------
6888
   */
6889
6890
  $.fn[NAME$9] = Tab._jQueryInterface;
6891
  $.fn[NAME$9].Constructor = Tab;
6892
6893
  $.fn[NAME$9].noConflict = function () {
6894
    $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
6895
    return Tab._jQueryInterface;
6896
  };
6897
6898
  /**
6899
   * ------------------------------------------------------------------------
6900
   * Constants
6901
   * ------------------------------------------------------------------------
6902
   */
6903
6904
  var NAME$a = 'toast';
6905
  var VERSION$a = '4.4.1';
6906
  var DATA_KEY$a = 'bs.toast';
6907
  var EVENT_KEY$a = "." + DATA_KEY$a;
6908
  var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
6909
  var Event$a = {
6910
    CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
6911
    HIDE: "hide" + EVENT_KEY$a,
6912
    HIDDEN: "hidden" + EVENT_KEY$a,
6913
    SHOW: "show" + EVENT_KEY$a,
6914
    SHOWN: "shown" + EVENT_KEY$a
6915
  };
6916
  var ClassName$a = {
6917
    FADE: 'fade',
6918
    HIDE: 'hide',
6919
    SHOW: 'show',
6920
    SHOWING: 'showing'
6921
  };
6922
  var DefaultType$7 = {
6923
    animation: 'boolean',
6924
    autohide: 'boolean',
6925
    delay: 'number'
6926
  };
6927
  var Default$7 = {
6928
    animation: true,
6929
    autohide: true,
6930
    delay: 500
6931
  };
6932
  var Selector$a = {
6933
    DATA_DISMISS: '[data-dismiss="toast"]'
6934
  };
6935
  /**
6936
   * ------------------------------------------------------------------------
6937
   * Class Definition
6938
   * ------------------------------------------------------------------------
6939
   */
6940
6941
  var Toast =
6942
  /*#__PURE__*/
6943
  function () {
6944
    function Toast(element, config) {
6945
      this._element = element;
6946
      this._config = this._getConfig(config);
6947
      this._timeout = null;
6948
6949
      this._setListeners();
6950
    } // Getters
6951
6952
6953
    var _proto = Toast.prototype;
6954
6955
    // Public
6956
    _proto.show = function show() {
6957
      var _this = this;
6958
6959
      var showEvent = $.Event(Event$a.SHOW);
6960
      $(this._element).trigger(showEvent);
6961
6962
      if (showEvent.isDefaultPrevented()) {
6963
        return;
6964
      }
6965
6966
      if (this._config.animation) {
6967
        this._element.classList.add(ClassName$a.FADE);
6968
      }
6969
6970
      var complete = function complete() {
6971
        _this._element.classList.remove(ClassName$a.SHOWING);
6972
6973
        _this._element.classList.add(ClassName$a.SHOW);
6974
6975
        $(_this._element).trigger(Event$a.SHOWN);
6976
6977
        if (_this._config.autohide) {
6978
          _this._timeout = setTimeout(function () {
6979
            _this.hide();
6980
          }, _this._config.delay);
6981
        }
6982
      };
6983
6984
      this._element.classList.remove(ClassName$a.HIDE);
6985
6986
      Util.reflow(this._element);
6987
6988
      this._element.classList.add(ClassName$a.SHOWING);
6989
6990
      if (this._config.animation) {
6991
        var transitionDuration = Util.getTransitionDurationFromElement(this._element);
6992
        $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
6993
      } else {
6994
        complete();
6995
      }
6996
    };
6997
6998
    _proto.hide = function hide() {
6999
      if (!this._element.classList.contains(ClassName$a.SHOW)) {
7000
        return;
7001
      }
7002
7003
      var hideEvent = $.Event(Event$a.HIDE);
7004
      $(this._element).trigger(hideEvent);
7005
7006
      if (hideEvent.isDefaultPrevented()) {
7007
        return;
7008
      }
7009
7010
      this._close();
7011
    };
7012
7013
    _proto.dispose = function dispose() {
7014
      clearTimeout(this._timeout);
7015
      this._timeout = null;
7016
7017
      if (this._element.classList.contains(ClassName$a.SHOW)) {
7018
        this._element.classList.remove(ClassName$a.SHOW);
7019
      }
7020
7021
      $(this._element).off(Event$a.CLICK_DISMISS);
7022
      $.removeData(this._element, DATA_KEY$a);
7023
      this._element = null;
7024
      this._config = null;
7025
    } // Private
7026
    ;
7027
7028
    _proto._getConfig = function _getConfig(config) {
7029
      config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
7030
      Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
7031
      return config;
7032
    };
7033
7034
    _proto._setListeners = function _setListeners() {
7035
      var _this2 = this;
7036
7037
      $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
7038
        return _this2.hide();
7039
      });
7040
    };
7041
7042
    _proto._close = function _close() {
7043
      var _this3 = this;
7044
7045
      var complete = function complete() {
7046
        _this3._element.classList.add(ClassName$a.HIDE);
7047
7048
        $(_this3._element).trigger(Event$a.HIDDEN);
7049
      };
7050
7051
      this._element.classList.remove(ClassName$a.SHOW);
7052
7053
      if (this._config.animation) {
7054
        var transitionDuration = Util.getTransitionDurationFromElement(this._element);
7055
        $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
7056
      } else {
7057
        complete();
7058
      }
7059
    } // Static
7060
    ;
7061
7062
    Toast._jQueryInterface = function _jQueryInterface(config) {
7063
      return this.each(function () {
7064
        var $element = $(this);
7065
        var data = $element.data(DATA_KEY$a);
7066
7067
        var _config = typeof config === 'object' && config;
7068
7069
        if (!data) {
7070
          data = new Toast(this, _config);
7071
          $element.data(DATA_KEY$a, data);
7072
        }
7073
7074
        if (typeof config === 'string') {
7075
          if (typeof data[config] === 'undefined') {
7076
            throw new TypeError("No method named \"" + config + "\"");
7077
          }
7078
7079
          data[config](this);
7080
        }
7081
      });
7082
    };
7083
7084
    _createClass(Toast, null, [{
7085
      key: "VERSION",
7086
      get: function get() {
7087
        return VERSION$a;
7088
      }
7089
    }, {
7090
      key: "DefaultType",
7091
      get: function get() {
7092
        return DefaultType$7;
7093
      }
7094
    }, {
7095
      key: "Default",
7096
      get: function get() {
7097
        return Default$7;
7098
      }
7099
    }]);
7100
7101
    return Toast;
7102
  }();
7103
  /**
7104
   * ------------------------------------------------------------------------
7105
   * jQuery
7106
   * ------------------------------------------------------------------------
7107
   */
7108
7109
7110
  $.fn[NAME$a] = Toast._jQueryInterface;
7111
  $.fn[NAME$a].Constructor = Toast;
7112
7113
  $.fn[NAME$a].noConflict = function () {
7114
    $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
7115
    return Toast._jQueryInterface;
7116
  };
7117
7118
  exports.Alert = Alert;
7119
  exports.Button = Button;
7120
  exports.Carousel = Carousel;
7121
  exports.Collapse = Collapse;
7122
  exports.Dropdown = Dropdown;
7123
  exports.Modal = Modal;
7124
  exports.Popover = Popover;
7125
  exports.Scrollspy = ScrollSpy;
7126
  exports.Tab = Tab;
7127
  exports.Toast = Toast;
7128
  exports.Tooltip = Tooltip;
7129
  exports.Util = Util;
7130
7131
  Object.defineProperty(exports, '__esModule', { value: true });
7132
7133
})));
7134
//# sourceMappingURL=bootstrap.bundle.js.map