bootstrap.js 149 KB
Newer Older
1
/*!
XhmikosR's avatar
XhmikosR committed
2
  * Bootstrap v5.0.0-alpha3 (https://getbootstrap.com/)
XhmikosR's avatar
XhmikosR committed
3
  * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
XhmikosR's avatar
XhmikosR committed
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
Mark Otto's avatar
dist    
Mark Otto committed
5
  */
Mark Otto's avatar
dist    
Mark Otto committed
6
(function (global, factory) {
XhmikosR's avatar
Dist.    
XhmikosR committed
7
8
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('popper.js')) :
  typeof define === 'function' && define.amd ? define(['popper.js'], factory) :
XhmikosR's avatar
XhmikosR committed
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory(global.Popper));
XhmikosR's avatar
XhmikosR committed
10
}(this, (function (Popper) { 'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
11

XhmikosR's avatar
XhmikosR committed
12
13
14
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

  var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
Jacob Thornton's avatar
Jacob Thornton committed
15

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

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

XhmikosR's avatar
XhmikosR committed
32
33
34
35
  function _extends() {
    _extends = Object.assign || function (target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i];
Mark Otto's avatar
dist    
Mark Otto committed
36

XhmikosR's avatar
XhmikosR committed
37
38
39
40
41
        for (var key in source) {
          if (Object.prototype.hasOwnProperty.call(source, key)) {
            target[key] = source[key];
          }
        }
Jacob Thornton's avatar
Jacob Thornton committed
42
43
      }

XhmikosR's avatar
XhmikosR committed
44
45
46
47
      return target;
    };

    return _extends.apply(this, arguments);
Jacob Thornton's avatar
Jacob Thornton committed
48
49
  }

Mark Otto's avatar
dist    
Mark Otto committed
50
51
52
53
  function _inheritsLoose(subClass, superClass) {
    subClass.prototype = Object.create(superClass.prototype);
    subClass.prototype.constructor = subClass;
    subClass.__proto__ = superClass;
Jacob Thornton's avatar
Jacob Thornton committed
54
55
56
57
  }

  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
58
   * Bootstrap (v5.0.0-alpha3): util/index.js
XhmikosR's avatar
XhmikosR committed
59
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
Jacob Thornton's avatar
Jacob Thornton committed
60
61
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
XhmikosR committed
62
63
  var MAX_UID = 1000000;
  var MILLISECONDS_MULTIPLIER = 1000;
XhmikosR's avatar
XhmikosR committed
64
  var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
XhmikosR's avatar
XhmikosR committed
65
66

  var toType = function toType(obj) {
XhmikosR's avatar
XhmikosR committed
67
68
69
70
    if (obj === null || obj === undefined) {
      return "" + obj;
    }

XhmikosR's avatar
XhmikosR committed
71
72
    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  };
XhmikosR's avatar
Dist    
XhmikosR committed
73
  /**
XhmikosR's avatar
XhmikosR committed
74
75
76
   * --------------------------------------------------------------------------
   * Public Util Api
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
77
   */
Mark Otto's avatar
dist    
Mark Otto committed
78

Jacob Thornton's avatar
Jacob Thornton committed
79

XhmikosR's avatar
XhmikosR committed
80
81
  var getUID = function getUID(prefix) {
    do {
Mark Otto's avatar
Mark Otto committed
82
      prefix += Math.floor(Math.random() * MAX_UID);
XhmikosR's avatar
XhmikosR committed
83
    } while (document.getElementById(prefix));
Mark Otto's avatar
dist    
Mark Otto committed
84

XhmikosR's avatar
XhmikosR committed
85
86
    return prefix;
  };
Mark Otto's avatar
dist    
Mark Otto committed
87

XhmikosR's avatar
XhmikosR committed
88
  var getSelector = function getSelector(element) {
XhmikosR's avatar
XhmikosR committed
89
    var selector = element.getAttribute('data-bs-target');
XhmikosR's avatar
XhmikosR committed
90
91
92

    if (!selector || selector === '#') {
      var hrefAttr = element.getAttribute('href');
XhmikosR's avatar
XhmikosR committed
93
      selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
XhmikosR's avatar
XhmikosR committed
94
95
    }

XhmikosR's avatar
XhmikosR committed
96
97
98
99
100
101
102
    return selector;
  };

  var getSelectorFromElement = function getSelectorFromElement(element) {
    var selector = getSelector(element);

    if (selector) {
XhmikosR's avatar
XhmikosR committed
103
104
      return document.querySelector(selector) ? selector : null;
    }
XhmikosR's avatar
XhmikosR committed
105
106
107
108
109
110
111

    return null;
  };

  var getElementFromSelector = function getElementFromSelector(element) {
    var selector = getSelector(element);
    return selector ? document.querySelector(selector) : null;
XhmikosR's avatar
XhmikosR committed
112
113
114
115
116
117
  };

  var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
    if (!element) {
      return 0;
    } // Get transition-duration of the element
Jacob Thornton's avatar
Jacob Thornton committed
118

Mark Otto's avatar
dist    
Mark Otto committed
119

XhmikosR's avatar
XhmikosR committed
120
121
122
123
    var _window$getComputedSt = window.getComputedStyle(element),
        transitionDuration = _window$getComputedSt.transitionDuration,
        transitionDelay = _window$getComputedSt.transitionDelay;

XhmikosR's avatar
XhmikosR committed
124
125
    var floatTransitionDuration = Number.parseFloat(transitionDuration);
    var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
XhmikosR's avatar
XhmikosR committed
126
127
128
129
130
131
132
133

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


    transitionDuration = transitionDuration.split(',')[0];
    transitionDelay = transitionDelay.split(',')[0];
XhmikosR's avatar
XhmikosR committed
134
    return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
XhmikosR's avatar
XhmikosR committed
135
136
137
  };

  var triggerTransitionEnd = function triggerTransitionEnd(element) {
XhmikosR's avatar
XhmikosR committed
138
    element.dispatchEvent(new Event(TRANSITION_END));
XhmikosR's avatar
XhmikosR committed
139
140
141
142
143
144
145
  };

  var isElement = function isElement(obj) {
    return (obj[0] || obj).nodeType;
  };

  var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
XhmikosR's avatar
Dist    
XhmikosR committed
146
    var called = false;
XhmikosR's avatar
XhmikosR committed
147
148
149
150
    var durationPadding = 5;
    var emulatedDuration = duration + durationPadding;

    function listener() {
XhmikosR's avatar
Dist    
XhmikosR committed
151
      called = true;
XhmikosR's avatar
XhmikosR committed
152
153
154
155
      element.removeEventListener(TRANSITION_END, listener);
    }

    element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
Dist    
XhmikosR committed
156
157
    setTimeout(function () {
      if (!called) {
XhmikosR's avatar
XhmikosR committed
158
        triggerTransitionEnd(element);
XhmikosR's avatar
Dist    
XhmikosR committed
159
      }
XhmikosR's avatar
XhmikosR committed
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
    }, emulatedDuration);
  };

  var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
    Object.keys(configTypes).forEach(function (property) {
      var expectedTypes = configTypes[property];
      var value = config[property];
      var valueType = value && isElement(value) ? 'element' : toType(value);

      if (!new RegExp(expectedTypes).test(valueType)) {
        throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
      }
    });
  };

  var isVisible = function isVisible(element) {
    if (!element) {
      return false;
    }

    if (element.style && element.parentNode && element.parentNode.style) {
XhmikosR's avatar
XhmikosR committed
181
182
183
      var elementStyle = getComputedStyle(element);
      var parentNodeStyle = getComputedStyle(element.parentNode);
      return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
XhmikosR's avatar
XhmikosR committed
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
    }

    return false;
  };

  var findShadowRoot = function findShadowRoot(element) {
    if (!document.documentElement.attachShadow) {
      return null;
    } // Can find the shadow root otherwise it'll return the document


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

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


    if (!element.parentNode) {
      return null;
    }

    return findShadowRoot(element.parentNode);
XhmikosR's avatar
XhmikosR committed
210
  };
XhmikosR's avatar
XhmikosR committed
211
212
213
214
215
216
217
218

  var noop = function noop() {
    return function () {};
  };

  var reflow = function reflow(element) {
    return element.offsetHeight;
  };
Mark Otto's avatar
dist    
Mark Otto committed
219

XhmikosR's avatar
XhmikosR committed
220
221
222
223
  var getjQuery = function getjQuery() {
    var _window = window,
        jQuery = _window.jQuery;

XhmikosR's avatar
XhmikosR committed
224
    if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
XhmikosR's avatar
XhmikosR committed
225
226
227
228
229
230
      return jQuery;
    }

    return null;
  };

XhmikosR's avatar
XhmikosR committed
231
232
233
234
235
236
237
238
  var onDOMContentLoaded = function onDOMContentLoaded(callback) {
    if (document.readyState === 'loading') {
      document.addEventListener('DOMContentLoaded', callback);
    } else {
      callback();
    }
  };

XhmikosR's avatar
Dist    
XhmikosR committed
239
240
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
241
   * Bootstrap (v5.0.0-alpha3): dom/data.js
XhmikosR's avatar
XhmikosR committed
242
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist    
XhmikosR committed
243
244
   * --------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
245

XhmikosR's avatar
XhmikosR committed
246
247
248
249
250
251
252
253
254
255
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
  var mapData = function () {
    var storeData = {};
    var id = 1;
    return {
      set: function set(element, key, data) {
XhmikosR's avatar
XhmikosR committed
256
257
        if (typeof element.bsKey === 'undefined') {
          element.bsKey = {
XhmikosR's avatar
XhmikosR committed
258
259
260
261
262
263
            key: key,
            id: id
          };
          id++;
        }

XhmikosR's avatar
XhmikosR committed
264
        storeData[element.bsKey.id] = data;
XhmikosR's avatar
XhmikosR committed
265
266
      },
      get: function get(element, key) {
XhmikosR's avatar
XhmikosR committed
267
        if (!element || typeof element.bsKey === 'undefined') {
XhmikosR's avatar
XhmikosR committed
268
269
          return null;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
270

XhmikosR's avatar
XhmikosR committed
271
        var keyProperties = element.bsKey;
XhmikosR's avatar
Dist    
XhmikosR committed
272

XhmikosR's avatar
XhmikosR committed
273
274
275
276
277
278
279
        if (keyProperties.key === key) {
          return storeData[keyProperties.id];
        }

        return null;
      },
      delete: function _delete(element, key) {
XhmikosR's avatar
XhmikosR committed
280
        if (typeof element.bsKey === 'undefined') {
XhmikosR's avatar
XhmikosR committed
281
282
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
283

XhmikosR's avatar
XhmikosR committed
284
        var keyProperties = element.bsKey;
XhmikosR's avatar
XhmikosR committed
285
286
287

        if (keyProperties.key === key) {
          delete storeData[keyProperties.id];
XhmikosR's avatar
XhmikosR committed
288
          delete element.bsKey;
XhmikosR's avatar
XhmikosR committed
289
        }
XhmikosR's avatar
Dist    
XhmikosR committed
290
      }
XhmikosR's avatar
XhmikosR committed
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
    };
  }();

  var Data = {
    setData: function setData(instance, key, data) {
      mapData.set(instance, key, data);
    },
    getData: function getData(instance, key) {
      return mapData.get(instance, key);
    },
    removeData: function removeData(instance, key) {
      mapData.delete(instance, key);
    }
  };

  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
308
   * Bootstrap (v5.0.0-alpha3): dom/event-handler.js
XhmikosR's avatar
XhmikosR committed
309
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
XhmikosR committed
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
   * --------------------------------------------------------------------------
   */
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
  var stripNameRegex = /\..*/;
  var stripUidRegex = /::\d+$/;
  var eventRegistry = {}; // Events storage

  var uidEvent = 1;
  var customEvents = {
    mouseenter: 'mouseover',
    mouseleave: 'mouseout'
  };
XhmikosR's avatar
XhmikosR committed
328
  var nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
XhmikosR's avatar
XhmikosR committed
329
330
331
332
333
334
335
336
337
338
339
340
341
  /**
   * ------------------------------------------------------------------------
   * Private methods
   * ------------------------------------------------------------------------
   */

  function getUidEvent(element, uid) {
    return uid && uid + "::" + uidEvent++ || element.uidEvent || uidEvent++;
  }

  function getEvent(element) {
    var uid = getUidEvent(element);
    element.uidEvent = uid;
XhmikosR's avatar
Dist.    
XhmikosR committed
342
343
    eventRegistry[uid] = eventRegistry[uid] || {};
    return eventRegistry[uid];
XhmikosR's avatar
XhmikosR committed
344
345
346
347
  }

  function bootstrapHandler(element, fn) {
    return function handler(event) {
XhmikosR's avatar
XhmikosR committed
348
349
      event.delegateTarget = element;

XhmikosR's avatar
XhmikosR committed
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
      if (handler.oneOff) {
        EventHandler.off(element, event.type, fn);
      }

      return fn.apply(element, [event]);
    };
  }

  function bootstrapDelegationHandler(element, selector, fn) {
    return function handler(event) {
      var domElements = element.querySelectorAll(selector);

      for (var target = event.target; target && target !== this; target = target.parentNode) {
        for (var i = domElements.length; i--;) {
          if (domElements[i] === target) {
XhmikosR's avatar
XhmikosR committed
365
366
            event.delegateTarget = target;

XhmikosR's avatar
XhmikosR committed
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
            if (handler.oneOff) {
              EventHandler.off(element, event.type, fn);
            }

            return fn.apply(target, [event]);
          }
        }
      } // To please ESLint


      return null;
    };
  }

  function findHandler(events, handler, delegationSelector) {
    if (delegationSelector === void 0) {
      delegationSelector = null;
    }

Mark Otto's avatar
dist v5    
Mark Otto committed
386
387
388
389
    var uidEventList = Object.keys(events);

    for (var i = 0, len = uidEventList.length; i < len; i++) {
      var event = events[uidEventList[i]];
XhmikosR's avatar
XhmikosR committed
390
391

      if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
Mark Otto's avatar
dist v5    
Mark Otto committed
392
        return event;
XhmikosR's avatar
XhmikosR committed
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
      }
    }

    return null;
  }

  function normalizeParams(originalTypeEvent, handler, delegationFn) {
    var delegation = typeof handler === 'string';
    var originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click')

    var typeEvent = originalTypeEvent.replace(stripNameRegex, '');
    var custom = customEvents[typeEvent];

    if (custom) {
      typeEvent = custom;
    }

XhmikosR's avatar
XhmikosR committed
410
    var isNative = nativeEvents.has(typeEvent);
XhmikosR's avatar
XhmikosR committed
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443

    if (!isNative) {
      typeEvent = originalTypeEvent;
    }

    return [delegation, originalHandler, typeEvent];
  }

  function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
    if (typeof originalTypeEvent !== 'string' || !element) {
      return;
    }

    if (!handler) {
      handler = delegationFn;
      delegationFn = null;
    }

    var _normalizeParams = normalizeParams(originalTypeEvent, handler, delegationFn),
        delegation = _normalizeParams[0],
        originalHandler = _normalizeParams[1],
        typeEvent = _normalizeParams[2];

    var events = getEvent(element);
    var handlers = events[typeEvent] || (events[typeEvent] = {});
    var previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);

    if (previousFn) {
      previousFn.oneOff = previousFn.oneOff && oneOff;
      return;
    }

    var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
XhmikosR's avatar
Dist.    
XhmikosR committed
444
    var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
XhmikosR committed
445
446
447
448
449
450
451
452
453
454
455
    fn.delegationSelector = delegation ? handler : null;
    fn.originalHandler = originalHandler;
    fn.oneOff = oneOff;
    fn.uidEvent = uid;
    handlers[uid] = fn;
    element.addEventListener(typeEvent, fn, delegation);
  }

  function removeHandler(element, events, typeEvent, handler, delegationSelector) {
    var fn = findHandler(events[typeEvent], handler, delegationSelector);

Mark Otto's avatar
dist v5    
Mark Otto committed
456
    if (!fn) {
XhmikosR's avatar
XhmikosR committed
457
458
459
460
461
462
463
464
465
466
      return;
    }

    element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
    delete events[typeEvent][fn.uidEvent];
  }

  function removeNamespacedHandlers(element, events, typeEvent, namespace) {
    var storeElementEvent = events[typeEvent] || {};
    Object.keys(storeElementEvent).forEach(function (handlerKey) {
XhmikosR's avatar
XhmikosR committed
467
      if (handlerKey.includes(namespace)) {
XhmikosR's avatar
XhmikosR committed
468
469
        var event = storeElementEvent[handlerKey];
        removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
Mark Otto's avatar
Mark Otto committed
470
      }
XhmikosR's avatar
XhmikosR committed
471
472
473
474
475
476
    });
  }

  var EventHandler = {
    on: function on(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, false);
XhmikosR's avatar
Dist    
XhmikosR committed
477
    },
XhmikosR's avatar
XhmikosR committed
478
479
480
481
482
483
484
    one: function one(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, true);
    },
    off: function off(element, originalTypeEvent, handler, delegationFn) {
      if (typeof originalTypeEvent !== 'string' || !element) {
        return;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
485

XhmikosR's avatar
XhmikosR committed
486
487
488
489
      var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
          delegation = _normalizeParams2[0],
          originalHandler = _normalizeParams2[1],
          typeEvent = _normalizeParams2[2];
XhmikosR's avatar
Dist    
XhmikosR committed
490

XhmikosR's avatar
XhmikosR committed
491
492
      var inNamespace = typeEvent !== originalTypeEvent;
      var events = getEvent(element);
XhmikosR's avatar
XhmikosR committed
493
      var isNamespace = originalTypeEvent.startsWith('.');
XhmikosR's avatar
Dist    
XhmikosR committed
494

XhmikosR's avatar
XhmikosR committed
495
496
497
498
499
      if (typeof originalHandler !== 'undefined') {
        // Simplest case: handler is passed, remove that listener ONLY.
        if (!events || !events[typeEvent]) {
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
500

XhmikosR's avatar
XhmikosR committed
501
502
503
        removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
        return;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
504

XhmikosR's avatar
XhmikosR committed
505
506
      if (isNamespace) {
        Object.keys(events).forEach(function (elementEvent) {
XhmikosR's avatar
XhmikosR committed
507
          removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
XhmikosR's avatar
XhmikosR committed
508
509
510
511
512
513
514
        });
      }

      var storeElementEvent = events[typeEvent] || {};
      Object.keys(storeElementEvent).forEach(function (keyHandlers) {
        var handlerKey = keyHandlers.replace(stripUidRegex, '');

XhmikosR's avatar
XhmikosR committed
515
        if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
XhmikosR's avatar
XhmikosR committed
516
517
518
519
          var event = storeElementEvent[keyHandlers];
          removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
        }
      });
XhmikosR's avatar
Dist    
XhmikosR committed
520
    },
XhmikosR's avatar
XhmikosR committed
521
522
523
524
525
    trigger: function trigger(element, event, args) {
      if (typeof event !== 'string' || !element) {
        return null;
      }

XhmikosR's avatar
XhmikosR committed
526
      var $ = getjQuery();
XhmikosR's avatar
XhmikosR committed
527
528
      var typeEvent = event.replace(stripNameRegex, '');
      var inNamespace = event !== typeEvent;
XhmikosR's avatar
XhmikosR committed
529
      var isNative = nativeEvents.has(typeEvent);
XhmikosR's avatar
XhmikosR committed
530
531
532
533
534
535
      var jQueryEvent;
      var bubbles = true;
      var nativeDispatch = true;
      var defaultPrevented = false;
      var evt = null;

XhmikosR's avatar
XhmikosR committed
536
537
538
      if (inNamespace && $) {
        jQueryEvent = $.Event(event, args);
        $(element).trigger(jQueryEvent);
XhmikosR's avatar
XhmikosR committed
539
540
541
542
543
544
545
546
547
        bubbles = !jQueryEvent.isPropagationStopped();
        nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
        defaultPrevented = jQueryEvent.isDefaultPrevented();
      }

      if (isNative) {
        evt = document.createEvent('HTMLEvents');
        evt.initEvent(typeEvent, bubbles, true);
      } else {
XhmikosR's avatar
XhmikosR committed
548
        evt = new CustomEvent(event, {
XhmikosR's avatar
XhmikosR committed
549
550
551
          bubbles: bubbles,
          cancelable: true
        });
XhmikosR's avatar
XhmikosR committed
552
      } // merge custom information in our event
XhmikosR's avatar
XhmikosR committed
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580


      if (typeof args !== 'undefined') {
        Object.keys(args).forEach(function (key) {
          Object.defineProperty(evt, key, {
            get: function get() {
              return args[key];
            }
          });
        });
      }

      if (defaultPrevented) {
        evt.preventDefault();
      }

      if (nativeDispatch) {
        element.dispatchEvent(evt);
      }

      if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
        jQueryEvent.preventDefault();
      }

      return evt;
    }
  };

XhmikosR's avatar
Dist    
XhmikosR committed
581
582
583
584
585
586
587
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME = 'alert';
XhmikosR's avatar
XhmikosR committed
588
  var VERSION = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
589
590
591
  var DATA_KEY = 'bs.alert';
  var EVENT_KEY = "." + DATA_KEY;
  var DATA_API_KEY = '.data-api';
XhmikosR's avatar
XhmikosR committed
592
  var SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
XhmikosR's avatar
XhmikosR committed
593
594
595
596
597
598
  var EVENT_CLOSE = "close" + EVENT_KEY;
  var EVENT_CLOSED = "closed" + EVENT_KEY;
  var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
  var CLASSNAME_ALERT = 'alert';
  var CLASSNAME_FADE = 'fade';
  var CLASSNAME_SHOW = 'show';
XhmikosR's avatar
XhmikosR committed
599
600
601
602
603
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
604

XhmikosR's avatar
XhmikosR committed
605
  var Alert = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
606
607
    function Alert(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
608
609
610
611

      if (this._element) {
        Data.setData(element, DATA_KEY, this);
      }
XhmikosR's avatar
Dist    
XhmikosR committed
612
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
613
614


XhmikosR's avatar
Dist    
XhmikosR committed
615
    var _proto = Alert.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
616

XhmikosR's avatar
Dist    
XhmikosR committed
617
618
    // Public
    _proto.close = function close(element) {
XhmikosR's avatar
XhmikosR committed
619
      var rootElement = element ? this._getRootElement(element) : this._element;
Mark Otto's avatar
dist    
Mark Otto committed
620

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

XhmikosR's avatar
XhmikosR committed
623
      if (customEvent === null || customEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
624
625
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
626

XhmikosR's avatar
Dist    
XhmikosR committed
627
628
      this._removeElement(rootElement);
    };
Jacob Thornton's avatar
Jacob Thornton committed
629

XhmikosR's avatar
Dist    
XhmikosR committed
630
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
631
      Data.removeData(this._element, DATA_KEY);
XhmikosR's avatar
Dist    
XhmikosR committed
632
      this._element = null;
Mark Otto's avatar
Mark Otto committed
633
634
    } // Private
    ;
Jacob Thornton's avatar
Jacob Thornton committed
635

XhmikosR's avatar
Dist    
XhmikosR committed
636
    _proto._getRootElement = function _getRootElement(element) {
XhmikosR's avatar
XhmikosR committed
637
      return getElementFromSelector(element) || element.closest("." + CLASSNAME_ALERT);
XhmikosR's avatar
Dist    
XhmikosR committed
638
    };
Jacob Thornton's avatar
Jacob Thornton committed
639

XhmikosR's avatar
Dist    
XhmikosR committed
640
    _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
XhmikosR's avatar
XhmikosR committed
641
      return EventHandler.trigger(element, EVENT_CLOSE);
XhmikosR's avatar
Dist    
XhmikosR committed
642
    };
Jacob Thornton's avatar
Jacob Thornton committed
643

XhmikosR's avatar
Dist    
XhmikosR committed
644
645
    _proto._removeElement = function _removeElement(element) {
      var _this = this;
Mark Otto's avatar
grunt    
Mark Otto committed
646

XhmikosR's avatar
XhmikosR committed
647
      element.classList.remove(CLASSNAME_SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
648

XhmikosR's avatar
XhmikosR committed
649
      if (!element.classList.contains(CLASSNAME_FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
650
        this._destroyElement(element);
Mark Otto's avatar
dist    
Mark Otto committed
651

XhmikosR's avatar
Dist    
XhmikosR committed
652
653
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
654

XhmikosR's avatar
XhmikosR committed
655
      var transitionDuration = getTransitionDurationFromElement(element);
656
657
      EventHandler.one(element, TRANSITION_END, function () {
        return _this._destroyElement(element);
XhmikosR's avatar
XhmikosR committed
658
659
      });
      emulateTransitionEnd(element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
660
    };
Jacob Thornton's avatar
Jacob Thornton committed
661

XhmikosR's avatar
Dist    
XhmikosR committed
662
    _proto._destroyElement = function _destroyElement(element) {
XhmikosR's avatar
XhmikosR committed
663
664
665
666
      if (element.parentNode) {
        element.parentNode.removeChild(element);
      }

XhmikosR's avatar
XhmikosR committed
667
      EventHandler.trigger(element, EVENT_CLOSED);
Mark Otto's avatar
Mark Otto committed
668
669
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
670

XhmikosR's avatar
XhmikosR committed
671
    Alert.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
672
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
673
        var data = Data.getData(this, DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
674

XhmikosR's avatar
Dist    
XhmikosR committed
675
676
677
        if (!data) {
          data = new Alert(this);
        }
Jacob Thornton's avatar
Jacob Thornton committed
678

XhmikosR's avatar
Dist    
XhmikosR committed
679
680
681
682
683
        if (config === 'close') {
          data[config](this);
        }
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
684

XhmikosR's avatar
XhmikosR committed
685
    Alert.handleDismiss = function handleDismiss(alertInstance) {
XhmikosR's avatar
Dist    
XhmikosR committed
686
687
688
689
      return function (event) {
        if (event) {
          event.preventDefault();
        }
Jacob Thornton's avatar
Jacob Thornton committed
690

XhmikosR's avatar
Dist    
XhmikosR committed
691
        alertInstance.close(this);
Mark Otto's avatar
grunt    
Mark Otto committed
692
      };
XhmikosR's avatar
Dist    
XhmikosR committed
693
    };
Mark Otto's avatar
grunt    
Mark Otto committed
694

XhmikosR's avatar
XhmikosR committed
695
    Alert.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
696
697
698
      return Data.getData(element, DATA_KEY);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
699
700
701
702
703
704
    _createClass(Alert, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION;
      }
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
705

XhmikosR's avatar
Dist    
XhmikosR committed
706
707
708
709
710
711
712
    return Alert;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
713

Mark Otto's avatar
dist    
Mark Otto committed
714

XhmikosR's avatar
XhmikosR committed
715
  EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
XhmikosR's avatar
Dist    
XhmikosR committed
716
717
718
719
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
720
   * add .Alert to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
721
   */
Jacob Thornton's avatar
Jacob Thornton committed
722

XhmikosR's avatar
XhmikosR committed
723
724
725
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
726

XhmikosR's avatar
XhmikosR committed
727
728
729
730
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME];
      $.fn[NAME] = Alert.jQueryInterface;
      $.fn[NAME].Constructor = Alert;
Jacob Thornton's avatar
Jacob Thornton committed
731

XhmikosR's avatar
XhmikosR committed
732
733
734
735
736
737
      $.fn[NAME].noConflict = function () {
        $.fn[NAME] = JQUERY_NO_CONFLICT;
        return Alert.jQueryInterface;
      };
    }
  });
Jacob Thornton's avatar
Jacob Thornton committed
738

XhmikosR's avatar
Dist    
XhmikosR committed
739
740
741
742
743
744
745
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$1 = 'button';
XhmikosR's avatar
XhmikosR committed
746
  var VERSION$1 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
747
748
749
  var DATA_KEY$1 = 'bs.button';
  var EVENT_KEY$1 = "." + DATA_KEY$1;
  var DATA_API_KEY$1 = '.data-api';
XhmikosR's avatar
XhmikosR committed
750
  var CLASS_NAME_ACTIVE = 'active';
XhmikosR's avatar
XhmikosR committed
751
  var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]';
XhmikosR's avatar
XhmikosR committed
752
  var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
XhmikosR's avatar
XhmikosR committed
753
754
755
756
757
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
758

XhmikosR's avatar
XhmikosR committed
759
  var Button = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
760
761
    function Button(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
762
      Data.setData(element, DATA_KEY$1, this);
XhmikosR's avatar
Dist    
XhmikosR committed
763
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
764
765


XhmikosR's avatar
Dist    
XhmikosR committed
766
    var _proto = Button.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
767

XhmikosR's avatar
Dist    
XhmikosR committed
768
769
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
770
771
      // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
      this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE));
XhmikosR's avatar
Dist    
XhmikosR committed
772
    };
Jacob Thornton's avatar
Jacob Thornton committed
773

XhmikosR's avatar
Dist    
XhmikosR committed
774
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
775
      Data.removeData(this._element, DATA_KEY$1);
XhmikosR's avatar
Dist    
XhmikosR committed
776
      this._element = null;
Mark Otto's avatar
Mark Otto committed
777
778
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
779

XhmikosR's avatar
XhmikosR committed
780
    Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
781
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
782
        var data = Data.getData(this, DATA_KEY$1);
Jacob Thornton's avatar
Jacob Thornton committed
783

XhmikosR's avatar
Dist    
XhmikosR committed
784
785
786
        if (!data) {
          data = new Button(this);
        }
Mark Otto's avatar
grunt    
Mark Otto committed
787

XhmikosR's avatar
Dist    
XhmikosR committed
788
789
        if (config === 'toggle') {
          data[config]();
Mark Otto's avatar
grunt    
Mark Otto committed
790
        }
XhmikosR's avatar
Dist    
XhmikosR committed
791
792
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
793

XhmikosR's avatar
XhmikosR committed
794
    Button.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
795
796
797
      return Data.getData(element, DATA_KEY$1);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
798
799
800
801
802
803
    _createClass(Button, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$1;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
804

XhmikosR's avatar
Dist    
XhmikosR committed
805
806
807
808
809
810
811
    return Button;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
812
813


XhmikosR's avatar
XhmikosR committed
814
  EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
815
    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
816
    var button = event.target.closest(SELECTOR_DATA_TOGGLE);
XhmikosR's avatar
XhmikosR committed
817
818
819
820
821
822
823
824
    var data = Data.getData(button, DATA_KEY$1);

    if (!data) {
      data = new Button(button);
    }

    data.toggle();
  });
XhmikosR's avatar
Dist    
XhmikosR committed
825
826
827
828
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
829
   * add .Button to jQuery only if jQuery is present
XhmikosR's avatar
XhmikosR committed
830
831
   */

XhmikosR's avatar
XhmikosR committed
832
833
834
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
835

XhmikosR's avatar
XhmikosR committed
836
837
838
839
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$1];
      $.fn[NAME$1] = Button.jQueryInterface;
      $.fn[NAME$1].Constructor = Button;
XhmikosR's avatar
XhmikosR committed
840

XhmikosR's avatar
XhmikosR committed
841
842
843
844
845
846
      $.fn[NAME$1].noConflict = function () {
        $.fn[NAME$1] = JQUERY_NO_CONFLICT;
        return Button.jQueryInterface;
      };
    }
  });
XhmikosR's avatar
XhmikosR committed
847
848
849

  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
850
   * Bootstrap (v5.0.0-alpha3): dom/manipulator.js
XhmikosR's avatar
XhmikosR committed
851
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
XhmikosR committed
852
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
853
   */
XhmikosR's avatar
XhmikosR committed
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
  function normalizeData(val) {
    if (val === 'true') {
      return true;
    }

    if (val === 'false') {
      return false;
    }

    if (val === Number(val).toString()) {
      return Number(val);
    }

    if (val === '' || val === 'null') {
      return null;
    }

    return val;
  }
Jacob Thornton's avatar
Jacob Thornton committed
873

XhmikosR's avatar
XhmikosR committed
874
875
  function normalizeDataKey(key) {
    return key.replace(/[A-Z]/g, function (chr) {
XhmikosR's avatar
XhmikosR committed
876
      return "-" + chr.toLowerCase();
XhmikosR's avatar
XhmikosR committed
877
878
879
880
881
    });
  }

  var Manipulator = {
    setDataAttribute: function setDataAttribute(element, key, value) {
XhmikosR's avatar
XhmikosR committed
882
      element.setAttribute("data-bs-" + normalizeDataKey(key), value);
XhmikosR's avatar
XhmikosR committed
883
884
    },
    removeDataAttribute: function removeDataAttribute(element, key) {
XhmikosR's avatar
XhmikosR committed
885
      element.removeAttribute("data-bs-" + normalizeDataKey(key));
XhmikosR's avatar
XhmikosR committed
886
887
888
889
890
891
    },
    getDataAttributes: function getDataAttributes(element) {
      if (!element) {
        return {};
      }

XhmikosR's avatar
XhmikosR committed
892
893
894
895
896
897
898
      var attributes = {};
      Object.keys(element.dataset).filter(function (key) {
        return key.startsWith('bs');
      }).forEach(function (key) {
        var pureKey = key.replace(/^bs/, '');
        pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
        attributes[pureKey] = normalizeData(element.dataset[key]);
XhmikosR's avatar
XhmikosR committed
899
900
901
902
      });
      return attributes;
    },
    getDataAttribute: function getDataAttribute(element, key) {
XhmikosR's avatar
XhmikosR committed
903
      return normalizeData(element.getAttribute("data-bs-" + normalizeDataKey(key)));
XhmikosR's avatar
XhmikosR committed
904
905
906
907
908
909
910
911
912
913
914
915
916
917
    },
    offset: function offset(element) {
      var rect = element.getBoundingClientRect();
      return {
        top: rect.top + document.body.scrollTop,
        left: rect.left + document.body.scrollLeft
      };
    },
    position: function position(element) {
      return {
        top: element.offsetTop,
        left: element.offsetLeft
      };
    }
XhmikosR's avatar
Dist    
XhmikosR committed
918
  };
Jacob Thornton's avatar
Jacob Thornton committed
919

XhmikosR's avatar
XhmikosR committed
920
921
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
922
   * Bootstrap (v5.0.0-alpha3): dom/selector-engine.js
XhmikosR's avatar
XhmikosR committed
923
924
925
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
XhmikosR committed
926

XhmikosR's avatar
XhmikosR committed
927
928
929
930
931
932
933
934
935
936
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
  var NODE_TEXT = 3;
  var SelectorEngine = {
    matches: function matches(element, selector) {
      return element.matches(selector);
    },
XhmikosR's avatar
XhmikosR committed
937
    find: function find(selector, element) {
XhmikosR's avatar
XhmikosR committed
938
939
940
941
942
943
      var _ref;

      if (element === void 0) {
        element = document.documentElement;
      }

XhmikosR's avatar
XhmikosR committed
944
      return (_ref = []).concat.apply(_ref, Element.prototype.querySelectorAll.call(element, selector));
XhmikosR's avatar
XhmikosR committed
945
    },
XhmikosR's avatar
XhmikosR committed
946
    findOne: function findOne(selector, element) {
XhmikosR's avatar
XhmikosR committed
947
948
949
950
      if (element === void 0) {
        element = document.documentElement;
      }

XhmikosR's avatar
XhmikosR committed
951
      return Element.prototype.querySelector.call(element, selector);
XhmikosR's avatar
XhmikosR committed
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
    },
    children: function children(element, selector) {
      var _ref2;

      var children = (_ref2 = []).concat.apply(_ref2, element.children);

      return children.filter(function (child) {
        return child.matches(selector);
      });
    },
    parents: function parents(element, selector) {
      var parents = [];
      var ancestor = element.parentNode;

      while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
        if (this.matches(ancestor, selector)) {
          parents.push(ancestor);
        }

        ancestor = ancestor.parentNode;
      }

      return parents;
    },
    prev: function prev(element, selector) {
      var previous = element.previousElementSibling;

      while (previous) {
        if (previous.matches(selector)) {
          return [previous];
        }

        previous = previous.previousElementSibling;
      }

      return [];
    },
    next: function next(element, selector) {
      var next = element.nextElementSibling;

      while (next) {
        if (this.matches(next, selector)) {
          return [next];
        }

        next = next.nextElementSibling;
      }

      return [];
    }
  };

Jacob Thornton's avatar
Jacob Thornton committed
1004
  /**
XhmikosR's avatar
Dist    
XhmikosR committed
1005
1006
1007
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
1008
   */
Mark Otto's avatar
dist    
Mark Otto committed
1009

XhmikosR's avatar
Dist    
XhmikosR committed
1010
  var NAME$2 = 'carousel';
XhmikosR's avatar
XhmikosR committed
1011
  var VERSION$2 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
1012
1013
1014
  var DATA_KEY$2 = 'bs.carousel';
  var EVENT_KEY$2 = "." + DATA_KEY$2;
  var DATA_API_KEY$2 = '.data-api';
XhmikosR's avatar
XhmikosR committed
1015
1016
  var ARROW_LEFT_KEY = 'ArrowLeft';
  var ARROW_RIGHT_KEY = 'ArrowRight';
XhmikosR's avatar
Dist    
XhmikosR committed
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
  var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch

  var SWIPE_THRESHOLD = 40;
  var Default = {
    interval: 5000,
    keyboard: true,
    slide: false,
    pause: 'hover',
    wrap: true,
    touch: true
  };
  var DefaultType = {
    interval: '(number|boolean)',
    keyboard: 'boolean',
    slide: '(boolean|string)',
    pause: '(string|boolean)',
    wrap: 'boolean',
    touch: 'boolean'
  };
XhmikosR's avatar
XhmikosR committed
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
  var DIRECTION_NEXT = 'next';
  var DIRECTION_PREV = 'prev';
  var DIRECTION_LEFT = 'left';
  var DIRECTION_RIGHT = 'right';
  var EVENT_SLIDE = "slide" + EVENT_KEY$2;
  var EVENT_SLID = "slid" + EVENT_KEY$2;
  var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
  var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
  var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
  var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
  var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
  var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
  var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
  var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
  var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
  var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
  var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
  var CLASS_NAME_CAROUSEL = 'carousel';
  var CLASS_NAME_ACTIVE$1 = 'active';
  var CLASS_NAME_SLIDE = 'slide';
  var CLASS_NAME_RIGHT = 'carousel-item-right';
  var CLASS_NAME_LEFT = 'carousel-item-left';
  var CLASS_NAME_NEXT = 'carousel-item-next';
  var CLASS_NAME_PREV = 'carousel-item-prev';
  var CLASS_NAME_POINTER_EVENT = 'pointer-event';
XhmikosR's avatar
XhmikosR committed
1061
  var SELECTOR_ACTIVE = '.active';
XhmikosR's avatar
XhmikosR committed
1062
1063
1064
1065
1066
  var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
  var SELECTOR_ITEM = '.carousel-item';
  var SELECTOR_ITEM_IMG = '.carousel-item img';
  var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
  var SELECTOR_INDICATORS = '.carousel-indicators';
XhmikosR's avatar
XhmikosR committed
1067
1068
  var SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
  var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
XhmikosR's avatar
Dist    
XhmikosR committed
1069
1070
1071
1072
  var PointerType = {
    TOUCH: 'touch',
    PEN: 'pen'
  };
XhmikosR's avatar
XhmikosR committed
1073
1074
1075
1076
1077
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
1078

XhmikosR's avatar
XhmikosR committed
1079
  var Carousel = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
    function Carousel(element, config) {
      this._items = null;
      this._interval = null;
      this._activeElement = null;
      this._isPaused = false;
      this._isSliding = false;
      this.touchTimeout = null;
      this.touchStartX = 0;
      this.touchDeltaX = 0;
      this._config = this._getConfig(config);
      this._element = element;
XhmikosR's avatar
XhmikosR committed
1091
      this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1092
      this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
XhmikosR's avatar
XhmikosR committed
1093
      this._pointerEvent = Boolean(window.PointerEvent);
XhmikosR's avatar
Dist    
XhmikosR committed
1094
1095

      this._addEventListeners();
XhmikosR's avatar
XhmikosR committed
1096
1097

      Data.setData(element, DATA_KEY$2, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1098
1099
1100
1101
1102
1103
1104
1105
    } // Getters


    var _proto = Carousel.prototype;

    // Public
    _proto.next = function next() {
      if (!this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1106
        this._slide(DIRECTION_NEXT);
XhmikosR's avatar
Dist    
XhmikosR committed
1107
      }
Mark Otto's avatar
dist    
Mark Otto committed
1108
    };
Jacob Thornton's avatar
Jacob Thornton committed
1109

XhmikosR's avatar
Dist    
XhmikosR committed
1110
1111
1112
    _proto.nextWhenVisible = function nextWhenVisible() {
      // Don't call next when the page isn't visible
      // or the carousel or its parent isn't visible
XhmikosR's avatar
XhmikosR committed
1113
      if (!document.hidden && isVisible(this._element)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1114
1115
        this.next();
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1116
1117
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1118
1119
    _proto.prev = function prev() {
      if (!this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1120
        this._slide(DIRECTION_PREV);
XhmikosR's avatar
Dist    
XhmikosR committed
1121
1122
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1123

XhmikosR's avatar
Dist    
XhmikosR committed
1124
1125
1126
1127
    _proto.pause = function pause(event) {
      if (!event) {
        this._isPaused = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1128

XhmikosR's avatar
XhmikosR committed
1129
      if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
XhmikosR's avatar
XhmikosR committed
1130
        triggerTransitionEnd(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1131
1132
        this.cycle(true);
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1133

XhmikosR's avatar
Dist    
XhmikosR committed
1134
1135
1136
      clearInterval(this._interval);
      this._interval = null;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1137

XhmikosR's avatar
Dist    
XhmikosR committed
1138
1139
1140
1141
    _proto.cycle = function cycle(event) {
      if (!event) {
        this._isPaused = false;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1142

XhmikosR's avatar
Dist    
XhmikosR committed
1143
      if (this._interval) {
Mark Otto's avatar
dist    
Mark Otto committed
1144
1145
        clearInterval(this._interval);
        this._interval = null;
XhmikosR's avatar
Dist    
XhmikosR committed
1146
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1147

XhmikosR's avatar
XhmikosR committed
1148
      if (this._config && this._config.interval && !this._isPaused) {
XhmikosR's avatar
XhmikosR committed
1149
1150
        this._updateInterval();

XhmikosR's avatar
Dist    
XhmikosR committed
1151
1152
1153
        this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1154

XhmikosR's avatar
Dist    
XhmikosR committed
1155
1156
    _proto.to = function to(index) {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
1157

XhmikosR's avatar
XhmikosR committed
1158
      this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
Jacob Thornton's avatar
Jacob Thornton committed
1159

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

XhmikosR's avatar
Dist    
XhmikosR committed
1162
1163
1164
      if (index > this._items.length - 1 || index < 0) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1165

XhmikosR's avatar
Dist    
XhmikosR committed
1166
      if (this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1167
        EventHandler.one(this._element, EVENT_SLID, function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1168
1169
1170
1171
          return _this.to(index);
        });
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1172

XhmikosR's avatar
Dist    
XhmikosR committed
1173
1174
1175
1176
1177
      if (activeIndex === index) {
        this.pause();
        this.cycle();
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1178

XhmikosR's avatar
XhmikosR committed
1179
      var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
Mark Otto's avatar
dist    
Mark Otto committed
1180

XhmikosR's avatar
Dist    
XhmikosR committed
1181
1182
      this._slide(direction, this._items[index]);
    };
Mark Otto's avatar
dist    
Mark Otto committed
1183

XhmikosR's avatar
Dist    
XhmikosR committed
1184
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1185
1186
      EventHandler.off(this._element, EVENT_KEY$2);
      Data.removeData(this._element, DATA_KEY$2);
XhmikosR's avatar
Dist    
XhmikosR committed
1187
1188
1189
1190
1191
1192
1193
1194
      this._items = null;
      this._config = null;
      this._element = null;
      this._interval = null;
      this._isPaused = null;
      this._isSliding = null;
      this._activeElement = null;
      this._indicatorsElement = null;
Mark Otto's avatar
Mark Otto committed
1195
1196
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
1197
1198

    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
1199
      config = _extends({}, Default, config);
XhmikosR's avatar
XhmikosR committed
1200
      typeCheckConfig(NAME$2, config, DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
1201
1202
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
1203

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

XhmikosR's avatar
Dist    
XhmikosR committed
1207
1208
1209
      if (absDeltax <= SWIPE_THRESHOLD) {
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1210

XhmikosR's avatar
XhmikosR committed
1211
1212
      var direction = absDeltax / this.touchDeltaX;
      this.touchDeltaX = 0; // swipe left
Jacob Thornton's avatar
Jacob Thornton committed
1213

XhmikosR's avatar
Dist    
XhmikosR committed
1214
1215
1216
      if (direction > 0) {
        this.prev();
      } // swipe right
Mark Otto's avatar
dist    
Mark Otto committed
1217
1218


XhmikosR's avatar
Dist    
XhmikosR committed
1219
1220
1221
1222
      if (direction < 0) {
        this.next();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1223

XhmikosR's avatar
Dist    
XhmikosR committed
1224
1225
    _proto._addEventListeners = function _addEventListeners() {
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
1226

XhmikosR's avatar
Dist    
XhmikosR committed
1227
      if (this._config.keyboard) {
XhmikosR's avatar
XhmikosR committed
1228
        EventHandler.on(this._element, EVENT_KEYDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1229
1230
1231
          return _this2._keydown(event);
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
1232

XhmikosR's avatar
Dist    
XhmikosR committed
1233
      if (this._config.pause === 'hover') {
XhmikosR's avatar
XhmikosR committed
1234
        EventHandler.on(this._element, EVENT_MOUSEENTER, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1235
          return _this2.pause(event);
XhmikosR's avatar
XhmikosR committed
1236
        });
XhmikosR's avatar
XhmikosR committed
1237
        EventHandler.on(this._element, EVENT_MOUSELEAVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1238
1239
1240
          return _this2.cycle(event);
        });
      }
Jacob Thornton's avatar
Jacob Thornton committed
1241

1242
      if (this._config.touch && this._touchSupported) {
Mark Otto's avatar
Mark Otto committed
1243
1244
        this._addTouchEventListeners();
      }
XhmikosR's avatar
Dist    
XhmikosR committed
1245
    };
Jacob Thornton's avatar
Jacob Thornton committed
1246

XhmikosR's avatar
Dist    
XhmikosR committed
1247
1248
    _proto._addTouchEventListeners = function _addTouchEventListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
1249

XhmikosR's avatar
Dist    
XhmikosR committed
1250
      var start = function start(event) {
XhmikosR's avatar
XhmikosR committed
1251
1252
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchStartX = event.clientX;
XhmikosR's avatar
Dist    
XhmikosR committed
1253
        } else if (!_this3._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1254
          _this3.touchStartX = event.touches[0].clientX;
Mark Otto's avatar
dist    
Mark Otto committed
1255
1256
        }
      };
Jacob Thornton's avatar
Jacob Thornton committed
1257

XhmikosR's avatar
Dist    
XhmikosR committed
1258
1259
      var move = function move(event) {
        // ensure swiping with one touch and not pinching
XhmikosR's avatar
XhmikosR committed
1260
        if (event.touches && event.touches.length > 1) {
XhmikosR's avatar
Dist    
XhmikosR committed
1261
1262
          _this3.touchDeltaX = 0;
        } else {
XhmikosR's avatar
XhmikosR committed
1263
          _this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX;
XhmikosR's avatar
Dist    
XhmikosR committed
1264
        }
Mark Otto's avatar
dist    
Mark Otto committed
1265
      };
Jacob Thornton's avatar
Jacob Thornton committed
1266

XhmikosR's avatar
Dist    
XhmikosR committed
1267
      var end = function end(event) {
XhmikosR's avatar
XhmikosR committed
1268
1269
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchDeltaX = event.clientX - _this3.touchStartX;
XhmikosR's avatar
Dist    
XhmikosR committed
1270
        }
Jacob Thornton's avatar
Jacob Thornton committed
1271

XhmikosR's avatar
Dist    
XhmikosR committed
1272
        _this3._handleSwipe();
Mark Otto's avatar
dist    
Mark Otto committed
1273

XhmikosR's avatar
Dist    
XhmikosR committed
1274
1275
1276
1277
1278
1279
1280
1281
1282
        if (_this3._config.pause === 'hover') {
          // If it's a touch-enabled device, mouseenter/leave are fired as
          // part of the mouse compatibility events on first tap - the carousel
          // would stop cycling until user tapped out of it;
          // here, we listen for touchend, explicitly pause the carousel
          // (as if it's the second time we tap on it, mouseenter compat event
          // is NOT fired) and after a timeout (to allow for mouse compatibility
          // events to fire) we explicitly restart cycling
          _this3.pause();
Mark Otto's avatar
dist    
Mark Otto committed
1283

XhmikosR's avatar
Dist    
XhmikosR committed
1284
1285
1286
          if (_this3.touchTimeout) {
            clearTimeout(_this3.touchTimeout);
          }
Jacob Thornton's avatar
Jacob Thornton committed
1287

XhmikosR's avatar
Dist    
XhmikosR committed
1288
1289
1290
1291
          _this3.touchTimeout = setTimeout(function (event) {
            return _this3.cycle(event);
          }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
        }
Mark Otto's avatar
dist    
Mark Otto committed
1292
      };
Jacob Thornton's avatar
Jacob Thornton committed
1293

XhmikosR's avatar
XhmikosR committed
1294
1295
      SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(function (itemImg) {
        EventHandler.on(itemImg, EVENT_DRAG_START, function (e) {
XhmikosR's avatar
XhmikosR committed
1296
1297
          return e.preventDefault();
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1298
      });
Jacob Thornton's avatar
Jacob Thornton committed
1299

XhmikosR's avatar
Dist    
XhmikosR committed
1300
      if (this._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1301
        EventHandler.on(this._element, EVENT_POINTERDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1302
1303
          return start(event);
        });
XhmikosR's avatar
XhmikosR committed
1304
        EventHandler.on(this._element, EVENT_POINTERUP, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1305
1306
          return end(event);
        });
Jacob Thornton's avatar
Jacob Thornton committed
1307

XhmikosR's avatar
XhmikosR committed
1308
        this._element.classList.add(CLASS_NAME_POINTER_EVENT);
XhmikosR's avatar
Dist    
XhmikosR committed
1309
      } else {
XhmikosR's avatar
XhmikosR committed
1310
        EventHandler.on(this._element, EVENT_TOUCHSTART, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1311
          return start(event);
Mark Otto's avatar
dist    
Mark Otto committed
1312
        });
XhmikosR's avatar
XhmikosR committed
1313
        EventHandler.on(this._element, EVENT_TOUCHMOVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1314
1315
          return move(event);
        });
XhmikosR's avatar
XhmikosR committed
1316
        EventHandler.on(this._element, EVENT_TOUCHEND, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1317
1318
1319
1320
          return end(event);
        });
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1321

XhmikosR's avatar
Dist    
XhmikosR committed
1322
1323
1324
1325
    _proto._keydown = function _keydown(event) {
      if (/input|textarea/i.test(event.target.tagName)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1326

XhmikosR's avatar
XhmikosR committed
1327
1328
      switch (event.key) {
        case ARROW_LEFT_KEY:
XhmikosR's avatar
Dist    
XhmikosR committed
1329
1330
1331
          event.preventDefault();
          this.prev();
          break;
Mark Otto's avatar
dist    
Mark Otto committed
1332

XhmikosR's avatar
XhmikosR committed
1333
        case ARROW_RIGHT_KEY:
XhmikosR's avatar
Dist    
XhmikosR committed
1334
1335
1336
1337
1338
          event.preventDefault();
          this.next();
          break;
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1339

XhmikosR's avatar
Dist    
XhmikosR committed
1340
    _proto._getItemIndex = function _getItemIndex(element) {
XhmikosR's avatar
XhmikosR committed
1341
      this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
XhmikosR's avatar
Dist    
XhmikosR committed
1342
1343
      return this._items.indexOf(element);
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1344

XhmikosR's avatar
Dist    
XhmikosR committed
1345
    _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
XhmikosR's avatar
XhmikosR committed
1346
1347
      var isNextDirection = direction === DIRECTION_NEXT;
      var isPrevDirection = direction === DIRECTION_PREV;
Mark Otto's avatar
grunt    
Mark Otto committed
1348

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1354
1355
1356
      if (isGoingToWrap && !this._config.wrap) {
        return activeElement;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1357

XhmikosR's avatar
XhmikosR committed
1358
      var delta = direction === DIRECTION_PREV ? -1 : 1;
XhmikosR's avatar
Dist    
XhmikosR committed
1359
1360
1361
      var itemIndex = (activeIndex + delta) % this._items.length;
      return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
    };
Jacob Thornton's avatar
Jacob Thornton committed
1362

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

XhmikosR's avatar
XhmikosR committed
1366
      var fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
Jacob Thornton's avatar
Jacob Thornton committed
1367

XhmikosR's avatar
XhmikosR committed
1368
      return EventHandler.trigger(this._element, EVENT_SLIDE, {
XhmikosR's avatar
Dist    
XhmikosR committed
1369
1370
1371
1372
1373
1374
        relatedTarget: relatedTarget,
        direction: eventDirectionName,
        from: fromIndex,
        to: targetIndex
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
1375

XhmikosR's avatar
Dist    
XhmikosR committed
1376
1377
    _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
      if (this._indicatorsElement) {
XhmikosR's avatar
XhmikosR committed
1378
        var indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement);
XhmikosR's avatar
XhmikosR committed
1379
1380

        for (var i = 0; i < indicators.length; i++) {
XhmikosR's avatar
XhmikosR committed
1381
          indicators[i].classList.remove(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
XhmikosR committed
1382
        }
Jacob Thornton's avatar
Jacob Thornton committed
1383

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

XhmikosR's avatar
Dist    
XhmikosR committed
1386
        if (nextIndicator) {
XhmikosR's avatar
XhmikosR committed
1387
          nextIndicator.classList.add(CLASS_NAME_ACTIVE$1);
Mark Otto's avatar
dist    
Mark Otto committed
1388
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1389
1390
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1391

XhmikosR's avatar
XhmikosR committed
1392
1393
1394
1395
1396
1397
1398
    _proto._updateInterval = function _updateInterval() {
      var element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);

      if (!element) {
        return;
      }

XhmikosR's avatar
XhmikosR committed
1399
      var elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
XhmikosR's avatar
XhmikosR committed
1400
1401
1402
1403
1404
1405
1406
1407
1408

      if (elementInterval) {
        this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
        this._config.interval = elementInterval;
      } else {
        this._config.interval = this._config.defaultInterval || this._config.interval;
      }
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1409
1410
    _proto._slide = function _slide(direction, element) {
      var _this4 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1411

XhmikosR's avatar
XhmikosR committed
1412
      var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
Mark Otto's avatar
dist    
Mark Otto committed
1413

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1420
1421
1422
1423
      var isCycling = Boolean(this._interval);
      var directionalClassName;
      var orderClassName;
      var eventDirectionName;
Jacob Thornton's avatar
Jacob Thornton committed
1424

XhmikosR's avatar
XhmikosR committed
1425
1426
1427
1428
      if (direction === DIRECTION_NEXT) {
        directionalClassName = CLASS_NAME_LEFT;
        orderClassName = CLASS_NAME_NEXT;
        eventDirectionName = DIRECTION_LEFT;
XhmikosR's avatar
Dist    
XhmikosR committed
1429
      } else {
XhmikosR's avatar
XhmikosR committed
1430
1431
1432
        directionalClassName = CLASS_NAME_RIGHT;
        orderClassName = CLASS_NAME_PREV;
        eventDirectionName = DIRECTION_RIGHT;
XhmikosR's avatar
Dist    
XhmikosR committed
1433
      }
Jacob Thornton's avatar
Jacob Thornton committed
1434

XhmikosR's avatar
XhmikosR committed
1435
      if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1436
1437
1438
        this._isSliding = false;
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1439

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

XhmikosR's avatar
XhmikosR committed
1442
      if (slideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1443
1444
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1445

XhmikosR's avatar
Dist    
XhmikosR committed
1446
1447
1448
1449
      if (!activeElement || !nextElement) {
        // Some weirdness is happening, so we bail
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1450

XhmikosR's avatar
Dist    
XhmikosR committed
1451
      this._isSliding = true;
Jacob Thornton's avatar
Jacob Thornton committed
1452

XhmikosR's avatar
Dist    
XhmikosR committed
1453
1454
1455
      if (isCycling) {
        this.pause();
      }
Mark Otto's avatar
dist    
Mark Otto committed
1456

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

XhmikosR's avatar
XhmikosR committed
1459
1460
      this._activeElement = nextElement;

XhmikosR's avatar
XhmikosR committed
1461
      if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
XhmikosR's avatar
XhmikosR committed
1462
1463
1464
1465
1466
1467
        nextElement.classList.add(orderClassName);
        reflow(nextElement);
        activeElement.classList.add(directionalClassName);
        nextElement.classList.add(directionalClassName);
        var transitionDuration = getTransitionDurationFromElement(activeElement);
        EventHandler.one(activeElement, TRANSITION_END, function () {
XhmikosR's avatar
XhmikosR committed
1468
          nextElement.classList.remove(directionalClassName, orderClassName);
XhmikosR's avatar
XhmikosR committed
1469
          nextElement.classList.add(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
XhmikosR committed
1470
          activeElement.classList.remove(CLASS_NAME_ACTIVE$1, orderClassName, directionalClassName);
XhmikosR's avatar
Dist    
XhmikosR committed
1471
1472
          _this4._isSliding = false;
          setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
1473
            EventHandler.trigger(_this4._element, EVENT_SLID, {
XhmikosR's avatar
XhmikosR committed
1474
1475
1476
1477
1478
              relatedTarget: nextElement,
              direction: eventDirectionName,
              from: activeElementIndex,
              to: nextElementIndex
            });
XhmikosR's avatar
Dist    
XhmikosR committed
1479
          }, 0);
XhmikosR's avatar
XhmikosR committed
1480
1481
        });
        emulateTransitionEnd(activeElement, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
1482
      } else {
XhmikosR's avatar
XhmikosR committed
1483
1484
        activeElement.classList.remove(CLASS_NAME_ACTIVE$1);
        nextElement.classList.add(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1485
        this._isSliding = false;
XhmikosR's avatar
XhmikosR committed
1486
        EventHandler.trigger(this._element, EVENT_SLID, {
XhmikosR's avatar
XhmikosR committed
1487
1488
1489
1490
1491
          relatedTarget: nextElement,
          direction: eventDirectionName,
          from: activeElementIndex,
          to: nextElementIndex
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1492
1493
1494
1495
1496
      }

      if (isCycling) {
        this.cycle();
      }
Mark Otto's avatar
Mark Otto committed
1497
1498
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
1499

XhmikosR's avatar
XhmikosR committed
1500
    Carousel.carouselInterface = function carouselInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
1501
      var data = Data.getData(element, DATA_KEY$2);
Jacob Thornton's avatar
Jacob Thornton committed
1502

XhmikosR's avatar
XhmikosR committed
1503
      var _config = _extends({}, Default, Manipulator.getDataAttributes(element));
Jacob Thornton's avatar
Jacob Thornton committed
1504

XhmikosR's avatar
XhmikosR committed
1505
      if (typeof config === 'object') {
XhmikosR's avatar
XhmikosR committed
1506
        _config = _extends({}, _config, config);
XhmikosR's avatar
XhmikosR committed
1507
      }
Jacob Thornton's avatar
Jacob Thornton committed
1508

XhmikosR's avatar
XhmikosR committed
1509
      var action = typeof config === 'string' ? config : _config.slide;
Jacob Thornton's avatar
Jacob Thornton committed
1510

XhmikosR's avatar
XhmikosR committed
1511
1512
1513
1514
1515
1516
1517
1518
      if (!data) {
        data = new Carousel(element, _config);
      }

      if (typeof config === 'number') {
        data.to(config);
      } else if (typeof action === 'string') {
        if (typeof data[action] === 'undefined') {
XhmikosR's avatar
Dist.    
XhmikosR committed
1519
          throw new TypeError("No method named \"" + action + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
1520
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1521

XhmikosR's avatar
XhmikosR committed
1522
1523
1524
1525
1526
1527
        data[action]();
      } else if (_config.interval && _config.ride) {
        data.pause();
        data.cycle();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1528

XhmikosR's avatar
XhmikosR committed
1529
    Carousel.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
1530
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1531
        Carousel.carouselInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1532
1533
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1534

XhmikosR's avatar
XhmikosR committed
1535
1536
    Carousel.dataApiClickHandler = function dataApiClickHandler(event) {
      var target = getElementFromSelector(this);
Jacob Thornton's avatar
Jacob Thornton committed
1537

XhmikosR's avatar
XhmikosR committed
1538
      if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1539
1540
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1541

XhmikosR's avatar
XhmikosR committed
1542
      var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this));
Mark Otto's avatar
dist    
Mark Otto committed
1543

XhmikosR's avatar
XhmikosR committed
1544
      var slideIndex = this.getAttribute('data-bs-slide-to');
Mark Otto's avatar
dist    
Mark Otto committed
1545

XhmikosR's avatar
Dist    
XhmikosR committed
1546
1547
      if (slideIndex) {
        config.interval = false;
Mark Otto's avatar
dist    
Mark Otto committed
1548
      }
Mark Otto's avatar
dist    
Mark Otto committed
1549

XhmikosR's avatar
XhmikosR committed
1550
      Carousel.carouselInterface(target, config);
Jacob Thornton's avatar
Jacob Thornton committed
1551

XhmikosR's avatar
Dist    
XhmikosR committed
1552
      if (slideIndex) {
XhmikosR's avatar
XhmikosR committed
1553
        Data.getData(target, DATA_KEY$2).to(slideIndex);
XhmikosR's avatar
Dist    
XhmikosR committed
1554
1555
1556
      }

      event.preventDefault();
Mark Otto's avatar
dist    
Mark Otto committed
1557
    };
Jacob Thornton's avatar
Jacob Thornton committed
1558

XhmikosR's avatar
XhmikosR committed
1559
    Carousel.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1560
1561
1562
      return Data.getData(element, DATA_KEY$2);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
    _createClass(Carousel, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$2;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default;
      }
    }]);

Mark Otto's avatar
dist    
Mark Otto committed
1575
    return Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1576
1577
1578
1579
1580
1581
1582
1583
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
1584
1585
1586
  EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
  EventHandler.on(window, EVENT_LOAD_DATA_API, function () {
    var carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
XhmikosR's avatar
Dist    
XhmikosR committed
1587
1588

    for (var i = 0, len = carousels.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
1589
      Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2));
XhmikosR's avatar
Dist    
XhmikosR committed
1590
1591
1592
1593
1594
1595
    }
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1596
   * add .Carousel to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
1597
1598
   */

XhmikosR's avatar
XhmikosR committed
1599
1600
1601
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
1602

XhmikosR's avatar
XhmikosR committed
1603
1604
1605
1606
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$2];
      $.fn[NAME$2] = Carousel.jQueryInterface;
      $.fn[NAME$2].Constructor = Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1607

XhmikosR's avatar
XhmikosR committed
1608
1609
1610
1611
1612
1613
      $.fn[NAME$2].noConflict = function () {
        $.fn[NAME$2] = JQUERY_NO_CONFLICT;
        return Carousel.jQueryInterface;
      };
    }
  });
Jacob Thornton's avatar
Jacob Thornton committed
1614

XhmikosR's avatar
Dist    
XhmikosR committed
1615
1616
1617
1618
1619
1620
1621
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$3 = 'collapse';
XhmikosR's avatar
XhmikosR committed
1622
  var VERSION$3 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
  var DATA_KEY$3 = 'bs.collapse';
  var EVENT_KEY$3 = "." + DATA_KEY$3;
  var DATA_API_KEY$3 = '.data-api';
  var Default$1 = {
    toggle: true,
    parent: ''
  };
  var DefaultType$1 = {
    toggle: 'boolean',
    parent: '(string|element)'
  };
XhmikosR's avatar
XhmikosR committed
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
  var EVENT_SHOW = "show" + EVENT_KEY$3;
  var EVENT_SHOWN = "shown" + EVENT_KEY$3;
  var EVENT_HIDE = "hide" + EVENT_KEY$3;
  var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
  var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
  var CLASS_NAME_SHOW = 'show';
  var CLASS_NAME_COLLAPSE = 'collapse';
  var CLASS_NAME_COLLAPSING = 'collapsing';
  var CLASS_NAME_COLLAPSED = 'collapsed';
  var WIDTH = 'width';
  var HEIGHT = 'height';
  var SELECTOR_ACTIVES = '.show, .collapsing';
XhmikosR's avatar
XhmikosR committed
1646
  var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="collapse"]';
XhmikosR's avatar
XhmikosR committed
1647
1648
1649
1650
1651
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
1652

XhmikosR's avatar
XhmikosR committed
1653
  var Collapse = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1654
1655
1656
1657
    function Collapse(element, config) {
      this._isTransitioning = false;
      this._element = element;
      this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
1658
      this._triggerArray = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1 + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE$1 + "[data-bs-target=\"#" + element.id + "\"]"));
XhmikosR's avatar
XhmikosR committed
1659
      var toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1660
1661
1662

      for (var i = 0, len = toggleList.length; i < len; i++) {
        var elem = toggleList[i];
XhmikosR's avatar
XhmikosR committed
1663
        var selector = getSelectorFromElement(elem);
XhmikosR's avatar
XhmikosR committed
1664
        var filterElement = SelectorEngine.find(selector).filter(function (foundElem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1665
1666
          return foundElem === element;
        });
Johann-S's avatar
build    
Johann-S committed
1667

XhmikosR's avatar
XhmikosR committed
1668
        if (selector !== null && filterElement.length) {
XhmikosR's avatar
Dist    
XhmikosR committed
1669
          this._selector = selector;
Jacob Thornton's avatar
Jacob Thornton committed
1670

XhmikosR's avatar
Dist    
XhmikosR committed
1671
          this._triggerArray.push(elem);
Mark Otto's avatar
dist    
Mark Otto committed
1672
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1673
      }
Jacob Thornton's avatar
Jacob Thornton committed
1674

XhmikosR's avatar
Dist    
XhmikosR committed
1675
      this._parent = this._config.parent ? this._getParent() : null;
Jacob Thornton's avatar
Jacob Thornton committed
1676

XhmikosR's avatar
Dist    
XhmikosR committed
1677
1678
1679
      if (!this._config.parent) {
        this._addAriaAndCollapsedClass(this._element, this._triggerArray);
      }
Jacob Thornton's avatar
Jacob Thornton committed
1680

XhmikosR's avatar
Dist    
XhmikosR committed
1681
1682
1683
      if (this._config.toggle) {
        this.toggle();
      }
XhmikosR's avatar
XhmikosR committed
1684
1685

      Data.setData(element, DATA_KEY$3, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1686
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
1687
1688


XhmikosR's avatar
Dist    
XhmikosR committed
1689
    var _proto = Collapse.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
1690

XhmikosR's avatar
Dist    
XhmikosR committed
1691
1692
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
1693
      if (this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1694
1695
1696
1697
1698
        this.hide();
      } else {
        this.show();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1699

XhmikosR's avatar
Dist    
XhmikosR committed
1700
1701
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
1702

XhmikosR's avatar
XhmikosR committed
1703
      if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1704
1705
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1706

XhmikosR's avatar
Dist    
XhmikosR committed
1707
1708
      var actives;
      var activesData;
Mark Otto's avatar
dist    
Mark Otto committed
1709

XhmikosR's avatar
Dist    
XhmikosR committed
1710
      if (this._parent) {
XhmikosR's avatar
XhmikosR committed
1711
        actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(function (elem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1712
          if (typeof _this._config.parent === 'string') {
XhmikosR's avatar
XhmikosR committed
1713
            return elem.getAttribute('data-bs-parent') === _this._config.parent;
Mark Otto's avatar
dist    
Mark Otto committed
1714
          }
Jacob Thornton's avatar
Jacob Thornton committed
1715

XhmikosR's avatar
XhmikosR committed
1716
          return elem.classList.contains(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
Dist    
XhmikosR committed
1717
        });
Mark Otto's avatar
dist    
Mark Otto committed
1718

XhmikosR's avatar
Dist    
XhmikosR committed
1719
1720
        if (actives.length === 0) {
          actives = null;
Jacob Thornton's avatar
Jacob Thornton committed
1721
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1722
      }
Jacob Thornton's avatar
Jacob Thornton committed
1723

XhmikosR's avatar
XhmikosR committed
1724
1725
      var container = SelectorEngine.findOne(this._selector);

XhmikosR's avatar
Dist    
XhmikosR committed
1726
      if (actives) {
XhmikosR's avatar
XhmikosR committed
1727
        var tempActiveData = actives.find(function (elem) {
XhmikosR's avatar
XhmikosR committed
1728
1729
          return container !== elem;
        });
XhmikosR's avatar
XhmikosR committed
1730
        activesData = tempActiveData ? Data.getData(tempActiveData, DATA_KEY$3) : null;
Mark Otto's avatar
dist    
Mark Otto committed
1731

XhmikosR's avatar
Dist    
XhmikosR committed
1732
        if (activesData && activesData._isTransitioning) {
Mark Otto's avatar
dist    
Mark Otto committed
1733
1734
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1735
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1736

XhmikosR's avatar
XhmikosR committed
1737
      var startEvent = EventHandler.trigger(this._element, EVENT_SHOW);
Mark Otto's avatar
dist    
Mark Otto committed
1738

XhmikosR's avatar
XhmikosR committed
1739
      if (startEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1740
1741
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1742

XhmikosR's avatar
Dist    
XhmikosR committed
1743
      if (actives) {
XhmikosR's avatar
XhmikosR committed
1744
1745
        actives.forEach(function (elemActive) {
          if (container !== elemActive) {
XhmikosR's avatar
XhmikosR committed
1746
            Collapse.collapseInterface(elemActive, 'hide');
XhmikosR's avatar
XhmikosR committed
1747
          }
Jacob Thornton's avatar
Jacob Thornton committed
1748

XhmikosR's avatar
XhmikosR committed
1749
1750
1751
1752
          if (!activesData) {
            Data.setData(elemActive, DATA_KEY$3, null);
          }
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1753
      }
Jacob Thornton's avatar
Jacob Thornton committed
1754

XhmikosR's avatar
Dist    
XhmikosR committed
1755
      var dimension = this._getDimension();
Jacob Thornton's avatar
Jacob Thornton committed
1756

XhmikosR's avatar
XhmikosR committed
1757
      this._element.classList.remove(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
XhmikosR committed
1758

XhmikosR's avatar
XhmikosR committed
1759
      this._element.classList.add(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1760

XhmikosR's avatar
Dist    
XhmikosR committed
1761
1762
1763
      this._element.style[dimension] = 0;

      if (this._triggerArray.length) {
XhmikosR's avatar
XhmikosR committed
1764
        this._triggerArray.forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
1765
          element.classList.remove(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
XhmikosR committed
1766
1767
          element.setAttribute('aria-expanded', true);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1768
      }
Jacob Thornton's avatar
Jacob Thornton committed
1769

XhmikosR's avatar
Dist    
XhmikosR committed
1770
      this.setTransitioning(true);
Jacob Thornton's avatar
Jacob Thornton committed
1771

XhmikosR's avatar
Dist    
XhmikosR committed
1772
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
1773
        _this._element.classList.remove(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1774

XhmikosR's avatar
XhmikosR committed
1775
        _this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
XhmikosR's avatar
XhmikosR committed
1776

XhmikosR's avatar
Dist    
XhmikosR committed
1777
        _this._element.style[dimension] = '';
Jacob Thornton's avatar
Jacob Thornton committed
1778

XhmikosR's avatar
Dist    
XhmikosR committed
1779
1780
        _this.setTransitioning(false);

XhmikosR's avatar
XhmikosR committed
1781
        EventHandler.trigger(_this._element, EVENT_SHOWN);
Mark Otto's avatar
dist    
Mark Otto committed
1782
      };
Jacob Thornton's avatar
Jacob Thornton committed
1783

XhmikosR's avatar
Dist    
XhmikosR committed
1784
1785
      var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
      var scrollSize = "scroll" + capitalizedDimension;
XhmikosR's avatar
XhmikosR committed
1786
1787
1788
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
1789
1790
      this._element.style[dimension] = this._element[scrollSize] + "px";
    };
Jacob Thornton's avatar
Jacob Thornton committed
1791

XhmikosR's avatar
Dist    
XhmikosR committed
1792
1793
    _proto.hide = function hide() {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1794

XhmikosR's avatar
XhmikosR committed
1795
      if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1796
1797
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1798

XhmikosR's avatar
XhmikosR committed
1799
      var startEvent = EventHandler.trigger(this._element, EVENT_HIDE);
Jacob Thornton's avatar
Jacob Thornton committed
1800

XhmikosR's avatar
XhmikosR committed
1801
      if (startEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1802
1803
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1804

XhmikosR's avatar
Dist    
XhmikosR committed
1805
      var dimension = this._getDimension();
Jacob Thornton's avatar
Jacob Thornton committed
1806

XhmikosR's avatar
Dist    
XhmikosR committed
1807
      this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
XhmikosR's avatar
XhmikosR committed
1808
1809
      reflow(this._element);

XhmikosR's avatar
XhmikosR committed
1810
      this._element.classList.add(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1811

XhmikosR's avatar
XhmikosR committed
1812
      this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
XhmikosR's avatar
XhmikosR committed
1813

XhmikosR's avatar
Dist    
XhmikosR committed
1814
      var triggerArrayLength = this._triggerArray.length;
Mark Otto's avatar
dist    
Mark Otto committed
1815

XhmikosR's avatar
Dist    
XhmikosR committed
1816
1817
1818
      if (triggerArrayLength > 0) {
        for (var i = 0; i < triggerArrayLength; i++) {
          var trigger = this._triggerArray[i];
XhmikosR's avatar
XhmikosR committed
1819
          var elem = getElementFromSelector(trigger);
XhmikosR's avatar
Dist    
XhmikosR committed
1820

XhmikosR's avatar
XhmikosR committed
1821
1822
          if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
            trigger.classList.add(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
XhmikosR committed
1823
            trigger.setAttribute('aria-expanded', false);
Mark Otto's avatar
build    
Mark Otto committed
1824
1825
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1826
      }
Mark Otto's avatar
dist    
Mark Otto committed
1827

XhmikosR's avatar
Dist    
XhmikosR committed
1828
      this.setTransitioning(true);
Jacob Thornton's avatar
Jacob Thornton committed
1829

XhmikosR's avatar
Dist    
XhmikosR committed
1830
1831
      var complete = function complete() {
        _this2.setTransitioning(false);
Jacob Thornton's avatar
Jacob Thornton committed
1832

XhmikosR's avatar
XhmikosR committed
1833
        _this2._element.classList.remove(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1834

XhmikosR's avatar
XhmikosR committed
1835
        _this2._element.classList.add(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
XhmikosR committed
1836

XhmikosR's avatar
XhmikosR committed
1837
        EventHandler.trigger(_this2._element, EVENT_HIDDEN);
Mark Otto's avatar
dist    
Mark Otto committed
1838
      };
Jacob Thornton's avatar
Jacob Thornton committed
1839

XhmikosR's avatar
Dist    
XhmikosR committed
1840
      this._element.style[dimension] = '';
XhmikosR's avatar
XhmikosR committed
1841
1842
1843
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
1844
    };
Jacob Thornton's avatar
Jacob Thornton committed
1845

XhmikosR's avatar
Dist    
XhmikosR committed
1846
1847
1848
    _proto.setTransitioning = function setTransitioning(isTransitioning) {
      this._isTransitioning = isTransitioning;
    };
Jacob Thornton's avatar
Jacob Thornton committed
1849

XhmikosR's avatar
Dist    
XhmikosR committed
1850
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1851
      Data.removeData(this._element, DATA_KEY$3);
XhmikosR's avatar
Dist    
XhmikosR committed
1852
1853
1854
1855
1856
      this._config = null;
      this._parent = null;
      this._element = null;
      this._triggerArray = null;
      this._isTransitioning = null;
Mark Otto's avatar
Mark Otto committed
1857
1858
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
1859

XhmikosR's avatar
Dist    
XhmikosR committed
1860
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
1861
      config = _extends({}, Default$1, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1862
      config.toggle = Boolean(config.toggle); // Coerce string values
Mark Otto's avatar
grunt    
Mark Otto committed
1863

XhmikosR's avatar
XhmikosR committed
1864
      typeCheckConfig(NAME$3, config, DefaultType$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1865
1866
      return config;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1867

XhmikosR's avatar
Dist    
XhmikosR committed
1868
    _proto._getDimension = function _getDimension() {
XhmikosR's avatar
XhmikosR committed
1869
      return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
XhmikosR's avatar
Dist    
XhmikosR committed
1870
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1871

XhmikosR's avatar
Dist    
XhmikosR committed
1872
1873
    _proto._getParent = function _getParent() {
      var _this3 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
1874

XhmikosR's avatar
Dist.    
XhmikosR committed
1875
      var parent = this._config.parent;
Mark Otto's avatar
dist    
Mark Otto committed
1876

XhmikosR's avatar
Dist.    
XhmikosR committed
1877
1878
1879
1880
      if (isElement(parent)) {
        // it's a jQuery object
        if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
          parent = parent[0];
XhmikosR's avatar
Dist    
XhmikosR committed
1881
1882
        }
      } else {
XhmikosR's avatar
Dist.    
XhmikosR committed
1883
        parent = SelectorEngine.findOne(parent);
XhmikosR's avatar
Dist    
XhmikosR committed
1884
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1885

XhmikosR's avatar
XhmikosR committed
1886
      var selector = SELECTOR_DATA_TOGGLE$1 + "[data-bs-parent=\"" + parent + "\"]";
XhmikosR's avatar
XhmikosR committed
1887
      SelectorEngine.find(selector, parent).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
1888
        var selected = getElementFromSelector(element);
1889
1890

        _this3._addAriaAndCollapsedClass(selected, [element]);
XhmikosR's avatar
Dist    
XhmikosR committed
1891
1892
1893
      });
      return parent;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1894

XhmikosR's avatar
Dist    
XhmikosR committed
1895
    _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
XhmikosR's avatar
XhmikosR committed
1896
1897
1898
      if (!element || !triggerArray.length) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1899

XhmikosR's avatar
XhmikosR committed
1900
1901
1902
1903
1904
1905
      var isOpen = element.classList.contains(CLASS_NAME_SHOW);
      triggerArray.forEach(function (elem) {
        if (isOpen) {
          elem.classList.remove(CLASS_NAME_COLLAPSED);
        } else {
          elem.classList.add(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
XhmikosR committed
1906
        }
XhmikosR's avatar
XhmikosR committed
1907
1908
1909

        elem.setAttribute('aria-expanded', isOpen);
      });
Mark Otto's avatar
Mark Otto committed
1910
1911
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
1912

XhmikosR's avatar
XhmikosR committed
1913
    Collapse.collapseInterface = function collapseInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
1914
      var data = Data.getData(element, DATA_KEY$3);
Jacob Thornton's avatar
Jacob Thornton committed
1915

XhmikosR's avatar
XhmikosR committed
1916
      var _config = _extends({}, Default$1, Manipulator.getDataAttributes(element), typeof config === 'object' && config ? config : {});
Mark Otto's avatar
grunt    
Mark Otto committed
1917

XhmikosR's avatar
XhmikosR committed
1918
      if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
XhmikosR's avatar
XhmikosR committed
1919
1920
        _config.toggle = false;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1921

XhmikosR's avatar
XhmikosR committed
1922
1923
1924
1925
1926
1927
      if (!data) {
        data = new Collapse(element, _config);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
Dist.    
XhmikosR committed
1928
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist    
XhmikosR committed
1929
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1930

XhmikosR's avatar
XhmikosR committed
1931
1932
1933
        data[config]();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
1934

XhmikosR's avatar
XhmikosR committed
1935
    Collapse.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
1936
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1937
        Collapse.collapseInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1938
1939
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1940

XhmikosR's avatar
XhmikosR committed
1941
    Collapse.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1942
1943
1944
      return Data.getData(element, DATA_KEY$3);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
    _createClass(Collapse, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$3;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$1;
      }
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
1956

XhmikosR's avatar
Dist    
XhmikosR committed
1957
1958
1959
1960
1961
1962
1963
    return Collapse;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
1964

Jacob Thornton's avatar
Jacob Thornton committed
1965

XhmikosR's avatar
XhmikosR committed
1966
  EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1967
    // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
XhmikosR's avatar
XhmikosR committed
1968
    if (event.target.tagName === 'A') {
XhmikosR's avatar
Dist    
XhmikosR committed
1969
1970
      event.preventDefault();
    }
Mark Otto's avatar
dist    
Mark Otto committed
1971

XhmikosR's avatar
XhmikosR committed
1972
1973
    var triggerData = Manipulator.getDataAttributes(this);
    var selector = getSelectorFromElement(this);
XhmikosR's avatar
XhmikosR committed
1974
    var selectorElements = SelectorEngine.find(selector);
XhmikosR's avatar
XhmikosR committed
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
    selectorElements.forEach(function (element) {
      var data = Data.getData(element, DATA_KEY$3);
      var config;

      if (data) {
        // update parent attribute
        if (data._parent === null && typeof triggerData.parent === 'string') {
          data._config.parent = triggerData.parent;
          data._parent = data._getParent();
        }

        config = 'toggle';
      } else {
        config = triggerData;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1990

XhmikosR's avatar
XhmikosR committed
1991
      Collapse.collapseInterface(element, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1992
1993
1994
1995
1996
1997
    });
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1998
   * add .Collapse to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
1999
   */
Jacob Thornton's avatar
Jacob Thornton committed
2000

XhmikosR's avatar
XhmikosR committed
2001
2002
2003
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
2004

XhmikosR's avatar
XhmikosR committed
2005
2006
2007
2008
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$3];
      $.fn[NAME$3] = Collapse.jQueryInterface;
      $.fn[NAME$3].Constructor = Collapse;
Jacob Thornton's avatar
Jacob Thornton committed
2009

XhmikosR's avatar
XhmikosR committed
2010
2011
2012
2013
2014
2015
      $.fn[NAME$3].noConflict = function () {
        $.fn[NAME$3] = JQUERY_NO_CONFLICT;
        return Collapse.jQueryInterface;
      };
    }
  });
Jacob Thornton's avatar
Jacob Thornton committed
2016

XhmikosR's avatar
Dist    
XhmikosR committed
2017
2018
2019
2020
2021
2022
2023
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$4 = 'dropdown';
XhmikosR's avatar
XhmikosR committed
2024
  var VERSION$4 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
2025
2026
2027
  var DATA_KEY$4 = 'bs.dropdown';
  var EVENT_KEY$4 = "." + DATA_KEY$4;
  var DATA_API_KEY$4 = '.data-api';
XhmikosR's avatar
XhmikosR committed
2028
2029
2030
2031
2032
2033
2034
2035
  var ESCAPE_KEY = 'Escape';
  var SPACE_KEY = 'Space';
  var TAB_KEY = 'Tab';
  var ARROW_UP_KEY = 'ArrowUp';
  var ARROW_DOWN_KEY = 'ArrowDown';
  var RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button

  var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEY + "|" + ARROW_DOWN_KEY + "|" + ESCAPE_KEY);
XhmikosR's avatar
XhmikosR committed
2036
2037
2038
2039
2040
2041
2042
2043
  var EVENT_HIDE$1 = "hide" + EVENT_KEY$4;
  var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4;
  var EVENT_SHOW$1 = "show" + EVENT_KEY$4;
  var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4;
  var EVENT_CLICK = "click" + EVENT_KEY$4;
  var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4;
  var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4;
  var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4;
XhmikosR's avatar
XhmikosR committed
2044
  var CLASS_NAME_DISABLED = 'disabled';
XhmikosR's avatar
XhmikosR committed
2045
2046
2047
2048
2049
2050
2051
  var CLASS_NAME_SHOW$1 = 'show';
  var CLASS_NAME_DROPUP = 'dropup';
  var CLASS_NAME_DROPRIGHT = 'dropright';
  var CLASS_NAME_DROPLEFT = 'dropleft';
  var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
  var CLASS_NAME_NAVBAR = 'navbar';
  var CLASS_NAME_POSITION_STATIC = 'position-static';
XhmikosR's avatar
XhmikosR committed
2052
  var SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="dropdown"]';
XhmikosR's avatar
XhmikosR committed
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
  var SELECTOR_FORM_CHILD = '.dropdown form';
  var SELECTOR_MENU = '.dropdown-menu';
  var SELECTOR_NAVBAR_NAV = '.navbar-nav';
  var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  var PLACEMENT_TOP = 'top-start';
  var PLACEMENT_TOPEND = 'top-end';
  var PLACEMENT_BOTTOM = 'bottom-start';
  var PLACEMENT_BOTTOMEND = 'bottom-end';
  var PLACEMENT_RIGHT = 'right-start';
  var PLACEMENT_LEFT = 'left-start';
XhmikosR's avatar
Dist    
XhmikosR committed
2063
2064
2065
2066
2067
  var Default$2 = {
    offset: 0,
    flip: true,
    boundary: 'scrollParent',
    reference: 'toggle',
XhmikosR's avatar
XhmikosR committed
2068
2069
    display: 'dynamic',
    popperConfig: null
XhmikosR's avatar
Dist    
XhmikosR committed
2070
2071
2072
2073
2074
2075
  };
  var DefaultType$2 = {
    offset: '(number|string|function)',
    flip: 'boolean',
    boundary: '(string|element)',
    reference: '(string|element)',
XhmikosR's avatar
XhmikosR committed
2076
2077
    display: 'string',
    popperConfig: '(null|object)'
XhmikosR's avatar
Dist    
XhmikosR committed
2078
  };
XhmikosR's avatar
XhmikosR committed
2079
2080
2081
2082
2083
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
2084

XhmikosR's avatar
XhmikosR committed
2085
  var Dropdown = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
2086
2087
2088
2089
2090
2091
    function Dropdown(element, config) {
      this._element = element;
      this._popper = null;
      this._config = this._getConfig(config);
      this._menu = this._getMenuElement();
      this._inNavbar = this._detectNavbar();
Mark Otto's avatar
dist    
Mark Otto committed
2092

XhmikosR's avatar
Dist    
XhmikosR committed
2093
      this._addEventListeners();
XhmikosR's avatar
XhmikosR committed
2094
2095

      Data.setData(element, DATA_KEY$4, this);
XhmikosR's avatar
Dist    
XhmikosR committed
2096
    } // Getters
Mark Otto's avatar
dist    
Mark Otto committed
2097

Jacob Thornton's avatar
Jacob Thornton committed
2098

XhmikosR's avatar
Dist    
XhmikosR committed
2099
    var _proto = Dropdown.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
2100

XhmikosR's avatar
Dist    
XhmikosR committed
2101
2102
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
2103
      if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2104
2105
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2106

XhmikosR's avatar
XhmikosR committed
2107
      var isActive = this._element.classList.contains(CLASS_NAME_SHOW$1);
Jacob Thornton's avatar
Jacob Thornton committed
2108

XhmikosR's avatar
XhmikosR committed
2109
      Dropdown.clearMenus();
Jacob Thornton's avatar
Jacob Thornton committed
2110

XhmikosR's avatar
Dist    
XhmikosR committed
2111
2112
2113
      if (isActive) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2114

XhmikosR's avatar
XhmikosR committed
2115
2116
2117
2118
      this.show();
    };

    _proto.show = function show() {
XhmikosR's avatar
XhmikosR committed
2119
      if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
XhmikosR committed
2120
2121
2122
2123
        return;
      }

      var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
2124
2125
2126
      var relatedTarget = {
        relatedTarget: this._element
      };
XhmikosR's avatar
XhmikosR committed
2127
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
2128

XhmikosR's avatar
XhmikosR committed
2129
      if (showEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2130
        return;
XhmikosR's avatar
XhmikosR committed
2131
      } // Totally disable Popper for Dropdowns in Navbar
Jacob Thornton's avatar
Jacob Thornton committed
2132
2133


XhmikosR's avatar
Dist    
XhmikosR committed
2134
      if (!this._inNavbar) {
XhmikosR's avatar
XhmikosR committed
2135
        if (typeof Popper__default['default'] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
2136
          throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
Mark Otto's avatar
dist    
Mark Otto committed
2137
        }
Jacob Thornton's avatar
Jacob Thornton committed
2138

XhmikosR's avatar
Dist    
XhmikosR committed
2139
        var referenceElement = this._element;
Mark Otto's avatar
dist    
Mark Otto committed
2140

XhmikosR's avatar
Dist    
XhmikosR committed
2141
2142
        if (this._config.reference === 'parent') {
          referenceElement = parent;
XhmikosR's avatar
XhmikosR committed
2143
        } else if (isElement(this._config.reference)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2144
          referenceElement = this._config.reference; // Check if it's jQuery element
Mark Otto's avatar
dist    
Mark Otto committed
2145

XhmikosR's avatar
Dist    
XhmikosR committed
2146
2147
          if (typeof this._config.reference.jquery !== 'undefined') {
            referenceElement = this._config.reference[0];
Mark Otto's avatar
dist    
Mark Otto committed
2148
          }
XhmikosR's avatar
Dist    
XhmikosR committed
2149
2150
2151
        } // If boundary is not `scrollParent`, then set position to `static`
        // to allow the menu to "escape" the scroll parent's boundaries
        // https://github.com/twbs/bootstrap/issues/24251
Jacob Thornton's avatar
Jacob Thornton committed
2152

Mark Otto's avatar
dist    
Mark Otto committed
2153

XhmikosR's avatar
Dist    
XhmikosR committed
2154
        if (this._config.boundary !== 'scrollParent') {
XhmikosR's avatar
XhmikosR committed
2155
          parent.classList.add(CLASS_NAME_POSITION_STATIC);
XhmikosR's avatar
Dist    
XhmikosR committed
2156
        }
Mark Otto's avatar
dist    
Mark Otto committed
2157

XhmikosR's avatar
XhmikosR committed
2158
        this._popper = new Popper__default['default'](referenceElement, this._menu, this._getPopperConfig());
XhmikosR's avatar
Dist    
XhmikosR committed
2159
2160
2161
2162
      } // If this is a touch-enabled device we add extra
      // empty mouseover listeners to the body's immediate children;
      // only needed because of broken event delegation on iOS
      // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
Mark Otto's avatar
dist    
Mark Otto committed
2163

Johann-S's avatar
build    
Johann-S committed
2164

XhmikosR's avatar
XhmikosR committed
2165
      if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
XhmikosR's avatar
XhmikosR committed
2166
2167
2168
        var _ref;

        (_ref = []).concat.apply(_ref, document.body.children).forEach(function (elem) {
XhmikosR's avatar
XhmikosR committed
2169
2170
          return EventHandler.on(elem, 'mouseover', null, noop());
        });
XhmikosR's avatar
Dist    
XhmikosR committed
2171
      }
Mark Otto's avatar
dist    
Mark Otto committed
2172

XhmikosR's avatar
Dist    
XhmikosR committed
2173
      this._element.focus();
Mark Otto's avatar
dist    
Mark Otto committed
2174

XhmikosR's avatar
Dist    
XhmikosR committed
2175
      this._element.setAttribute('aria-expanded', true);
Mark Otto's avatar
grunt    
Mark Otto committed
2176

Mark Otto's avatar
Mark Otto committed
2177
2178
2179
2180
      this._menu.classList.toggle(CLASS_NAME_SHOW$1);

      this._element.classList.toggle(CLASS_NAME_SHOW$1);

XhmikosR's avatar
XhmikosR committed
2181
      EventHandler.trigger(parent, EVENT_SHOWN$1, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
2182
    };
Mark Otto's avatar
dist    
Mark Otto committed
2183

XhmikosR's avatar
Dist    
XhmikosR committed
2184
    _proto.hide = function hide() {
XhmikosR's avatar
XhmikosR committed
2185
      if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2186
2187
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2188

XhmikosR's avatar
XhmikosR committed
2189
      var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
2190
2191
2192
      var relatedTarget = {
        relatedTarget: this._element
      };
XhmikosR's avatar
XhmikosR committed
2193
      var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
2194

XhmikosR's avatar
XhmikosR committed
2195
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2196
2197
        return;
      }
Johann-S's avatar
build    
Johann-S committed
2198

XhmikosR's avatar
XhmikosR committed
2199
2200
2201
2202
      if (this._popper) {
        this._popper.destroy();
      }

Mark Otto's avatar
Mark Otto committed
2203
2204
2205
2206
      this._menu.classList.toggle(CLASS_NAME_SHOW$1);

      this._element.classList.toggle(CLASS_NAME_SHOW$1);

XhmikosR's avatar
XhmikosR committed
2207
      EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
2208
    };
Johann-S's avatar
build    
Johann-S committed
2209

XhmikosR's avatar
Dist    
XhmikosR committed
2210
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
2211
2212
      Data.removeData(this._element, DATA_KEY$4);
      EventHandler.off(this._element, EVENT_KEY$4);
XhmikosR's avatar
Dist    
XhmikosR committed
2213
2214
      this._element = null;
      this._menu = null;
Mark Otto's avatar
dist    
Mark Otto committed
2215

XhmikosR's avatar
XhmikosR committed
2216
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
2217
        this._popper.destroy();
Mark Otto's avatar
dist    
Mark Otto committed
2218

XhmikosR's avatar
Dist    
XhmikosR committed
2219
2220
2221
        this._popper = null;
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2222

XhmikosR's avatar
Dist    
XhmikosR committed
2223
2224
    _proto.update = function update() {
      this._inNavbar = this._detectNavbar();
Mark Otto's avatar
build    
Mark Otto committed
2225

XhmikosR's avatar
XhmikosR committed
2226
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
2227
2228
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
2229
2230
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
2231

XhmikosR's avatar
Dist    
XhmikosR committed
2232
2233
    _proto._addEventListeners = function _addEventListeners() {
      var _this = this;
Mark Otto's avatar
build    
Mark Otto committed
2234

XhmikosR's avatar
XhmikosR committed
2235
      EventHandler.on(this._element, EVENT_CLICK, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2236
2237
        event.preventDefault();
        event.stopPropagation();
Mark Otto's avatar
build    
Mark Otto committed
2238

XhmikosR's avatar
Dist    
XhmikosR committed
2239
2240
2241
        _this.toggle();
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
2242

XhmikosR's avatar
Dist    
XhmikosR committed
2243
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
2244
      config = _extends({}, this.constructor.Default, Manipulator.getDataAttributes(this._element), config);
XhmikosR's avatar
XhmikosR committed
2245
      typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
2246
2247
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
2248

XhmikosR's avatar
Dist    
XhmikosR committed
2249
    _proto._getMenuElement = function _getMenuElement() {
XhmikosR's avatar
XhmikosR committed
2250
      return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
XhmikosR's avatar
Dist    
XhmikosR committed
2251
    };
Mark Otto's avatar
dist    
Mark Otto committed
2252

XhmikosR's avatar
Dist    
XhmikosR committed
2253
    _proto._getPlacement = function _getPlacement() {
XhmikosR's avatar
XhmikosR committed
2254
      var parentDropdown = this._element.parentNode;
XhmikosR's avatar
XhmikosR committed
2255
      var placement = PLACEMENT_BOTTOM; // Handle dropup
Mark Otto's avatar
dist    
Mark Otto committed
2256

XhmikosR's avatar
XhmikosR committed
2257
      if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
XhmikosR's avatar
XhmikosR committed
2258
        placement = this._menu.classList.contains(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
XhmikosR's avatar
XhmikosR committed
2259
2260
2261
2262
2263
2264
      } else if (parentDropdown.classList.contains(CLASS_NAME_DROPRIGHT)) {
        placement = PLACEMENT_RIGHT;
      } else if (parentDropdown.classList.contains(CLASS_NAME_DROPLEFT)) {
        placement = PLACEMENT_LEFT;
      } else if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) {
        placement = PLACEMENT_BOTTOMEND;
XhmikosR's avatar
Dist    
XhmikosR committed
2265
      }
Jacob Thornton's avatar
Jacob Thornton committed
2266

XhmikosR's avatar
Dist    
XhmikosR committed
2267
2268
      return placement;
    };
Mark Otto's avatar
dist    
Mark Otto committed
2269

XhmikosR's avatar
Dist    
XhmikosR committed
2270
    _proto._detectNavbar = function _detectNavbar() {
XhmikosR's avatar
XhmikosR committed
2271
      return Boolean(this._element.closest("." + CLASS_NAME_NAVBAR));
XhmikosR's avatar
Dist    
XhmikosR committed
2272
    };
Jacob Thornton's avatar
Jacob Thornton committed
2273

Mark Otto's avatar
Mark Otto committed
2274
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
Dist    
XhmikosR committed
2275
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
2276

Mark Otto's avatar
Mark Otto committed
2277
      var offset = {};
Jacob Thornton's avatar
Jacob Thornton committed
2278

XhmikosR's avatar
Dist    
XhmikosR committed
2279
      if (typeof this._config.offset === 'function') {
Mark Otto's avatar
Mark Otto committed
2280
        offset.fn = function (data) {
XhmikosR's avatar
XhmikosR committed
2281
          data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
XhmikosR's avatar
Dist    
XhmikosR committed
2282
2283
2284
          return data;
        };
      } else {
Mark Otto's avatar
Mark Otto committed
2285
        offset.offset = this._config.offset;
XhmikosR's avatar
Dist    
XhmikosR committed
2286
      }
Mark Otto's avatar
dist    
Mark Otto committed
2287

Mark Otto's avatar
Mark Otto committed
2288
2289
2290
2291
      return offset;
    };

    _proto._getPopperConfig = function _getPopperConfig() {
XhmikosR's avatar
Dist    
XhmikosR committed
2292
2293
2294
      var popperConfig = {
        placement: this._getPlacement(),
        modifiers: {
Mark Otto's avatar
Mark Otto committed
2295
          offset: this._getOffset(),
XhmikosR's avatar
Dist    
XhmikosR committed
2296
2297
2298
2299
2300
          flip: {
            enabled: this._config.flip
          },
          preventOverflow: {
            boundariesElement: this._config.boundary
Mark Otto's avatar
grunt    
Mark Otto committed
2301
          }
XhmikosR's avatar
XhmikosR committed
2302
        }
XhmikosR's avatar
XhmikosR committed
2303
      }; // Disable Popper if we have a static display
Jacob Thornton's avatar
Jacob Thornton committed
2304

XhmikosR's avatar
Dist    
XhmikosR committed
2305
2306
2307
2308
2309
      if (this._config.display === 'static') {
        popperConfig.modifiers.applyStyle = {
          enabled: false
        };
      }
Jacob Thornton's avatar
Jacob Thornton committed
2310

XhmikosR's avatar
XhmikosR committed
2311
      return _extends({}, popperConfig, this._config.popperConfig);
Mark Otto's avatar
Mark Otto committed
2312
2313
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
2314

XhmikosR's avatar
XhmikosR committed
2315
    Dropdown.dropdownInterface = function dropdownInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
2316
      var data = Data.getData(element, DATA_KEY$4);
Mark Otto's avatar
dist    
Mark Otto committed
2317

XhmikosR's avatar
XhmikosR committed
2318
      var _config = typeof config === 'object' ? config : null;
Jacob Thornton's avatar
Jacob Thornton committed
2319

XhmikosR's avatar
XhmikosR committed
2320
2321
2322
2323
2324
2325
      if (!data) {
        data = new Dropdown(element, _config);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
Dist.    
XhmikosR committed
2326
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist    
XhmikosR committed
2327
        }
Johann-S's avatar
build    
Johann-S committed
2328

XhmikosR's avatar
XhmikosR committed
2329
2330
2331
        data[config]();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2332

XhmikosR's avatar
XhmikosR committed
2333
    Dropdown.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
2334
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
2335
        Dropdown.dropdownInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
2336
2337
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
2338

XhmikosR's avatar
XhmikosR committed
2339
    Dropdown.clearMenus = function clearMenus(event) {
XhmikosR's avatar
XhmikosR committed
2340
      if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2341
2342
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2343

XhmikosR's avatar
XhmikosR committed
2344
      var toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$2);
Mark Otto's avatar
dist    
Mark Otto committed
2345

XhmikosR's avatar
Dist    
XhmikosR committed
2346
      for (var i = 0, len = toggles.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
2347
        var parent = Dropdown.getParentFromElement(toggles[i]);
XhmikosR's avatar
XhmikosR committed
2348
        var context = Data.getData(toggles[i], DATA_KEY$4);
XhmikosR's avatar
Dist    
XhmikosR committed
2349
2350
2351
        var relatedTarget = {
          relatedTarget: toggles[i]
        };
Mark Otto's avatar
dist    
Mark Otto committed
2352

XhmikosR's avatar
Dist    
XhmikosR committed
2353
2354
        if (event && event.type === 'click') {
          relatedTarget.clickEvent = event;
Mark Otto's avatar
grunt    
Mark Otto committed
2355
2356
        }

XhmikosR's avatar
Dist    
XhmikosR committed
2357
2358
        if (!context) {
          continue;
Mark Otto's avatar
dist    
Mark Otto committed
2359
        }
Jacob Thornton's avatar
Jacob Thornton committed
2360

XhmikosR's avatar
Dist    
XhmikosR committed
2361
        var dropdownMenu = context._menu;
Jacob Thornton's avatar
Jacob Thornton committed
2362

XhmikosR's avatar
XhmikosR committed
2363
        if (!toggles[i].classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2364
2365
          continue;
        }
Mark Otto's avatar
dist    
Mark Otto committed
2366

XhmikosR's avatar
XhmikosR committed
2367
        if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.key === TAB_KEY) && dropdownMenu.contains(event.target)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2368
          continue;
Mark Otto's avatar
dist    
Mark Otto committed
2369
        }
Jacob Thornton's avatar
Jacob Thornton committed
2370

XhmikosR's avatar
XhmikosR committed
2371
        var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget);
Jacob Thornton's avatar
Jacob Thornton committed
2372

XhmikosR's avatar
XhmikosR committed
2373
        if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2374
2375
2376
2377
2378
2379
          continue;
        } // If this is a touch-enabled device we remove the extra
        // empty mouseover listeners we added for iOS support


        if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
2380
2381
2382
          var _ref2;

          (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (elem) {
XhmikosR's avatar
XhmikosR committed
2383
2384
            return EventHandler.off(elem, 'mouseover', null, noop());
          });
Mark Otto's avatar
dist    
Mark Otto committed
2385
        }
Jacob Thornton's avatar
Jacob Thornton committed
2386

XhmikosR's avatar
Dist    
XhmikosR committed
2387
        toggles[i].setAttribute('aria-expanded', 'false');
XhmikosR's avatar
XhmikosR committed
2388
2389
2390
2391
2392

        if (context._popper) {
          context._popper.destroy();
        }

XhmikosR's avatar
XhmikosR committed
2393
2394
2395
        dropdownMenu.classList.remove(CLASS_NAME_SHOW$1);
        toggles[i].classList.remove(CLASS_NAME_SHOW$1);
        EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
2396
2397
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2398

XhmikosR's avatar
XhmikosR committed
2399
2400
    Dropdown.getParentFromElement = function getParentFromElement(element) {
      return getElementFromSelector(element) || element.parentNode;
XhmikosR's avatar
XhmikosR committed
2401
    };
Jacob Thornton's avatar
Jacob Thornton committed
2402

XhmikosR's avatar
XhmikosR committed
2403
    Dropdown.dataApiKeydownHandler = function dataApiKeydownHandler(event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2404
2405
2406
2407
2408
2409
2410
      // If not input/textarea:
      //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
      // If input/textarea:
      //  - If space key => not a dropdown command
      //  - If key is other than escape
      //    - If key is not up or down => not a dropdown command
      //    - If trigger inside the menu => not a dropdown command
XhmikosR's avatar
XhmikosR committed
2411
      if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2412
2413
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2414

XhmikosR's avatar
Dist    
XhmikosR committed
2415
2416
      event.preventDefault();
      event.stopPropagation();
Jacob Thornton's avatar
Jacob Thornton committed
2417

XhmikosR's avatar
XhmikosR committed
2418
      if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2419
2420
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2421

XhmikosR's avatar
XhmikosR committed
2422
      var parent = Dropdown.getParentFromElement(this);
XhmikosR's avatar
XhmikosR committed
2423
      var isActive = this.classList.contains(CLASS_NAME_SHOW$1);
Jacob Thornton's avatar
Jacob Thornton committed
2424

XhmikosR's avatar
XhmikosR committed
2425
      if (event.key === ESCAPE_KEY) {
XhmikosR's avatar
XhmikosR committed
2426
2427
2428
2429
2430
        var button = this.matches(SELECTOR_DATA_TOGGLE$2) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$2)[0];
        button.focus();
        Dropdown.clearMenus();
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2431

XhmikosR's avatar
XhmikosR committed
2432
      if (!isActive || event.key === SPACE_KEY) {
XhmikosR's avatar
XhmikosR committed
2433
        Dropdown.clearMenus();
XhmikosR's avatar
Dist    
XhmikosR committed
2434
2435
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2436

XhmikosR's avatar
XhmikosR committed
2437
      var items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible);
Jacob Thornton's avatar
Jacob Thornton committed
2438

XhmikosR's avatar
XhmikosR committed
2439
      if (!items.length) {
XhmikosR's avatar
Dist    
XhmikosR committed
2440
2441
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2442

XhmikosR's avatar
XhmikosR committed
2443
      var index = items.indexOf(event.target);
Mark Otto's avatar
dist    
Mark Otto committed
2444

XhmikosR's avatar
XhmikosR committed
2445
      if (event.key === ARROW_UP_KEY && index > 0) {
XhmikosR's avatar
Dist    
XhmikosR committed
2446
2447
2448
        // Up
        index--;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2449

XhmikosR's avatar
XhmikosR committed
2450
      if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
XhmikosR's avatar
Dist    
XhmikosR committed
2451
2452
        // Down
        index++;
XhmikosR's avatar
XhmikosR committed
2453
2454
      } // index is -1 if the first keydown is an ArrowUp

Mark Otto's avatar
dist    
Mark Otto committed
2455

XhmikosR's avatar
XhmikosR committed
2456
      index = index === -1 ? 0 : index;
XhmikosR's avatar
Dist    
XhmikosR committed
2457
      items[index].focus();
Mark Otto's avatar
dist    
Mark Otto committed
2458
    };
Jacob Thornton's avatar
Jacob Thornton committed
2459

XhmikosR's avatar
XhmikosR committed
2460
    Dropdown.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
2461
2462
2463
      return Data.getData(element, DATA_KEY$4);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
    _createClass(Dropdown, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$4;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$2;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$2;
      }
    }]);

Mark Otto's avatar
dist    
Mark Otto committed
2481
    return Dropdown;
XhmikosR's avatar
Dist    
XhmikosR committed
2482
2483
2484
2485
2486
2487
2488
2489
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
2490
2491
2492
2493
2494
  EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown.dataApiKeydownHandler);
  EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
  EventHandler.on(document, EVENT_CLICK_DATA_API$4, Dropdown.clearMenus);
  EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
  EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2495
2496
    event.preventDefault();
    event.stopPropagation();
XhmikosR's avatar
XhmikosR committed
2497
    Dropdown.dropdownInterface(this, 'toggle');
XhmikosR's avatar
XhmikosR committed
2498
  });
XhmikosR's avatar
XhmikosR committed
2499
  EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
XhmikosR's avatar
XhmikosR committed
2500
    return e.stopPropagation();
XhmikosR's avatar
Dist    
XhmikosR committed
2501
2502
2503
2504
2505
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
2506
   * add .Dropdown to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
2507
2508
   */

XhmikosR's avatar
XhmikosR committed
2509
2510
2511
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
2512

XhmikosR's avatar
XhmikosR committed
2513
2514
2515
2516
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$4];
      $.fn[NAME$4] = Dropdown.jQueryInterface;
      $.fn[NAME$4].Constructor = Dropdown;
XhmikosR's avatar
Dist    
XhmikosR committed
2517

XhmikosR's avatar
XhmikosR committed
2518
2519
2520
2521
2522
2523
      $.fn[NAME$4].noConflict = function () {
        $.fn[NAME$4] = JQUERY_NO_CONFLICT;
        return Dropdown.jQueryInterface;
      };
    }
  });
Jacob Thornton's avatar
Jacob Thornton committed
2524

XhmikosR's avatar
Dist    
XhmikosR committed
2525
2526
2527
2528
2529
2530
2531
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$5 = 'modal';
XhmikosR's avatar
XhmikosR committed
2532
  var VERSION$5 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
2533
2534
2535
  var DATA_KEY$5 = 'bs.modal';
  var EVENT_KEY$5 = "." + DATA_KEY$5;
  var DATA_API_KEY$5 = '.data-api';
XhmikosR's avatar
XhmikosR committed
2536
  var ESCAPE_KEY$1 = 'Escape';
XhmikosR's avatar
Dist    
XhmikosR committed
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
  var Default$3 = {
    backdrop: true,
    keyboard: true,
    focus: true,
    show: true
  };
  var DefaultType$3 = {
    backdrop: '(boolean|string)',
    keyboard: 'boolean',
    focus: 'boolean',
    show: 'boolean'
  };
XhmikosR's avatar
XhmikosR committed
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
  var EVENT_HIDE$2 = "hide" + EVENT_KEY$5;
  var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5;
  var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5;
  var EVENT_SHOW$2 = "show" + EVENT_KEY$5;
  var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5;
  var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5;
  var EVENT_RESIZE = "resize" + EVENT_KEY$5;
  var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5;
  var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5;
  var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5;
  var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5;
  var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5;
  var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
  var CLASS_NAME_BACKDROP = 'modal-backdrop';
  var CLASS_NAME_OPEN = 'modal-open';
  var CLASS_NAME_FADE = 'fade';
  var CLASS_NAME_SHOW$2 = 'show';
  var CLASS_NAME_STATIC = 'modal-static';
  var SELECTOR_DIALOG = '.modal-dialog';
  var SELECTOR_MODAL_BODY = '.modal-body';
XhmikosR's avatar
XhmikosR committed
2569
2570
  var SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="modal"]';
  var SELECTOR_DATA_DISMISS = '[data-bs-dismiss="modal"]';
XhmikosR's avatar
XhmikosR committed
2571
2572
  var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  var SELECTOR_STICKY_CONTENT = '.sticky-top';
XhmikosR's avatar
XhmikosR committed
2573
2574
2575
2576
2577
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
2578

XhmikosR's avatar
XhmikosR committed
2579
  var Modal = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
2580
2581
2582
    function Modal(element, config) {
      this._config = this._getConfig(config);
      this._element = element;
XhmikosR's avatar
XhmikosR committed
2583
      this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element);
XhmikosR's avatar
Dist    
XhmikosR committed
2584
2585
2586
2587
2588
2589
      this._backdrop = null;
      this._isShown = false;
      this._isBodyOverflowing = false;
      this._ignoreBackdropClick = false;
      this._isTransitioning = false;
      this._scrollbarWidth = 0;
XhmikosR's avatar
XhmikosR committed
2590
      Data.setData(element, DATA_KEY$5, this);
XhmikosR's avatar
Dist    
XhmikosR committed
2591
2592
2593
2594
2595
2596
2597
2598
    } // Getters


    var _proto = Modal.prototype;

    // Public
    _proto.toggle = function toggle(relatedTarget) {
      return this._isShown ? this.hide() : this.show(relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
2599
    };
Jacob Thornton's avatar
Jacob Thornton committed
2600

XhmikosR's avatar
Dist    
XhmikosR committed
2601
2602
    _proto.show = function show(relatedTarget) {
      var _this = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2603

XhmikosR's avatar
Dist    
XhmikosR committed
2604
2605
2606
      if (this._isShown || this._isTransitioning) {
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2607

XhmikosR's avatar
XhmikosR committed
2608
      if (this._element.classList.contains(CLASS_NAME_FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2609
2610
        this._isTransitioning = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2611

XhmikosR's avatar
XhmikosR committed
2612
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
XhmikosR's avatar
Dist    
XhmikosR committed
2613
2614
        relatedTarget: relatedTarget
      });
Jacob Thornton's avatar
Jacob Thornton committed
2615

XhmikosR's avatar
XhmikosR committed
2616
      if (this._isShown || showEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2617
2618
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2619

XhmikosR's avatar
Dist    
XhmikosR committed
2620
      this._isShown = true;
Mark Otto's avatar
dist    
Mark Otto committed
2621

XhmikosR's avatar
Dist    
XhmikosR committed
2622
      this._checkScrollbar();
Jacob Thornton's avatar
Jacob Thornton committed
2623

XhmikosR's avatar
Dist    
XhmikosR committed
2624
      this._setScrollbar();
Mark Otto's avatar
dist    
Mark Otto committed
2625

XhmikosR's avatar
Dist    
XhmikosR committed
2626
      this._adjustDialog();
Jacob Thornton's avatar
Jacob Thornton committed
2627

XhmikosR's avatar
Dist    
XhmikosR committed
2628
      this._setEscapeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2629

XhmikosR's avatar
Dist    
XhmikosR committed
2630
      this._setResizeEvent();
Mark Otto's avatar
grunt    
Mark Otto committed
2631

XhmikosR's avatar
XhmikosR committed
2632
      EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2633
2634
        return _this.hide(event);
      });
XhmikosR's avatar
XhmikosR committed
2635
2636
      EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
        EventHandler.one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) {
XhmikosR's avatar
XhmikosR committed
2637
          if (event.target === _this._element) {
XhmikosR's avatar
Dist    
XhmikosR committed
2638
2639
            _this._ignoreBackdropClick = true;
          }
Mark Otto's avatar
dist    
Mark Otto committed
2640
        });
XhmikosR's avatar
Dist    
XhmikosR committed
2641
      });
Jacob Thornton's avatar
Jacob Thornton committed
2642

XhmikosR's avatar
Dist    
XhmikosR committed
2643
2644
2645
2646
      this._showBackdrop(function () {
        return _this._showElement(relatedTarget);
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2647

XhmikosR's avatar
Dist    
XhmikosR committed
2648
2649
    _proto.hide = function hide(event) {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2650

XhmikosR's avatar
Dist    
XhmikosR committed
2651
2652
2653
      if (event) {
        event.preventDefault();
      }
Jacob Thornton's avatar
Jacob Thornton committed
2654

XhmikosR's avatar
Dist    
XhmikosR committed
2655
2656
2657
      if (!this._isShown || this._isTransitioning) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2658

XhmikosR's avatar
XhmikosR committed
2659
      var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
Jacob Thornton's avatar
Jacob Thornton committed
2660

2661
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2662
2663
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2664

XhmikosR's avatar
Dist    
XhmikosR committed
2665
      this._isShown = false;
XhmikosR's avatar
XhmikosR committed
2666

XhmikosR's avatar
XhmikosR committed
2667
      var transition = this._element.classList.contains(CLASS_NAME_FADE);
Jacob Thornton's avatar
Jacob Thornton committed
2668

XhmikosR's avatar
Dist    
XhmikosR committed
2669
2670
2671
      if (transition) {
        this._isTransitioning = true;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2672

XhmikosR's avatar
Dist    
XhmikosR committed
2673
      this._setEscapeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2674

XhmikosR's avatar
Dist    
XhmikosR committed
2675
      this._setResizeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2676

XhmikosR's avatar
XhmikosR committed
2677
      EventHandler.off(document, EVENT_FOCUSIN);
XhmikosR's avatar
XhmikosR committed
2678

XhmikosR's avatar
XhmikosR committed
2679
      this._element.classList.remove(CLASS_NAME_SHOW$2);
XhmikosR's avatar
XhmikosR committed
2680

XhmikosR's avatar
XhmikosR committed
2681
2682
      EventHandler.off(this._element, EVENT_CLICK_DISMISS);
      EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
Jacob Thornton's avatar
Jacob Thornton committed
2683

XhmikosR's avatar
Dist    
XhmikosR committed
2684
      if (transition) {
XhmikosR's avatar
XhmikosR committed
2685
2686
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2687
          return _this2._hideModal(event);
XhmikosR's avatar
XhmikosR committed
2688
2689
        });
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
2690
2691
2692
2693
      } else {
        this._hideModal();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2694

XhmikosR's avatar
Dist    
XhmikosR committed
2695
2696
    _proto.dispose = function dispose() {
      [window, this._element, this._dialog].forEach(function (htmlElement) {
XhmikosR's avatar
XhmikosR committed
2697
        return EventHandler.off(htmlElement, EVENT_KEY$5);
XhmikosR's avatar
Dist    
XhmikosR committed
2698
2699
      });
      /**
XhmikosR's avatar
XhmikosR committed
2700
       * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
XhmikosR's avatar
Dist    
XhmikosR committed
2701
       * Do not move `document` in `htmlElements` array
XhmikosR's avatar
XhmikosR committed
2702
       * It will remove `EVENT_CLICK_DATA_API` event that should remain
XhmikosR's avatar
Dist    
XhmikosR committed
2703
       */
Mark Otto's avatar
grunt    
Mark Otto committed
2704

XhmikosR's avatar
XhmikosR committed
2705
      EventHandler.off(document, EVENT_FOCUSIN);
XhmikosR's avatar
XhmikosR committed
2706
      Data.removeData(this._element, DATA_KEY$5);
XhmikosR's avatar
Dist    
XhmikosR committed
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
      this._config = null;
      this._element = null;
      this._dialog = null;
      this._backdrop = null;
      this._isShown = null;
      this._isBodyOverflowing = null;
      this._ignoreBackdropClick = null;
      this._isTransitioning = null;
      this._scrollbarWidth = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2717

XhmikosR's avatar
Dist    
XhmikosR committed
2718
2719
    _proto.handleUpdate = function handleUpdate() {
      this._adjustDialog();
Mark Otto's avatar
Mark Otto committed
2720
2721
    } // Private
    ;
Jacob Thornton's avatar
Jacob Thornton committed
2722

XhmikosR's avatar
Dist    
XhmikosR committed
2723
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
2724
      config = _extends({}, Default$3, config);
XhmikosR's avatar
XhmikosR committed
2725
      typeCheckConfig(NAME$5, config, DefaultType$3);
XhmikosR's avatar
Dist    
XhmikosR committed
2726
2727
      return config;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2728

XhmikosR's avatar
Dist    
XhmikosR committed
2729
2730
    _proto._showElement = function _showElement(relatedTarget) {
      var _this3 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2731

XhmikosR's avatar
XhmikosR committed
2732
      var transition = this._element.classList.contains(CLASS_NAME_FADE);
Mark Otto's avatar
dist    
Mark Otto committed
2733

XhmikosR's avatar
XhmikosR committed
2734
      var modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
XhmikosR's avatar
XhmikosR committed
2735

XhmikosR's avatar
Dist    
XhmikosR committed
2736
2737
2738
2739
      if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
        // Don't move modal's DOM position
        document.body.appendChild(this._element);
      }
Mark Otto's avatar
dist    
Mark Otto committed
2740

XhmikosR's avatar
Dist    
XhmikosR committed
2741
      this._element.style.display = 'block';
Jacob Thornton's avatar
Jacob Thornton committed
2742

XhmikosR's avatar
Dist    
XhmikosR committed
2743
      this._element.removeAttribute('aria-hidden');
Mark Otto's avatar
grunt    
Mark Otto committed
2744

Mark Otto's avatar
dist    
Mark Otto committed
2745
2746
      this._element.setAttribute('aria-modal', true);

Mark Otto's avatar
Mark Otto committed
2747
2748
      this._element.setAttribute('role', 'dialog');

XhmikosR's avatar
XhmikosR committed
2749
2750
2751
      this._element.scrollTop = 0;

      if (modalBody) {
XhmikosR's avatar
XhmikosR committed
2752
        modalBody.scrollTop = 0;
Mark Otto's avatar
Mark Otto committed
2753
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2754

XhmikosR's avatar
Dist    
XhmikosR committed
2755
      if (transition) {
XhmikosR's avatar
XhmikosR committed
2756
        reflow(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
2757
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2758

XhmikosR's avatar
XhmikosR committed
2759
      this._element.classList.add(CLASS_NAME_SHOW$2);
Mark Otto's avatar
dist    
Mark Otto committed
2760

XhmikosR's avatar
Dist    
XhmikosR committed
2761
2762
2763
      if (this._config.focus) {
        this._enforceFocus();
      }
Mark Otto's avatar
dist    
Mark Otto committed
2764

XhmikosR's avatar
Dist    
XhmikosR committed
2765
2766
2767
      var transitionComplete = function transitionComplete() {
        if (_this3._config.focus) {
          _this3._element.focus();
Jacob Thornton's avatar
Jacob Thornton committed
2768
        }
Mark Otto's avatar
dist    
Mark Otto committed
2769

XhmikosR's avatar
Dist    
XhmikosR committed
2770
        _this3._isTransitioning = false;
XhmikosR's avatar
XhmikosR committed
2771
        EventHandler.trigger(_this3._element, EVENT_SHOWN$2, {
XhmikosR's avatar
XhmikosR committed
2772
2773
          relatedTarget: relatedTarget
        });
Mark Otto's avatar
grunt    
Mark Otto committed
2774
2775
      };

XhmikosR's avatar
Dist    
XhmikosR committed
2776
      if (transition) {
XhmikosR's avatar
XhmikosR committed
2777
2778
2779
        var transitionDuration = getTransitionDurationFromElement(this._dialog);
        EventHandler.one(this._dialog, TRANSITION_END, transitionComplete);
        emulateTransitionEnd(this._dialog, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
2780
2781
2782
2783
      } else {
        transitionComplete();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2784

XhmikosR's avatar
Dist    
XhmikosR committed
2785
2786
    _proto._enforceFocus = function _enforceFocus() {
      var _this4 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2787

XhmikosR's avatar
XhmikosR committed
2788
      EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
XhmikosR's avatar
XhmikosR committed
2789

XhmikosR's avatar
XhmikosR committed
2790
      EventHandler.on(document, EVENT_FOCUSIN, function (event) {
XhmikosR's avatar
XhmikosR committed
2791
        if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2792
          _this4._element.focus();
Mark Otto's avatar
dist    
Mark Otto committed
2793
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2794
2795
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
2796

XhmikosR's avatar
Dist    
XhmikosR committed
2797
2798
    _proto._setEscapeEvent = function _setEscapeEvent() {
      var _this5 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2799

XhmikosR's avatar
XhmikosR committed
2800
2801
      if (this._isShown) {
        EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, function (event) {
XhmikosR's avatar
XhmikosR committed
2802
          if (_this5._config.keyboard && event.key === ESCAPE_KEY$1) {
XhmikosR's avatar
XhmikosR committed
2803
2804
2805
            event.preventDefault();

            _this5.hide();
XhmikosR's avatar
XhmikosR committed
2806
          } else if (!_this5._config.keyboard && event.key === ESCAPE_KEY$1) {
XhmikosR's avatar
XhmikosR committed
2807
            _this5._triggerBackdropTransition();
XhmikosR's avatar
Dist    
XhmikosR committed
2808
2809
          }
        });
2810
      } else {
XhmikosR's avatar
XhmikosR committed
2811
        EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS);
XhmikosR's avatar
Dist    
XhmikosR committed
2812
2813
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2814

XhmikosR's avatar
Dist    
XhmikosR committed
2815
2816
    _proto._setResizeEvent = function _setResizeEvent() {
      var _this6 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2817

XhmikosR's avatar
Dist    
XhmikosR committed
2818
      if (this._isShown) {
XhmikosR's avatar
XhmikosR committed
2819
        EventHandler.on(window, EVENT_RESIZE, function () {
2820
          return _this6._adjustDialog();
XhmikosR's avatar
Dist    
XhmikosR committed
2821
2822
        });
      } else {
XhmikosR's avatar
XhmikosR committed
2823
        EventHandler.off(window, EVENT_RESIZE);
XhmikosR's avatar
Dist    
XhmikosR committed
2824
2825
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2826

XhmikosR's avatar
Dist    
XhmikosR committed
2827
2828
    _proto._hideModal = function _hideModal() {
      var _this7 = this;
Mark Otto's avatar
dist    
Mark Otto committed
2829

XhmikosR's avatar
Dist    
XhmikosR committed
2830
      this._element.style.display = 'none';
Mark Otto's avatar
dist    
Mark Otto committed
2831

XhmikosR's avatar
Dist    
XhmikosR committed
2832
      this._element.setAttribute('aria-hidden', true);
Mark Otto's avatar
dist    
Mark Otto committed
2833

Mark Otto's avatar
dist    
Mark Otto committed
2834
2835
      this._element.removeAttribute('aria-modal');

Mark Otto's avatar
Mark Otto committed
2836
2837
      this._element.removeAttribute('role');

XhmikosR's avatar
Dist    
XhmikosR committed
2838
      this._isTransitioning = false;
Mark Otto's avatar
dist    
Mark Otto committed
2839

XhmikosR's avatar
Dist    
XhmikosR committed
2840
      this._showBackdrop(function () {
XhmikosR's avatar
XhmikosR committed
2841
        document.body.classList.remove(CLASS_NAME_OPEN);
Mark Otto's avatar
dist    
Mark Otto committed
2842

XhmikosR's avatar
Dist    
XhmikosR committed
2843
        _this7._resetAdjustments();
Mark Otto's avatar
dist    
Mark Otto committed
2844

XhmikosR's avatar
Dist    
XhmikosR committed
2845
        _this7._resetScrollbar();
Jacob Thornton's avatar
Jacob Thornton committed
2846

XhmikosR's avatar
XhmikosR committed
2847
        EventHandler.trigger(_this7._element, EVENT_HIDDEN$2);
XhmikosR's avatar
Dist    
XhmikosR committed
2848
2849
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
2850

XhmikosR's avatar
Dist    
XhmikosR committed
2851
    _proto._removeBackdrop = function _removeBackdrop() {
2852
      this._backdrop.parentNode.removeChild(this._backdrop);
XhmikosR's avatar
XhmikosR committed
2853

2854
      this._backdrop = null;
XhmikosR's avatar
Dist    
XhmikosR committed
2855
    };
Jacob Thornton's avatar
Jacob Thornton committed
2856

XhmikosR's avatar
Dist    
XhmikosR committed
2857
2858
    _proto._showBackdrop = function _showBackdrop(callback) {
      var _this8 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2859

XhmikosR's avatar
XhmikosR committed
2860
      var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
Jacob Thornton's avatar
Jacob Thornton committed
2861

XhmikosR's avatar
Dist    
XhmikosR committed
2862
2863
      if (this._isShown && this._config.backdrop) {
        this._backdrop = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
2864
        this._backdrop.className = CLASS_NAME_BACKDROP;
Mark Otto's avatar
grunt    
Mark Otto committed
2865

XhmikosR's avatar
Dist    
XhmikosR committed
2866
2867
2868
        if (animate) {
          this._backdrop.classList.add(animate);
        }
Jacob Thornton's avatar
Jacob Thornton committed
2869

XhmikosR's avatar
XhmikosR committed
2870
        document.body.appendChild(this._backdrop);
XhmikosR's avatar
XhmikosR committed
2871
        EventHandler.on(this._element, EVENT_CLICK_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2872
2873
          if (_this8._ignoreBackdropClick) {
            _this8._ignoreBackdropClick = false;
Jacob Thornton's avatar
Jacob Thornton committed
2874
2875
            return;
          }
Mark Otto's avatar
dist    
Mark Otto committed
2876

XhmikosR's avatar
Dist    
XhmikosR committed
2877
          if (event.target !== event.currentTarget) {
Jacob Thornton's avatar
Jacob Thornton committed
2878
2879
            return;
          }
Mark Otto's avatar
dist    
Mark Otto committed
2880

XhmikosR's avatar
XhmikosR committed
2881
2882
2883
2884
2885
          if (_this8._config.backdrop === 'static') {
            _this8._triggerBackdropTransition();
          } else {
            _this8.hide();
          }
XhmikosR's avatar
Dist    
XhmikosR committed
2886
        });
Jacob Thornton's avatar
Jacob Thornton committed
2887

XhmikosR's avatar
Dist    
XhmikosR committed
2888
        if (animate) {
XhmikosR's avatar
XhmikosR committed
2889
          reflow(this._backdrop);
XhmikosR's avatar
Dist    
XhmikosR committed
2890
        }
Jacob Thornton's avatar
Jacob Thornton committed
2891

XhmikosR's avatar
XhmikosR committed
2892
        this._backdrop.classList.add(CLASS_NAME_SHOW$2);
Jacob Thornton's avatar
Jacob Thornton committed
2893

XhmikosR's avatar
Dist    
XhmikosR committed
2894
        if (!animate) {
Jacob Thornton's avatar
Jacob Thornton committed
2895
          callback();
XhmikosR's avatar
Dist    
XhmikosR committed
2896
          return;
Jacob Thornton's avatar
Jacob Thornton committed
2897
2898
        }

XhmikosR's avatar
XhmikosR committed
2899
2900
2901
        var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
        EventHandler.one(this._backdrop, TRANSITION_END, callback);
        emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
2902
      } else if (!this._isShown && this._backdrop) {
XhmikosR's avatar
XhmikosR committed
2903
        this._backdrop.classList.remove(CLASS_NAME_SHOW$2);
Jacob Thornton's avatar
Jacob Thornton committed
2904

XhmikosR's avatar
Dist    
XhmikosR committed
2905
2906
        var callbackRemove = function callbackRemove() {
          _this8._removeBackdrop();
Jacob Thornton's avatar
Jacob Thornton committed
2907

2908
          callback();
XhmikosR's avatar
Dist    
XhmikosR committed
2909
2910
        };

XhmikosR's avatar
XhmikosR committed
2911
        if (this._element.classList.contains(CLASS_NAME_FADE)) {
XhmikosR's avatar
XhmikosR committed
2912
          var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
Mark Otto's avatar
grunt    
Mark Otto committed
2913

XhmikosR's avatar
XhmikosR committed
2914
2915
          EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove);
          emulateTransitionEnd(this._backdrop, _backdropTransitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
2916
2917
        } else {
          callbackRemove();
Mark Otto's avatar
dist    
Mark Otto committed
2918
        }
2919
      } else {
XhmikosR's avatar
Dist    
XhmikosR committed
2920
2921
        callback();
      }
XhmikosR's avatar
XhmikosR committed
2922
2923
2924
2925
2926
    };

    _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
      var _this9 = this;

XhmikosR's avatar
XhmikosR committed
2927
      var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
XhmikosR's avatar
XhmikosR committed
2928

XhmikosR's avatar
XhmikosR committed
2929
2930
2931
      if (hideEvent.defaultPrevented) {
        return;
      }
XhmikosR's avatar
XhmikosR committed
2932

XhmikosR's avatar
XhmikosR committed
2933
      var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
XhmikosR's avatar
XhmikosR committed
2934

XhmikosR's avatar
XhmikosR committed
2935
2936
2937
      if (!isModalOverflowing) {
        this._element.style.overflowY = 'hidden';
      }
XhmikosR's avatar
XhmikosR committed
2938

XhmikosR's avatar
XhmikosR committed
2939
      this._element.classList.add(CLASS_NAME_STATIC);
XhmikosR's avatar
XhmikosR committed
2940

XhmikosR's avatar
XhmikosR committed
2941
2942
2943
2944
      var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
      EventHandler.off(this._element, TRANSITION_END);
      EventHandler.one(this._element, TRANSITION_END, function () {
        _this9._element.classList.remove(CLASS_NAME_STATIC);
XhmikosR's avatar
XhmikosR committed
2945

XhmikosR's avatar
XhmikosR committed
2946
2947
2948
2949
2950
2951
2952
2953
        if (!isModalOverflowing) {
          EventHandler.one(_this9._element, TRANSITION_END, function () {
            _this9._element.style.overflowY = '';
          });
          emulateTransitionEnd(_this9._element, modalTransitionDuration);
        }
      });
      emulateTransitionEnd(this._element, modalTransitionDuration);
XhmikosR's avatar
XhmikosR committed
2954

XhmikosR's avatar
XhmikosR committed
2955
      this._element.focus();
Mark Otto's avatar
Mark Otto committed
2956
    } // ----------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
2957
2958
    // the following methods are used to handle overflowing modals
    // ----------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
2959
    ;
Mark Otto's avatar
grunt    
Mark Otto committed
2960

XhmikosR's avatar
Dist    
XhmikosR committed
2961
2962
    _proto._adjustDialog = function _adjustDialog() {
      var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
Mark Otto's avatar
grunt    
Mark Otto committed
2963

XhmikosR's avatar
Dist    
XhmikosR committed
2964
2965
2966
      if (!this._isBodyOverflowing && isModalOverflowing) {
        this._element.style.paddingLeft = this._scrollbarWidth + "px";
      }
Mark Otto's avatar
dist    
Mark Otto committed
2967

XhmikosR's avatar
Dist    
XhmikosR committed
2968
2969
2970
2971
      if (this._isBodyOverflowing && !isModalOverflowing) {
        this._element.style.paddingRight = this._scrollbarWidth + "px";
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2972

XhmikosR's avatar
Dist    
XhmikosR committed
2973
2974
2975
2976
    _proto._resetAdjustments = function _resetAdjustments() {
      this._element.style.paddingLeft = '';
      this._element.style.paddingRight = '';
    };
Mark Otto's avatar
dist    
Mark Otto committed
2977

XhmikosR's avatar
Dist    
XhmikosR committed
2978
2979
    _proto._checkScrollbar = function _checkScrollbar() {
      var rect = document.body.getBoundingClientRect();
XhmikosR's avatar
XhmikosR committed
2980
      this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
XhmikosR's avatar
Dist    
XhmikosR committed
2981
2982
      this._scrollbarWidth = this._getScrollbarWidth();
    };
Mark Otto's avatar
dist    
Mark Otto committed
2983

XhmikosR's avatar
Dist    
XhmikosR committed
2984
    _proto._setScrollbar = function _setScrollbar() {
XhmikosR's avatar
XhmikosR committed
2985
      var _this10 = this;
XhmikosR's avatar
Dist    
XhmikosR committed
2986
2987
2988
2989

      if (this._isBodyOverflowing) {
        // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
        //   while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
XhmikosR's avatar
XhmikosR committed
2990
        // Adjust fixed content padding
XhmikosR's avatar
XhmikosR committed
2991
        SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
XhmikosR's avatar
Dist    
XhmikosR committed
2992
          var actualPadding = element.style.paddingRight;
XhmikosR's avatar
XhmikosR committed
2993
2994
          var calculatedPadding = window.getComputedStyle(element)['padding-right'];
          Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
XhmikosR's avatar
XhmikosR committed
2995
          element.style.paddingRight = Number.parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
2996
2997
        }); // Adjust sticky content margin

XhmikosR's avatar
XhmikosR committed
2998
        SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach(function (element) {
XhmikosR's avatar
Dist    
XhmikosR committed
2999
          var actualMargin = element.style.marginRight;
XhmikosR's avatar
XhmikosR committed
3000
3001
          var calculatedMargin = window.getComputedStyle(element)['margin-right'];
          Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
XhmikosR's avatar
XhmikosR committed
3002
          element.style.marginRight = Number.parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
3003
3004
3005
        }); // Adjust body padding

        var actualPadding = document.body.style.paddingRight;
XhmikosR's avatar
XhmikosR committed
3006
3007
        var calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
        Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
XhmikosR's avatar
XhmikosR committed
3008
        document.body.style.paddingRight = Number.parseFloat(calculatedPadding) + this._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
3009
      }
XhmikosR's avatar
Dist    
XhmikosR committed
3010

XhmikosR's avatar
XhmikosR committed
3011
      document.body.classList.add(CLASS_NAME_OPEN);
XhmikosR's avatar
Dist    
XhmikosR committed
3012
    };
Mark Otto's avatar
grunt    
Mark Otto committed
3013

XhmikosR's avatar
Dist    
XhmikosR committed
3014
3015
    _proto._resetScrollbar = function _resetScrollbar() {
      // Restore fixed content padding
XhmikosR's avatar
XhmikosR committed
3016
      SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3017
3018
3019
3020
3021
3022
3023
        var padding = Manipulator.getDataAttribute(element, 'padding-right');

        if (typeof padding !== 'undefined') {
          Manipulator.removeDataAttribute(element, 'padding-right');
          element.style.paddingRight = padding;
        }
      }); // Restore sticky content and navbar-toggler margin
Jacob Thornton's avatar
Jacob Thornton committed
3024

XhmikosR's avatar
XhmikosR committed
3025
      SelectorEngine.find("" + SELECTOR_STICKY_CONTENT).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3026
        var margin = Manipulator.getDataAttribute(element, 'margin-right');
Mark Otto's avatar
dist    
Mark Otto committed
3027

XhmikosR's avatar
Dist    
XhmikosR committed
3028
        if (typeof margin !== 'undefined') {
XhmikosR's avatar
XhmikosR committed
3029
3030
          Manipulator.removeDataAttribute(element, 'margin-right');
          element.style.marginRight = margin;
XhmikosR's avatar
Dist    
XhmikosR committed
3031
3032
        }
      }); // Restore body padding
Jacob Thornton's avatar
Jacob Thornton committed
3033

XhmikosR's avatar
XhmikosR committed
3034
3035
      var padding = Manipulator.getDataAttribute(document.body, 'padding-right');

XhmikosR's avatar
Dist.    
XhmikosR committed
3036
3037
3038
      if (typeof padding === 'undefined') {
        document.body.style.paddingRight = '';
      } else {
XhmikosR's avatar
XhmikosR committed
3039
3040
3041
        Manipulator.removeDataAttribute(document.body, 'padding-right');
        document.body.style.paddingRight = padding;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
3042
    };
Mark Otto's avatar
grunt    
Mark Otto committed
3043

XhmikosR's avatar
Dist    
XhmikosR committed
3044
3045
3046
    _proto._getScrollbarWidth = function _getScrollbarWidth() {
      // thx d.walsh
      var scrollDiv = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
3047
      scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
XhmikosR's avatar
Dist    
XhmikosR committed
3048
3049
3050
3051
      document.body.appendChild(scrollDiv);
      var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
      document.body.removeChild(scrollDiv);
      return scrollbarWidth;
Mark Otto's avatar
Mark Otto committed
3052
3053
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
3054

XhmikosR's avatar
XhmikosR committed
3055
    Modal.jQueryInterface = function jQueryInterface(config, relatedTarget) {
XhmikosR's avatar
Dist    
XhmikosR committed
3056
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
3057
        var data = Data.getData(this, DATA_KEY$5);
Mark Otto's avatar
grunt    
Mark Otto committed
3058

XhmikosR's avatar
XhmikosR committed
3059
        var _config = _extends({}, Default$3, Manipulator.getDataAttributes(this), typeof config === 'object' && config ? config : {});
Jacob Thornton's avatar
Jacob Thornton committed
3060

XhmikosR's avatar
Dist    
XhmikosR committed
3061
3062
3063
3064
3065
3066
3067
        if (!data) {
          data = new Modal(this, _config);
        }

        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Jacob Thornton's avatar
Jacob Thornton committed
3068
          }
Mark Otto's avatar
dist    
Mark Otto committed
3069

XhmikosR's avatar
Dist    
XhmikosR committed
3070
3071
3072
          data[config](relatedTarget);
        } else if (_config.show) {
          data.show(relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
3073
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3074
3075
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
3076

XhmikosR's avatar
XhmikosR committed
3077
    Modal.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
3078
3079
3080
      return Data.getData(element, DATA_KEY$5);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
    _createClass(Modal, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$5;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$3;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
3092

XhmikosR's avatar
Dist    
XhmikosR committed
3093
3094
3095
3096
3097
3098
3099
    return Modal;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
3100
3101


XhmikosR's avatar
XhmikosR committed
3102
  EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
XhmikosR's avatar
XhmikosR committed
3103
    var _this11 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3104

XhmikosR's avatar
XhmikosR committed
3105
    var target = getElementFromSelector(this);
XhmikosR's avatar
Dist    
XhmikosR committed
3106
3107
3108
3109
3110

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

XhmikosR's avatar
XhmikosR committed
3111
    EventHandler.one(target, EVENT_SHOW$2, function (showEvent) {
XhmikosR's avatar
XhmikosR committed
3112
3113
      if (showEvent.defaultPrevented) {
        // only register focus restorer if modal will actually get shown
XhmikosR's avatar
Dist    
XhmikosR committed
3114
        return;
Jacob Thornton's avatar
Jacob Thornton committed
3115
3116
      }

XhmikosR's avatar
XhmikosR committed
3117
      EventHandler.one(target, EVENT_HIDDEN$2, function () {
XhmikosR's avatar
XhmikosR committed
3118
3119
        if (isVisible(_this11)) {
          _this11.focus();
Jacob Thornton's avatar
Jacob Thornton committed
3120
        }
Mark Otto's avatar
dist    
Mark Otto committed
3121
3122
      });
    });
XhmikosR's avatar
XhmikosR committed
3123
    var data = Data.getData(target, DATA_KEY$5);
Mark Otto's avatar
dist    
Mark Otto committed
3124

XhmikosR's avatar
XhmikosR committed
3125
    if (!data) {
XhmikosR's avatar
XhmikosR committed
3126
      var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this));
3127

XhmikosR's avatar
XhmikosR committed
3128
3129
3130
3131
      data = new Modal(target, config);
    }

    data.show(this);
XhmikosR's avatar
Dist    
XhmikosR committed
3132
3133
3134
3135
3136
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
3137
   * add .Modal to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
3138
   */
Jacob Thornton's avatar
Jacob Thornton committed
3139

XhmikosR's avatar
XhmikosR committed
3140
3141
3142
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
3143

XhmikosR's avatar
XhmikosR committed
3144
3145
3146
3147
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$5];
      $.fn[NAME$5] = Modal.jQueryInterface;
      $.fn[NAME$5].Constructor = Modal;
Jacob Thornton's avatar
Jacob Thornton committed
3148

XhmikosR's avatar
XhmikosR committed
3149
3150
3151
3152
3153
3154
      $.fn[NAME$5].noConflict = function () {
        $.fn[NAME$5] = JQUERY_NO_CONFLICT;
        return Modal.jQueryInterface;
      };
    }
  });
Jacob Thornton's avatar
Jacob Thornton committed
3155

XhmikosR's avatar
XhmikosR committed
3156
3157
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
3158
   * Bootstrap (v5.0.0-alpha3): util/sanitizer.js
XhmikosR's avatar
XhmikosR committed
3159
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
XhmikosR committed
3160
3161
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
XhmikosR committed
3162
  var uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
XhmikosR's avatar
XhmikosR committed
3163
  var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
XhmikosR's avatar
XhmikosR committed
3164
3165
3166
3167
3168
3169
  /**
   * A pattern that recognizes a commonly useful subset of URLs that are safe.
   *
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
   */

XhmikosR's avatar
XhmikosR committed
3170
  var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
XhmikosR's avatar
XhmikosR committed
3171
3172
3173
3174
3175
3176
  /**
   * A pattern that matches safe data URLs. Only matches image, video and audio types.
   *
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
   */

XhmikosR's avatar
XhmikosR committed
3177
  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;
XhmikosR's avatar
XhmikosR committed
3178
3179
3180
3181

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

XhmikosR's avatar
XhmikosR committed
3182
3183
    if (allowedAttributeList.includes(attrName)) {
      if (uriAttrs.has(attrName)) {
Mark Otto's avatar
Mark Otto committed
3184
        return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
XhmikosR's avatar
XhmikosR committed
3185
3186
3187
3188
3189
3190
3191
3192
3193
      }

      return true;
    }

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

XhmikosR's avatar
XhmikosR committed
3194
    for (var i = 0, len = regExp.length; i < len; i++) {
Mark Otto's avatar
Mark Otto committed
3195
      if (attrName.match(regExp[i])) {
XhmikosR's avatar
XhmikosR committed
3196
3197
3198
3199
3200
3201
3202
        return true;
      }
    }

    return false;
  };

XhmikosR's avatar
XhmikosR committed
3203
  var DefaultAllowlist = {
XhmikosR's avatar
XhmikosR committed
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
    // Global attributes allowed on any supplied element below.
    '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
    a: ['target', 'href', 'title', 'rel'],
    area: [],
    b: [],
    br: [],
    col: [],
    code: [],
    div: [],
    em: [],
    hr: [],
    h1: [],
    h2: [],
    h3: [],
    h4: [],
    h5: [],
    h6: [],
    i: [],
XhmikosR's avatar
XhmikosR committed
3222
    img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
XhmikosR's avatar
XhmikosR committed
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
    li: [],
    ol: [],
    p: [],
    pre: [],
    s: [],
    small: [],
    span: [],
    sub: [],
    sup: [],
    strong: [],
    u: [],
    ul: []
  };
XhmikosR's avatar
XhmikosR committed
3236
  function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
XhmikosR's avatar
XhmikosR committed
3237
3238
    var _ref;

XhmikosR's avatar
XhmikosR committed
3239
    if (!unsafeHtml.length) {
XhmikosR's avatar
XhmikosR committed
3240
3241
3242
3243
3244
3245
3246
3247
3248
      return unsafeHtml;
    }

    if (sanitizeFn && typeof sanitizeFn === 'function') {
      return sanitizeFn(unsafeHtml);
    }

    var domParser = new window.DOMParser();
    var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
XhmikosR's avatar
XhmikosR committed
3249
    var allowlistKeys = Object.keys(allowList);
XhmikosR's avatar
XhmikosR committed
3250
3251

    var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*'));
XhmikosR's avatar
XhmikosR committed
3252
3253

    var _loop = function _loop(i, len) {
XhmikosR's avatar
XhmikosR committed
3254
3255
      var _ref2;

XhmikosR's avatar
XhmikosR committed
3256
3257
3258
      var el = elements[i];
      var elName = el.nodeName.toLowerCase();

XhmikosR's avatar
XhmikosR committed
3259
      if (!allowlistKeys.includes(elName)) {
XhmikosR's avatar
XhmikosR committed
3260
3261
3262
3263
        el.parentNode.removeChild(el);
        return "continue";
      }

XhmikosR's avatar
XhmikosR committed
3264
3265
      var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes);

XhmikosR's avatar
XhmikosR committed
3266
      var allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
XhmikosR's avatar
XhmikosR committed
3267
      attributeList.forEach(function (attr) {
XhmikosR's avatar
XhmikosR committed
3268
        if (!allowedAttribute(attr, allowedAttributes)) {
XhmikosR's avatar
XhmikosR committed
3269
3270
3271
3272
3273
3274
          el.removeAttribute(attr.nodeName);
        }
      });
    };

    for (var i = 0, len = elements.length; i < len; i++) {
3275
      var _ret = _loop(i);
XhmikosR's avatar
XhmikosR committed
3276
3277
3278
3279
3280
3281
3282

      if (_ret === "continue") continue;
    }

    return createdDocument.body.innerHTML;
  }

XhmikosR's avatar
Dist    
XhmikosR committed
3283
3284
3285
3286
3287
3288
3289
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$6 = 'tooltip';
XhmikosR's avatar
XhmikosR committed
3290
  var VERSION$6 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
3291
3292
3293
3294
  var DATA_KEY$6 = 'bs.tooltip';
  var EVENT_KEY$6 = "." + DATA_KEY$6;
  var CLASS_PREFIX = 'bs-tooltip';
  var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
XhmikosR's avatar
XhmikosR committed
3295
  var DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
XhmikosR's avatar
Dist    
XhmikosR committed
3296
3297
3298
3299
3300
3301
3302
3303
3304
  var DefaultType$4 = {
    animation: 'boolean',
    template: 'string',
    title: '(string|element|function)',
    trigger: 'string',
    delay: '(number|object)',
    html: 'boolean',
    selector: '(string|boolean)',
    placement: '(string|function)',
Mark Otto's avatar
Mark Otto committed
3305
    offset: '(number|string|function)',
XhmikosR's avatar
Dist    
XhmikosR committed
3306
3307
    container: '(string|element|boolean)',
    fallbackPlacement: '(string|array)',
XhmikosR's avatar
XhmikosR committed
3308
3309
3310
    boundary: '(string|element)',
    sanitize: 'boolean',
    sanitizeFn: '(null|function)',
XhmikosR's avatar
XhmikosR committed
3311
    allowList: 'object',
XhmikosR's avatar
XhmikosR committed
3312
    popperConfig: '(null|object)'
XhmikosR's avatar
Dist    
XhmikosR committed
3313
  };
XhmikosR's avatar
XhmikosR committed
3314
  var AttachmentMap = {
XhmikosR's avatar
Dist    
XhmikosR committed
3315
3316
3317
3318
3319
3320
3321
3322
    AUTO: 'auto',
    TOP: 'top',
    RIGHT: 'right',
    BOTTOM: 'bottom',
    LEFT: 'left'
  };
  var Default$4 = {
    animation: true,
XhmikosR's avatar
XhmikosR committed
3323
    template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
XhmikosR's avatar
Dist    
XhmikosR committed
3324
3325
3326
3327
3328
3329
3330
3331
3332
    trigger: 'hover focus',
    title: '',
    delay: 0,
    html: false,
    selector: false,
    placement: 'top',
    offset: 0,
    container: false,
    fallbackPlacement: 'flip',
XhmikosR's avatar
XhmikosR committed
3333
3334
3335
    boundary: 'scrollParent',
    sanitize: true,
    sanitizeFn: null,
XhmikosR's avatar
XhmikosR committed
3336
    allowList: DefaultAllowlist,
XhmikosR's avatar
XhmikosR committed
3337
    popperConfig: null
XhmikosR's avatar
Dist    
XhmikosR committed
3338
  };
XhmikosR's avatar
XhmikosR committed
3339
  var Event$1 = {
XhmikosR's avatar
Dist    
XhmikosR committed
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
    HIDE: "hide" + EVENT_KEY$6,
    HIDDEN: "hidden" + EVENT_KEY$6,
    SHOW: "show" + EVENT_KEY$6,
    SHOWN: "shown" + EVENT_KEY$6,
    INSERTED: "inserted" + EVENT_KEY$6,
    CLICK: "click" + EVENT_KEY$6,
    FOCUSIN: "focusin" + EVENT_KEY$6,
    FOCUSOUT: "focusout" + EVENT_KEY$6,
    MOUSEENTER: "mouseenter" + EVENT_KEY$6,
    MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  };
XhmikosR's avatar
XhmikosR committed
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
  var CLASS_NAME_FADE$1 = 'fade';
  var CLASS_NAME_MODAL = 'modal';
  var CLASS_NAME_SHOW$3 = 'show';
  var HOVER_STATE_SHOW = 'show';
  var HOVER_STATE_OUT = 'out';
  var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  var TRIGGER_HOVER = 'hover';
  var TRIGGER_FOCUS = 'focus';
  var TRIGGER_CLICK = 'click';
  var TRIGGER_MANUAL = 'manual';
XhmikosR's avatar
XhmikosR committed
3361
3362
3363
3364
3365
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
3366

XhmikosR's avatar
XhmikosR committed
3367
  var Tooltip = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
3368
    function Tooltip(element, config) {
XhmikosR's avatar
XhmikosR committed
3369
      if (typeof Popper__default['default'] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
3370
        throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
XhmikosR's avatar
Dist    
XhmikosR committed
3371
      } // private
Mark Otto's avatar
dist    
Mark Otto committed
3372
3373


XhmikosR's avatar
Dist    
XhmikosR committed
3374
3375
3376
3377
3378
      this._isEnabled = true;
      this._timeout = 0;
      this._hoverState = '';
      this._activeTrigger = {};
      this._popper = null; // Protected
Jacob Thornton's avatar
Jacob Thornton committed
3379

XhmikosR's avatar
Dist    
XhmikosR committed
3380
3381
3382
      this.element = element;
      this.config = this._getConfig(config);
      this.tip = null;
Jacob Thornton's avatar
Jacob Thornton committed
3383

XhmikosR's avatar
Dist    
XhmikosR committed
3384
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
3385
3386

      Data.setData(element, this.constructor.DATA_KEY, this);
XhmikosR's avatar
Dist    
XhmikosR committed
3387
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
3388
3389


XhmikosR's avatar
Dist    
XhmikosR committed
3390
    var _proto = Tooltip.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
3391

XhmikosR's avatar
Dist    
XhmikosR committed
3392
3393
3394
3395
    // Public
    _proto.enable = function enable() {
      this._isEnabled = true;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3396

XhmikosR's avatar
Dist    
XhmikosR committed
3397
3398
3399
    _proto.disable = function disable() {
      this._isEnabled = false;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3400

XhmikosR's avatar
Dist    
XhmikosR committed
3401
3402
3403
    _proto.toggleEnabled = function toggleEnabled() {
      this._isEnabled = !this._isEnabled;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3404

XhmikosR's avatar
Dist    
XhmikosR committed
3405
3406
3407
3408
    _proto.toggle = function toggle(event) {
      if (!this._isEnabled) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3409

XhmikosR's avatar
Dist    
XhmikosR committed
3410
3411
      if (event) {
        var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
3412
        var context = Data.getData(event.delegateTarget, dataKey);
Jacob Thornton's avatar
Jacob Thornton committed
3413

XhmikosR's avatar
Dist    
XhmikosR committed
3414
        if (!context) {
XhmikosR's avatar
XhmikosR committed
3415
3416
          context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
          Data.setData(event.delegateTarget, dataKey, context);
Mark Otto's avatar
dist    
Mark Otto committed
3417
        }
Jacob Thornton's avatar
Jacob Thornton committed
3418

XhmikosR's avatar
Dist    
XhmikosR committed
3419
        context._activeTrigger.click = !context._activeTrigger.click;
Jacob Thornton's avatar
Jacob Thornton committed
3420

XhmikosR's avatar
Dist    
XhmikosR committed
3421
3422
        if (context._isWithActiveTrigger()) {
          context._enter(null, context);
Mark Otto's avatar
dist    
Mark Otto committed
3423
        } else {
XhmikosR's avatar
Dist    
XhmikosR committed
3424
3425
3426
          context._leave(null, context);
        }
      } else {
XhmikosR's avatar
XhmikosR committed
3427
        if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
XhmikosR's avatar
Dist    
XhmikosR committed
3428
          this._leave(null, this);
Jacob Thornton's avatar
Jacob Thornton committed
3429

XhmikosR's avatar
Dist    
XhmikosR committed
3430
          return;
Mark Otto's avatar
dist    
Mark Otto committed
3431
        }
Jacob Thornton's avatar
Jacob Thornton committed
3432

XhmikosR's avatar
Dist    
XhmikosR committed
3433
3434
3435
        this._enter(null, this);
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
3436

XhmikosR's avatar
Dist    
XhmikosR committed
3437
3438
    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
XhmikosR's avatar
XhmikosR committed
3439
3440
      Data.removeData(this.element, this.constructor.DATA_KEY);
      EventHandler.off(this.element, this.constructor.EVENT_KEY);
XhmikosR's avatar
XhmikosR committed
3441
      EventHandler.off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
Jacob Thornton's avatar
Jacob Thornton committed
3442

XhmikosR's avatar
Dist    
XhmikosR committed
3443
      if (this.tip) {
XhmikosR's avatar
XhmikosR committed
3444
        this.tip.parentNode.removeChild(this.tip);
XhmikosR's avatar
Dist    
XhmikosR committed
3445
      }
Mark Otto's avatar
dist    
Mark Otto committed
3446

XhmikosR's avatar
Dist    
XhmikosR committed
3447
3448
3449
3450
      this._isEnabled = null;
      this._timeout = null;
      this._hoverState = null;
      this._activeTrigger = null;
Mark Otto's avatar
grunt    
Mark Otto committed
3451

XhmikosR's avatar
XhmikosR committed
3452
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
3453
3454
        this._popper.destroy();
      }
Jacob Thornton's avatar
Jacob Thornton committed
3455

XhmikosR's avatar
Dist    
XhmikosR committed
3456
3457
3458
3459
3460
      this._popper = null;
      this.element = null;
      this.config = null;
      this.tip = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3461

XhmikosR's avatar
Dist    
XhmikosR committed
3462
3463
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
3464

XhmikosR's avatar
XhmikosR committed
3465
      if (this.element.style.display === 'none') {
XhmikosR's avatar
Dist    
XhmikosR committed
3466
3467
        throw new Error('Please use show on visible elements');
      }
Mark Otto's avatar
dist    
Mark Otto committed
3468

XhmikosR's avatar
Dist    
XhmikosR committed
3469
      if (this.isWithContent() && this._isEnabled) {
XhmikosR's avatar
XhmikosR committed
3470
3471
        var showEvent = EventHandler.trigger(this.element, this.constructor.Event.SHOW);
        var shadowRoot = findShadowRoot(this.element);
XhmikosR's avatar
Dist.    
XhmikosR committed
3472
        var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element);
Jacob Thornton's avatar
Jacob Thornton committed
3473

XhmikosR's avatar
XhmikosR committed
3474
        if (showEvent.defaultPrevented || !isInTheDom) {
XhmikosR's avatar
Dist    
XhmikosR committed
3475
3476
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
3477

XhmikosR's avatar
Dist    
XhmikosR committed
3478
        var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
3479
        var tipId = getUID(this.constructor.NAME);
XhmikosR's avatar
Dist    
XhmikosR committed
3480
3481
3482
        tip.setAttribute('id', tipId);
        this.element.setAttribute('aria-describedby', tipId);
        this.setContent();
Jacob Thornton's avatar
Jacob Thornton committed
3483

XhmikosR's avatar
Dist    
XhmikosR committed
3484
        if (this.config.animation) {
XhmikosR's avatar
XhmikosR committed
3485
          tip.classList.add(CLASS_NAME_FADE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
3486
        }
Jacob Thornton's avatar
Jacob Thornton committed
3487

XhmikosR's avatar
Dist    
XhmikosR committed
3488
        var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
Jacob Thornton's avatar
Jacob Thornton committed
3489

XhmikosR's avatar
Dist    
XhmikosR committed
3490
        var attachment = this._getAttachment(placement);
Mark Otto's avatar
dist    
Mark Otto committed
3491

3492
        this._addAttachmentClass(attachment);
Mark Otto's avatar
dist    
Mark Otto committed
3493
3494
3495

        var container = this._getContainer();

XhmikosR's avatar
XhmikosR committed
3496
        Data.setData(tip, this.constructor.DATA_KEY, this);
Mark Otto's avatar
grunt    
Mark Otto committed
3497

XhmikosR's avatar
XhmikosR committed
3498
3499
        if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
          container.appendChild(tip);
XhmikosR's avatar
Dist    
XhmikosR committed
3500
3501
        }

XhmikosR's avatar
XhmikosR committed
3502
        EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
XhmikosR's avatar
XhmikosR committed
3503
        this._popper = new Popper__default['default'](this.element, tip, this._getPopperConfig(attachment));
XhmikosR's avatar
XhmikosR committed
3504
        tip.classList.add(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we add extra
XhmikosR's avatar
Dist    
XhmikosR committed
3505
3506
3507
        // empty mouseover listeners to the body's immediate children;
        // only needed because of broken event delegation on iOS
        // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
Mark Otto's avatar
dist    
Mark Otto committed
3508

XhmikosR's avatar
Dist    
XhmikosR committed
3509
        if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
3510
3511
3512
          var _ref;

          (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3513
3514
            EventHandler.on(element, 'mouseover', noop());
          });
XhmikosR's avatar
Dist    
XhmikosR committed
3515
        }
Mark Otto's avatar
grunt    
Mark Otto committed
3516

XhmikosR's avatar
Dist    
XhmikosR committed
3517
3518
3519
3520
        var complete = function complete() {
          if (_this.config.animation) {
            _this._fixTransition();
          }
Mark Otto's avatar
dist    
Mark Otto committed
3521

XhmikosR's avatar
Dist    
XhmikosR committed
3522
3523
          var prevHoverState = _this._hoverState;
          _this._hoverState = null;
XhmikosR's avatar
XhmikosR committed
3524
          EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN);
Jacob Thornton's avatar
Jacob Thornton committed
3525

XhmikosR's avatar
XhmikosR committed
3526
          if (prevHoverState === HOVER_STATE_OUT) {
XhmikosR's avatar
Dist    
XhmikosR committed
3527
            _this._leave(null, _this);
Mark Otto's avatar
dist    
Mark Otto committed
3528
          }
XhmikosR's avatar
Dist    
XhmikosR committed
3529
3530
        };

XhmikosR's avatar
XhmikosR committed
3531
        if (this.tip.classList.contains(CLASS_NAME_FADE$1)) {
XhmikosR's avatar
XhmikosR committed
3532
3533
3534
          var transitionDuration = getTransitionDurationFromElement(this.tip);
          EventHandler.one(this.tip, TRANSITION_END, complete);
          emulateTransitionEnd(this.tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3535
3536
        } else {
          complete();
Mark Otto's avatar
dist    
Mark Otto committed
3537
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3538
3539
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3540

3541
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
3542
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3543

XhmikosR's avatar
XhmikosR committed
3544
3545
3546
3547
      if (!this._popper) {
        return;
      }

XhmikosR's avatar
Dist    
XhmikosR committed
3548
      var tip = this.getTipElement();
Mark Otto's avatar
dist    
Mark Otto committed
3549

XhmikosR's avatar
Dist    
XhmikosR committed
3550
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
3551
        if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
XhmikosR's avatar
Dist    
XhmikosR committed
3552
3553
          tip.parentNode.removeChild(tip);
        }
Mark Otto's avatar
grunt    
Mark Otto committed
3554

XhmikosR's avatar
Dist    
XhmikosR committed
3555
        _this2._cleanTipClass();
Mark Otto's avatar
dist    
Mark Otto committed
3556

XhmikosR's avatar
Dist    
XhmikosR committed
3557
        _this2.element.removeAttribute('aria-describedby');
Mark Otto's avatar
dist    
Mark Otto committed
3558

XhmikosR's avatar
XhmikosR committed
3559
        EventHandler.trigger(_this2.element, _this2.constructor.Event.HIDDEN);
Mark Otto's avatar
dist    
Mark Otto committed
3560

3561
        _this2._popper.destroy();
XhmikosR's avatar
Dist    
XhmikosR committed
3562
      };
Mark Otto's avatar
grunt    
Mark Otto committed
3563

XhmikosR's avatar
XhmikosR committed
3564
      var hideEvent = EventHandler.trigger(this.element, this.constructor.Event.HIDE);
Mark Otto's avatar
dist    
Mark Otto committed
3565

XhmikosR's avatar
XhmikosR committed
3566
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
3567
3568
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3569

XhmikosR's avatar
XhmikosR committed
3570
      tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra
XhmikosR's avatar
Dist    
XhmikosR committed
3571
      // empty mouseover listeners we added for iOS support
Mark Otto's avatar
dist    
Mark Otto committed
3572

XhmikosR's avatar
Dist    
XhmikosR committed
3573
      if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
3574
3575
3576
        var _ref2;

        (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3577
3578
          return EventHandler.off(element, 'mouseover', noop);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
3579
      }
Jacob Thornton's avatar
Jacob Thornton committed
3580

XhmikosR's avatar
XhmikosR committed
3581
3582
3583
      this._activeTrigger[TRIGGER_CLICK] = false;
      this._activeTrigger[TRIGGER_FOCUS] = false;
      this._activeTrigger[TRIGGER_HOVER] = false;
Jacob Thornton's avatar
Jacob Thornton committed
3584

XhmikosR's avatar
XhmikosR committed
3585
      if (this.tip.classList.contains(CLASS_NAME_FADE$1)) {
XhmikosR's avatar
XhmikosR committed
3586
3587
3588
        var transitionDuration = getTransitionDurationFromElement(tip);
        EventHandler.one(tip, TRANSITION_END, complete);
        emulateTransitionEnd(tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3589
3590
3591
      } else {
        complete();
      }
Jacob Thornton's avatar
Jacob Thornton committed
3592

XhmikosR's avatar
Dist    
XhmikosR committed
3593
3594
      this._hoverState = '';
    };
Jacob Thornton's avatar
Jacob Thornton committed
3595

XhmikosR's avatar
Dist    
XhmikosR committed
3596
3597
3598
3599
    _proto.update = function update() {
      if (this._popper !== null) {
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
3600
3601
    } // Protected
    ;
Jacob Thornton's avatar
Jacob Thornton committed
3602

XhmikosR's avatar
Dist    
XhmikosR committed
3603
3604
3605
    _proto.isWithContent = function isWithContent() {
      return Boolean(this.getTitle());
    };
Jacob Thornton's avatar
Jacob Thornton committed
3606

XhmikosR's avatar
Dist    
XhmikosR committed
3607
    _proto.getTipElement = function getTipElement() {
XhmikosR's avatar
XhmikosR committed
3608
3609
3610
3611
3612
3613
3614
      if (this.tip) {
        return this.tip;
      }

      var element = document.createElement('div');
      element.innerHTML = this.config.template;
      this.tip = element.children[0];
XhmikosR's avatar
Dist    
XhmikosR committed
3615
3616
      return this.tip;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3617

XhmikosR's avatar
Dist    
XhmikosR committed
3618
3619
    _proto.setContent = function setContent() {
      var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
3620
      this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
XhmikosR's avatar
XhmikosR committed
3621
      tip.classList.remove(CLASS_NAME_FADE$1, CLASS_NAME_SHOW$3);
XhmikosR's avatar
Dist    
XhmikosR committed
3622
    };
Jacob Thornton's avatar
Jacob Thornton committed
3623

XhmikosR's avatar
XhmikosR committed
3624
3625
3626
3627
3628
    _proto.setElementContent = function setElementContent(element, content) {
      if (element === null) {
        return;
      }

3629
      if (typeof content === 'object' && isElement(content)) {
XhmikosR's avatar
XhmikosR committed
3630
3631
3632
3633
3634
        if (content.jquery) {
          content = content[0];
        } // content is a DOM node or a jQuery


XhmikosR's avatar
XhmikosR committed
3635
        if (this.config.html) {
XhmikosR's avatar
XhmikosR committed
3636
3637
3638
          if (content.parentNode !== element) {
            element.innerHTML = '';
            element.appendChild(content);
Mark Otto's avatar
dist    
Mark Otto committed
3639
3640
          }
        } else {
XhmikosR's avatar
XhmikosR committed
3641
          element.textContent = content.textContent;
Mark Otto's avatar
dist    
Mark Otto committed
3642
        }
XhmikosR's avatar
XhmikosR committed
3643
3644
3645
3646
3647
3648

        return;
      }

      if (this.config.html) {
        if (this.config.sanitize) {
XhmikosR's avatar
XhmikosR committed
3649
          content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
XhmikosR's avatar
XhmikosR committed
3650
3651
        }

XhmikosR's avatar
XhmikosR committed
3652
        element.innerHTML = content;
XhmikosR's avatar
Dist    
XhmikosR committed
3653
      } else {
XhmikosR's avatar
XhmikosR committed
3654
        element.textContent = content;
XhmikosR's avatar
Dist    
XhmikosR committed
3655
3656
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3657

XhmikosR's avatar
Dist    
XhmikosR committed
3658
    _proto.getTitle = function getTitle() {
XhmikosR's avatar
XhmikosR committed
3659
      var title = this.element.getAttribute('data-bs-original-title');
Jacob Thornton's avatar
Jacob Thornton committed
3660

XhmikosR's avatar
Dist    
XhmikosR committed
3661
3662
3663
      if (!title) {
        title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3664

XhmikosR's avatar
Dist    
XhmikosR committed
3665
      return title;
Mark Otto's avatar
Mark Otto committed
3666
3667
    } // Private
    ;
Jacob Thornton's avatar
Jacob Thornton committed
3668

XhmikosR's avatar
XhmikosR committed
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
    _proto._getPopperConfig = function _getPopperConfig(attachment) {
      var _this3 = this;

      var defaultBsConfig = {
        placement: attachment,
        modifiers: {
          offset: this._getOffset(),
          flip: {
            behavior: this.config.fallbackPlacement
          },
          arrow: {
            element: "." + this.constructor.NAME + "-arrow"
          },
          preventOverflow: {
            boundariesElement: this.config.boundary
          }
        },
        onCreate: function onCreate(data) {
          if (data.originalPlacement !== data.placement) {
            _this3._handlePopperPlacementChange(data);
          }
        },
        onUpdate: function onUpdate(data) {
          return _this3._handlePopperPlacementChange(data);
        }
      };
XhmikosR's avatar
XhmikosR committed
3695
      return _extends({}, defaultBsConfig, this.config.popperConfig);
XhmikosR's avatar
XhmikosR committed
3696
3697
    };

3698
3699
3700
3701
    _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
      this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
    };

Mark Otto's avatar
Mark Otto committed
3702
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
XhmikosR committed
3703
      var _this4 = this;
Mark Otto's avatar
Mark Otto committed
3704
3705
3706
3707
3708

      var offset = {};

      if (typeof this.config.offset === 'function') {
        offset.fn = function (data) {
XhmikosR's avatar
XhmikosR committed
3709
          data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
Mark Otto's avatar
Mark Otto committed
3710
3711
3712
3713
3714
3715
3716
3717
3718
          return data;
        };
      } else {
        offset.offset = this.config.offset;
      }

      return offset;
    };

Mark Otto's avatar
dist    
Mark Otto committed
3719
3720
3721
3722
3723
    _proto._getContainer = function _getContainer() {
      if (this.config.container === false) {
        return document.body;
      }

XhmikosR's avatar
XhmikosR committed
3724
3725
      if (isElement(this.config.container)) {
        return this.config.container;
Mark Otto's avatar
dist    
Mark Otto committed
3726
3727
      }

XhmikosR's avatar
XhmikosR committed
3728
      return SelectorEngine.findOne(this.config.container);
Mark Otto's avatar
dist    
Mark Otto committed
3729
3730
    };

XhmikosR's avatar
Dist    
XhmikosR committed
3731
    _proto._getAttachment = function _getAttachment(placement) {
XhmikosR's avatar
XhmikosR committed
3732
      return AttachmentMap[placement.toUpperCase()];
XhmikosR's avatar
Dist    
XhmikosR committed
3733
    };
Mark Otto's avatar
dist    
Mark Otto committed
3734

XhmikosR's avatar
Dist    
XhmikosR committed
3735
    _proto._setListeners = function _setListeners() {
XhmikosR's avatar
XhmikosR committed
3736
      var _this5 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3737

XhmikosR's avatar
Dist    
XhmikosR committed
3738
3739
3740
      var triggers = this.config.trigger.split(' ');
      triggers.forEach(function (trigger) {
        if (trigger === 'click') {
XhmikosR's avatar
XhmikosR committed
3741
3742
          EventHandler.on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
            return _this5.toggle(event);
Mark Otto's avatar
dist    
Mark Otto committed
3743
          });
XhmikosR's avatar
XhmikosR committed
3744
3745
3746
        } else if (trigger !== TRIGGER_MANUAL) {
          var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
          var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
XhmikosR's avatar
XhmikosR committed
3747
3748
          EventHandler.on(_this5.element, eventIn, _this5.config.selector, function (event) {
            return _this5._enter(event);
XhmikosR's avatar
XhmikosR committed
3749
          });
XhmikosR's avatar
XhmikosR committed
3750
3751
          EventHandler.on(_this5.element, eventOut, _this5.config.selector, function (event) {
            return _this5._leave(event);
Mark Otto's avatar
dist    
Mark Otto committed
3752
3753
          });
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3754
      });
Mark Otto's avatar
dist v5    
Mark Otto committed
3755
3756

      this._hideModalHandler = function () {
XhmikosR's avatar
XhmikosR committed
3757
3758
        if (_this5.element) {
          _this5.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
3759
        }
Mark Otto's avatar
dist v5    
Mark Otto committed
3760
3761
      };

XhmikosR's avatar
XhmikosR committed
3762
      EventHandler.on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
Jacob Thornton's avatar
Jacob Thornton committed
3763

XhmikosR's avatar
Dist    
XhmikosR committed
3764
      if (this.config.selector) {
XhmikosR's avatar
XhmikosR committed
3765
        this.config = _extends({}, this.config, {
XhmikosR's avatar
Dist    
XhmikosR committed
3766
3767
3768
3769
3770
3771
3772
          trigger: 'manual',
          selector: ''
        });
      } else {
        this._fixTitle();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3773

XhmikosR's avatar
Dist    
XhmikosR committed
3774
    _proto._fixTitle = function _fixTitle() {
XhmikosR's avatar
XhmikosR committed
3775
3776
      var title = this.element.getAttribute('title');
      var originalTitleType = typeof this.element.getAttribute('data-bs-original-title');
Mark Otto's avatar
dist    
Mark Otto committed
3777

XhmikosR's avatar
XhmikosR committed
3778
3779
      if (title || originalTitleType !== 'string') {
        this.element.setAttribute('data-bs-original-title', title || '');
XhmikosR's avatar
Dist    
XhmikosR committed
3780
3781
3782
        this.element.setAttribute('title', '');
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3783

XhmikosR's avatar
Dist    
XhmikosR committed
3784
3785
    _proto._enter = function _enter(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
3786
      context = context || Data.getData(event.delegateTarget, dataKey);
Jacob Thornton's avatar
Jacob Thornton committed
3787

XhmikosR's avatar
Dist    
XhmikosR committed
3788
      if (!context) {
XhmikosR's avatar
XhmikosR committed
3789
3790
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
3791
      }
Jacob Thornton's avatar
Jacob Thornton committed
3792

XhmikosR's avatar
Dist    
XhmikosR committed
3793
      if (event) {
XhmikosR's avatar
XhmikosR committed
3794
        context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
XhmikosR's avatar
Dist    
XhmikosR committed
3795
      }
Jacob Thornton's avatar
Jacob Thornton committed
3796

XhmikosR's avatar
XhmikosR committed
3797
3798
      if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
        context._hoverState = HOVER_STATE_SHOW;
XhmikosR's avatar
Dist    
XhmikosR committed
3799
3800
3801
3802
        return;
      }

      clearTimeout(context._timeout);
XhmikosR's avatar
XhmikosR committed
3803
      context._hoverState = HOVER_STATE_SHOW;
XhmikosR's avatar
Dist    
XhmikosR committed
3804
3805
3806
3807
3808

      if (!context.config.delay || !context.config.delay.show) {
        context.show();
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3809

XhmikosR's avatar
Dist    
XhmikosR committed
3810
      context._timeout = setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
3811
        if (context._hoverState === HOVER_STATE_SHOW) {
Mark Otto's avatar
dist    
Mark Otto committed
3812
3813
          context.show();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3814
3815
      }, context.config.delay.show);
    };
Jacob Thornton's avatar
Jacob Thornton committed
3816

XhmikosR's avatar
Dist    
XhmikosR committed
3817
3818
    _proto._leave = function _leave(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
3819
      context = context || Data.getData(event.delegateTarget, dataKey);
Mark Otto's avatar
grunt    
Mark Otto committed
3820

XhmikosR's avatar
Dist    
XhmikosR committed
3821
      if (!context) {
XhmikosR's avatar
XhmikosR committed
3822
3823
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
3824
      }
Mark Otto's avatar
dist    
Mark Otto committed
3825

XhmikosR's avatar
Dist    
XhmikosR committed
3826
      if (event) {
XhmikosR's avatar
XhmikosR committed
3827
        context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
XhmikosR's avatar
Dist    
XhmikosR committed
3828
      }
Jacob Thornton's avatar
Jacob Thornton committed
3829

XhmikosR's avatar
Dist    
XhmikosR committed
3830
3831
3832
      if (context._isWithActiveTrigger()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3833

XhmikosR's avatar
Dist    
XhmikosR committed
3834
      clearTimeout(context._timeout);
XhmikosR's avatar
XhmikosR committed
3835
      context._hoverState = HOVER_STATE_OUT;
Jacob Thornton's avatar
Jacob Thornton committed
3836

XhmikosR's avatar
Dist    
XhmikosR committed
3837
3838
3839
3840
      if (!context.config.delay || !context.config.delay.hide) {
        context.hide();
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3841

XhmikosR's avatar
Dist    
XhmikosR committed
3842
      context._timeout = setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
3843
        if (context._hoverState === HOVER_STATE_OUT) {
Mark Otto's avatar
dist    
Mark Otto committed
3844
3845
          context.hide();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3846
3847
      }, context.config.delay.hide);
    };
Jacob Thornton's avatar
Jacob Thornton committed
3848

XhmikosR's avatar
Dist    
XhmikosR committed
3849
3850
3851
3852
    _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
      for (var trigger in this._activeTrigger) {
        if (this._activeTrigger[trigger]) {
          return true;
Mark Otto's avatar
dist    
Mark Otto committed
3853
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3854
      }
Jacob Thornton's avatar
Jacob Thornton committed
3855

XhmikosR's avatar
Dist    
XhmikosR committed
3856
3857
      return false;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3858

XhmikosR's avatar
Dist    
XhmikosR committed
3859
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
3860
      var dataAttributes = Manipulator.getDataAttributes(this.element);
XhmikosR's avatar
XhmikosR committed
3861
      Object.keys(dataAttributes).forEach(function (dataAttr) {
XhmikosR's avatar
XhmikosR committed
3862
        if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
XhmikosR's avatar
XhmikosR committed
3863
3864
3865
          delete dataAttributes[dataAttr];
        }
      });
XhmikosR's avatar
XhmikosR committed
3866
3867
3868
3869
3870

      if (config && typeof config.container === 'object' && config.container.jquery) {
        config.container = config.container[0];
      }

XhmikosR's avatar
XhmikosR committed
3871
      config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
Jacob Thornton's avatar
Jacob Thornton committed
3872

XhmikosR's avatar
Dist    
XhmikosR committed
3873
3874
3875
3876
3877
3878
      if (typeof config.delay === 'number') {
        config.delay = {
          show: config.delay,
          hide: config.delay
        };
      }
Mark Otto's avatar
grunt    
Mark Otto committed
3879

XhmikosR's avatar
Dist    
XhmikosR committed
3880
3881
3882
      if (typeof config.title === 'number') {
        config.title = config.title.toString();
      }
Jacob Thornton's avatar
Jacob Thornton committed
3883

XhmikosR's avatar
Dist    
XhmikosR committed
3884
3885
3886
      if (typeof config.content === 'number') {
        config.content = config.content.toString();
      }
Jacob Thornton's avatar
Jacob Thornton committed
3887

XhmikosR's avatar
XhmikosR committed
3888
      typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
XhmikosR's avatar
XhmikosR committed
3889
3890

      if (config.sanitize) {
XhmikosR's avatar
XhmikosR committed
3891
        config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
XhmikosR's avatar
XhmikosR committed
3892
3893
      }

XhmikosR's avatar
Dist    
XhmikosR committed
3894
3895
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
3896

XhmikosR's avatar
Dist    
XhmikosR committed
3897
3898
    _proto._getDelegateConfig = function _getDelegateConfig() {
      var config = {};
Mark Otto's avatar
dist    
Mark Otto committed
3899

XhmikosR's avatar
Dist    
XhmikosR committed
3900
3901
3902
3903
      if (this.config) {
        for (var key in this.config) {
          if (this.constructor.Default[key] !== this.config[key]) {
            config[key] = this.config[key];
Mark Otto's avatar
dist    
Mark Otto committed
3904
3905
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3906
      }
Mark Otto's avatar
dist    
Mark Otto committed
3907

XhmikosR's avatar
Dist    
XhmikosR committed
3908
3909
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
3910

XhmikosR's avatar
Dist    
XhmikosR committed
3911
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
3912
3913
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
Mark Otto's avatar
dist    
Mark Otto committed
3914

XhmikosR's avatar
XhmikosR committed
3915
      if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
3916
3917
3918
3919
3920
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
3921
3922
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
3923

XhmikosR's avatar
Dist    
XhmikosR committed
3924
    _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
XhmikosR's avatar
XhmikosR committed
3925
      this.tip = popperData.instance.popper;
Mark Otto's avatar
dist    
Mark Otto committed
3926

XhmikosR's avatar
Dist    
XhmikosR committed
3927
      this._cleanTipClass();
Mark Otto's avatar
dist    
Mark Otto committed
3928

3929
      this._addAttachmentClass(this._getAttachment(popperData.placement));
XhmikosR's avatar
Dist    
XhmikosR committed
3930
    };
Mark Otto's avatar
dist    
Mark Otto committed
3931

XhmikosR's avatar
Dist    
XhmikosR committed
3932
3933
3934
    _proto._fixTransition = function _fixTransition() {
      var tip = this.getTipElement();
      var initConfigAnimation = this.config.animation;
Jacob Thornton's avatar
Jacob Thornton committed
3935

XhmikosR's avatar
Dist    
XhmikosR committed
3936
3937
3938
      if (tip.getAttribute('x-placement') !== null) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3939

XhmikosR's avatar
XhmikosR committed
3940
      tip.classList.remove(CLASS_NAME_FADE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
3941
3942
3943
3944
      this.config.animation = false;
      this.hide();
      this.show();
      this.config.animation = initConfigAnimation;
Mark Otto's avatar
Mark Otto committed
3945
3946
    } // Static
    ;
Mark Otto's avatar
grunt    
Mark Otto committed
3947

XhmikosR's avatar
XhmikosR committed
3948
    Tooltip.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
3949
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
3950
        var data = Data.getData(this, DATA_KEY$6);
Jacob Thornton's avatar
Jacob Thornton committed
3951

XhmikosR's avatar
Dist    
XhmikosR committed
3952
        var _config = typeof config === 'object' && config;
Mark Otto's avatar
dist    
Mark Otto committed
3953

XhmikosR's avatar
Dist    
XhmikosR committed
3954
3955
3956
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
3957

XhmikosR's avatar
Dist    
XhmikosR committed
3958
3959
3960
        if (!data) {
          data = new Tooltip(this, _config);
        }
Mark Otto's avatar
dist    
Mark Otto committed
3961

XhmikosR's avatar
Dist    
XhmikosR committed
3962
3963
3964
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
3965
3966
          }

XhmikosR's avatar
Dist    
XhmikosR committed
3967
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
3968
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3969
3970
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
3971

XhmikosR's avatar
XhmikosR committed
3972
    Tooltip.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
3973
3974
3975
      return Data.getData(element, DATA_KEY$6);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
    _createClass(Tooltip, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$6;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$4;
      }
    }, {
      key: "NAME",
      get: function get() {
        return NAME$6;
      }
    }, {
      key: "DATA_KEY",
      get: function get() {
        return DATA_KEY$6;
      }
    }, {
      key: "Event",
      get: function get() {
XhmikosR's avatar
XhmikosR committed
3999
        return Event$1;
XhmikosR's avatar
Dist    
XhmikosR committed
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
      }
    }, {
      key: "EVENT_KEY",
      get: function get() {
        return EVENT_KEY$6;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$4;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
4012

XhmikosR's avatar
Dist    
XhmikosR committed
4013
4014
4015
4016
4017
4018
    return Tooltip;
  }();
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
4019
   * add .Tooltip to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
4020
   */
Mark Otto's avatar
dist    
Mark Otto committed
4021

4022

XhmikosR's avatar
XhmikosR committed
4023
4024
4025
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
Jacob Thornton's avatar
Jacob Thornton committed
4026

XhmikosR's avatar
XhmikosR committed
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$6];
      $.fn[NAME$6] = Tooltip.jQueryInterface;
      $.fn[NAME$6].Constructor = Tooltip;

      $.fn[NAME$6].noConflict = function () {
        $.fn[NAME$6] = JQUERY_NO_CONFLICT;
        return Tooltip.jQueryInterface;
      };
    }
  });
Jacob Thornton's avatar
Jacob Thornton committed
4038

XhmikosR's avatar
Dist    
XhmikosR committed
4039
4040
4041
4042
4043
4044
4045
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$7 = 'popover';
XhmikosR's avatar
XhmikosR committed
4046
  var VERSION$7 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
4047
4048
4049
4050
4051
  var DATA_KEY$7 = 'bs.popover';
  var EVENT_KEY$7 = "." + DATA_KEY$7;
  var CLASS_PREFIX$1 = 'bs-popover';
  var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');

XhmikosR's avatar
XhmikosR committed
4052
  var Default$5 = _extends({}, Tooltip.Default, {
XhmikosR's avatar
Dist    
XhmikosR committed
4053
4054
4055
    placement: 'right',
    trigger: 'click',
    content: '',
XhmikosR's avatar
XhmikosR committed
4056
    template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
XhmikosR's avatar
Dist    
XhmikosR committed
4057
4058
  });

XhmikosR's avatar
XhmikosR committed
4059
  var DefaultType$5 = _extends({}, Tooltip.DefaultType, {
XhmikosR's avatar
Dist    
XhmikosR committed
4060
4061
4062
    content: '(string|element|function)'
  });

XhmikosR's avatar
XhmikosR committed
4063
  var Event$2 = {
XhmikosR's avatar
Dist    
XhmikosR committed
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
    HIDE: "hide" + EVENT_KEY$7,
    HIDDEN: "hidden" + EVENT_KEY$7,
    SHOW: "show" + EVENT_KEY$7,
    SHOWN: "shown" + EVENT_KEY$7,
    INSERTED: "inserted" + EVENT_KEY$7,
    CLICK: "click" + EVENT_KEY$7,
    FOCUSIN: "focusin" + EVENT_KEY$7,
    FOCUSOUT: "focusout" + EVENT_KEY$7,
    MOUSEENTER: "mouseenter" + EVENT_KEY$7,
    MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  };
XhmikosR's avatar
XhmikosR committed
4075
4076
4077
4078
  var CLASS_NAME_FADE$2 = 'fade';
  var CLASS_NAME_SHOW$4 = 'show';
  var SELECTOR_TITLE = '.popover-header';
  var SELECTOR_CONTENT = '.popover-body';
XhmikosR's avatar
XhmikosR committed
4079
4080
4081
4082
4083
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
4084

XhmikosR's avatar
XhmikosR committed
4085
  var Popover = /*#__PURE__*/function (_Tooltip) {
XhmikosR's avatar
Dist    
XhmikosR committed
4086
    _inheritsLoose(Popover, _Tooltip);
Jacob Thornton's avatar
Jacob Thornton committed
4087

XhmikosR's avatar
Dist    
XhmikosR committed
4088
4089
4090
    function Popover() {
      return _Tooltip.apply(this, arguments) || this;
    }
Mark Otto's avatar
grunt    
Mark Otto committed
4091

XhmikosR's avatar
Dist    
XhmikosR committed
4092
    var _proto = Popover.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
4093

XhmikosR's avatar
Dist    
XhmikosR committed
4094
4095
4096
4097
    // Overrides
    _proto.isWithContent = function isWithContent() {
      return this.getTitle() || this._getContent();
    };
Mark Otto's avatar
Mark Otto committed
4098

XhmikosR's avatar
Dist    
XhmikosR committed
4099
    _proto.setContent = function setContent() {
XhmikosR's avatar
XhmikosR committed
4100
      var tip = this.getTipElement(); // we use append for html objects to maintain js events
Jacob Thornton's avatar
Jacob Thornton committed
4101

XhmikosR's avatar
XhmikosR committed
4102
      this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
Jacob Thornton's avatar
Jacob Thornton committed
4103

XhmikosR's avatar
Dist    
XhmikosR committed
4104
      var content = this._getContent();
Mark Otto's avatar
dist    
Mark Otto committed
4105

XhmikosR's avatar
Dist    
XhmikosR committed
4106
4107
4108
      if (typeof content === 'function') {
        content = content.call(this.element);
      }
Jacob Thornton's avatar
Jacob Thornton committed
4109

XhmikosR's avatar
XhmikosR committed
4110
      this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
XhmikosR's avatar
XhmikosR committed
4111
      tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$4);
XhmikosR's avatar
XhmikosR committed
4112
4113
    } // Private
    ;
XhmikosR's avatar
XhmikosR committed
4114
4115
4116

    _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
      this.getTipElement().classList.add(CLASS_PREFIX$1 + "-" + attachment);
XhmikosR's avatar
XhmikosR committed
4117
    };
Mark Otto's avatar
dist    
Mark Otto committed
4118

XhmikosR's avatar
Dist    
XhmikosR committed
4119
    _proto._getContent = function _getContent() {
XhmikosR's avatar
XhmikosR committed
4120
      return this.element.getAttribute('data-bs-content') || this.config.content;
XhmikosR's avatar
Dist    
XhmikosR committed
4121
    };
Jacob Thornton's avatar
Jacob Thornton committed
4122

XhmikosR's avatar
Dist    
XhmikosR committed
4123
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
4124
4125
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
Jacob Thornton's avatar
Jacob Thornton committed
4126

XhmikosR's avatar
Dist    
XhmikosR committed
4127
      if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
4128
4129
4130
4131
4132
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4133
      }
Mark Otto's avatar
Mark Otto committed
4134
4135
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4136

XhmikosR's avatar
XhmikosR committed
4137
    Popover.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4138
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4139
        var data = Data.getData(this, DATA_KEY$7);
Mark Otto's avatar
dist    
Mark Otto committed
4140

XhmikosR's avatar
Dist    
XhmikosR committed
4141
        var _config = typeof config === 'object' ? config : null;
Mark Otto's avatar
dist    
Mark Otto committed
4142

XhmikosR's avatar
Dist    
XhmikosR committed
4143
4144
4145
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
build    
Mark Otto committed
4146

XhmikosR's avatar
Dist    
XhmikosR committed
4147
4148
        if (!data) {
          data = new Popover(this, _config);
XhmikosR's avatar
XhmikosR committed
4149
          Data.setData(this, DATA_KEY$7, data);
XhmikosR's avatar
Dist    
XhmikosR committed
4150
        }
Mark Otto's avatar
dist    
Mark Otto committed
4151

XhmikosR's avatar
Dist    
XhmikosR committed
4152
4153
4154
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
4155
          }
Jacob Thornton's avatar
Jacob Thornton committed
4156

XhmikosR's avatar
Dist    
XhmikosR committed
4157
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
4158
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4159
4160
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
4161

XhmikosR's avatar
XhmikosR committed
4162
    Popover.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4163
4164
4165
      return Data.getData(element, DATA_KEY$7);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
    _createClass(Popover, null, [{
      key: "VERSION",
      // Getters
      get: function get() {
        return VERSION$7;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$5;
      }
    }, {
      key: "NAME",
      get: function get() {
        return NAME$7;
      }
    }, {
      key: "DATA_KEY",
      get: function get() {
        return DATA_KEY$7;
      }
    }, {
      key: "Event",
      get: function get() {
XhmikosR's avatar
XhmikosR committed
4190
        return Event$2;
XhmikosR's avatar
Dist    
XhmikosR committed
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
      }
    }, {
      key: "EVENT_KEY",
      get: function get() {
        return EVENT_KEY$7;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$5;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
4203

XhmikosR's avatar
Dist    
XhmikosR committed
4204
4205
4206
4207
4208
4209
    return Popover;
  }(Tooltip);
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
4210
   * add .Popover to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
4211
   */
Mark Otto's avatar
dist    
Mark Otto committed
4212

4213

XhmikosR's avatar
XhmikosR committed
4214
4215
4216
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
Jacob Thornton's avatar
Jacob Thornton committed
4217

XhmikosR's avatar
XhmikosR committed
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$7];
      $.fn[NAME$7] = Popover.jQueryInterface;
      $.fn[NAME$7].Constructor = Popover;

      $.fn[NAME$7].noConflict = function () {
        $.fn[NAME$7] = JQUERY_NO_CONFLICT;
        return Popover.jQueryInterface;
      };
    }
  });
Jacob Thornton's avatar
Jacob Thornton committed
4229

XhmikosR's avatar
Dist    
XhmikosR committed
4230
4231
4232
4233
4234
4235
4236
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$8 = 'scrollspy';
XhmikosR's avatar
XhmikosR committed
4237
  var VERSION$8 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
  var DATA_KEY$8 = 'bs.scrollspy';
  var EVENT_KEY$8 = "." + DATA_KEY$8;
  var DATA_API_KEY$6 = '.data-api';
  var Default$6 = {
    offset: 10,
    method: 'auto',
    target: ''
  };
  var DefaultType$6 = {
    offset: 'number',
    method: 'string',
    target: '(string|element)'
  };
XhmikosR's avatar
XhmikosR committed
4251
4252
4253
4254
4255
  var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
  var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
  var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
  var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  var CLASS_NAME_ACTIVE$2 = 'active';
XhmikosR's avatar
XhmikosR committed
4256
  var SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
XhmikosR's avatar
XhmikosR committed
4257
4258
4259
4260
4261
4262
4263
4264
  var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  var SELECTOR_NAV_LINKS = '.nav-link';
  var SELECTOR_NAV_ITEMS = '.nav-item';
  var SELECTOR_LIST_ITEMS = '.list-group-item';
  var SELECTOR_DROPDOWN = '.dropdown';
  var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  var METHOD_OFFSET = 'offset';
  var METHOD_POSITION = 'position';
XhmikosR's avatar
XhmikosR committed
4265
4266
4267
4268
4269
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
4270

XhmikosR's avatar
XhmikosR committed
4271
  var ScrollSpy = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
4272
4273
4274
4275
4276
4277
    function ScrollSpy(element, config) {
      var _this = this;

      this._element = element;
      this._scrollElement = element.tagName === 'BODY' ? window : element;
      this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
4278
      this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + ", " + this._config.target + " " + SELECTOR_LIST_ITEMS + ", " + this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM;
XhmikosR's avatar
Dist    
XhmikosR committed
4279
4280
4281
4282
      this._offsets = [];
      this._targets = [];
      this._activeTarget = null;
      this._scrollHeight = 0;
XhmikosR's avatar
XhmikosR committed
4283
      EventHandler.on(this._scrollElement, EVENT_SCROLL, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
4284
4285
4286
4287
4288
        return _this._process(event);
      });
      this.refresh();

      this._process();
XhmikosR's avatar
XhmikosR committed
4289
4290

      Data.setData(element, DATA_KEY$8, this);
XhmikosR's avatar
Dist    
XhmikosR committed
4291
4292
4293
4294
4295
4296
4297
4298
4299
    } // Getters


    var _proto = ScrollSpy.prototype;

    // Public
    _proto.refresh = function refresh() {
      var _this2 = this;

XhmikosR's avatar
XhmikosR committed
4300
      var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
XhmikosR's avatar
Dist    
XhmikosR committed
4301
      var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
XhmikosR's avatar
XhmikosR committed
4302
      var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
XhmikosR's avatar
Dist    
XhmikosR committed
4303
4304
4305
      this._offsets = [];
      this._targets = [];
      this._scrollHeight = this._getScrollHeight();
XhmikosR's avatar
XhmikosR committed
4306
      var targets = SelectorEngine.find(this._selector);
XhmikosR's avatar
Dist    
XhmikosR committed
4307
      targets.map(function (element) {
XhmikosR's avatar
XhmikosR committed
4308
        var targetSelector = getSelectorFromElement(element);
XhmikosR's avatar
XhmikosR committed
4309
        var target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
XhmikosR's avatar
Dist    
XhmikosR committed
4310
4311
4312
4313
4314

        if (target) {
          var targetBCR = target.getBoundingClientRect();

          if (targetBCR.width || targetBCR.height) {
XhmikosR's avatar
XhmikosR committed
4315
            return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
XhmikosR's avatar
Dist    
XhmikosR committed
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
          }
        }

        return null;
      }).filter(function (item) {
        return item;
      }).sort(function (a, b) {
        return a[0] - b[0];
      }).forEach(function (item) {
        _this2._offsets.push(item[0]);

        _this2._targets.push(item[1]);
      });
Mark Otto's avatar
dist    
Mark Otto committed
4329
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4330
4331

    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
4332
4333
      Data.removeData(this._element, DATA_KEY$8);
      EventHandler.off(this._scrollElement, EVENT_KEY$8);
XhmikosR's avatar
Dist    
XhmikosR committed
4334
4335
4336
4337
4338
4339
4340
4341
      this._element = null;
      this._scrollElement = null;
      this._config = null;
      this._selector = null;
      this._offsets = null;
      this._targets = null;
      this._activeTarget = null;
      this._scrollHeight = null;
Mark Otto's avatar
Mark Otto committed
4342
4343
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
4344
4345

    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
4346
      config = _extends({}, Default$6, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist    
XhmikosR committed
4347

XhmikosR's avatar
XhmikosR committed
4348
      if (typeof config.target !== 'string' && isElement(config.target)) {
XhmikosR's avatar
XhmikosR committed
4349
        var id = config.target.id;
XhmikosR's avatar
Dist    
XhmikosR committed
4350
4351

        if (!id) {
XhmikosR's avatar
XhmikosR committed
4352
4353
          id = getUID(NAME$8);
          config.target.id = id;
XhmikosR's avatar
Dist    
XhmikosR committed
4354
4355
4356
4357
4358
        }

        config.target = "#" + id;
      }

XhmikosR's avatar
XhmikosR committed
4359
      typeCheckConfig(NAME$8, config, DefaultType$6);
XhmikosR's avatar
Dist    
XhmikosR committed
4360
      return config;
Mark Otto's avatar
dist    
Mark Otto committed
4361
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4362
4363
4364

    _proto._getScrollTop = function _getScrollTop() {
      return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
Mark Otto's avatar
dist    
Mark Otto committed
4365
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4366
4367
4368

    _proto._getScrollHeight = function _getScrollHeight() {
      return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
Mark Otto's avatar
dist    
Mark Otto committed
4369
    };
Mark Otto's avatar
grunt    
Mark Otto committed
4370

XhmikosR's avatar
Dist    
XhmikosR committed
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
    _proto._getOffsetHeight = function _getOffsetHeight() {
      return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
    };

    _proto._process = function _process() {
      var scrollTop = this._getScrollTop() + this._config.offset;

      var scrollHeight = this._getScrollHeight();

      var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();

      if (this._scrollHeight !== scrollHeight) {
        this.refresh();
      }

      if (scrollTop >= maxScroll) {
        var target = this._targets[this._targets.length - 1];

        if (this._activeTarget !== target) {
          this._activate(target);
        }

        return;
      }

      if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
        this._activeTarget = null;

        this._clear();

        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4403

XhmikosR's avatar
XhmikosR committed
4404
      for (var i = this._offsets.length; i--;) {
XhmikosR's avatar
Dist    
XhmikosR committed
4405
        var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
Mark Otto's avatar
dist    
Mark Otto committed
4406

XhmikosR's avatar
Dist    
XhmikosR committed
4407
4408
4409
4410
4411
        if (isActiveTarget) {
          this._activate(this._targets[i]);
        }
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
4412

XhmikosR's avatar
Dist    
XhmikosR committed
4413
4414
    _proto._activate = function _activate(target) {
      this._activeTarget = target;
Jacob Thornton's avatar
Jacob Thornton committed
4415

XhmikosR's avatar
Dist    
XhmikosR committed
4416
      this._clear();
Jacob Thornton's avatar
Jacob Thornton committed
4417

XhmikosR's avatar
Dist    
XhmikosR committed
4418
      var queries = this._selector.split(',').map(function (selector) {
XhmikosR's avatar
XhmikosR committed
4419
        return selector + "[data-bs-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
XhmikosR's avatar
Dist    
XhmikosR committed
4420
      });
XhmikosR's avatar
Dist    
XhmikosR committed
4421

XhmikosR's avatar
XhmikosR committed
4422
      var link = SelectorEngine.findOne(queries.join(','));
Mark Otto's avatar
dist    
Mark Otto committed
4423

XhmikosR's avatar
XhmikosR committed
4424
      if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
XhmikosR's avatar
XhmikosR committed
4425
        SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4426
        link.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
Dist    
XhmikosR committed
4427
4428
      } else {
        // Set triggered link as active
XhmikosR's avatar
XhmikosR committed
4429
4430
        link.classList.add(CLASS_NAME_ACTIVE$2);
        SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP).forEach(function (listGroup) {
XhmikosR's avatar
XhmikosR committed
4431
4432
          // Set triggered links parents as active
          // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
XhmikosR's avatar
XhmikosR committed
4433
4434
          SelectorEngine.prev(listGroup, SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).forEach(function (item) {
            return item.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4435
4436
          }); // Handle special case when .nav-link is inside .nav-item

XhmikosR's avatar
XhmikosR committed
4437
4438
4439
          SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(function (navItem) {
            SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(function (item) {
              return item.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4440
4441
4442
            });
          });
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4443
      }
Mark Otto's avatar
dist    
Mark Otto committed
4444

XhmikosR's avatar
XhmikosR committed
4445
      EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
XhmikosR's avatar
Dist    
XhmikosR committed
4446
4447
4448
        relatedTarget: target
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
4449

XhmikosR's avatar
Dist    
XhmikosR committed
4450
    _proto._clear = function _clear() {
XhmikosR's avatar
XhmikosR committed
4451
4452
      SelectorEngine.find(this._selector).filter(function (node) {
        return node.classList.contains(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
Dist    
XhmikosR committed
4453
      }).forEach(function (node) {
XhmikosR's avatar
XhmikosR committed
4454
        return node.classList.remove(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
Dist    
XhmikosR committed
4455
      });
Mark Otto's avatar
Mark Otto committed
4456
4457
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
4458

XhmikosR's avatar
XhmikosR committed
4459
    ScrollSpy.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4460
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4461
        var data = Data.getData(this, DATA_KEY$8);
Jacob Thornton's avatar
Jacob Thornton committed
4462

XhmikosR's avatar
Dist    
XhmikosR committed
4463
        var _config = typeof config === 'object' && config;
Mark Otto's avatar
dist    
Mark Otto committed
4464

XhmikosR's avatar
Dist    
XhmikosR committed
4465
4466
        if (!data) {
          data = new ScrollSpy(this, _config);
Mark Otto's avatar
dist    
Mark Otto committed
4467
        }
Mark Otto's avatar
dist    
Mark Otto committed
4468

XhmikosR's avatar
Dist    
XhmikosR committed
4469
4470
4471
4472
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
          }
Mark Otto's avatar
grunt    
Mark Otto committed
4473

XhmikosR's avatar
Dist    
XhmikosR committed
4474
4475
4476
4477
          data[config]();
        }
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
4478

XhmikosR's avatar
XhmikosR committed
4479
    ScrollSpy.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4480
4481
4482
      return Data.getData(element, DATA_KEY$8);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
    _createClass(ScrollSpy, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$8;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$6;
      }
    }]);
Mark Otto's avatar
grunt    
Mark Otto committed
4494

XhmikosR's avatar
Dist    
XhmikosR committed
4495
4496
4497
4498
4499
4500
4501
    return ScrollSpy;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
4502
4503


XhmikosR's avatar
XhmikosR committed
4504
4505
  EventHandler.on(window, EVENT_LOAD_DATA_API$1, function () {
    SelectorEngine.find(SELECTOR_DATA_SPY).forEach(function (spy) {
XhmikosR's avatar
XhmikosR committed
4506
4507
      return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
    });
XhmikosR's avatar
Dist    
XhmikosR committed
4508
4509
4510
4511
4512
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
4513
   * add .ScrollSpy to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
4514
   */
Jacob Thornton's avatar
Jacob Thornton committed
4515

XhmikosR's avatar
XhmikosR committed
4516
4517
4518
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
4519

XhmikosR's avatar
XhmikosR committed
4520
4521
4522
4523
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$8];
      $.fn[NAME$8] = ScrollSpy.jQueryInterface;
      $.fn[NAME$8].Constructor = ScrollSpy;
Jacob Thornton's avatar
Jacob Thornton committed
4524

XhmikosR's avatar
XhmikosR committed
4525
4526
4527
4528
4529
4530
      $.fn[NAME$8].noConflict = function () {
        $.fn[NAME$8] = JQUERY_NO_CONFLICT;
        return ScrollSpy.jQueryInterface;
      };
    }
  });
Jacob Thornton's avatar
Jacob Thornton committed
4531

XhmikosR's avatar
Dist    
XhmikosR committed
4532
4533
4534
4535
4536
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
4537

XhmikosR's avatar
Dist    
XhmikosR committed
4538
  var NAME$9 = 'tab';
XhmikosR's avatar
XhmikosR committed
4539
  var VERSION$9 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
4540
4541
4542
  var DATA_KEY$9 = 'bs.tab';
  var EVENT_KEY$9 = "." + DATA_KEY$9;
  var DATA_API_KEY$7 = '.data-api';
XhmikosR's avatar
XhmikosR committed
4543
4544
4545
4546
4547
4548
4549
  var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
  var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
  var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
  var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
  var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
  var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
  var CLASS_NAME_ACTIVE$3 = 'active';
XhmikosR's avatar
XhmikosR committed
4550
  var CLASS_NAME_DISABLED$1 = 'disabled';
XhmikosR's avatar
XhmikosR committed
4551
4552
4553
4554
  var CLASS_NAME_FADE$3 = 'fade';
  var CLASS_NAME_SHOW$5 = 'show';
  var SELECTOR_DROPDOWN$1 = '.dropdown';
  var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
XhmikosR's avatar
XhmikosR committed
4555
  var SELECTOR_ACTIVE$1 = '.active';
XhmikosR's avatar
XhmikosR committed
4556
  var SELECTOR_ACTIVE_UL = ':scope > li > .active';
XhmikosR's avatar
XhmikosR committed
4557
  var SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
XhmikosR's avatar
XhmikosR committed
4558
4559
  var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  var SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
XhmikosR's avatar
XhmikosR committed
4560
4561
4562
4563
4564
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
4565

XhmikosR's avatar
XhmikosR committed
4566
  var Tab = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
4567
4568
    function Tab(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
4569
      Data.setData(this._element, DATA_KEY$9, this);
XhmikosR's avatar
Dist    
XhmikosR committed
4570
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
4571

Mark Otto's avatar
dist    
Mark Otto committed
4572

XhmikosR's avatar
Dist    
XhmikosR committed
4573
    var _proto = Tab.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
4574

XhmikosR's avatar
Dist    
XhmikosR committed
4575
4576
4577
    // Public
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
4578

XhmikosR's avatar
XhmikosR committed
4579
      if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE$3) || this._element.classList.contains(CLASS_NAME_DISABLED$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4580
4581
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
4582

XhmikosR's avatar
Dist    
XhmikosR committed
4583
      var previous;
XhmikosR's avatar
XhmikosR committed
4584
      var target = getElementFromSelector(this._element);
XhmikosR's avatar
XhmikosR committed
4585
4586

      var listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP$1);
XhmikosR's avatar
Dist    
XhmikosR committed
4587
4588

      if (listElement) {
XhmikosR's avatar
XhmikosR committed
4589
        var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$1;
XhmikosR's avatar
XhmikosR committed
4590
        previous = SelectorEngine.find(itemSelector, listElement);
XhmikosR's avatar
Dist    
XhmikosR committed
4591
4592
        previous = previous[previous.length - 1];
      }
Mark Otto's avatar
grunt    
Mark Otto committed
4593

XhmikosR's avatar
XhmikosR committed
4594
      var hideEvent = null;
Mark Otto's avatar
dist    
Mark Otto committed
4595

XhmikosR's avatar
Dist    
XhmikosR committed
4596
      if (previous) {
XhmikosR's avatar
XhmikosR committed
4597
        hideEvent = EventHandler.trigger(previous, EVENT_HIDE$3, {
XhmikosR's avatar
XhmikosR committed
4598
4599
          relatedTarget: this._element
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4600
      }
Mark Otto's avatar
dist    
Mark Otto committed
4601

XhmikosR's avatar
XhmikosR committed
4602
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
XhmikosR's avatar
XhmikosR committed
4603
4604
        relatedTarget: previous
      });
Jacob Thornton's avatar
Jacob Thornton committed
4605

XhmikosR's avatar
XhmikosR committed
4606
      if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
4607
4608
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4609

XhmikosR's avatar
Dist    
XhmikosR committed
4610
      this._activate(this._element, listElement);
Johann-S's avatar
build    
Johann-S committed
4611

XhmikosR's avatar
Dist    
XhmikosR committed
4612
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4613
        EventHandler.trigger(previous, EVENT_HIDDEN$3, {
XhmikosR's avatar
Dist    
XhmikosR committed
4614
          relatedTarget: _this._element
Mark Otto's avatar
dist    
Mark Otto committed
4615
        });
XhmikosR's avatar
XhmikosR committed
4616
        EventHandler.trigger(_this._element, EVENT_SHOWN$3, {
XhmikosR's avatar
Dist    
XhmikosR committed
4617
4618
          relatedTarget: previous
        });
Mark Otto's avatar
dist    
Mark Otto committed
4619
      };
Johann-S's avatar
build    
Johann-S committed
4620

XhmikosR's avatar
Dist    
XhmikosR committed
4621
4622
4623
4624
4625
4626
      if (target) {
        this._activate(target, target.parentNode, complete);
      } else {
        complete();
      }
    };
Johann-S's avatar
build    
Johann-S committed
4627

XhmikosR's avatar
Dist    
XhmikosR committed
4628
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
4629
      Data.removeData(this._element, DATA_KEY$9);
XhmikosR's avatar
Dist    
XhmikosR committed
4630
      this._element = null;
Mark Otto's avatar
Mark Otto committed
4631
4632
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4633

XhmikosR's avatar
Dist    
XhmikosR committed
4634
4635
    _proto._activate = function _activate(element, container, callback) {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
4636

XhmikosR's avatar
XhmikosR committed
4637
      var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
4638
      var active = activeElements[0];
XhmikosR's avatar
XhmikosR committed
4639
      var isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$3);
XhmikosR's avatar
Dist    
XhmikosR committed
4640
4641
4642

      var complete = function complete() {
        return _this2._transitionComplete(element, active, callback);
Mark Otto's avatar
dist    
Mark Otto committed
4643
      };
Mark Otto's avatar
dist    
Mark Otto committed
4644

XhmikosR's avatar
Dist    
XhmikosR committed
4645
      if (active && isTransitioning) {
XhmikosR's avatar
XhmikosR committed
4646
        var transitionDuration = getTransitionDurationFromElement(active);
XhmikosR's avatar
XhmikosR committed
4647
        active.classList.remove(CLASS_NAME_SHOW$5);
XhmikosR's avatar
XhmikosR committed
4648
4649
        EventHandler.one(active, TRANSITION_END, complete);
        emulateTransitionEnd(active, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
4650
4651
4652
4653
4654
4655
4656
      } else {
        complete();
      }
    };

    _proto._transitionComplete = function _transitionComplete(element, active, callback) {
      if (active) {
XhmikosR's avatar
XhmikosR committed
4657
4658
        active.classList.remove(CLASS_NAME_ACTIVE$3);
        var dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
XhmikosR's avatar
Dist    
XhmikosR committed
4659
4660

        if (dropdownChild) {
XhmikosR's avatar
XhmikosR committed
4661
          dropdownChild.classList.remove(CLASS_NAME_ACTIVE$3);
Mark Otto's avatar
grunt    
Mark Otto committed
4662
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4663
4664
4665

        if (active.getAttribute('role') === 'tab') {
          active.setAttribute('aria-selected', false);
Mark Otto's avatar
dist    
Mark Otto committed
4666
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4667
      }
Mark Otto's avatar
dist    
Mark Otto committed
4668

XhmikosR's avatar
XhmikosR committed
4669
      element.classList.add(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
Dist    
XhmikosR committed
4670
4671
4672
4673

      if (element.getAttribute('role') === 'tab') {
        element.setAttribute('aria-selected', true);
      }
Mark Otto's avatar
dist    
Mark Otto committed
4674

XhmikosR's avatar
XhmikosR committed
4675
      reflow(element);
Mark Otto's avatar
Mark Otto committed
4676

XhmikosR's avatar
XhmikosR committed
4677
4678
      if (element.classList.contains(CLASS_NAME_FADE$3)) {
        element.classList.add(CLASS_NAME_SHOW$5);
Mark Otto's avatar
Mark Otto committed
4679
      }
Mark Otto's avatar
dist    
Mark Otto committed
4680

XhmikosR's avatar
XhmikosR committed
4681
      if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
XhmikosR's avatar
XhmikosR committed
4682
        var dropdownElement = element.closest(SELECTOR_DROPDOWN$1);
Mark Otto's avatar
dist    
Mark Otto committed
4683

XhmikosR's avatar
Dist    
XhmikosR committed
4684
        if (dropdownElement) {
XhmikosR's avatar
XhmikosR committed
4685
4686
          SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE$1).forEach(function (dropdown) {
            return dropdown.classList.add(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
XhmikosR committed
4687
          });
XhmikosR's avatar
Dist    
XhmikosR committed
4688
        }
Jacob Thornton's avatar
Jacob Thornton committed
4689

XhmikosR's avatar
Dist    
XhmikosR committed
4690
        element.setAttribute('aria-expanded', true);
Mark Otto's avatar
dist    
Mark Otto committed
4691
      }
Mark Otto's avatar
dist    
Mark Otto committed
4692

XhmikosR's avatar
Dist    
XhmikosR committed
4693
4694
4695
      if (callback) {
        callback();
      }
Mark Otto's avatar
Mark Otto committed
4696
4697
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
4698

XhmikosR's avatar
XhmikosR committed
4699
    Tab.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4700
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4701
        var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
XhmikosR's avatar
Dist    
XhmikosR committed
4702
4703
4704
4705
4706
4707
4708
4709
4710

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

          data[config]();
        }
      });
Mark Otto's avatar
dist    
Mark Otto committed
4711
    };
Jacob Thornton's avatar
Jacob Thornton committed
4712

XhmikosR's avatar
XhmikosR committed
4713
    Tab.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4714
4715
4716
      return Data.getData(element, DATA_KEY$9);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
    _createClass(Tab, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$9;
      }
    }]);

    return Tab;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
4733
  EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
4734
    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
4735
4736
    var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
    data.show();
XhmikosR's avatar
Dist    
XhmikosR committed
4737
4738
4739
4740
4741
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
4742
   * add .Tab to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
4743
4744
   */

XhmikosR's avatar
XhmikosR committed
4745
4746
4747
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
4748

XhmikosR's avatar
XhmikosR committed
4749
4750
4751
4752
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$9];
      $.fn[NAME$9] = Tab.jQueryInterface;
      $.fn[NAME$9].Constructor = Tab;
XhmikosR's avatar
Dist    
XhmikosR committed
4753

XhmikosR's avatar
XhmikosR committed
4754
4755
4756
4757
4758
4759
      $.fn[NAME$9].noConflict = function () {
        $.fn[NAME$9] = JQUERY_NO_CONFLICT;
        return Tab.jQueryInterface;
      };
    }
  });
Jacob Thornton's avatar
Jacob Thornton committed
4760
4761

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
4762
4763
4764
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
4765
   */
Mark Otto's avatar
dist    
Mark Otto committed
4766

XhmikosR's avatar
Dist    
XhmikosR committed
4767
  var NAME$a = 'toast';
XhmikosR's avatar
XhmikosR committed
4768
  var VERSION$a = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
4769
4770
  var DATA_KEY$a = 'bs.toast';
  var EVENT_KEY$a = "." + DATA_KEY$a;
XhmikosR's avatar
XhmikosR committed
4771
4772
4773
4774
4775
4776
4777
4778
4779
  var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
  var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
  var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
  var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
  var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
  var CLASS_NAME_FADE$4 = 'fade';
  var CLASS_NAME_HIDE = 'hide';
  var CLASS_NAME_SHOW$6 = 'show';
  var CLASS_NAME_SHOWING = 'showing';
XhmikosR's avatar
Dist    
XhmikosR committed
4780
4781
4782
4783
4784
4785
4786
4787
  var DefaultType$7 = {
    animation: 'boolean',
    autohide: 'boolean',
    delay: 'number'
  };
  var Default$7 = {
    animation: true,
    autohide: true,
XhmikosR's avatar
XhmikosR committed
4788
    delay: 5000
XhmikosR's avatar
Dist    
XhmikosR committed
4789
  };
XhmikosR's avatar
XhmikosR committed
4790
  var SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="toast"]';
XhmikosR's avatar
XhmikosR committed
4791
4792
4793
4794
4795
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
4796

XhmikosR's avatar
XhmikosR committed
4797
  var Toast = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
4798
4799
4800
4801
    function Toast(element, config) {
      this._element = element;
      this._config = this._getConfig(config);
      this._timeout = null;
Jacob Thornton's avatar
Jacob Thornton committed
4802

XhmikosR's avatar
Dist    
XhmikosR committed
4803
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
4804
4805

      Data.setData(element, DATA_KEY$a, this);
XhmikosR's avatar
Dist    
XhmikosR committed
4806
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
4807

Johann-S's avatar
build    
Johann-S committed
4808

XhmikosR's avatar
Dist    
XhmikosR committed
4809
    var _proto = Toast.prototype;
XhmikosR's avatar
Dist    
XhmikosR committed
4810

XhmikosR's avatar
Dist    
XhmikosR committed
4811
4812
4813
    // Public
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
4814

XhmikosR's avatar
XhmikosR committed
4815
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4);
Mark Otto's avatar
dist v5    
Mark Otto committed
4816
4817
4818
4819

      if (showEvent.defaultPrevented) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4820

XhmikosR's avatar
XhmikosR committed
4821
4822
      this._clearTimeout();

XhmikosR's avatar
Dist    
XhmikosR committed
4823
      if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
4824
        this._element.classList.add(CLASS_NAME_FADE$4);
XhmikosR's avatar
Dist    
XhmikosR committed
4825
      }
Mark Otto's avatar
dist    
Mark Otto committed
4826

XhmikosR's avatar
Dist    
XhmikosR committed
4827
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4828
        _this._element.classList.remove(CLASS_NAME_SHOWING);
Mark Otto's avatar
dist    
Mark Otto committed
4829

XhmikosR's avatar
XhmikosR committed
4830
        _this._element.classList.add(CLASS_NAME_SHOW$6);
Mark Otto's avatar
dist    
Mark Otto committed
4831

XhmikosR's avatar
XhmikosR committed
4832
        EventHandler.trigger(_this._element, EVENT_SHOWN$4);
Mark Otto's avatar
dist    
Mark Otto committed
4833

XhmikosR's avatar
Dist    
XhmikosR committed
4834
        if (_this._config.autohide) {
XhmikosR's avatar
XhmikosR committed
4835
4836
4837
          _this._timeout = setTimeout(function () {
            _this.hide();
          }, _this._config.delay);
Mark Otto's avatar
dist    
Mark Otto committed
4838
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4839
      };
Mark Otto's avatar
dist    
Mark Otto committed
4840

XhmikosR's avatar
XhmikosR committed
4841
      this._element.classList.remove(CLASS_NAME_HIDE);
Mark Otto's avatar
dist    
Mark Otto committed
4842

4843
4844
      reflow(this._element);

XhmikosR's avatar
XhmikosR committed
4845
      this._element.classList.add(CLASS_NAME_SHOWING);
Mark Otto's avatar
dist    
Mark Otto committed
4846

XhmikosR's avatar
Dist    
XhmikosR committed
4847
      if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
4848
4849
4850
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, complete);
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
4851
4852
4853
4854
      } else {
        complete();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
4855

XhmikosR's avatar
XhmikosR committed
4856
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
4857
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
4858

XhmikosR's avatar
XhmikosR committed
4859
      if (!this._element.classList.contains(CLASS_NAME_SHOW$6)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4860
4861
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4862

XhmikosR's avatar
XhmikosR committed
4863
      var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
Mark Otto's avatar
dist v5    
Mark Otto committed
4864
4865
4866
4867

      if (hideEvent.defaultPrevented) {
        return;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
4868

XhmikosR's avatar
XhmikosR committed
4869
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4870
        _this2._element.classList.add(CLASS_NAME_HIDE);
XhmikosR's avatar
XhmikosR committed
4871

XhmikosR's avatar
XhmikosR committed
4872
        EventHandler.trigger(_this2._element, EVENT_HIDDEN$4);
XhmikosR's avatar
XhmikosR committed
4873
4874
      };

XhmikosR's avatar
XhmikosR committed
4875
      this._element.classList.remove(CLASS_NAME_SHOW$6);
XhmikosR's avatar
XhmikosR committed
4876
4877
4878
4879
4880

      if (this._config.animation) {
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, complete);
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
4881
      } else {
XhmikosR's avatar
XhmikosR committed
4882
        complete();
XhmikosR's avatar
Dist    
XhmikosR committed
4883
4884
      }
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4885

XhmikosR's avatar
Dist    
XhmikosR committed
4886
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
4887
      this._clearTimeout();
Mark Otto's avatar
dist    
Mark Otto committed
4888

XhmikosR's avatar
XhmikosR committed
4889
4890
      if (this._element.classList.contains(CLASS_NAME_SHOW$6)) {
        this._element.classList.remove(CLASS_NAME_SHOW$6);
XhmikosR's avatar
Dist    
XhmikosR committed
4891
      }
Jacob Thornton's avatar
Jacob Thornton committed
4892

XhmikosR's avatar
XhmikosR committed
4893
      EventHandler.off(this._element, EVENT_CLICK_DISMISS$1);
XhmikosR's avatar
XhmikosR committed
4894
      Data.removeData(this._element, DATA_KEY$a);
XhmikosR's avatar
Dist    
XhmikosR committed
4895
4896
      this._element = null;
      this._config = null;
Mark Otto's avatar
Mark Otto committed
4897
4898
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4899

XhmikosR's avatar
Dist    
XhmikosR committed
4900
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
4901
      config = _extends({}, Default$7, Manipulator.getDataAttributes(this._element), typeof config === 'object' && config ? config : {});
XhmikosR's avatar
XhmikosR committed
4902
      typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
4903
4904
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4905

XhmikosR's avatar
Dist    
XhmikosR committed
4906
4907
    _proto._setListeners = function _setListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
4908

XhmikosR's avatar
XhmikosR committed
4909
      EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
XhmikosR's avatar
XhmikosR committed
4910
        return _this3.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
4911
      });
XhmikosR's avatar
XhmikosR committed
4912
4913
4914
4915
4916
    };

    _proto._clearTimeout = function _clearTimeout() {
      clearTimeout(this._timeout);
      this._timeout = null;
Mark Otto's avatar
Mark Otto committed
4917
4918
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
4919

XhmikosR's avatar
XhmikosR committed
4920
    Toast.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4921
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4922
        var data = Data.getData(this, DATA_KEY$a);
Jacob Thornton's avatar
Jacob Thornton committed
4923

XhmikosR's avatar
Dist    
XhmikosR committed
4924
4925
4926
4927
4928
        var _config = typeof config === 'object' && config;

        if (!data) {
          data = new Toast(this, _config);
        }
Jacob Thornton's avatar
Jacob Thornton committed
4929

XhmikosR's avatar
Dist    
XhmikosR committed
4930
4931
4932
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
grunt    
Mark Otto committed
4933
          }
Mark Otto's avatar
dist    
Mark Otto committed
4934

XhmikosR's avatar
Dist    
XhmikosR committed
4935
          data[config](this);
XhmikosR's avatar
Dist    
XhmikosR committed
4936
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4937
4938
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
4939

XhmikosR's avatar
XhmikosR committed
4940
    Toast.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4941
4942
4943
      return Data.getData(element, DATA_KEY$a);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
    _createClass(Toast, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$a;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$7;
      }
Mark Otto's avatar
Mark Otto committed
4954
4955
4956
4957
4958
    }, {
      key: "Default",
      get: function get() {
        return Default$7;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
4959
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
4960

XhmikosR's avatar
Dist    
XhmikosR committed
4961
4962
4963
4964
4965
4966
    return Toast;
  }();
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
4967
   * add .Toast to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
4968
   */
XhmikosR's avatar
Dist    
XhmikosR committed
4969

4970

XhmikosR's avatar
XhmikosR committed
4971
4972
4973
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
Mark Otto's avatar
dist    
Mark Otto committed
4974

XhmikosR's avatar
XhmikosR committed
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$a];
      $.fn[NAME$a] = Toast.jQueryInterface;
      $.fn[NAME$a].Constructor = Toast;

      $.fn[NAME$a].noConflict = function () {
        $.fn[NAME$a] = JQUERY_NO_CONFLICT;
        return Toast.jQueryInterface;
      };
    }
  });
Mark Otto's avatar
grunt    
Mark Otto committed
4986

Mark Otto's avatar
dist    
Mark Otto committed
4987
4988
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
4989
   * Bootstrap (v5.0.0-alpha3): index.umd.js
XhmikosR's avatar
XhmikosR committed
4990
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
Mark Otto's avatar
dist    
Mark Otto committed
4991
4992
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist.    
XhmikosR committed
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
  var index_umd = {
    Alert: Alert,
    Button: Button,
    Carousel: Carousel,
    Collapse: Collapse,
    Dropdown: Dropdown,
    Modal: Modal,
    Popover: Popover,
    ScrollSpy: ScrollSpy,
    Tab: Tab,
    Toast: Toast,
    Tooltip: Tooltip
  };
Mark Otto's avatar
dist    
Mark Otto committed
5006

XhmikosR's avatar
Dist.    
XhmikosR committed
5007
  return index_umd;
Mark Otto's avatar
dist    
Mark Otto committed
5008

XhmikosR's avatar
XhmikosR committed
5009
})));
Mark Otto's avatar
dist    
Mark Otto committed
5010
//# sourceMappingURL=bootstrap.js.map