bootstrap.esm.js 144 KB
Newer Older
XhmikosR's avatar
Dist.  
XhmikosR committed
1
2
3
4
5
6
7
/*!
  * Bootstrap v4.3.1 (https://getbootstrap.com/)
  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  */
import Popper from 'popper.js';

XhmikosR's avatar
XhmikosR committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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;
}

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

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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) {
XhmikosR's avatar
XhmikosR committed
54
55
56
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i] != null ? arguments[i] : {};

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

  return target;
}

function _inheritsLoose(subClass, superClass) {
  subClass.prototype = Object.create(superClass.prototype);
  subClass.prototype.constructor = subClass;
  subClass.__proto__ = superClass;
}

XhmikosR's avatar
Dist.  
XhmikosR committed
79
80
81
82
83
84
/**
 * --------------------------------------------------------------------------
 * Bootstrap (v4.3.1): util/index.js
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */
XhmikosR's avatar
XhmikosR committed
85
86
var MAX_UID = 1000000;
var MILLISECONDS_MULTIPLIER = 1000;
XhmikosR's avatar
XhmikosR committed
87
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
XhmikosR's avatar
XhmikosR committed
88
89
90
91

var toType = function toType(obj) {
  return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
};
XhmikosR's avatar
Dist.  
XhmikosR committed
92
93
94
95
96
97
98
/**
 * --------------------------------------------------------------------------
 * Public Util Api
 * --------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
99
var getUID = function getUID(prefix) {
XhmikosR's avatar
Dist.  
XhmikosR committed
100
101
102
103
104
105
106
  do {
    prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  } while (document.getElementById(prefix));

  return prefix;
};

XhmikosR's avatar
XhmikosR committed
107
var getSelector = function getSelector(element) {
XhmikosR's avatar
XhmikosR committed
108
  var selector = element.getAttribute('data-target');
XhmikosR's avatar
Dist.  
XhmikosR committed
109
110

  if (!selector || selector === '#') {
XhmikosR's avatar
XhmikosR committed
111
    var hrefAttr = element.getAttribute('href');
XhmikosR's avatar
XhmikosR committed
112
    selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
113
114
  }

XhmikosR's avatar
XhmikosR committed
115
116
117
118
119
120
121
  return selector;
};

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

  if (selector) {
XhmikosR's avatar
Dist.  
XhmikosR committed
122
123
    return document.querySelector(selector) ? selector : null;
  }
XhmikosR's avatar
XhmikosR committed
124
125
126
127
128
129
130

  return null;
};

var getElementFromSelector = function getElementFromSelector(element) {
  var selector = getSelector(element);
  return selector ? document.querySelector(selector) : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
131
132
};

XhmikosR's avatar
XhmikosR committed
133
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
134
135
136
137
138
  if (!element) {
    return 0;
  } // Get transition-duration of the element


XhmikosR's avatar
XhmikosR committed
139
  var _window$getComputedSt = window.getComputedStyle(element),
XhmikosR's avatar
Dist.  
XhmikosR committed
140
141
142
      transitionDuration = _window$getComputedSt.transitionDuration,
      transitionDelay = _window$getComputedSt.transitionDelay;

XhmikosR's avatar
XhmikosR committed
143
144
  var floatTransitionDuration = parseFloat(transitionDuration);
  var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
XhmikosR's avatar
Dist.  
XhmikosR committed
145
146
147
148
149
150
151
152
153
154
155

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

XhmikosR's avatar
XhmikosR committed
156
157
158
159
var triggerTransitionEnd = function triggerTransitionEnd(element) {
  var evt = document.createEvent('HTMLEvents');
  evt.initEvent(TRANSITION_END, true, true);
  element.dispatchEvent(evt);
XhmikosR's avatar
Dist.  
XhmikosR committed
160
161
};

XhmikosR's avatar
XhmikosR committed
162
163
164
var isElement = function isElement(obj) {
  return (obj[0] || obj).nodeType;
};
XhmikosR's avatar
Dist.  
XhmikosR committed
165

XhmikosR's avatar
XhmikosR committed
166
167
168
169
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
  var called = false;
  var durationPadding = 5;
  var emulatedDuration = duration + durationPadding;
XhmikosR's avatar
Dist.  
XhmikosR committed
170
171
172
173
174
175
176

  function listener() {
    called = true;
    element.removeEventListener(TRANSITION_END, listener);
  }

  element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
XhmikosR committed
177
  setTimeout(function () {
XhmikosR's avatar
Dist.  
XhmikosR committed
178
179
180
181
182
183
    if (!called) {
      triggerTransitionEnd(element);
    }
  }, emulatedDuration);
};

XhmikosR's avatar
XhmikosR committed
184
185
186
187
188
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);
XhmikosR's avatar
Dist.  
XhmikosR committed
189
190

    if (!new RegExp(expectedTypes).test(valueType)) {
XhmikosR's avatar
XhmikosR committed
191
      throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
XhmikosR's avatar
Dist.  
XhmikosR committed
192
193
194
195
    }
  });
};

XhmikosR's avatar
XhmikosR committed
196
var makeArray = function makeArray(nodeList) {
XhmikosR's avatar
Dist.  
XhmikosR committed
197
198
199
200
201
202
203
  if (!nodeList) {
    return [];
  }

  return [].slice.call(nodeList);
};

XhmikosR's avatar
XhmikosR committed
204
var isVisible = function isVisible(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
205
206
207
208
209
210
211
212
213
214
215
  if (!element) {
    return false;
  }

  if (element.style && element.parentNode && element.parentNode.style) {
    return element.style.display !== 'none' && element.parentNode.style.display !== 'none' && element.style.visibility !== 'hidden';
  }

  return false;
};

XhmikosR's avatar
XhmikosR committed
216
var findShadowRoot = function findShadowRoot(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
217
218
219
220
221
222
  if (!document.documentElement.attachShadow) {
    return null;
  } // Can find the shadow root otherwise it'll return the document


  if (typeof element.getRootNode === 'function') {
XhmikosR's avatar
XhmikosR committed
223
    var root = element.getRootNode();
XhmikosR's avatar
Dist.  
XhmikosR committed
224
225
226
227
228
229
230
231
232
233
234
235
236
    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
Dist.  
XhmikosR committed
238

XhmikosR's avatar
XhmikosR committed
239
240
241
var noop = function noop() {
  return function () {};
};
XhmikosR's avatar
Dist.  
XhmikosR committed
242

XhmikosR's avatar
XhmikosR committed
243
244
245
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
261
262
263
264
265
266
267
268
269
/**
 * --------------------------------------------------------------------------
 * Bootstrap (v4.3.1): dom/data.js
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

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

      storeData[element.key.id] = data;
    },
XhmikosR's avatar
XhmikosR committed
285
    get: function get(element, key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
286
287
288
289
      if (!element || typeof element.key === 'undefined') {
        return null;
      }

XhmikosR's avatar
XhmikosR committed
290
      var keyProperties = element.key;
XhmikosR's avatar
Dist.  
XhmikosR committed
291
292
293
294
295
296
297

      if (keyProperties.key === key) {
        return storeData[keyProperties.id];
      }

      return null;
    },
XhmikosR's avatar
XhmikosR committed
298
    delete: function _delete(element, key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
299
300
301
302
      if (typeof element.key === 'undefined') {
        return;
      }

XhmikosR's avatar
XhmikosR committed
303
      var keyProperties = element.key;
XhmikosR's avatar
Dist.  
XhmikosR committed
304
305
306
307
308
309
310

      if (keyProperties.key === key) {
        delete storeData[keyProperties.id];
        delete element.key;
      }
    }
  };
XhmikosR's avatar
XhmikosR committed
311
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
312

XhmikosR's avatar
XhmikosR committed
313
314
var Data = {
  setData: function setData(instance, key, data) {
XhmikosR's avatar
Dist.  
XhmikosR committed
315
316
    mapData.set(instance, key, data);
  },
XhmikosR's avatar
XhmikosR committed
317
  getData: function getData(instance, key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
318
319
    return mapData.get(instance, key);
  },
XhmikosR's avatar
XhmikosR committed
320
  removeData: function removeData(instance, key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
321
322
    mapData.delete(instance, key);
  }
XhmikosR's avatar
XhmikosR committed
323
};
XhmikosR's avatar
Dist.  
XhmikosR committed
324

XhmikosR's avatar
XhmikosR committed
325
326
327
328
329
330
331
332
333
334
/* istanbul ignore file */
var _Element$prototype = Element.prototype,
    matches = _Element$prototype.matches,
    closest = _Element$prototype.closest;
var find = Element.prototype.querySelectorAll;
var findOne = Element.prototype.querySelector;

var createCustomEvent = function createCustomEvent(eventName, params) {
  var cEvent = new CustomEvent(eventName, params);
  return cEvent;
XhmikosR's avatar
Dist.  
XhmikosR committed
335
336
};

XhmikosR's avatar
XhmikosR committed
337
338
339
340
341
342
343
344
345
346
347
348
if (typeof window.CustomEvent !== 'function') {
  createCustomEvent = function createCustomEvent(eventName, params) {
    params = params || {
      bubbles: false,
      cancelable: false,
      detail: null
    };
    var evt = document.createEvent('CustomEvent');
    evt.initCustomEvent(eventName, params.bubbles, params.cancelable, params.detail);
    return evt;
  };
}
XhmikosR's avatar
Dist.  
XhmikosR committed
349

XhmikosR's avatar
XhmikosR committed
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
var workingDefaultPrevented = function () {
  var e = document.createEvent('CustomEvent');
  e.initEvent('Bootstrap', true, true);
  e.preventDefault();
  return e.defaultPrevented;
}();

if (!workingDefaultPrevented) {
  var origPreventDefault = Event.prototype.preventDefault;

  Event.prototype.preventDefault = function () {
    if (!this.cancelable) {
      return;
    }

    origPreventDefault.call(this);
    Object.defineProperty(this, 'defaultPrevented', {
      get: function get() {
        return true;
      },
      configurable: true
XhmikosR's avatar
Dist.  
XhmikosR committed
371
    });
XhmikosR's avatar
XhmikosR committed
372
373
  };
} // MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
XhmikosR's avatar
Dist.  
XhmikosR committed
374
375


XhmikosR's avatar
XhmikosR committed
376
377
378
379
380
381
382
383
384
385
386
387
var defaultPreventedPreservedOnDispatch = function () {
  var e = createCustomEvent('Bootstrap', {
    cancelable: true
  });
  var element = document.createElement('div');
  element.addEventListener('Bootstrap', function () {
    return null;
  });
  e.preventDefault();
  element.dispatchEvent(e);
  return e.defaultPrevented;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
388

XhmikosR's avatar
XhmikosR committed
389
390
391
if (!matches) {
  matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}
XhmikosR's avatar
Dist.  
XhmikosR committed
392

XhmikosR's avatar
XhmikosR committed
393
394
395
if (!closest) {
  closest = function closest(selector) {
    var element = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
396

XhmikosR's avatar
XhmikosR committed
397
398
399
    do {
      if (matches.call(element, selector)) {
        return element;
XhmikosR's avatar
Dist.  
XhmikosR committed
400
401
      }

XhmikosR's avatar
XhmikosR committed
402
403
      element = element.parentElement || element.parentNode;
    } while (element !== null && element.nodeType === 1);
XhmikosR's avatar
Dist.  
XhmikosR committed
404

XhmikosR's avatar
XhmikosR committed
405
406
407
    return null;
  };
}
XhmikosR's avatar
Dist.  
XhmikosR committed
408

XhmikosR's avatar
XhmikosR committed
409
var scopeSelectorRegex = /:scope\b/;
XhmikosR's avatar
Dist.  
XhmikosR committed
410

XhmikosR's avatar
XhmikosR committed
411
412
var supportScopeQuery = function () {
  var element = document.createElement('div');
XhmikosR's avatar
Dist.  
XhmikosR committed
413

XhmikosR's avatar
XhmikosR committed
414
415
  try {
    element.querySelectorAll(':scope *');
XhmikosR's avatar
XhmikosR committed
416
  } catch (_) {
XhmikosR's avatar
XhmikosR committed
417
418
    return false;
  }
XhmikosR's avatar
Dist.  
XhmikosR committed
419

XhmikosR's avatar
XhmikosR committed
420
421
422
423
424
425
426
427
428
429
  return true;
}();

if (!supportScopeQuery) {
  find = function find(selector) {
    if (!scopeSelectorRegex.test(selector)) {
      return this.querySelectorAll(selector);
    }

    var hasId = Boolean(this.id);
XhmikosR's avatar
Dist.  
XhmikosR committed
430

XhmikosR's avatar
XhmikosR committed
431
432
433
434
435
    if (!hasId) {
      this.id = getUID('scope');
    }

    var nodeList = null;
XhmikosR's avatar
Dist.  
XhmikosR committed
436

XhmikosR's avatar
XhmikosR committed
437
438
439
440
441
442
    try {
      selector = selector.replace(scopeSelectorRegex, "#" + this.id);
      nodeList = this.querySelectorAll(selector);
    } finally {
      if (!hasId) {
        this.removeAttribute('id');
XhmikosR's avatar
Dist.  
XhmikosR committed
443
      }
XhmikosR's avatar
XhmikosR committed
444
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
445

XhmikosR's avatar
XhmikosR committed
446
447
    return nodeList;
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
448

XhmikosR's avatar
XhmikosR committed
449
450
451
452
453
454
455
456
457
458
459
460
  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
Dist.  
XhmikosR committed
461
  };
XhmikosR's avatar
XhmikosR committed
462
}
XhmikosR's avatar
Dist.  
XhmikosR committed
463
464
465

/**
 * --------------------------------------------------------------------------
466
 * Bootstrap (v4.3.1): dom/event-handler.js
XhmikosR's avatar
Dist.  
XhmikosR committed
467
468
469
470
471
472
473
474
475
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */
/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
476
var $ = getjQuery();
XhmikosR's avatar
XhmikosR committed
477
478
479
480
481
var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
var stripNameRegex = /\..*/;
var keyEventRegex = /^key/;
var stripUidRegex = /::\d+$/;
var eventRegistry = {}; // Events storage
XhmikosR's avatar
Dist.  
XhmikosR committed
482

XhmikosR's avatar
XhmikosR committed
483
484
var uidEvent = 1;
var customEvents = {
XhmikosR's avatar
Dist.  
XhmikosR committed
485
486
487
  mouseenter: 'mouseover',
  mouseleave: 'mouseout'
};
XhmikosR's avatar
XhmikosR committed
488
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'];
XhmikosR's avatar
Dist.  
XhmikosR committed
489
490
491
492
493
494
495
/**
 * ------------------------------------------------------------------------
 * Private methods
 * ------------------------------------------------------------------------
 */

function getUidEvent(element, uid) {
XhmikosR's avatar
XhmikosR committed
496
  return uid && uid + "::" + uidEvent++ || element.uidEvent || uidEvent++;
XhmikosR's avatar
Dist.  
XhmikosR committed
497
498
499
}

function getEvent(element) {
XhmikosR's avatar
XhmikosR committed
500
  var uid = getUidEvent(element);
XhmikosR's avatar
Dist.  
XhmikosR committed
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
  element.uidEvent = uid;
  eventRegistry[uid] = eventRegistry[uid] || {};
  return eventRegistry[uid];
}

function fixEvent(event, element) {
  // Add which for key events
  if (event.which === null && keyEventRegex.test(event.type)) {
    event.which = event.charCode === null ? event.keyCode : event.charCode;
  }

  event.delegateTarget = element;
}

function bootstrapHandler(element, fn) {
  return function handler(event) {
    fixEvent(event, element);

    if (handler.oneOff) {
      EventHandler.off(element, event.type, fn);
    }

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

function bootstrapDelegationHandler(element, selector, fn) {
  return function handler(event) {
XhmikosR's avatar
XhmikosR committed
529
    var domElements = element.querySelectorAll(selector);
XhmikosR's avatar
Dist.  
XhmikosR committed
530

XhmikosR's avatar
XhmikosR committed
531
532
    for (var target = event.target; target && target !== this; target = target.parentNode) {
      for (var i = domElements.length; i--;) {
XhmikosR's avatar
Dist.  
XhmikosR committed
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
        if (domElements[i] === target) {
          fixEvent(event, 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
555
556
557
558
  var uidEventList = Object.keys(events);

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

    if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
Mark Otto's avatar
dist v5    
Mark Otto committed
561
      return event;
XhmikosR's avatar
Dist.  
XhmikosR committed
562
563
564
565
566
567
568
    }
  }

  return null;
}

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

XhmikosR's avatar
XhmikosR committed
572
573
  var typeEvent = originalTypeEvent.replace(stripNameRegex, '');
  var custom = customEvents[typeEvent];
XhmikosR's avatar
Dist.  
XhmikosR committed
574
575
576
577
578

  if (custom) {
    typeEvent = custom;
  }

XhmikosR's avatar
XhmikosR committed
579
  var isNative = nativeEvents.indexOf(typeEvent) > -1;
XhmikosR's avatar
Dist.  
XhmikosR committed
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597

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

XhmikosR's avatar
XhmikosR committed
598
599
600
601
  var _normalizeParams = normalizeParams(originalTypeEvent, handler, delegationFn),
      delegation = _normalizeParams[0],
      originalHandler = _normalizeParams[1],
      typeEvent = _normalizeParams[2];
XhmikosR's avatar
Dist.  
XhmikosR committed
602

XhmikosR's avatar
XhmikosR committed
603
604
605
  var events = getEvent(element);
  var handlers = events[typeEvent] || (events[typeEvent] = {});
  var previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
XhmikosR's avatar
Dist.  
XhmikosR committed
606
607
608
609
610
611

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

XhmikosR's avatar
XhmikosR committed
612
613
  var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
  var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
Dist.  
XhmikosR committed
614
615
616
617
618
619
620
621
622
  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) {
XhmikosR's avatar
XhmikosR committed
623
  var fn = findHandler(events[typeEvent], handler, delegationSelector);
XhmikosR's avatar
Dist.  
XhmikosR committed
624

Mark Otto's avatar
dist v5    
Mark Otto committed
625
  if (!fn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
626
627
628
629
630
631
632
633
    return;
  }

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

function removeNamespacedHandlers(element, events, typeEvent, namespace) {
XhmikosR's avatar
XhmikosR committed
634
635
  var storeElementEvent = events[typeEvent] || {};
  Object.keys(storeElementEvent).forEach(function (handlerKey) {
XhmikosR's avatar
Dist.  
XhmikosR committed
636
    if (handlerKey.indexOf(namespace) > -1) {
XhmikosR's avatar
XhmikosR committed
637
      var event = storeElementEvent[handlerKey];
XhmikosR's avatar
Dist.  
XhmikosR committed
638
639
640
641
642
      removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
    }
  });
}

XhmikosR's avatar
XhmikosR committed
643
644
var EventHandler = {
  on: function on(element, event, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
645
646
    addHandler(element, event, handler, delegationFn, false);
  },
XhmikosR's avatar
XhmikosR committed
647
  one: function one(element, event, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
648
649
    addHandler(element, event, handler, delegationFn, true);
  },
XhmikosR's avatar
XhmikosR committed
650
  off: function off(element, originalTypeEvent, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
651
652
653
654
    if (typeof originalTypeEvent !== 'string' || !element) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
655
656
657
658
    var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
        delegation = _normalizeParams2[0],
        originalHandler = _normalizeParams2[1],
        typeEvent = _normalizeParams2[2];
XhmikosR's avatar
Dist.  
XhmikosR committed
659

XhmikosR's avatar
XhmikosR committed
660
661
662
    var inNamespace = typeEvent !== originalTypeEvent;
    var events = getEvent(element);
    var isNamespace = originalTypeEvent.charAt(0) === '.';
XhmikosR's avatar
Dist.  
XhmikosR committed
663
664
665
666
667
668
669
670
671
672
673
674

    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) {
XhmikosR's avatar
XhmikosR committed
675
      Object.keys(events).forEach(function (elementEvent) {
XhmikosR's avatar
XhmikosR committed
676
        removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
XhmikosR's avatar
Dist.  
XhmikosR committed
677
678
679
      });
    }

XhmikosR's avatar
XhmikosR committed
680
681
682
    var storeElementEvent = events[typeEvent] || {};
    Object.keys(storeElementEvent).forEach(function (keyHandlers) {
      var handlerKey = keyHandlers.replace(stripUidRegex, '');
XhmikosR's avatar
Dist.  
XhmikosR committed
683
684

      if (!inNamespace || originalTypeEvent.indexOf(handlerKey) > -1) {
XhmikosR's avatar
XhmikosR committed
685
        var event = storeElementEvent[keyHandlers];
XhmikosR's avatar
Dist.  
XhmikosR committed
686
687
688
689
        removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
      }
    });
  },
XhmikosR's avatar
XhmikosR committed
690
  trigger: function trigger(element, event, args) {
XhmikosR's avatar
Dist.  
XhmikosR committed
691
692
693
694
    if (typeof event !== 'string' || !element) {
      return null;
    }

XhmikosR's avatar
XhmikosR committed
695
696
697
698
699
700
701
702
    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
Dist.  
XhmikosR committed
703

XhmikosR's avatar
XhmikosR committed
704
705
706
    if (inNamespace && $) {
      jQueryEvent = $.Event(event, args);
      $(element).trigger(jQueryEvent);
XhmikosR's avatar
Dist.  
XhmikosR committed
707
708
709
710
711
712
713
714
715
      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
716
717
      evt = createCustomEvent(event, {
        bubbles: bubbles,
XhmikosR's avatar
Dist.  
XhmikosR committed
718
719
720
721
722
723
        cancelable: true
      });
    } // merge custom informations in our event


    if (typeof args !== 'undefined') {
XhmikosR's avatar
XhmikosR committed
724
      Object.keys(args).forEach(function (key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
725
        Object.defineProperty(evt, key, {
XhmikosR's avatar
XhmikosR committed
726
          get: function get() {
XhmikosR's avatar
Dist.  
XhmikosR committed
727
728
729
730
731
732
733
734
735
            return args[key];
          }
        });
      });
    }

    if (defaultPrevented) {
      evt.preventDefault();

XhmikosR's avatar
XhmikosR committed
736
      if (!defaultPreventedPreservedOnDispatch) {
XhmikosR's avatar
Dist.  
XhmikosR committed
737
        Object.defineProperty(evt, 'defaultPrevented', {
XhmikosR's avatar
XhmikosR committed
738
739
740
          get: function get() {
            return true;
          }
XhmikosR's avatar
Dist.  
XhmikosR committed
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
        });
      }
    }

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

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

    return evt;
  }
};

/**
 * --------------------------------------------------------------------------
759
 * Bootstrap (v4.3.1): dom/selector-engine.js
XhmikosR's avatar
Dist.  
XhmikosR committed
760
761
762
763
764
765
766
767
768
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */
/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
769
770
771
772
var NODE_TEXT = 3;
var SelectorEngine = {
  matches: function matches$1(element, selector) {
    return matches.call(element, selector);
XhmikosR's avatar
Dist.  
XhmikosR committed
773
  },
XhmikosR's avatar
XhmikosR committed
774
  find: function find$1(selector, element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
775
776
777
778
    if (element === void 0) {
      element = document.documentElement;
    }

XhmikosR's avatar
XhmikosR committed
779
    return find.call(element, selector);
XhmikosR's avatar
Dist.  
XhmikosR committed
780
  },
XhmikosR's avatar
XhmikosR committed
781
  findOne: function findOne$1(selector, element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
782
783
784
785
786
787
    if (element === void 0) {
      element = document.documentElement;
    }

    return findOne.call(element, selector);
  },
XhmikosR's avatar
XhmikosR committed
788
789
  children: function children(element, selector) {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
790

XhmikosR's avatar
XhmikosR committed
791
792
793
794
    var children = makeArray(element.children);
    return children.filter(function (child) {
      return _this.matches(child, selector);
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
795
  },
XhmikosR's avatar
XhmikosR committed
796
797
798
  parents: function parents(element, selector) {
    var parents = [];
    var ancestor = element.parentNode;
XhmikosR's avatar
Dist.  
XhmikosR committed
799
800
801
802
803
804
805
806
807
808
809

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

      ancestor = ancestor.parentNode;
    }

    return parents;
  },
XhmikosR's avatar
XhmikosR committed
810
811
  closest: function closest$1(element, selector) {
    return closest.call(element, selector);
XhmikosR's avatar
Dist.  
XhmikosR committed
812
  },
XhmikosR's avatar
XhmikosR committed
813
814
815
  prev: function prev(element, selector) {
    var siblings = [];
    var previous = element.previousSibling;
XhmikosR's avatar
Dist.  
XhmikosR committed
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834

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

      previous = previous.previousSibling;
    }

    return siblings;
  }
};

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
835
836
837
838
839
840
var NAME = 'alert';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.alert';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
var Selector = {
XhmikosR's avatar
Dist.  
XhmikosR committed
841
842
  DISMISS: '[data-dismiss="alert"]'
};
XhmikosR's avatar
XhmikosR committed
843
844
845
846
var Event$1 = {
  CLOSE: "close" + EVENT_KEY,
  CLOSED: "closed" + EVENT_KEY,
  CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
XhmikosR's avatar
Dist.  
XhmikosR committed
847
};
XhmikosR's avatar
XhmikosR committed
848
var ClassName = {
XhmikosR's avatar
Dist.  
XhmikosR committed
849
850
851
852
  ALERT: 'alert',
  FADE: 'fade',
  SHOW: 'show'
};
XhmikosR's avatar
XhmikosR committed
853
854
855
856
857
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
858

XhmikosR's avatar
XhmikosR committed
859
860
861
862
var Alert =
/*#__PURE__*/
function () {
  function Alert(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
863
864
865
866
867
868
869
870
    this._element = element;

    if (this._element) {
      Data.setData(element, DATA_KEY, this);
    }
  } // Getters


XhmikosR's avatar
XhmikosR committed
871
  var _proto = Alert.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
872

XhmikosR's avatar
XhmikosR committed
873
874
875
  // Public
  _proto.close = function close(element) {
    var rootElement = this._element;
XhmikosR's avatar
Dist.  
XhmikosR committed
876
877
878
879
880

    if (element) {
      rootElement = this._getRootElement(element);
    }

XhmikosR's avatar
XhmikosR committed
881
    var customEvent = this._triggerCloseEvent(rootElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
882
883
884
885
886
887

    if (customEvent === null || customEvent.defaultPrevented) {
      return;
    }

    this._removeElement(rootElement);
XhmikosR's avatar
XhmikosR committed
888
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
889

XhmikosR's avatar
XhmikosR committed
890
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
891
892
893
    Data.removeData(this._element, DATA_KEY);
    this._element = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
894
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
895

XhmikosR's avatar
XhmikosR committed
896
  _proto._getRootElement = function _getRootElement(element) {
XhmikosR's avatar
XhmikosR committed
897
    var parent = getElementFromSelector(element);
XhmikosR's avatar
Dist.  
XhmikosR committed
898
899

    if (!parent) {
XhmikosR's avatar
XhmikosR committed
900
      parent = SelectorEngine.closest(element, "." + ClassName.ALERT);
XhmikosR's avatar
Dist.  
XhmikosR committed
901
902
903
    }

    return parent;
XhmikosR's avatar
XhmikosR committed
904
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
905

XhmikosR's avatar
XhmikosR committed
906
  _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
907
    return EventHandler.trigger(element, Event$1.CLOSE);
XhmikosR's avatar
XhmikosR committed
908
909
910
911
  };

  _proto._removeElement = function _removeElement(element) {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
912
913
914
915
916
917
918
919
920

    element.classList.remove(ClassName.SHOW);

    if (!element.classList.contains(ClassName.FADE)) {
      this._destroyElement(element);

      return;
    }

XhmikosR's avatar
XhmikosR committed
921
    var transitionDuration = getTransitionDurationFromElement(element);
922
923
    EventHandler.one(element, TRANSITION_END, function () {
      return _this._destroyElement(element);
XhmikosR's avatar
XhmikosR committed
924
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
925
    emulateTransitionEnd(element, transitionDuration);
XhmikosR's avatar
XhmikosR committed
926
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
927

XhmikosR's avatar
XhmikosR committed
928
  _proto._destroyElement = function _destroyElement(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
929
930
931
932
933
934
    if (element.parentNode) {
      element.parentNode.removeChild(element);
    }

    EventHandler.trigger(element, Event$1.CLOSED);
  } // Static
XhmikosR's avatar
XhmikosR committed
935
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
936

XhmikosR's avatar
XhmikosR committed
937
  Alert.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
938
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
939
      var data = Data.getData(this, DATA_KEY);
XhmikosR's avatar
Dist.  
XhmikosR committed
940
941
942
943
944
945
946
947
948

      if (!data) {
        data = new Alert(this);
      }

      if (config === 'close') {
        data[config](this);
      }
    });
XhmikosR's avatar
XhmikosR committed
949
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
950

XhmikosR's avatar
XhmikosR committed
951
  Alert.handleDismiss = function handleDismiss(alertInstance) {
XhmikosR's avatar
Dist.  
XhmikosR committed
952
953
954
955
956
957
958
    return function (event) {
      if (event) {
        event.preventDefault();
      }

      alertInstance.close(this);
    };
XhmikosR's avatar
XhmikosR committed
959
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
960

XhmikosR's avatar
XhmikosR committed
961
  Alert.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
962
    return Data.getData(element, DATA_KEY);
XhmikosR's avatar
XhmikosR committed
963
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
964

XhmikosR's avatar
XhmikosR committed
965
966
967
968
969
970
971
972
973
  _createClass(Alert, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION;
    }
  }]);

  return Alert;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
974
975
976
977
978
979
980
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
981
982
EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DISMISS, Alert.handleDismiss(new Alert()));
var $$1 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
983
984
985
986
987
988
989
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .alert to jQuery only if jQuery is present
 */

990
991
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
992
993
994
995
if ($$1) {
  var JQUERY_NO_CONFLICT = $$1.fn[NAME];
  $$1.fn[NAME] = Alert.jQueryInterface;
  $$1.fn[NAME].Constructor = Alert;
XhmikosR's avatar
Dist.  
XhmikosR committed
996

XhmikosR's avatar
XhmikosR committed
997
998
999
  $$1.fn[NAME].noConflict = function () {
    $$1.fn[NAME] = JQUERY_NO_CONFLICT;
    return Alert.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
1000
  };
For faster browsing, not all history is shown. View entire blame