bootstrap.bundle.js 241 KB
Newer Older
Mark Otto's avatar
dist  
Mark Otto committed
1
/*!
2
  * Bootstrap v5.0.0-alpha1 (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
9
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  typeof define === 'function' && define.amd ? define(factory) :
  (global = global || self, global.bootstrap = factory());
XhmikosR's avatar
XhmikosR committed
10
}(this, (function () { 'use strict';
Mark Otto's avatar
dist  
Mark Otto committed
11

Mark Otto's avatar
dist    
Mark Otto committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  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);
    }
  }

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

Mark Otto's avatar
dist    
Mark Otto committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  function _defineProperty(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }
Mark Otto's avatar
Mark Otto committed
42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      if (enumerableOnly) symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      });
      keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread2(target) {
Mark Otto's avatar
dist    
Mark Otto committed
58
    for (var i = 1; i < arguments.length; i++) {
Mark Otto's avatar
dist    
Mark Otto committed
59
      var source = arguments[i] != null ? arguments[i] : {};
Mark Otto's avatar
dist    
Mark Otto committed
60

61
      if (i % 2) {
XhmikosR's avatar
XhmikosR committed
62
        ownKeys(Object(source), true).forEach(function (key) {
63
64
65
66
67
          _defineProperty(target, key, source[key]);
        });
      } else if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
      } else {
XhmikosR's avatar
XhmikosR committed
68
        ownKeys(Object(source)).forEach(function (key) {
69
70
          Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
Mark Otto's avatar
dist    
Mark Otto committed
71
72
73
74
      }
    }

    return target;
Mark Otto's avatar
dist    
Mark Otto committed
75
  }
Mark Otto's avatar
Mark Otto committed
76

Mark Otto's avatar
dist    
Mark Otto committed
77
78
79
80
81
  function _inheritsLoose(subClass, superClass) {
    subClass.prototype = Object.create(superClass.prototype);
    subClass.prototype.constructor = subClass;
    subClass.__proto__ = superClass;
  }
Mark Otto's avatar
dist  
Mark Otto committed
82
83

  /**
Mark Otto's avatar
dist    
Mark Otto committed
84
   * --------------------------------------------------------------------------
85
   * Bootstrap (v5.0.0-alpha1): util/index.js
XhmikosR's avatar
XhmikosR committed
86
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
Mark Otto's avatar
dist    
Mark Otto committed
87
   * --------------------------------------------------------------------------
Mark Otto's avatar
dist  
Mark Otto committed
88
   */
XhmikosR's avatar
XhmikosR committed
89
90
  var MAX_UID = 1000000;
  var MILLISECONDS_MULTIPLIER = 1000;
XhmikosR's avatar
XhmikosR committed
91
  var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
XhmikosR's avatar
XhmikosR committed
92
93

  var toType = function toType(obj) {
XhmikosR's avatar
XhmikosR committed
94
95
96
97
    if (obj === null || obj === undefined) {
      return "" + obj;
    }

XhmikosR's avatar
XhmikosR committed
98
99
    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  };
XhmikosR's avatar
Dist    
XhmikosR committed
100
  /**
XhmikosR's avatar
XhmikosR committed
101
102
103
   * --------------------------------------------------------------------------
   * Public Util Api
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
104
   */
Mark Otto's avatar
dist  
Mark Otto committed
105
106


XhmikosR's avatar
XhmikosR committed
107
108
  var getUID = function getUID(prefix) {
    do {
Mark Otto's avatar
Mark Otto committed
109
      prefix += Math.floor(Math.random() * MAX_UID);
XhmikosR's avatar
XhmikosR committed
110
    } while (document.getElementById(prefix));
Mark Otto's avatar
dist  
Mark Otto committed
111

XhmikosR's avatar
XhmikosR committed
112
113
    return prefix;
  };
Mark Otto's avatar
dist  
Mark Otto committed
114

XhmikosR's avatar
XhmikosR committed
115
  var getSelector = function getSelector(element) {
XhmikosR's avatar
XhmikosR committed
116
117
118
119
    var selector = element.getAttribute('data-target');

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

XhmikosR's avatar
XhmikosR committed
123
124
125
126
127
128
129
    return selector;
  };

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

    if (selector) {
XhmikosR's avatar
XhmikosR committed
130
131
      return document.querySelector(selector) ? selector : null;
    }
XhmikosR's avatar
XhmikosR committed
132
133
134
135
136
137
138

    return null;
  };

  var getElementFromSelector = function getElementFromSelector(element) {
    var selector = getSelector(element);
    return selector ? document.querySelector(selector) : null;
XhmikosR's avatar
XhmikosR committed
139
  };
Mark Otto's avatar
dist  
Mark Otto committed
140

XhmikosR's avatar
XhmikosR committed
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
  var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
    if (!element) {
      return 0;
    } // Get transition-duration of the element


    var _window$getComputedSt = window.getComputedStyle(element),
        transitionDuration = _window$getComputedSt.transitionDuration,
        transitionDelay = _window$getComputedSt.transitionDelay;

    var floatTransitionDuration = parseFloat(transitionDuration);
    var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found

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


    transitionDuration = transitionDuration.split(',')[0];
    transitionDelay = transitionDelay.split(',')[0];
    return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  };

  var triggerTransitionEnd = function triggerTransitionEnd(element) {
XhmikosR's avatar
XhmikosR committed
165
    element.dispatchEvent(new Event(TRANSITION_END));
XhmikosR's avatar
XhmikosR committed
166
  };
Mark Otto's avatar
dist  
Mark Otto committed
167

XhmikosR's avatar
XhmikosR committed
168
169
170
171
172
  var isElement = function isElement(obj) {
    return (obj[0] || obj).nodeType;
  };

  var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
XhmikosR's avatar
Dist    
XhmikosR committed
173
    var called = false;
XhmikosR's avatar
XhmikosR committed
174
175
176
177
    var durationPadding = 5;
    var emulatedDuration = duration + durationPadding;

    function listener() {
XhmikosR's avatar
Dist    
XhmikosR committed
178
      called = true;
XhmikosR's avatar
XhmikosR committed
179
180
181
182
      element.removeEventListener(TRANSITION_END, listener);
    }

    element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
Dist    
XhmikosR committed
183
184
    setTimeout(function () {
      if (!called) {
XhmikosR's avatar
XhmikosR committed
185
        triggerTransitionEnd(element);
XhmikosR's avatar
Dist    
XhmikosR committed
186
      }
XhmikosR's avatar
XhmikosR committed
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
    }, 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
208
209
210
      var elementStyle = getComputedStyle(element);
      var parentNodeStyle = getComputedStyle(element.parentNode);
      return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
XhmikosR's avatar
XhmikosR committed
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
    }

    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
237
  };
XhmikosR's avatar
XhmikosR committed
238
239
240
241
242
243
244
245

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

  var reflow = function reflow(element) {
    return element.offsetHeight;
  };
XhmikosR's avatar
Dist    
XhmikosR committed
246

XhmikosR's avatar
XhmikosR committed
247
248
249
250
251
252
253
254
255
256
257
  var getjQuery = function getjQuery() {
    var _window = window,
        jQuery = _window.jQuery;

    if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
      return jQuery;
    }

    return null;
  };

XhmikosR's avatar
Dist    
XhmikosR committed
258
259
  /**
   * --------------------------------------------------------------------------
260
   * Bootstrap (v5.0.0-alpha1): dom/data.js
XhmikosR's avatar
XhmikosR committed
261
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist    
XhmikosR committed
262
263
   * --------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
264

XhmikosR's avatar
XhmikosR committed
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
  var mapData = function () {
    var storeData = {};
    var id = 1;
    return {
      set: function set(element, key, data) {
        if (typeof element.key === 'undefined') {
          element.key = {
            key: key,
            id: id
          };
          id++;
        }

        storeData[element.key.id] = data;
      },
      get: function get(element, key) {
        if (!element || typeof element.key === 'undefined') {
          return null;
        }
Mark Otto's avatar
dist  
Mark Otto committed
289

XhmikosR's avatar
XhmikosR committed
290
        var keyProperties = element.key;
Mark Otto's avatar
dist    
Mark Otto committed
291

XhmikosR's avatar
XhmikosR committed
292
293
294
        if (keyProperties.key === key) {
          return storeData[keyProperties.id];
        }
Mark Otto's avatar
dist    
Mark Otto committed
295

XhmikosR's avatar
XhmikosR committed
296
297
298
299
300
301
302
303
304
305
306
307
308
        return null;
      },
      delete: function _delete(element, key) {
        if (typeof element.key === 'undefined') {
          return;
        }

        var keyProperties = element.key;

        if (keyProperties.key === key) {
          delete storeData[keyProperties.id];
          delete element.key;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
309
      }
XhmikosR's avatar
XhmikosR committed
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
    };
  }();

  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
325
326
  /* istanbul ignore file */
  var find = Element.prototype.querySelectorAll;
XhmikosR's avatar
XhmikosR committed
327
  var findOne = Element.prototype.querySelector; // MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
XhmikosR's avatar
XhmikosR committed
328

XhmikosR's avatar
XhmikosR committed
329
  var defaultPreventedPreservedOnDispatch = function () {
XhmikosR's avatar
XhmikosR committed
330
    var e = new CustomEvent('Bootstrap', {
XhmikosR's avatar
XhmikosR committed
331
332
333
334
335
336
337
338
339
340
      cancelable: true
    });
    var element = document.createElement('div');
    element.addEventListener('Bootstrap', function () {
      return null;
    });
    e.preventDefault();
    element.dispatchEvent(e);
    return e.defaultPrevented;
  }();
XhmikosR's avatar
XhmikosR committed
341

XhmikosR's avatar
XhmikosR committed
342
  var scopeSelectorRegex = /:scope\b/;
XhmikosR's avatar
XhmikosR committed
343

XhmikosR's avatar
XhmikosR committed
344
345
  var supportScopeQuery = function () {
    var element = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
346

XhmikosR's avatar
XhmikosR committed
347
348
    try {
      element.querySelectorAll(':scope *');
XhmikosR's avatar
XhmikosR committed
349
    } catch (_) {
XhmikosR's avatar
XhmikosR committed
350
      return false;
XhmikosR's avatar
XhmikosR committed
351
352
    }

XhmikosR's avatar
XhmikosR committed
353
    return true;
XhmikosR's avatar
XhmikosR committed
354
355
  }();

XhmikosR's avatar
XhmikosR committed
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
  if (!supportScopeQuery) {
    find = function find(selector) {
      if (!scopeSelectorRegex.test(selector)) {
        return this.querySelectorAll(selector);
      }

      var hasId = Boolean(this.id);

      if (!hasId) {
        this.id = getUID('scope');
      }

      var nodeList = null;

      try {
        selector = selector.replace(scopeSelectorRegex, "#" + this.id);
        nodeList = this.querySelectorAll(selector);
      } finally {
        if (!hasId) {
          this.removeAttribute('id');
        }
      }

      return nodeList;
    };

    findOne = function findOne(selector) {
      if (!scopeSelectorRegex.test(selector)) {
        return this.querySelector(selector);
      }

      var matches = find.call(this, selector);

      if (typeof matches[0] !== 'undefined') {
        return matches[0];
      }

      return null;
    };
  }

XhmikosR's avatar
XhmikosR committed
397
398
  /**
   * --------------------------------------------------------------------------
399
   * Bootstrap (v5.0.0-alpha1): dom/event-handler.js
XhmikosR's avatar
XhmikosR committed
400
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
XhmikosR committed
401
402
403
404
405
406
407
408
   * --------------------------------------------------------------------------
   */
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

XhmikosR's avatar
XhmikosR committed
409
  var $ = getjQuery();
XhmikosR's avatar
XhmikosR committed
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
  var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
  var stripNameRegex = /\..*/;
  var stripUidRegex = /::\d+$/;
  var eventRegistry = {}; // Events storage

  var uidEvent = 1;
  var customEvents = {
    mouseenter: 'mouseover',
    mouseleave: 'mouseout'
  };
  var nativeEvents = ['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'];
  /**
   * ------------------------------------------------------------------------
   * 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
434
435
    eventRegistry[uid] = eventRegistry[uid] || {};
    return eventRegistry[uid];
XhmikosR's avatar
XhmikosR committed
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
  }

  function bootstrapHandler(element, fn) {
    return function handler(event) {
      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) {
            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
474
475
476
477
    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
478
479

      if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
Mark Otto's avatar
dist v5    
Mark Otto committed
480
        return event;
XhmikosR's avatar
XhmikosR committed
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
      }
    }

    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;
    }

    var isNative = nativeEvents.indexOf(typeEvent) > -1;

    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
532
    var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
XhmikosR committed
533
534
535
536
537
538
539
540
541
542
543
    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
544
    if (!fn) {
XhmikosR's avatar
XhmikosR committed
545
546
547
548
549
550
551
552
553
554
555
556
557
      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) {
      if (handlerKey.indexOf(namespace) > -1) {
        var event = storeElementEvent[handlerKey];
        removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
Mark Otto's avatar
Mark Otto committed
558
      }
XhmikosR's avatar
XhmikosR committed
559
560
561
562
563
564
    });
  }

  var EventHandler = {
    on: function on(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, false);
XhmikosR's avatar
Dist    
XhmikosR committed
565
    },
XhmikosR's avatar
XhmikosR committed
566
567
568
569
570
571
572
    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;
      }
Mark Otto's avatar
dist    
Mark Otto committed
573

XhmikosR's avatar
XhmikosR committed
574
575
576
577
      var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
          delegation = _normalizeParams2[0],
          originalHandler = _normalizeParams2[1],
          typeEvent = _normalizeParams2[2];
Mark Otto's avatar
dist    
Mark Otto committed
578

XhmikosR's avatar
XhmikosR committed
579
580
581
      var inNamespace = typeEvent !== originalTypeEvent;
      var events = getEvent(element);
      var isNamespace = originalTypeEvent.charAt(0) === '.';
Mark Otto's avatar
dist    
Mark Otto committed
582

XhmikosR's avatar
XhmikosR committed
583
584
585
586
587
588
589
590
591
592
593
594
      if (typeof originalHandler !== 'undefined') {
        // Simplest case: handler is passed, remove that listener ONLY.
        if (!events || !events[typeEvent]) {
          return;
        }

        removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
        return;
      }

      if (isNamespace) {
        Object.keys(events).forEach(function (elementEvent) {
XhmikosR's avatar
XhmikosR committed
595
          removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
XhmikosR's avatar
XhmikosR committed
596
597
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
598

XhmikosR's avatar
XhmikosR committed
599
600
601
      var storeElementEvent = events[typeEvent] || {};
      Object.keys(storeElementEvent).forEach(function (keyHandlers) {
        var handlerKey = keyHandlers.replace(stripUidRegex, '');
Mark Otto's avatar
dist    
Mark Otto committed
602

XhmikosR's avatar
XhmikosR committed
603
604
605
606
607
        if (!inNamespace || originalTypeEvent.indexOf(handlerKey) > -1) {
          var event = storeElementEvent[keyHandlers];
          removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
        }
      });
XhmikosR's avatar
Dist    
XhmikosR committed
608
    },
XhmikosR's avatar
XhmikosR committed
609
610
611
612
613
614
615
616
617
618
619
620
621
622
    trigger: function trigger(element, event, args) {
      if (typeof event !== 'string' || !element) {
        return null;
      }

      var typeEvent = event.replace(stripNameRegex, '');
      var inNamespace = event !== typeEvent;
      var isNative = nativeEvents.indexOf(typeEvent) > -1;
      var jQueryEvent;
      var bubbles = true;
      var nativeDispatch = true;
      var defaultPrevented = false;
      var evt = null;

XhmikosR's avatar
XhmikosR committed
623
624
625
      if (inNamespace && $) {
        jQueryEvent = $.Event(event, args);
        $(element).trigger(jQueryEvent);
XhmikosR's avatar
XhmikosR committed
626
627
628
629
630
631
632
633
634
        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
635
        evt = new CustomEvent(event, {
XhmikosR's avatar
XhmikosR committed
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
          bubbles: bubbles,
          cancelable: true
        });
      } // merge custom informations in our event


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

      if (defaultPrevented) {
        evt.preventDefault();

XhmikosR's avatar
XhmikosR committed
655
        if (!defaultPreventedPreservedOnDispatch) {
XhmikosR's avatar
XhmikosR committed
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
          Object.defineProperty(evt, 'defaultPrevented', {
            get: function get() {
              return true;
            }
          });
        }
      }

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

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

      return evt;
    }
  };

XhmikosR's avatar
Dist    
XhmikosR committed
676
677
678
679
680
681
682
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME = 'alert';
683
  var VERSION = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
684
685
686
  var DATA_KEY = 'bs.alert';
  var EVENT_KEY = "." + DATA_KEY;
  var DATA_API_KEY = '.data-api';
XhmikosR's avatar
XhmikosR committed
687
688
689
690
691
692
693
  var SELECTOR_DISMISS = '[data-dismiss="alert"]';
  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
694
695
696
697
698
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
699

XhmikosR's avatar
XhmikosR committed
700
  var Alert = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
701
702
    function Alert(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
703
704
705
706

      if (this._element) {
        Data.setData(element, DATA_KEY, this);
      }
XhmikosR's avatar
Dist    
XhmikosR committed
707
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
708
709


XhmikosR's avatar
Dist    
XhmikosR committed
710
    var _proto = Alert.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
711

XhmikosR's avatar
Dist    
XhmikosR committed
712
713
714
    // Public
    _proto.close = function close(element) {
      var rootElement = this._element;
Mark Otto's avatar
dist  
Mark Otto committed
715

XhmikosR's avatar
Dist    
XhmikosR committed
716
717
718
      if (element) {
        rootElement = this._getRootElement(element);
      }
Mark Otto's avatar
dist    
Mark Otto committed
719

XhmikosR's avatar
Dist    
XhmikosR committed
720
      var customEvent = this._triggerCloseEvent(rootElement);
Mark Otto's avatar
dist  
Mark Otto committed
721

XhmikosR's avatar
XhmikosR committed
722
      if (customEvent === null || customEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
723
724
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
725

XhmikosR's avatar
Dist    
XhmikosR committed
726
727
      this._removeElement(rootElement);
    };
Mark Otto's avatar
dist  
Mark Otto committed
728

XhmikosR's avatar
Dist    
XhmikosR committed
729
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
730
      Data.removeData(this._element, DATA_KEY);
XhmikosR's avatar
Dist    
XhmikosR committed
731
      this._element = null;
Mark Otto's avatar
Mark Otto committed
732
733
    } // Private
    ;
Mark Otto's avatar
dist  
Mark Otto committed
734

XhmikosR's avatar
Dist    
XhmikosR committed
735
    _proto._getRootElement = function _getRootElement(element) {
XhmikosR's avatar
XhmikosR committed
736
      return getElementFromSelector(element) || element.closest("." + CLASSNAME_ALERT);
XhmikosR's avatar
Dist    
XhmikosR committed
737
    };
Mark Otto's avatar
dist  
Mark Otto committed
738

XhmikosR's avatar
Dist    
XhmikosR committed
739
    _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
XhmikosR's avatar
XhmikosR committed
740
      return EventHandler.trigger(element, EVENT_CLOSE);
XhmikosR's avatar
Dist    
XhmikosR committed
741
    };
Mark Otto's avatar
dist  
Mark Otto committed
742

XhmikosR's avatar
Dist    
XhmikosR committed
743
744
    _proto._removeElement = function _removeElement(element) {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
745

XhmikosR's avatar
XhmikosR committed
746
      element.classList.remove(CLASSNAME_SHOW);
Mark Otto's avatar
dist  
Mark Otto committed
747

XhmikosR's avatar
XhmikosR committed
748
      if (!element.classList.contains(CLASSNAME_FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
749
        this._destroyElement(element);
Mark Otto's avatar
dist    
Mark Otto committed
750

XhmikosR's avatar
Dist    
XhmikosR committed
751
752
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
753

XhmikosR's avatar
XhmikosR committed
754
      var transitionDuration = getTransitionDurationFromElement(element);
755
756
      EventHandler.one(element, TRANSITION_END, function () {
        return _this._destroyElement(element);
XhmikosR's avatar
XhmikosR committed
757
758
      });
      emulateTransitionEnd(element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
759
    };
Mark Otto's avatar
dist  
Mark Otto committed
760

XhmikosR's avatar
Dist    
XhmikosR committed
761
    _proto._destroyElement = function _destroyElement(element) {
XhmikosR's avatar
XhmikosR committed
762
763
764
765
      if (element.parentNode) {
        element.parentNode.removeChild(element);
      }

XhmikosR's avatar
XhmikosR committed
766
      EventHandler.trigger(element, EVENT_CLOSED);
Mark Otto's avatar
Mark Otto committed
767
768
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
769

XhmikosR's avatar
XhmikosR committed
770
    Alert.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
771
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
772
        var data = Data.getData(this, DATA_KEY);
Mark Otto's avatar
dist  
Mark Otto committed
773

XhmikosR's avatar
Dist    
XhmikosR committed
774
775
776
        if (!data) {
          data = new Alert(this);
        }
Mark Otto's avatar
dist  
Mark Otto committed
777

XhmikosR's avatar
Dist    
XhmikosR committed
778
779
780
781
782
        if (config === 'close') {
          data[config](this);
        }
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
783

XhmikosR's avatar
XhmikosR committed
784
    Alert.handleDismiss = function handleDismiss(alertInstance) {
XhmikosR's avatar
Dist    
XhmikosR committed
785
786
787
788
      return function (event) {
        if (event) {
          event.preventDefault();
        }
Mark Otto's avatar
dist  
Mark Otto committed
789

XhmikosR's avatar
Dist    
XhmikosR committed
790
        alertInstance.close(this);
Mark Otto's avatar
dist  
Mark Otto committed
791
      };
XhmikosR's avatar
Dist    
XhmikosR committed
792
    };
Mark Otto's avatar
dist  
Mark Otto committed
793

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
805
806
807
808
809
810
811
    return Alert;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
812

Mark Otto's avatar
dist    
Mark Otto committed
813

XhmikosR's avatar
XhmikosR committed
814
  EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
XhmikosR's avatar
XhmikosR committed
815
  var $$1 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
816
817
818
819
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
820
   * add .alert to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
821
   */
Mark Otto's avatar
dist  
Mark Otto committed
822

823
824
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
825
826
827
828
  if ($$1) {
    var JQUERY_NO_CONFLICT = $$1.fn[NAME];
    $$1.fn[NAME] = Alert.jQueryInterface;
    $$1.fn[NAME].Constructor = Alert;
Mark Otto's avatar
dist  
Mark Otto committed
829

XhmikosR's avatar
XhmikosR committed
830
831
832
    $$1.fn[NAME].noConflict = function () {
      $$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Alert.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
833
834
    };
  }
Mark Otto's avatar
dist  
Mark Otto committed
835

XhmikosR's avatar
Dist    
XhmikosR committed
836
837
838
839
840
841
842
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$1 = 'button';
843
  var VERSION$1 = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
844
845
846
  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
847
  var CLASS_NAME_ACTIVE = 'active';
XhmikosR's avatar
XhmikosR committed
848
  var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
XhmikosR's avatar
XhmikosR committed
849
  var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
XhmikosR's avatar
XhmikosR committed
850
851
852
853
854
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
855

XhmikosR's avatar
XhmikosR committed
856
  var Button = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
857
858
    function Button(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
859
      Data.setData(element, DATA_KEY$1, this);
XhmikosR's avatar
Dist    
XhmikosR committed
860
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
861
862


XhmikosR's avatar
Dist    
XhmikosR committed
863
    var _proto = Button.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
864

XhmikosR's avatar
Dist    
XhmikosR committed
865
866
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
867
868
      // 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
869
    };
Mark Otto's avatar
dist  
Mark Otto committed
870

XhmikosR's avatar
Dist    
XhmikosR committed
871
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
872
      Data.removeData(this._element, DATA_KEY$1);
XhmikosR's avatar
Dist    
XhmikosR committed
873
      this._element = null;
Mark Otto's avatar
Mark Otto committed
874
875
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
876

XhmikosR's avatar
XhmikosR committed
877
    Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
878
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
879
        var data = Data.getData(this, DATA_KEY$1);
Mark Otto's avatar
dist  
Mark Otto committed
880

XhmikosR's avatar
Dist    
XhmikosR committed
881
882
883
        if (!data) {
          data = new Button(this);
        }
Mark Otto's avatar
dist  
Mark Otto committed
884

XhmikosR's avatar
Dist    
XhmikosR committed
885
886
        if (config === 'toggle') {
          data[config]();
Mark Otto's avatar
dist  
Mark Otto committed
887
        }
XhmikosR's avatar
Dist    
XhmikosR committed
888
889
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
890

XhmikosR's avatar
XhmikosR committed
891
    Button.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
892
893
894
      return Data.getData(element, DATA_KEY$1);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
895
896
897
898
899
900
    _createClass(Button, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$1;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
901

XhmikosR's avatar
Dist    
XhmikosR committed
902
903
904
905
906
907
908
    return Button;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
909
910


XhmikosR's avatar
XhmikosR committed
911
  EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
912
    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
913
    var button = event.target.closest(SELECTOR_DATA_TOGGLE);
XhmikosR's avatar
XhmikosR committed
914
915
916
917
    var data = Data.getData(button, DATA_KEY$1);

    if (!data) {
      data = new Button(button);
XhmikosR's avatar
Dist    
XhmikosR committed
918
    }
Mark Otto's avatar
dist    
Mark Otto committed
919

XhmikosR's avatar
XhmikosR committed
920
921
    data.toggle();
  });
XhmikosR's avatar
XhmikosR committed
922
  var $$2 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
923
924
925
926
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
927
   * add .button to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
928
   */
Mark Otto's avatar
dist  
Mark Otto committed
929

930
931
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
932
933
934
935
  if ($$2) {
    var JQUERY_NO_CONFLICT$1 = $$2.fn[NAME$1];
    $$2.fn[NAME$1] = Button.jQueryInterface;
    $$2.fn[NAME$1].Constructor = Button;
XhmikosR's avatar
XhmikosR committed
936

XhmikosR's avatar
XhmikosR committed
937
938
939
    $$2.fn[NAME$1].noConflict = function () {
      $$2.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
      return Button.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
940
941
942
943
944
    };
  }

  /**
   * --------------------------------------------------------------------------
945
   * Bootstrap (v5.0.0-alpha1): dom/manipulator.js
XhmikosR's avatar
XhmikosR committed
946
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
XhmikosR committed
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
   * --------------------------------------------------------------------------
   */
  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;
  }

  function normalizeDataKey(key) {
    return key.replace(/[A-Z]/g, function (chr) {
XhmikosR's avatar
XhmikosR committed
971
      return "-" + chr.toLowerCase();
XhmikosR's avatar
XhmikosR committed
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
    });
  }

  var Manipulator = {
    setDataAttribute: function setDataAttribute(element, key, value) {
      element.setAttribute("data-" + normalizeDataKey(key), value);
    },
    removeDataAttribute: function removeDataAttribute(element, key) {
      element.removeAttribute("data-" + normalizeDataKey(key));
    },
    getDataAttributes: function getDataAttributes(element) {
      if (!element) {
        return {};
      }

987
      var attributes = _objectSpread2({}, element.dataset);
Mark Otto's avatar
dist  
Mark Otto committed
988

XhmikosR's avatar
XhmikosR committed
989
990
991
992
993
994
995
996
997
998
999
1000
      Object.keys(attributes).forEach(function (key) {
        attributes[key] = normalizeData(attributes[key]);
      });
      return attributes;
    },
    getDataAttribute: function getDataAttribute(element, key) {
      return normalizeData(element.getAttribute("data-" + normalizeDataKey(key)));
    },
    offset: function offset(element) {
      var rect = element.getBoundingClientRect();
      return {
        top: rect.top + document.body.scrollTop,
For faster browsing, not all history is shown. View entire blame