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
    },
    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 [];
For faster browsing, not all history is shown. View entire blame