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