bootstrap.esm.js 140 KB
Newer Older
XhmikosR's avatar
Dist.  
XhmikosR committed
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)
XhmikosR's avatar
Dist.  
XhmikosR committed
5
6
7
  */
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
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;
}

XhmikosR's avatar
XhmikosR committed
24
25
26
27
28
29
30
31
32
33
function _extends() {
  _extends = Object.assign || function (target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];

      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
XhmikosR's avatar
XhmikosR committed
34
35
    }

XhmikosR's avatar
XhmikosR committed
36
37
38
39
    return target;
  };

  return _extends.apply(this, arguments);
XhmikosR's avatar
XhmikosR committed
40
41
42
43
44
45
46
47
}

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

XhmikosR's avatar
Dist.  
XhmikosR committed
48
49
/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
50
 * Bootstrap (v5.0.0-alpha3): util/index.js
XhmikosR's avatar
XhmikosR committed
51
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
52
53
 * --------------------------------------------------------------------------
 */
XhmikosR's avatar
XhmikosR committed
54
55
var MAX_UID = 1000000;
var MILLISECONDS_MULTIPLIER = 1000;
XhmikosR's avatar
XhmikosR committed
56
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
XhmikosR's avatar
XhmikosR committed
57
58

var toType = function toType(obj) {
XhmikosR's avatar
XhmikosR committed
59
60
61
62
  if (obj === null || obj === undefined) {
    return "" + obj;
  }

XhmikosR's avatar
XhmikosR committed
63
64
  return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
};
XhmikosR's avatar
Dist.  
XhmikosR committed
65
66
67
68
69
70
71
/**
 * --------------------------------------------------------------------------
 * Public Util Api
 * --------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
72
var getUID = function getUID(prefix) {
XhmikosR's avatar
Dist.  
XhmikosR committed
73
  do {
Mark Otto's avatar
Mark Otto committed
74
    prefix += Math.floor(Math.random() * MAX_UID);
XhmikosR's avatar
Dist.  
XhmikosR committed
75
76
77
78
79
  } while (document.getElementById(prefix));

  return prefix;
};

XhmikosR's avatar
XhmikosR committed
80
var getSelector = function getSelector(element) {
XhmikosR's avatar
XhmikosR committed
81
  var selector = element.getAttribute('data-bs-target');
XhmikosR's avatar
Dist.  
XhmikosR committed
82
83

  if (!selector || selector === '#') {
XhmikosR's avatar
XhmikosR committed
84
    var hrefAttr = element.getAttribute('href');
XhmikosR's avatar
XhmikosR committed
85
    selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
86
87
  }

XhmikosR's avatar
XhmikosR committed
88
89
90
91
92
93
94
  return selector;
};

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

  if (selector) {
XhmikosR's avatar
Dist.  
XhmikosR committed
95
96
    return document.querySelector(selector) ? selector : null;
  }
XhmikosR's avatar
XhmikosR committed
97
98
99
100
101
102
103

  return null;
};

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

XhmikosR's avatar
XhmikosR committed
106
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
107
108
109
110
111
  if (!element) {
    return 0;
  } // Get transition-duration of the element


XhmikosR's avatar
XhmikosR committed
112
  var _window$getComputedSt = window.getComputedStyle(element),
XhmikosR's avatar
Dist.  
XhmikosR committed
113
114
115
      transitionDuration = _window$getComputedSt.transitionDuration,
      transitionDelay = _window$getComputedSt.transitionDelay;

XhmikosR's avatar
XhmikosR committed
116
117
  var floatTransitionDuration = Number.parseFloat(transitionDuration);
  var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
XhmikosR's avatar
Dist.  
XhmikosR committed
118
119
120
121
122
123
124
125

  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
126
  return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
XhmikosR's avatar
Dist.  
XhmikosR committed
127
128
};

XhmikosR's avatar
XhmikosR committed
129
var triggerTransitionEnd = function triggerTransitionEnd(element) {
XhmikosR's avatar
XhmikosR committed
130
  element.dispatchEvent(new Event(TRANSITION_END));
XhmikosR's avatar
Dist.  
XhmikosR committed
131
132
};

XhmikosR's avatar
XhmikosR committed
133
134
135
var isElement = function isElement(obj) {
  return (obj[0] || obj).nodeType;
};
XhmikosR's avatar
Dist.  
XhmikosR committed
136

XhmikosR's avatar
XhmikosR committed
137
138
139
140
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
  var called = false;
  var durationPadding = 5;
  var emulatedDuration = duration + durationPadding;
XhmikosR's avatar
Dist.  
XhmikosR committed
141
142
143
144
145
146
147

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

  element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
XhmikosR committed
148
  setTimeout(function () {
XhmikosR's avatar
Dist.  
XhmikosR committed
149
150
151
152
153
154
    if (!called) {
      triggerTransitionEnd(element);
    }
  }, emulatedDuration);
};

XhmikosR's avatar
XhmikosR committed
155
156
157
158
159
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
160
161

    if (!new RegExp(expectedTypes).test(valueType)) {
XhmikosR's avatar
XhmikosR committed
162
      throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
XhmikosR's avatar
Dist.  
XhmikosR committed
163
164
165
166
    }
  });
};

XhmikosR's avatar
XhmikosR committed
167
var isVisible = function isVisible(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
168
169
170
171
172
  if (!element) {
    return false;
  }

  if (element.style && element.parentNode && element.parentNode.style) {
XhmikosR's avatar
XhmikosR committed
173
174
175
    var elementStyle = getComputedStyle(element);
    var parentNodeStyle = getComputedStyle(element.parentNode);
    return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
XhmikosR's avatar
Dist.  
XhmikosR committed
176
177
178
179
180
  }

  return false;
};

XhmikosR's avatar
XhmikosR committed
181
var findShadowRoot = function findShadowRoot(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
182
183
184
185
186
187
  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
188
    var root = element.getRootNode();
XhmikosR's avatar
Dist.  
XhmikosR committed
189
190
191
192
193
194
195
196
197
198
199
200
201
    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
202
};
XhmikosR's avatar
Dist.  
XhmikosR committed
203

XhmikosR's avatar
XhmikosR committed
204
205
206
var noop = function noop() {
  return function () {};
};
XhmikosR's avatar
Dist.  
XhmikosR committed
207

XhmikosR's avatar
XhmikosR committed
208
209
210
var reflow = function reflow(element) {
  return element.offsetHeight;
};
XhmikosR's avatar
Dist.  
XhmikosR committed
211

XhmikosR's avatar
XhmikosR committed
212
213
214
215
var getjQuery = function getjQuery() {
  var _window = window,
      jQuery = _window.jQuery;

XhmikosR's avatar
XhmikosR committed
216
  if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
XhmikosR's avatar
XhmikosR committed
217
218
219
220
221
222
    return jQuery;
  }

  return null;
};

XhmikosR's avatar
XhmikosR committed
223
224
225
226
227
228
229
230
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', callback);
  } else {
    callback();
  }
};

XhmikosR's avatar
Dist.  
XhmikosR committed
231
232
/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
233
 * Bootstrap (v5.0.0-alpha3): dom/data.js
XhmikosR's avatar
XhmikosR committed
234
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
235
236
237
238
239
240
241
242
 * --------------------------------------------------------------------------
 */

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
XhmikosR committed
243
244
245
var mapData = function () {
  var storeData = {};
  var id = 1;
XhmikosR's avatar
Dist.  
XhmikosR committed
246
  return {
XhmikosR's avatar
XhmikosR committed
247
    set: function set(element, key, data) {
XhmikosR's avatar
XhmikosR committed
248
249
      if (typeof element.bsKey === 'undefined') {
        element.bsKey = {
XhmikosR's avatar
XhmikosR committed
250
251
          key: key,
          id: id
XhmikosR's avatar
Dist.  
XhmikosR committed
252
253
254
255
        };
        id++;
      }

XhmikosR's avatar
XhmikosR committed
256
      storeData[element.bsKey.id] = data;
XhmikosR's avatar
Dist.  
XhmikosR committed
257
    },
XhmikosR's avatar
XhmikosR committed
258
    get: function get(element, key) {
XhmikosR's avatar
XhmikosR committed
259
      if (!element || typeof element.bsKey === 'undefined') {
XhmikosR's avatar
Dist.  
XhmikosR committed
260
261
262
        return null;
      }

XhmikosR's avatar
XhmikosR committed
263
      var keyProperties = element.bsKey;
XhmikosR's avatar
Dist.  
XhmikosR committed
264
265
266
267
268
269
270

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

      return null;
    },
XhmikosR's avatar
XhmikosR committed
271
    delete: function _delete(element, key) {
XhmikosR's avatar
XhmikosR committed
272
      if (typeof element.bsKey === 'undefined') {
XhmikosR's avatar
Dist.  
XhmikosR committed
273
274
275
        return;
      }

XhmikosR's avatar
XhmikosR committed
276
      var keyProperties = element.bsKey;
XhmikosR's avatar
Dist.  
XhmikosR committed
277
278
279

      if (keyProperties.key === key) {
        delete storeData[keyProperties.id];
XhmikosR's avatar
XhmikosR committed
280
        delete element.bsKey;
XhmikosR's avatar
Dist.  
XhmikosR committed
281
282
283
      }
    }
  };
XhmikosR's avatar
XhmikosR committed
284
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
285

XhmikosR's avatar
XhmikosR committed
286
287
var Data = {
  setData: function setData(instance, key, data) {
XhmikosR's avatar
Dist.  
XhmikosR committed
288
289
    mapData.set(instance, key, data);
  },
XhmikosR's avatar
XhmikosR committed
290
  getData: function getData(instance, key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
291
292
    return mapData.get(instance, key);
  },
XhmikosR's avatar
XhmikosR committed
293
  removeData: function removeData(instance, key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
294
295
    mapData.delete(instance, key);
  }
XhmikosR's avatar
XhmikosR committed
296
};
XhmikosR's avatar
Dist.  
XhmikosR committed
297
298
299

/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
300
 * Bootstrap (v5.0.0-alpha3): dom/event-handler.js
XhmikosR's avatar
XhmikosR committed
301
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
302
303
304
305
306
307
308
309
 * --------------------------------------------------------------------------
 */
/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
310
311
312
313
var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
var stripNameRegex = /\..*/;
var stripUidRegex = /::\d+$/;
var eventRegistry = {}; // Events storage
XhmikosR's avatar
Dist.  
XhmikosR committed
314

XhmikosR's avatar
XhmikosR committed
315
316
var uidEvent = 1;
var customEvents = {
XhmikosR's avatar
Dist.  
XhmikosR committed
317
318
319
  mouseenter: 'mouseover',
  mouseleave: 'mouseout'
};
XhmikosR's avatar
XhmikosR committed
320
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
Dist.  
XhmikosR committed
321
322
323
324
325
326
327
/**
 * ------------------------------------------------------------------------
 * Private methods
 * ------------------------------------------------------------------------
 */

function getUidEvent(element, uid) {
XhmikosR's avatar
XhmikosR committed
328
  return uid && uid + "::" + uidEvent++ || element.uidEvent || uidEvent++;
XhmikosR's avatar
Dist.  
XhmikosR committed
329
330
331
}

function getEvent(element) {
XhmikosR's avatar
XhmikosR committed
332
  var uid = getUidEvent(element);
XhmikosR's avatar
Dist.  
XhmikosR committed
333
334
335
336
337
338
339
  element.uidEvent = uid;
  eventRegistry[uid] = eventRegistry[uid] || {};
  return eventRegistry[uid];
}

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

XhmikosR's avatar
Dist.  
XhmikosR committed
342
343
344
345
346
347
348
349
350
351
    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
352
    var domElements = element.querySelectorAll(selector);
XhmikosR's avatar
Dist.  
XhmikosR committed
353

XhmikosR's avatar
XhmikosR committed
354
355
    for (var target = event.target; target && target !== this; target = target.parentNode) {
      for (var i = domElements.length; i--;) {
XhmikosR's avatar
Dist.  
XhmikosR committed
356
        if (domElements[i] === target) {
XhmikosR's avatar
XhmikosR committed
357
358
          event.delegateTarget = target;

XhmikosR's avatar
Dist.  
XhmikosR committed
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
          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
378
379
380
381
  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
382
383

    if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
Mark Otto's avatar
dist v5    
Mark Otto committed
384
      return event;
XhmikosR's avatar
Dist.  
XhmikosR committed
385
386
387
388
389
390
391
    }
  }

  return null;
}

function normalizeParams(originalTypeEvent, handler, delegationFn) {
XhmikosR's avatar
XhmikosR committed
392
393
  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
394

XhmikosR's avatar
XhmikosR committed
395
396
  var typeEvent = originalTypeEvent.replace(stripNameRegex, '');
  var custom = customEvents[typeEvent];
XhmikosR's avatar
Dist.  
XhmikosR committed
397
398
399
400
401

  if (custom) {
    typeEvent = custom;
  }

XhmikosR's avatar
XhmikosR committed
402
  var isNative = nativeEvents.has(typeEvent);
XhmikosR's avatar
Dist.  
XhmikosR committed
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420

  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
421
422
423
424
  var _normalizeParams = normalizeParams(originalTypeEvent, handler, delegationFn),
      delegation = _normalizeParams[0],
      originalHandler = _normalizeParams[1],
      typeEvent = _normalizeParams[2];
XhmikosR's avatar
Dist.  
XhmikosR committed
425

XhmikosR's avatar
XhmikosR committed
426
427
428
  var events = getEvent(element);
  var handlers = events[typeEvent] || (events[typeEvent] = {});
  var previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
XhmikosR's avatar
Dist.  
XhmikosR committed
429
430
431
432
433
434

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

XhmikosR's avatar
XhmikosR committed
435
436
  var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
  var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
Dist.  
XhmikosR committed
437
438
439
440
441
442
443
444
445
  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
446
  var fn = findHandler(events[typeEvent], handler, delegationSelector);
XhmikosR's avatar
Dist.  
XhmikosR committed
447

Mark Otto's avatar
dist v5    
Mark Otto committed
448
  if (!fn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
449
450
451
452
453
454
455
456
    return;
  }

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

function removeNamespacedHandlers(element, events, typeEvent, namespace) {
XhmikosR's avatar
XhmikosR committed
457
458
  var storeElementEvent = events[typeEvent] || {};
  Object.keys(storeElementEvent).forEach(function (handlerKey) {
XhmikosR's avatar
XhmikosR committed
459
    if (handlerKey.includes(namespace)) {
XhmikosR's avatar
XhmikosR committed
460
      var event = storeElementEvent[handlerKey];
XhmikosR's avatar
Dist.  
XhmikosR committed
461
462
463
464
465
      removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
    }
  });
}

XhmikosR's avatar
XhmikosR committed
466
467
var EventHandler = {
  on: function on(element, event, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
468
469
    addHandler(element, event, handler, delegationFn, false);
  },
XhmikosR's avatar
XhmikosR committed
470
  one: function one(element, event, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
471
472
    addHandler(element, event, handler, delegationFn, true);
  },
XhmikosR's avatar
XhmikosR committed
473
  off: function off(element, originalTypeEvent, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
474
475
476
477
    if (typeof originalTypeEvent !== 'string' || !element) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
478
479
480
481
    var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
        delegation = _normalizeParams2[0],
        originalHandler = _normalizeParams2[1],
        typeEvent = _normalizeParams2[2];
XhmikosR's avatar
Dist.  
XhmikosR committed
482

XhmikosR's avatar
XhmikosR committed
483
484
    var inNamespace = typeEvent !== originalTypeEvent;
    var events = getEvent(element);
XhmikosR's avatar
XhmikosR committed
485
    var isNamespace = originalTypeEvent.startsWith('.');
XhmikosR's avatar
Dist.  
XhmikosR committed
486
487
488
489
490
491
492
493
494
495
496
497

    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
498
      Object.keys(events).forEach(function (elementEvent) {
XhmikosR's avatar
XhmikosR committed
499
        removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
XhmikosR's avatar
Dist.  
XhmikosR committed
500
501
502
      });
    }

XhmikosR's avatar
XhmikosR committed
503
504
505
    var storeElementEvent = events[typeEvent] || {};
    Object.keys(storeElementEvent).forEach(function (keyHandlers) {
      var handlerKey = keyHandlers.replace(stripUidRegex, '');
XhmikosR's avatar
Dist.  
XhmikosR committed
506

XhmikosR's avatar
XhmikosR committed
507
      if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
XhmikosR's avatar
XhmikosR committed
508
        var event = storeElementEvent[keyHandlers];
XhmikosR's avatar
Dist.  
XhmikosR committed
509
510
511
512
        removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
      }
    });
  },
XhmikosR's avatar
XhmikosR committed
513
  trigger: function trigger(element, event, args) {
XhmikosR's avatar
Dist.  
XhmikosR committed
514
515
516
517
    if (typeof event !== 'string' || !element) {
      return null;
    }

XhmikosR's avatar
XhmikosR committed
518
    var $ = getjQuery();
XhmikosR's avatar
XhmikosR committed
519
520
    var typeEvent = event.replace(stripNameRegex, '');
    var inNamespace = event !== typeEvent;
XhmikosR's avatar
XhmikosR committed
521
    var isNative = nativeEvents.has(typeEvent);
XhmikosR's avatar
XhmikosR committed
522
523
524
525
526
    var jQueryEvent;
    var bubbles = true;
    var nativeDispatch = true;
    var defaultPrevented = false;
    var evt = null;
XhmikosR's avatar
Dist.  
XhmikosR committed
527

XhmikosR's avatar
XhmikosR committed
528
529
530
    if (inNamespace && $) {
      jQueryEvent = $.Event(event, args);
      $(element).trigger(jQueryEvent);
XhmikosR's avatar
Dist.  
XhmikosR committed
531
532
533
534
535
536
537
538
539
      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
540
      evt = new CustomEvent(event, {
XhmikosR's avatar
XhmikosR committed
541
        bubbles: bubbles,
XhmikosR's avatar
Dist.  
XhmikosR committed
542
543
        cancelable: true
      });
XhmikosR's avatar
XhmikosR committed
544
    } // merge custom information in our event
XhmikosR's avatar
Dist.  
XhmikosR committed
545
546
547


    if (typeof args !== 'undefined') {
XhmikosR's avatar
XhmikosR committed
548
      Object.keys(args).forEach(function (key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
549
        Object.defineProperty(evt, key, {
XhmikosR's avatar
XhmikosR committed
550
          get: function get() {
XhmikosR's avatar
Dist.  
XhmikosR committed
551
552
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
            return args[key];
          }
        });
      });
    }

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

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

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

    return evt;
  }
};

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

XhmikosR's avatar
XhmikosR committed
579
var NAME = 'alert';
XhmikosR's avatar
XhmikosR committed
580
var VERSION = '5.0.0-alpha3';
XhmikosR's avatar
XhmikosR committed
581
582
583
var DATA_KEY = 'bs.alert';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
XhmikosR's avatar
XhmikosR committed
584
var SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
XhmikosR's avatar
XhmikosR committed
585
586
587
588
589
590
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
591
592
593
594
595
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
596

XhmikosR's avatar
XhmikosR committed
597
var Alert = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
598
  function Alert(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
599
600
601
602
603
604
605
606
    this._element = element;

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


XhmikosR's avatar
XhmikosR committed
607
  var _proto = Alert.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
608

XhmikosR's avatar
XhmikosR committed
609
610
  // Public
  _proto.close = function close(element) {
XhmikosR's avatar
XhmikosR committed
611
    var rootElement = element ? this._getRootElement(element) : this._element;
XhmikosR's avatar
Dist.  
XhmikosR committed
612

XhmikosR's avatar
XhmikosR committed
613
    var customEvent = this._triggerCloseEvent(rootElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
614
615
616
617
618
619

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

    this._removeElement(rootElement);
XhmikosR's avatar
XhmikosR committed
620
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
621

XhmikosR's avatar
XhmikosR committed
622
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
623
624
625
    Data.removeData(this._element, DATA_KEY);
    this._element = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
626
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
627

XhmikosR's avatar
XhmikosR committed
628
  _proto._getRootElement = function _getRootElement(element) {
XhmikosR's avatar
XhmikosR committed
629
    return getElementFromSelector(element) || element.closest("." + CLASSNAME_ALERT);
XhmikosR's avatar
XhmikosR committed
630
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
631

XhmikosR's avatar
XhmikosR committed
632
  _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
XhmikosR's avatar
XhmikosR committed
633
    return EventHandler.trigger(element, EVENT_CLOSE);
XhmikosR's avatar
XhmikosR committed
634
635
636
637
  };

  _proto._removeElement = function _removeElement(element) {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
638

XhmikosR's avatar
XhmikosR committed
639
    element.classList.remove(CLASSNAME_SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
640

XhmikosR's avatar
XhmikosR committed
641
    if (!element.classList.contains(CLASSNAME_FADE)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
642
643
644
645
646
      this._destroyElement(element);

      return;
    }

XhmikosR's avatar
XhmikosR committed
647
    var transitionDuration = getTransitionDurationFromElement(element);
648
649
    EventHandler.one(element, TRANSITION_END, function () {
      return _this._destroyElement(element);
XhmikosR's avatar
XhmikosR committed
650
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
651
    emulateTransitionEnd(element, transitionDuration);
XhmikosR's avatar
XhmikosR committed
652
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
653

XhmikosR's avatar
XhmikosR committed
654
  _proto._destroyElement = function _destroyElement(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
655
656
657
658
    if (element.parentNode) {
      element.parentNode.removeChild(element);
    }

XhmikosR's avatar
XhmikosR committed
659
    EventHandler.trigger(element, EVENT_CLOSED);
XhmikosR's avatar
Dist.  
XhmikosR committed
660
  } // Static
XhmikosR's avatar
XhmikosR committed
661
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
662

XhmikosR's avatar
XhmikosR committed
663
  Alert.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
664
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
665
      var data = Data.getData(this, DATA_KEY);
XhmikosR's avatar
Dist.  
XhmikosR committed
666
667
668
669
670
671
672
673
674

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

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

XhmikosR's avatar
XhmikosR committed
677
  Alert.handleDismiss = function handleDismiss(alertInstance) {
XhmikosR's avatar
Dist.  
XhmikosR committed
678
679
680
681
682
683
684
    return function (event) {
      if (event) {
        event.preventDefault();
      }

      alertInstance.close(this);
    };
XhmikosR's avatar
XhmikosR committed
685
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
686

XhmikosR's avatar
XhmikosR committed
687
  Alert.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
688
    return Data.getData(element, DATA_KEY);
XhmikosR's avatar
XhmikosR committed
689
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
690

XhmikosR's avatar
XhmikosR committed
691
692
693
694
695
696
697
698
699
  _createClass(Alert, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION;
    }
  }]);

  return Alert;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
700
701
702
703
704
705
706
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
707
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
XhmikosR's avatar
Dist.  
XhmikosR committed
708
709
710
711
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
712
 * add .Alert to jQuery only if jQuery is present
XhmikosR's avatar
Dist.  
XhmikosR committed
713
714
 */

XhmikosR's avatar
XhmikosR committed
715
716
717
onDOMContentLoaded(function () {
  var $ = getjQuery();
  /* istanbul ignore if */
718

XhmikosR's avatar
XhmikosR committed
719
720
721
722
  if ($) {
    var JQUERY_NO_CONFLICT = $.fn[NAME];
    $.fn[NAME] = Alert.jQueryInterface;
    $.fn[NAME].Constructor = Alert;
XhmikosR's avatar
Dist.  
XhmikosR committed
723

XhmikosR's avatar
XhmikosR committed
724
725
726
727
728
729
    $.fn[NAME].noConflict = function () {
      $.fn[NAME] = JQUERY_NO_CONFLICT;
      return Alert.jQueryInterface;
    };
  }
});
XhmikosR's avatar
Dist.  
XhmikosR committed
730
731
732
733
734
735
736

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

XhmikosR's avatar
XhmikosR committed
737
var NAME$1 = 'button';
XhmikosR's avatar
XhmikosR committed
738
var VERSION$1 = '5.0.0-alpha3';
XhmikosR's avatar
XhmikosR committed
739
740
741
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
742
var CLASS_NAME_ACTIVE = 'active';
XhmikosR's avatar
XhmikosR committed
743
var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]';
XhmikosR's avatar
XhmikosR committed
744
var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
XhmikosR's avatar
XhmikosR committed
745
746
747
748
749
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
750

XhmikosR's avatar
XhmikosR committed
751
var Button = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
752
  function Button(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
753
754
755
756
757
    this._element = element;
    Data.setData(element, DATA_KEY$1, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
758
  var _proto = Button.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
759

XhmikosR's avatar
XhmikosR committed
760
761
  // Public
  _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
762
763
    // 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
XhmikosR committed
764
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
765

XhmikosR's avatar
XhmikosR committed
766
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
767
768
769
    Data.removeData(this._element, DATA_KEY$1);
    this._element = null;
  } // Static
XhmikosR's avatar
XhmikosR committed
770
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
771

XhmikosR's avatar
XhmikosR committed
772
  Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
773
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
774
      var data = Data.getData(this, DATA_KEY$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
775
776
777
778
779
780
781
782
783

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

      if (config === 'toggle') {
        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
784
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
785

XhmikosR's avatar
XhmikosR committed
786
  Button.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
787
    return Data.getData(element, DATA_KEY$1);
XhmikosR's avatar
XhmikosR committed
788
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
789

XhmikosR's avatar
XhmikosR committed
790
791
792
793
794
795
796
797
798
  _createClass(Button, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$1;
    }
  }]);

  return Button;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
799
800
801
802
803
804
805
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
806
EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
807
  event.preventDefault();
XhmikosR's avatar
XhmikosR committed
808
  var button = event.target.closest(SELECTOR_DATA_TOGGLE);
XhmikosR's avatar
XhmikosR committed
809
  var data = Data.getData(button, DATA_KEY$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
810
811
812
813
814
815
816
817
818
819
820

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

  data.toggle();
});
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
821
 * add .Button to jQuery only if jQuery is present
XhmikosR's avatar
Dist.  
XhmikosR committed
822
823
 */

XhmikosR's avatar
XhmikosR committed
824
825
826
onDOMContentLoaded(function () {
  var $ = getjQuery();
  /* istanbul ignore if */
827

XhmikosR's avatar
XhmikosR committed
828
829
830
831
  if ($) {
    var JQUERY_NO_CONFLICT = $.fn[NAME$1];
    $.fn[NAME$1] = Button.jQueryInterface;
    $.fn[NAME$1].Constructor = Button;
XhmikosR's avatar
Dist.  
XhmikosR committed
832

XhmikosR's avatar
XhmikosR committed
833
834
835
836
837
838
    $.fn[NAME$1].noConflict = function () {
      $.fn[NAME$1] = JQUERY_NO_CONFLICT;
      return Button.jQueryInterface;
    };
  }
});
XhmikosR's avatar
Dist.  
XhmikosR committed
839
840
841

/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
842
 * Bootstrap (v5.0.0-alpha3): dom/manipulator.js
XhmikosR's avatar
XhmikosR committed
843
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
 * --------------------------------------------------------------------------
 */
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) {
XhmikosR's avatar
XhmikosR committed
867
  return key.replace(/[A-Z]/g, function (chr) {
XhmikosR's avatar
XhmikosR committed
868
    return "-" + chr.toLowerCase();
XhmikosR's avatar
XhmikosR committed
869
  });
XhmikosR's avatar
Dist.  
XhmikosR committed
870
871
}

XhmikosR's avatar
XhmikosR committed
872
873
var Manipulator = {
  setDataAttribute: function setDataAttribute(element, key, value) {
XhmikosR's avatar
XhmikosR committed
874
    element.setAttribute("data-bs-" + normalizeDataKey(key), value);
XhmikosR's avatar
Dist.  
XhmikosR committed
875
  },
XhmikosR's avatar
XhmikosR committed
876
  removeDataAttribute: function removeDataAttribute(element, key) {
XhmikosR's avatar
XhmikosR committed
877
    element.removeAttribute("data-bs-" + normalizeDataKey(key));
XhmikosR's avatar
Dist.  
XhmikosR committed
878
  },
XhmikosR's avatar
XhmikosR committed
879
  getDataAttributes: function getDataAttributes(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
880
881
882
883
    if (!element) {
      return {};
    }

XhmikosR's avatar
XhmikosR committed
884
885
886
887
888
889
890
    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
Dist.  
XhmikosR committed
891
892
893
    });
    return attributes;
  },
XhmikosR's avatar
XhmikosR committed
894
  getDataAttribute: function getDataAttribute(element, key) {
XhmikosR's avatar
XhmikosR committed
895
    return normalizeData(element.getAttribute("data-bs-" + normalizeDataKey(key)));
XhmikosR's avatar
Dist.  
XhmikosR committed
896
  },
XhmikosR's avatar
XhmikosR committed
897
898
  offset: function offset(element) {
    var rect = element.getBoundingClientRect();
XhmikosR's avatar
Dist.  
XhmikosR committed
899
900
901
902
903
    return {
      top: rect.top + document.body.scrollTop,
      left: rect.left + document.body.scrollLeft
    };
  },
XhmikosR's avatar
XhmikosR committed
904
  position: function position(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
905
906
907
908
909
910
911
    return {
      top: element.offsetTop,
      left: element.offsetLeft
    };
  }
};

XhmikosR's avatar
XhmikosR committed
912
913
/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
914
 * Bootstrap (v5.0.0-alpha3): dom/selector-engine.js
XhmikosR's avatar
XhmikosR committed
915
916
917
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 * --------------------------------------------------------------------------
 */
XhmikosR's avatar
XhmikosR committed
918

XhmikosR's avatar
XhmikosR committed
919
920
921
922
923
924
925
926
927
928
/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */
var NODE_TEXT = 3;
var SelectorEngine = {
  matches: function matches(element, selector) {
    return element.matches(selector);
  },
XhmikosR's avatar
XhmikosR committed
929
  find: function find(selector, element) {
XhmikosR's avatar
XhmikosR committed
930
931
932
933
934
935
    var _ref;

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

XhmikosR's avatar
XhmikosR committed
936
    return (_ref = []).concat.apply(_ref, Element.prototype.querySelectorAll.call(element, selector));
XhmikosR's avatar
XhmikosR committed
937
  },
XhmikosR's avatar
XhmikosR committed
938
  findOne: function findOne(selector, element) {
XhmikosR's avatar
XhmikosR committed
939
940
941
942
    if (element === void 0) {
      element = document.documentElement;
    }

XhmikosR's avatar
XhmikosR committed
943
    return Element.prototype.querySelector.call(element, selector);
XhmikosR's avatar
XhmikosR committed
944
945
946
947
948
949
950
951
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
  },
  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 [];
  }
};

XhmikosR's avatar
Dist.  
XhmikosR committed
996
997
998
999
1000
/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */
For faster browsing, not all history is shown. View entire blame