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