prometheus

Форк
0
7023 строки · 223.1 Кб
1
/*!
2
  * Bootstrap v4.5.2 (https://getbootstrap.com/)
3
  * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/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 = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.bootstrap = {}, global.jQuery));
10
}(this, (function (exports, $) { 'use strict';
11

12
  $ = $ && Object.prototype.hasOwnProperty.call($, '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 _extends() {
31
    _extends = Object.assign || function (target) {
32
      for (var i = 1; i < arguments.length; i++) {
33
        var source = arguments[i];
34

35
        for (var key in source) {
36
          if (Object.prototype.hasOwnProperty.call(source, key)) {
37
            target[key] = source[key];
38
          }
39
        }
40
      }
41

42
      return target;
43
    };
44

45
    return _extends.apply(this, arguments);
46
  }
47

48
  function _inheritsLoose(subClass, superClass) {
49
    subClass.prototype = Object.create(superClass.prototype);
50
    subClass.prototype.constructor = subClass;
51
    subClass.__proto__ = superClass;
52
  }
53

54
  /**
55
   * --------------------------------------------------------------------------
56
   * Bootstrap (v4.5.2): util.js
57
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
58
   * --------------------------------------------------------------------------
59
   */
60
  /**
61
   * ------------------------------------------------------------------------
62
   * Private TransitionEnd Helpers
63
   * ------------------------------------------------------------------------
64
   */
65

66
  var TRANSITION_END = 'transitionend';
67
  var MAX_UID = 1000000;
68
  var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
69

70
  function toType(obj) {
71
    if (obj === null || typeof obj === 'undefined') {
72
      return "" + obj;
73
    }
74

75
    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
76
  }
77

78
  function getSpecialTransitionEndEvent() {
79
    return {
80
      bindType: TRANSITION_END,
81
      delegateType: TRANSITION_END,
82
      handle: function handle(event) {
83
        if ($(event.target).is(this)) {
84
          return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
85
        }
86

87
        return undefined;
88
      }
89
    };
90
  }
91

92
  function transitionEndEmulator(duration) {
93
    var _this = this;
94

95
    var called = false;
96
    $(this).one(Util.TRANSITION_END, function () {
97
      called = true;
98
    });
99
    setTimeout(function () {
100
      if (!called) {
101
        Util.triggerTransitionEnd(_this);
102
      }
103
    }, duration);
104
    return this;
105
  }
106

107
  function setTransitionEndSupport() {
108
    $.fn.emulateTransitionEnd = transitionEndEmulator;
109
    $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
110
  }
111
  /**
112
   * --------------------------------------------------------------------------
113
   * Public Util Api
114
   * --------------------------------------------------------------------------
115
   */
116

117

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

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

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

136
      try {
137
        return document.querySelector(selector) ? selector : null;
138
      } catch (err) {
139
        return null;
140
      }
141
    },
142
    getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
143
      if (!element) {
144
        return 0;
145
      } // Get transition-duration of the element
146

147

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

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

157

158
      transitionDuration = transitionDuration.split(',')[0];
159
      transitionDelay = transitionDelay.split(',')[0];
160
      return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
161
    },
162
    reflow: function reflow(element) {
163
      return element.offsetHeight;
164
    },
165
    triggerTransitionEnd: function triggerTransitionEnd(element) {
166
      $(element).trigger(TRANSITION_END);
167
    },
168
    // TODO: Remove in v5
169
    supportsTransitionEnd: function supportsTransitionEnd() {
170
      return Boolean(TRANSITION_END);
171
    },
172
    isElement: function isElement(obj) {
173
      return (obj[0] || obj).nodeType;
174
    },
175
    typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
176
      for (var property in configTypes) {
177
        if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
178
          var expectedTypes = configTypes[property];
179
          var value = config[property];
180
          var valueType = value && Util.isElement(value) ? 'element' : toType(value);
181

182
          if (!new RegExp(expectedTypes).test(valueType)) {
183
            throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
184
          }
185
        }
186
      }
187
    },
188
    findShadowRoot: function findShadowRoot(element) {
189
      if (!document.documentElement.attachShadow) {
190
        return null;
191
      } // Can find the shadow root otherwise it'll return the document
192

193

194
      if (typeof element.getRootNode === 'function') {
195
        var root = element.getRootNode();
196
        return root instanceof ShadowRoot ? root : null;
197
      }
198

199
      if (element instanceof ShadowRoot) {
200
        return element;
201
      } // when we don't find a shadow root
202

203

204
      if (!element.parentNode) {
205
        return null;
206
      }
207

208
      return Util.findShadowRoot(element.parentNode);
209
    },
210
    jQueryDetection: function jQueryDetection() {
211
      if (typeof $ === 'undefined') {
212
        throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
213
      }
214

215
      var version = $.fn.jquery.split(' ')[0].split('.');
216
      var minMajor = 1;
217
      var ltMajor = 2;
218
      var minMinor = 9;
219
      var minPatch = 1;
220
      var maxMajor = 4;
221

222
      if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
223
        throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
224
      }
225
    }
226
  };
227
  Util.jQueryDetection();
228
  setTransitionEndSupport();
229

230
  /**
231
   * ------------------------------------------------------------------------
232
   * Constants
233
   * ------------------------------------------------------------------------
234
   */
235

236
  var NAME = 'alert';
237
  var VERSION = '4.5.2';
238
  var DATA_KEY = 'bs.alert';
239
  var EVENT_KEY = "." + DATA_KEY;
240
  var DATA_API_KEY = '.data-api';
241
  var JQUERY_NO_CONFLICT = $.fn[NAME];
242
  var SELECTOR_DISMISS = '[data-dismiss="alert"]';
243
  var EVENT_CLOSE = "close" + EVENT_KEY;
244
  var EVENT_CLOSED = "closed" + EVENT_KEY;
245
  var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
246
  var CLASS_NAME_ALERT = 'alert';
247
  var CLASS_NAME_FADE = 'fade';
248
  var CLASS_NAME_SHOW = 'show';
249
  /**
250
   * ------------------------------------------------------------------------
251
   * Class Definition
252
   * ------------------------------------------------------------------------
253
   */
254

255
  var Alert = /*#__PURE__*/function () {
256
    function Alert(element) {
257
      this._element = element;
258
    } // Getters
259

260

261
    var _proto = Alert.prototype;
262

263
    // Public
264
    _proto.close = function close(element) {
265
      var rootElement = this._element;
266

267
      if (element) {
268
        rootElement = this._getRootElement(element);
269
      }
270

271
      var customEvent = this._triggerCloseEvent(rootElement);
272

273
      if (customEvent.isDefaultPrevented()) {
274
        return;
275
      }
276

277
      this._removeElement(rootElement);
278
    };
279

280
    _proto.dispose = function dispose() {
281
      $.removeData(this._element, DATA_KEY);
282
      this._element = null;
283
    } // Private
284
    ;
285

286
    _proto._getRootElement = function _getRootElement(element) {
287
      var selector = Util.getSelectorFromElement(element);
288
      var parent = false;
289

290
      if (selector) {
291
        parent = document.querySelector(selector);
292
      }
293

294
      if (!parent) {
295
        parent = $(element).closest("." + CLASS_NAME_ALERT)[0];
296
      }
297

298
      return parent;
299
    };
300

301
    _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
302
      var closeEvent = $.Event(EVENT_CLOSE);
303
      $(element).trigger(closeEvent);
304
      return closeEvent;
305
    };
306

307
    _proto._removeElement = function _removeElement(element) {
308
      var _this = this;
309

310
      $(element).removeClass(CLASS_NAME_SHOW);
311

312
      if (!$(element).hasClass(CLASS_NAME_FADE)) {
313
        this._destroyElement(element);
314

315
        return;
316
      }
317

318
      var transitionDuration = Util.getTransitionDurationFromElement(element);
319
      $(element).one(Util.TRANSITION_END, function (event) {
320
        return _this._destroyElement(element, event);
321
      }).emulateTransitionEnd(transitionDuration);
322
    };
323

324
    _proto._destroyElement = function _destroyElement(element) {
325
      $(element).detach().trigger(EVENT_CLOSED).remove();
326
    } // Static
327
    ;
328

329
    Alert._jQueryInterface = function _jQueryInterface(config) {
330
      return this.each(function () {
331
        var $element = $(this);
332
        var data = $element.data(DATA_KEY);
333

334
        if (!data) {
335
          data = new Alert(this);
336
          $element.data(DATA_KEY, data);
337
        }
338

339
        if (config === 'close') {
340
          data[config](this);
341
        }
342
      });
343
    };
344

345
    Alert._handleDismiss = function _handleDismiss(alertInstance) {
346
      return function (event) {
347
        if (event) {
348
          event.preventDefault();
349
        }
350

351
        alertInstance.close(this);
352
      };
353
    };
354

355
    _createClass(Alert, null, [{
356
      key: "VERSION",
357
      get: function get() {
358
        return VERSION;
359
      }
360
    }]);
361

362
    return Alert;
363
  }();
364
  /**
365
   * ------------------------------------------------------------------------
366
   * Data Api implementation
367
   * ------------------------------------------------------------------------
368
   */
369

370

371
  $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert()));
372
  /**
373
   * ------------------------------------------------------------------------
374
   * jQuery
375
   * ------------------------------------------------------------------------
376
   */
377

378
  $.fn[NAME] = Alert._jQueryInterface;
379
  $.fn[NAME].Constructor = Alert;
380

381
  $.fn[NAME].noConflict = function () {
382
    $.fn[NAME] = JQUERY_NO_CONFLICT;
383
    return Alert._jQueryInterface;
384
  };
385

386
  /**
387
   * ------------------------------------------------------------------------
388
   * Constants
389
   * ------------------------------------------------------------------------
390
   */
391

392
  var NAME$1 = 'button';
393
  var VERSION$1 = '4.5.2';
394
  var DATA_KEY$1 = 'bs.button';
395
  var EVENT_KEY$1 = "." + DATA_KEY$1;
396
  var DATA_API_KEY$1 = '.data-api';
397
  var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
398
  var CLASS_NAME_ACTIVE = 'active';
399
  var CLASS_NAME_BUTTON = 'btn';
400
  var CLASS_NAME_FOCUS = 'focus';
401
  var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]';
402
  var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]';
403
  var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
404
  var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn';
405
  var SELECTOR_INPUT = 'input:not([type="hidden"])';
406
  var SELECTOR_ACTIVE = '.active';
407
  var SELECTOR_BUTTON = '.btn';
408
  var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
409
  var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1);
410
  var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$1 + DATA_API_KEY$1;
411
  /**
412
   * ------------------------------------------------------------------------
413
   * Class Definition
414
   * ------------------------------------------------------------------------
415
   */
416

417
  var Button = /*#__PURE__*/function () {
418
    function Button(element) {
419
      this._element = element;
420
    } // Getters
421

422

423
    var _proto = Button.prototype;
424

425
    // Public
426
    _proto.toggle = function toggle() {
427
      var triggerChangeEvent = true;
428
      var addAriaPressed = true;
429
      var rootElement = $(this._element).closest(SELECTOR_DATA_TOGGLES)[0];
430

431
      if (rootElement) {
432
        var input = this._element.querySelector(SELECTOR_INPUT);
433

434
        if (input) {
435
          if (input.type === 'radio') {
436
            if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
437
              triggerChangeEvent = false;
438
            } else {
439
              var activeElement = rootElement.querySelector(SELECTOR_ACTIVE);
440

441
              if (activeElement) {
442
                $(activeElement).removeClass(CLASS_NAME_ACTIVE);
443
              }
444
            }
445
          }
446

447
          if (triggerChangeEvent) {
448
            // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
449
            if (input.type === 'checkbox' || input.type === 'radio') {
450
              input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE);
451
            }
452

453
            $(input).trigger('change');
454
          }
455

456
          input.focus();
457
          addAriaPressed = false;
458
        }
459
      }
460

461
      if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
462
        if (addAriaPressed) {
463
          this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE));
464
        }
465

466
        if (triggerChangeEvent) {
467
          $(this._element).toggleClass(CLASS_NAME_ACTIVE);
468
        }
469
      }
470
    };
471

472
    _proto.dispose = function dispose() {
473
      $.removeData(this._element, DATA_KEY$1);
474
      this._element = null;
475
    } // Static
476
    ;
477

478
    Button._jQueryInterface = function _jQueryInterface(config) {
479
      return this.each(function () {
480
        var data = $(this).data(DATA_KEY$1);
481

482
        if (!data) {
483
          data = new Button(this);
484
          $(this).data(DATA_KEY$1, data);
485
        }
486

487
        if (config === 'toggle') {
488
          data[config]();
489
        }
490
      });
491
    };
492

493
    _createClass(Button, null, [{
494
      key: "VERSION",
495
      get: function get() {
496
        return VERSION$1;
497
      }
498
    }]);
499

500
    return Button;
501
  }();
502
  /**
503
   * ------------------------------------------------------------------------
504
   * Data Api implementation
505
   * ------------------------------------------------------------------------
506
   */
507

508

509
  $(document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
510
    var button = event.target;
511
    var initialButton = button;
512

513
    if (!$(button).hasClass(CLASS_NAME_BUTTON)) {
514
      button = $(button).closest(SELECTOR_BUTTON)[0];
515
    }
516

517
    if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
518
      event.preventDefault(); // work around Firefox bug #1540995
519
    } else {
520
      var inputBtn = button.querySelector(SELECTOR_INPUT);
521

522
      if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
523
        event.preventDefault(); // work around Firefox bug #1540995
524

525
        return;
526
      }
527

528
      if (initialButton.tagName !== 'LABEL' || inputBtn && inputBtn.type !== 'checkbox') {
529
        Button._jQueryInterface.call($(button), 'toggle');
530
      }
531
    }
532
  }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
533
    var button = $(event.target).closest(SELECTOR_BUTTON)[0];
534
    $(button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type));
535
  });
536
  $(window).on(EVENT_LOAD_DATA_API, function () {
537
    // ensure correct active class is set to match the controls' actual values/states
538
    // find all checkboxes/readio buttons inside data-toggle groups
539
    var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS));
540

541
    for (var i = 0, len = buttons.length; i < len; i++) {
542
      var button = buttons[i];
543
      var input = button.querySelector(SELECTOR_INPUT);
544

545
      if (input.checked || input.hasAttribute('checked')) {
546
        button.classList.add(CLASS_NAME_ACTIVE);
547
      } else {
548
        button.classList.remove(CLASS_NAME_ACTIVE);
549
      }
550
    } // find all button toggles
551

552

553
    buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
554

555
    for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
556
      var _button = buttons[_i];
557

558
      if (_button.getAttribute('aria-pressed') === 'true') {
559
        _button.classList.add(CLASS_NAME_ACTIVE);
560
      } else {
561
        _button.classList.remove(CLASS_NAME_ACTIVE);
562
      }
563
    }
564
  });
565
  /**
566
   * ------------------------------------------------------------------------
567
   * jQuery
568
   * ------------------------------------------------------------------------
569
   */
570

571
  $.fn[NAME$1] = Button._jQueryInterface;
572
  $.fn[NAME$1].Constructor = Button;
573

574
  $.fn[NAME$1].noConflict = function () {
575
    $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
576
    return Button._jQueryInterface;
577
  };
578

579
  /**
580
   * ------------------------------------------------------------------------
581
   * Constants
582
   * ------------------------------------------------------------------------
583
   */
584

585
  var NAME$2 = 'carousel';
586
  var VERSION$2 = '4.5.2';
587
  var DATA_KEY$2 = 'bs.carousel';
588
  var EVENT_KEY$2 = "." + DATA_KEY$2;
589
  var DATA_API_KEY$2 = '.data-api';
590
  var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
591
  var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
592

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

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

597
  var SWIPE_THRESHOLD = 40;
598
  var Default = {
599
    interval: 5000,
600
    keyboard: true,
601
    slide: false,
602
    pause: 'hover',
603
    wrap: true,
604
    touch: true
605
  };
606
  var DefaultType = {
607
    interval: '(number|boolean)',
608
    keyboard: 'boolean',
609
    slide: '(boolean|string)',
610
    pause: '(string|boolean)',
611
    wrap: 'boolean',
612
    touch: 'boolean'
613
  };
614
  var DIRECTION_NEXT = 'next';
615
  var DIRECTION_PREV = 'prev';
616
  var DIRECTION_LEFT = 'left';
617
  var DIRECTION_RIGHT = 'right';
618
  var EVENT_SLIDE = "slide" + EVENT_KEY$2;
619
  var EVENT_SLID = "slid" + EVENT_KEY$2;
620
  var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
621
  var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
622
  var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
623
  var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
624
  var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
625
  var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
626
  var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
627
  var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
628
  var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
629
  var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
630
  var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
631
  var CLASS_NAME_CAROUSEL = 'carousel';
632
  var CLASS_NAME_ACTIVE$1 = 'active';
633
  var CLASS_NAME_SLIDE = 'slide';
634
  var CLASS_NAME_RIGHT = 'carousel-item-right';
635
  var CLASS_NAME_LEFT = 'carousel-item-left';
636
  var CLASS_NAME_NEXT = 'carousel-item-next';
637
  var CLASS_NAME_PREV = 'carousel-item-prev';
638
  var CLASS_NAME_POINTER_EVENT = 'pointer-event';
639
  var SELECTOR_ACTIVE$1 = '.active';
640
  var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
641
  var SELECTOR_ITEM = '.carousel-item';
642
  var SELECTOR_ITEM_IMG = '.carousel-item img';
643
  var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
644
  var SELECTOR_INDICATORS = '.carousel-indicators';
645
  var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
646
  var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
647
  var PointerType = {
648
    TOUCH: 'touch',
649
    PEN: 'pen'
650
  };
651
  /**
652
   * ------------------------------------------------------------------------
653
   * Class Definition
654
   * ------------------------------------------------------------------------
655
   */
656

657
  var Carousel = /*#__PURE__*/function () {
658
    function Carousel(element, config) {
659
      this._items = null;
660
      this._interval = null;
661
      this._activeElement = null;
662
      this._isPaused = false;
663
      this._isSliding = false;
664
      this.touchTimeout = null;
665
      this.touchStartX = 0;
666
      this.touchDeltaX = 0;
667
      this._config = this._getConfig(config);
668
      this._element = element;
669
      this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
670
      this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
671
      this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
672

673
      this._addEventListeners();
674
    } // Getters
675

676

677
    var _proto = Carousel.prototype;
678

679
    // Public
680
    _proto.next = function next() {
681
      if (!this._isSliding) {
682
        this._slide(DIRECTION_NEXT);
683
      }
684
    };
685

686
    _proto.nextWhenVisible = function nextWhenVisible() {
687
      // Don't call next when the page isn't visible
688
      // or the carousel or its parent isn't visible
689
      if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
690
        this.next();
691
      }
692
    };
693

694
    _proto.prev = function prev() {
695
      if (!this._isSliding) {
696
        this._slide(DIRECTION_PREV);
697
      }
698
    };
699

700
    _proto.pause = function pause(event) {
701
      if (!event) {
702
        this._isPaused = true;
703
      }
704

705
      if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
706
        Util.triggerTransitionEnd(this._element);
707
        this.cycle(true);
708
      }
709

710
      clearInterval(this._interval);
711
      this._interval = null;
712
    };
713

714
    _proto.cycle = function cycle(event) {
715
      if (!event) {
716
        this._isPaused = false;
717
      }
718

719
      if (this._interval) {
720
        clearInterval(this._interval);
721
        this._interval = null;
722
      }
723

724
      if (this._config.interval && !this._isPaused) {
725
        this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
726
      }
727
    };
728

729
    _proto.to = function to(index) {
730
      var _this = this;
731

732
      this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
733

734
      var activeIndex = this._getItemIndex(this._activeElement);
735

736
      if (index > this._items.length - 1 || index < 0) {
737
        return;
738
      }
739

740
      if (this._isSliding) {
741
        $(this._element).one(EVENT_SLID, function () {
742
          return _this.to(index);
743
        });
744
        return;
745
      }
746

747
      if (activeIndex === index) {
748
        this.pause();
749
        this.cycle();
750
        return;
751
      }
752

753
      var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
754

755
      this._slide(direction, this._items[index]);
756
    };
757

758
    _proto.dispose = function dispose() {
759
      $(this._element).off(EVENT_KEY$2);
760
      $.removeData(this._element, DATA_KEY$2);
761
      this._items = null;
762
      this._config = null;
763
      this._element = null;
764
      this._interval = null;
765
      this._isPaused = null;
766
      this._isSliding = null;
767
      this._activeElement = null;
768
      this._indicatorsElement = null;
769
    } // Private
770
    ;
771

772
    _proto._getConfig = function _getConfig(config) {
773
      config = _extends({}, Default, config);
774
      Util.typeCheckConfig(NAME$2, config, DefaultType);
775
      return config;
776
    };
777

778
    _proto._handleSwipe = function _handleSwipe() {
779
      var absDeltax = Math.abs(this.touchDeltaX);
780

781
      if (absDeltax <= SWIPE_THRESHOLD) {
782
        return;
783
      }
784

785
      var direction = absDeltax / this.touchDeltaX;
786
      this.touchDeltaX = 0; // swipe left
787

788
      if (direction > 0) {
789
        this.prev();
790
      } // swipe right
791

792

793
      if (direction < 0) {
794
        this.next();
795
      }
796
    };
797

798
    _proto._addEventListeners = function _addEventListeners() {
799
      var _this2 = this;
800

801
      if (this._config.keyboard) {
802
        $(this._element).on(EVENT_KEYDOWN, function (event) {
803
          return _this2._keydown(event);
804
        });
805
      }
806

807
      if (this._config.pause === 'hover') {
808
        $(this._element).on(EVENT_MOUSEENTER, function (event) {
809
          return _this2.pause(event);
810
        }).on(EVENT_MOUSELEAVE, function (event) {
811
          return _this2.cycle(event);
812
        });
813
      }
814

815
      if (this._config.touch) {
816
        this._addTouchEventListeners();
817
      }
818
    };
819

820
    _proto._addTouchEventListeners = function _addTouchEventListeners() {
821
      var _this3 = this;
822

823
      if (!this._touchSupported) {
824
        return;
825
      }
826

827
      var start = function start(event) {
828
        if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
829
          _this3.touchStartX = event.originalEvent.clientX;
830
        } else if (!_this3._pointerEvent) {
831
          _this3.touchStartX = event.originalEvent.touches[0].clientX;
832
        }
833
      };
834

835
      var move = function move(event) {
836
        // ensure swiping with one touch and not pinching
837
        if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
838
          _this3.touchDeltaX = 0;
839
        } else {
840
          _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
841
        }
842
      };
843

844
      var end = function end(event) {
845
        if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
846
          _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
847
        }
848

849
        _this3._handleSwipe();
850

851
        if (_this3._config.pause === 'hover') {
852
          // If it's a touch-enabled device, mouseenter/leave are fired as
853
          // part of the mouse compatibility events on first tap - the carousel
854
          // would stop cycling until user tapped out of it;
855
          // here, we listen for touchend, explicitly pause the carousel
856
          // (as if it's the second time we tap on it, mouseenter compat event
857
          // is NOT fired) and after a timeout (to allow for mouse compatibility
858
          // events to fire) we explicitly restart cycling
859
          _this3.pause();
860

861
          if (_this3.touchTimeout) {
862
            clearTimeout(_this3.touchTimeout);
863
          }
864

865
          _this3.touchTimeout = setTimeout(function (event) {
866
            return _this3.cycle(event);
867
          }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
868
        }
869
      };
870

871
      $(this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) {
872
        return e.preventDefault();
873
      });
874

875
      if (this._pointerEvent) {
876
        $(this._element).on(EVENT_POINTERDOWN, function (event) {
877
          return start(event);
878
        });
879
        $(this._element).on(EVENT_POINTERUP, function (event) {
880
          return end(event);
881
        });
882

883
        this._element.classList.add(CLASS_NAME_POINTER_EVENT);
884
      } else {
885
        $(this._element).on(EVENT_TOUCHSTART, function (event) {
886
          return start(event);
887
        });
888
        $(this._element).on(EVENT_TOUCHMOVE, function (event) {
889
          return move(event);
890
        });
891
        $(this._element).on(EVENT_TOUCHEND, function (event) {
892
          return end(event);
893
        });
894
      }
895
    };
896

897
    _proto._keydown = function _keydown(event) {
898
      if (/input|textarea/i.test(event.target.tagName)) {
899
        return;
900
      }
901

902
      switch (event.which) {
903
        case ARROW_LEFT_KEYCODE:
904
          event.preventDefault();
905
          this.prev();
906
          break;
907

908
        case ARROW_RIGHT_KEYCODE:
909
          event.preventDefault();
910
          this.next();
911
          break;
912
      }
913
    };
914

915
    _proto._getItemIndex = function _getItemIndex(element) {
916
      this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
917
      return this._items.indexOf(element);
918
    };
919

920
    _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
921
      var isNextDirection = direction === DIRECTION_NEXT;
922
      var isPrevDirection = direction === DIRECTION_PREV;
923

924
      var activeIndex = this._getItemIndex(activeElement);
925

926
      var lastItemIndex = this._items.length - 1;
927
      var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
928

929
      if (isGoingToWrap && !this._config.wrap) {
930
        return activeElement;
931
      }
932

933
      var delta = direction === DIRECTION_PREV ? -1 : 1;
934
      var itemIndex = (activeIndex + delta) % this._items.length;
935
      return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
936
    };
937

938
    _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
939
      var targetIndex = this._getItemIndex(relatedTarget);
940

941
      var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
942

943
      var slideEvent = $.Event(EVENT_SLIDE, {
944
        relatedTarget: relatedTarget,
945
        direction: eventDirectionName,
946
        from: fromIndex,
947
        to: targetIndex
948
      });
949
      $(this._element).trigger(slideEvent);
950
      return slideEvent;
951
    };
952

953
    _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
954
      if (this._indicatorsElement) {
955
        var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1));
956
        $(indicators).removeClass(CLASS_NAME_ACTIVE$1);
957

958
        var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
959

960
        if (nextIndicator) {
961
          $(nextIndicator).addClass(CLASS_NAME_ACTIVE$1);
962
        }
963
      }
964
    };
965

966
    _proto._slide = function _slide(direction, element) {
967
      var _this4 = this;
968

969
      var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
970

971
      var activeElementIndex = this._getItemIndex(activeElement);
972

973
      var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
974

975
      var nextElementIndex = this._getItemIndex(nextElement);
976

977
      var isCycling = Boolean(this._interval);
978
      var directionalClassName;
979
      var orderClassName;
980
      var eventDirectionName;
981

982
      if (direction === DIRECTION_NEXT) {
983
        directionalClassName = CLASS_NAME_LEFT;
984
        orderClassName = CLASS_NAME_NEXT;
985
        eventDirectionName = DIRECTION_LEFT;
986
      } else {
987
        directionalClassName = CLASS_NAME_RIGHT;
988
        orderClassName = CLASS_NAME_PREV;
989
        eventDirectionName = DIRECTION_RIGHT;
990
      }
991

992
      if (nextElement && $(nextElement).hasClass(CLASS_NAME_ACTIVE$1)) {
993
        this._isSliding = false;
994
        return;
995
      }
996

997
      var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
998

999
      if (slideEvent.isDefaultPrevented()) {
1000
        return;
1001
      }
1002

1003
      if (!activeElement || !nextElement) {
1004
        // Some weirdness is happening, so we bail
1005
        return;
1006
      }
1007

1008
      this._isSliding = true;
1009

1010
      if (isCycling) {
1011
        this.pause();
1012
      }
1013

1014
      this._setActiveIndicatorElement(nextElement);
1015

1016
      var slidEvent = $.Event(EVENT_SLID, {
1017
        relatedTarget: nextElement,
1018
        direction: eventDirectionName,
1019
        from: activeElementIndex,
1020
        to: nextElementIndex
1021
      });
1022

1023
      if ($(this._element).hasClass(CLASS_NAME_SLIDE)) {
1024
        $(nextElement).addClass(orderClassName);
1025
        Util.reflow(nextElement);
1026
        $(activeElement).addClass(directionalClassName);
1027
        $(nextElement).addClass(directionalClassName);
1028
        var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
1029

1030
        if (nextElementInterval) {
1031
          this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
1032
          this._config.interval = nextElementInterval;
1033
        } else {
1034
          this._config.interval = this._config.defaultInterval || this._config.interval;
1035
        }
1036

1037
        var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
1038
        $(activeElement).one(Util.TRANSITION_END, function () {
1039
          $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$1);
1040
          $(activeElement).removeClass(CLASS_NAME_ACTIVE$1 + " " + orderClassName + " " + directionalClassName);
1041
          _this4._isSliding = false;
1042
          setTimeout(function () {
1043
            return $(_this4._element).trigger(slidEvent);
1044
          }, 0);
1045
        }).emulateTransitionEnd(transitionDuration);
1046
      } else {
1047
        $(activeElement).removeClass(CLASS_NAME_ACTIVE$1);
1048
        $(nextElement).addClass(CLASS_NAME_ACTIVE$1);
1049
        this._isSliding = false;
1050
        $(this._element).trigger(slidEvent);
1051
      }
1052

1053
      if (isCycling) {
1054
        this.cycle();
1055
      }
1056
    } // Static
1057
    ;
1058

1059
    Carousel._jQueryInterface = function _jQueryInterface(config) {
1060
      return this.each(function () {
1061
        var data = $(this).data(DATA_KEY$2);
1062

1063
        var _config = _extends({}, Default, $(this).data());
1064

1065
        if (typeof config === 'object') {
1066
          _config = _extends({}, _config, config);
1067
        }
1068

1069
        var action = typeof config === 'string' ? config : _config.slide;
1070

1071
        if (!data) {
1072
          data = new Carousel(this, _config);
1073
          $(this).data(DATA_KEY$2, data);
1074
        }
1075

1076
        if (typeof config === 'number') {
1077
          data.to(config);
1078
        } else if (typeof action === 'string') {
1079
          if (typeof data[action] === 'undefined') {
1080
            throw new TypeError("No method named \"" + action + "\"");
1081
          }
1082

1083
          data[action]();
1084
        } else if (_config.interval && _config.ride) {
1085
          data.pause();
1086
          data.cycle();
1087
        }
1088
      });
1089
    };
1090

1091
    Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
1092
      var selector = Util.getSelectorFromElement(this);
1093

1094
      if (!selector) {
1095
        return;
1096
      }
1097

1098
      var target = $(selector)[0];
1099

1100
      if (!target || !$(target).hasClass(CLASS_NAME_CAROUSEL)) {
1101
        return;
1102
      }
1103

1104
      var config = _extends({}, $(target).data(), $(this).data());
1105

1106
      var slideIndex = this.getAttribute('data-slide-to');
1107

1108
      if (slideIndex) {
1109
        config.interval = false;
1110
      }
1111

1112
      Carousel._jQueryInterface.call($(target), config);
1113

1114
      if (slideIndex) {
1115
        $(target).data(DATA_KEY$2).to(slideIndex);
1116
      }
1117

1118
      event.preventDefault();
1119
    };
1120

1121
    _createClass(Carousel, null, [{
1122
      key: "VERSION",
1123
      get: function get() {
1124
        return VERSION$2;
1125
      }
1126
    }, {
1127
      key: "Default",
1128
      get: function get() {
1129
        return Default;
1130
      }
1131
    }]);
1132

1133
    return Carousel;
1134
  }();
1135
  /**
1136
   * ------------------------------------------------------------------------
1137
   * Data Api implementation
1138
   * ------------------------------------------------------------------------
1139
   */
1140

1141

1142
  $(document).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler);
1143
  $(window).on(EVENT_LOAD_DATA_API$1, function () {
1144
    var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE));
1145

1146
    for (var i = 0, len = carousels.length; i < len; i++) {
1147
      var $carousel = $(carousels[i]);
1148

1149
      Carousel._jQueryInterface.call($carousel, $carousel.data());
1150
    }
1151
  });
1152
  /**
1153
   * ------------------------------------------------------------------------
1154
   * jQuery
1155
   * ------------------------------------------------------------------------
1156
   */
1157

1158
  $.fn[NAME$2] = Carousel._jQueryInterface;
1159
  $.fn[NAME$2].Constructor = Carousel;
1160

1161
  $.fn[NAME$2].noConflict = function () {
1162
    $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
1163
    return Carousel._jQueryInterface;
1164
  };
1165

1166
  /**
1167
   * ------------------------------------------------------------------------
1168
   * Constants
1169
   * ------------------------------------------------------------------------
1170
   */
1171

1172
  var NAME$3 = 'collapse';
1173
  var VERSION$3 = '4.5.2';
1174
  var DATA_KEY$3 = 'bs.collapse';
1175
  var EVENT_KEY$3 = "." + DATA_KEY$3;
1176
  var DATA_API_KEY$3 = '.data-api';
1177
  var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
1178
  var Default$1 = {
1179
    toggle: true,
1180
    parent: ''
1181
  };
1182
  var DefaultType$1 = {
1183
    toggle: 'boolean',
1184
    parent: '(string|element)'
1185
  };
1186
  var EVENT_SHOW = "show" + EVENT_KEY$3;
1187
  var EVENT_SHOWN = "shown" + EVENT_KEY$3;
1188
  var EVENT_HIDE = "hide" + EVENT_KEY$3;
1189
  var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
1190
  var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
1191
  var CLASS_NAME_SHOW$1 = 'show';
1192
  var CLASS_NAME_COLLAPSE = 'collapse';
1193
  var CLASS_NAME_COLLAPSING = 'collapsing';
1194
  var CLASS_NAME_COLLAPSED = 'collapsed';
1195
  var DIMENSION_WIDTH = 'width';
1196
  var DIMENSION_HEIGHT = 'height';
1197
  var SELECTOR_ACTIVES = '.show, .collapsing';
1198
  var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]';
1199
  /**
1200
   * ------------------------------------------------------------------------
1201
   * Class Definition
1202
   * ------------------------------------------------------------------------
1203
   */
1204

1205
  var Collapse = /*#__PURE__*/function () {
1206
    function Collapse(element, config) {
1207
      this._isTransitioning = false;
1208
      this._element = element;
1209
      this._config = this._getConfig(config);
1210
      this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
1211
      var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$1));
1212

1213
      for (var i = 0, len = toggleList.length; i < len; i++) {
1214
        var elem = toggleList[i];
1215
        var selector = Util.getSelectorFromElement(elem);
1216
        var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
1217
          return foundElem === element;
1218
        });
1219

1220
        if (selector !== null && filterElement.length > 0) {
1221
          this._selector = selector;
1222

1223
          this._triggerArray.push(elem);
1224
        }
1225
      }
1226

1227
      this._parent = this._config.parent ? this._getParent() : null;
1228

1229
      if (!this._config.parent) {
1230
        this._addAriaAndCollapsedClass(this._element, this._triggerArray);
1231
      }
1232

1233
      if (this._config.toggle) {
1234
        this.toggle();
1235
      }
1236
    } // Getters
1237

1238

1239
    var _proto = Collapse.prototype;
1240

1241
    // Public
1242
    _proto.toggle = function toggle() {
1243
      if ($(this._element).hasClass(CLASS_NAME_SHOW$1)) {
1244
        this.hide();
1245
      } else {
1246
        this.show();
1247
      }
1248
    };
1249

1250
    _proto.show = function show() {
1251
      var _this = this;
1252

1253
      if (this._isTransitioning || $(this._element).hasClass(CLASS_NAME_SHOW$1)) {
1254
        return;
1255
      }
1256

1257
      var actives;
1258
      var activesData;
1259

1260
      if (this._parent) {
1261
        actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) {
1262
          if (typeof _this._config.parent === 'string') {
1263
            return elem.getAttribute('data-parent') === _this._config.parent;
1264
          }
1265

1266
          return elem.classList.contains(CLASS_NAME_COLLAPSE);
1267
        });
1268

1269
        if (actives.length === 0) {
1270
          actives = null;
1271
        }
1272
      }
1273

1274
      if (actives) {
1275
        activesData = $(actives).not(this._selector).data(DATA_KEY$3);
1276

1277
        if (activesData && activesData._isTransitioning) {
1278
          return;
1279
        }
1280
      }
1281

1282
      var startEvent = $.Event(EVENT_SHOW);
1283
      $(this._element).trigger(startEvent);
1284

1285
      if (startEvent.isDefaultPrevented()) {
1286
        return;
1287
      }
1288

1289
      if (actives) {
1290
        Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
1291

1292
        if (!activesData) {
1293
          $(actives).data(DATA_KEY$3, null);
1294
        }
1295
      }
1296

1297
      var dimension = this._getDimension();
1298

1299
      $(this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING);
1300
      this._element.style[dimension] = 0;
1301

1302
      if (this._triggerArray.length) {
1303
        $(this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true);
1304
      }
1305

1306
      this.setTransitioning(true);
1307

1308
      var complete = function complete() {
1309
        $(_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
1310
        _this._element.style[dimension] = '';
1311

1312
        _this.setTransitioning(false);
1313

1314
        $(_this._element).trigger(EVENT_SHOWN);
1315
      };
1316

1317
      var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
1318
      var scrollSize = "scroll" + capitalizedDimension;
1319
      var transitionDuration = Util.getTransitionDurationFromElement(this._element);
1320
      $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
1321
      this._element.style[dimension] = this._element[scrollSize] + "px";
1322
    };
1323

1324
    _proto.hide = function hide() {
1325
      var _this2 = this;
1326

1327
      if (this._isTransitioning || !$(this._element).hasClass(CLASS_NAME_SHOW$1)) {
1328
        return;
1329
      }
1330

1331
      var startEvent = $.Event(EVENT_HIDE);
1332
      $(this._element).trigger(startEvent);
1333

1334
      if (startEvent.isDefaultPrevented()) {
1335
        return;
1336
      }
1337

1338
      var dimension = this._getDimension();
1339

1340
      this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
1341
      Util.reflow(this._element);
1342
      $(this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
1343
      var triggerArrayLength = this._triggerArray.length;
1344

1345
      if (triggerArrayLength > 0) {
1346
        for (var i = 0; i < triggerArrayLength; i++) {
1347
          var trigger = this._triggerArray[i];
1348
          var selector = Util.getSelectorFromElement(trigger);
1349

1350
          if (selector !== null) {
1351
            var $elem = $([].slice.call(document.querySelectorAll(selector)));
1352

1353
            if (!$elem.hasClass(CLASS_NAME_SHOW$1)) {
1354
              $(trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false);
1355
            }
1356
          }
1357
        }
1358
      }
1359

1360
      this.setTransitioning(true);
1361

1362
      var complete = function complete() {
1363
        _this2.setTransitioning(false);
1364

1365
        $(_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN);
1366
      };
1367

1368
      this._element.style[dimension] = '';
1369
      var transitionDuration = Util.getTransitionDurationFromElement(this._element);
1370
      $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
1371
    };
1372

1373
    _proto.setTransitioning = function setTransitioning(isTransitioning) {
1374
      this._isTransitioning = isTransitioning;
1375
    };
1376

1377
    _proto.dispose = function dispose() {
1378
      $.removeData(this._element, DATA_KEY$3);
1379
      this._config = null;
1380
      this._parent = null;
1381
      this._element = null;
1382
      this._triggerArray = null;
1383
      this._isTransitioning = null;
1384
    } // Private
1385
    ;
1386

1387
    _proto._getConfig = function _getConfig(config) {
1388
      config = _extends({}, Default$1, config);
1389
      config.toggle = Boolean(config.toggle); // Coerce string values
1390

1391
      Util.typeCheckConfig(NAME$3, config, DefaultType$1);
1392
      return config;
1393
    };
1394

1395
    _proto._getDimension = function _getDimension() {
1396
      var hasWidth = $(this._element).hasClass(DIMENSION_WIDTH);
1397
      return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT;
1398
    };
1399

1400
    _proto._getParent = function _getParent() {
1401
      var _this3 = this;
1402

1403
      var parent;
1404

1405
      if (Util.isElement(this._config.parent)) {
1406
        parent = this._config.parent; // It's a jQuery object
1407

1408
        if (typeof this._config.parent.jquery !== 'undefined') {
1409
          parent = this._config.parent[0];
1410
        }
1411
      } else {
1412
        parent = document.querySelector(this._config.parent);
1413
      }
1414

1415
      var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
1416
      var children = [].slice.call(parent.querySelectorAll(selector));
1417
      $(children).each(function (i, element) {
1418
        _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
1419
      });
1420
      return parent;
1421
    };
1422

1423
    _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
1424
      var isOpen = $(element).hasClass(CLASS_NAME_SHOW$1);
1425

1426
      if (triggerArray.length) {
1427
        $(triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
1428
      }
1429
    } // Static
1430
    ;
1431

1432
    Collapse._getTargetFromElement = function _getTargetFromElement(element) {
1433
      var selector = Util.getSelectorFromElement(element);
1434
      return selector ? document.querySelector(selector) : null;
1435
    };
1436

1437
    Collapse._jQueryInterface = function _jQueryInterface(config) {
1438
      return this.each(function () {
1439
        var $this = $(this);
1440
        var data = $this.data(DATA_KEY$3);
1441

1442
        var _config = _extends({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {});
1443

1444
        if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
1445
          _config.toggle = false;
1446
        }
1447

1448
        if (!data) {
1449
          data = new Collapse(this, _config);
1450
          $this.data(DATA_KEY$3, data);
1451
        }
1452

1453
        if (typeof config === 'string') {
1454
          if (typeof data[config] === 'undefined') {
1455
            throw new TypeError("No method named \"" + config + "\"");
1456
          }
1457

1458
          data[config]();
1459
        }
1460
      });
1461
    };
1462

1463
    _createClass(Collapse, null, [{
1464
      key: "VERSION",
1465
      get: function get() {
1466
        return VERSION$3;
1467
      }
1468
    }, {
1469
      key: "Default",
1470
      get: function get() {
1471
        return Default$1;
1472
      }
1473
    }]);
1474

1475
    return Collapse;
1476
  }();
1477
  /**
1478
   * ------------------------------------------------------------------------
1479
   * Data Api implementation
1480
   * ------------------------------------------------------------------------
1481
   */
1482

1483

1484
  $(document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
1485
    // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
1486
    if (event.currentTarget.tagName === 'A') {
1487
      event.preventDefault();
1488
    }
1489

1490
    var $trigger = $(this);
1491
    var selector = Util.getSelectorFromElement(this);
1492
    var selectors = [].slice.call(document.querySelectorAll(selector));
1493
    $(selectors).each(function () {
1494
      var $target = $(this);
1495
      var data = $target.data(DATA_KEY$3);
1496
      var config = data ? 'toggle' : $trigger.data();
1497

1498
      Collapse._jQueryInterface.call($target, config);
1499
    });
1500
  });
1501
  /**
1502
   * ------------------------------------------------------------------------
1503
   * jQuery
1504
   * ------------------------------------------------------------------------
1505
   */
1506

1507
  $.fn[NAME$3] = Collapse._jQueryInterface;
1508
  $.fn[NAME$3].Constructor = Collapse;
1509

1510
  $.fn[NAME$3].noConflict = function () {
1511
    $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
1512
    return Collapse._jQueryInterface;
1513
  };
1514

1515
  /**!
1516
   * @fileOverview Kickass library to create and place poppers near their reference elements.
1517
   * @version 1.16.1
1518
   * @license
1519
   * Copyright (c) 2016 Federico Zivolo and contributors
1520
   *
1521
   * Permission is hereby granted, free of charge, to any person obtaining a copy
1522
   * of this software and associated documentation files (the "Software"), to deal
1523
   * in the Software without restriction, including without limitation the rights
1524
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1525
   * copies of the Software, and to permit persons to whom the Software is
1526
   * furnished to do so, subject to the following conditions:
1527
   *
1528
   * The above copyright notice and this permission notice shall be included in all
1529
   * copies or substantial portions of the Software.
1530
   *
1531
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1532
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1533
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1534
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1535
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1536
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1537
   * SOFTWARE.
1538
   */
1539
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
1540

1541
  var timeoutDuration = function () {
1542
    var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
1543
    for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
1544
      if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
1545
        return 1;
1546
      }
1547
    }
1548
    return 0;
1549
  }();
1550

1551
  function microtaskDebounce(fn) {
1552
    var called = false;
1553
    return function () {
1554
      if (called) {
1555
        return;
1556
      }
1557
      called = true;
1558
      window.Promise.resolve().then(function () {
1559
        called = false;
1560
        fn();
1561
      });
1562
    };
1563
  }
1564

1565
  function taskDebounce(fn) {
1566
    var scheduled = false;
1567
    return function () {
1568
      if (!scheduled) {
1569
        scheduled = true;
1570
        setTimeout(function () {
1571
          scheduled = false;
1572
          fn();
1573
        }, timeoutDuration);
1574
      }
1575
    };
1576
  }
1577

1578
  var supportsMicroTasks = isBrowser && window.Promise;
1579

1580
  /**
1581
  * Create a debounced version of a method, that's asynchronously deferred
1582
  * but called in the minimum time possible.
1583
  *
1584
  * @method
1585
  * @memberof Popper.Utils
1586
  * @argument {Function} fn
1587
  * @returns {Function}
1588
  */
1589
  var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
1590

1591
  /**
1592
   * Check if the given variable is a function
1593
   * @method
1594
   * @memberof Popper.Utils
1595
   * @argument {Any} functionToCheck - variable to check
1596
   * @returns {Boolean} answer to: is a function?
1597
   */
1598
  function isFunction(functionToCheck) {
1599
    var getType = {};
1600
    return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
1601
  }
1602

1603
  /**
1604
   * Get CSS computed property of the given element
1605
   * @method
1606
   * @memberof Popper.Utils
1607
   * @argument {Eement} element
1608
   * @argument {String} property
1609
   */
1610
  function getStyleComputedProperty(element, property) {
1611
    if (element.nodeType !== 1) {
1612
      return [];
1613
    }
1614
    // NOTE: 1 DOM access here
1615
    var window = element.ownerDocument.defaultView;
1616
    var css = window.getComputedStyle(element, null);
1617
    return property ? css[property] : css;
1618
  }
1619

1620
  /**
1621
   * Returns the parentNode or the host of the element
1622
   * @method
1623
   * @memberof Popper.Utils
1624
   * @argument {Element} element
1625
   * @returns {Element} parent
1626
   */
1627
  function getParentNode(element) {
1628
    if (element.nodeName === 'HTML') {
1629
      return element;
1630
    }
1631
    return element.parentNode || element.host;
1632
  }
1633

1634
  /**
1635
   * Returns the scrolling parent of the given element
1636
   * @method
1637
   * @memberof Popper.Utils
1638
   * @argument {Element} element
1639
   * @returns {Element} scroll parent
1640
   */
1641
  function getScrollParent(element) {
1642
    // Return body, `getScroll` will take care to get the correct `scrollTop` from it
1643
    if (!element) {
1644
      return document.body;
1645
    }
1646

1647
    switch (element.nodeName) {
1648
      case 'HTML':
1649
      case 'BODY':
1650
        return element.ownerDocument.body;
1651
      case '#document':
1652
        return element.body;
1653
    }
1654

1655
    // Firefox want us to check `-x` and `-y` variations as well
1656

1657
    var _getStyleComputedProp = getStyleComputedProperty(element),
1658
        overflow = _getStyleComputedProp.overflow,
1659
        overflowX = _getStyleComputedProp.overflowX,
1660
        overflowY = _getStyleComputedProp.overflowY;
1661

1662
    if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
1663
      return element;
1664
    }
1665

1666
    return getScrollParent(getParentNode(element));
1667
  }
1668

1669
  /**
1670
   * Returns the reference node of the reference object, or the reference object itself.
1671
   * @method
1672
   * @memberof Popper.Utils
1673
   * @param {Element|Object} reference - the reference element (the popper will be relative to this)
1674
   * @returns {Element} parent
1675
   */
1676
  function getReferenceNode(reference) {
1677
    return reference && reference.referenceNode ? reference.referenceNode : reference;
1678
  }
1679

1680
  var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
1681
  var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
1682

1683
  /**
1684
   * Determines if the browser is Internet Explorer
1685
   * @method
1686
   * @memberof Popper.Utils
1687
   * @param {Number} version to check
1688
   * @returns {Boolean} isIE
1689
   */
1690
  function isIE(version) {
1691
    if (version === 11) {
1692
      return isIE11;
1693
    }
1694
    if (version === 10) {
1695
      return isIE10;
1696
    }
1697
    return isIE11 || isIE10;
1698
  }
1699

1700
  /**
1701
   * Returns the offset parent of the given element
1702
   * @method
1703
   * @memberof Popper.Utils
1704
   * @argument {Element} element
1705
   * @returns {Element} offset parent
1706
   */
1707
  function getOffsetParent(element) {
1708
    if (!element) {
1709
      return document.documentElement;
1710
    }
1711

1712
    var noOffsetParent = isIE(10) ? document.body : null;
1713

1714
    // NOTE: 1 DOM access here
1715
    var offsetParent = element.offsetParent || null;
1716
    // Skip hidden elements which don't have an offsetParent
1717
    while (offsetParent === noOffsetParent && element.nextElementSibling) {
1718
      offsetParent = (element = element.nextElementSibling).offsetParent;
1719
    }
1720

1721
    var nodeName = offsetParent && offsetParent.nodeName;
1722

1723
    if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
1724
      return element ? element.ownerDocument.documentElement : document.documentElement;
1725
    }
1726

1727
    // .offsetParent will return the closest TH, TD or TABLE in case
1728
    // no offsetParent is present, I hate this job...
1729
    if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
1730
      return getOffsetParent(offsetParent);
1731
    }
1732

1733
    return offsetParent;
1734
  }
1735

1736
  function isOffsetContainer(element) {
1737
    var nodeName = element.nodeName;
1738

1739
    if (nodeName === 'BODY') {
1740
      return false;
1741
    }
1742
    return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
1743
  }
1744

1745
  /**
1746
   * Finds the root node (document, shadowDOM root) of the given element
1747
   * @method
1748
   * @memberof Popper.Utils
1749
   * @argument {Element} node
1750
   * @returns {Element} root node
1751
   */
1752
  function getRoot(node) {
1753
    if (node.parentNode !== null) {
1754
      return getRoot(node.parentNode);
1755
    }
1756

1757
    return node;
1758
  }
1759

1760
  /**
1761
   * Finds the offset parent common to the two provided nodes
1762
   * @method
1763
   * @memberof Popper.Utils
1764
   * @argument {Element} element1
1765
   * @argument {Element} element2
1766
   * @returns {Element} common offset parent
1767
   */
1768
  function findCommonOffsetParent(element1, element2) {
1769
    // This check is needed to avoid errors in case one of the elements isn't defined for any reason
1770
    if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
1771
      return document.documentElement;
1772
    }
1773

1774
    // Here we make sure to give as "start" the element that comes first in the DOM
1775
    var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
1776
    var start = order ? element1 : element2;
1777
    var end = order ? element2 : element1;
1778

1779
    // Get common ancestor container
1780
    var range = document.createRange();
1781
    range.setStart(start, 0);
1782
    range.setEnd(end, 0);
1783
    var commonAncestorContainer = range.commonAncestorContainer;
1784

1785
    // Both nodes are inside #document
1786

1787
    if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
1788
      if (isOffsetContainer(commonAncestorContainer)) {
1789
        return commonAncestorContainer;
1790
      }
1791

1792
      return getOffsetParent(commonAncestorContainer);
1793
    }
1794

1795
    // one of the nodes is inside shadowDOM, find which one
1796
    var element1root = getRoot(element1);
1797
    if (element1root.host) {
1798
      return findCommonOffsetParent(element1root.host, element2);
1799
    } else {
1800
      return findCommonOffsetParent(element1, getRoot(element2).host);
1801
    }
1802
  }
1803

1804
  /**
1805
   * Gets the scroll value of the given element in the given side (top and left)
1806
   * @method
1807
   * @memberof Popper.Utils
1808
   * @argument {Element} element
1809
   * @argument {String} side `top` or `left`
1810
   * @returns {number} amount of scrolled pixels
1811
   */
1812
  function getScroll(element) {
1813
    var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
1814

1815
    var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
1816
    var nodeName = element.nodeName;
1817

1818
    if (nodeName === 'BODY' || nodeName === 'HTML') {
1819
      var html = element.ownerDocument.documentElement;
1820
      var scrollingElement = element.ownerDocument.scrollingElement || html;
1821
      return scrollingElement[upperSide];
1822
    }
1823

1824
    return element[upperSide];
1825
  }
1826

1827
  /*
1828
   * Sum or subtract the element scroll values (left and top) from a given rect object
1829
   * @method
1830
   * @memberof Popper.Utils
1831
   * @param {Object} rect - Rect object you want to change
1832
   * @param {HTMLElement} element - The element from the function reads the scroll values
1833
   * @param {Boolean} subtract - set to true if you want to subtract the scroll values
1834
   * @return {Object} rect - The modifier rect object
1835
   */
1836
  function includeScroll(rect, element) {
1837
    var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1838

1839
    var scrollTop = getScroll(element, 'top');
1840
    var scrollLeft = getScroll(element, 'left');
1841
    var modifier = subtract ? -1 : 1;
1842
    rect.top += scrollTop * modifier;
1843
    rect.bottom += scrollTop * modifier;
1844
    rect.left += scrollLeft * modifier;
1845
    rect.right += scrollLeft * modifier;
1846
    return rect;
1847
  }
1848

1849
  /*
1850
   * Helper to detect borders of a given element
1851
   * @method
1852
   * @memberof Popper.Utils
1853
   * @param {CSSStyleDeclaration} styles
1854
   * Result of `getStyleComputedProperty` on the given element
1855
   * @param {String} axis - `x` or `y`
1856
   * @return {number} borders - The borders size of the given axis
1857
   */
1858

1859
  function getBordersSize(styles, axis) {
1860
    var sideA = axis === 'x' ? 'Left' : 'Top';
1861
    var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
1862

1863
    return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
1864
  }
1865

1866
  function getSize(axis, body, html, computedStyle) {
1867
    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);
1868
  }
1869

1870
  function getWindowSizes(document) {
1871
    var body = document.body;
1872
    var html = document.documentElement;
1873
    var computedStyle = isIE(10) && getComputedStyle(html);
1874

1875
    return {
1876
      height: getSize('Height', body, html, computedStyle),
1877
      width: getSize('Width', body, html, computedStyle)
1878
    };
1879
  }
1880

1881
  var classCallCheck = function (instance, Constructor) {
1882
    if (!(instance instanceof Constructor)) {
1883
      throw new TypeError("Cannot call a class as a function");
1884
    }
1885
  };
1886

1887
  var createClass = function () {
1888
    function defineProperties(target, props) {
1889
      for (var i = 0; i < props.length; i++) {
1890
        var descriptor = props[i];
1891
        descriptor.enumerable = descriptor.enumerable || false;
1892
        descriptor.configurable = true;
1893
        if ("value" in descriptor) descriptor.writable = true;
1894
        Object.defineProperty(target, descriptor.key, descriptor);
1895
      }
1896
    }
1897

1898
    return function (Constructor, protoProps, staticProps) {
1899
      if (protoProps) defineProperties(Constructor.prototype, protoProps);
1900
      if (staticProps) defineProperties(Constructor, staticProps);
1901
      return Constructor;
1902
    };
1903
  }();
1904

1905

1906

1907

1908

1909
  var defineProperty = function (obj, key, value) {
1910
    if (key in obj) {
1911
      Object.defineProperty(obj, key, {
1912
        value: value,
1913
        enumerable: true,
1914
        configurable: true,
1915
        writable: true
1916
      });
1917
    } else {
1918
      obj[key] = value;
1919
    }
1920

1921
    return obj;
1922
  };
1923

1924
  var _extends$1 = Object.assign || function (target) {
1925
    for (var i = 1; i < arguments.length; i++) {
1926
      var source = arguments[i];
1927

1928
      for (var key in source) {
1929
        if (Object.prototype.hasOwnProperty.call(source, key)) {
1930
          target[key] = source[key];
1931
        }
1932
      }
1933
    }
1934

1935
    return target;
1936
  };
1937

1938
  /**
1939
   * Given element offsets, generate an output similar to getBoundingClientRect
1940
   * @method
1941
   * @memberof Popper.Utils
1942
   * @argument {Object} offsets
1943
   * @returns {Object} ClientRect like output
1944
   */
1945
  function getClientRect(offsets) {
1946
    return _extends$1({}, offsets, {
1947
      right: offsets.left + offsets.width,
1948
      bottom: offsets.top + offsets.height
1949
    });
1950
  }
1951

1952
  /**
1953
   * Get bounding client rect of given element
1954
   * @method
1955
   * @memberof Popper.Utils
1956
   * @param {HTMLElement} element
1957
   * @return {Object} client rect
1958
   */
1959
  function getBoundingClientRect(element) {
1960
    var rect = {};
1961

1962
    // IE10 10 FIX: Please, don't ask, the element isn't
1963
    // considered in DOM in some circumstances...
1964
    // This isn't reproducible in IE10 compatibility mode of IE11
1965
    try {
1966
      if (isIE(10)) {
1967
        rect = element.getBoundingClientRect();
1968
        var scrollTop = getScroll(element, 'top');
1969
        var scrollLeft = getScroll(element, 'left');
1970
        rect.top += scrollTop;
1971
        rect.left += scrollLeft;
1972
        rect.bottom += scrollTop;
1973
        rect.right += scrollLeft;
1974
      } else {
1975
        rect = element.getBoundingClientRect();
1976
      }
1977
    } catch (e) {}
1978

1979
    var result = {
1980
      left: rect.left,
1981
      top: rect.top,
1982
      width: rect.right - rect.left,
1983
      height: rect.bottom - rect.top
1984
    };
1985

1986
    // subtract scrollbar size from sizes
1987
    var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
1988
    var width = sizes.width || element.clientWidth || result.width;
1989
    var height = sizes.height || element.clientHeight || result.height;
1990

1991
    var horizScrollbar = element.offsetWidth - width;
1992
    var vertScrollbar = element.offsetHeight - height;
1993

1994
    // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
1995
    // we make this check conditional for performance reasons
1996
    if (horizScrollbar || vertScrollbar) {
1997
      var styles = getStyleComputedProperty(element);
1998
      horizScrollbar -= getBordersSize(styles, 'x');
1999
      vertScrollbar -= getBordersSize(styles, 'y');
2000

2001
      result.width -= horizScrollbar;
2002
      result.height -= vertScrollbar;
2003
    }
2004

2005
    return getClientRect(result);
2006
  }
2007

2008
  function getOffsetRectRelativeToArbitraryNode(children, parent) {
2009
    var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2010

2011
    var isIE10 = isIE(10);
2012
    var isHTML = parent.nodeName === 'HTML';
2013
    var childrenRect = getBoundingClientRect(children);
2014
    var parentRect = getBoundingClientRect(parent);
2015
    var scrollParent = getScrollParent(children);
2016

2017
    var styles = getStyleComputedProperty(parent);
2018
    var borderTopWidth = parseFloat(styles.borderTopWidth);
2019
    var borderLeftWidth = parseFloat(styles.borderLeftWidth);
2020

2021
    // In cases where the parent is fixed, we must ignore negative scroll in offset calc
2022
    if (fixedPosition && isHTML) {
2023
      parentRect.top = Math.max(parentRect.top, 0);
2024
      parentRect.left = Math.max(parentRect.left, 0);
2025
    }
2026
    var offsets = getClientRect({
2027
      top: childrenRect.top - parentRect.top - borderTopWidth,
2028
      left: childrenRect.left - parentRect.left - borderLeftWidth,
2029
      width: childrenRect.width,
2030
      height: childrenRect.height
2031
    });
2032
    offsets.marginTop = 0;
2033
    offsets.marginLeft = 0;
2034

2035
    // Subtract margins of documentElement in case it's being used as parent
2036
    // we do this only on HTML because it's the only element that behaves
2037
    // differently when margins are applied to it. The margins are included in
2038
    // the box of the documentElement, in the other cases not.
2039
    if (!isIE10 && isHTML) {
2040
      var marginTop = parseFloat(styles.marginTop);
2041
      var marginLeft = parseFloat(styles.marginLeft);
2042

2043
      offsets.top -= borderTopWidth - marginTop;
2044
      offsets.bottom -= borderTopWidth - marginTop;
2045
      offsets.left -= borderLeftWidth - marginLeft;
2046
      offsets.right -= borderLeftWidth - marginLeft;
2047

2048
      // Attach marginTop and marginLeft because in some circumstances we may need them
2049
      offsets.marginTop = marginTop;
2050
      offsets.marginLeft = marginLeft;
2051
    }
2052

2053
    if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
2054
      offsets = includeScroll(offsets, parent);
2055
    }
2056

2057
    return offsets;
2058
  }
2059

2060
  function getViewportOffsetRectRelativeToArtbitraryNode(element) {
2061
    var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2062

2063
    var html = element.ownerDocument.documentElement;
2064
    var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
2065
    var width = Math.max(html.clientWidth, window.innerWidth || 0);
2066
    var height = Math.max(html.clientHeight, window.innerHeight || 0);
2067

2068
    var scrollTop = !excludeScroll ? getScroll(html) : 0;
2069
    var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
2070

2071
    var offset = {
2072
      top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
2073
      left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
2074
      width: width,
2075
      height: height
2076
    };
2077

2078
    return getClientRect(offset);
2079
  }
2080

2081
  /**
2082
   * Check if the given element is fixed or is inside a fixed parent
2083
   * @method
2084
   * @memberof Popper.Utils
2085
   * @argument {Element} element
2086
   * @argument {Element} customContainer
2087
   * @returns {Boolean} answer to "isFixed?"
2088
   */
2089
  function isFixed(element) {
2090
    var nodeName = element.nodeName;
2091
    if (nodeName === 'BODY' || nodeName === 'HTML') {
2092
      return false;
2093
    }
2094
    if (getStyleComputedProperty(element, 'position') === 'fixed') {
2095
      return true;
2096
    }
2097
    var parentNode = getParentNode(element);
2098
    if (!parentNode) {
2099
      return false;
2100
    }
2101
    return isFixed(parentNode);
2102
  }
2103

2104
  /**
2105
   * Finds the first parent of an element that has a transformed property defined
2106
   * @method
2107
   * @memberof Popper.Utils
2108
   * @argument {Element} element
2109
   * @returns {Element} first transformed parent or documentElement
2110
   */
2111

2112
  function getFixedPositionOffsetParent(element) {
2113
    // This check is needed to avoid errors in case one of the elements isn't defined for any reason
2114
    if (!element || !element.parentElement || isIE()) {
2115
      return document.documentElement;
2116
    }
2117
    var el = element.parentElement;
2118
    while (el && getStyleComputedProperty(el, 'transform') === 'none') {
2119
      el = el.parentElement;
2120
    }
2121
    return el || document.documentElement;
2122
  }
2123

2124
  /**
2125
   * Computed the boundaries limits and return them
2126
   * @method
2127
   * @memberof Popper.Utils
2128
   * @param {HTMLElement} popper
2129
   * @param {HTMLElement} reference
2130
   * @param {number} padding
2131
   * @param {HTMLElement} boundariesElement - Element used to define the boundaries
2132
   * @param {Boolean} fixedPosition - Is in fixed position mode
2133
   * @returns {Object} Coordinates of the boundaries
2134
   */
2135
  function getBoundaries(popper, reference, padding, boundariesElement) {
2136
    var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
2137

2138
    // NOTE: 1 DOM access here
2139

2140
    var boundaries = { top: 0, left: 0 };
2141
    var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
2142

2143
    // Handle viewport case
2144
    if (boundariesElement === 'viewport') {
2145
      boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
2146
    } else {
2147
      // Handle other cases based on DOM element used as boundaries
2148
      var boundariesNode = void 0;
2149
      if (boundariesElement === 'scrollParent') {
2150
        boundariesNode = getScrollParent(getParentNode(reference));
2151
        if (boundariesNode.nodeName === 'BODY') {
2152
          boundariesNode = popper.ownerDocument.documentElement;
2153
        }
2154
      } else if (boundariesElement === 'window') {
2155
        boundariesNode = popper.ownerDocument.documentElement;
2156
      } else {
2157
        boundariesNode = boundariesElement;
2158
      }
2159

2160
      var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
2161

2162
      // In case of HTML, we need a different computation
2163
      if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
2164
        var _getWindowSizes = getWindowSizes(popper.ownerDocument),
2165
            height = _getWindowSizes.height,
2166
            width = _getWindowSizes.width;
2167

2168
        boundaries.top += offsets.top - offsets.marginTop;
2169
        boundaries.bottom = height + offsets.top;
2170
        boundaries.left += offsets.left - offsets.marginLeft;
2171
        boundaries.right = width + offsets.left;
2172
      } else {
2173
        // for all the other DOM elements, this one is good
2174
        boundaries = offsets;
2175
      }
2176
    }
2177

2178
    // Add paddings
2179
    padding = padding || 0;
2180
    var isPaddingNumber = typeof padding === 'number';
2181
    boundaries.left += isPaddingNumber ? padding : padding.left || 0;
2182
    boundaries.top += isPaddingNumber ? padding : padding.top || 0;
2183
    boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
2184
    boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
2185

2186
    return boundaries;
2187
  }
2188

2189
  function getArea(_ref) {
2190
    var width = _ref.width,
2191
        height = _ref.height;
2192

2193
    return width * height;
2194
  }
2195

2196
  /**
2197
   * Utility used to transform the `auto` placement to the placement with more
2198
   * available space.
2199
   * @method
2200
   * @memberof Popper.Utils
2201
   * @argument {Object} data - The data object generated by update method
2202
   * @argument {Object} options - Modifiers configuration and options
2203
   * @returns {Object} The data object, properly modified
2204
   */
2205
  function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
2206
    var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
2207

2208
    if (placement.indexOf('auto') === -1) {
2209
      return placement;
2210
    }
2211

2212
    var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
2213

2214
    var rects = {
2215
      top: {
2216
        width: boundaries.width,
2217
        height: refRect.top - boundaries.top
2218
      },
2219
      right: {
2220
        width: boundaries.right - refRect.right,
2221
        height: boundaries.height
2222
      },
2223
      bottom: {
2224
        width: boundaries.width,
2225
        height: boundaries.bottom - refRect.bottom
2226
      },
2227
      left: {
2228
        width: refRect.left - boundaries.left,
2229
        height: boundaries.height
2230
      }
2231
    };
2232

2233
    var sortedAreas = Object.keys(rects).map(function (key) {
2234
      return _extends$1({
2235
        key: key
2236
      }, rects[key], {
2237
        area: getArea(rects[key])
2238
      });
2239
    }).sort(function (a, b) {
2240
      return b.area - a.area;
2241
    });
2242

2243
    var filteredAreas = sortedAreas.filter(function (_ref2) {
2244
      var width = _ref2.width,
2245
          height = _ref2.height;
2246
      return width >= popper.clientWidth && height >= popper.clientHeight;
2247
    });
2248

2249
    var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
2250

2251
    var variation = placement.split('-')[1];
2252

2253
    return computedPlacement + (variation ? '-' + variation : '');
2254
  }
2255

2256
  /**
2257
   * Get offsets to the reference element
2258
   * @method
2259
   * @memberof Popper.Utils
2260
   * @param {Object} state
2261
   * @param {Element} popper - the popper element
2262
   * @param {Element} reference - the reference element (the popper will be relative to this)
2263
   * @param {Element} fixedPosition - is in fixed position mode
2264
   * @returns {Object} An object containing the offsets which will be applied to the popper
2265
   */
2266
  function getReferenceOffsets(state, popper, reference) {
2267
    var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
2268

2269
    var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
2270
    return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
2271
  }
2272

2273
  /**
2274
   * Get the outer sizes of the given element (offset size + margins)
2275
   * @method
2276
   * @memberof Popper.Utils
2277
   * @argument {Element} element
2278
   * @returns {Object} object containing width and height properties
2279
   */
2280
  function getOuterSizes(element) {
2281
    var window = element.ownerDocument.defaultView;
2282
    var styles = window.getComputedStyle(element);
2283
    var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
2284
    var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
2285
    var result = {
2286
      width: element.offsetWidth + y,
2287
      height: element.offsetHeight + x
2288
    };
2289
    return result;
2290
  }
2291

2292
  /**
2293
   * Get the opposite placement of the given one
2294
   * @method
2295
   * @memberof Popper.Utils
2296
   * @argument {String} placement
2297
   * @returns {String} flipped placement
2298
   */
2299
  function getOppositePlacement(placement) {
2300
    var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
2301
    return placement.replace(/left|right|bottom|top/g, function (matched) {
2302
      return hash[matched];
2303
    });
2304
  }
2305

2306
  /**
2307
   * Get offsets to the popper
2308
   * @method
2309
   * @memberof Popper.Utils
2310
   * @param {Object} position - CSS position the Popper will get applied
2311
   * @param {HTMLElement} popper - the popper element
2312
   * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
2313
   * @param {String} placement - one of the valid placement options
2314
   * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
2315
   */
2316
  function getPopperOffsets(popper, referenceOffsets, placement) {
2317
    placement = placement.split('-')[0];
2318

2319
    // Get popper node sizes
2320
    var popperRect = getOuterSizes(popper);
2321

2322
    // Add position, width and height to our offsets object
2323
    var popperOffsets = {
2324
      width: popperRect.width,
2325
      height: popperRect.height
2326
    };
2327

2328
    // depending by the popper placement we have to compute its offsets slightly differently
2329
    var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
2330
    var mainSide = isHoriz ? 'top' : 'left';
2331
    var secondarySide = isHoriz ? 'left' : 'top';
2332
    var measurement = isHoriz ? 'height' : 'width';
2333
    var secondaryMeasurement = !isHoriz ? 'height' : 'width';
2334

2335
    popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
2336
    if (placement === secondarySide) {
2337
      popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
2338
    } else {
2339
      popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
2340
    }
2341

2342
    return popperOffsets;
2343
  }
2344

2345
  /**
2346
   * Mimics the `find` method of Array
2347
   * @method
2348
   * @memberof Popper.Utils
2349
   * @argument {Array} arr
2350
   * @argument prop
2351
   * @argument value
2352
   * @returns index or -1
2353
   */
2354
  function find(arr, check) {
2355
    // use native find if supported
2356
    if (Array.prototype.find) {
2357
      return arr.find(check);
2358
    }
2359

2360
    // use `filter` to obtain the same behavior of `find`
2361
    return arr.filter(check)[0];
2362
  }
2363

2364
  /**
2365
   * Return the index of the matching object
2366
   * @method
2367
   * @memberof Popper.Utils
2368
   * @argument {Array} arr
2369
   * @argument prop
2370
   * @argument value
2371
   * @returns index or -1
2372
   */
2373
  function findIndex(arr, prop, value) {
2374
    // use native findIndex if supported
2375
    if (Array.prototype.findIndex) {
2376
      return arr.findIndex(function (cur) {
2377
        return cur[prop] === value;
2378
      });
2379
    }
2380

2381
    // use `find` + `indexOf` if `findIndex` isn't supported
2382
    var match = find(arr, function (obj) {
2383
      return obj[prop] === value;
2384
    });
2385
    return arr.indexOf(match);
2386
  }
2387

2388
  /**
2389
   * Loop trough the list of modifiers and run them in order,
2390
   * each of them will then edit the data object.
2391
   * @method
2392
   * @memberof Popper.Utils
2393
   * @param {dataObject} data
2394
   * @param {Array} modifiers
2395
   * @param {String} ends - Optional modifier name used as stopper
2396
   * @returns {dataObject}
2397
   */
2398
  function runModifiers(modifiers, data, ends) {
2399
    var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
2400

2401
    modifiersToRun.forEach(function (modifier) {
2402
      if (modifier['function']) {
2403
        // eslint-disable-line dot-notation
2404
        console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
2405
      }
2406
      var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
2407
      if (modifier.enabled && isFunction(fn)) {
2408
        // Add properties to offsets to make them a complete clientRect object
2409
        // we do this before each modifier to make sure the previous one doesn't
2410
        // mess with these values
2411
        data.offsets.popper = getClientRect(data.offsets.popper);
2412
        data.offsets.reference = getClientRect(data.offsets.reference);
2413

2414
        data = fn(data, modifier);
2415
      }
2416
    });
2417

2418
    return data;
2419
  }
2420

2421
  /**
2422
   * Updates the position of the popper, computing the new offsets and applying
2423
   * the new style.<br />
2424
   * Prefer `scheduleUpdate` over `update` because of performance reasons.
2425
   * @method
2426
   * @memberof Popper
2427
   */
2428
  function update() {
2429
    // if popper is destroyed, don't perform any further update
2430
    if (this.state.isDestroyed) {
2431
      return;
2432
    }
2433

2434
    var data = {
2435
      instance: this,
2436
      styles: {},
2437
      arrowStyles: {},
2438
      attributes: {},
2439
      flipped: false,
2440
      offsets: {}
2441
    };
2442

2443
    // compute reference element offsets
2444
    data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
2445

2446
    // compute auto placement, store placement inside the data object,
2447
    // modifiers will be able to edit `placement` if needed
2448
    // and refer to originalPlacement to know the original value
2449
    data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
2450

2451
    // store the computed placement inside `originalPlacement`
2452
    data.originalPlacement = data.placement;
2453

2454
    data.positionFixed = this.options.positionFixed;
2455

2456
    // compute the popper offsets
2457
    data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
2458

2459
    data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
2460

2461
    // run the modifiers
2462
    data = runModifiers(this.modifiers, data);
2463

2464
    // the first `update` will call `onCreate` callback
2465
    // the other ones will call `onUpdate` callback
2466
    if (!this.state.isCreated) {
2467
      this.state.isCreated = true;
2468
      this.options.onCreate(data);
2469
    } else {
2470
      this.options.onUpdate(data);
2471
    }
2472
  }
2473

2474
  /**
2475
   * Helper used to know if the given modifier is enabled.
2476
   * @method
2477
   * @memberof Popper.Utils
2478
   * @returns {Boolean}
2479
   */
2480
  function isModifierEnabled(modifiers, modifierName) {
2481
    return modifiers.some(function (_ref) {
2482
      var name = _ref.name,
2483
          enabled = _ref.enabled;
2484
      return enabled && name === modifierName;
2485
    });
2486
  }
2487

2488
  /**
2489
   * Get the prefixed supported property name
2490
   * @method
2491
   * @memberof Popper.Utils
2492
   * @argument {String} property (camelCase)
2493
   * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
2494
   */
2495
  function getSupportedPropertyName(property) {
2496
    var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
2497
    var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
2498

2499
    for (var i = 0; i < prefixes.length; i++) {
2500
      var prefix = prefixes[i];
2501
      var toCheck = prefix ? '' + prefix + upperProp : property;
2502
      if (typeof document.body.style[toCheck] !== 'undefined') {
2503
        return toCheck;
2504
      }
2505
    }
2506
    return null;
2507
  }
2508

2509
  /**
2510
   * Destroys the popper.
2511
   * @method
2512
   * @memberof Popper
2513
   */
2514
  function destroy() {
2515
    this.state.isDestroyed = true;
2516

2517
    // touch DOM only if `applyStyle` modifier is enabled
2518
    if (isModifierEnabled(this.modifiers, 'applyStyle')) {
2519
      this.popper.removeAttribute('x-placement');
2520
      this.popper.style.position = '';
2521
      this.popper.style.top = '';
2522
      this.popper.style.left = '';
2523
      this.popper.style.right = '';
2524
      this.popper.style.bottom = '';
2525
      this.popper.style.willChange = '';
2526
      this.popper.style[getSupportedPropertyName('transform')] = '';
2527
    }
2528

2529
    this.disableEventListeners();
2530

2531
    // remove the popper if user explicitly asked for the deletion on destroy
2532
    // do not use `remove` because IE11 doesn't support it
2533
    if (this.options.removeOnDestroy) {
2534
      this.popper.parentNode.removeChild(this.popper);
2535
    }
2536
    return this;
2537
  }
2538

2539
  /**
2540
   * Get the window associated with the element
2541
   * @argument {Element} element
2542
   * @returns {Window}
2543
   */
2544
  function getWindow(element) {
2545
    var ownerDocument = element.ownerDocument;
2546
    return ownerDocument ? ownerDocument.defaultView : window;
2547
  }
2548

2549
  function attachToScrollParents(scrollParent, event, callback, scrollParents) {
2550
    var isBody = scrollParent.nodeName === 'BODY';
2551
    var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
2552
    target.addEventListener(event, callback, { passive: true });
2553

2554
    if (!isBody) {
2555
      attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
2556
    }
2557
    scrollParents.push(target);
2558
  }
2559

2560
  /**
2561
   * Setup needed event listeners used to update the popper position
2562
   * @method
2563
   * @memberof Popper.Utils
2564
   * @private
2565
   */
2566
  function setupEventListeners(reference, options, state, updateBound) {
2567
    // Resize event listener on window
2568
    state.updateBound = updateBound;
2569
    getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
2570

2571
    // Scroll event listener on scroll parents
2572
    var scrollElement = getScrollParent(reference);
2573
    attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
2574
    state.scrollElement = scrollElement;
2575
    state.eventsEnabled = true;
2576

2577
    return state;
2578
  }
2579

2580
  /**
2581
   * It will add resize/scroll events and start recalculating
2582
   * position of the popper element when they are triggered.
2583
   * @method
2584
   * @memberof Popper
2585
   */
2586
  function enableEventListeners() {
2587
    if (!this.state.eventsEnabled) {
2588
      this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
2589
    }
2590
  }
2591

2592
  /**
2593
   * Remove event listeners used to update the popper position
2594
   * @method
2595
   * @memberof Popper.Utils
2596
   * @private
2597
   */
2598
  function removeEventListeners(reference, state) {
2599
    // Remove resize event listener on window
2600
    getWindow(reference).removeEventListener('resize', state.updateBound);
2601

2602
    // Remove scroll event listener on scroll parents
2603
    state.scrollParents.forEach(function (target) {
2604
      target.removeEventListener('scroll', state.updateBound);
2605
    });
2606

2607
    // Reset state
2608
    state.updateBound = null;
2609
    state.scrollParents = [];
2610
    state.scrollElement = null;
2611
    state.eventsEnabled = false;
2612
    return state;
2613
  }
2614

2615
  /**
2616
   * It will remove resize/scroll events and won't recalculate popper position
2617
   * when they are triggered. It also won't trigger `onUpdate` callback anymore,
2618
   * unless you call `update` method manually.
2619
   * @method
2620
   * @memberof Popper
2621
   */
2622
  function disableEventListeners() {
2623
    if (this.state.eventsEnabled) {
2624
      cancelAnimationFrame(this.scheduleUpdate);
2625
      this.state = removeEventListeners(this.reference, this.state);
2626
    }
2627
  }
2628

2629
  /**
2630
   * Tells if a given input is a number
2631
   * @method
2632
   * @memberof Popper.Utils
2633
   * @param {*} input to check
2634
   * @return {Boolean}
2635
   */
2636
  function isNumeric(n) {
2637
    return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
2638
  }
2639

2640
  /**
2641
   * Set the style to the given popper
2642
   * @method
2643
   * @memberof Popper.Utils
2644
   * @argument {Element} element - Element to apply the style to
2645
   * @argument {Object} styles
2646
   * Object with a list of properties and values which will be applied to the element
2647
   */
2648
  function setStyles(element, styles) {
2649
    Object.keys(styles).forEach(function (prop) {
2650
      var unit = '';
2651
      // add unit if the value is numeric and is one of the following
2652
      if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
2653
        unit = 'px';
2654
      }
2655
      element.style[prop] = styles[prop] + unit;
2656
    });
2657
  }
2658

2659
  /**
2660
   * Set the attributes to the given popper
2661
   * @method
2662
   * @memberof Popper.Utils
2663
   * @argument {Element} element - Element to apply the attributes to
2664
   * @argument {Object} styles
2665
   * Object with a list of properties and values which will be applied to the element
2666
   */
2667
  function setAttributes(element, attributes) {
2668
    Object.keys(attributes).forEach(function (prop) {
2669
      var value = attributes[prop];
2670
      if (value !== false) {
2671
        element.setAttribute(prop, attributes[prop]);
2672
      } else {
2673
        element.removeAttribute(prop);
2674
      }
2675
    });
2676
  }
2677

2678
  /**
2679
   * @function
2680
   * @memberof Modifiers
2681
   * @argument {Object} data - The data object generated by `update` method
2682
   * @argument {Object} data.styles - List of style properties - values to apply to popper element
2683
   * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
2684
   * @argument {Object} options - Modifiers configuration and options
2685
   * @returns {Object} The same data object
2686
   */
2687
  function applyStyle(data) {
2688
    // any property present in `data.styles` will be applied to the popper,
2689
    // in this way we can make the 3rd party modifiers add custom styles to it
2690
    // Be aware, modifiers could override the properties defined in the previous
2691
    // lines of this modifier!
2692
    setStyles(data.instance.popper, data.styles);
2693

2694
    // any property present in `data.attributes` will be applied to the popper,
2695
    // they will be set as HTML attributes of the element
2696
    setAttributes(data.instance.popper, data.attributes);
2697

2698
    // if arrowElement is defined and arrowStyles has some properties
2699
    if (data.arrowElement && Object.keys(data.arrowStyles).length) {
2700
      setStyles(data.arrowElement, data.arrowStyles);
2701
    }
2702

2703
    return data;
2704
  }
2705

2706
  /**
2707
   * Set the x-placement attribute before everything else because it could be used
2708
   * to add margins to the popper margins needs to be calculated to get the
2709
   * correct popper offsets.
2710
   * @method
2711
   * @memberof Popper.modifiers
2712
   * @param {HTMLElement} reference - The reference element used to position the popper
2713
   * @param {HTMLElement} popper - The HTML element used as popper
2714
   * @param {Object} options - Popper.js options
2715
   */
2716
  function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
2717
    // compute reference element offsets
2718
    var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
2719

2720
    // compute auto placement, store placement inside the data object,
2721
    // modifiers will be able to edit `placement` if needed
2722
    // and refer to originalPlacement to know the original value
2723
    var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
2724

2725
    popper.setAttribute('x-placement', placement);
2726

2727
    // Apply `position` to popper before anything else because
2728
    // without the position applied we can't guarantee correct computations
2729
    setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
2730

2731
    return options;
2732
  }
2733

2734
  /**
2735
   * @function
2736
   * @memberof Popper.Utils
2737
   * @argument {Object} data - The data object generated by `update` method
2738
   * @argument {Boolean} shouldRound - If the offsets should be rounded at all
2739
   * @returns {Object} The popper's position offsets rounded
2740
   *
2741
   * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
2742
   * good as it can be within reason.
2743
   * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
2744
   *
2745
   * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
2746
   * as well on High DPI screens).
2747
   *
2748
   * Firefox prefers no rounding for positioning and does not have blurriness on
2749
   * high DPI screens.
2750
   *
2751
   * Only horizontal placement and left/right values need to be considered.
2752
   */
2753
  function getRoundedOffsets(data, shouldRound) {
2754
    var _data$offsets = data.offsets,
2755
        popper = _data$offsets.popper,
2756
        reference = _data$offsets.reference;
2757
    var round = Math.round,
2758
        floor = Math.floor;
2759

2760
    var noRound = function noRound(v) {
2761
      return v;
2762
    };
2763

2764
    var referenceWidth = round(reference.width);
2765
    var popperWidth = round(popper.width);
2766

2767
    var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
2768
    var isVariation = data.placement.indexOf('-') !== -1;
2769
    var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
2770
    var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
2771

2772
    var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
2773
    var verticalToInteger = !shouldRound ? noRound : round;
2774

2775
    return {
2776
      left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
2777
      top: verticalToInteger(popper.top),
2778
      bottom: verticalToInteger(popper.bottom),
2779
      right: horizontalToInteger(popper.right)
2780
    };
2781
  }
2782

2783
  var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
2784

2785
  /**
2786
   * @function
2787
   * @memberof Modifiers
2788
   * @argument {Object} data - The data object generated by `update` method
2789
   * @argument {Object} options - Modifiers configuration and options
2790
   * @returns {Object} The data object, properly modified
2791
   */
2792
  function computeStyle(data, options) {
2793
    var x = options.x,
2794
        y = options.y;
2795
    var popper = data.offsets.popper;
2796

2797
    // Remove this legacy support in Popper.js v2
2798

2799
    var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
2800
      return modifier.name === 'applyStyle';
2801
    }).gpuAcceleration;
2802
    if (legacyGpuAccelerationOption !== undefined) {
2803
      console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
2804
    }
2805
    var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
2806

2807
    var offsetParent = getOffsetParent(data.instance.popper);
2808
    var offsetParentRect = getBoundingClientRect(offsetParent);
2809

2810
    // Styles
2811
    var styles = {
2812
      position: popper.position
2813
    };
2814

2815
    var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
2816

2817
    var sideA = x === 'bottom' ? 'top' : 'bottom';
2818
    var sideB = y === 'right' ? 'left' : 'right';
2819

2820
    // if gpuAcceleration is set to `true` and transform is supported,
2821
    //  we use `translate3d` to apply the position to the popper we
2822
    // automatically use the supported prefixed version if needed
2823
    var prefixedProperty = getSupportedPropertyName('transform');
2824

2825
    // now, let's make a step back and look at this code closely (wtf?)
2826
    // If the content of the popper grows once it's been positioned, it
2827
    // may happen that the popper gets misplaced because of the new content
2828
    // overflowing its reference element
2829
    // To avoid this problem, we provide two options (x and y), which allow
2830
    // the consumer to define the offset origin.
2831
    // If we position a popper on top of a reference element, we can set
2832
    // `x` to `top` to make the popper grow towards its top instead of
2833
    // its bottom.
2834
    var left = void 0,
2835
        top = void 0;
2836
    if (sideA === 'bottom') {
2837
      // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
2838
      // and not the bottom of the html element
2839
      if (offsetParent.nodeName === 'HTML') {
2840
        top = -offsetParent.clientHeight + offsets.bottom;
2841
      } else {
2842
        top = -offsetParentRect.height + offsets.bottom;
2843
      }
2844
    } else {
2845
      top = offsets.top;
2846
    }
2847
    if (sideB === 'right') {
2848
      if (offsetParent.nodeName === 'HTML') {
2849
        left = -offsetParent.clientWidth + offsets.right;
2850
      } else {
2851
        left = -offsetParentRect.width + offsets.right;
2852
      }
2853
    } else {
2854
      left = offsets.left;
2855
    }
2856
    if (gpuAcceleration && prefixedProperty) {
2857
      styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
2858
      styles[sideA] = 0;
2859
      styles[sideB] = 0;
2860
      styles.willChange = 'transform';
2861
    } else {
2862
      // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
2863
      var invertTop = sideA === 'bottom' ? -1 : 1;
2864
      var invertLeft = sideB === 'right' ? -1 : 1;
2865
      styles[sideA] = top * invertTop;
2866
      styles[sideB] = left * invertLeft;
2867
      styles.willChange = sideA + ', ' + sideB;
2868
    }
2869

2870
    // Attributes
2871
    var attributes = {
2872
      'x-placement': data.placement
2873
    };
2874

2875
    // Update `data` attributes, styles and arrowStyles
2876
    data.attributes = _extends$1({}, attributes, data.attributes);
2877
    data.styles = _extends$1({}, styles, data.styles);
2878
    data.arrowStyles = _extends$1({}, data.offsets.arrow, data.arrowStyles);
2879

2880
    return data;
2881
  }
2882

2883
  /**
2884
   * Helper used to know if the given modifier depends from another one.<br />
2885
   * It checks if the needed modifier is listed and enabled.
2886
   * @method
2887
   * @memberof Popper.Utils
2888
   * @param {Array} modifiers - list of modifiers
2889
   * @param {String} requestingName - name of requesting modifier
2890
   * @param {String} requestedName - name of requested modifier
2891
   * @returns {Boolean}
2892
   */
2893
  function isModifierRequired(modifiers, requestingName, requestedName) {
2894
    var requesting = find(modifiers, function (_ref) {
2895
      var name = _ref.name;
2896
      return name === requestingName;
2897
    });
2898

2899
    var isRequired = !!requesting && modifiers.some(function (modifier) {
2900
      return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
2901
    });
2902

2903
    if (!isRequired) {
2904
      var _requesting = '`' + requestingName + '`';
2905
      var requested = '`' + requestedName + '`';
2906
      console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
2907
    }
2908
    return isRequired;
2909
  }
2910

2911
  /**
2912
   * @function
2913
   * @memberof Modifiers
2914
   * @argument {Object} data - The data object generated by update method
2915
   * @argument {Object} options - Modifiers configuration and options
2916
   * @returns {Object} The data object, properly modified
2917
   */
2918
  function arrow(data, options) {
2919
    var _data$offsets$arrow;
2920

2921
    // arrow depends on keepTogether in order to work
2922
    if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
2923
      return data;
2924
    }
2925

2926
    var arrowElement = options.element;
2927

2928
    // if arrowElement is a string, suppose it's a CSS selector
2929
    if (typeof arrowElement === 'string') {
2930
      arrowElement = data.instance.popper.querySelector(arrowElement);
2931

2932
      // if arrowElement is not found, don't run the modifier
2933
      if (!arrowElement) {
2934
        return data;
2935
      }
2936
    } else {
2937
      // if the arrowElement isn't a query selector we must check that the
2938
      // provided DOM node is child of its popper node
2939
      if (!data.instance.popper.contains(arrowElement)) {
2940
        console.warn('WARNING: `arrow.element` must be child of its popper element!');
2941
        return data;
2942
      }
2943
    }
2944

2945
    var placement = data.placement.split('-')[0];
2946
    var _data$offsets = data.offsets,
2947
        popper = _data$offsets.popper,
2948
        reference = _data$offsets.reference;
2949

2950
    var isVertical = ['left', 'right'].indexOf(placement) !== -1;
2951

2952
    var len = isVertical ? 'height' : 'width';
2953
    var sideCapitalized = isVertical ? 'Top' : 'Left';
2954
    var side = sideCapitalized.toLowerCase();
2955
    var altSide = isVertical ? 'left' : 'top';
2956
    var opSide = isVertical ? 'bottom' : 'right';
2957
    var arrowElementSize = getOuterSizes(arrowElement)[len];
2958

2959
    //
2960
    // extends keepTogether behavior making sure the popper and its
2961
    // reference have enough pixels in conjunction
2962
    //
2963

2964
    // top/left side
2965
    if (reference[opSide] - arrowElementSize < popper[side]) {
2966
      data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
2967
    }
2968
    // bottom/right side
2969
    if (reference[side] + arrowElementSize > popper[opSide]) {
2970
      data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
2971
    }
2972
    data.offsets.popper = getClientRect(data.offsets.popper);
2973

2974
    // compute center of the popper
2975
    var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
2976

2977
    // Compute the sideValue using the updated popper offsets
2978
    // take popper margin in account because we don't have this info available
2979
    var css = getStyleComputedProperty(data.instance.popper);
2980
    var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
2981
    var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
2982
    var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
2983

2984
    // prevent arrowElement from being placed not contiguously to its popper
2985
    sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
2986

2987
    data.arrowElement = arrowElement;
2988
    data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
2989

2990
    return data;
2991
  }
2992

2993
  /**
2994
   * Get the opposite placement variation of the given one
2995
   * @method
2996
   * @memberof Popper.Utils
2997
   * @argument {String} placement variation
2998
   * @returns {String} flipped placement variation
2999
   */
3000
  function getOppositeVariation(variation) {
3001
    if (variation === 'end') {
3002
      return 'start';
3003
    } else if (variation === 'start') {
3004
      return 'end';
3005
    }
3006
    return variation;
3007
  }
3008

3009
  /**
3010
   * List of accepted placements to use as values of the `placement` option.<br />
3011
   * Valid placements are:
3012
   * - `auto`
3013
   * - `top`
3014
   * - `right`
3015
   * - `bottom`
3016
   * - `left`
3017
   *
3018
   * Each placement can have a variation from this list:
3019
   * - `-start`
3020
   * - `-end`
3021
   *
3022
   * Variations are interpreted easily if you think of them as the left to right
3023
   * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
3024
   * is right.<br />
3025
   * Vertically (`left` and `right`), `start` is top and `end` is bottom.
3026
   *
3027
   * Some valid examples are:
3028
   * - `top-end` (on top of reference, right aligned)
3029
   * - `right-start` (on right of reference, top aligned)
3030
   * - `bottom` (on bottom, centered)
3031
   * - `auto-end` (on the side with more space available, alignment depends by placement)
3032
   *
3033
   * @static
3034
   * @type {Array}
3035
   * @enum {String}
3036
   * @readonly
3037
   * @method placements
3038
   * @memberof Popper
3039
   */
3040
  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'];
3041

3042
  // Get rid of `auto` `auto-start` and `auto-end`
3043
  var validPlacements = placements.slice(3);
3044

3045
  /**
3046
   * Given an initial placement, returns all the subsequent placements
3047
   * clockwise (or counter-clockwise).
3048
   *
3049
   * @method
3050
   * @memberof Popper.Utils
3051
   * @argument {String} placement - A valid placement (it accepts variations)
3052
   * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
3053
   * @returns {Array} placements including their variations
3054
   */
3055
  function clockwise(placement) {
3056
    var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3057

3058
    var index = validPlacements.indexOf(placement);
3059
    var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
3060
    return counter ? arr.reverse() : arr;
3061
  }
3062

3063
  var BEHAVIORS = {
3064
    FLIP: 'flip',
3065
    CLOCKWISE: 'clockwise',
3066
    COUNTERCLOCKWISE: 'counterclockwise'
3067
  };
3068

3069
  /**
3070
   * @function
3071
   * @memberof Modifiers
3072
   * @argument {Object} data - The data object generated by update method
3073
   * @argument {Object} options - Modifiers configuration and options
3074
   * @returns {Object} The data object, properly modified
3075
   */
3076
  function flip(data, options) {
3077
    // if `inner` modifier is enabled, we can't use the `flip` modifier
3078
    if (isModifierEnabled(data.instance.modifiers, 'inner')) {
3079
      return data;
3080
    }
3081

3082
    if (data.flipped && data.placement === data.originalPlacement) {
3083
      // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
3084
      return data;
3085
    }
3086

3087
    var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
3088

3089
    var placement = data.placement.split('-')[0];
3090
    var placementOpposite = getOppositePlacement(placement);
3091
    var variation = data.placement.split('-')[1] || '';
3092

3093
    var flipOrder = [];
3094

3095
    switch (options.behavior) {
3096
      case BEHAVIORS.FLIP:
3097
        flipOrder = [placement, placementOpposite];
3098
        break;
3099
      case BEHAVIORS.CLOCKWISE:
3100
        flipOrder = clockwise(placement);
3101
        break;
3102
      case BEHAVIORS.COUNTERCLOCKWISE:
3103
        flipOrder = clockwise(placement, true);
3104
        break;
3105
      default:
3106
        flipOrder = options.behavior;
3107
    }
3108

3109
    flipOrder.forEach(function (step, index) {
3110
      if (placement !== step || flipOrder.length === index + 1) {
3111
        return data;
3112
      }
3113

3114
      placement = data.placement.split('-')[0];
3115
      placementOpposite = getOppositePlacement(placement);
3116

3117
      var popperOffsets = data.offsets.popper;
3118
      var refOffsets = data.offsets.reference;
3119

3120
      // using floor because the reference offsets may contain decimals we are not going to consider here
3121
      var floor = Math.floor;
3122
      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);
3123

3124
      var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
3125
      var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
3126
      var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
3127
      var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
3128

3129
      var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
3130

3131
      // flip the variation if required
3132
      var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
3133

3134
      // flips variation if reference element overflows boundaries
3135
      var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
3136

3137
      // flips variation if popper content overflows boundaries
3138
      var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
3139

3140
      var flippedVariation = flippedVariationByRef || flippedVariationByContent;
3141

3142
      if (overlapsRef || overflowsBoundaries || flippedVariation) {
3143
        // this boolean to detect any flip loop
3144
        data.flipped = true;
3145

3146
        if (overlapsRef || overflowsBoundaries) {
3147
          placement = flipOrder[index + 1];
3148
        }
3149

3150
        if (flippedVariation) {
3151
          variation = getOppositeVariation(variation);
3152
        }
3153

3154
        data.placement = placement + (variation ? '-' + variation : '');
3155

3156
        // this object contains `position`, we want to preserve it along with
3157
        // any additional property we may add in the future
3158
        data.offsets.popper = _extends$1({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
3159

3160
        data = runModifiers(data.instance.modifiers, data, 'flip');
3161
      }
3162
    });
3163
    return data;
3164
  }
3165

3166
  /**
3167
   * @function
3168
   * @memberof Modifiers
3169
   * @argument {Object} data - The data object generated by update method
3170
   * @argument {Object} options - Modifiers configuration and options
3171
   * @returns {Object} The data object, properly modified
3172
   */
3173
  function keepTogether(data) {
3174
    var _data$offsets = data.offsets,
3175
        popper = _data$offsets.popper,
3176
        reference = _data$offsets.reference;
3177

3178
    var placement = data.placement.split('-')[0];
3179
    var floor = Math.floor;
3180
    var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
3181
    var side = isVertical ? 'right' : 'bottom';
3182
    var opSide = isVertical ? 'left' : 'top';
3183
    var measurement = isVertical ? 'width' : 'height';
3184

3185
    if (popper[side] < floor(reference[opSide])) {
3186
      data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
3187
    }
3188
    if (popper[opSide] > floor(reference[side])) {
3189
      data.offsets.popper[opSide] = floor(reference[side]);
3190
    }
3191

3192
    return data;
3193
  }
3194

3195
  /**
3196
   * Converts a string containing value + unit into a px value number
3197
   * @function
3198
   * @memberof {modifiers~offset}
3199
   * @private
3200
   * @argument {String} str - Value + unit string
3201
   * @argument {String} measurement - `height` or `width`
3202
   * @argument {Object} popperOffsets
3203
   * @argument {Object} referenceOffsets
3204
   * @returns {Number|String}
3205
   * Value in pixels, or original string if no values were extracted
3206
   */
3207
  function toValue(str, measurement, popperOffsets, referenceOffsets) {
3208
    // separate value from unit
3209
    var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
3210
    var value = +split[1];
3211
    var unit = split[2];
3212

3213
    // If it's not a number it's an operator, I guess
3214
    if (!value) {
3215
      return str;
3216
    }
3217

3218
    if (unit.indexOf('%') === 0) {
3219
      var element = void 0;
3220
      switch (unit) {
3221
        case '%p':
3222
          element = popperOffsets;
3223
          break;
3224
        case '%':
3225
        case '%r':
3226
        default:
3227
          element = referenceOffsets;
3228
      }
3229

3230
      var rect = getClientRect(element);
3231
      return rect[measurement] / 100 * value;
3232
    } else if (unit === 'vh' || unit === 'vw') {
3233
      // if is a vh or vw, we calculate the size based on the viewport
3234
      var size = void 0;
3235
      if (unit === 'vh') {
3236
        size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
3237
      } else {
3238
        size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
3239
      }
3240
      return size / 100 * value;
3241
    } else {
3242
      // if is an explicit pixel unit, we get rid of the unit and keep the value
3243
      // if is an implicit unit, it's px, and we return just the value
3244
      return value;
3245
    }
3246
  }
3247

3248
  /**
3249
   * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
3250
   * @function
3251
   * @memberof {modifiers~offset}
3252
   * @private
3253
   * @argument {String} offset
3254
   * @argument {Object} popperOffsets
3255
   * @argument {Object} referenceOffsets
3256
   * @argument {String} basePlacement
3257
   * @returns {Array} a two cells array with x and y offsets in numbers
3258
   */
3259
  function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
3260
    var offsets = [0, 0];
3261

3262
    // Use height if placement is left or right and index is 0 otherwise use width
3263
    // in this way the first offset will use an axis and the second one
3264
    // will use the other one
3265
    var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
3266

3267
    // Split the offset string to obtain a list of values and operands
3268
    // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
3269
    var fragments = offset.split(/(\+|\-)/).map(function (frag) {
3270
      return frag.trim();
3271
    });
3272

3273
    // Detect if the offset string contains a pair of values or a single one
3274
    // they could be separated by comma or space
3275
    var divider = fragments.indexOf(find(fragments, function (frag) {
3276
      return frag.search(/,|\s/) !== -1;
3277
    }));
3278

3279
    if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
3280
      console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
3281
    }
3282

3283
    // If divider is found, we divide the list of values and operands to divide
3284
    // them by ofset X and Y.
3285
    var splitRegex = /\s*,\s*|\s+/;
3286
    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];
3287

3288
    // Convert the values with units to absolute pixels to allow our computations
3289
    ops = ops.map(function (op, index) {
3290
      // Most of the units rely on the orientation of the popper
3291
      var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
3292
      var mergeWithPrevious = false;
3293
      return op
3294
      // This aggregates any `+` or `-` sign that aren't considered operators
3295
      // e.g.: 10 + +5 => [10, +, +5]
3296
      .reduce(function (a, b) {
3297
        if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
3298
          a[a.length - 1] = b;
3299
          mergeWithPrevious = true;
3300
          return a;
3301
        } else if (mergeWithPrevious) {
3302
          a[a.length - 1] += b;
3303
          mergeWithPrevious = false;
3304
          return a;
3305
        } else {
3306
          return a.concat(b);
3307
        }
3308
      }, [])
3309
      // Here we convert the string values into number values (in px)
3310
      .map(function (str) {
3311
        return toValue(str, measurement, popperOffsets, referenceOffsets);
3312
      });
3313
    });
3314

3315
    // Loop trough the offsets arrays and execute the operations
3316
    ops.forEach(function (op, index) {
3317
      op.forEach(function (frag, index2) {
3318
        if (isNumeric(frag)) {
3319
          offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
3320
        }
3321
      });
3322
    });
3323
    return offsets;
3324
  }
3325

3326
  /**
3327
   * @function
3328
   * @memberof Modifiers
3329
   * @argument {Object} data - The data object generated by update method
3330
   * @argument {Object} options - Modifiers configuration and options
3331
   * @argument {Number|String} options.offset=0
3332
   * The offset value as described in the modifier description
3333
   * @returns {Object} The data object, properly modified
3334
   */
3335
  function offset(data, _ref) {
3336
    var offset = _ref.offset;
3337
    var placement = data.placement,
3338
        _data$offsets = data.offsets,
3339
        popper = _data$offsets.popper,
3340
        reference = _data$offsets.reference;
3341

3342
    var basePlacement = placement.split('-')[0];
3343

3344
    var offsets = void 0;
3345
    if (isNumeric(+offset)) {
3346
      offsets = [+offset, 0];
3347
    } else {
3348
      offsets = parseOffset(offset, popper, reference, basePlacement);
3349
    }
3350

3351
    if (basePlacement === 'left') {
3352
      popper.top += offsets[0];
3353
      popper.left -= offsets[1];
3354
    } else if (basePlacement === 'right') {
3355
      popper.top += offsets[0];
3356
      popper.left += offsets[1];
3357
    } else if (basePlacement === 'top') {
3358
      popper.left += offsets[0];
3359
      popper.top -= offsets[1];
3360
    } else if (basePlacement === 'bottom') {
3361
      popper.left += offsets[0];
3362
      popper.top += offsets[1];
3363
    }
3364

3365
    data.popper = popper;
3366
    return data;
3367
  }
3368

3369
  /**
3370
   * @function
3371
   * @memberof Modifiers
3372
   * @argument {Object} data - The data object generated by `update` method
3373
   * @argument {Object} options - Modifiers configuration and options
3374
   * @returns {Object} The data object, properly modified
3375
   */
3376
  function preventOverflow(data, options) {
3377
    var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
3378

3379
    // If offsetParent is the reference element, we really want to
3380
    // go one step up and use the next offsetParent as reference to
3381
    // avoid to make this modifier completely useless and look like broken
3382
    if (data.instance.reference === boundariesElement) {
3383
      boundariesElement = getOffsetParent(boundariesElement);
3384
    }
3385

3386
    // NOTE: DOM access here
3387
    // resets the popper's position so that the document size can be calculated excluding
3388
    // the size of the popper element itself
3389
    var transformProp = getSupportedPropertyName('transform');
3390
    var popperStyles = data.instance.popper.style; // assignment to help minification
3391
    var top = popperStyles.top,
3392
        left = popperStyles.left,
3393
        transform = popperStyles[transformProp];
3394

3395
    popperStyles.top = '';
3396
    popperStyles.left = '';
3397
    popperStyles[transformProp] = '';
3398

3399
    var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
3400

3401
    // NOTE: DOM access here
3402
    // restores the original style properties after the offsets have been computed
3403
    popperStyles.top = top;
3404
    popperStyles.left = left;
3405
    popperStyles[transformProp] = transform;
3406

3407
    options.boundaries = boundaries;
3408

3409
    var order = options.priority;
3410
    var popper = data.offsets.popper;
3411

3412
    var check = {
3413
      primary: function primary(placement) {
3414
        var value = popper[placement];
3415
        if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
3416
          value = Math.max(popper[placement], boundaries[placement]);
3417
        }
3418
        return defineProperty({}, placement, value);
3419
      },
3420
      secondary: function secondary(placement) {
3421
        var mainSide = placement === 'right' ? 'left' : 'top';
3422
        var value = popper[mainSide];
3423
        if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
3424
          value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
3425
        }
3426
        return defineProperty({}, mainSide, value);
3427
      }
3428
    };
3429

3430
    order.forEach(function (placement) {
3431
      var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
3432
      popper = _extends$1({}, popper, check[side](placement));
3433
    });
3434

3435
    data.offsets.popper = popper;
3436

3437
    return data;
3438
  }
3439

3440
  /**
3441
   * @function
3442
   * @memberof Modifiers
3443
   * @argument {Object} data - The data object generated by `update` method
3444
   * @argument {Object} options - Modifiers configuration and options
3445
   * @returns {Object} The data object, properly modified
3446
   */
3447
  function shift(data) {
3448
    var placement = data.placement;
3449
    var basePlacement = placement.split('-')[0];
3450
    var shiftvariation = placement.split('-')[1];
3451

3452
    // if shift shiftvariation is specified, run the modifier
3453
    if (shiftvariation) {
3454
      var _data$offsets = data.offsets,
3455
          reference = _data$offsets.reference,
3456
          popper = _data$offsets.popper;
3457

3458
      var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
3459
      var side = isVertical ? 'left' : 'top';
3460
      var measurement = isVertical ? 'width' : 'height';
3461

3462
      var shiftOffsets = {
3463
        start: defineProperty({}, side, reference[side]),
3464
        end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
3465
      };
3466

3467
      data.offsets.popper = _extends$1({}, popper, shiftOffsets[shiftvariation]);
3468
    }
3469

3470
    return data;
3471
  }
3472

3473
  /**
3474
   * @function
3475
   * @memberof Modifiers
3476
   * @argument {Object} data - The data object generated by update method
3477
   * @argument {Object} options - Modifiers configuration and options
3478
   * @returns {Object} The data object, properly modified
3479
   */
3480
  function hide(data) {
3481
    if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
3482
      return data;
3483
    }
3484

3485
    var refRect = data.offsets.reference;
3486
    var bound = find(data.instance.modifiers, function (modifier) {
3487
      return modifier.name === 'preventOverflow';
3488
    }).boundaries;
3489

3490
    if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
3491
      // Avoid unnecessary DOM access if visibility hasn't changed
3492
      if (data.hide === true) {
3493
        return data;
3494
      }
3495

3496
      data.hide = true;
3497
      data.attributes['x-out-of-boundaries'] = '';
3498
    } else {
3499
      // Avoid unnecessary DOM access if visibility hasn't changed
3500
      if (data.hide === false) {
3501
        return data;
3502
      }
3503

3504
      data.hide = false;
3505
      data.attributes['x-out-of-boundaries'] = false;
3506
    }
3507

3508
    return data;
3509
  }
3510

3511
  /**
3512
   * @function
3513
   * @memberof Modifiers
3514
   * @argument {Object} data - The data object generated by `update` method
3515
   * @argument {Object} options - Modifiers configuration and options
3516
   * @returns {Object} The data object, properly modified
3517
   */
3518
  function inner(data) {
3519
    var placement = data.placement;
3520
    var basePlacement = placement.split('-')[0];
3521
    var _data$offsets = data.offsets,
3522
        popper = _data$offsets.popper,
3523
        reference = _data$offsets.reference;
3524

3525
    var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
3526

3527
    var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
3528

3529
    popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
3530

3531
    data.placement = getOppositePlacement(placement);
3532
    data.offsets.popper = getClientRect(popper);
3533

3534
    return data;
3535
  }
3536

3537
  /**
3538
   * Modifier function, each modifier can have a function of this type assigned
3539
   * to its `fn` property.<br />
3540
   * These functions will be called on each update, this means that you must
3541
   * make sure they are performant enough to avoid performance bottlenecks.
3542
   *
3543
   * @function ModifierFn
3544
   * @argument {dataObject} data - The data object generated by `update` method
3545
   * @argument {Object} options - Modifiers configuration and options
3546
   * @returns {dataObject} The data object, properly modified
3547
   */
3548

3549
  /**
3550
   * Modifiers are plugins used to alter the behavior of your poppers.<br />
3551
   * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
3552
   * needed by the library.
3553
   *
3554
   * Usually you don't want to override the `order`, `fn` and `onLoad` props.
3555
   * All the other properties are configurations that could be tweaked.
3556
   * @namespace modifiers
3557
   */
3558
  var modifiers = {
3559
    /**
3560
     * Modifier used to shift the popper on the start or end of its reference
3561
     * element.<br />
3562
     * It will read the variation of the `placement` property.<br />
3563
     * It can be one either `-end` or `-start`.
3564
     * @memberof modifiers
3565
     * @inner
3566
     */
3567
    shift: {
3568
      /** @prop {number} order=100 - Index used to define the order of execution */
3569
      order: 100,
3570
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3571
      enabled: true,
3572
      /** @prop {ModifierFn} */
3573
      fn: shift
3574
    },
3575

3576
    /**
3577
     * The `offset` modifier can shift your popper on both its axis.
3578
     *
3579
     * It accepts the following units:
3580
     * - `px` or unit-less, interpreted as pixels
3581
     * - `%` or `%r`, percentage relative to the length of the reference element
3582
     * - `%p`, percentage relative to the length of the popper element
3583
     * - `vw`, CSS viewport width unit
3584
     * - `vh`, CSS viewport height unit
3585
     *
3586
     * For length is intended the main axis relative to the placement of the popper.<br />
3587
     * This means that if the placement is `top` or `bottom`, the length will be the
3588
     * `width`. In case of `left` or `right`, it will be the `height`.
3589
     *
3590
     * You can provide a single value (as `Number` or `String`), or a pair of values
3591
     * as `String` divided by a comma or one (or more) white spaces.<br />
3592
     * The latter is a deprecated method because it leads to confusion and will be
3593
     * removed in v2.<br />
3594
     * Additionally, it accepts additions and subtractions between different units.
3595
     * Note that multiplications and divisions aren't supported.
3596
     *
3597
     * Valid examples are:
3598
     * ```
3599
     * 10
3600
     * '10%'
3601
     * '10, 10'
3602
     * '10%, 10'
3603
     * '10 + 10%'
3604
     * '10 - 5vh + 3%'
3605
     * '-10px + 5vh, 5px - 6%'
3606
     * ```
3607
     * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
3608
     * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
3609
     * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
3610
     *
3611
     * @memberof modifiers
3612
     * @inner
3613
     */
3614
    offset: {
3615
      /** @prop {number} order=200 - Index used to define the order of execution */
3616
      order: 200,
3617
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3618
      enabled: true,
3619
      /** @prop {ModifierFn} */
3620
      fn: offset,
3621
      /** @prop {Number|String} offset=0
3622
       * The offset value as described in the modifier description
3623
       */
3624
      offset: 0
3625
    },
3626

3627
    /**
3628
     * Modifier used to prevent the popper from being positioned outside the boundary.
3629
     *
3630
     * A scenario exists where the reference itself is not within the boundaries.<br />
3631
     * We can say it has "escaped the boundaries" — or just "escaped".<br />
3632
     * In this case we need to decide whether the popper should either:
3633
     *
3634
     * - detach from the reference and remain "trapped" in the boundaries, or
3635
     * - if it should ignore the boundary and "escape with its reference"
3636
     *
3637
     * When `escapeWithReference` is set to`true` and reference is completely
3638
     * outside its boundaries, the popper will overflow (or completely leave)
3639
     * the boundaries in order to remain attached to the edge of the reference.
3640
     *
3641
     * @memberof modifiers
3642
     * @inner
3643
     */
3644
    preventOverflow: {
3645
      /** @prop {number} order=300 - Index used to define the order of execution */
3646
      order: 300,
3647
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3648
      enabled: true,
3649
      /** @prop {ModifierFn} */
3650
      fn: preventOverflow,
3651
      /**
3652
       * @prop {Array} [priority=['left','right','top','bottom']]
3653
       * Popper will try to prevent overflow following these priorities by default,
3654
       * then, it could overflow on the left and on top of the `boundariesElement`
3655
       */
3656
      priority: ['left', 'right', 'top', 'bottom'],
3657
      /**
3658
       * @prop {number} padding=5
3659
       * Amount of pixel used to define a minimum distance between the boundaries
3660
       * and the popper. This makes sure the popper always has a little padding
3661
       * between the edges of its container
3662
       */
3663
      padding: 5,
3664
      /**
3665
       * @prop {String|HTMLElement} boundariesElement='scrollParent'
3666
       * Boundaries used by the modifier. Can be `scrollParent`, `window`,
3667
       * `viewport` or any DOM element.
3668
       */
3669
      boundariesElement: 'scrollParent'
3670
    },
3671

3672
    /**
3673
     * Modifier used to make sure the reference and its popper stay near each other
3674
     * without leaving any gap between the two. Especially useful when the arrow is
3675
     * enabled and you want to ensure that it points to its reference element.
3676
     * It cares only about the first axis. You can still have poppers with margin
3677
     * between the popper and its reference element.
3678
     * @memberof modifiers
3679
     * @inner
3680
     */
3681
    keepTogether: {
3682
      /** @prop {number} order=400 - Index used to define the order of execution */
3683
      order: 400,
3684
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3685
      enabled: true,
3686
      /** @prop {ModifierFn} */
3687
      fn: keepTogether
3688
    },
3689

3690
    /**
3691
     * This modifier is used to move the `arrowElement` of the popper to make
3692
     * sure it is positioned between the reference element and its popper element.
3693
     * It will read the outer size of the `arrowElement` node to detect how many
3694
     * pixels of conjunction are needed.
3695
     *
3696
     * It has no effect if no `arrowElement` is provided.
3697
     * @memberof modifiers
3698
     * @inner
3699
     */
3700
    arrow: {
3701
      /** @prop {number} order=500 - Index used to define the order of execution */
3702
      order: 500,
3703
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3704
      enabled: true,
3705
      /** @prop {ModifierFn} */
3706
      fn: arrow,
3707
      /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
3708
      element: '[x-arrow]'
3709
    },
3710

3711
    /**
3712
     * Modifier used to flip the popper's placement when it starts to overlap its
3713
     * reference element.
3714
     *
3715
     * Requires the `preventOverflow` modifier before it in order to work.
3716
     *
3717
     * **NOTE:** this modifier will interrupt the current update cycle and will
3718
     * restart it if it detects the need to flip the placement.
3719
     * @memberof modifiers
3720
     * @inner
3721
     */
3722
    flip: {
3723
      /** @prop {number} order=600 - Index used to define the order of execution */
3724
      order: 600,
3725
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3726
      enabled: true,
3727
      /** @prop {ModifierFn} */
3728
      fn: flip,
3729
      /**
3730
       * @prop {String|Array} behavior='flip'
3731
       * The behavior used to change the popper's placement. It can be one of
3732
       * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
3733
       * placements (with optional variations)
3734
       */
3735
      behavior: 'flip',
3736
      /**
3737
       * @prop {number} padding=5
3738
       * The popper will flip if it hits the edges of the `boundariesElement`
3739
       */
3740
      padding: 5,
3741
      /**
3742
       * @prop {String|HTMLElement} boundariesElement='viewport'
3743
       * The element which will define the boundaries of the popper position.
3744
       * The popper will never be placed outside of the defined boundaries
3745
       * (except if `keepTogether` is enabled)
3746
       */
3747
      boundariesElement: 'viewport',
3748
      /**
3749
       * @prop {Boolean} flipVariations=false
3750
       * The popper will switch placement variation between `-start` and `-end` when
3751
       * the reference element overlaps its boundaries.
3752
       *
3753
       * The original placement should have a set variation.
3754
       */
3755
      flipVariations: false,
3756
      /**
3757
       * @prop {Boolean} flipVariationsByContent=false
3758
       * The popper will switch placement variation between `-start` and `-end` when
3759
       * the popper element overlaps its reference boundaries.
3760
       *
3761
       * The original placement should have a set variation.
3762
       */
3763
      flipVariationsByContent: false
3764
    },
3765

3766
    /**
3767
     * Modifier used to make the popper flow toward the inner of the reference element.
3768
     * By default, when this modifier is disabled, the popper will be placed outside
3769
     * the reference element.
3770
     * @memberof modifiers
3771
     * @inner
3772
     */
3773
    inner: {
3774
      /** @prop {number} order=700 - Index used to define the order of execution */
3775
      order: 700,
3776
      /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
3777
      enabled: false,
3778
      /** @prop {ModifierFn} */
3779
      fn: inner
3780
    },
3781

3782
    /**
3783
     * Modifier used to hide the popper when its reference element is outside of the
3784
     * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
3785
     * be used to hide with a CSS selector the popper when its reference is
3786
     * out of boundaries.
3787
     *
3788
     * Requires the `preventOverflow` modifier before it in order to work.
3789
     * @memberof modifiers
3790
     * @inner
3791
     */
3792
    hide: {
3793
      /** @prop {number} order=800 - Index used to define the order of execution */
3794
      order: 800,
3795
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3796
      enabled: true,
3797
      /** @prop {ModifierFn} */
3798
      fn: hide
3799
    },
3800

3801
    /**
3802
     * Computes the style that will be applied to the popper element to gets
3803
     * properly positioned.
3804
     *
3805
     * Note that this modifier will not touch the DOM, it just prepares the styles
3806
     * so that `applyStyle` modifier can apply it. This separation is useful
3807
     * in case you need to replace `applyStyle` with a custom implementation.
3808
     *
3809
     * This modifier has `850` as `order` value to maintain backward compatibility
3810
     * with previous versions of Popper.js. Expect the modifiers ordering method
3811
     * to change in future major versions of the library.
3812
     *
3813
     * @memberof modifiers
3814
     * @inner
3815
     */
3816
    computeStyle: {
3817
      /** @prop {number} order=850 - Index used to define the order of execution */
3818
      order: 850,
3819
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3820
      enabled: true,
3821
      /** @prop {ModifierFn} */
3822
      fn: computeStyle,
3823
      /**
3824
       * @prop {Boolean} gpuAcceleration=true
3825
       * If true, it uses the CSS 3D transformation to position the popper.
3826
       * Otherwise, it will use the `top` and `left` properties
3827
       */
3828
      gpuAcceleration: true,
3829
      /**
3830
       * @prop {string} [x='bottom']
3831
       * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
3832
       * Change this if your popper should grow in a direction different from `bottom`
3833
       */
3834
      x: 'bottom',
3835
      /**
3836
       * @prop {string} [x='left']
3837
       * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
3838
       * Change this if your popper should grow in a direction different from `right`
3839
       */
3840
      y: 'right'
3841
    },
3842

3843
    /**
3844
     * Applies the computed styles to the popper element.
3845
     *
3846
     * All the DOM manipulations are limited to this modifier. This is useful in case
3847
     * you want to integrate Popper.js inside a framework or view library and you
3848
     * want to delegate all the DOM manipulations to it.
3849
     *
3850
     * Note that if you disable this modifier, you must make sure the popper element
3851
     * has its position set to `absolute` before Popper.js can do its work!
3852
     *
3853
     * Just disable this modifier and define your own to achieve the desired effect.
3854
     *
3855
     * @memberof modifiers
3856
     * @inner
3857
     */
3858
    applyStyle: {
3859
      /** @prop {number} order=900 - Index used to define the order of execution */
3860
      order: 900,
3861
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3862
      enabled: true,
3863
      /** @prop {ModifierFn} */
3864
      fn: applyStyle,
3865
      /** @prop {Function} */
3866
      onLoad: applyStyleOnLoad,
3867
      /**
3868
       * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
3869
       * @prop {Boolean} gpuAcceleration=true
3870
       * If true, it uses the CSS 3D transformation to position the popper.
3871
       * Otherwise, it will use the `top` and `left` properties
3872
       */
3873
      gpuAcceleration: undefined
3874
    }
3875
  };
3876

3877
  /**
3878
   * The `dataObject` is an object containing all the information used by Popper.js.
3879
   * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
3880
   * @name dataObject
3881
   * @property {Object} data.instance The Popper.js instance
3882
   * @property {String} data.placement Placement applied to popper
3883
   * @property {String} data.originalPlacement Placement originally defined on init
3884
   * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
3885
   * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
3886
   * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
3887
   * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
3888
   * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
3889
   * @property {Object} data.boundaries Offsets of the popper boundaries
3890
   * @property {Object} data.offsets The measurements of popper, reference and arrow elements
3891
   * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
3892
   * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
3893
   * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
3894
   */
3895

3896
  /**
3897
   * Default options provided to Popper.js constructor.<br />
3898
   * These can be overridden using the `options` argument of Popper.js.<br />
3899
   * To override an option, simply pass an object with the same
3900
   * structure of the `options` object, as the 3rd argument. For example:
3901
   * ```
3902
   * new Popper(ref, pop, {
3903
   *   modifiers: {
3904
   *     preventOverflow: { enabled: false }
3905
   *   }
3906
   * })
3907
   * ```
3908
   * @type {Object}
3909
   * @static
3910
   * @memberof Popper
3911
   */
3912
  var Defaults = {
3913
    /**
3914
     * Popper's placement.
3915
     * @prop {Popper.placements} placement='bottom'
3916
     */
3917
    placement: 'bottom',
3918

3919
    /**
3920
     * Set this to true if you want popper to position it self in 'fixed' mode
3921
     * @prop {Boolean} positionFixed=false
3922
     */
3923
    positionFixed: false,
3924

3925
    /**
3926
     * Whether events (resize, scroll) are initially enabled.
3927
     * @prop {Boolean} eventsEnabled=true
3928
     */
3929
    eventsEnabled: true,
3930

3931
    /**
3932
     * Set to true if you want to automatically remove the popper when
3933
     * you call the `destroy` method.
3934
     * @prop {Boolean} removeOnDestroy=false
3935
     */
3936
    removeOnDestroy: false,
3937

3938
    /**
3939
     * Callback called when the popper is created.<br />
3940
     * By default, it is set to no-op.<br />
3941
     * Access Popper.js instance with `data.instance`.
3942
     * @prop {onCreate}
3943
     */
3944
    onCreate: function onCreate() {},
3945

3946
    /**
3947
     * Callback called when the popper is updated. This callback is not called
3948
     * on the initialization/creation of the popper, but only on subsequent
3949
     * updates.<br />
3950
     * By default, it is set to no-op.<br />
3951
     * Access Popper.js instance with `data.instance`.
3952
     * @prop {onUpdate}
3953
     */
3954
    onUpdate: function onUpdate() {},
3955

3956
    /**
3957
     * List of modifiers used to modify the offsets before they are applied to the popper.
3958
     * They provide most of the functionalities of Popper.js.
3959
     * @prop {modifiers}
3960
     */
3961
    modifiers: modifiers
3962
  };
3963

3964
  /**
3965
   * @callback onCreate
3966
   * @param {dataObject} data
3967
   */
3968

3969
  /**
3970
   * @callback onUpdate
3971
   * @param {dataObject} data
3972
   */
3973

3974
  // Utils
3975
  // Methods
3976
  var Popper = function () {
3977
    /**
3978
     * Creates a new Popper.js instance.
3979
     * @class Popper
3980
     * @param {Element|referenceObject} reference - The reference element used to position the popper
3981
     * @param {Element} popper - The HTML / XML element used as the popper
3982
     * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
3983
     * @return {Object} instance - The generated Popper.js instance
3984
     */
3985
    function Popper(reference, popper) {
3986
      var _this = this;
3987

3988
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3989
      classCallCheck(this, Popper);
3990

3991
      this.scheduleUpdate = function () {
3992
        return requestAnimationFrame(_this.update);
3993
      };
3994

3995
      // make update() debounced, so that it only runs at most once-per-tick
3996
      this.update = debounce(this.update.bind(this));
3997

3998
      // with {} we create a new object with the options inside it
3999
      this.options = _extends$1({}, Popper.Defaults, options);
4000

4001
      // init state
4002
      this.state = {
4003
        isDestroyed: false,
4004
        isCreated: false,
4005
        scrollParents: []
4006
      };
4007

4008
      // get reference and popper elements (allow jQuery wrappers)
4009
      this.reference = reference && reference.jquery ? reference[0] : reference;
4010
      this.popper = popper && popper.jquery ? popper[0] : popper;
4011

4012
      // Deep merge modifiers options
4013
      this.options.modifiers = {};
4014
      Object.keys(_extends$1({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
4015
        _this.options.modifiers[name] = _extends$1({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
4016
      });
4017

4018
      // Refactoring modifiers' list (Object => Array)
4019
      this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
4020
        return _extends$1({
4021
          name: name
4022
        }, _this.options.modifiers[name]);
4023
      })
4024
      // sort the modifiers by order
4025
      .sort(function (a, b) {
4026
        return a.order - b.order;
4027
      });
4028

4029
      // modifiers have the ability to execute arbitrary code when Popper.js get inited
4030
      // such code is executed in the same order of its modifier
4031
      // they could add new properties to their options configuration
4032
      // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
4033
      this.modifiers.forEach(function (modifierOptions) {
4034
        if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
4035
          modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
4036
        }
4037
      });
4038

4039
      // fire the first update to position the popper in the right place
4040
      this.update();
4041

4042
      var eventsEnabled = this.options.eventsEnabled;
4043
      if (eventsEnabled) {
4044
        // setup event listeners, they will take care of update the position in specific situations
4045
        this.enableEventListeners();
4046
      }
4047

4048
      this.state.eventsEnabled = eventsEnabled;
4049
    }
4050

4051
    // We can't use class properties because they don't get listed in the
4052
    // class prototype and break stuff like Sinon stubs
4053

4054

4055
    createClass(Popper, [{
4056
      key: 'update',
4057
      value: function update$$1() {
4058
        return update.call(this);
4059
      }
4060
    }, {
4061
      key: 'destroy',
4062
      value: function destroy$$1() {
4063
        return destroy.call(this);
4064
      }
4065
    }, {
4066
      key: 'enableEventListeners',
4067
      value: function enableEventListeners$$1() {
4068
        return enableEventListeners.call(this);
4069
      }
4070
    }, {
4071
      key: 'disableEventListeners',
4072
      value: function disableEventListeners$$1() {
4073
        return disableEventListeners.call(this);
4074
      }
4075

4076
      /**
4077
       * Schedules an update. It will run on the next UI update available.
4078
       * @method scheduleUpdate
4079
       * @memberof Popper
4080
       */
4081

4082

4083
      /**
4084
       * Collection of utilities useful when writing custom modifiers.
4085
       * Starting from version 1.7, this method is available only if you
4086
       * include `popper-utils.js` before `popper.js`.
4087
       *
4088
       * **DEPRECATION**: This way to access PopperUtils is deprecated
4089
       * and will be removed in v2! Use the PopperUtils module directly instead.
4090
       * Due to the high instability of the methods contained in Utils, we can't
4091
       * guarantee them to follow semver. Use them at your own risk!
4092
       * @static
4093
       * @private
4094
       * @type {Object}
4095
       * @deprecated since version 1.8
4096
       * @member Utils
4097
       * @memberof Popper
4098
       */
4099

4100
    }]);
4101
    return Popper;
4102
  }();
4103

4104
  /**
4105
   * The `referenceObject` is an object that provides an interface compatible with Popper.js
4106
   * and lets you use it as replacement of a real DOM node.<br />
4107
   * You can use this method to position a popper relatively to a set of coordinates
4108
   * in case you don't have a DOM node to use as reference.
4109
   *
4110
   * ```
4111
   * new Popper(referenceObject, popperNode);
4112
   * ```
4113
   *
4114
   * NB: This feature isn't supported in Internet Explorer 10.
4115
   * @name referenceObject
4116
   * @property {Function} data.getBoundingClientRect
4117
   * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
4118
   * @property {number} data.clientWidth
4119
   * An ES6 getter that will return the width of the virtual reference element.
4120
   * @property {number} data.clientHeight
4121
   * An ES6 getter that will return the height of the virtual reference element.
4122
   */
4123

4124

4125
  Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
4126
  Popper.placements = placements;
4127
  Popper.Defaults = Defaults;
4128

4129
  /**
4130
   * ------------------------------------------------------------------------
4131
   * Constants
4132
   * ------------------------------------------------------------------------
4133
   */
4134

4135
  var NAME$4 = 'dropdown';
4136
  var VERSION$4 = '4.5.2';
4137
  var DATA_KEY$4 = 'bs.dropdown';
4138
  var EVENT_KEY$4 = "." + DATA_KEY$4;
4139
  var DATA_API_KEY$4 = '.data-api';
4140
  var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
4141
  var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
4142

4143
  var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
4144

4145
  var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
4146

4147
  var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
4148

4149
  var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
4150

4151
  var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
4152

4153
  var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
4154
  var EVENT_HIDE$1 = "hide" + EVENT_KEY$4;
4155
  var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4;
4156
  var EVENT_SHOW$1 = "show" + EVENT_KEY$4;
4157
  var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4;
4158
  var EVENT_CLICK = "click" + EVENT_KEY$4;
4159
  var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4;
4160
  var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4;
4161
  var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4;
4162
  var CLASS_NAME_DISABLED = 'disabled';
4163
  var CLASS_NAME_SHOW$2 = 'show';
4164
  var CLASS_NAME_DROPUP = 'dropup';
4165
  var CLASS_NAME_DROPRIGHT = 'dropright';
4166
  var CLASS_NAME_DROPLEFT = 'dropleft';
4167
  var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
4168
  var CLASS_NAME_POSITION_STATIC = 'position-static';
4169
  var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]';
4170
  var SELECTOR_FORM_CHILD = '.dropdown form';
4171
  var SELECTOR_MENU = '.dropdown-menu';
4172
  var SELECTOR_NAVBAR_NAV = '.navbar-nav';
4173
  var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
4174
  var PLACEMENT_TOP = 'top-start';
4175
  var PLACEMENT_TOPEND = 'top-end';
4176
  var PLACEMENT_BOTTOM = 'bottom-start';
4177
  var PLACEMENT_BOTTOMEND = 'bottom-end';
4178
  var PLACEMENT_RIGHT = 'right-start';
4179
  var PLACEMENT_LEFT = 'left-start';
4180
  var Default$2 = {
4181
    offset: 0,
4182
    flip: true,
4183
    boundary: 'scrollParent',
4184
    reference: 'toggle',
4185
    display: 'dynamic',
4186
    popperConfig: null
4187
  };
4188
  var DefaultType$2 = {
4189
    offset: '(number|string|function)',
4190
    flip: 'boolean',
4191
    boundary: '(string|element)',
4192
    reference: '(string|element)',
4193
    display: 'string',
4194
    popperConfig: '(null|object)'
4195
  };
4196
  /**
4197
   * ------------------------------------------------------------------------
4198
   * Class Definition
4199
   * ------------------------------------------------------------------------
4200
   */
4201

4202
  var Dropdown = /*#__PURE__*/function () {
4203
    function Dropdown(element, config) {
4204
      this._element = element;
4205
      this._popper = null;
4206
      this._config = this._getConfig(config);
4207
      this._menu = this._getMenuElement();
4208
      this._inNavbar = this._detectNavbar();
4209

4210
      this._addEventListeners();
4211
    } // Getters
4212

4213

4214
    var _proto = Dropdown.prototype;
4215

4216
    // Public
4217
    _proto.toggle = function toggle() {
4218
      if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED)) {
4219
        return;
4220
      }
4221

4222
      var isActive = $(this._menu).hasClass(CLASS_NAME_SHOW$2);
4223

4224
      Dropdown._clearMenus();
4225

4226
      if (isActive) {
4227
        return;
4228
      }
4229

4230
      this.show(true);
4231
    };
4232

4233
    _proto.show = function show(usePopper) {
4234
      if (usePopper === void 0) {
4235
        usePopper = false;
4236
      }
4237

4238
      if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || $(this._menu).hasClass(CLASS_NAME_SHOW$2)) {
4239
        return;
4240
      }
4241

4242
      var relatedTarget = {
4243
        relatedTarget: this._element
4244
      };
4245
      var showEvent = $.Event(EVENT_SHOW$1, relatedTarget);
4246

4247
      var parent = Dropdown._getParentFromElement(this._element);
4248

4249
      $(parent).trigger(showEvent);
4250

4251
      if (showEvent.isDefaultPrevented()) {
4252
        return;
4253
      } // Disable totally Popper.js for Dropdown in Navbar
4254

4255

4256
      if (!this._inNavbar && usePopper) {
4257
        /**
4258
         * Check for Popper dependency
4259
         * Popper - https://popper.js.org
4260
         */
4261
        if (typeof Popper === 'undefined') {
4262
          throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
4263
        }
4264

4265
        var referenceElement = this._element;
4266

4267
        if (this._config.reference === 'parent') {
4268
          referenceElement = parent;
4269
        } else if (Util.isElement(this._config.reference)) {
4270
          referenceElement = this._config.reference; // Check if it's jQuery element
4271

4272
          if (typeof this._config.reference.jquery !== 'undefined') {
4273
            referenceElement = this._config.reference[0];
4274
          }
4275
        } // If boundary is not `scrollParent`, then set position to `static`
4276
        // to allow the menu to "escape" the scroll parent's boundaries
4277
        // https://github.com/twbs/bootstrap/issues/24251
4278

4279

4280
        if (this._config.boundary !== 'scrollParent') {
4281
          $(parent).addClass(CLASS_NAME_POSITION_STATIC);
4282
        }
4283

4284
        this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
4285
      } // If this is a touch-enabled device we add extra
4286
      // empty mouseover listeners to the body's immediate children;
4287
      // only needed because of broken event delegation on iOS
4288
      // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
4289

4290

4291
      if ('ontouchstart' in document.documentElement && $(parent).closest(SELECTOR_NAVBAR_NAV).length === 0) {
4292
        $(document.body).children().on('mouseover', null, $.noop);
4293
      }
4294

4295
      this._element.focus();
4296

4297
      this._element.setAttribute('aria-expanded', true);
4298

4299
      $(this._menu).toggleClass(CLASS_NAME_SHOW$2);
4300
      $(parent).toggleClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_SHOWN$1, relatedTarget));
4301
    };
4302

4303
    _proto.hide = function hide() {
4304
      if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || !$(this._menu).hasClass(CLASS_NAME_SHOW$2)) {
4305
        return;
4306
      }
4307

4308
      var relatedTarget = {
4309
        relatedTarget: this._element
4310
      };
4311
      var hideEvent = $.Event(EVENT_HIDE$1, relatedTarget);
4312

4313
      var parent = Dropdown._getParentFromElement(this._element);
4314

4315
      $(parent).trigger(hideEvent);
4316

4317
      if (hideEvent.isDefaultPrevented()) {
4318
        return;
4319
      }
4320

4321
      if (this._popper) {
4322
        this._popper.destroy();
4323
      }
4324

4325
      $(this._menu).toggleClass(CLASS_NAME_SHOW$2);
4326
      $(parent).toggleClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_HIDDEN$1, relatedTarget));
4327
    };
4328

4329
    _proto.dispose = function dispose() {
4330
      $.removeData(this._element, DATA_KEY$4);
4331
      $(this._element).off(EVENT_KEY$4);
4332
      this._element = null;
4333
      this._menu = null;
4334

4335
      if (this._popper !== null) {
4336
        this._popper.destroy();
4337

4338
        this._popper = null;
4339
      }
4340
    };
4341

4342
    _proto.update = function update() {
4343
      this._inNavbar = this._detectNavbar();
4344

4345
      if (this._popper !== null) {
4346
        this._popper.scheduleUpdate();
4347
      }
4348
    } // Private
4349
    ;
4350

4351
    _proto._addEventListeners = function _addEventListeners() {
4352
      var _this = this;
4353

4354
      $(this._element).on(EVENT_CLICK, function (event) {
4355
        event.preventDefault();
4356
        event.stopPropagation();
4357

4358
        _this.toggle();
4359
      });
4360
    };
4361

4362
    _proto._getConfig = function _getConfig(config) {
4363
      config = _extends({}, this.constructor.Default, $(this._element).data(), config);
4364
      Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
4365
      return config;
4366
    };
4367

4368
    _proto._getMenuElement = function _getMenuElement() {
4369
      if (!this._menu) {
4370
        var parent = Dropdown._getParentFromElement(this._element);
4371

4372
        if (parent) {
4373
          this._menu = parent.querySelector(SELECTOR_MENU);
4374
        }
4375
      }
4376

4377
      return this._menu;
4378
    };
4379

4380
    _proto._getPlacement = function _getPlacement() {
4381
      var $parentDropdown = $(this._element.parentNode);
4382
      var placement = PLACEMENT_BOTTOM; // Handle dropup
4383

4384
      if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
4385
        placement = $(this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
4386
      } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
4387
        placement = PLACEMENT_RIGHT;
4388
      } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
4389
        placement = PLACEMENT_LEFT;
4390
      } else if ($(this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
4391
        placement = PLACEMENT_BOTTOMEND;
4392
      }
4393

4394
      return placement;
4395
    };
4396

4397
    _proto._detectNavbar = function _detectNavbar() {
4398
      return $(this._element).closest('.navbar').length > 0;
4399
    };
4400

4401
    _proto._getOffset = function _getOffset() {
4402
      var _this2 = this;
4403

4404
      var offset = {};
4405

4406
      if (typeof this._config.offset === 'function') {
4407
        offset.fn = function (data) {
4408
          data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
4409
          return data;
4410
        };
4411
      } else {
4412
        offset.offset = this._config.offset;
4413
      }
4414

4415
      return offset;
4416
    };
4417

4418
    _proto._getPopperConfig = function _getPopperConfig() {
4419
      var popperConfig = {
4420
        placement: this._getPlacement(),
4421
        modifiers: {
4422
          offset: this._getOffset(),
4423
          flip: {
4424
            enabled: this._config.flip
4425
          },
4426
          preventOverflow: {
4427
            boundariesElement: this._config.boundary
4428
          }
4429
        }
4430
      }; // Disable Popper.js if we have a static display
4431

4432
      if (this._config.display === 'static') {
4433
        popperConfig.modifiers.applyStyle = {
4434
          enabled: false
4435
        };
4436
      }
4437

4438
      return _extends({}, popperConfig, this._config.popperConfig);
4439
    } // Static
4440
    ;
4441

4442
    Dropdown._jQueryInterface = function _jQueryInterface(config) {
4443
      return this.each(function () {
4444
        var data = $(this).data(DATA_KEY$4);
4445

4446
        var _config = typeof config === 'object' ? config : null;
4447

4448
        if (!data) {
4449
          data = new Dropdown(this, _config);
4450
          $(this).data(DATA_KEY$4, data);
4451
        }
4452

4453
        if (typeof config === 'string') {
4454
          if (typeof data[config] === 'undefined') {
4455
            throw new TypeError("No method named \"" + config + "\"");
4456
          }
4457

4458
          data[config]();
4459
        }
4460
      });
4461
    };
4462

4463
    Dropdown._clearMenus = function _clearMenus(event) {
4464
      if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
4465
        return;
4466
      }
4467

4468
      var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2));
4469

4470
      for (var i = 0, len = toggles.length; i < len; i++) {
4471
        var parent = Dropdown._getParentFromElement(toggles[i]);
4472

4473
        var context = $(toggles[i]).data(DATA_KEY$4);
4474
        var relatedTarget = {
4475
          relatedTarget: toggles[i]
4476
        };
4477

4478
        if (event && event.type === 'click') {
4479
          relatedTarget.clickEvent = event;
4480
        }
4481

4482
        if (!context) {
4483
          continue;
4484
        }
4485

4486
        var dropdownMenu = context._menu;
4487

4488
        if (!$(parent).hasClass(CLASS_NAME_SHOW$2)) {
4489
          continue;
4490
        }
4491

4492
        if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
4493
          continue;
4494
        }
4495

4496
        var hideEvent = $.Event(EVENT_HIDE$1, relatedTarget);
4497
        $(parent).trigger(hideEvent);
4498

4499
        if (hideEvent.isDefaultPrevented()) {
4500
          continue;
4501
        } // If this is a touch-enabled device we remove the extra
4502
        // empty mouseover listeners we added for iOS support
4503

4504

4505
        if ('ontouchstart' in document.documentElement) {
4506
          $(document.body).children().off('mouseover', null, $.noop);
4507
        }
4508

4509
        toggles[i].setAttribute('aria-expanded', 'false');
4510

4511
        if (context._popper) {
4512
          context._popper.destroy();
4513
        }
4514

4515
        $(dropdownMenu).removeClass(CLASS_NAME_SHOW$2);
4516
        $(parent).removeClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_HIDDEN$1, relatedTarget));
4517
      }
4518
    };
4519

4520
    Dropdown._getParentFromElement = function _getParentFromElement(element) {
4521
      var parent;
4522
      var selector = Util.getSelectorFromElement(element);
4523

4524
      if (selector) {
4525
        parent = document.querySelector(selector);
4526
      }
4527

4528
      return parent || element.parentNode;
4529
    } // eslint-disable-next-line complexity
4530
    ;
4531

4532
    Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
4533
      // If not input/textarea:
4534
      //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
4535
      // If input/textarea:
4536
      //  - If space key => not a dropdown command
4537
      //  - If key is other than escape
4538
      //    - If key is not up or down => not a dropdown command
4539
      //    - If trigger inside the menu => not a dropdown command
4540
      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_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
4541
        return;
4542
      }
4543

4544
      if (this.disabled || $(this).hasClass(CLASS_NAME_DISABLED)) {
4545
        return;
4546
      }
4547

4548
      var parent = Dropdown._getParentFromElement(this);
4549

4550
      var isActive = $(parent).hasClass(CLASS_NAME_SHOW$2);
4551

4552
      if (!isActive && event.which === ESCAPE_KEYCODE) {
4553
        return;
4554
      }
4555

4556
      event.preventDefault();
4557
      event.stopPropagation();
4558

4559
      if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
4560
        if (event.which === ESCAPE_KEYCODE) {
4561
          $(parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus');
4562
        }
4563

4564
        $(this).trigger('click');
4565
        return;
4566
      }
4567

4568
      var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) {
4569
        return $(item).is(':visible');
4570
      });
4571

4572
      if (items.length === 0) {
4573
        return;
4574
      }
4575

4576
      var index = items.indexOf(event.target);
4577

4578
      if (event.which === ARROW_UP_KEYCODE && index > 0) {
4579
        // Up
4580
        index--;
4581
      }
4582

4583
      if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
4584
        // Down
4585
        index++;
4586
      }
4587

4588
      if (index < 0) {
4589
        index = 0;
4590
      }
4591

4592
      items[index].focus();
4593
    };
4594

4595
    _createClass(Dropdown, null, [{
4596
      key: "VERSION",
4597
      get: function get() {
4598
        return VERSION$4;
4599
      }
4600
    }, {
4601
      key: "Default",
4602
      get: function get() {
4603
        return Default$2;
4604
      }
4605
    }, {
4606
      key: "DefaultType",
4607
      get: function get() {
4608
        return DefaultType$2;
4609
      }
4610
    }]);
4611

4612
    return Dropdown;
4613
  }();
4614
  /**
4615
   * ------------------------------------------------------------------------
4616
   * Data Api implementation
4617
   * ------------------------------------------------------------------------
4618
   */
4619

4620

4621
  $(document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$4 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) {
4622
    event.preventDefault();
4623
    event.stopPropagation();
4624

4625
    Dropdown._jQueryInterface.call($(this), 'toggle');
4626
  }).on(EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
4627
    e.stopPropagation();
4628
  });
4629
  /**
4630
   * ------------------------------------------------------------------------
4631
   * jQuery
4632
   * ------------------------------------------------------------------------
4633
   */
4634

4635
  $.fn[NAME$4] = Dropdown._jQueryInterface;
4636
  $.fn[NAME$4].Constructor = Dropdown;
4637

4638
  $.fn[NAME$4].noConflict = function () {
4639
    $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
4640
    return Dropdown._jQueryInterface;
4641
  };
4642

4643
  /**
4644
   * ------------------------------------------------------------------------
4645
   * Constants
4646
   * ------------------------------------------------------------------------
4647
   */
4648

4649
  var NAME$5 = 'modal';
4650
  var VERSION$5 = '4.5.2';
4651
  var DATA_KEY$5 = 'bs.modal';
4652
  var EVENT_KEY$5 = "." + DATA_KEY$5;
4653
  var DATA_API_KEY$5 = '.data-api';
4654
  var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
4655
  var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
4656

4657
  var Default$3 = {
4658
    backdrop: true,
4659
    keyboard: true,
4660
    focus: true,
4661
    show: true
4662
  };
4663
  var DefaultType$3 = {
4664
    backdrop: '(boolean|string)',
4665
    keyboard: 'boolean',
4666
    focus: 'boolean',
4667
    show: 'boolean'
4668
  };
4669
  var EVENT_HIDE$2 = "hide" + EVENT_KEY$5;
4670
  var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5;
4671
  var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5;
4672
  var EVENT_SHOW$2 = "show" + EVENT_KEY$5;
4673
  var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5;
4674
  var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5;
4675
  var EVENT_RESIZE = "resize" + EVENT_KEY$5;
4676
  var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5;
4677
  var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5;
4678
  var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5;
4679
  var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5;
4680
  var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5;
4681
  var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable';
4682
  var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
4683
  var CLASS_NAME_BACKDROP = 'modal-backdrop';
4684
  var CLASS_NAME_OPEN = 'modal-open';
4685
  var CLASS_NAME_FADE$1 = 'fade';
4686
  var CLASS_NAME_SHOW$3 = 'show';
4687
  var CLASS_NAME_STATIC = 'modal-static';
4688
  var SELECTOR_DIALOG = '.modal-dialog';
4689
  var SELECTOR_MODAL_BODY = '.modal-body';
4690
  var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]';
4691
  var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
4692
  var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
4693
  var SELECTOR_STICKY_CONTENT = '.sticky-top';
4694
  /**
4695
   * ------------------------------------------------------------------------
4696
   * Class Definition
4697
   * ------------------------------------------------------------------------
4698
   */
4699

4700
  var Modal = /*#__PURE__*/function () {
4701
    function Modal(element, config) {
4702
      this._config = this._getConfig(config);
4703
      this._element = element;
4704
      this._dialog = element.querySelector(SELECTOR_DIALOG);
4705
      this._backdrop = null;
4706
      this._isShown = false;
4707
      this._isBodyOverflowing = false;
4708
      this._ignoreBackdropClick = false;
4709
      this._isTransitioning = false;
4710
      this._scrollbarWidth = 0;
4711
    } // Getters
4712

4713

4714
    var _proto = Modal.prototype;
4715

4716
    // Public
4717
    _proto.toggle = function toggle(relatedTarget) {
4718
      return this._isShown ? this.hide() : this.show(relatedTarget);
4719
    };
4720

4721
    _proto.show = function show(relatedTarget) {
4722
      var _this = this;
4723

4724
      if (this._isShown || this._isTransitioning) {
4725
        return;
4726
      }
4727

4728
      if ($(this._element).hasClass(CLASS_NAME_FADE$1)) {
4729
        this._isTransitioning = true;
4730
      }
4731

4732
      var showEvent = $.Event(EVENT_SHOW$2, {
4733
        relatedTarget: relatedTarget
4734
      });
4735
      $(this._element).trigger(showEvent);
4736

4737
      if (this._isShown || showEvent.isDefaultPrevented()) {
4738
        return;
4739
      }
4740

4741
      this._isShown = true;
4742

4743
      this._checkScrollbar();
4744

4745
      this._setScrollbar();
4746

4747
      this._adjustDialog();
4748

4749
      this._setEscapeEvent();
4750

4751
      this._setResizeEvent();
4752

4753
      $(this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
4754
        return _this.hide(event);
4755
      });
4756
      $(this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () {
4757
        $(_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) {
4758
          if ($(event.target).is(_this._element)) {
4759
            _this._ignoreBackdropClick = true;
4760
          }
4761
        });
4762
      });
4763

4764
      this._showBackdrop(function () {
4765
        return _this._showElement(relatedTarget);
4766
      });
4767
    };
4768

4769
    _proto.hide = function hide(event) {
4770
      var _this2 = this;
4771

4772
      if (event) {
4773
        event.preventDefault();
4774
      }
4775

4776
      if (!this._isShown || this._isTransitioning) {
4777
        return;
4778
      }
4779

4780
      var hideEvent = $.Event(EVENT_HIDE$2);
4781
      $(this._element).trigger(hideEvent);
4782

4783
      if (!this._isShown || hideEvent.isDefaultPrevented()) {
4784
        return;
4785
      }
4786

4787
      this._isShown = false;
4788
      var transition = $(this._element).hasClass(CLASS_NAME_FADE$1);
4789

4790
      if (transition) {
4791
        this._isTransitioning = true;
4792
      }
4793

4794
      this._setEscapeEvent();
4795

4796
      this._setResizeEvent();
4797

4798
      $(document).off(EVENT_FOCUSIN);
4799
      $(this._element).removeClass(CLASS_NAME_SHOW$3);
4800
      $(this._element).off(EVENT_CLICK_DISMISS);
4801
      $(this._dialog).off(EVENT_MOUSEDOWN_DISMISS);
4802

4803
      if (transition) {
4804
        var transitionDuration = Util.getTransitionDurationFromElement(this._element);
4805
        $(this._element).one(Util.TRANSITION_END, function (event) {
4806
          return _this2._hideModal(event);
4807
        }).emulateTransitionEnd(transitionDuration);
4808
      } else {
4809
        this._hideModal();
4810
      }
4811
    };
4812

4813
    _proto.dispose = function dispose() {
4814
      [window, this._element, this._dialog].forEach(function (htmlElement) {
4815
        return $(htmlElement).off(EVENT_KEY$5);
4816
      });
4817
      /**
4818
       * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
4819
       * Do not move `document` in `htmlElements` array
4820
       * It will remove `EVENT_CLICK_DATA_API` event that should remain
4821
       */
4822

4823
      $(document).off(EVENT_FOCUSIN);
4824
      $.removeData(this._element, DATA_KEY$5);
4825
      this._config = null;
4826
      this._element = null;
4827
      this._dialog = null;
4828
      this._backdrop = null;
4829
      this._isShown = null;
4830
      this._isBodyOverflowing = null;
4831
      this._ignoreBackdropClick = null;
4832
      this._isTransitioning = null;
4833
      this._scrollbarWidth = null;
4834
    };
4835

4836
    _proto.handleUpdate = function handleUpdate() {
4837
      this._adjustDialog();
4838
    } // Private
4839
    ;
4840

4841
    _proto._getConfig = function _getConfig(config) {
4842
      config = _extends({}, Default$3, config);
4843
      Util.typeCheckConfig(NAME$5, config, DefaultType$3);
4844
      return config;
4845
    };
4846

4847
    _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
4848
      var _this3 = this;
4849

4850
      if (this._config.backdrop === 'static') {
4851
        var hideEventPrevented = $.Event(EVENT_HIDE_PREVENTED);
4852
        $(this._element).trigger(hideEventPrevented);
4853

4854
        if (hideEventPrevented.defaultPrevented) {
4855
          return;
4856
        }
4857

4858
        var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
4859

4860
        if (!isModalOverflowing) {
4861
          this._element.style.overflowY = 'hidden';
4862
        }
4863

4864
        this._element.classList.add(CLASS_NAME_STATIC);
4865

4866
        var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog);
4867
        $(this._element).off(Util.TRANSITION_END);
4868
        $(this._element).one(Util.TRANSITION_END, function () {
4869
          _this3._element.classList.remove(CLASS_NAME_STATIC);
4870

4871
          if (!isModalOverflowing) {
4872
            $(_this3._element).one(Util.TRANSITION_END, function () {
4873
              _this3._element.style.overflowY = '';
4874
            }).emulateTransitionEnd(_this3._element, modalTransitionDuration);
4875
          }
4876
        }).emulateTransitionEnd(modalTransitionDuration);
4877

4878
        this._element.focus();
4879
      } else {
4880
        this.hide();
4881
      }
4882
    };
4883

4884
    _proto._showElement = function _showElement(relatedTarget) {
4885
      var _this4 = this;
4886

4887
      var transition = $(this._element).hasClass(CLASS_NAME_FADE$1);
4888
      var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null;
4889

4890
      if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
4891
        // Don't move modal's DOM position
4892
        document.body.appendChild(this._element);
4893
      }
4894

4895
      this._element.style.display = 'block';
4896

4897
      this._element.removeAttribute('aria-hidden');
4898

4899
      this._element.setAttribute('aria-modal', true);
4900

4901
      this._element.setAttribute('role', 'dialog');
4902

4903
      if ($(this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
4904
        modalBody.scrollTop = 0;
4905
      } else {
4906
        this._element.scrollTop = 0;
4907
      }
4908

4909
      if (transition) {
4910
        Util.reflow(this._element);
4911
      }
4912

4913
      $(this._element).addClass(CLASS_NAME_SHOW$3);
4914

4915
      if (this._config.focus) {
4916
        this._enforceFocus();
4917
      }
4918

4919
      var shownEvent = $.Event(EVENT_SHOWN$2, {
4920
        relatedTarget: relatedTarget
4921
      });
4922

4923
      var transitionComplete = function transitionComplete() {
4924
        if (_this4._config.focus) {
4925
          _this4._element.focus();
4926
        }
4927

4928
        _this4._isTransitioning = false;
4929
        $(_this4._element).trigger(shownEvent);
4930
      };
4931

4932
      if (transition) {
4933
        var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
4934
        $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
4935
      } else {
4936
        transitionComplete();
4937
      }
4938
    };
4939

4940
    _proto._enforceFocus = function _enforceFocus() {
4941
      var _this5 = this;
4942

4943
      $(document).off(EVENT_FOCUSIN) // Guard against infinite focus loop
4944
      .on(EVENT_FOCUSIN, function (event) {
4945
        if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
4946
          _this5._element.focus();
4947
        }
4948
      });
4949
    };
4950

4951
    _proto._setEscapeEvent = function _setEscapeEvent() {
4952
      var _this6 = this;
4953

4954
      if (this._isShown) {
4955
        $(this._element).on(EVENT_KEYDOWN_DISMISS, function (event) {
4956
          if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
4957
            event.preventDefault();
4958

4959
            _this6.hide();
4960
          } else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
4961
            _this6._triggerBackdropTransition();
4962
          }
4963
        });
4964
      } else if (!this._isShown) {
4965
        $(this._element).off(EVENT_KEYDOWN_DISMISS);
4966
      }
4967
    };
4968

4969
    _proto._setResizeEvent = function _setResizeEvent() {
4970
      var _this7 = this;
4971

4972
      if (this._isShown) {
4973
        $(window).on(EVENT_RESIZE, function (event) {
4974
          return _this7.handleUpdate(event);
4975
        });
4976
      } else {
4977
        $(window).off(EVENT_RESIZE);
4978
      }
4979
    };
4980

4981
    _proto._hideModal = function _hideModal() {
4982
      var _this8 = this;
4983

4984
      this._element.style.display = 'none';
4985

4986
      this._element.setAttribute('aria-hidden', true);
4987

4988
      this._element.removeAttribute('aria-modal');
4989

4990
      this._element.removeAttribute('role');
4991

4992
      this._isTransitioning = false;
4993

4994
      this._showBackdrop(function () {
4995
        $(document.body).removeClass(CLASS_NAME_OPEN);
4996

4997
        _this8._resetAdjustments();
4998

4999
        _this8._resetScrollbar();
5000

5001
        $(_this8._element).trigger(EVENT_HIDDEN$2);
5002
      });
5003
    };
5004

5005
    _proto._removeBackdrop = function _removeBackdrop() {
5006
      if (this._backdrop) {
5007
        $(this._backdrop).remove();
5008
        this._backdrop = null;
5009
      }
5010
    };
5011

5012
    _proto._showBackdrop = function _showBackdrop(callback) {
5013
      var _this9 = this;
5014

5015
      var animate = $(this._element).hasClass(CLASS_NAME_FADE$1) ? CLASS_NAME_FADE$1 : '';
5016

5017
      if (this._isShown && this._config.backdrop) {
5018
        this._backdrop = document.createElement('div');
5019
        this._backdrop.className = CLASS_NAME_BACKDROP;
5020

5021
        if (animate) {
5022
          this._backdrop.classList.add(animate);
5023
        }
5024

5025
        $(this._backdrop).appendTo(document.body);
5026
        $(this._element).on(EVENT_CLICK_DISMISS, function (event) {
5027
          if (_this9._ignoreBackdropClick) {
5028
            _this9._ignoreBackdropClick = false;
5029
            return;
5030
          }
5031

5032
          if (event.target !== event.currentTarget) {
5033
            return;
5034
          }
5035

5036
          _this9._triggerBackdropTransition();
5037
        });
5038

5039
        if (animate) {
5040
          Util.reflow(this._backdrop);
5041
        }
5042

5043
        $(this._backdrop).addClass(CLASS_NAME_SHOW$3);
5044

5045
        if (!callback) {
5046
          return;
5047
        }
5048

5049
        if (!animate) {
5050
          callback();
5051
          return;
5052
        }
5053

5054
        var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
5055
        $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
5056
      } else if (!this._isShown && this._backdrop) {
5057
        $(this._backdrop).removeClass(CLASS_NAME_SHOW$3);
5058

5059
        var callbackRemove = function callbackRemove() {
5060
          _this9._removeBackdrop();
5061

5062
          if (callback) {
5063
            callback();
5064
          }
5065
        };
5066

5067
        if ($(this._element).hasClass(CLASS_NAME_FADE$1)) {
5068
          var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
5069

5070
          $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
5071
        } else {
5072
          callbackRemove();
5073
        }
5074
      } else if (callback) {
5075
        callback();
5076
      }
5077
    } // ----------------------------------------------------------------------
5078
    // the following methods are used to handle overflowing modals
5079
    // todo (fat): these should probably be refactored out of modal.js
5080
    // ----------------------------------------------------------------------
5081
    ;
5082

5083
    _proto._adjustDialog = function _adjustDialog() {
5084
      var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
5085

5086
      if (!this._isBodyOverflowing && isModalOverflowing) {
5087
        this._element.style.paddingLeft = this._scrollbarWidth + "px";
5088
      }
5089

5090
      if (this._isBodyOverflowing && !isModalOverflowing) {
5091
        this._element.style.paddingRight = this._scrollbarWidth + "px";
5092
      }
5093
    };
5094

5095
    _proto._resetAdjustments = function _resetAdjustments() {
5096
      this._element.style.paddingLeft = '';
5097
      this._element.style.paddingRight = '';
5098
    };
5099

5100
    _proto._checkScrollbar = function _checkScrollbar() {
5101
      var rect = document.body.getBoundingClientRect();
5102
      this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
5103
      this._scrollbarWidth = this._getScrollbarWidth();
5104
    };
5105

5106
    _proto._setScrollbar = function _setScrollbar() {
5107
      var _this10 = this;
5108

5109
      if (this._isBodyOverflowing) {
5110
        // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
5111
        //   while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
5112
        var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
5113
        var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding
5114

5115
        $(fixedContent).each(function (index, element) {
5116
          var actualPadding = element.style.paddingRight;
5117
          var calculatedPadding = $(element).css('padding-right');
5118
          $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
5119
        }); // Adjust sticky content margin
5120

5121
        $(stickyContent).each(function (index, element) {
5122
          var actualMargin = element.style.marginRight;
5123
          var calculatedMargin = $(element).css('margin-right');
5124
          $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
5125
        }); // Adjust body padding
5126

5127
        var actualPadding = document.body.style.paddingRight;
5128
        var calculatedPadding = $(document.body).css('padding-right');
5129
        $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
5130
      }
5131

5132
      $(document.body).addClass(CLASS_NAME_OPEN);
5133
    };
5134

5135
    _proto._resetScrollbar = function _resetScrollbar() {
5136
      // Restore fixed content padding
5137
      var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
5138
      $(fixedContent).each(function (index, element) {
5139
        var padding = $(element).data('padding-right');
5140
        $(element).removeData('padding-right');
5141
        element.style.paddingRight = padding ? padding : '';
5142
      }); // Restore sticky content
5143

5144
      var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT));
5145
      $(elements).each(function (index, element) {
5146
        var margin = $(element).data('margin-right');
5147

5148
        if (typeof margin !== 'undefined') {
5149
          $(element).css('margin-right', margin).removeData('margin-right');
5150
        }
5151
      }); // Restore body padding
5152

5153
      var padding = $(document.body).data('padding-right');
5154
      $(document.body).removeData('padding-right');
5155
      document.body.style.paddingRight = padding ? padding : '';
5156
    };
5157

5158
    _proto._getScrollbarWidth = function _getScrollbarWidth() {
5159
      // thx d.walsh
5160
      var scrollDiv = document.createElement('div');
5161
      scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
5162
      document.body.appendChild(scrollDiv);
5163
      var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
5164
      document.body.removeChild(scrollDiv);
5165
      return scrollbarWidth;
5166
    } // Static
5167
    ;
5168

5169
    Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
5170
      return this.each(function () {
5171
        var data = $(this).data(DATA_KEY$5);
5172

5173
        var _config = _extends({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {});
5174

5175
        if (!data) {
5176
          data = new Modal(this, _config);
5177
          $(this).data(DATA_KEY$5, data);
5178
        }
5179

5180
        if (typeof config === 'string') {
5181
          if (typeof data[config] === 'undefined') {
5182
            throw new TypeError("No method named \"" + config + "\"");
5183
          }
5184

5185
          data[config](relatedTarget);
5186
        } else if (_config.show) {
5187
          data.show(relatedTarget);
5188
        }
5189
      });
5190
    };
5191

5192
    _createClass(Modal, null, [{
5193
      key: "VERSION",
5194
      get: function get() {
5195
        return VERSION$5;
5196
      }
5197
    }, {
5198
      key: "Default",
5199
      get: function get() {
5200
        return Default$3;
5201
      }
5202
    }]);
5203

5204
    return Modal;
5205
  }();
5206
  /**
5207
   * ------------------------------------------------------------------------
5208
   * Data Api implementation
5209
   * ------------------------------------------------------------------------
5210
   */
5211

5212

5213
  $(document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
5214
    var _this11 = this;
5215

5216
    var target;
5217
    var selector = Util.getSelectorFromElement(this);
5218

5219
    if (selector) {
5220
      target = document.querySelector(selector);
5221
    }
5222

5223
    var config = $(target).data(DATA_KEY$5) ? 'toggle' : _extends({}, $(target).data(), $(this).data());
5224

5225
    if (this.tagName === 'A' || this.tagName === 'AREA') {
5226
      event.preventDefault();
5227
    }
5228

5229
    var $target = $(target).one(EVENT_SHOW$2, function (showEvent) {
5230
      if (showEvent.isDefaultPrevented()) {
5231
        // Only register focus restorer if modal will actually get shown
5232
        return;
5233
      }
5234

5235
      $target.one(EVENT_HIDDEN$2, function () {
5236
        if ($(_this11).is(':visible')) {
5237
          _this11.focus();
5238
        }
5239
      });
5240
    });
5241

5242
    Modal._jQueryInterface.call($(target), config, this);
5243
  });
5244
  /**
5245
   * ------------------------------------------------------------------------
5246
   * jQuery
5247
   * ------------------------------------------------------------------------
5248
   */
5249

5250
  $.fn[NAME$5] = Modal._jQueryInterface;
5251
  $.fn[NAME$5].Constructor = Modal;
5252

5253
  $.fn[NAME$5].noConflict = function () {
5254
    $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
5255
    return Modal._jQueryInterface;
5256
  };
5257

5258
  /**
5259
   * --------------------------------------------------------------------------
5260
   * Bootstrap (v4.5.2): tools/sanitizer.js
5261
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5262
   * --------------------------------------------------------------------------
5263
   */
5264
  var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
5265
  var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
5266
  var DefaultWhitelist = {
5267
    // Global attributes allowed on any supplied element below.
5268
    '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
5269
    a: ['target', 'href', 'title', 'rel'],
5270
    area: [],
5271
    b: [],
5272
    br: [],
5273
    col: [],
5274
    code: [],
5275
    div: [],
5276
    em: [],
5277
    hr: [],
5278
    h1: [],
5279
    h2: [],
5280
    h3: [],
5281
    h4: [],
5282
    h5: [],
5283
    h6: [],
5284
    i: [],
5285
    img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
5286
    li: [],
5287
    ol: [],
5288
    p: [],
5289
    pre: [],
5290
    s: [],
5291
    small: [],
5292
    span: [],
5293
    sub: [],
5294
    sup: [],
5295
    strong: [],
5296
    u: [],
5297
    ul: []
5298
  };
5299
  /**
5300
   * A pattern that recognizes a commonly useful subset of URLs that are safe.
5301
   *
5302
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
5303
   */
5304

5305
  var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
5306
  /**
5307
   * A pattern that matches safe data URLs. Only matches image, video and audio types.
5308
   *
5309
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
5310
   */
5311

5312
  var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
5313

5314
  function allowedAttribute(attr, allowedAttributeList) {
5315
    var attrName = attr.nodeName.toLowerCase();
5316

5317
    if (allowedAttributeList.indexOf(attrName) !== -1) {
5318
      if (uriAttrs.indexOf(attrName) !== -1) {
5319
        return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
5320
      }
5321

5322
      return true;
5323
    }
5324

5325
    var regExp = allowedAttributeList.filter(function (attrRegex) {
5326
      return attrRegex instanceof RegExp;
5327
    }); // Check if a regular expression validates the attribute.
5328

5329
    for (var i = 0, len = regExp.length; i < len; i++) {
5330
      if (attrName.match(regExp[i])) {
5331
        return true;
5332
      }
5333
    }
5334

5335
    return false;
5336
  }
5337

5338
  function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
5339
    if (unsafeHtml.length === 0) {
5340
      return unsafeHtml;
5341
    }
5342

5343
    if (sanitizeFn && typeof sanitizeFn === 'function') {
5344
      return sanitizeFn(unsafeHtml);
5345
    }
5346

5347
    var domParser = new window.DOMParser();
5348
    var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
5349
    var whitelistKeys = Object.keys(whiteList);
5350
    var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
5351

5352
    var _loop = function _loop(i, len) {
5353
      var el = elements[i];
5354
      var elName = el.nodeName.toLowerCase();
5355

5356
      if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
5357
        el.parentNode.removeChild(el);
5358
        return "continue";
5359
      }
5360

5361
      var attributeList = [].slice.call(el.attributes);
5362
      var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
5363
      attributeList.forEach(function (attr) {
5364
        if (!allowedAttribute(attr, whitelistedAttributes)) {
5365
          el.removeAttribute(attr.nodeName);
5366
        }
5367
      });
5368
    };
5369

5370
    for (var i = 0, len = elements.length; i < len; i++) {
5371
      var _ret = _loop(i);
5372

5373
      if (_ret === "continue") continue;
5374
    }
5375

5376
    return createdDocument.body.innerHTML;
5377
  }
5378

5379
  /**
5380
   * ------------------------------------------------------------------------
5381
   * Constants
5382
   * ------------------------------------------------------------------------
5383
   */
5384

5385
  var NAME$6 = 'tooltip';
5386
  var VERSION$6 = '4.5.2';
5387
  var DATA_KEY$6 = 'bs.tooltip';
5388
  var EVENT_KEY$6 = "." + DATA_KEY$6;
5389
  var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
5390
  var CLASS_PREFIX = 'bs-tooltip';
5391
  var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
5392
  var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
5393
  var DefaultType$4 = {
5394
    animation: 'boolean',
5395
    template: 'string',
5396
    title: '(string|element|function)',
5397
    trigger: 'string',
5398
    delay: '(number|object)',
5399
    html: 'boolean',
5400
    selector: '(string|boolean)',
5401
    placement: '(string|function)',
5402
    offset: '(number|string|function)',
5403
    container: '(string|element|boolean)',
5404
    fallbackPlacement: '(string|array)',
5405
    boundary: '(string|element)',
5406
    sanitize: 'boolean',
5407
    sanitizeFn: '(null|function)',
5408
    whiteList: 'object',
5409
    popperConfig: '(null|object)'
5410
  };
5411
  var AttachmentMap = {
5412
    AUTO: 'auto',
5413
    TOP: 'top',
5414
    RIGHT: 'right',
5415
    BOTTOM: 'bottom',
5416
    LEFT: 'left'
5417
  };
5418
  var Default$4 = {
5419
    animation: true,
5420
    template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
5421
    trigger: 'hover focus',
5422
    title: '',
5423
    delay: 0,
5424
    html: false,
5425
    selector: false,
5426
    placement: 'top',
5427
    offset: 0,
5428
    container: false,
5429
    fallbackPlacement: 'flip',
5430
    boundary: 'scrollParent',
5431
    sanitize: true,
5432
    sanitizeFn: null,
5433
    whiteList: DefaultWhitelist,
5434
    popperConfig: null
5435
  };
5436
  var HOVER_STATE_SHOW = 'show';
5437
  var HOVER_STATE_OUT = 'out';
5438
  var Event = {
5439
    HIDE: "hide" + EVENT_KEY$6,
5440
    HIDDEN: "hidden" + EVENT_KEY$6,
5441
    SHOW: "show" + EVENT_KEY$6,
5442
    SHOWN: "shown" + EVENT_KEY$6,
5443
    INSERTED: "inserted" + EVENT_KEY$6,
5444
    CLICK: "click" + EVENT_KEY$6,
5445
    FOCUSIN: "focusin" + EVENT_KEY$6,
5446
    FOCUSOUT: "focusout" + EVENT_KEY$6,
5447
    MOUSEENTER: "mouseenter" + EVENT_KEY$6,
5448
    MOUSELEAVE: "mouseleave" + EVENT_KEY$6
5449
  };
5450
  var CLASS_NAME_FADE$2 = 'fade';
5451
  var CLASS_NAME_SHOW$4 = 'show';
5452
  var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
5453
  var SELECTOR_ARROW = '.arrow';
5454
  var TRIGGER_HOVER = 'hover';
5455
  var TRIGGER_FOCUS = 'focus';
5456
  var TRIGGER_CLICK = 'click';
5457
  var TRIGGER_MANUAL = 'manual';
5458
  /**
5459
   * ------------------------------------------------------------------------
5460
   * Class Definition
5461
   * ------------------------------------------------------------------------
5462
   */
5463

5464
  var Tooltip = /*#__PURE__*/function () {
5465
    function Tooltip(element, config) {
5466
      if (typeof Popper === 'undefined') {
5467
        throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
5468
      } // private
5469

5470

5471
      this._isEnabled = true;
5472
      this._timeout = 0;
5473
      this._hoverState = '';
5474
      this._activeTrigger = {};
5475
      this._popper = null; // Protected
5476

5477
      this.element = element;
5478
      this.config = this._getConfig(config);
5479
      this.tip = null;
5480

5481
      this._setListeners();
5482
    } // Getters
5483

5484

5485
    var _proto = Tooltip.prototype;
5486

5487
    // Public
5488
    _proto.enable = function enable() {
5489
      this._isEnabled = true;
5490
    };
5491

5492
    _proto.disable = function disable() {
5493
      this._isEnabled = false;
5494
    };
5495

5496
    _proto.toggleEnabled = function toggleEnabled() {
5497
      this._isEnabled = !this._isEnabled;
5498
    };
5499

5500
    _proto.toggle = function toggle(event) {
5501
      if (!this._isEnabled) {
5502
        return;
5503
      }
5504

5505
      if (event) {
5506
        var dataKey = this.constructor.DATA_KEY;
5507
        var context = $(event.currentTarget).data(dataKey);
5508

5509
        if (!context) {
5510
          context = new this.constructor(event.currentTarget, this._getDelegateConfig());
5511
          $(event.currentTarget).data(dataKey, context);
5512
        }
5513

5514
        context._activeTrigger.click = !context._activeTrigger.click;
5515

5516
        if (context._isWithActiveTrigger()) {
5517
          context._enter(null, context);
5518
        } else {
5519
          context._leave(null, context);
5520
        }
5521
      } else {
5522
        if ($(this.getTipElement()).hasClass(CLASS_NAME_SHOW$4)) {
5523
          this._leave(null, this);
5524

5525
          return;
5526
        }
5527

5528
        this._enter(null, this);
5529
      }
5530
    };
5531

5532
    _proto.dispose = function dispose() {
5533
      clearTimeout(this._timeout);
5534
      $.removeData(this.element, this.constructor.DATA_KEY);
5535
      $(this.element).off(this.constructor.EVENT_KEY);
5536
      $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
5537

5538
      if (this.tip) {
5539
        $(this.tip).remove();
5540
      }
5541

5542
      this._isEnabled = null;
5543
      this._timeout = null;
5544
      this._hoverState = null;
5545
      this._activeTrigger = null;
5546

5547
      if (this._popper) {
5548
        this._popper.destroy();
5549
      }
5550

5551
      this._popper = null;
5552
      this.element = null;
5553
      this.config = null;
5554
      this.tip = null;
5555
    };
5556

5557
    _proto.show = function show() {
5558
      var _this = this;
5559

5560
      if ($(this.element).css('display') === 'none') {
5561
        throw new Error('Please use show on visible elements');
5562
      }
5563

5564
      var showEvent = $.Event(this.constructor.Event.SHOW);
5565

5566
      if (this.isWithContent() && this._isEnabled) {
5567
        $(this.element).trigger(showEvent);
5568
        var shadowRoot = Util.findShadowRoot(this.element);
5569
        var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
5570

5571
        if (showEvent.isDefaultPrevented() || !isInTheDom) {
5572
          return;
5573
        }
5574

5575
        var tip = this.getTipElement();
5576
        var tipId = Util.getUID(this.constructor.NAME);
5577
        tip.setAttribute('id', tipId);
5578
        this.element.setAttribute('aria-describedby', tipId);
5579
        this.setContent();
5580

5581
        if (this.config.animation) {
5582
          $(tip).addClass(CLASS_NAME_FADE$2);
5583
        }
5584

5585
        var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
5586

5587
        var attachment = this._getAttachment(placement);
5588

5589
        this.addAttachmentClass(attachment);
5590

5591
        var container = this._getContainer();
5592

5593
        $(tip).data(this.constructor.DATA_KEY, this);
5594

5595
        if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
5596
          $(tip).appendTo(container);
5597
        }
5598

5599
        $(this.element).trigger(this.constructor.Event.INSERTED);
5600
        this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
5601
        $(tip).addClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we add extra
5602
        // empty mouseover listeners to the body's immediate children;
5603
        // only needed because of broken event delegation on iOS
5604
        // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
5605

5606
        if ('ontouchstart' in document.documentElement) {
5607
          $(document.body).children().on('mouseover', null, $.noop);
5608
        }
5609

5610
        var complete = function complete() {
5611
          if (_this.config.animation) {
5612
            _this._fixTransition();
5613
          }
5614

5615
          var prevHoverState = _this._hoverState;
5616
          _this._hoverState = null;
5617
          $(_this.element).trigger(_this.constructor.Event.SHOWN);
5618

5619
          if (prevHoverState === HOVER_STATE_OUT) {
5620
            _this._leave(null, _this);
5621
          }
5622
        };
5623

5624
        if ($(this.tip).hasClass(CLASS_NAME_FADE$2)) {
5625
          var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
5626
          $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
5627
        } else {
5628
          complete();
5629
        }
5630
      }
5631
    };
5632

5633
    _proto.hide = function hide(callback) {
5634
      var _this2 = this;
5635

5636
      var tip = this.getTipElement();
5637
      var hideEvent = $.Event(this.constructor.Event.HIDE);
5638

5639
      var complete = function complete() {
5640
        if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
5641
          tip.parentNode.removeChild(tip);
5642
        }
5643

5644
        _this2._cleanTipClass();
5645

5646
        _this2.element.removeAttribute('aria-describedby');
5647

5648
        $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
5649

5650
        if (_this2._popper !== null) {
5651
          _this2._popper.destroy();
5652
        }
5653

5654
        if (callback) {
5655
          callback();
5656
        }
5657
      };
5658

5659
      $(this.element).trigger(hideEvent);
5660

5661
      if (hideEvent.isDefaultPrevented()) {
5662
        return;
5663
      }
5664

5665
      $(tip).removeClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we remove the extra
5666
      // empty mouseover listeners we added for iOS support
5667

5668
      if ('ontouchstart' in document.documentElement) {
5669
        $(document.body).children().off('mouseover', null, $.noop);
5670
      }
5671

5672
      this._activeTrigger[TRIGGER_CLICK] = false;
5673
      this._activeTrigger[TRIGGER_FOCUS] = false;
5674
      this._activeTrigger[TRIGGER_HOVER] = false;
5675

5676
      if ($(this.tip).hasClass(CLASS_NAME_FADE$2)) {
5677
        var transitionDuration = Util.getTransitionDurationFromElement(tip);
5678
        $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
5679
      } else {
5680
        complete();
5681
      }
5682

5683
      this._hoverState = '';
5684
    };
5685

5686
    _proto.update = function update() {
5687
      if (this._popper !== null) {
5688
        this._popper.scheduleUpdate();
5689
      }
5690
    } // Protected
5691
    ;
5692

5693
    _proto.isWithContent = function isWithContent() {
5694
      return Boolean(this.getTitle());
5695
    };
5696

5697
    _proto.addAttachmentClass = function addAttachmentClass(attachment) {
5698
      $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
5699
    };
5700

5701
    _proto.getTipElement = function getTipElement() {
5702
      this.tip = this.tip || $(this.config.template)[0];
5703
      return this.tip;
5704
    };
5705

5706
    _proto.setContent = function setContent() {
5707
      var tip = this.getTipElement();
5708
      this.setElementContent($(tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle());
5709
      $(tip).removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$4);
5710
    };
5711

5712
    _proto.setElementContent = function setElementContent($element, content) {
5713
      if (typeof content === 'object' && (content.nodeType || content.jquery)) {
5714
        // Content is a DOM node or a jQuery
5715
        if (this.config.html) {
5716
          if (!$(content).parent().is($element)) {
5717
            $element.empty().append(content);
5718
          }
5719
        } else {
5720
          $element.text($(content).text());
5721
        }
5722

5723
        return;
5724
      }
5725

5726
      if (this.config.html) {
5727
        if (this.config.sanitize) {
5728
          content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
5729
        }
5730

5731
        $element.html(content);
5732
      } else {
5733
        $element.text(content);
5734
      }
5735
    };
5736

5737
    _proto.getTitle = function getTitle() {
5738
      var title = this.element.getAttribute('data-original-title');
5739

5740
      if (!title) {
5741
        title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
5742
      }
5743

5744
      return title;
5745
    } // Private
5746
    ;
5747

5748
    _proto._getPopperConfig = function _getPopperConfig(attachment) {
5749
      var _this3 = this;
5750

5751
      var defaultBsConfig = {
5752
        placement: attachment,
5753
        modifiers: {
5754
          offset: this._getOffset(),
5755
          flip: {
5756
            behavior: this.config.fallbackPlacement
5757
          },
5758
          arrow: {
5759
            element: SELECTOR_ARROW
5760
          },
5761
          preventOverflow: {
5762
            boundariesElement: this.config.boundary
5763
          }
5764
        },
5765
        onCreate: function onCreate(data) {
5766
          if (data.originalPlacement !== data.placement) {
5767
            _this3._handlePopperPlacementChange(data);
5768
          }
5769
        },
5770
        onUpdate: function onUpdate(data) {
5771
          return _this3._handlePopperPlacementChange(data);
5772
        }
5773
      };
5774
      return _extends({}, defaultBsConfig, this.config.popperConfig);
5775
    };
5776

5777
    _proto._getOffset = function _getOffset() {
5778
      var _this4 = this;
5779

5780
      var offset = {};
5781

5782
      if (typeof this.config.offset === 'function') {
5783
        offset.fn = function (data) {
5784
          data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
5785
          return data;
5786
        };
5787
      } else {
5788
        offset.offset = this.config.offset;
5789
      }
5790

5791
      return offset;
5792
    };
5793

5794
    _proto._getContainer = function _getContainer() {
5795
      if (this.config.container === false) {
5796
        return document.body;
5797
      }
5798

5799
      if (Util.isElement(this.config.container)) {
5800
        return $(this.config.container);
5801
      }
5802

5803
      return $(document).find(this.config.container);
5804
    };
5805

5806
    _proto._getAttachment = function _getAttachment(placement) {
5807
      return AttachmentMap[placement.toUpperCase()];
5808
    };
5809

5810
    _proto._setListeners = function _setListeners() {
5811
      var _this5 = this;
5812

5813
      var triggers = this.config.trigger.split(' ');
5814
      triggers.forEach(function (trigger) {
5815
        if (trigger === 'click') {
5816
          $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
5817
            return _this5.toggle(event);
5818
          });
5819
        } else if (trigger !== TRIGGER_MANUAL) {
5820
          var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
5821
          var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
5822
          $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
5823
            return _this5._enter(event);
5824
          }).on(eventOut, _this5.config.selector, function (event) {
5825
            return _this5._leave(event);
5826
          });
5827
        }
5828
      });
5829

5830
      this._hideModalHandler = function () {
5831
        if (_this5.element) {
5832
          _this5.hide();
5833
        }
5834
      };
5835

5836
      $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
5837

5838
      if (this.config.selector) {
5839
        this.config = _extends({}, this.config, {
5840
          trigger: 'manual',
5841
          selector: ''
5842
        });
5843
      } else {
5844
        this._fixTitle();
5845
      }
5846
    };
5847

5848
    _proto._fixTitle = function _fixTitle() {
5849
      var titleType = typeof this.element.getAttribute('data-original-title');
5850

5851
      if (this.element.getAttribute('title') || titleType !== 'string') {
5852
        this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
5853
        this.element.setAttribute('title', '');
5854
      }
5855
    };
5856

5857
    _proto._enter = function _enter(event, context) {
5858
      var dataKey = this.constructor.DATA_KEY;
5859
      context = context || $(event.currentTarget).data(dataKey);
5860

5861
      if (!context) {
5862
        context = new this.constructor(event.currentTarget, this._getDelegateConfig());
5863
        $(event.currentTarget).data(dataKey, context);
5864
      }
5865

5866
      if (event) {
5867
        context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
5868
      }
5869

5870
      if ($(context.getTipElement()).hasClass(CLASS_NAME_SHOW$4) || context._hoverState === HOVER_STATE_SHOW) {
5871
        context._hoverState = HOVER_STATE_SHOW;
5872
        return;
5873
      }
5874

5875
      clearTimeout(context._timeout);
5876
      context._hoverState = HOVER_STATE_SHOW;
5877

5878
      if (!context.config.delay || !context.config.delay.show) {
5879
        context.show();
5880
        return;
5881
      }
5882

5883
      context._timeout = setTimeout(function () {
5884
        if (context._hoverState === HOVER_STATE_SHOW) {
5885
          context.show();
5886
        }
5887
      }, context.config.delay.show);
5888
    };
5889

5890
    _proto._leave = function _leave(event, context) {
5891
      var dataKey = this.constructor.DATA_KEY;
5892
      context = context || $(event.currentTarget).data(dataKey);
5893

5894
      if (!context) {
5895
        context = new this.constructor(event.currentTarget, this._getDelegateConfig());
5896
        $(event.currentTarget).data(dataKey, context);
5897
      }
5898

5899
      if (event) {
5900
        context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
5901
      }
5902

5903
      if (context._isWithActiveTrigger()) {
5904
        return;
5905
      }
5906

5907
      clearTimeout(context._timeout);
5908
      context._hoverState = HOVER_STATE_OUT;
5909

5910
      if (!context.config.delay || !context.config.delay.hide) {
5911
        context.hide();
5912
        return;
5913
      }
5914

5915
      context._timeout = setTimeout(function () {
5916
        if (context._hoverState === HOVER_STATE_OUT) {
5917
          context.hide();
5918
        }
5919
      }, context.config.delay.hide);
5920
    };
5921

5922
    _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
5923
      for (var trigger in this._activeTrigger) {
5924
        if (this._activeTrigger[trigger]) {
5925
          return true;
5926
        }
5927
      }
5928

5929
      return false;
5930
    };
5931

5932
    _proto._getConfig = function _getConfig(config) {
5933
      var dataAttributes = $(this.element).data();
5934
      Object.keys(dataAttributes).forEach(function (dataAttr) {
5935
        if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
5936
          delete dataAttributes[dataAttr];
5937
        }
5938
      });
5939
      config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
5940

5941
      if (typeof config.delay === 'number') {
5942
        config.delay = {
5943
          show: config.delay,
5944
          hide: config.delay
5945
        };
5946
      }
5947

5948
      if (typeof config.title === 'number') {
5949
        config.title = config.title.toString();
5950
      }
5951

5952
      if (typeof config.content === 'number') {
5953
        config.content = config.content.toString();
5954
      }
5955

5956
      Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
5957

5958
      if (config.sanitize) {
5959
        config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
5960
      }
5961

5962
      return config;
5963
    };
5964

5965
    _proto._getDelegateConfig = function _getDelegateConfig() {
5966
      var config = {};
5967

5968
      if (this.config) {
5969
        for (var key in this.config) {
5970
          if (this.constructor.Default[key] !== this.config[key]) {
5971
            config[key] = this.config[key];
5972
          }
5973
        }
5974
      }
5975

5976
      return config;
5977
    };
5978

5979
    _proto._cleanTipClass = function _cleanTipClass() {
5980
      var $tip = $(this.getTipElement());
5981
      var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
5982

5983
      if (tabClass !== null && tabClass.length) {
5984
        $tip.removeClass(tabClass.join(''));
5985
      }
5986
    };
5987

5988
    _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
5989
      this.tip = popperData.instance.popper;
5990

5991
      this._cleanTipClass();
5992

5993
      this.addAttachmentClass(this._getAttachment(popperData.placement));
5994
    };
5995

5996
    _proto._fixTransition = function _fixTransition() {
5997
      var tip = this.getTipElement();
5998
      var initConfigAnimation = this.config.animation;
5999

6000
      if (tip.getAttribute('x-placement') !== null) {
6001
        return;
6002
      }
6003

6004
      $(tip).removeClass(CLASS_NAME_FADE$2);
6005
      this.config.animation = false;
6006
      this.hide();
6007
      this.show();
6008
      this.config.animation = initConfigAnimation;
6009
    } // Static
6010
    ;
6011

6012
    Tooltip._jQueryInterface = function _jQueryInterface(config) {
6013
      return this.each(function () {
6014
        var data = $(this).data(DATA_KEY$6);
6015

6016
        var _config = typeof config === 'object' && config;
6017

6018
        if (!data && /dispose|hide/.test(config)) {
6019
          return;
6020
        }
6021

6022
        if (!data) {
6023
          data = new Tooltip(this, _config);
6024
          $(this).data(DATA_KEY$6, data);
6025
        }
6026

6027
        if (typeof config === 'string') {
6028
          if (typeof data[config] === 'undefined') {
6029
            throw new TypeError("No method named \"" + config + "\"");
6030
          }
6031

6032
          data[config]();
6033
        }
6034
      });
6035
    };
6036

6037
    _createClass(Tooltip, null, [{
6038
      key: "VERSION",
6039
      get: function get() {
6040
        return VERSION$6;
6041
      }
6042
    }, {
6043
      key: "Default",
6044
      get: function get() {
6045
        return Default$4;
6046
      }
6047
    }, {
6048
      key: "NAME",
6049
      get: function get() {
6050
        return NAME$6;
6051
      }
6052
    }, {
6053
      key: "DATA_KEY",
6054
      get: function get() {
6055
        return DATA_KEY$6;
6056
      }
6057
    }, {
6058
      key: "Event",
6059
      get: function get() {
6060
        return Event;
6061
      }
6062
    }, {
6063
      key: "EVENT_KEY",
6064
      get: function get() {
6065
        return EVENT_KEY$6;
6066
      }
6067
    }, {
6068
      key: "DefaultType",
6069
      get: function get() {
6070
        return DefaultType$4;
6071
      }
6072
    }]);
6073

6074
    return Tooltip;
6075
  }();
6076
  /**
6077
   * ------------------------------------------------------------------------
6078
   * jQuery
6079
   * ------------------------------------------------------------------------
6080
   */
6081

6082

6083
  $.fn[NAME$6] = Tooltip._jQueryInterface;
6084
  $.fn[NAME$6].Constructor = Tooltip;
6085

6086
  $.fn[NAME$6].noConflict = function () {
6087
    $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
6088
    return Tooltip._jQueryInterface;
6089
  };
6090

6091
  /**
6092
   * ------------------------------------------------------------------------
6093
   * Constants
6094
   * ------------------------------------------------------------------------
6095
   */
6096

6097
  var NAME$7 = 'popover';
6098
  var VERSION$7 = '4.5.2';
6099
  var DATA_KEY$7 = 'bs.popover';
6100
  var EVENT_KEY$7 = "." + DATA_KEY$7;
6101
  var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
6102
  var CLASS_PREFIX$1 = 'bs-popover';
6103
  var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
6104

6105
  var Default$5 = _extends({}, Tooltip.Default, {
6106
    placement: 'right',
6107
    trigger: 'click',
6108
    content: '',
6109
    template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
6110
  });
6111

6112
  var DefaultType$5 = _extends({}, Tooltip.DefaultType, {
6113
    content: '(string|element|function)'
6114
  });
6115

6116
  var CLASS_NAME_FADE$3 = 'fade';
6117
  var CLASS_NAME_SHOW$5 = 'show';
6118
  var SELECTOR_TITLE = '.popover-header';
6119
  var SELECTOR_CONTENT = '.popover-body';
6120
  var Event$1 = {
6121
    HIDE: "hide" + EVENT_KEY$7,
6122
    HIDDEN: "hidden" + EVENT_KEY$7,
6123
    SHOW: "show" + EVENT_KEY$7,
6124
    SHOWN: "shown" + EVENT_KEY$7,
6125
    INSERTED: "inserted" + EVENT_KEY$7,
6126
    CLICK: "click" + EVENT_KEY$7,
6127
    FOCUSIN: "focusin" + EVENT_KEY$7,
6128
    FOCUSOUT: "focusout" + EVENT_KEY$7,
6129
    MOUSEENTER: "mouseenter" + EVENT_KEY$7,
6130
    MOUSELEAVE: "mouseleave" + EVENT_KEY$7
6131
  };
6132
  /**
6133
   * ------------------------------------------------------------------------
6134
   * Class Definition
6135
   * ------------------------------------------------------------------------
6136
   */
6137

6138
  var Popover = /*#__PURE__*/function (_Tooltip) {
6139
    _inheritsLoose(Popover, _Tooltip);
6140

6141
    function Popover() {
6142
      return _Tooltip.apply(this, arguments) || this;
6143
    }
6144

6145
    var _proto = Popover.prototype;
6146

6147
    // Overrides
6148
    _proto.isWithContent = function isWithContent() {
6149
      return this.getTitle() || this._getContent();
6150
    };
6151

6152
    _proto.addAttachmentClass = function addAttachmentClass(attachment) {
6153
      $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
6154
    };
6155

6156
    _proto.getTipElement = function getTipElement() {
6157
      this.tip = this.tip || $(this.config.template)[0];
6158
      return this.tip;
6159
    };
6160

6161
    _proto.setContent = function setContent() {
6162
      var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
6163

6164
      this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle());
6165

6166
      var content = this._getContent();
6167

6168
      if (typeof content === 'function') {
6169
        content = content.call(this.element);
6170
      }
6171

6172
      this.setElementContent($tip.find(SELECTOR_CONTENT), content);
6173
      $tip.removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$5);
6174
    } // Private
6175
    ;
6176

6177
    _proto._getContent = function _getContent() {
6178
      return this.element.getAttribute('data-content') || this.config.content;
6179
    };
6180

6181
    _proto._cleanTipClass = function _cleanTipClass() {
6182
      var $tip = $(this.getTipElement());
6183
      var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
6184

6185
      if (tabClass !== null && tabClass.length > 0) {
6186
        $tip.removeClass(tabClass.join(''));
6187
      }
6188
    } // Static
6189
    ;
6190

6191
    Popover._jQueryInterface = function _jQueryInterface(config) {
6192
      return this.each(function () {
6193
        var data = $(this).data(DATA_KEY$7);
6194

6195
        var _config = typeof config === 'object' ? config : null;
6196

6197
        if (!data && /dispose|hide/.test(config)) {
6198
          return;
6199
        }
6200

6201
        if (!data) {
6202
          data = new Popover(this, _config);
6203
          $(this).data(DATA_KEY$7, data);
6204
        }
6205

6206
        if (typeof config === 'string') {
6207
          if (typeof data[config] === 'undefined') {
6208
            throw new TypeError("No method named \"" + config + "\"");
6209
          }
6210

6211
          data[config]();
6212
        }
6213
      });
6214
    };
6215

6216
    _createClass(Popover, null, [{
6217
      key: "VERSION",
6218
      // Getters
6219
      get: function get() {
6220
        return VERSION$7;
6221
      }
6222
    }, {
6223
      key: "Default",
6224
      get: function get() {
6225
        return Default$5;
6226
      }
6227
    }, {
6228
      key: "NAME",
6229
      get: function get() {
6230
        return NAME$7;
6231
      }
6232
    }, {
6233
      key: "DATA_KEY",
6234
      get: function get() {
6235
        return DATA_KEY$7;
6236
      }
6237
    }, {
6238
      key: "Event",
6239
      get: function get() {
6240
        return Event$1;
6241
      }
6242
    }, {
6243
      key: "EVENT_KEY",
6244
      get: function get() {
6245
        return EVENT_KEY$7;
6246
      }
6247
    }, {
6248
      key: "DefaultType",
6249
      get: function get() {
6250
        return DefaultType$5;
6251
      }
6252
    }]);
6253

6254
    return Popover;
6255
  }(Tooltip);
6256
  /**
6257
   * ------------------------------------------------------------------------
6258
   * jQuery
6259
   * ------------------------------------------------------------------------
6260
   */
6261

6262

6263
  $.fn[NAME$7] = Popover._jQueryInterface;
6264
  $.fn[NAME$7].Constructor = Popover;
6265

6266
  $.fn[NAME$7].noConflict = function () {
6267
    $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
6268
    return Popover._jQueryInterface;
6269
  };
6270

6271
  /**
6272
   * ------------------------------------------------------------------------
6273
   * Constants
6274
   * ------------------------------------------------------------------------
6275
   */
6276

6277
  var NAME$8 = 'scrollspy';
6278
  var VERSION$8 = '4.5.2';
6279
  var DATA_KEY$8 = 'bs.scrollspy';
6280
  var EVENT_KEY$8 = "." + DATA_KEY$8;
6281
  var DATA_API_KEY$6 = '.data-api';
6282
  var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
6283
  var Default$6 = {
6284
    offset: 10,
6285
    method: 'auto',
6286
    target: ''
6287
  };
6288
  var DefaultType$6 = {
6289
    offset: 'number',
6290
    method: 'string',
6291
    target: '(string|element)'
6292
  };
6293
  var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
6294
  var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
6295
  var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
6296
  var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
6297
  var CLASS_NAME_ACTIVE$2 = 'active';
6298
  var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
6299
  var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
6300
  var SELECTOR_NAV_LINKS = '.nav-link';
6301
  var SELECTOR_NAV_ITEMS = '.nav-item';
6302
  var SELECTOR_LIST_ITEMS = '.list-group-item';
6303
  var SELECTOR_DROPDOWN = '.dropdown';
6304
  var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item';
6305
  var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
6306
  var METHOD_OFFSET = 'offset';
6307
  var METHOD_POSITION = 'position';
6308
  /**
6309
   * ------------------------------------------------------------------------
6310
   * Class Definition
6311
   * ------------------------------------------------------------------------
6312
   */
6313

6314
  var ScrollSpy = /*#__PURE__*/function () {
6315
    function ScrollSpy(element, config) {
6316
      var _this = this;
6317

6318
      this._element = element;
6319
      this._scrollElement = element.tagName === 'BODY' ? window : element;
6320
      this._config = this._getConfig(config);
6321
      this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS);
6322
      this._offsets = [];
6323
      this._targets = [];
6324
      this._activeTarget = null;
6325
      this._scrollHeight = 0;
6326
      $(this._scrollElement).on(EVENT_SCROLL, function (event) {
6327
        return _this._process(event);
6328
      });
6329
      this.refresh();
6330

6331
      this._process();
6332
    } // Getters
6333

6334

6335
    var _proto = ScrollSpy.prototype;
6336

6337
    // Public
6338
    _proto.refresh = function refresh() {
6339
      var _this2 = this;
6340

6341
      var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
6342
      var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
6343
      var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
6344
      this._offsets = [];
6345
      this._targets = [];
6346
      this._scrollHeight = this._getScrollHeight();
6347
      var targets = [].slice.call(document.querySelectorAll(this._selector));
6348
      targets.map(function (element) {
6349
        var target;
6350
        var targetSelector = Util.getSelectorFromElement(element);
6351

6352
        if (targetSelector) {
6353
          target = document.querySelector(targetSelector);
6354
        }
6355

6356
        if (target) {
6357
          var targetBCR = target.getBoundingClientRect();
6358

6359
          if (targetBCR.width || targetBCR.height) {
6360
            // TODO (fat): remove sketch reliance on jQuery position/offset
6361
            return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
6362
          }
6363
        }
6364

6365
        return null;
6366
      }).filter(function (item) {
6367
        return item;
6368
      }).sort(function (a, b) {
6369
        return a[0] - b[0];
6370
      }).forEach(function (item) {
6371
        _this2._offsets.push(item[0]);
6372

6373
        _this2._targets.push(item[1]);
6374
      });
6375
    };
6376

6377
    _proto.dispose = function dispose() {
6378
      $.removeData(this._element, DATA_KEY$8);
6379
      $(this._scrollElement).off(EVENT_KEY$8);
6380
      this._element = null;
6381
      this._scrollElement = null;
6382
      this._config = null;
6383
      this._selector = null;
6384
      this._offsets = null;
6385
      this._targets = null;
6386
      this._activeTarget = null;
6387
      this._scrollHeight = null;
6388
    } // Private
6389
    ;
6390

6391
    _proto._getConfig = function _getConfig(config) {
6392
      config = _extends({}, Default$6, typeof config === 'object' && config ? config : {});
6393

6394
      if (typeof config.target !== 'string' && Util.isElement(config.target)) {
6395
        var id = $(config.target).attr('id');
6396

6397
        if (!id) {
6398
          id = Util.getUID(NAME$8);
6399
          $(config.target).attr('id', id);
6400
        }
6401

6402
        config.target = "#" + id;
6403
      }
6404

6405
      Util.typeCheckConfig(NAME$8, config, DefaultType$6);
6406
      return config;
6407
    };
6408

6409
    _proto._getScrollTop = function _getScrollTop() {
6410
      return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
6411
    };
6412

6413
    _proto._getScrollHeight = function _getScrollHeight() {
6414
      return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6415
    };
6416

6417
    _proto._getOffsetHeight = function _getOffsetHeight() {
6418
      return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
6419
    };
6420

6421
    _proto._process = function _process() {
6422
      var scrollTop = this._getScrollTop() + this._config.offset;
6423

6424
      var scrollHeight = this._getScrollHeight();
6425

6426
      var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
6427

6428
      if (this._scrollHeight !== scrollHeight) {
6429
        this.refresh();
6430
      }
6431

6432
      if (scrollTop >= maxScroll) {
6433
        var target = this._targets[this._targets.length - 1];
6434

6435
        if (this._activeTarget !== target) {
6436
          this._activate(target);
6437
        }
6438

6439
        return;
6440
      }
6441

6442
      if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
6443
        this._activeTarget = null;
6444

6445
        this._clear();
6446

6447
        return;
6448
      }
6449

6450
      for (var i = this._offsets.length; i--;) {
6451
        var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
6452

6453
        if (isActiveTarget) {
6454
          this._activate(this._targets[i]);
6455
        }
6456
      }
6457
    };
6458

6459
    _proto._activate = function _activate(target) {
6460
      this._activeTarget = target;
6461

6462
      this._clear();
6463

6464
      var queries = this._selector.split(',').map(function (selector) {
6465
        return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
6466
      });
6467

6468
      var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
6469

6470
      if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) {
6471
        $link.closest(SELECTOR_DROPDOWN).find(SELECTOR_DROPDOWN_TOGGLE).addClass(CLASS_NAME_ACTIVE$2);
6472
        $link.addClass(CLASS_NAME_ACTIVE$2);
6473
      } else {
6474
        // Set triggered link as active
6475
        $link.addClass(CLASS_NAME_ACTIVE$2); // Set triggered links parents as active
6476
        // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
6477

6478
        $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$2); // Handle special case when .nav-link is inside .nav-item
6479

6480
        $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$2);
6481
      }
6482

6483
      $(this._scrollElement).trigger(EVENT_ACTIVATE, {
6484
        relatedTarget: target
6485
      });
6486
    };
6487

6488
    _proto._clear = function _clear() {
6489
      [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
6490
        return node.classList.contains(CLASS_NAME_ACTIVE$2);
6491
      }).forEach(function (node) {
6492
        return node.classList.remove(CLASS_NAME_ACTIVE$2);
6493
      });
6494
    } // Static
6495
    ;
6496

6497
    ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
6498
      return this.each(function () {
6499
        var data = $(this).data(DATA_KEY$8);
6500

6501
        var _config = typeof config === 'object' && config;
6502

6503
        if (!data) {
6504
          data = new ScrollSpy(this, _config);
6505
          $(this).data(DATA_KEY$8, data);
6506
        }
6507

6508
        if (typeof config === 'string') {
6509
          if (typeof data[config] === 'undefined') {
6510
            throw new TypeError("No method named \"" + config + "\"");
6511
          }
6512

6513
          data[config]();
6514
        }
6515
      });
6516
    };
6517

6518
    _createClass(ScrollSpy, null, [{
6519
      key: "VERSION",
6520
      get: function get() {
6521
        return VERSION$8;
6522
      }
6523
    }, {
6524
      key: "Default",
6525
      get: function get() {
6526
        return Default$6;
6527
      }
6528
    }]);
6529

6530
    return ScrollSpy;
6531
  }();
6532
  /**
6533
   * ------------------------------------------------------------------------
6534
   * Data Api implementation
6535
   * ------------------------------------------------------------------------
6536
   */
6537

6538

6539
  $(window).on(EVENT_LOAD_DATA_API$2, function () {
6540
    var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY));
6541
    var scrollSpysLength = scrollSpys.length;
6542

6543
    for (var i = scrollSpysLength; i--;) {
6544
      var $spy = $(scrollSpys[i]);
6545

6546
      ScrollSpy._jQueryInterface.call($spy, $spy.data());
6547
    }
6548
  });
6549
  /**
6550
   * ------------------------------------------------------------------------
6551
   * jQuery
6552
   * ------------------------------------------------------------------------
6553
   */
6554

6555
  $.fn[NAME$8] = ScrollSpy._jQueryInterface;
6556
  $.fn[NAME$8].Constructor = ScrollSpy;
6557

6558
  $.fn[NAME$8].noConflict = function () {
6559
    $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
6560
    return ScrollSpy._jQueryInterface;
6561
  };
6562

6563
  /**
6564
   * ------------------------------------------------------------------------
6565
   * Constants
6566
   * ------------------------------------------------------------------------
6567
   */
6568

6569
  var NAME$9 = 'tab';
6570
  var VERSION$9 = '4.5.2';
6571
  var DATA_KEY$9 = 'bs.tab';
6572
  var EVENT_KEY$9 = "." + DATA_KEY$9;
6573
  var DATA_API_KEY$7 = '.data-api';
6574
  var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
6575
  var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
6576
  var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
6577
  var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
6578
  var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
6579
  var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
6580
  var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
6581
  var CLASS_NAME_ACTIVE$3 = 'active';
6582
  var CLASS_NAME_DISABLED$1 = 'disabled';
6583
  var CLASS_NAME_FADE$4 = 'fade';
6584
  var CLASS_NAME_SHOW$6 = 'show';
6585
  var SELECTOR_DROPDOWN$1 = '.dropdown';
6586
  var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
6587
  var SELECTOR_ACTIVE$2 = '.active';
6588
  var SELECTOR_ACTIVE_UL = '> li > .active';
6589
  var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
6590
  var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
6591
  var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active';
6592
  /**
6593
   * ------------------------------------------------------------------------
6594
   * Class Definition
6595
   * ------------------------------------------------------------------------
6596
   */
6597

6598
  var Tab = /*#__PURE__*/function () {
6599
    function Tab(element) {
6600
      this._element = element;
6601
    } // Getters
6602

6603

6604
    var _proto = Tab.prototype;
6605

6606
    // Public
6607
    _proto.show = function show() {
6608
      var _this = this;
6609

6610
      if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(CLASS_NAME_ACTIVE$3) || $(this._element).hasClass(CLASS_NAME_DISABLED$1)) {
6611
        return;
6612
      }
6613

6614
      var target;
6615
      var previous;
6616
      var listElement = $(this._element).closest(SELECTOR_NAV_LIST_GROUP$1)[0];
6617
      var selector = Util.getSelectorFromElement(this._element);
6618

6619
      if (listElement) {
6620
        var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2;
6621
        previous = $.makeArray($(listElement).find(itemSelector));
6622
        previous = previous[previous.length - 1];
6623
      }
6624

6625
      var hideEvent = $.Event(EVENT_HIDE$3, {
6626
        relatedTarget: this._element
6627
      });
6628
      var showEvent = $.Event(EVENT_SHOW$3, {
6629
        relatedTarget: previous
6630
      });
6631

6632
      if (previous) {
6633
        $(previous).trigger(hideEvent);
6634
      }
6635

6636
      $(this._element).trigger(showEvent);
6637

6638
      if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
6639
        return;
6640
      }
6641

6642
      if (selector) {
6643
        target = document.querySelector(selector);
6644
      }
6645

6646
      this._activate(this._element, listElement);
6647

6648
      var complete = function complete() {
6649
        var hiddenEvent = $.Event(EVENT_HIDDEN$3, {
6650
          relatedTarget: _this._element
6651
        });
6652
        var shownEvent = $.Event(EVENT_SHOWN$3, {
6653
          relatedTarget: previous
6654
        });
6655
        $(previous).trigger(hiddenEvent);
6656
        $(_this._element).trigger(shownEvent);
6657
      };
6658

6659
      if (target) {
6660
        this._activate(target, target.parentNode, complete);
6661
      } else {
6662
        complete();
6663
      }
6664
    };
6665

6666
    _proto.dispose = function dispose() {
6667
      $.removeData(this._element, DATA_KEY$9);
6668
      this._element = null;
6669
    } // Private
6670
    ;
6671

6672
    _proto._activate = function _activate(element, container, callback) {
6673
      var _this2 = this;
6674

6675
      var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(SELECTOR_ACTIVE_UL) : $(container).children(SELECTOR_ACTIVE$2);
6676
      var active = activeElements[0];
6677
      var isTransitioning = callback && active && $(active).hasClass(CLASS_NAME_FADE$4);
6678

6679
      var complete = function complete() {
6680
        return _this2._transitionComplete(element, active, callback);
6681
      };
6682

6683
      if (active && isTransitioning) {
6684
        var transitionDuration = Util.getTransitionDurationFromElement(active);
6685
        $(active).removeClass(CLASS_NAME_SHOW$6).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
6686
      } else {
6687
        complete();
6688
      }
6689
    };
6690

6691
    _proto._transitionComplete = function _transitionComplete(element, active, callback) {
6692
      if (active) {
6693
        $(active).removeClass(CLASS_NAME_ACTIVE$3);
6694
        var dropdownChild = $(active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0];
6695

6696
        if (dropdownChild) {
6697
          $(dropdownChild).removeClass(CLASS_NAME_ACTIVE$3);
6698
        }
6699

6700
        if (active.getAttribute('role') === 'tab') {
6701
          active.setAttribute('aria-selected', false);
6702
        }
6703
      }
6704

6705
      $(element).addClass(CLASS_NAME_ACTIVE$3);
6706

6707
      if (element.getAttribute('role') === 'tab') {
6708
        element.setAttribute('aria-selected', true);
6709
      }
6710

6711
      Util.reflow(element);
6712

6713
      if (element.classList.contains(CLASS_NAME_FADE$4)) {
6714
        element.classList.add(CLASS_NAME_SHOW$6);
6715
      }
6716

6717
      if (element.parentNode && $(element.parentNode).hasClass(CLASS_NAME_DROPDOWN_MENU)) {
6718
        var dropdownElement = $(element).closest(SELECTOR_DROPDOWN$1)[0];
6719

6720
        if (dropdownElement) {
6721
          var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE$1));
6722
          $(dropdownToggleList).addClass(CLASS_NAME_ACTIVE$3);
6723
        }
6724

6725
        element.setAttribute('aria-expanded', true);
6726
      }
6727

6728
      if (callback) {
6729
        callback();
6730
      }
6731
    } // Static
6732
    ;
6733

6734
    Tab._jQueryInterface = function _jQueryInterface(config) {
6735
      return this.each(function () {
6736
        var $this = $(this);
6737
        var data = $this.data(DATA_KEY$9);
6738

6739
        if (!data) {
6740
          data = new Tab(this);
6741
          $this.data(DATA_KEY$9, data);
6742
        }
6743

6744
        if (typeof config === 'string') {
6745
          if (typeof data[config] === 'undefined') {
6746
            throw new TypeError("No method named \"" + config + "\"");
6747
          }
6748

6749
          data[config]();
6750
        }
6751
      });
6752
    };
6753

6754
    _createClass(Tab, null, [{
6755
      key: "VERSION",
6756
      get: function get() {
6757
        return VERSION$9;
6758
      }
6759
    }]);
6760

6761
    return Tab;
6762
  }();
6763
  /**
6764
   * ------------------------------------------------------------------------
6765
   * Data Api implementation
6766
   * ------------------------------------------------------------------------
6767
   */
6768

6769

6770
  $(document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
6771
    event.preventDefault();
6772

6773
    Tab._jQueryInterface.call($(this), 'show');
6774
  });
6775
  /**
6776
   * ------------------------------------------------------------------------
6777
   * jQuery
6778
   * ------------------------------------------------------------------------
6779
   */
6780

6781
  $.fn[NAME$9] = Tab._jQueryInterface;
6782
  $.fn[NAME$9].Constructor = Tab;
6783

6784
  $.fn[NAME$9].noConflict = function () {
6785
    $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
6786
    return Tab._jQueryInterface;
6787
  };
6788

6789
  /**
6790
   * ------------------------------------------------------------------------
6791
   * Constants
6792
   * ------------------------------------------------------------------------
6793
   */
6794

6795
  var NAME$a = 'toast';
6796
  var VERSION$a = '4.5.2';
6797
  var DATA_KEY$a = 'bs.toast';
6798
  var EVENT_KEY$a = "." + DATA_KEY$a;
6799
  var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
6800
  var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
6801
  var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
6802
  var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
6803
  var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
6804
  var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
6805
  var CLASS_NAME_FADE$5 = 'fade';
6806
  var CLASS_NAME_HIDE = 'hide';
6807
  var CLASS_NAME_SHOW$7 = 'show';
6808
  var CLASS_NAME_SHOWING = 'showing';
6809
  var DefaultType$7 = {
6810
    animation: 'boolean',
6811
    autohide: 'boolean',
6812
    delay: 'number'
6813
  };
6814
  var Default$7 = {
6815
    animation: true,
6816
    autohide: true,
6817
    delay: 500
6818
  };
6819
  var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
6820
  /**
6821
   * ------------------------------------------------------------------------
6822
   * Class Definition
6823
   * ------------------------------------------------------------------------
6824
   */
6825

6826
  var Toast = /*#__PURE__*/function () {
6827
    function Toast(element, config) {
6828
      this._element = element;
6829
      this._config = this._getConfig(config);
6830
      this._timeout = null;
6831

6832
      this._setListeners();
6833
    } // Getters
6834

6835

6836
    var _proto = Toast.prototype;
6837

6838
    // Public
6839
    _proto.show = function show() {
6840
      var _this = this;
6841

6842
      var showEvent = $.Event(EVENT_SHOW$4);
6843
      $(this._element).trigger(showEvent);
6844

6845
      if (showEvent.isDefaultPrevented()) {
6846
        return;
6847
      }
6848

6849
      this._clearTimeout();
6850

6851
      if (this._config.animation) {
6852
        this._element.classList.add(CLASS_NAME_FADE$5);
6853
      }
6854

6855
      var complete = function complete() {
6856
        _this._element.classList.remove(CLASS_NAME_SHOWING);
6857

6858
        _this._element.classList.add(CLASS_NAME_SHOW$7);
6859

6860
        $(_this._element).trigger(EVENT_SHOWN$4);
6861

6862
        if (_this._config.autohide) {
6863
          _this._timeout = setTimeout(function () {
6864
            _this.hide();
6865
          }, _this._config.delay);
6866
        }
6867
      };
6868

6869
      this._element.classList.remove(CLASS_NAME_HIDE);
6870

6871
      Util.reflow(this._element);
6872

6873
      this._element.classList.add(CLASS_NAME_SHOWING);
6874

6875
      if (this._config.animation) {
6876
        var transitionDuration = Util.getTransitionDurationFromElement(this._element);
6877
        $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
6878
      } else {
6879
        complete();
6880
      }
6881
    };
6882

6883
    _proto.hide = function hide() {
6884
      if (!this._element.classList.contains(CLASS_NAME_SHOW$7)) {
6885
        return;
6886
      }
6887

6888
      var hideEvent = $.Event(EVENT_HIDE$4);
6889
      $(this._element).trigger(hideEvent);
6890

6891
      if (hideEvent.isDefaultPrevented()) {
6892
        return;
6893
      }
6894

6895
      this._close();
6896
    };
6897

6898
    _proto.dispose = function dispose() {
6899
      this._clearTimeout();
6900

6901
      if (this._element.classList.contains(CLASS_NAME_SHOW$7)) {
6902
        this._element.classList.remove(CLASS_NAME_SHOW$7);
6903
      }
6904

6905
      $(this._element).off(EVENT_CLICK_DISMISS$1);
6906
      $.removeData(this._element, DATA_KEY$a);
6907
      this._element = null;
6908
      this._config = null;
6909
    } // Private
6910
    ;
6911

6912
    _proto._getConfig = function _getConfig(config) {
6913
      config = _extends({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {});
6914
      Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
6915
      return config;
6916
    };
6917

6918
    _proto._setListeners = function _setListeners() {
6919
      var _this2 = this;
6920

6921
      $(this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
6922
        return _this2.hide();
6923
      });
6924
    };
6925

6926
    _proto._close = function _close() {
6927
      var _this3 = this;
6928

6929
      var complete = function complete() {
6930
        _this3._element.classList.add(CLASS_NAME_HIDE);
6931

6932
        $(_this3._element).trigger(EVENT_HIDDEN$4);
6933
      };
6934

6935
      this._element.classList.remove(CLASS_NAME_SHOW$7);
6936

6937
      if (this._config.animation) {
6938
        var transitionDuration = Util.getTransitionDurationFromElement(this._element);
6939
        $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
6940
      } else {
6941
        complete();
6942
      }
6943
    };
6944

6945
    _proto._clearTimeout = function _clearTimeout() {
6946
      clearTimeout(this._timeout);
6947
      this._timeout = null;
6948
    } // Static
6949
    ;
6950

6951
    Toast._jQueryInterface = function _jQueryInterface(config) {
6952
      return this.each(function () {
6953
        var $element = $(this);
6954
        var data = $element.data(DATA_KEY$a);
6955

6956
        var _config = typeof config === 'object' && config;
6957

6958
        if (!data) {
6959
          data = new Toast(this, _config);
6960
          $element.data(DATA_KEY$a, data);
6961
        }
6962

6963
        if (typeof config === 'string') {
6964
          if (typeof data[config] === 'undefined') {
6965
            throw new TypeError("No method named \"" + config + "\"");
6966
          }
6967

6968
          data[config](this);
6969
        }
6970
      });
6971
    };
6972

6973
    _createClass(Toast, null, [{
6974
      key: "VERSION",
6975
      get: function get() {
6976
        return VERSION$a;
6977
      }
6978
    }, {
6979
      key: "DefaultType",
6980
      get: function get() {
6981
        return DefaultType$7;
6982
      }
6983
    }, {
6984
      key: "Default",
6985
      get: function get() {
6986
        return Default$7;
6987
      }
6988
    }]);
6989

6990
    return Toast;
6991
  }();
6992
  /**
6993
   * ------------------------------------------------------------------------
6994
   * jQuery
6995
   * ------------------------------------------------------------------------
6996
   */
6997

6998

6999
  $.fn[NAME$a] = Toast._jQueryInterface;
7000
  $.fn[NAME$a].Constructor = Toast;
7001

7002
  $.fn[NAME$a].noConflict = function () {
7003
    $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
7004
    return Toast._jQueryInterface;
7005
  };
7006

7007
  exports.Alert = Alert;
7008
  exports.Button = Button;
7009
  exports.Carousel = Carousel;
7010
  exports.Collapse = Collapse;
7011
  exports.Dropdown = Dropdown;
7012
  exports.Modal = Modal;
7013
  exports.Popover = Popover;
7014
  exports.Scrollspy = ScrollSpy;
7015
  exports.Tab = Tab;
7016
  exports.Toast = Toast;
7017
  exports.Tooltip = Tooltip;
7018
  exports.Util = Util;
7019

7020
  Object.defineProperty(exports, '__esModule', { value: true });
7021

7022
})));
7023
//# sourceMappingURL=bootstrap.bundle.js.map
7024

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.