administrate-bootstrap-theme 0.2.0 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +71 -37
  3. data/app/assets/javascripts/administrate-bootstrap-theme/{bootstrap/bootstrap.bundle.js → bootstrap.bundle.js} +1376 -1310
  4. data/app/assets/stylesheets/administrate-bootstrap-theme/_base.scss +4 -21
  5. data/app/assets/stylesheets/administrate-bootstrap-theme/_variables.scss +4 -0
  6. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_accordion.scss +4 -2
  7. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_card.scss +7 -6
  8. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_carousel.scss +2 -2
  9. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_dropdown.scss +11 -17
  10. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_functions.scss +94 -3
  11. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_grid.scss +11 -0
  12. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_helpers.scss +2 -0
  13. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_images.scss +1 -1
  14. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_list-group.scss +5 -5
  15. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_mixins.scss +2 -0
  16. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_modal.scss +7 -35
  17. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_navbar.scss +30 -1
  18. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_offcanvas.scss +19 -13
  19. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_placeholders.scss +51 -0
  20. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_popover.scss +10 -10
  21. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_reboot.scss +12 -8
  22. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_root.scss +39 -2
  23. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_spinners.scss +2 -2
  24. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_tables.scss +1 -0
  25. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_toasts.scss +3 -3
  26. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_tooltip.scss +4 -4
  27. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_transitions.scss +6 -0
  28. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_utilities.scss +44 -8
  29. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_variables.scss +193 -28
  30. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/bootstrap-grid.scss +1 -1
  31. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/bootstrap-reboot.scss +1 -1
  32. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/bootstrap-utilities.scss +1 -1
  33. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/bootstrap.scss +2 -1
  34. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/forms/_floating-labels.scss +3 -1
  35. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/forms/_form-check.scss +1 -1
  36. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/forms/_form-control.scss +1 -1
  37. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/forms/_form-range.scss +1 -1
  38. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/forms/_form-select.scss +3 -0
  39. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/helpers/_stacks.scss +15 -0
  40. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/helpers/_vr.scss +8 -0
  41. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/mixins/_backdrop.scss +14 -0
  42. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/mixins/_buttons.scss +1 -1
  43. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/mixins/_color-scheme.scss +7 -0
  44. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/mixins/_forms.scss +15 -5
  45. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/mixins/_grid.scss +40 -10
  46. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/mixins/_utilities.scss +27 -6
  47. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/vendor/_rfs.scss +55 -13
  48. data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_autumn.scss +8 -0
  49. data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_default.scss +8 -0
  50. data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_forest.scss +9 -0
  51. data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_industrial.scss +8 -0
  52. data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_water.scss +8 -0
  53. data/app/assets/stylesheets/administrate-bootstrap-theme/components/_content_body.scss +28 -10
  54. data/app/assets/stylesheets/administrate-bootstrap-theme/components/_content_header.scss +4 -6
  55. data/app/assets/stylesheets/administrate-bootstrap-theme/components/_form.scss +6 -6
  56. data/app/assets/stylesheets/administrate-bootstrap-theme/components/_navigation.scss +26 -3
  57. data/app/assets/stylesheets/administrate-bootstrap-theme/components/_pagination.scss +1 -1
  58. data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_lato.scss +5 -0
  59. data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_montserrat.scss +5 -0
  60. data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_open_sans.scss +5 -0
  61. data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_roboto.scss +5 -0
  62. data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_source_sans_pro.scss +5 -0
  63. data/app/assets/stylesheets/administrate-bootstrap-theme/theme.scss +10 -61
  64. data/lib/administrate-bootstrap-theme/version.rb +2 -1
  65. data/lib/generators/administrate_bootstrap_theme/install/USAGE +10 -0
  66. data/lib/generators/administrate_bootstrap_theme/install/install_generator.rb +33 -0
  67. data/package.json +10 -0
  68. metadata +24 -9
  69. data/Rakefile +0 -16
  70. data/app/assets/javascripts/administrate-bootstrap-theme/flatpickr/flatpickr.js +0 -2673
  71. data/app/assets/javascripts/administrate-bootstrap-theme/theme.js +0 -22
  72. data/app/assets/stylesheets/administrate-bootstrap-theme/flatpickr/flatpickr.css +0 -791
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap v5.0.0-beta3 (https://getbootstrap.com/)
2
+ * Bootstrap v5.1.0 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0-beta3): util/index.js
14
+ * Bootstrap (v5.1.0): util/index.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
@@ -56,7 +56,7 @@
56
56
 
57
57
 
58
58
  if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
59
- hrefAttr = '#' + hrefAttr.split('#')[1];
59
+ hrefAttr = `#${hrefAttr.split('#')[1]}`;
60
60
  }
61
61
 
62
62
  selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@@ -107,24 +107,29 @@
107
107
  element.dispatchEvent(new Event(TRANSITION_END));
108
108
  };
109
109
 
110
- const isElement$1 = obj => (obj[0] || obj).nodeType;
110
+ const isElement$1 = obj => {
111
+ if (!obj || typeof obj !== 'object') {
112
+ return false;
113
+ }
111
114
 
112
- const emulateTransitionEnd = (element, duration) => {
113
- let called = false;
114
- const durationPadding = 5;
115
- const emulatedDuration = duration + durationPadding;
115
+ if (typeof obj.jquery !== 'undefined') {
116
+ obj = obj[0];
117
+ }
116
118
 
117
- function listener() {
118
- called = true;
119
- element.removeEventListener(TRANSITION_END, listener);
119
+ return typeof obj.nodeType !== 'undefined';
120
+ };
121
+
122
+ const getElement = obj => {
123
+ if (isElement$1(obj)) {
124
+ // it's a jQuery object or a node element
125
+ return obj.jquery ? obj[0] : obj;
120
126
  }
121
127
 
122
- element.addEventListener(TRANSITION_END, listener);
123
- setTimeout(() => {
124
- if (!called) {
125
- triggerTransitionEnd(element);
126
- }
127
- }, emulatedDuration);
128
+ if (typeof obj === 'string' && obj.length > 0) {
129
+ return document.querySelector(obj);
130
+ }
131
+
132
+ return null;
128
133
  };
129
134
 
130
135
  const typeCheckConfig = (componentName, config, configTypes) => {
@@ -134,23 +139,17 @@
134
139
  const valueType = value && isElement$1(value) ? 'element' : toType(value);
135
140
 
136
141
  if (!new RegExp(expectedTypes).test(valueType)) {
137
- throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`);
142
+ throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
138
143
  }
139
144
  });
140
145
  };
141
146
 
142
147
  const isVisible = element => {
143
- if (!element) {
148
+ if (!isElement$1(element) || element.getClientRects().length === 0) {
144
149
  return false;
145
150
  }
146
151
 
147
- if (element.style && element.parentNode && element.parentNode.style) {
148
- const elementStyle = getComputedStyle(element);
149
- const parentNodeStyle = getComputedStyle(element.parentNode);
150
- return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
151
- }
152
-
153
- return false;
152
+ return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
154
153
  };
155
154
 
156
155
  const isDisabled = element => {
@@ -192,9 +191,21 @@
192
191
  return findShadowRoot(element.parentNode);
193
192
  };
194
193
 
195
- const noop = () => function () {};
194
+ const noop = () => {};
195
+ /**
196
+ * Trick to restart an element's animation
197
+ *
198
+ * @param {HTMLElement} element
199
+ * @return void
200
+ *
201
+ * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
202
+ */
203
+
196
204
 
197
- const reflow = element => element.offsetHeight;
205
+ const reflow = element => {
206
+ // eslint-disable-next-line no-unused-expressions
207
+ element.offsetHeight;
208
+ };
198
209
 
199
210
  const getjQuery = () => {
200
211
  const {
@@ -208,9 +219,18 @@
208
219
  return null;
209
220
  };
210
221
 
222
+ const DOMContentLoadedCallbacks = [];
223
+
211
224
  const onDOMContentLoaded = callback => {
212
225
  if (document.readyState === 'loading') {
213
- document.addEventListener('DOMContentLoaded', callback);
226
+ // add listener on the first call when the document is in loading state
227
+ if (!DOMContentLoadedCallbacks.length) {
228
+ document.addEventListener('DOMContentLoaded', () => {
229
+ DOMContentLoadedCallbacks.forEach(callback => callback());
230
+ });
231
+ }
232
+
233
+ DOMContentLoadedCallbacks.push(callback);
214
234
  } else {
215
235
  callback();
216
236
  }
@@ -218,12 +238,13 @@
218
238
 
219
239
  const isRTL = () => document.documentElement.dir === 'rtl';
220
240
 
221
- const defineJQueryPlugin = (name, plugin) => {
241
+ const defineJQueryPlugin = plugin => {
222
242
  onDOMContentLoaded(() => {
223
243
  const $ = getjQuery();
224
244
  /* istanbul ignore if */
225
245
 
226
246
  if ($) {
247
+ const name = plugin.NAME;
227
248
  const JQUERY_NO_CONFLICT = $.fn[name];
228
249
  $.fn[name] = plugin.jQueryInterface;
229
250
  $.fn[name].Constructor = plugin;
@@ -236,63 +257,72 @@
236
257
  });
237
258
  };
238
259
 
239
- /**
240
- * --------------------------------------------------------------------------
241
- * Bootstrap (v5.0.0-beta3): dom/data.js
242
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
243
- * --------------------------------------------------------------------------
244
- */
260
+ const execute = callback => {
261
+ if (typeof callback === 'function') {
262
+ callback();
263
+ }
264
+ };
245
265
 
246
- /**
247
- * ------------------------------------------------------------------------
248
- * Constants
249
- * ------------------------------------------------------------------------
250
- */
251
- const elementMap = new Map();
252
- var Data = {
253
- set(element, key, instance) {
254
- if (!elementMap.has(element)) {
255
- elementMap.set(element, new Map());
256
- }
266
+ const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
267
+ if (!waitForTransition) {
268
+ execute(callback);
269
+ return;
270
+ }
257
271
 
258
- const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
259
- // can be removed later when multiple key/instances are fine to be used
272
+ const durationPadding = 5;
273
+ const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
274
+ let called = false;
260
275
 
261
- if (!instanceMap.has(key) && instanceMap.size !== 0) {
262
- // eslint-disable-next-line no-console
263
- console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
276
+ const handler = ({
277
+ target
278
+ }) => {
279
+ if (target !== transitionElement) {
264
280
  return;
265
281
  }
266
282
 
267
- instanceMap.set(key, instance);
268
- },
283
+ called = true;
284
+ transitionElement.removeEventListener(TRANSITION_END, handler);
285
+ execute(callback);
286
+ };
269
287
 
270
- get(element, key) {
271
- if (elementMap.has(element)) {
272
- return elementMap.get(element).get(key) || null;
288
+ transitionElement.addEventListener(TRANSITION_END, handler);
289
+ setTimeout(() => {
290
+ if (!called) {
291
+ triggerTransitionEnd(transitionElement);
273
292
  }
293
+ }, emulatedDuration);
294
+ };
295
+ /**
296
+ * Return the previous/next element of a list.
297
+ *
298
+ * @param {array} list The list of elements
299
+ * @param activeElement The active element
300
+ * @param shouldGetNext Choose to get next or previous element
301
+ * @param isCycleAllowed
302
+ * @return {Element|elem} The proper element
303
+ */
274
304
 
275
- return null;
276
- },
277
305
 
278
- remove(element, key) {
279
- if (!elementMap.has(element)) {
280
- return;
281
- }
306
+ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
307
+ let index = list.indexOf(activeElement); // if the element does not exist in the list return an element depending on the direction and if cycle is allowed
282
308
 
283
- const instanceMap = elementMap.get(element);
284
- instanceMap.delete(key); // free up element references if there are no instances left for an element
309
+ if (index === -1) {
310
+ return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
311
+ }
285
312
 
286
- if (instanceMap.size === 0) {
287
- elementMap.delete(element);
288
- }
313
+ const listLength = list.length;
314
+ index += shouldGetNext ? 1 : -1;
315
+
316
+ if (isCycleAllowed) {
317
+ index = (index + listLength) % listLength;
289
318
  }
290
319
 
320
+ return list[Math.max(0, Math.min(index, listLength - 1))];
291
321
  };
292
322
 
293
323
  /**
294
324
  * --------------------------------------------------------------------------
295
- * Bootstrap (v5.0.0-beta3): dom/event-handler.js
325
+ * Bootstrap (v5.1.0): dom/event-handler.js
296
326
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
297
327
  * --------------------------------------------------------------------------
298
328
  */
@@ -312,6 +342,7 @@
312
342
  mouseenter: 'mouseover',
313
343
  mouseleave: 'mouseout'
314
344
  };
345
+ const customEventsRegex = /^(mouseenter|mouseleave)/i;
315
346
  const 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']);
316
347
  /**
317
348
  * ------------------------------------------------------------------------
@@ -355,7 +386,7 @@
355
386
 
356
387
  if (handler.oneOff) {
357
388
  // eslint-disable-next-line unicorn/consistent-destructuring
358
- EventHandler.off(element, event.type, fn);
389
+ EventHandler.off(element, event.type, selector, fn);
359
390
  }
360
391
 
361
392
  return fn.apply(target, [event]);
@@ -384,15 +415,8 @@
384
415
 
385
416
  function normalizeParams(originalTypeEvent, handler, delegationFn) {
386
417
  const delegation = typeof handler === 'string';
387
- const originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
388
-
389
- let typeEvent = originalTypeEvent.replace(stripNameRegex, '');
390
- const custom = customEvents[typeEvent];
391
-
392
- if (custom) {
393
- typeEvent = custom;
394
- }
395
-
418
+ const originalHandler = delegation ? delegationFn : handler;
419
+ let typeEvent = getTypeEvent(originalTypeEvent);
396
420
  const isNative = nativeEvents.has(typeEvent);
397
421
 
398
422
  if (!isNative) {
@@ -410,6 +434,24 @@
410
434
  if (!handler) {
411
435
  handler = delegationFn;
412
436
  delegationFn = null;
437
+ } // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
438
+ // this prevents the handler from being dispatched the same way as mouseover or mouseout does
439
+
440
+
441
+ if (customEventsRegex.test(originalTypeEvent)) {
442
+ const wrapFn = fn => {
443
+ return function (event) {
444
+ if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
445
+ return fn.call(this, event);
446
+ }
447
+ };
448
+ };
449
+
450
+ if (delegationFn) {
451
+ delegationFn = wrapFn(delegationFn);
452
+ } else {
453
+ handler = wrapFn(handler);
454
+ }
413
455
  }
414
456
 
415
457
  const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
@@ -453,6 +495,12 @@
453
495
  });
454
496
  }
455
497
 
498
+ function getTypeEvent(event) {
499
+ // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
500
+ event = event.replace(stripNameRegex, '');
501
+ return customEvents[event] || event;
502
+ }
503
+
456
504
  const EventHandler = {
457
505
  on(element, event, handler, delegationFn) {
458
506
  addHandler(element, event, handler, delegationFn, false);
@@ -505,7 +553,7 @@
505
553
  }
506
554
 
507
555
  const $ = getjQuery();
508
- const typeEvent = event.replace(stripNameRegex, '');
556
+ const typeEvent = getTypeEvent(event);
509
557
  const inNamespace = event !== typeEvent;
510
558
  const isNative = nativeEvents.has(typeEvent);
511
559
  let jQueryEvent;
@@ -563,7 +611,61 @@
563
611
 
564
612
  /**
565
613
  * --------------------------------------------------------------------------
566
- * Bootstrap (v5.0.0-beta3): base-component.js
614
+ * Bootstrap (v5.1.0): dom/data.js
615
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
616
+ * --------------------------------------------------------------------------
617
+ */
618
+
619
+ /**
620
+ * ------------------------------------------------------------------------
621
+ * Constants
622
+ * ------------------------------------------------------------------------
623
+ */
624
+ const elementMap = new Map();
625
+ var Data = {
626
+ set(element, key, instance) {
627
+ if (!elementMap.has(element)) {
628
+ elementMap.set(element, new Map());
629
+ }
630
+
631
+ const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
632
+ // can be removed later when multiple key/instances are fine to be used
633
+
634
+ if (!instanceMap.has(key) && instanceMap.size !== 0) {
635
+ // eslint-disable-next-line no-console
636
+ console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
637
+ return;
638
+ }
639
+
640
+ instanceMap.set(key, instance);
641
+ },
642
+
643
+ get(element, key) {
644
+ if (elementMap.has(element)) {
645
+ return elementMap.get(element).get(key) || null;
646
+ }
647
+
648
+ return null;
649
+ },
650
+
651
+ remove(element, key) {
652
+ if (!elementMap.has(element)) {
653
+ return;
654
+ }
655
+
656
+ const instanceMap = elementMap.get(element);
657
+ instanceMap.delete(key); // free up element references if there are no instances left for an element
658
+
659
+ if (instanceMap.size === 0) {
660
+ elementMap.delete(element);
661
+ }
662
+ }
663
+
664
+ };
665
+
666
+ /**
667
+ * --------------------------------------------------------------------------
668
+ * Bootstrap (v5.1.0): base-component.js
567
669
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
568
670
  * --------------------------------------------------------------------------
569
671
  */
@@ -573,11 +675,11 @@
573
675
  * ------------------------------------------------------------------------
574
676
  */
575
677
 
576
- const VERSION = '5.0.0-beta3';
678
+ const VERSION = '5.1.0';
577
679
 
578
680
  class BaseComponent {
579
681
  constructor(element) {
580
- element = typeof element === 'string' ? document.querySelector(element) : element;
682
+ element = getElement(element);
581
683
 
582
684
  if (!element) {
583
685
  return;
@@ -589,24 +691,73 @@
589
691
 
590
692
  dispose() {
591
693
  Data.remove(this._element, this.constructor.DATA_KEY);
592
- this._element = null;
694
+ EventHandler.off(this._element, this.constructor.EVENT_KEY);
695
+ Object.getOwnPropertyNames(this).forEach(propertyName => {
696
+ this[propertyName] = null;
697
+ });
698
+ }
699
+
700
+ _queueCallback(callback, element, isAnimated = true) {
701
+ executeAfterTransition(callback, element, isAnimated);
593
702
  }
594
703
  /** Static */
595
704
 
596
705
 
597
706
  static getInstance(element) {
598
- return Data.get(element, this.DATA_KEY);
707
+ return Data.get(getElement(element), this.DATA_KEY);
708
+ }
709
+
710
+ static getOrCreateInstance(element, config = {}) {
711
+ return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
599
712
  }
600
713
 
601
714
  static get VERSION() {
602
715
  return VERSION;
603
716
  }
604
717
 
718
+ static get NAME() {
719
+ throw new Error('You have to implement the static method "NAME", for each component!');
720
+ }
721
+
722
+ static get DATA_KEY() {
723
+ return `bs.${this.NAME}`;
724
+ }
725
+
726
+ static get EVENT_KEY() {
727
+ return `.${this.DATA_KEY}`;
728
+ }
729
+
605
730
  }
606
731
 
607
732
  /**
608
733
  * --------------------------------------------------------------------------
609
- * Bootstrap (v5.0.0-beta3): alert.js
734
+ * Bootstrap (v5.1.0): util/component-functions.js
735
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
736
+ * --------------------------------------------------------------------------
737
+ */
738
+
739
+ const enableDismissTrigger = (component, method = 'hide') => {
740
+ const clickEvent = `click.dismiss${component.EVENT_KEY}`;
741
+ const name = component.NAME;
742
+ EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
743
+ if (['A', 'AREA'].includes(this.tagName)) {
744
+ event.preventDefault();
745
+ }
746
+
747
+ if (isDisabled(this)) {
748
+ return;
749
+ }
750
+
751
+ const target = getElementFromSelector(this) || this.closest(`.${name}`);
752
+ const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
753
+
754
+ instance[method]();
755
+ });
756
+ };
757
+
758
+ /**
759
+ * --------------------------------------------------------------------------
760
+ * Bootstrap (v5.1.0): alert.js
610
761
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
611
762
  * --------------------------------------------------------------------------
612
763
  */
@@ -616,15 +767,11 @@
616
767
  * ------------------------------------------------------------------------
617
768
  */
618
769
 
619
- const NAME$b = 'alert';
620
- const DATA_KEY$b = 'bs.alert';
621
- const EVENT_KEY$b = `.${DATA_KEY$b}`;
622
- const DATA_API_KEY$8 = '.data-api';
623
- const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
624
- const EVENT_CLOSE = `close${EVENT_KEY$b}`;
625
- const EVENT_CLOSED = `closed${EVENT_KEY$b}`;
626
- const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
627
- const CLASS_NAME_ALERT = 'alert';
770
+ const NAME$d = 'alert';
771
+ const DATA_KEY$c = 'bs.alert';
772
+ const EVENT_KEY$c = `.${DATA_KEY$c}`;
773
+ const EVENT_CLOSE = `close${EVENT_KEY$c}`;
774
+ const EVENT_CLOSED = `closed${EVENT_KEY$c}`;
628
775
  const CLASS_NAME_FADE$5 = 'fade';
629
776
  const CLASS_NAME_SHOW$8 = 'show';
630
777
  /**
@@ -635,77 +782,48 @@
635
782
 
636
783
  class Alert extends BaseComponent {
637
784
  // Getters
638
- static get DATA_KEY() {
639
- return DATA_KEY$b;
785
+ static get NAME() {
786
+ return NAME$d;
640
787
  } // Public
641
788
 
642
789
 
643
- close(element) {
644
- const rootElement = element ? this._getRootElement(element) : this._element;
790
+ close() {
791
+ const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
645
792
 
646
- const customEvent = this._triggerCloseEvent(rootElement);
647
-
648
- if (customEvent === null || customEvent.defaultPrevented) {
793
+ if (closeEvent.defaultPrevented) {
649
794
  return;
650
795
  }
651
796
 
652
- this._removeElement(rootElement);
653
- } // Private
654
-
655
-
656
- _getRootElement(element) {
657
- return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
658
- }
659
-
660
- _triggerCloseEvent(element) {
661
- return EventHandler.trigger(element, EVENT_CLOSE);
662
- }
663
-
664
- _removeElement(element) {
665
- element.classList.remove(CLASS_NAME_SHOW$8);
797
+ this._element.classList.remove(CLASS_NAME_SHOW$8);
666
798
 
667
- if (!element.classList.contains(CLASS_NAME_FADE$5)) {
668
- this._destroyElement(element);
799
+ const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5);
669
800
 
670
- return;
671
- }
801
+ this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
802
+ } // Private
672
803
 
673
- const transitionDuration = getTransitionDurationFromElement(element);
674
- EventHandler.one(element, 'transitionend', () => this._destroyElement(element));
675
- emulateTransitionEnd(element, transitionDuration);
676
- }
677
804
 
678
- _destroyElement(element) {
679
- if (element.parentNode) {
680
- element.parentNode.removeChild(element);
681
- }
805
+ _destroyElement() {
806
+ this._element.remove();
682
807
 
683
- EventHandler.trigger(element, EVENT_CLOSED);
808
+ EventHandler.trigger(this._element, EVENT_CLOSED);
809
+ this.dispose();
684
810
  } // Static
685
811
 
686
812
 
687
813
  static jQueryInterface(config) {
688
814
  return this.each(function () {
689
- let data = Data.get(this, DATA_KEY$b);
690
-
691
- if (!data) {
692
- data = new Alert(this);
693
- }
815
+ const data = Alert.getOrCreateInstance(this);
694
816
 
695
- if (config === 'close') {
696
- data[config](this);
817
+ if (typeof config !== 'string') {
818
+ return;
697
819
  }
698
- });
699
- }
700
820
 
701
- static handleDismiss(alertInstance) {
702
- return function (event) {
703
- if (event) {
704
- event.preventDefault();
821
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
822
+ throw new TypeError(`No method named "${config}"`);
705
823
  }
706
824
 
707
- alertInstance.close(this);
708
- };
825
+ data[config](this);
826
+ });
709
827
  }
710
828
 
711
829
  }
@@ -716,7 +834,7 @@
716
834
  */
717
835
 
718
836
 
719
- EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
837
+ enableDismissTrigger(Alert, 'close');
720
838
  /**
721
839
  * ------------------------------------------------------------------------
722
840
  * jQuery
@@ -724,11 +842,11 @@
724
842
  * add .Alert to jQuery only if jQuery is present
725
843
  */
726
844
 
727
- defineJQueryPlugin(NAME$b, Alert);
845
+ defineJQueryPlugin(Alert);
728
846
 
729
847
  /**
730
848
  * --------------------------------------------------------------------------
731
- * Bootstrap (v5.0.0-beta3): button.js
849
+ * Bootstrap (v5.1.0): button.js
732
850
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
733
851
  * --------------------------------------------------------------------------
734
852
  */
@@ -738,13 +856,13 @@
738
856
  * ------------------------------------------------------------------------
739
857
  */
740
858
 
741
- const NAME$a = 'button';
742
- const DATA_KEY$a = 'bs.button';
743
- const EVENT_KEY$a = `.${DATA_KEY$a}`;
859
+ const NAME$c = 'button';
860
+ const DATA_KEY$b = 'bs.button';
861
+ const EVENT_KEY$b = `.${DATA_KEY$b}`;
744
862
  const DATA_API_KEY$7 = '.data-api';
745
863
  const CLASS_NAME_ACTIVE$3 = 'active';
746
864
  const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
747
- const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$7}`;
865
+ const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`;
748
866
  /**
749
867
  * ------------------------------------------------------------------------
750
868
  * Class Definition
@@ -753,8 +871,8 @@
753
871
 
754
872
  class Button extends BaseComponent {
755
873
  // Getters
756
- static get DATA_KEY() {
757
- return DATA_KEY$a;
874
+ static get NAME() {
875
+ return NAME$c;
758
876
  } // Public
759
877
 
760
878
 
@@ -766,11 +884,7 @@
766
884
 
767
885
  static jQueryInterface(config) {
768
886
  return this.each(function () {
769
- let data = Data.get(this, DATA_KEY$a);
770
-
771
- if (!data) {
772
- data = new Button(this);
773
- }
887
+ const data = Button.getOrCreateInstance(this);
774
888
 
775
889
  if (config === 'toggle') {
776
890
  data[config]();
@@ -789,12 +903,7 @@
789
903
  EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => {
790
904
  event.preventDefault();
791
905
  const button = event.target.closest(SELECTOR_DATA_TOGGLE$5);
792
- let data = Data.get(button, DATA_KEY$a);
793
-
794
- if (!data) {
795
- data = new Button(button);
796
- }
797
-
906
+ const data = Button.getOrCreateInstance(button);
798
907
  data.toggle();
799
908
  });
800
909
  /**
@@ -804,11 +913,11 @@
804
913
  * add .Button to jQuery only if jQuery is present
805
914
  */
806
915
 
807
- defineJQueryPlugin(NAME$a, Button);
916
+ defineJQueryPlugin(Button);
808
917
 
809
918
  /**
810
919
  * --------------------------------------------------------------------------
811
- * Bootstrap (v5.0.0-beta3): dom/manipulator.js
920
+ * Bootstrap (v5.1.0): dom/manipulator.js
812
921
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
813
922
  * --------------------------------------------------------------------------
814
923
  */
@@ -866,8 +975,8 @@
866
975
  offset(element) {
867
976
  const rect = element.getBoundingClientRect();
868
977
  return {
869
- top: rect.top + document.body.scrollTop,
870
- left: rect.left + document.body.scrollLeft
978
+ top: rect.top + window.pageYOffset,
979
+ left: rect.left + window.pageXOffset
871
980
  };
872
981
  },
873
982
 
@@ -882,16 +991,10 @@
882
991
 
883
992
  /**
884
993
  * --------------------------------------------------------------------------
885
- * Bootstrap (v5.0.0-beta3): dom/selector-engine.js
994
+ * Bootstrap (v5.1.0): dom/selector-engine.js
886
995
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
887
996
  * --------------------------------------------------------------------------
888
997
  */
889
-
890
- /**
891
- * ------------------------------------------------------------------------
892
- * Constants
893
- * ------------------------------------------------------------------------
894
- */
895
998
  const NODE_TEXT = 3;
896
999
  const SelectorEngine = {
897
1000
  find(selector, element = document.documentElement) {
@@ -947,13 +1050,18 @@
947
1050
  }
948
1051
 
949
1052
  return [];
1053
+ },
1054
+
1055
+ focusableChildren(element) {
1056
+ const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
1057
+ return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
950
1058
  }
951
1059
 
952
1060
  };
953
1061
 
954
1062
  /**
955
1063
  * --------------------------------------------------------------------------
956
- * Bootstrap (v5.0.0-beta3): carousel.js
1064
+ * Bootstrap (v5.1.0): carousel.js
957
1065
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
958
1066
  * --------------------------------------------------------------------------
959
1067
  */
@@ -963,16 +1071,16 @@
963
1071
  * ------------------------------------------------------------------------
964
1072
  */
965
1073
 
966
- const NAME$9 = 'carousel';
967
- const DATA_KEY$9 = 'bs.carousel';
968
- const EVENT_KEY$9 = `.${DATA_KEY$9}`;
1074
+ const NAME$b = 'carousel';
1075
+ const DATA_KEY$a = 'bs.carousel';
1076
+ const EVENT_KEY$a = `.${DATA_KEY$a}`;
969
1077
  const DATA_API_KEY$6 = '.data-api';
970
1078
  const ARROW_LEFT_KEY = 'ArrowLeft';
971
1079
  const ARROW_RIGHT_KEY = 'ArrowRight';
972
1080
  const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
973
1081
 
974
1082
  const SWIPE_THRESHOLD = 40;
975
- const Default$8 = {
1083
+ const Default$a = {
976
1084
  interval: 5000,
977
1085
  keyboard: true,
978
1086
  slide: false,
@@ -980,7 +1088,7 @@
980
1088
  wrap: true,
981
1089
  touch: true
982
1090
  };
983
- const DefaultType$8 = {
1091
+ const DefaultType$a = {
984
1092
  interval: '(number|boolean)',
985
1093
  keyboard: 'boolean',
986
1094
  slide: '(boolean|string)',
@@ -992,19 +1100,23 @@
992
1100
  const ORDER_PREV = 'prev';
993
1101
  const DIRECTION_LEFT = 'left';
994
1102
  const DIRECTION_RIGHT = 'right';
995
- const EVENT_SLIDE = `slide${EVENT_KEY$9}`;
996
- const EVENT_SLID = `slid${EVENT_KEY$9}`;
997
- const EVENT_KEYDOWN = `keydown${EVENT_KEY$9}`;
998
- const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$9}`;
999
- const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$9}`;
1000
- const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
1001
- const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
1002
- const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
1003
- const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
1004
- const EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
1005
- const EVENT_DRAG_START = `dragstart${EVENT_KEY$9}`;
1006
- const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$9}${DATA_API_KEY$6}`;
1007
- const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$9}${DATA_API_KEY$6}`;
1103
+ const KEY_TO_DIRECTION = {
1104
+ [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
1105
+ [ARROW_RIGHT_KEY]: DIRECTION_LEFT
1106
+ };
1107
+ const EVENT_SLIDE = `slide${EVENT_KEY$a}`;
1108
+ const EVENT_SLID = `slid${EVENT_KEY$a}`;
1109
+ const EVENT_KEYDOWN = `keydown${EVENT_KEY$a}`;
1110
+ const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$a}`;
1111
+ const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$a}`;
1112
+ const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$a}`;
1113
+ const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$a}`;
1114
+ const EVENT_TOUCHEND = `touchend${EVENT_KEY$a}`;
1115
+ const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$a}`;
1116
+ const EVENT_POINTERUP = `pointerup${EVENT_KEY$a}`;
1117
+ const EVENT_DRAG_START = `dragstart${EVENT_KEY$a}`;
1118
+ const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$a}${DATA_API_KEY$6}`;
1119
+ const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
1008
1120
  const CLASS_NAME_CAROUSEL = 'carousel';
1009
1121
  const CLASS_NAME_ACTIVE$2 = 'active';
1010
1122
  const CLASS_NAME_SLIDE = 'slide';
@@ -1051,18 +1163,16 @@
1051
1163
 
1052
1164
 
1053
1165
  static get Default() {
1054
- return Default$8;
1166
+ return Default$a;
1055
1167
  }
1056
1168
 
1057
- static get DATA_KEY() {
1058
- return DATA_KEY$9;
1169
+ static get NAME() {
1170
+ return NAME$b;
1059
1171
  } // Public
1060
1172
 
1061
1173
 
1062
1174
  next() {
1063
- if (!this._isSliding) {
1064
- this._slide(ORDER_NEXT);
1065
- }
1175
+ this._slide(ORDER_NEXT);
1066
1176
  }
1067
1177
 
1068
1178
  nextWhenVisible() {
@@ -1074,9 +1184,7 @@
1074
1184
  }
1075
1185
 
1076
1186
  prev() {
1077
- if (!this._isSliding) {
1078
- this._slide(ORDER_PREV);
1079
- }
1187
+ this._slide(ORDER_PREV);
1080
1188
  }
1081
1189
 
1082
1190
  pause(event) {
@@ -1133,26 +1241,15 @@
1133
1241
  const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
1134
1242
 
1135
1243
  this._slide(order, this._items[index]);
1136
- }
1137
-
1138
- dispose() {
1139
- EventHandler.off(this._element, EVENT_KEY$9);
1140
- this._items = null;
1141
- this._config = null;
1142
- this._interval = null;
1143
- this._isPaused = null;
1144
- this._isSliding = null;
1145
- this._activeElement = null;
1146
- this._indicatorsElement = null;
1147
- super.dispose();
1148
1244
  } // Private
1149
1245
 
1150
1246
 
1151
1247
  _getConfig(config) {
1152
- config = { ...Default$8,
1153
- ...config
1248
+ config = { ...Default$a,
1249
+ ...Manipulator.getDataAttributes(this._element),
1250
+ ...(typeof config === 'object' ? config : {})
1154
1251
  };
1155
- typeCheckConfig(NAME$9, config, DefaultType$8);
1252
+ typeCheckConfig(NAME$b, config, DefaultType$a);
1156
1253
  return config;
1157
1254
  }
1158
1255
 
@@ -1248,14 +1345,12 @@
1248
1345
  return;
1249
1346
  }
1250
1347
 
1251
- if (event.key === ARROW_LEFT_KEY) {
1252
- event.preventDefault();
1348
+ const direction = KEY_TO_DIRECTION[event.key];
1253
1349
 
1254
- this._slide(DIRECTION_LEFT);
1255
- } else if (event.key === ARROW_RIGHT_KEY) {
1350
+ if (direction) {
1256
1351
  event.preventDefault();
1257
1352
 
1258
- this._slide(DIRECTION_RIGHT);
1353
+ this._slide(direction);
1259
1354
  }
1260
1355
  }
1261
1356
 
@@ -1266,20 +1361,7 @@
1266
1361
 
1267
1362
  _getItemByOrder(order, activeElement) {
1268
1363
  const isNext = order === ORDER_NEXT;
1269
- const isPrev = order === ORDER_PREV;
1270
-
1271
- const activeIndex = this._getItemIndex(activeElement);
1272
-
1273
- const lastItemIndex = this._items.length - 1;
1274
- const isGoingToWrap = isPrev && activeIndex === 0 || isNext && activeIndex === lastItemIndex;
1275
-
1276
- if (isGoingToWrap && !this._config.wrap) {
1277
- return activeElement;
1278
- }
1279
-
1280
- const delta = isPrev ? -1 : 1;
1281
- const itemIndex = (activeIndex + delta) % this._items.length;
1282
- return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
1364
+ return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
1283
1365
  }
1284
1366
 
1285
1367
  _triggerSlideEvent(relatedTarget, eventDirectionName) {
@@ -1352,7 +1434,11 @@
1352
1434
  return;
1353
1435
  }
1354
1436
 
1355
- const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
1437
+ if (this._isSliding) {
1438
+ return;
1439
+ }
1440
+
1441
+ const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
1356
1442
 
1357
1443
  if (slideEvent.defaultPrevented) {
1358
1444
  return;
@@ -1373,37 +1459,35 @@
1373
1459
 
1374
1460
  this._activeElement = nextElement;
1375
1461
 
1462
+ const triggerSlidEvent = () => {
1463
+ EventHandler.trigger(this._element, EVENT_SLID, {
1464
+ relatedTarget: nextElement,
1465
+ direction: eventDirectionName,
1466
+ from: activeElementIndex,
1467
+ to: nextElementIndex
1468
+ });
1469
+ };
1470
+
1376
1471
  if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
1377
1472
  nextElement.classList.add(orderClassName);
1378
1473
  reflow(nextElement);
1379
1474
  activeElement.classList.add(directionalClassName);
1380
1475
  nextElement.classList.add(directionalClassName);
1381
- const transitionDuration = getTransitionDurationFromElement(activeElement);
1382
- EventHandler.one(activeElement, 'transitionend', () => {
1476
+
1477
+ const completeCallBack = () => {
1383
1478
  nextElement.classList.remove(directionalClassName, orderClassName);
1384
1479
  nextElement.classList.add(CLASS_NAME_ACTIVE$2);
1385
1480
  activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
1386
1481
  this._isSliding = false;
1387
- setTimeout(() => {
1388
- EventHandler.trigger(this._element, EVENT_SLID, {
1389
- relatedTarget: nextElement,
1390
- direction: eventDirectionName,
1391
- from: activeElementIndex,
1392
- to: nextElementIndex
1393
- });
1394
- }, 0);
1395
- });
1396
- emulateTransitionEnd(activeElement, transitionDuration);
1482
+ setTimeout(triggerSlidEvent, 0);
1483
+ };
1484
+
1485
+ this._queueCallback(completeCallBack, activeElement, true);
1397
1486
  } else {
1398
1487
  activeElement.classList.remove(CLASS_NAME_ACTIVE$2);
1399
1488
  nextElement.classList.add(CLASS_NAME_ACTIVE$2);
1400
1489
  this._isSliding = false;
1401
- EventHandler.trigger(this._element, EVENT_SLID, {
1402
- relatedTarget: nextElement,
1403
- direction: eventDirectionName,
1404
- from: activeElementIndex,
1405
- to: nextElementIndex
1406
- });
1490
+ triggerSlidEvent();
1407
1491
  }
1408
1492
 
1409
1493
  if (isCycling) {
@@ -1417,10 +1501,10 @@
1417
1501
  }
1418
1502
 
1419
1503
  if (isRTL()) {
1420
- return direction === DIRECTION_RIGHT ? ORDER_PREV : ORDER_NEXT;
1504
+ return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
1421
1505
  }
1422
1506
 
1423
- return direction === DIRECTION_RIGHT ? ORDER_NEXT : ORDER_PREV;
1507
+ return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
1424
1508
  }
1425
1509
 
1426
1510
  _orderToDirection(order) {
@@ -1429,18 +1513,18 @@
1429
1513
  }
1430
1514
 
1431
1515
  if (isRTL()) {
1432
- return order === ORDER_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
1516
+ return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
1433
1517
  }
1434
1518
 
1435
- return order === ORDER_NEXT ? DIRECTION_RIGHT : DIRECTION_LEFT;
1519
+ return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
1436
1520
  } // Static
1437
1521
 
1438
1522
 
1439
1523
  static carouselInterface(element, config) {
1440
- let data = Data.get(element, DATA_KEY$9);
1441
- let _config = { ...Default$8,
1442
- ...Manipulator.getDataAttributes(element)
1443
- };
1524
+ const data = Carousel.getOrCreateInstance(element, config);
1525
+ let {
1526
+ _config
1527
+ } = data;
1444
1528
 
1445
1529
  if (typeof config === 'object') {
1446
1530
  _config = { ..._config,
@@ -1450,10 +1534,6 @@
1450
1534
 
1451
1535
  const action = typeof config === 'string' ? config : _config.slide;
1452
1536
 
1453
- if (!data) {
1454
- data = new Carousel(element, _config);
1455
- }
1456
-
1457
1537
  if (typeof config === 'number') {
1458
1538
  data.to(config);
1459
1539
  } else if (typeof action === 'string') {
@@ -1493,7 +1573,7 @@
1493
1573
  Carousel.carouselInterface(target, config);
1494
1574
 
1495
1575
  if (slideIndex) {
1496
- Data.get(target, DATA_KEY$9).to(slideIndex);
1576
+ Carousel.getInstance(target).to(slideIndex);
1497
1577
  }
1498
1578
 
1499
1579
  event.preventDefault();
@@ -1512,7 +1592,7 @@
1512
1592
  const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
1513
1593
 
1514
1594
  for (let i = 0, len = carousels.length; i < len; i++) {
1515
- Carousel.carouselInterface(carousels[i], Data.get(carousels[i], DATA_KEY$9));
1595
+ Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
1516
1596
  }
1517
1597
  });
1518
1598
  /**
@@ -1522,11 +1602,11 @@
1522
1602
  * add .Carousel to jQuery only if jQuery is present
1523
1603
  */
1524
1604
 
1525
- defineJQueryPlugin(NAME$9, Carousel);
1605
+ defineJQueryPlugin(Carousel);
1526
1606
 
1527
1607
  /**
1528
1608
  * --------------------------------------------------------------------------
1529
- * Bootstrap (v5.0.0-beta3): collapse.js
1609
+ * Bootstrap (v5.1.0): collapse.js
1530
1610
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
1531
1611
  * --------------------------------------------------------------------------
1532
1612
  */
@@ -1536,27 +1616,28 @@
1536
1616
  * ------------------------------------------------------------------------
1537
1617
  */
1538
1618
 
1539
- const NAME$8 = 'collapse';
1540
- const DATA_KEY$8 = 'bs.collapse';
1541
- const EVENT_KEY$8 = `.${DATA_KEY$8}`;
1619
+ const NAME$a = 'collapse';
1620
+ const DATA_KEY$9 = 'bs.collapse';
1621
+ const EVENT_KEY$9 = `.${DATA_KEY$9}`;
1542
1622
  const DATA_API_KEY$5 = '.data-api';
1543
- const Default$7 = {
1623
+ const Default$9 = {
1544
1624
  toggle: true,
1545
- parent: ''
1625
+ parent: null
1546
1626
  };
1547
- const DefaultType$7 = {
1627
+ const DefaultType$9 = {
1548
1628
  toggle: 'boolean',
1549
- parent: '(string|element)'
1629
+ parent: '(null|element)'
1550
1630
  };
1551
- const EVENT_SHOW$5 = `show${EVENT_KEY$8}`;
1552
- const EVENT_SHOWN$5 = `shown${EVENT_KEY$8}`;
1553
- const EVENT_HIDE$5 = `hide${EVENT_KEY$8}`;
1554
- const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`;
1555
- const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
1631
+ const EVENT_SHOW$5 = `show${EVENT_KEY$9}`;
1632
+ const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`;
1633
+ const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`;
1634
+ const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`;
1635
+ const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`;
1556
1636
  const CLASS_NAME_SHOW$7 = 'show';
1557
1637
  const CLASS_NAME_COLLAPSE = 'collapse';
1558
1638
  const CLASS_NAME_COLLAPSING = 'collapsing';
1559
1639
  const CLASS_NAME_COLLAPSED = 'collapsed';
1640
+ const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
1560
1641
  const WIDTH = 'width';
1561
1642
  const HEIGHT = 'height';
1562
1643
  const SELECTOR_ACTIVES = '.show, .collapsing';
@@ -1572,7 +1653,7 @@
1572
1653
  super(element);
1573
1654
  this._isTransitioning = false;
1574
1655
  this._config = this._getConfig(config);
1575
- this._triggerArray = SelectorEngine.find(`${SELECTOR_DATA_TOGGLE$4}[href="#${this._element.id}"],` + `${SELECTOR_DATA_TOGGLE$4}[data-bs-target="#${this._element.id}"]`);
1656
+ this._triggerArray = [];
1576
1657
  const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
1577
1658
 
1578
1659
  for (let i = 0, len = toggleList.length; i < len; i++) {
@@ -1587,10 +1668,10 @@
1587
1668
  }
1588
1669
  }
1589
1670
 
1590
- this._parent = this._config.parent ? this._getParent() : null;
1671
+ this._initializeChildren();
1591
1672
 
1592
1673
  if (!this._config.parent) {
1593
- this._addAriaAndCollapsedClass(this._element, this._triggerArray);
1674
+ this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
1594
1675
  }
1595
1676
 
1596
1677
  if (this._config.toggle) {
@@ -1600,16 +1681,16 @@
1600
1681
 
1601
1682
 
1602
1683
  static get Default() {
1603
- return Default$7;
1684
+ return Default$9;
1604
1685
  }
1605
1686
 
1606
- static get DATA_KEY() {
1607
- return DATA_KEY$8;
1687
+ static get NAME() {
1688
+ return NAME$a;
1608
1689
  } // Public
1609
1690
 
1610
1691
 
1611
1692
  toggle() {
1612
- if (this._element.classList.contains(CLASS_NAME_SHOW$7)) {
1693
+ if (this._isShown()) {
1613
1694
  this.hide();
1614
1695
  } else {
1615
1696
  this.show();
@@ -1617,32 +1698,23 @@
1617
1698
  }
1618
1699
 
1619
1700
  show() {
1620
- if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$7)) {
1701
+ if (this._isTransitioning || this._isShown()) {
1621
1702
  return;
1622
1703
  }
1623
1704
 
1624
- let actives;
1705
+ let actives = [];
1625
1706
  let activesData;
1626
1707
 
1627
- if (this._parent) {
1628
- actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(elem => {
1629
- if (typeof this._config.parent === 'string') {
1630
- return elem.getAttribute('data-bs-parent') === this._config.parent;
1631
- }
1632
-
1633
- return elem.classList.contains(CLASS_NAME_COLLAPSE);
1634
- });
1635
-
1636
- if (actives.length === 0) {
1637
- actives = null;
1638
- }
1708
+ if (this._config.parent) {
1709
+ const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
1710
+ actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth
1639
1711
  }
1640
1712
 
1641
1713
  const container = SelectorEngine.findOne(this._selector);
1642
1714
 
1643
- if (actives) {
1715
+ if (actives.length) {
1644
1716
  const tempActiveData = actives.find(elem => container !== elem);
1645
- activesData = tempActiveData ? Data.get(tempActiveData, DATA_KEY$8) : null;
1717
+ activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
1646
1718
 
1647
1719
  if (activesData && activesData._isTransitioning) {
1648
1720
  return;
@@ -1655,17 +1727,17 @@
1655
1727
  return;
1656
1728
  }
1657
1729
 
1658
- if (actives) {
1659
- actives.forEach(elemActive => {
1660
- if (container !== elemActive) {
1661
- Collapse.collapseInterface(elemActive, 'hide');
1662
- }
1730
+ actives.forEach(elemActive => {
1731
+ if (container !== elemActive) {
1732
+ Collapse.getOrCreateInstance(elemActive, {
1733
+ toggle: false
1734
+ }).hide();
1735
+ }
1663
1736
 
1664
- if (!activesData) {
1665
- Data.set(elemActive, DATA_KEY$8, null);
1666
- }
1667
- });
1668
- }
1737
+ if (!activesData) {
1738
+ Data.set(elemActive, DATA_KEY$9, null);
1739
+ }
1740
+ });
1669
1741
 
1670
1742
  const dimension = this._getDimension();
1671
1743
 
@@ -1675,35 +1747,31 @@
1675
1747
 
1676
1748
  this._element.style[dimension] = 0;
1677
1749
 
1678
- if (this._triggerArray.length) {
1679
- this._triggerArray.forEach(element => {
1680
- element.classList.remove(CLASS_NAME_COLLAPSED);
1681
- element.setAttribute('aria-expanded', true);
1682
- });
1683
- }
1750
+ this._addAriaAndCollapsedClass(this._triggerArray, true);
1684
1751
 
1685
- this.setTransitioning(true);
1752
+ this._isTransitioning = true;
1686
1753
 
1687
1754
  const complete = () => {
1755
+ this._isTransitioning = false;
1756
+
1688
1757
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
1689
1758
 
1690
1759
  this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
1691
1760
 
1692
1761
  this._element.style[dimension] = '';
1693
- this.setTransitioning(false);
1694
1762
  EventHandler.trigger(this._element, EVENT_SHOWN$5);
1695
1763
  };
1696
1764
 
1697
1765
  const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
1698
1766
  const scrollSize = `scroll${capitalizedDimension}`;
1699
- const transitionDuration = getTransitionDurationFromElement(this._element);
1700
- EventHandler.one(this._element, 'transitionend', complete);
1701
- emulateTransitionEnd(this._element, transitionDuration);
1767
+
1768
+ this._queueCallback(complete, this._element, true);
1769
+
1702
1770
  this._element.style[dimension] = `${this._element[scrollSize]}px`;
1703
1771
  }
1704
1772
 
1705
1773
  hide() {
1706
- if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$7)) {
1774
+ if (this._isTransitioning || !this._isShown()) {
1707
1775
  return;
1708
1776
  }
1709
1777
 
@@ -1724,22 +1792,19 @@
1724
1792
 
1725
1793
  const triggerArrayLength = this._triggerArray.length;
1726
1794
 
1727
- if (triggerArrayLength > 0) {
1728
- for (let i = 0; i < triggerArrayLength; i++) {
1729
- const trigger = this._triggerArray[i];
1730
- const elem = getElementFromSelector(trigger);
1795
+ for (let i = 0; i < triggerArrayLength; i++) {
1796
+ const trigger = this._triggerArray[i];
1797
+ const elem = getElementFromSelector(trigger);
1731
1798
 
1732
- if (elem && !elem.classList.contains(CLASS_NAME_SHOW$7)) {
1733
- trigger.classList.add(CLASS_NAME_COLLAPSED);
1734
- trigger.setAttribute('aria-expanded', false);
1735
- }
1799
+ if (elem && !this._isShown(elem)) {
1800
+ this._addAriaAndCollapsedClass([trigger], false);
1736
1801
  }
1737
1802
  }
1738
1803
 
1739
- this.setTransitioning(true);
1804
+ this._isTransitioning = true;
1740
1805
 
1741
1806
  const complete = () => {
1742
- this.setTransitioning(false);
1807
+ this._isTransitioning = false;
1743
1808
 
1744
1809
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
1745
1810
 
@@ -1749,67 +1814,51 @@
1749
1814
  };
1750
1815
 
1751
1816
  this._element.style[dimension] = '';
1752
- const transitionDuration = getTransitionDurationFromElement(this._element);
1753
- EventHandler.one(this._element, 'transitionend', complete);
1754
- emulateTransitionEnd(this._element, transitionDuration);
1755
- }
1756
1817
 
1757
- setTransitioning(isTransitioning) {
1758
- this._isTransitioning = isTransitioning;
1818
+ this._queueCallback(complete, this._element, true);
1759
1819
  }
1760
1820
 
1761
- dispose() {
1762
- super.dispose();
1763
- this._config = null;
1764
- this._parent = null;
1765
- this._triggerArray = null;
1766
- this._isTransitioning = null;
1821
+ _isShown(element = this._element) {
1822
+ return element.classList.contains(CLASS_NAME_SHOW$7);
1767
1823
  } // Private
1768
1824
 
1769
1825
 
1770
1826
  _getConfig(config) {
1771
- config = { ...Default$7,
1827
+ config = { ...Default$9,
1828
+ ...Manipulator.getDataAttributes(this._element),
1772
1829
  ...config
1773
1830
  };
1774
1831
  config.toggle = Boolean(config.toggle); // Coerce string values
1775
1832
 
1776
- typeCheckConfig(NAME$8, config, DefaultType$7);
1833
+ config.parent = getElement(config.parent);
1834
+ typeCheckConfig(NAME$a, config, DefaultType$9);
1777
1835
  return config;
1778
1836
  }
1779
1837
 
1780
1838
  _getDimension() {
1781
- return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
1839
+ return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
1782
1840
  }
1783
1841
 
1784
- _getParent() {
1785
- let {
1786
- parent
1787
- } = this._config;
1788
-
1789
- if (isElement$1(parent)) {
1790
- // it's a jQuery object
1791
- if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
1792
- parent = parent[0];
1793
- }
1794
- } else {
1795
- parent = SelectorEngine.findOne(parent);
1842
+ _initializeChildren() {
1843
+ if (!this._config.parent) {
1844
+ return;
1796
1845
  }
1797
1846
 
1798
- const selector = `${SELECTOR_DATA_TOGGLE$4}[data-bs-parent="${parent}"]`;
1799
- SelectorEngine.find(selector, parent).forEach(element => {
1847
+ const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
1848
+ SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
1800
1849
  const selected = getElementFromSelector(element);
1801
1850
 
1802
- this._addAriaAndCollapsedClass(selected, [element]);
1851
+ if (selected) {
1852
+ this._addAriaAndCollapsedClass([element], this._isShown(selected));
1853
+ }
1803
1854
  });
1804
- return parent;
1805
1855
  }
1806
1856
 
1807
- _addAriaAndCollapsedClass(element, triggerArray) {
1808
- if (!element || !triggerArray.length) {
1857
+ _addAriaAndCollapsedClass(triggerArray, isOpen) {
1858
+ if (!triggerArray.length) {
1809
1859
  return;
1810
1860
  }
1811
1861
 
1812
- const isOpen = element.classList.contains(CLASS_NAME_SHOW$7);
1813
1862
  triggerArray.forEach(elem => {
1814
1863
  if (isOpen) {
1815
1864
  elem.classList.remove(CLASS_NAME_COLLAPSED);
@@ -1822,33 +1871,23 @@
1822
1871
  } // Static
1823
1872
 
1824
1873
 
1825
- static collapseInterface(element, config) {
1826
- let data = Data.get(element, DATA_KEY$8);
1827
- const _config = { ...Default$7,
1828
- ...Manipulator.getDataAttributes(element),
1829
- ...(typeof config === 'object' && config ? config : {})
1830
- };
1831
-
1832
- if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
1833
- _config.toggle = false;
1834
- }
1835
-
1836
- if (!data) {
1837
- data = new Collapse(element, _config);
1838
- }
1874
+ static jQueryInterface(config) {
1875
+ return this.each(function () {
1876
+ const _config = {};
1839
1877
 
1840
- if (typeof config === 'string') {
1841
- if (typeof data[config] === 'undefined') {
1842
- throw new TypeError(`No method named "${config}"`);
1878
+ if (typeof config === 'string' && /show|hide/.test(config)) {
1879
+ _config.toggle = false;
1843
1880
  }
1844
1881
 
1845
- data[config]();
1846
- }
1847
- }
1882
+ const data = Collapse.getOrCreateInstance(this, _config);
1848
1883
 
1849
- static jQueryInterface(config) {
1850
- return this.each(function () {
1851
- Collapse.collapseInterface(this, config);
1884
+ if (typeof config === 'string') {
1885
+ if (typeof data[config] === 'undefined') {
1886
+ throw new TypeError(`No method named "${config}"`);
1887
+ }
1888
+
1889
+ data[config]();
1890
+ }
1852
1891
  });
1853
1892
  }
1854
1893
 
@@ -1866,26 +1905,12 @@
1866
1905
  event.preventDefault();
1867
1906
  }
1868
1907
 
1869
- const triggerData = Manipulator.getDataAttributes(this);
1870
1908
  const selector = getSelectorFromElement(this);
1871
1909
  const selectorElements = SelectorEngine.find(selector);
1872
1910
  selectorElements.forEach(element => {
1873
- const data = Data.get(element, DATA_KEY$8);
1874
- let config;
1875
-
1876
- if (data) {
1877
- // update parent attribute
1878
- if (data._parent === null && typeof triggerData.parent === 'string') {
1879
- data._config.parent = triggerData.parent;
1880
- data._parent = data._getParent();
1881
- }
1882
-
1883
- config = 'toggle';
1884
- } else {
1885
- config = triggerData;
1886
- }
1887
-
1888
- Collapse.collapseInterface(element, config);
1911
+ Collapse.getOrCreateInstance(element, {
1912
+ toggle: false
1913
+ }).toggle();
1889
1914
  });
1890
1915
  });
1891
1916
  /**
@@ -1895,7 +1920,7 @@
1895
1920
  * add .Collapse to jQuery only if jQuery is present
1896
1921
  */
1897
1922
 
1898
- defineJQueryPlugin(NAME$8, Collapse);
1923
+ defineJQueryPlugin(Collapse);
1899
1924
 
1900
1925
  var top = 'top';
1901
1926
  var bottom = 'bottom';
@@ -2053,17 +2078,31 @@
2053
2078
  return placement.split('-')[0];
2054
2079
  }
2055
2080
 
2056
- function getBoundingClientRect(element) {
2081
+ var round$1 = Math.round;
2082
+ function getBoundingClientRect(element, includeScale) {
2083
+ if (includeScale === void 0) {
2084
+ includeScale = false;
2085
+ }
2086
+
2057
2087
  var rect = element.getBoundingClientRect();
2088
+ var scaleX = 1;
2089
+ var scaleY = 1;
2090
+
2091
+ if (isHTMLElement(element) && includeScale) {
2092
+ // Fallback to 1 in case both values are `0`
2093
+ scaleX = rect.width / element.offsetWidth || 1;
2094
+ scaleY = rect.height / element.offsetHeight || 1;
2095
+ }
2096
+
2058
2097
  return {
2059
- width: rect.width,
2060
- height: rect.height,
2061
- top: rect.top,
2062
- right: rect.right,
2063
- bottom: rect.bottom,
2064
- left: rect.left,
2065
- x: rect.left,
2066
- y: rect.top
2098
+ width: round$1(rect.width / scaleX),
2099
+ height: round$1(rect.height / scaleY),
2100
+ top: round$1(rect.top / scaleY),
2101
+ right: round$1(rect.right / scaleX),
2102
+ bottom: round$1(rect.bottom / scaleY),
2103
+ left: round$1(rect.left / scaleX),
2104
+ x: round$1(rect.left / scaleX),
2105
+ y: round$1(rect.top / scaleY)
2067
2106
  };
2068
2107
  }
2069
2108
 
@@ -2159,6 +2198,17 @@
2159
2198
 
2160
2199
  function getContainingBlock(element) {
2161
2200
  var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
2201
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
2202
+
2203
+ if (isIE && isHTMLElement(element)) {
2204
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
2205
+ var elementCss = getComputedStyle$1(element);
2206
+
2207
+ if (elementCss.position === 'fixed') {
2208
+ return null;
2209
+ }
2210
+ }
2211
+
2162
2212
  var currentNode = getParentNode(element);
2163
2213
 
2164
2214
  while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
@@ -3036,7 +3086,7 @@
3036
3086
  });
3037
3087
  }
3038
3088
 
3039
- function hide$1(_ref) {
3089
+ function hide(_ref) {
3040
3090
  var state = _ref.state,
3041
3091
  name = _ref.name;
3042
3092
  var referenceRect = state.rects.reference;
@@ -3065,12 +3115,12 @@
3065
3115
  } // eslint-disable-next-line import/no-unused-modules
3066
3116
 
3067
3117
 
3068
- var hide$2 = {
3118
+ var hide$1 = {
3069
3119
  name: 'hide',
3070
3120
  enabled: true,
3071
3121
  phase: 'main',
3072
3122
  requiresIfExists: ['preventOverflow'],
3073
- fn: hide$1
3123
+ fn: hide
3074
3124
  };
3075
3125
 
3076
3126
  function distanceAndSkiddingToXY(placement, rects, offset) {
@@ -3280,16 +3330,24 @@
3280
3330
  }
3281
3331
  }
3282
3332
 
3333
+ function isElementScaled(element) {
3334
+ var rect = element.getBoundingClientRect();
3335
+ var scaleX = rect.width / element.offsetWidth || 1;
3336
+ var scaleY = rect.height / element.offsetHeight || 1;
3337
+ return scaleX !== 1 || scaleY !== 1;
3338
+ } // Returns the composite rect of an element relative to its offsetParent.
3283
3339
  // Composite means it takes into account transforms as well as layout.
3284
3340
 
3341
+
3285
3342
  function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
3286
3343
  if (isFixed === void 0) {
3287
3344
  isFixed = false;
3288
3345
  }
3289
3346
 
3290
- var documentElement = getDocumentElement(offsetParent);
3291
- var rect = getBoundingClientRect(elementOrVirtualElement);
3292
3347
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
3348
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
3349
+ var documentElement = getDocumentElement(offsetParent);
3350
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
3293
3351
  var scroll = {
3294
3352
  scrollLeft: 0,
3295
3353
  scrollTop: 0
@@ -3306,7 +3364,7 @@
3306
3364
  }
3307
3365
 
3308
3366
  if (isHTMLElement(offsetParent)) {
3309
- offsets = getBoundingClientRect(offsetParent);
3367
+ offsets = getBoundingClientRect(offsetParent, true);
3310
3368
  offsets.x += offsetParent.clientLeft;
3311
3369
  offsets.y += offsetParent.clientTop;
3312
3370
  } else if (documentElement) {
@@ -3593,7 +3651,7 @@
3593
3651
  defaultModifiers: defaultModifiers$1
3594
3652
  }); // eslint-disable-next-line import/no-unused-modules
3595
3653
 
3596
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$2];
3654
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
3597
3655
  var createPopper = /*#__PURE__*/popperGenerator({
3598
3656
  defaultModifiers: defaultModifiers
3599
3657
  }); // eslint-disable-next-line import/no-unused-modules
@@ -3634,7 +3692,7 @@
3634
3692
  computeStyles: computeStyles$1,
3635
3693
  eventListeners: eventListeners,
3636
3694
  flip: flip$1,
3637
- hide: hide$2,
3695
+ hide: hide$1,
3638
3696
  offset: offset$1,
3639
3697
  popperOffsets: popperOffsets$1,
3640
3698
  preventOverflow: preventOverflow$1
@@ -3642,7 +3700,7 @@
3642
3700
 
3643
3701
  /**
3644
3702
  * --------------------------------------------------------------------------
3645
- * Bootstrap (v5.0.0-beta3): dropdown.js
3703
+ * Bootstrap (v5.1.0): dropdown.js
3646
3704
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
3647
3705
  * --------------------------------------------------------------------------
3648
3706
  */
@@ -3652,27 +3710,25 @@
3652
3710
  * ------------------------------------------------------------------------
3653
3711
  */
3654
3712
 
3655
- const NAME$7 = 'dropdown';
3656
- const DATA_KEY$7 = 'bs.dropdown';
3657
- const EVENT_KEY$7 = `.${DATA_KEY$7}`;
3713
+ const NAME$9 = 'dropdown';
3714
+ const DATA_KEY$8 = 'bs.dropdown';
3715
+ const EVENT_KEY$8 = `.${DATA_KEY$8}`;
3658
3716
  const DATA_API_KEY$4 = '.data-api';
3659
3717
  const ESCAPE_KEY$2 = 'Escape';
3660
3718
  const SPACE_KEY = 'Space';
3661
- const TAB_KEY = 'Tab';
3719
+ const TAB_KEY$1 = 'Tab';
3662
3720
  const ARROW_UP_KEY = 'ArrowUp';
3663
3721
  const ARROW_DOWN_KEY = 'ArrowDown';
3664
3722
  const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
3665
3723
 
3666
3724
  const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
3667
- const EVENT_HIDE$4 = `hide${EVENT_KEY$7}`;
3668
- const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$7}`;
3669
- const EVENT_SHOW$4 = `show${EVENT_KEY$7}`;
3670
- const EVENT_SHOWN$4 = `shown${EVENT_KEY$7}`;
3671
- const EVENT_CLICK = `click${EVENT_KEY$7}`;
3672
- const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
3673
- const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`;
3674
- const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`;
3675
- const CLASS_NAME_DISABLED = 'disabled';
3725
+ const EVENT_HIDE$4 = `hide${EVENT_KEY$8}`;
3726
+ const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`;
3727
+ const EVENT_SHOW$4 = `show${EVENT_KEY$8}`;
3728
+ const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`;
3729
+ const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$8}${DATA_API_KEY$4}`;
3730
+ const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$8}${DATA_API_KEY$4}`;
3731
+ const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$8}${DATA_API_KEY$4}`;
3676
3732
  const CLASS_NAME_SHOW$6 = 'show';
3677
3733
  const CLASS_NAME_DROPUP = 'dropup';
3678
3734
  const CLASS_NAME_DROPEND = 'dropend';
@@ -3688,19 +3744,21 @@
3688
3744
  const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
3689
3745
  const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
3690
3746
  const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
3691
- const Default$6 = {
3747
+ const Default$8 = {
3692
3748
  offset: [0, 2],
3693
3749
  boundary: 'clippingParents',
3694
3750
  reference: 'toggle',
3695
3751
  display: 'dynamic',
3696
- popperConfig: null
3752
+ popperConfig: null,
3753
+ autoClose: true
3697
3754
  };
3698
- const DefaultType$6 = {
3755
+ const DefaultType$8 = {
3699
3756
  offset: '(array|string|function)',
3700
3757
  boundary: '(string|element)',
3701
3758
  reference: '(string|element|object)',
3702
3759
  display: 'string',
3703
- popperConfig: '(null|object|function)'
3760
+ popperConfig: '(null|object|function)',
3761
+ autoClose: '(boolean|string)'
3704
3762
  };
3705
3763
  /**
3706
3764
  * ------------------------------------------------------------------------
@@ -3715,46 +3773,31 @@
3715
3773
  this._config = this._getConfig(config);
3716
3774
  this._menu = this._getMenuElement();
3717
3775
  this._inNavbar = this._detectNavbar();
3718
-
3719
- this._addEventListeners();
3720
3776
  } // Getters
3721
3777
 
3722
3778
 
3723
3779
  static get Default() {
3724
- return Default$6;
3780
+ return Default$8;
3725
3781
  }
3726
3782
 
3727
3783
  static get DefaultType() {
3728
- return DefaultType$6;
3784
+ return DefaultType$8;
3729
3785
  }
3730
3786
 
3731
- static get DATA_KEY() {
3732
- return DATA_KEY$7;
3787
+ static get NAME() {
3788
+ return NAME$9;
3733
3789
  } // Public
3734
3790
 
3735
3791
 
3736
3792
  toggle() {
3737
- if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) {
3738
- return;
3739
- }
3740
-
3741
- const isActive = this._element.classList.contains(CLASS_NAME_SHOW$6);
3742
-
3743
- Dropdown.clearMenus();
3744
-
3745
- if (isActive) {
3746
- return;
3747
- }
3748
-
3749
- this.show();
3793
+ return this._isShown() ? this.hide() : this.show();
3750
3794
  }
3751
3795
 
3752
3796
  show() {
3753
- if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW$6)) {
3797
+ if (isDisabled(this._element) || this._isShown(this._menu)) {
3754
3798
  return;
3755
3799
  }
3756
3800
 
3757
- const parent = Dropdown.getParentFromElement(this._element);
3758
3801
  const relatedTarget = {
3759
3802
  relatedTarget: this._element
3760
3803
  };
@@ -3762,38 +3805,14 @@
3762
3805
 
3763
3806
  if (showEvent.defaultPrevented) {
3764
3807
  return;
3765
- } // Totally disable Popper for Dropdowns in Navbar
3808
+ }
3766
3809
 
3810
+ const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar
3767
3811
 
3768
3812
  if (this._inNavbar) {
3769
3813
  Manipulator.setDataAttribute(this._menu, 'popper', 'none');
3770
3814
  } else {
3771
- if (typeof Popper === 'undefined') {
3772
- throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
3773
- }
3774
-
3775
- let referenceElement = this._element;
3776
-
3777
- if (this._config.reference === 'parent') {
3778
- referenceElement = parent;
3779
- } else if (isElement$1(this._config.reference)) {
3780
- referenceElement = this._config.reference; // Check if it's jQuery element
3781
-
3782
- if (typeof this._config.reference.jquery !== 'undefined') {
3783
- referenceElement = this._config.reference[0];
3784
- }
3785
- } else if (typeof this._config.reference === 'object') {
3786
- referenceElement = this._config.reference;
3787
- }
3788
-
3789
- const popperConfig = this._getPopperConfig();
3790
-
3791
- const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
3792
- this._popper = createPopper(referenceElement, this._menu, popperConfig);
3793
-
3794
- if (isDisplayStatic) {
3795
- Manipulator.setDataAttribute(this._menu, 'popper', 'static');
3796
- }
3815
+ this._createPopper(parent);
3797
3816
  } // If this is a touch-enabled device we add extra
3798
3817
  // empty mouseover listeners to the body's immediate children;
3799
3818
  // only needed because of broken event delegation on iOS
@@ -3801,54 +3820,35 @@
3801
3820
 
3802
3821
 
3803
3822
  if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
3804
- [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', null, noop()));
3823
+ [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop));
3805
3824
  }
3806
3825
 
3807
3826
  this._element.focus();
3808
3827
 
3809
3828
  this._element.setAttribute('aria-expanded', true);
3810
3829
 
3811
- this._menu.classList.toggle(CLASS_NAME_SHOW$6);
3830
+ this._menu.classList.add(CLASS_NAME_SHOW$6);
3812
3831
 
3813
- this._element.classList.toggle(CLASS_NAME_SHOW$6);
3832
+ this._element.classList.add(CLASS_NAME_SHOW$6);
3814
3833
 
3815
3834
  EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
3816
3835
  }
3817
3836
 
3818
3837
  hide() {
3819
- if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW$6)) {
3838
+ if (isDisabled(this._element) || !this._isShown(this._menu)) {
3820
3839
  return;
3821
3840
  }
3822
3841
 
3823
3842
  const relatedTarget = {
3824
3843
  relatedTarget: this._element
3825
3844
  };
3826
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
3827
-
3828
- if (hideEvent.defaultPrevented) {
3829
- return;
3830
- }
3831
-
3832
- if (this._popper) {
3833
- this._popper.destroy();
3834
- }
3835
-
3836
- this._menu.classList.toggle(CLASS_NAME_SHOW$6);
3837
3845
 
3838
- this._element.classList.toggle(CLASS_NAME_SHOW$6);
3839
-
3840
- Manipulator.removeDataAttribute(this._menu, 'popper');
3841
- EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
3846
+ this._completeHide(relatedTarget);
3842
3847
  }
3843
3848
 
3844
3849
  dispose() {
3845
- EventHandler.off(this._element, EVENT_KEY$7);
3846
- this._menu = null;
3847
-
3848
3850
  if (this._popper) {
3849
3851
  this._popper.destroy();
3850
-
3851
- this._popper = null;
3852
3852
  }
3853
3853
 
3854
3854
  super.dispose();
@@ -3863,11 +3863,31 @@
3863
3863
  } // Private
3864
3864
 
3865
3865
 
3866
- _addEventListeners() {
3867
- EventHandler.on(this._element, EVENT_CLICK, event => {
3868
- event.preventDefault();
3869
- this.toggle();
3870
- });
3866
+ _completeHide(relatedTarget) {
3867
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
3868
+
3869
+ if (hideEvent.defaultPrevented) {
3870
+ return;
3871
+ } // If this is a touch-enabled device we remove the extra
3872
+ // empty mouseover listeners we added for iOS support
3873
+
3874
+
3875
+ if ('ontouchstart' in document.documentElement) {
3876
+ [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop));
3877
+ }
3878
+
3879
+ if (this._popper) {
3880
+ this._popper.destroy();
3881
+ }
3882
+
3883
+ this._menu.classList.remove(CLASS_NAME_SHOW$6);
3884
+
3885
+ this._element.classList.remove(CLASS_NAME_SHOW$6);
3886
+
3887
+ this._element.setAttribute('aria-expanded', 'false');
3888
+
3889
+ Manipulator.removeDataAttribute(this._menu, 'popper');
3890
+ EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
3871
3891
  }
3872
3892
 
3873
3893
  _getConfig(config) {
@@ -3875,16 +3895,45 @@
3875
3895
  ...Manipulator.getDataAttributes(this._element),
3876
3896
  ...config
3877
3897
  };
3878
- typeCheckConfig(NAME$7, config, this.constructor.DefaultType);
3898
+ typeCheckConfig(NAME$9, config, this.constructor.DefaultType);
3879
3899
 
3880
3900
  if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
3881
3901
  // Popper virtual elements require a getBoundingClientRect method
3882
- throw new TypeError(`${NAME$7.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
3902
+ throw new TypeError(`${NAME$9.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
3883
3903
  }
3884
3904
 
3885
3905
  return config;
3886
3906
  }
3887
3907
 
3908
+ _createPopper(parent) {
3909
+ if (typeof Popper === 'undefined') {
3910
+ throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
3911
+ }
3912
+
3913
+ let referenceElement = this._element;
3914
+
3915
+ if (this._config.reference === 'parent') {
3916
+ referenceElement = parent;
3917
+ } else if (isElement$1(this._config.reference)) {
3918
+ referenceElement = getElement(this._config.reference);
3919
+ } else if (typeof this._config.reference === 'object') {
3920
+ referenceElement = this._config.reference;
3921
+ }
3922
+
3923
+ const popperConfig = this._getPopperConfig();
3924
+
3925
+ const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
3926
+ this._popper = createPopper(referenceElement, this._menu, popperConfig);
3927
+
3928
+ if (isDisplayStatic) {
3929
+ Manipulator.setDataAttribute(this._menu, 'popper', 'static');
3930
+ }
3931
+ }
3932
+
3933
+ _isShown(element = this._element) {
3934
+ return element.classList.contains(CLASS_NAME_SHOW$6);
3935
+ }
3936
+
3888
3937
  _getMenuElement() {
3889
3938
  return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
3890
3939
  }
@@ -3956,100 +4005,81 @@
3956
4005
  return { ...defaultBsPopperConfig,
3957
4006
  ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
3958
4007
  };
3959
- } // Static
4008
+ }
3960
4009
 
4010
+ _selectMenuItem({
4011
+ key,
4012
+ target
4013
+ }) {
4014
+ const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
3961
4015
 
3962
- static dropdownInterface(element, config) {
3963
- let data = Data.get(element, DATA_KEY$7);
4016
+ if (!items.length) {
4017
+ return;
4018
+ } // if target isn't included in items (e.g. when expanding the dropdown)
4019
+ // allow cycling to get the last item in case key equals ARROW_UP_KEY
3964
4020
 
3965
- const _config = typeof config === 'object' ? config : null;
3966
4021
 
3967
- if (!data) {
3968
- data = new Dropdown(element, _config);
3969
- }
4022
+ getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
4023
+ } // Static
4024
+
4025
+
4026
+ static jQueryInterface(config) {
4027
+ return this.each(function () {
4028
+ const data = Dropdown.getOrCreateInstance(this, config);
4029
+
4030
+ if (typeof config !== 'string') {
4031
+ return;
4032
+ }
3970
4033
 
3971
- if (typeof config === 'string') {
3972
4034
  if (typeof data[config] === 'undefined') {
3973
4035
  throw new TypeError(`No method named "${config}"`);
3974
4036
  }
3975
4037
 
3976
4038
  data[config]();
3977
- }
3978
- }
3979
-
3980
- static jQueryInterface(config) {
3981
- return this.each(function () {
3982
- Dropdown.dropdownInterface(this, config);
3983
4039
  });
3984
4040
  }
3985
4041
 
3986
4042
  static clearMenus(event) {
3987
- if (event) {
3988
- if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY) {
3989
- return;
3990
- }
3991
-
3992
- if (/input|select|textarea|form/i.test(event.target.tagName)) {
3993
- return;
3994
- }
4043
+ if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) {
4044
+ return;
3995
4045
  }
3996
4046
 
3997
4047
  const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
3998
4048
 
3999
4049
  for (let i = 0, len = toggles.length; i < len; i++) {
4000
- const context = Data.get(toggles[i], DATA_KEY$7);
4001
- const relatedTarget = {
4002
- relatedTarget: toggles[i]
4003
- };
4004
-
4005
- if (event && event.type === 'click') {
4006
- relatedTarget.clickEvent = event;
4007
- }
4050
+ const context = Dropdown.getInstance(toggles[i]);
4008
4051
 
4009
- if (!context) {
4052
+ if (!context || context._config.autoClose === false) {
4010
4053
  continue;
4011
4054
  }
4012
4055
 
4013
- const dropdownMenu = context._menu;
4014
-
4015
- if (!toggles[i].classList.contains(CLASS_NAME_SHOW$6)) {
4056
+ if (!context._isShown()) {
4016
4057
  continue;
4017
4058
  }
4018
4059
 
4060
+ const relatedTarget = {
4061
+ relatedTarget: context._element
4062
+ };
4063
+
4019
4064
  if (event) {
4020
- // Don't close the menu if the clicked element or one of its parents is the dropdown button
4021
- if ([context._element].some(element => event.composedPath().includes(element))) {
4065
+ const composedPath = event.composedPath();
4066
+ const isMenuTarget = composedPath.includes(context._menu);
4067
+
4068
+ if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
4022
4069
  continue;
4023
- } // Tab navigation through the dropdown menu shouldn't close the menu
4070
+ } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
4024
4071
 
4025
4072
 
4026
- if (event.type === 'keyup' && event.key === TAB_KEY && dropdownMenu.contains(event.target)) {
4073
+ if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
4027
4074
  continue;
4028
4075
  }
4029
- }
4030
-
4031
- const hideEvent = EventHandler.trigger(toggles[i], EVENT_HIDE$4, relatedTarget);
4032
4076
 
4033
- if (hideEvent.defaultPrevented) {
4034
- continue;
4035
- } // If this is a touch-enabled device we remove the extra
4036
- // empty mouseover listeners we added for iOS support
4037
-
4038
-
4039
- if ('ontouchstart' in document.documentElement) {
4040
- [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', null, noop()));
4041
- }
4042
-
4043
- toggles[i].setAttribute('aria-expanded', 'false');
4044
-
4045
- if (context._popper) {
4046
- context._popper.destroy();
4077
+ if (event.type === 'click') {
4078
+ relatedTarget.clickEvent = event;
4079
+ }
4047
4080
  }
4048
4081
 
4049
- dropdownMenu.classList.remove(CLASS_NAME_SHOW$6);
4050
- toggles[i].classList.remove(CLASS_NAME_SHOW$6);
4051
- Manipulator.removeDataAttribute(dropdownMenu, 'popper');
4052
- EventHandler.trigger(toggles[i], EVENT_HIDDEN$4, relatedTarget);
4082
+ context._completeHide(relatedTarget);
4053
4083
  }
4054
4084
  }
4055
4085
 
@@ -4069,55 +4099,41 @@
4069
4099
  return;
4070
4100
  }
4071
4101
 
4102
+ const isActive = this.classList.contains(CLASS_NAME_SHOW$6);
4103
+
4104
+ if (!isActive && event.key === ESCAPE_KEY$2) {
4105
+ return;
4106
+ }
4107
+
4072
4108
  event.preventDefault();
4073
4109
  event.stopPropagation();
4074
4110
 
4075
- if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) {
4111
+ if (isDisabled(this)) {
4076
4112
  return;
4077
4113
  }
4078
4114
 
4079
- const parent = Dropdown.getParentFromElement(this);
4080
- const isActive = this.classList.contains(CLASS_NAME_SHOW$6);
4115
+ const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
4116
+ const instance = Dropdown.getOrCreateInstance(getToggleButton);
4081
4117
 
4082
4118
  if (event.key === ESCAPE_KEY$2) {
4083
- const button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
4084
- button.focus();
4085
- Dropdown.clearMenus();
4119
+ instance.hide();
4086
4120
  return;
4087
4121
  }
4088
4122
 
4089
- if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
4090
- const button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
4091
- button.click();
4123
+ if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
4124
+ if (!isActive) {
4125
+ instance.show();
4126
+ }
4127
+
4128
+ instance._selectMenuItem(event);
4129
+
4092
4130
  return;
4093
4131
  }
4094
4132
 
4095
4133
  if (!isActive || event.key === SPACE_KEY) {
4096
4134
  Dropdown.clearMenus();
4097
- return;
4098
- }
4099
-
4100
- const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible);
4101
-
4102
- if (!items.length) {
4103
- return;
4104
4135
  }
4105
-
4106
- let index = items.indexOf(event.target); // Up
4107
-
4108
- if (event.key === ARROW_UP_KEY && index > 0) {
4109
- index--;
4110
- } // Down
4111
-
4112
-
4113
- if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
4114
- index++;
4115
- } // index is -1 if the first keydown is an ArrowUp
4116
-
4117
-
4118
- index = index === -1 ? 0 : index;
4119
- items[index].focus();
4120
- }
4136
+ }
4121
4137
 
4122
4138
  }
4123
4139
  /**
@@ -4133,7 +4149,7 @@
4133
4149
  EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
4134
4150
  EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) {
4135
4151
  event.preventDefault();
4136
- Dropdown.dropdownInterface(this);
4152
+ Dropdown.getOrCreateInstance(this).toggle();
4137
4153
  });
4138
4154
  /**
4139
4155
  * ------------------------------------------------------------------------
@@ -4142,11 +4158,342 @@
4142
4158
  * add .Dropdown to jQuery only if jQuery is present
4143
4159
  */
4144
4160
 
4145
- defineJQueryPlugin(NAME$7, Dropdown);
4161
+ defineJQueryPlugin(Dropdown);
4162
+
4163
+ /**
4164
+ * --------------------------------------------------------------------------
4165
+ * Bootstrap (v5.1.0): util/scrollBar.js
4166
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4167
+ * --------------------------------------------------------------------------
4168
+ */
4169
+ const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
4170
+ const SELECTOR_STICKY_CONTENT = '.sticky-top';
4171
+
4172
+ class ScrollBarHelper {
4173
+ constructor() {
4174
+ this._element = document.body;
4175
+ }
4176
+
4177
+ getWidth() {
4178
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
4179
+ const documentWidth = document.documentElement.clientWidth;
4180
+ return Math.abs(window.innerWidth - documentWidth);
4181
+ }
4182
+
4183
+ hide() {
4184
+ const width = this.getWidth();
4185
+
4186
+ this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width
4187
+
4188
+
4189
+ this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
4190
+
4191
+
4192
+ this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
4193
+
4194
+ this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
4195
+ }
4196
+
4197
+ _disableOverFlow() {
4198
+ this._saveInitialAttribute(this._element, 'overflow');
4199
+
4200
+ this._element.style.overflow = 'hidden';
4201
+ }
4202
+
4203
+ _setElementAttributes(selector, styleProp, callback) {
4204
+ const scrollbarWidth = this.getWidth();
4205
+
4206
+ const manipulationCallBack = element => {
4207
+ if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
4208
+ return;
4209
+ }
4210
+
4211
+ this._saveInitialAttribute(element, styleProp);
4212
+
4213
+ const calculatedValue = window.getComputedStyle(element)[styleProp];
4214
+ element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
4215
+ };
4216
+
4217
+ this._applyManipulationCallback(selector, manipulationCallBack);
4218
+ }
4219
+
4220
+ reset() {
4221
+ this._resetElementAttributes(this._element, 'overflow');
4222
+
4223
+ this._resetElementAttributes(this._element, 'paddingRight');
4224
+
4225
+ this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
4226
+
4227
+ this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
4228
+ }
4229
+
4230
+ _saveInitialAttribute(element, styleProp) {
4231
+ const actualValue = element.style[styleProp];
4232
+
4233
+ if (actualValue) {
4234
+ Manipulator.setDataAttribute(element, styleProp, actualValue);
4235
+ }
4236
+ }
4237
+
4238
+ _resetElementAttributes(selector, styleProp) {
4239
+ const manipulationCallBack = element => {
4240
+ const value = Manipulator.getDataAttribute(element, styleProp);
4241
+
4242
+ if (typeof value === 'undefined') {
4243
+ element.style.removeProperty(styleProp);
4244
+ } else {
4245
+ Manipulator.removeDataAttribute(element, styleProp);
4246
+ element.style[styleProp] = value;
4247
+ }
4248
+ };
4249
+
4250
+ this._applyManipulationCallback(selector, manipulationCallBack);
4251
+ }
4252
+
4253
+ _applyManipulationCallback(selector, callBack) {
4254
+ if (isElement$1(selector)) {
4255
+ callBack(selector);
4256
+ } else {
4257
+ SelectorEngine.find(selector, this._element).forEach(callBack);
4258
+ }
4259
+ }
4260
+
4261
+ isOverflowing() {
4262
+ return this.getWidth() > 0;
4263
+ }
4264
+
4265
+ }
4266
+
4267
+ /**
4268
+ * --------------------------------------------------------------------------
4269
+ * Bootstrap (v5.1.0): util/backdrop.js
4270
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
4271
+ * --------------------------------------------------------------------------
4272
+ */
4273
+ const Default$7 = {
4274
+ className: 'modal-backdrop',
4275
+ isVisible: true,
4276
+ // if false, we use the backdrop helper without adding any element to the dom
4277
+ isAnimated: false,
4278
+ rootElement: 'body',
4279
+ // give the choice to place backdrop under different elements
4280
+ clickCallback: null
4281
+ };
4282
+ const DefaultType$7 = {
4283
+ className: 'string',
4284
+ isVisible: 'boolean',
4285
+ isAnimated: 'boolean',
4286
+ rootElement: '(element|string)',
4287
+ clickCallback: '(function|null)'
4288
+ };
4289
+ const NAME$8 = 'backdrop';
4290
+ const CLASS_NAME_FADE$4 = 'fade';
4291
+ const CLASS_NAME_SHOW$5 = 'show';
4292
+ const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$8}`;
4293
+
4294
+ class Backdrop {
4295
+ constructor(config) {
4296
+ this._config = this._getConfig(config);
4297
+ this._isAppended = false;
4298
+ this._element = null;
4299
+ }
4300
+
4301
+ show(callback) {
4302
+ if (!this._config.isVisible) {
4303
+ execute(callback);
4304
+ return;
4305
+ }
4306
+
4307
+ this._append();
4308
+
4309
+ if (this._config.isAnimated) {
4310
+ reflow(this._getElement());
4311
+ }
4312
+
4313
+ this._getElement().classList.add(CLASS_NAME_SHOW$5);
4314
+
4315
+ this._emulateAnimation(() => {
4316
+ execute(callback);
4317
+ });
4318
+ }
4319
+
4320
+ hide(callback) {
4321
+ if (!this._config.isVisible) {
4322
+ execute(callback);
4323
+ return;
4324
+ }
4325
+
4326
+ this._getElement().classList.remove(CLASS_NAME_SHOW$5);
4327
+
4328
+ this._emulateAnimation(() => {
4329
+ this.dispose();
4330
+ execute(callback);
4331
+ });
4332
+ } // Private
4333
+
4334
+
4335
+ _getElement() {
4336
+ if (!this._element) {
4337
+ const backdrop = document.createElement('div');
4338
+ backdrop.className = this._config.className;
4339
+
4340
+ if (this._config.isAnimated) {
4341
+ backdrop.classList.add(CLASS_NAME_FADE$4);
4342
+ }
4343
+
4344
+ this._element = backdrop;
4345
+ }
4346
+
4347
+ return this._element;
4348
+ }
4349
+
4350
+ _getConfig(config) {
4351
+ config = { ...Default$7,
4352
+ ...(typeof config === 'object' ? config : {})
4353
+ }; // use getElement() with the default "body" to get a fresh Element on each instantiation
4354
+
4355
+ config.rootElement = getElement(config.rootElement);
4356
+ typeCheckConfig(NAME$8, config, DefaultType$7);
4357
+ return config;
4358
+ }
4359
+
4360
+ _append() {
4361
+ if (this._isAppended) {
4362
+ return;
4363
+ }
4364
+
4365
+ this._config.rootElement.append(this._getElement());
4366
+
4367
+ EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
4368
+ execute(this._config.clickCallback);
4369
+ });
4370
+ this._isAppended = true;
4371
+ }
4372
+
4373
+ dispose() {
4374
+ if (!this._isAppended) {
4375
+ return;
4376
+ }
4377
+
4378
+ EventHandler.off(this._element, EVENT_MOUSEDOWN);
4379
+
4380
+ this._element.remove();
4381
+
4382
+ this._isAppended = false;
4383
+ }
4384
+
4385
+ _emulateAnimation(callback) {
4386
+ executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
4387
+ }
4388
+
4389
+ }
4390
+
4391
+ /**
4392
+ * --------------------------------------------------------------------------
4393
+ * Bootstrap (v5.1.0): util/focustrap.js
4394
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
4395
+ * --------------------------------------------------------------------------
4396
+ */
4397
+ const Default$6 = {
4398
+ trapElement: null,
4399
+ // The element to trap focus inside of
4400
+ autofocus: true
4401
+ };
4402
+ const DefaultType$6 = {
4403
+ trapElement: 'element',
4404
+ autofocus: 'boolean'
4405
+ };
4406
+ const NAME$7 = 'focustrap';
4407
+ const DATA_KEY$7 = 'bs.focustrap';
4408
+ const EVENT_KEY$7 = `.${DATA_KEY$7}`;
4409
+ const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$7}`;
4410
+ const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$7}`;
4411
+ const TAB_KEY = 'Tab';
4412
+ const TAB_NAV_FORWARD = 'forward';
4413
+ const TAB_NAV_BACKWARD = 'backward';
4414
+
4415
+ class FocusTrap {
4416
+ constructor(config) {
4417
+ this._config = this._getConfig(config);
4418
+ this._isActive = false;
4419
+ this._lastTabNavDirection = null;
4420
+ }
4421
+
4422
+ activate() {
4423
+ const {
4424
+ trapElement,
4425
+ autofocus
4426
+ } = this._config;
4427
+
4428
+ if (this._isActive) {
4429
+ return;
4430
+ }
4431
+
4432
+ if (autofocus) {
4433
+ trapElement.focus();
4434
+ }
4435
+
4436
+ EventHandler.off(document, EVENT_KEY$7); // guard against infinite focus loop
4437
+
4438
+ EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event));
4439
+ EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
4440
+ this._isActive = true;
4441
+ }
4442
+
4443
+ deactivate() {
4444
+ if (!this._isActive) {
4445
+ return;
4446
+ }
4447
+
4448
+ this._isActive = false;
4449
+ EventHandler.off(document, EVENT_KEY$7);
4450
+ } // Private
4451
+
4452
+
4453
+ _handleFocusin(event) {
4454
+ const {
4455
+ target
4456
+ } = event;
4457
+ const {
4458
+ trapElement
4459
+ } = this._config;
4460
+
4461
+ if (target === document || target === trapElement || trapElement.contains(target)) {
4462
+ return;
4463
+ }
4464
+
4465
+ const elements = SelectorEngine.focusableChildren(trapElement);
4466
+
4467
+ if (elements.length === 0) {
4468
+ trapElement.focus();
4469
+ } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
4470
+ elements[elements.length - 1].focus();
4471
+ } else {
4472
+ elements[0].focus();
4473
+ }
4474
+ }
4475
+
4476
+ _handleKeydown(event) {
4477
+ if (event.key !== TAB_KEY) {
4478
+ return;
4479
+ }
4480
+
4481
+ this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
4482
+ }
4483
+
4484
+ _getConfig(config) {
4485
+ config = { ...Default$6,
4486
+ ...(typeof config === 'object' ? config : {})
4487
+ };
4488
+ typeCheckConfig(NAME$7, config, DefaultType$6);
4489
+ return config;
4490
+ }
4491
+
4492
+ }
4146
4493
 
4147
4494
  /**
4148
4495
  * --------------------------------------------------------------------------
4149
- * Bootstrap (v5.0.0-beta3): modal.js
4496
+ * Bootstrap (v5.1.0): modal.js
4150
4497
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4151
4498
  * --------------------------------------------------------------------------
4152
4499
  */
@@ -4176,25 +4523,19 @@
4176
4523
  const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
4177
4524
  const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
4178
4525
  const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
4179
- const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`;
4180
4526
  const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
4181
- const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`;
4182
- const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$6}`;
4527
+ const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$6}`;
4528
+ const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
4183
4529
  const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
4184
4530
  const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
4185
4531
  const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
4186
- const CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
4187
- const CLASS_NAME_BACKDROP = 'modal-backdrop';
4188
4532
  const CLASS_NAME_OPEN = 'modal-open';
4189
- const CLASS_NAME_FADE$4 = 'fade';
4190
- const CLASS_NAME_SHOW$5 = 'show';
4533
+ const CLASS_NAME_FADE$3 = 'fade';
4534
+ const CLASS_NAME_SHOW$4 = 'show';
4191
4535
  const CLASS_NAME_STATIC = 'modal-static';
4192
4536
  const SELECTOR_DIALOG = '.modal-dialog';
4193
4537
  const SELECTOR_MODAL_BODY = '.modal-body';
4194
4538
  const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
4195
- const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]';
4196
- const SELECTOR_FIXED_CONTENT$1 = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
4197
- const SELECTOR_STICKY_CONTENT$1 = '.sticky-top';
4198
4539
  /**
4199
4540
  * ------------------------------------------------------------------------
4200
4541
  * Class Definition
@@ -4206,12 +4547,12 @@
4206
4547
  super(element);
4207
4548
  this._config = this._getConfig(config);
4208
4549
  this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
4209
- this._backdrop = null;
4550
+ this._backdrop = this._initializeBackDrop();
4551
+ this._focustrap = this._initializeFocusTrap();
4210
4552
  this._isShown = false;
4211
- this._isBodyOverflowing = false;
4212
4553
  this._ignoreBackdropClick = false;
4213
4554
  this._isTransitioning = false;
4214
- this._scrollbarWidth = 0;
4555
+ this._scrollBar = new ScrollBarHelper();
4215
4556
  } // Getters
4216
4557
 
4217
4558
 
@@ -4219,8 +4560,8 @@
4219
4560
  return Default$5;
4220
4561
  }
4221
4562
 
4222
- static get DATA_KEY() {
4223
- return DATA_KEY$6;
4563
+ static get NAME() {
4564
+ return NAME$6;
4224
4565
  } // Public
4225
4566
 
4226
4567
 
@@ -4233,23 +4574,23 @@
4233
4574
  return;
4234
4575
  }
4235
4576
 
4236
- if (this._isAnimated()) {
4237
- this._isTransitioning = true;
4238
- }
4239
-
4240
4577
  const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
4241
4578
  relatedTarget
4242
4579
  });
4243
4580
 
4244
- if (this._isShown || showEvent.defaultPrevented) {
4581
+ if (showEvent.defaultPrevented) {
4245
4582
  return;
4246
4583
  }
4247
4584
 
4248
4585
  this._isShown = true;
4249
4586
 
4250
- this._checkScrollbar();
4587
+ if (this._isAnimated()) {
4588
+ this._isTransitioning = true;
4589
+ }
4590
+
4591
+ this._scrollBar.hide();
4251
4592
 
4252
- this._setScrollbar();
4593
+ document.body.classList.add(CLASS_NAME_OPEN);
4253
4594
 
4254
4595
  this._adjustDialog();
4255
4596
 
@@ -4257,7 +4598,6 @@
4257
4598
 
4258
4599
  this._setResizeEvent();
4259
4600
 
4260
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, event => this.hide(event));
4261
4601
  EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
4262
4602
  EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
4263
4603
  if (event.target === this._element) {
@@ -4269,11 +4609,7 @@
4269
4609
  this._showBackdrop(() => this._showElement(relatedTarget));
4270
4610
  }
4271
4611
 
4272
- hide(event) {
4273
- if (event) {
4274
- event.preventDefault();
4275
- }
4276
-
4612
+ hide() {
4277
4613
  if (!this._isShown || this._isTransitioning) {
4278
4614
  return;
4279
4615
  }
@@ -4296,40 +4632,24 @@
4296
4632
 
4297
4633
  this._setResizeEvent();
4298
4634
 
4299
- EventHandler.off(document, EVENT_FOCUSIN$1);
4635
+ this._focustrap.deactivate();
4300
4636
 
4301
- this._element.classList.remove(CLASS_NAME_SHOW$5);
4637
+ this._element.classList.remove(CLASS_NAME_SHOW$4);
4302
4638
 
4303
- EventHandler.off(this._element, EVENT_CLICK_DISMISS$2);
4639
+ EventHandler.off(this._element, EVENT_CLICK_DISMISS);
4304
4640
  EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
4305
4641
 
4306
- if (isAnimated) {
4307
- const transitionDuration = getTransitionDurationFromElement(this._element);
4308
- EventHandler.one(this._element, 'transitionend', event => this._hideModal(event));
4309
- emulateTransitionEnd(this._element, transitionDuration);
4310
- } else {
4311
- this._hideModal();
4312
- }
4642
+ this._queueCallback(() => this._hideModal(), this._element, isAnimated);
4313
4643
  }
4314
4644
 
4315
4645
  dispose() {
4316
- [window, this._element, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
4646
+ [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
4647
+
4648
+ this._backdrop.dispose();
4649
+
4650
+ this._focustrap.deactivate();
4651
+
4317
4652
  super.dispose();
4318
- /**
4319
- * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
4320
- * Do not move `document` in `htmlElements` array
4321
- * It will remove `EVENT_CLICK_DATA_API` event that should remain
4322
- */
4323
-
4324
- EventHandler.off(document, EVENT_FOCUSIN$1);
4325
- this._config = null;
4326
- this._dialog = null;
4327
- this._backdrop = null;
4328
- this._isShown = null;
4329
- this._isBodyOverflowing = null;
4330
- this._ignoreBackdropClick = null;
4331
- this._isTransitioning = null;
4332
- this._scrollbarWidth = null;
4333
4653
  }
4334
4654
 
4335
4655
  handleUpdate() {
@@ -4337,9 +4657,24 @@
4337
4657
  } // Private
4338
4658
 
4339
4659
 
4660
+ _initializeBackDrop() {
4661
+ return new Backdrop({
4662
+ isVisible: Boolean(this._config.backdrop),
4663
+ // 'static' option will be translated to true, and booleans will keep their value
4664
+ isAnimated: this._isAnimated()
4665
+ });
4666
+ }
4667
+
4668
+ _initializeFocusTrap() {
4669
+ return new FocusTrap({
4670
+ trapElement: this._element
4671
+ });
4672
+ }
4673
+
4340
4674
  _getConfig(config) {
4341
4675
  config = { ...Default$5,
4342
- ...config
4676
+ ...Manipulator.getDataAttributes(this._element),
4677
+ ...(typeof config === 'object' ? config : {})
4343
4678
  };
4344
4679
  typeCheckConfig(NAME$6, config, DefaultType$5);
4345
4680
  return config;
@@ -4352,7 +4687,7 @@
4352
4687
 
4353
4688
  if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
4354
4689
  // Don't move modal's DOM position
4355
- document.body.appendChild(this._element);
4690
+ document.body.append(this._element);
4356
4691
  }
4357
4692
 
4358
4693
  this._element.style.display = 'block';
@@ -4373,15 +4708,11 @@
4373
4708
  reflow(this._element);
4374
4709
  }
4375
4710
 
4376
- this._element.classList.add(CLASS_NAME_SHOW$5);
4377
-
4378
- if (this._config.focus) {
4379
- this._enforceFocus();
4380
- }
4711
+ this._element.classList.add(CLASS_NAME_SHOW$4);
4381
4712
 
4382
4713
  const transitionComplete = () => {
4383
4714
  if (this._config.focus) {
4384
- this._element.focus();
4715
+ this._focustrap.activate();
4385
4716
  }
4386
4717
 
4387
4718
  this._isTransitioning = false;
@@ -4390,28 +4721,12 @@
4390
4721
  });
4391
4722
  };
4392
4723
 
4393
- if (isAnimated) {
4394
- const transitionDuration = getTransitionDurationFromElement(this._dialog);
4395
- EventHandler.one(this._dialog, 'transitionend', transitionComplete);
4396
- emulateTransitionEnd(this._dialog, transitionDuration);
4397
- } else {
4398
- transitionComplete();
4399
- }
4400
- }
4401
-
4402
- _enforceFocus() {
4403
- EventHandler.off(document, EVENT_FOCUSIN$1); // guard against infinite focus loop
4404
-
4405
- EventHandler.on(document, EVENT_FOCUSIN$1, event => {
4406
- if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
4407
- this._element.focus();
4408
- }
4409
- });
4724
+ this._queueCallback(transitionComplete, this._dialog, isAnimated);
4410
4725
  }
4411
4726
 
4412
4727
  _setEscapeEvent() {
4413
4728
  if (this._isShown) {
4414
- EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
4729
+ EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
4415
4730
  if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
4416
4731
  event.preventDefault();
4417
4732
  this.hide();
@@ -4420,7 +4735,7 @@
4420
4735
  }
4421
4736
  });
4422
4737
  } else {
4423
- EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS);
4738
+ EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
4424
4739
  }
4425
4740
  }
4426
4741
 
@@ -4443,89 +4758,40 @@
4443
4758
 
4444
4759
  this._isTransitioning = false;
4445
4760
 
4446
- this._showBackdrop(() => {
4761
+ this._backdrop.hide(() => {
4447
4762
  document.body.classList.remove(CLASS_NAME_OPEN);
4448
4763
 
4449
4764
  this._resetAdjustments();
4450
4765
 
4451
- this._resetScrollbar();
4766
+ this._scrollBar.reset();
4452
4767
 
4453
4768
  EventHandler.trigger(this._element, EVENT_HIDDEN$3);
4454
4769
  });
4455
4770
  }
4456
4771
 
4457
- _removeBackdrop() {
4458
- this._backdrop.parentNode.removeChild(this._backdrop);
4459
-
4460
- this._backdrop = null;
4461
- }
4462
-
4463
4772
  _showBackdrop(callback) {
4464
- const isAnimated = this._isAnimated();
4465
-
4466
- if (this._isShown && this._config.backdrop) {
4467
- this._backdrop = document.createElement('div');
4468
- this._backdrop.className = CLASS_NAME_BACKDROP;
4469
-
4470
- if (isAnimated) {
4471
- this._backdrop.classList.add(CLASS_NAME_FADE$4);
4472
- }
4473
-
4474
- document.body.appendChild(this._backdrop);
4475
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => {
4476
- if (this._ignoreBackdropClick) {
4477
- this._ignoreBackdropClick = false;
4478
- return;
4479
- }
4480
-
4481
- if (event.target !== event.currentTarget) {
4482
- return;
4483
- }
4484
-
4485
- if (this._config.backdrop === 'static') {
4486
- this._triggerBackdropTransition();
4487
- } else {
4488
- this.hide();
4489
- }
4490
- });
4491
-
4492
- if (isAnimated) {
4493
- reflow(this._backdrop);
4773
+ EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
4774
+ if (this._ignoreBackdropClick) {
4775
+ this._ignoreBackdropClick = false;
4776
+ return;
4494
4777
  }
4495
4778
 
4496
- this._backdrop.classList.add(CLASS_NAME_SHOW$5);
4497
-
4498
- if (!isAnimated) {
4499
- callback();
4779
+ if (event.target !== event.currentTarget) {
4500
4780
  return;
4501
4781
  }
4502
4782
 
4503
- const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
4504
- EventHandler.one(this._backdrop, 'transitionend', callback);
4505
- emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
4506
- } else if (!this._isShown && this._backdrop) {
4507
- this._backdrop.classList.remove(CLASS_NAME_SHOW$5);
4508
-
4509
- const callbackRemove = () => {
4510
- this._removeBackdrop();
4511
-
4512
- callback();
4513
- };
4514
-
4515
- if (isAnimated) {
4516
- const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
4517
- EventHandler.one(this._backdrop, 'transitionend', callbackRemove);
4518
- emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
4519
- } else {
4520
- callbackRemove();
4783
+ if (this._config.backdrop === true) {
4784
+ this.hide();
4785
+ } else if (this._config.backdrop === 'static') {
4786
+ this._triggerBackdropTransition();
4521
4787
  }
4522
- } else {
4523
- callback();
4524
- }
4788
+ });
4789
+
4790
+ this._backdrop.show(callback);
4525
4791
  }
4526
4792
 
4527
4793
  _isAnimated() {
4528
- return this._element.classList.contains(CLASS_NAME_FADE$4);
4794
+ return this._element.classList.contains(CLASS_NAME_FADE$3);
4529
4795
  }
4530
4796
 
4531
4797
  _triggerBackdropTransition() {
@@ -4535,27 +4801,32 @@
4535
4801
  return;
4536
4802
  }
4537
4803
 
4538
- const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
4804
+ const {
4805
+ classList,
4806
+ scrollHeight,
4807
+ style
4808
+ } = this._element;
4809
+ const isModalOverflowing = scrollHeight > document.documentElement.clientHeight; // return if the following background transition hasn't yet completed
4810
+
4811
+ if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
4812
+ return;
4813
+ }
4539
4814
 
4540
4815
  if (!isModalOverflowing) {
4541
- this._element.style.overflowY = 'hidden';
4816
+ style.overflowY = 'hidden';
4542
4817
  }
4543
4818
 
4544
- this._element.classList.add(CLASS_NAME_STATIC);
4819
+ classList.add(CLASS_NAME_STATIC);
4545
4820
 
4546
- const modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
4547
- EventHandler.off(this._element, 'transitionend');
4548
- EventHandler.one(this._element, 'transitionend', () => {
4549
- this._element.classList.remove(CLASS_NAME_STATIC);
4821
+ this._queueCallback(() => {
4822
+ classList.remove(CLASS_NAME_STATIC);
4550
4823
 
4551
4824
  if (!isModalOverflowing) {
4552
- EventHandler.one(this._element, 'transitionend', () => {
4553
- this._element.style.overflowY = '';
4554
- });
4555
- emulateTransitionEnd(this._element, modalTransitionDuration);
4825
+ this._queueCallback(() => {
4826
+ style.overflowY = '';
4827
+ }, this._dialog);
4556
4828
  }
4557
- });
4558
- emulateTransitionEnd(this._element, modalTransitionDuration);
4829
+ }, this._dialog);
4559
4830
 
4560
4831
  this._element.focus();
4561
4832
  } // ----------------------------------------------------------------------
@@ -4566,217 +4837,84 @@
4566
4837
  _adjustDialog() {
4567
4838
  const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
4568
4839
 
4569
- if (!this._isBodyOverflowing && isModalOverflowing && !isRTL() || this._isBodyOverflowing && !isModalOverflowing && isRTL()) {
4570
- this._element.style.paddingLeft = `${this._scrollbarWidth}px`;
4840
+ const scrollbarWidth = this._scrollBar.getWidth();
4841
+
4842
+ const isBodyOverflowing = scrollbarWidth > 0;
4843
+
4844
+ if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
4845
+ this._element.style.paddingLeft = `${scrollbarWidth}px`;
4571
4846
  }
4572
4847
 
4573
- if (this._isBodyOverflowing && !isModalOverflowing && !isRTL() || !this._isBodyOverflowing && isModalOverflowing && isRTL()) {
4574
- this._element.style.paddingRight = `${this._scrollbarWidth}px`;
4848
+ if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
4849
+ this._element.style.paddingRight = `${scrollbarWidth}px`;
4575
4850
  }
4576
4851
  }
4577
4852
 
4578
4853
  _resetAdjustments() {
4579
4854
  this._element.style.paddingLeft = '';
4580
4855
  this._element.style.paddingRight = '';
4581
- }
4582
-
4583
- _checkScrollbar() {
4584
- const rect = document.body.getBoundingClientRect();
4585
- this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
4586
- this._scrollbarWidth = this._getScrollbarWidth();
4587
- }
4588
-
4589
- _setScrollbar() {
4590
- if (this._isBodyOverflowing) {
4591
- this._setElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
4592
-
4593
- this._setElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight', calculatedValue => calculatedValue - this._scrollbarWidth);
4594
-
4595
- this._setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
4596
- }
4597
-
4598
- document.body.classList.add(CLASS_NAME_OPEN);
4599
- }
4600
-
4601
- _setElementAttributes(selector, styleProp, callback) {
4602
- SelectorEngine.find(selector).forEach(element => {
4603
- if (element !== document.body && window.innerWidth > element.clientWidth + this._scrollbarWidth) {
4604
- return;
4605
- }
4606
-
4607
- const actualValue = element.style[styleProp];
4608
- const calculatedValue = window.getComputedStyle(element)[styleProp];
4609
- Manipulator.setDataAttribute(element, styleProp, actualValue);
4610
- element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
4611
- });
4612
- }
4613
-
4614
- _resetScrollbar() {
4615
- this._resetElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight');
4616
-
4617
- this._resetElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight');
4618
-
4619
- this._resetElementAttributes('body', 'paddingRight');
4620
- }
4621
-
4622
- _resetElementAttributes(selector, styleProp) {
4623
- SelectorEngine.find(selector).forEach(element => {
4624
- const value = Manipulator.getDataAttribute(element, styleProp);
4625
-
4626
- if (typeof value === 'undefined' && element === document.body) {
4627
- element.style[styleProp] = '';
4628
- } else {
4629
- Manipulator.removeDataAttribute(element, styleProp);
4630
- element.style[styleProp] = value;
4631
- }
4632
- });
4633
- }
4634
-
4635
- _getScrollbarWidth() {
4636
- // thx d.walsh
4637
- const scrollDiv = document.createElement('div');
4638
- scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
4639
- document.body.appendChild(scrollDiv);
4640
- const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
4641
- document.body.removeChild(scrollDiv);
4642
- return scrollbarWidth;
4643
4856
  } // Static
4644
4857
 
4645
4858
 
4646
4859
  static jQueryInterface(config, relatedTarget) {
4647
4860
  return this.each(function () {
4648
- let data = Data.get(this, DATA_KEY$6);
4649
- const _config = { ...Default$5,
4650
- ...Manipulator.getDataAttributes(this),
4651
- ...(typeof config === 'object' && config ? config : {})
4652
- };
4861
+ const data = Modal.getOrCreateInstance(this, config);
4653
4862
 
4654
- if (!data) {
4655
- data = new Modal(this, _config);
4863
+ if (typeof config !== 'string') {
4864
+ return;
4656
4865
  }
4657
4866
 
4658
- if (typeof config === 'string') {
4659
- if (typeof data[config] === 'undefined') {
4660
- throw new TypeError(`No method named "${config}"`);
4661
- }
4662
-
4663
- data[config](relatedTarget);
4867
+ if (typeof data[config] === 'undefined') {
4868
+ throw new TypeError(`No method named "${config}"`);
4664
4869
  }
4665
- });
4666
- }
4667
-
4668
- }
4669
- /**
4670
- * ------------------------------------------------------------------------
4671
- * Data Api implementation
4672
- * ------------------------------------------------------------------------
4673
- */
4674
-
4675
-
4676
- EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
4677
- const target = getElementFromSelector(this);
4678
4870
 
4679
- if (this.tagName === 'A' || this.tagName === 'AREA') {
4680
- event.preventDefault();
4681
- }
4682
-
4683
- EventHandler.one(target, EVENT_SHOW$3, showEvent => {
4684
- if (showEvent.defaultPrevented) {
4685
- // only register focus restorer if modal will actually get shown
4686
- return;
4687
- }
4688
-
4689
- EventHandler.one(target, EVENT_HIDDEN$3, () => {
4690
- if (isVisible(this)) {
4691
- this.focus();
4692
- }
4871
+ data[config](relatedTarget);
4693
4872
  });
4694
- });
4695
- let data = Data.get(target, DATA_KEY$6);
4696
-
4697
- if (!data) {
4698
- const config = { ...Manipulator.getDataAttributes(target),
4699
- ...Manipulator.getDataAttributes(this)
4700
- };
4701
- data = new Modal(target, config);
4702
4873
  }
4703
4874
 
4704
- data.toggle(this);
4705
- });
4875
+ }
4706
4876
  /**
4707
4877
  * ------------------------------------------------------------------------
4708
- * jQuery
4709
- * ------------------------------------------------------------------------
4710
- * add .Modal to jQuery only if jQuery is present
4711
- */
4712
-
4713
- defineJQueryPlugin(NAME$6, Modal);
4714
-
4715
- /**
4716
- * --------------------------------------------------------------------------
4717
- * Bootstrap (v5.0.0-beta3): util/scrollBar.js
4718
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4719
- * --------------------------------------------------------------------------
4720
- */
4721
- const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed';
4722
- const SELECTOR_STICKY_CONTENT = '.sticky-top';
4723
-
4724
- const getWidth = () => {
4725
- // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
4726
- const documentWidth = document.documentElement.clientWidth;
4727
- return Math.abs(window.innerWidth - documentWidth);
4728
- };
4729
-
4730
- const hide = (width = getWidth()) => {
4731
- document.body.style.overflow = 'hidden';
4732
-
4733
- _setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
4734
-
4735
- _setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
4736
-
4737
- _setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width);
4738
- };
4739
-
4740
- const _setElementAttributes = (selector, styleProp, callback) => {
4741
- const scrollbarWidth = getWidth();
4742
- SelectorEngine.find(selector).forEach(element => {
4743
- if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
4744
- return;
4745
- }
4746
-
4747
- const actualValue = element.style[styleProp];
4748
- const calculatedValue = window.getComputedStyle(element)[styleProp];
4749
- Manipulator.setDataAttribute(element, styleProp, actualValue);
4750
- element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
4751
- });
4752
- };
4753
-
4754
- const reset = () => {
4755
- document.body.style.overflow = 'auto';
4756
-
4757
- _resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
4878
+ * Data Api implementation
4879
+ * ------------------------------------------------------------------------
4880
+ */
4758
4881
 
4759
- _resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
4760
4882
 
4761
- _resetElementAttributes('body', 'paddingRight');
4762
- };
4883
+ EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
4884
+ const target = getElementFromSelector(this);
4763
4885
 
4764
- const _resetElementAttributes = (selector, styleProp) => {
4765
- SelectorEngine.find(selector).forEach(element => {
4766
- const value = Manipulator.getDataAttribute(element, styleProp);
4886
+ if (['A', 'AREA'].includes(this.tagName)) {
4887
+ event.preventDefault();
4888
+ }
4767
4889
 
4768
- if (typeof value === 'undefined' && element === document.body) {
4769
- element.style.removeProperty(styleProp);
4770
- } else {
4771
- Manipulator.removeDataAttribute(element, styleProp);
4772
- element.style[styleProp] = value;
4890
+ EventHandler.one(target, EVENT_SHOW$3, showEvent => {
4891
+ if (showEvent.defaultPrevented) {
4892
+ // only register focus restorer if modal will actually get shown
4893
+ return;
4773
4894
  }
4895
+
4896
+ EventHandler.one(target, EVENT_HIDDEN$3, () => {
4897
+ if (isVisible(this)) {
4898
+ this.focus();
4899
+ }
4900
+ });
4774
4901
  });
4775
- };
4902
+ const data = Modal.getOrCreateInstance(target);
4903
+ data.toggle(this);
4904
+ });
4905
+ enableDismissTrigger(Modal);
4906
+ /**
4907
+ * ------------------------------------------------------------------------
4908
+ * jQuery
4909
+ * ------------------------------------------------------------------------
4910
+ * add .Modal to jQuery only if jQuery is present
4911
+ */
4912
+
4913
+ defineJQueryPlugin(Modal);
4776
4914
 
4777
4915
  /**
4778
4916
  * --------------------------------------------------------------------------
4779
- * Bootstrap (v5.0.0-beta3): offcanvas.js
4917
+ * Bootstrap (v5.1.0): offcanvas.js
4780
4918
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
4781
4919
  * --------------------------------------------------------------------------
4782
4920
  */
@@ -4802,19 +4940,15 @@
4802
4940
  keyboard: 'boolean',
4803
4941
  scroll: 'boolean'
4804
4942
  };
4805
- const CLASS_NAME_BACKDROP_BODY = 'offcanvas-backdrop';
4806
- const CLASS_NAME_SHOW$4 = 'show';
4807
- const CLASS_NAME_TOGGLING = 'offcanvas-toggling';
4943
+ const CLASS_NAME_SHOW$3 = 'show';
4944
+ const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
4808
4945
  const OPEN_SELECTOR = '.offcanvas.show';
4809
- const ACTIVE_SELECTOR = `${OPEN_SELECTOR}, .${CLASS_NAME_TOGGLING}`;
4810
4946
  const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
4811
4947
  const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
4812
4948
  const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
4813
4949
  const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
4814
- const EVENT_FOCUSIN = `focusin${EVENT_KEY$5}`;
4815
4950
  const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
4816
- const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`;
4817
- const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]';
4951
+ const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
4818
4952
  const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
4819
4953
  /**
4820
4954
  * ------------------------------------------------------------------------
@@ -4827,17 +4961,19 @@
4827
4961
  super(element);
4828
4962
  this._config = this._getConfig(config);
4829
4963
  this._isShown = false;
4964
+ this._backdrop = this._initializeBackDrop();
4965
+ this._focustrap = this._initializeFocusTrap();
4830
4966
 
4831
4967
  this._addEventListeners();
4832
4968
  } // Getters
4833
4969
 
4834
4970
 
4835
- static get Default() {
4836
- return Default$4;
4971
+ static get NAME() {
4972
+ return NAME$5;
4837
4973
  }
4838
4974
 
4839
- static get DATA_KEY() {
4840
- return DATA_KEY$5;
4975
+ static get Default() {
4976
+ return Default$4;
4841
4977
  } // Public
4842
4978
 
4843
4979
 
@@ -4861,35 +4997,31 @@
4861
4997
  this._isShown = true;
4862
4998
  this._element.style.visibility = 'visible';
4863
4999
 
4864
- if (this._config.backdrop) {
4865
- document.body.classList.add(CLASS_NAME_BACKDROP_BODY);
4866
- }
5000
+ this._backdrop.show();
4867
5001
 
4868
5002
  if (!this._config.scroll) {
4869
- hide();
5003
+ new ScrollBarHelper().hide();
4870
5004
  }
4871
5005
 
4872
- this._element.classList.add(CLASS_NAME_TOGGLING);
4873
-
4874
5006
  this._element.removeAttribute('aria-hidden');
4875
5007
 
4876
5008
  this._element.setAttribute('aria-modal', true);
4877
5009
 
4878
5010
  this._element.setAttribute('role', 'dialog');
4879
5011
 
4880
- this._element.classList.add(CLASS_NAME_SHOW$4);
5012
+ this._element.classList.add(CLASS_NAME_SHOW$3);
4881
5013
 
4882
5014
  const completeCallBack = () => {
4883
- this._element.classList.remove(CLASS_NAME_TOGGLING);
5015
+ if (!this._config.scroll) {
5016
+ this._focustrap.activate();
5017
+ }
4884
5018
 
4885
5019
  EventHandler.trigger(this._element, EVENT_SHOWN$2, {
4886
5020
  relatedTarget
4887
5021
  });
4888
-
4889
- this._enforceFocusOnElement(this._element);
4890
5022
  };
4891
5023
 
4892
- setTimeout(completeCallBack, getTransitionDurationFromElement(this._element));
5024
+ this._queueCallback(completeCallBack, this._element, true);
4893
5025
  }
4894
5026
 
4895
5027
  hide() {
@@ -4903,15 +5035,15 @@
4903
5035
  return;
4904
5036
  }
4905
5037
 
4906
- this._element.classList.add(CLASS_NAME_TOGGLING);
4907
-
4908
- EventHandler.off(document, EVENT_FOCUSIN);
5038
+ this._focustrap.deactivate();
4909
5039
 
4910
5040
  this._element.blur();
4911
5041
 
4912
5042
  this._isShown = false;
4913
5043
 
4914
- this._element.classList.remove(CLASS_NAME_SHOW$4);
5044
+ this._element.classList.remove(CLASS_NAME_SHOW$3);
5045
+
5046
+ this._backdrop.hide();
4915
5047
 
4916
5048
  const completeCallback = () => {
4917
5049
  this._element.setAttribute('aria-hidden', true);
@@ -4922,20 +5054,22 @@
4922
5054
 
4923
5055
  this._element.style.visibility = 'hidden';
4924
5056
 
4925
- if (this._config.backdrop) {
4926
- document.body.classList.remove(CLASS_NAME_BACKDROP_BODY);
4927
- }
4928
-
4929
5057
  if (!this._config.scroll) {
4930
- reset();
5058
+ new ScrollBarHelper().reset();
4931
5059
  }
4932
5060
 
4933
5061
  EventHandler.trigger(this._element, EVENT_HIDDEN$2);
4934
-
4935
- this._element.classList.remove(CLASS_NAME_TOGGLING);
4936
5062
  };
4937
5063
 
4938
- setTimeout(completeCallback, getTransitionDurationFromElement(this._element));
5064
+ this._queueCallback(completeCallback, this._element, true);
5065
+ }
5066
+
5067
+ dispose() {
5068
+ this._backdrop.dispose();
5069
+
5070
+ this._focustrap.deactivate();
5071
+
5072
+ super.dispose();
4939
5073
  } // Private
4940
5074
 
4941
5075
 
@@ -4948,37 +5082,34 @@
4948
5082
  return config;
4949
5083
  }
4950
5084
 
4951
- _enforceFocusOnElement(element) {
4952
- EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
5085
+ _initializeBackDrop() {
5086
+ return new Backdrop({
5087
+ className: CLASS_NAME_BACKDROP,
5088
+ isVisible: this._config.backdrop,
5089
+ isAnimated: true,
5090
+ rootElement: this._element.parentNode,
5091
+ clickCallback: () => this.hide()
5092
+ });
5093
+ }
4953
5094
 
4954
- EventHandler.on(document, EVENT_FOCUSIN, event => {
4955
- if (document !== event.target && element !== event.target && !element.contains(event.target)) {
4956
- element.focus();
4957
- }
5095
+ _initializeFocusTrap() {
5096
+ return new FocusTrap({
5097
+ trapElement: this._element
4958
5098
  });
4959
- element.focus();
4960
5099
  }
4961
5100
 
4962
5101
  _addEventListeners() {
4963
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
4964
- EventHandler.on(document, 'keydown', event => {
5102
+ EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
4965
5103
  if (this._config.keyboard && event.key === ESCAPE_KEY) {
4966
5104
  this.hide();
4967
5105
  }
4968
5106
  });
4969
- EventHandler.on(document, EVENT_CLICK_DATA_API$1, event => {
4970
- const target = SelectorEngine.findOne(getSelectorFromElement(event.target));
4971
-
4972
- if (!this._element.contains(event.target) && target !== this._element) {
4973
- this.hide();
4974
- }
4975
- });
4976
5107
  } // Static
4977
5108
 
4978
5109
 
4979
5110
  static jQueryInterface(config) {
4980
5111
  return this.each(function () {
4981
- const data = Data.get(this, DATA_KEY$5) || new Offcanvas(this, typeof config === 'object' ? config : {});
5112
+ const data = Offcanvas.getOrCreateInstance(this, config);
4982
5113
 
4983
5114
  if (typeof config !== 'string') {
4984
5115
  return;
@@ -5018,29 +5149,28 @@
5018
5149
  }
5019
5150
  }); // avoid conflict when clicking a toggler of an offcanvas, while another is open
5020
5151
 
5021
- const allReadyOpen = SelectorEngine.findOne(ACTIVE_SELECTOR);
5152
+ const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
5022
5153
 
5023
5154
  if (allReadyOpen && allReadyOpen !== target) {
5024
- return;
5155
+ Offcanvas.getInstance(allReadyOpen).hide();
5025
5156
  }
5026
5157
 
5027
- const data = Data.get(target, DATA_KEY$5) || new Offcanvas(target);
5158
+ const data = Offcanvas.getOrCreateInstance(target);
5028
5159
  data.toggle(this);
5029
5160
  });
5030
- EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
5031
- SelectorEngine.find(OPEN_SELECTOR).forEach(el => (Data.get(el, DATA_KEY$5) || new Offcanvas(el)).show());
5032
- });
5161
+ EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
5162
+ enableDismissTrigger(Offcanvas);
5033
5163
  /**
5034
5164
  * ------------------------------------------------------------------------
5035
5165
  * jQuery
5036
5166
  * ------------------------------------------------------------------------
5037
5167
  */
5038
5168
 
5039
- defineJQueryPlugin(NAME$5, Offcanvas);
5169
+ defineJQueryPlugin(Offcanvas);
5040
5170
 
5041
5171
  /**
5042
5172
  * --------------------------------------------------------------------------
5043
- * Bootstrap (v5.0.0-beta3): util/sanitizer.js
5173
+ * Bootstrap (v5.1.0): util/sanitizer.js
5044
5174
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5045
5175
  * --------------------------------------------------------------------------
5046
5176
  */
@@ -5135,7 +5265,7 @@
5135
5265
  const elName = el.nodeName.toLowerCase();
5136
5266
 
5137
5267
  if (!allowlistKeys.includes(elName)) {
5138
- el.parentNode.removeChild(el);
5268
+ el.remove();
5139
5269
  continue;
5140
5270
  }
5141
5271
 
@@ -5153,7 +5283,7 @@
5153
5283
 
5154
5284
  /**
5155
5285
  * --------------------------------------------------------------------------
5156
- * Bootstrap (v5.0.0-beta3): tooltip.js
5286
+ * Bootstrap (v5.1.0): tooltip.js
5157
5287
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5158
5288
  * --------------------------------------------------------------------------
5159
5289
  */
@@ -5167,7 +5297,6 @@
5167
5297
  const DATA_KEY$4 = 'bs.tooltip';
5168
5298
  const EVENT_KEY$4 = `.${DATA_KEY$4}`;
5169
5299
  const CLASS_PREFIX$1 = 'bs-tooltip';
5170
- const BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, 'g');
5171
5300
  const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
5172
5301
  const DefaultType$3 = {
5173
5302
  animation: 'boolean',
@@ -5226,12 +5355,14 @@
5226
5355
  MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
5227
5356
  MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
5228
5357
  };
5229
- const CLASS_NAME_FADE$3 = 'fade';
5358
+ const CLASS_NAME_FADE$2 = 'fade';
5230
5359
  const CLASS_NAME_MODAL = 'modal';
5231
- const CLASS_NAME_SHOW$3 = 'show';
5360
+ const CLASS_NAME_SHOW$2 = 'show';
5232
5361
  const HOVER_STATE_SHOW = 'show';
5233
5362
  const HOVER_STATE_OUT = 'out';
5234
5363
  const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
5364
+ const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
5365
+ const EVENT_MODAL_HIDE = 'hide.bs.modal';
5235
5366
  const TRIGGER_HOVER = 'hover';
5236
5367
  const TRIGGER_FOCUS = 'focus';
5237
5368
  const TRIGGER_CLICK = 'click';
@@ -5256,7 +5387,7 @@
5256
5387
  this._activeTrigger = {};
5257
5388
  this._popper = null; // Protected
5258
5389
 
5259
- this.config = this._getConfig(config);
5390
+ this._config = this._getConfig(config);
5260
5391
  this.tip = null;
5261
5392
 
5262
5393
  this._setListeners();
@@ -5271,18 +5402,10 @@
5271
5402
  return NAME$4;
5272
5403
  }
5273
5404
 
5274
- static get DATA_KEY() {
5275
- return DATA_KEY$4;
5276
- }
5277
-
5278
5405
  static get Event() {
5279
5406
  return Event$2;
5280
5407
  }
5281
5408
 
5282
- static get EVENT_KEY() {
5283
- return EVENT_KEY$4;
5284
- }
5285
-
5286
5409
  static get DefaultType() {
5287
5410
  return DefaultType$3;
5288
5411
  } // Public
@@ -5316,7 +5439,7 @@
5316
5439
  context._leave(null, context);
5317
5440
  }
5318
5441
  } else {
5319
- if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
5442
+ if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$2)) {
5320
5443
  this._leave(null, this);
5321
5444
 
5322
5445
  return;
@@ -5328,25 +5451,16 @@
5328
5451
 
5329
5452
  dispose() {
5330
5453
  clearTimeout(this._timeout);
5331
- EventHandler.off(this._element, this.constructor.EVENT_KEY);
5332
- EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
5454
+ EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
5333
5455
 
5334
- if (this.tip && this.tip.parentNode) {
5335
- this.tip.parentNode.removeChild(this.tip);
5456
+ if (this.tip) {
5457
+ this.tip.remove();
5336
5458
  }
5337
5459
 
5338
- this._isEnabled = null;
5339
- this._timeout = null;
5340
- this._hoverState = null;
5341
- this._activeTrigger = null;
5342
-
5343
5460
  if (this._popper) {
5344
5461
  this._popper.destroy();
5345
5462
  }
5346
5463
 
5347
- this._popper = null;
5348
- this.config = null;
5349
- this.tip = null;
5350
5464
  super.dispose();
5351
5465
  }
5352
5466
 
@@ -5373,24 +5487,23 @@
5373
5487
 
5374
5488
  this._element.setAttribute('aria-describedby', tipId);
5375
5489
 
5376
- this.setContent();
5377
-
5378
- if (this.config.animation) {
5379
- tip.classList.add(CLASS_NAME_FADE$3);
5490
+ if (this._config.animation) {
5491
+ tip.classList.add(CLASS_NAME_FADE$2);
5380
5492
  }
5381
5493
 
5382
- const placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this._element) : this.config.placement;
5494
+ const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
5383
5495
 
5384
5496
  const attachment = this._getAttachment(placement);
5385
5497
 
5386
5498
  this._addAttachmentClass(attachment);
5387
5499
 
5388
- const container = this._getContainer();
5389
-
5500
+ const {
5501
+ container
5502
+ } = this._config;
5390
5503
  Data.set(tip, this.constructor.DATA_KEY, this);
5391
5504
 
5392
5505
  if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
5393
- container.appendChild(tip);
5506
+ container.append(tip);
5394
5507
  EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
5395
5508
  }
5396
5509
 
@@ -5400,8 +5513,9 @@
5400
5513
  this._popper = createPopper(this._element, tip, this._getPopperConfig(attachment));
5401
5514
  }
5402
5515
 
5403
- tip.classList.add(CLASS_NAME_SHOW$3);
5404
- const customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass;
5516
+ tip.classList.add(CLASS_NAME_SHOW$2);
5517
+
5518
+ const customClass = this._resolvePossibleFunction(this._config.customClass);
5405
5519
 
5406
5520
  if (customClass) {
5407
5521
  tip.classList.add(...customClass.split(' '));
@@ -5413,7 +5527,7 @@
5413
5527
 
5414
5528
  if ('ontouchstart' in document.documentElement) {
5415
5529
  [].concat(...document.body.children).forEach(element => {
5416
- EventHandler.on(element, 'mouseover', noop());
5530
+ EventHandler.on(element, 'mouseover', noop);
5417
5531
  });
5418
5532
  }
5419
5533
 
@@ -5427,13 +5541,9 @@
5427
5541
  }
5428
5542
  };
5429
5543
 
5430
- if (this.tip.classList.contains(CLASS_NAME_FADE$3)) {
5431
- const transitionDuration = getTransitionDurationFromElement(this.tip);
5432
- EventHandler.one(this.tip, 'transitionend', complete);
5433
- emulateTransitionEnd(this.tip, transitionDuration);
5434
- } else {
5435
- complete();
5436
- }
5544
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
5545
+
5546
+ this._queueCallback(complete, this.tip, isAnimated);
5437
5547
  }
5438
5548
 
5439
5549
  hide() {
@@ -5448,8 +5558,8 @@
5448
5558
  return;
5449
5559
  }
5450
5560
 
5451
- if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
5452
- tip.parentNode.removeChild(tip);
5561
+ if (this._hoverState !== HOVER_STATE_SHOW) {
5562
+ tip.remove();
5453
5563
  }
5454
5564
 
5455
5565
  this._cleanTipClass();
@@ -5471,7 +5581,7 @@
5471
5581
  return;
5472
5582
  }
5473
5583
 
5474
- tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra
5584
+ tip.classList.remove(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we remove the extra
5475
5585
  // empty mouseover listeners we added for iOS support
5476
5586
 
5477
5587
  if ('ontouchstart' in document.documentElement) {
@@ -5481,14 +5591,9 @@
5481
5591
  this._activeTrigger[TRIGGER_CLICK] = false;
5482
5592
  this._activeTrigger[TRIGGER_FOCUS] = false;
5483
5593
  this._activeTrigger[TRIGGER_HOVER] = false;
5594
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
5484
5595
 
5485
- if (this.tip.classList.contains(CLASS_NAME_FADE$3)) {
5486
- const transitionDuration = getTransitionDurationFromElement(tip);
5487
- EventHandler.one(tip, 'transitionend', complete);
5488
- emulateTransitionEnd(tip, transitionDuration);
5489
- } else {
5490
- complete();
5491
- }
5596
+ this._queueCallback(complete, this.tip, isAnimated);
5492
5597
 
5493
5598
  this._hoverState = '';
5494
5599
  }
@@ -5510,15 +5615,28 @@
5510
5615
  }
5511
5616
 
5512
5617
  const element = document.createElement('div');
5513
- element.innerHTML = this.config.template;
5514
- this.tip = element.children[0];
5618
+ element.innerHTML = this._config.template;
5619
+ const tip = element.children[0];
5620
+ this.setContent(tip);
5621
+ tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
5622
+ this.tip = tip;
5515
5623
  return this.tip;
5516
5624
  }
5517
5625
 
5518
- setContent() {
5519
- const tip = this.getTipElement();
5520
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
5521
- tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3);
5626
+ setContent(tip) {
5627
+ this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
5628
+ }
5629
+
5630
+ _sanitizeAndSetContent(template, content, selector) {
5631
+ const templateElement = SelectorEngine.findOne(selector, template);
5632
+
5633
+ if (!content && templateElement) {
5634
+ templateElement.remove();
5635
+ return;
5636
+ } // we use append for html objects to maintain js events
5637
+
5638
+
5639
+ this.setElementContent(templateElement, content);
5522
5640
  }
5523
5641
 
5524
5642
  setElementContent(element, content) {
@@ -5526,16 +5644,13 @@
5526
5644
  return;
5527
5645
  }
5528
5646
 
5529
- if (typeof content === 'object' && isElement$1(content)) {
5530
- if (content.jquery) {
5531
- content = content[0];
5532
- } // content is a DOM node or a jQuery
5533
-
5647
+ if (isElement$1(content)) {
5648
+ content = getElement(content); // content is a DOM node or a jQuery
5534
5649
 
5535
- if (this.config.html) {
5650
+ if (this._config.html) {
5536
5651
  if (content.parentNode !== element) {
5537
5652
  element.innerHTML = '';
5538
- element.appendChild(content);
5653
+ element.append(content);
5539
5654
  }
5540
5655
  } else {
5541
5656
  element.textContent = content.textContent;
@@ -5544,9 +5659,9 @@
5544
5659
  return;
5545
5660
  }
5546
5661
 
5547
- if (this.config.html) {
5548
- if (this.config.sanitize) {
5549
- content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
5662
+ if (this._config.html) {
5663
+ if (this._config.sanitize) {
5664
+ content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
5550
5665
  }
5551
5666
 
5552
5667
  element.innerHTML = content;
@@ -5556,13 +5671,9 @@
5556
5671
  }
5557
5672
 
5558
5673
  getTitle() {
5559
- let title = this._element.getAttribute('data-bs-original-title');
5674
+ const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
5560
5675
 
5561
- if (!title) {
5562
- title = typeof this.config.title === 'function' ? this.config.title.call(this._element) : this.config.title;
5563
- }
5564
-
5565
- return title;
5676
+ return this._resolvePossibleFunction(title);
5566
5677
  }
5567
5678
 
5568
5679
  updateAttachment(attachment) {
@@ -5579,21 +5690,13 @@
5579
5690
 
5580
5691
 
5581
5692
  _initializeOnDelegatedTarget(event, context) {
5582
- const dataKey = this.constructor.DATA_KEY;
5583
- context = context || Data.get(event.delegateTarget, dataKey);
5584
-
5585
- if (!context) {
5586
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
5587
- Data.set(event.delegateTarget, dataKey, context);
5588
- }
5589
-
5590
- return context;
5693
+ return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
5591
5694
  }
5592
5695
 
5593
5696
  _getOffset() {
5594
5697
  const {
5595
5698
  offset
5596
- } = this.config;
5699
+ } = this._config;
5597
5700
 
5598
5701
  if (typeof offset === 'string') {
5599
5702
  return offset.split(',').map(val => Number.parseInt(val, 10));
@@ -5606,14 +5709,17 @@
5606
5709
  return offset;
5607
5710
  }
5608
5711
 
5712
+ _resolvePossibleFunction(content) {
5713
+ return typeof content === 'function' ? content.call(this._element) : content;
5714
+ }
5715
+
5609
5716
  _getPopperConfig(attachment) {
5610
5717
  const defaultBsPopperConfig = {
5611
5718
  placement: attachment,
5612
5719
  modifiers: [{
5613
5720
  name: 'flip',
5614
5721
  options: {
5615
- altBoundary: true,
5616
- fallbackPlacements: this.config.fallbackPlacements
5722
+ fallbackPlacements: this._config.fallbackPlacements
5617
5723
  }
5618
5724
  }, {
5619
5725
  name: 'offset',
@@ -5623,7 +5729,7 @@
5623
5729
  }, {
5624
5730
  name: 'preventOverflow',
5625
5731
  options: {
5626
- boundary: this.config.boundary
5732
+ boundary: this._config.boundary
5627
5733
  }
5628
5734
  }, {
5629
5735
  name: 'arrow',
@@ -5643,24 +5749,12 @@
5643
5749
  }
5644
5750
  };
5645
5751
  return { ...defaultBsPopperConfig,
5646
- ...(typeof this.config.popperConfig === 'function' ? this.config.popperConfig(defaultBsPopperConfig) : this.config.popperConfig)
5752
+ ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
5647
5753
  };
5648
5754
  }
5649
5755
 
5650
5756
  _addAttachmentClass(attachment) {
5651
- this.getTipElement().classList.add(`${CLASS_PREFIX$1}-${this.updateAttachment(attachment)}`);
5652
- }
5653
-
5654
- _getContainer() {
5655
- if (this.config.container === false) {
5656
- return document.body;
5657
- }
5658
-
5659
- if (isElement$1(this.config.container)) {
5660
- return this.config.container;
5661
- }
5662
-
5663
- return SelectorEngine.findOne(this.config.container);
5757
+ this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
5664
5758
  }
5665
5759
 
5666
5760
  _getAttachment(placement) {
@@ -5668,15 +5762,16 @@
5668
5762
  }
5669
5763
 
5670
5764
  _setListeners() {
5671
- const triggers = this.config.trigger.split(' ');
5765
+ const triggers = this._config.trigger.split(' ');
5766
+
5672
5767
  triggers.forEach(trigger => {
5673
5768
  if (trigger === 'click') {
5674
- EventHandler.on(this._element, this.constructor.Event.CLICK, this.config.selector, event => this.toggle(event));
5769
+ EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event));
5675
5770
  } else if (trigger !== TRIGGER_MANUAL) {
5676
5771
  const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
5677
5772
  const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
5678
- EventHandler.on(this._element, eventIn, this.config.selector, event => this._enter(event));
5679
- EventHandler.on(this._element, eventOut, this.config.selector, event => this._leave(event));
5773
+ EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event));
5774
+ EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event));
5680
5775
  }
5681
5776
  });
5682
5777
 
@@ -5686,10 +5781,10 @@
5686
5781
  }
5687
5782
  };
5688
5783
 
5689
- EventHandler.on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
5784
+ EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
5690
5785
 
5691
- if (this.config.selector) {
5692
- this.config = { ...this.config,
5786
+ if (this._config.selector) {
5787
+ this._config = { ...this._config,
5693
5788
  trigger: 'manual',
5694
5789
  selector: ''
5695
5790
  };
@@ -5721,7 +5816,7 @@
5721
5816
  context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
5722
5817
  }
5723
5818
 
5724
- if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
5819
+ if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$2) || context._hoverState === HOVER_STATE_SHOW) {
5725
5820
  context._hoverState = HOVER_STATE_SHOW;
5726
5821
  return;
5727
5822
  }
@@ -5729,7 +5824,7 @@
5729
5824
  clearTimeout(context._timeout);
5730
5825
  context._hoverState = HOVER_STATE_SHOW;
5731
5826
 
5732
- if (!context.config.delay || !context.config.delay.show) {
5827
+ if (!context._config.delay || !context._config.delay.show) {
5733
5828
  context.show();
5734
5829
  return;
5735
5830
  }
@@ -5738,7 +5833,7 @@
5738
5833
  if (context._hoverState === HOVER_STATE_SHOW) {
5739
5834
  context.show();
5740
5835
  }
5741
- }, context.config.delay.show);
5836
+ }, context._config.delay.show);
5742
5837
  }
5743
5838
 
5744
5839
  _leave(event, context) {
@@ -5755,7 +5850,7 @@
5755
5850
  clearTimeout(context._timeout);
5756
5851
  context._hoverState = HOVER_STATE_OUT;
5757
5852
 
5758
- if (!context.config.delay || !context.config.delay.hide) {
5853
+ if (!context._config.delay || !context._config.delay.hide) {
5759
5854
  context.hide();
5760
5855
  return;
5761
5856
  }
@@ -5764,7 +5859,7 @@
5764
5859
  if (context._hoverState === HOVER_STATE_OUT) {
5765
5860
  context.hide();
5766
5861
  }
5767
- }, context.config.delay.hide);
5862
+ }, context._config.delay.hide);
5768
5863
  }
5769
5864
 
5770
5865
  _isWithActiveTrigger() {
@@ -5784,15 +5879,11 @@
5784
5879
  delete dataAttributes[dataAttr];
5785
5880
  }
5786
5881
  });
5787
-
5788
- if (config && typeof config.container === 'object' && config.container.jquery) {
5789
- config.container = config.container[0];
5790
- }
5791
-
5792
5882
  config = { ...this.constructor.Default,
5793
5883
  ...dataAttributes,
5794
5884
  ...(typeof config === 'object' && config ? config : {})
5795
5885
  };
5886
+ config.container = config.container === false ? document.body : getElement(config.container);
5796
5887
 
5797
5888
  if (typeof config.delay === 'number') {
5798
5889
  config.delay = {
@@ -5821,26 +5912,32 @@
5821
5912
  _getDelegateConfig() {
5822
5913
  const config = {};
5823
5914
 
5824
- if (this.config) {
5825
- for (const key in this.config) {
5826
- if (this.constructor.Default[key] !== this.config[key]) {
5827
- config[key] = this.config[key];
5828
- }
5915
+ for (const key in this._config) {
5916
+ if (this.constructor.Default[key] !== this._config[key]) {
5917
+ config[key] = this._config[key];
5829
5918
  }
5830
- }
5919
+ } // In the future can be replaced with:
5920
+ // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
5921
+ // `Object.fromEntries(keysWithDifferentValues)`
5922
+
5831
5923
 
5832
5924
  return config;
5833
5925
  }
5834
5926
 
5835
5927
  _cleanTipClass() {
5836
5928
  const tip = this.getTipElement();
5837
- const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
5929
+ const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
5930
+ const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
5838
5931
 
5839
5932
  if (tabClass !== null && tabClass.length > 0) {
5840
5933
  tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
5841
5934
  }
5842
5935
  }
5843
5936
 
5937
+ _getBasicClassPrefix() {
5938
+ return CLASS_PREFIX$1;
5939
+ }
5940
+
5844
5941
  _handlePopperPlacementChange(popperData) {
5845
5942
  const {
5846
5943
  state
@@ -5860,17 +5957,7 @@
5860
5957
 
5861
5958
  static jQueryInterface(config) {
5862
5959
  return this.each(function () {
5863
- let data = Data.get(this, DATA_KEY$4);
5864
-
5865
- const _config = typeof config === 'object' && config;
5866
-
5867
- if (!data && /dispose|hide/.test(config)) {
5868
- return;
5869
- }
5870
-
5871
- if (!data) {
5872
- data = new Tooltip(this, _config);
5873
- }
5960
+ const data = Tooltip.getOrCreateInstance(this, config);
5874
5961
 
5875
5962
  if (typeof config === 'string') {
5876
5963
  if (typeof data[config] === 'undefined') {
@@ -5891,11 +5978,11 @@
5891
5978
  */
5892
5979
 
5893
5980
 
5894
- defineJQueryPlugin(NAME$4, Tooltip);
5981
+ defineJQueryPlugin(Tooltip);
5895
5982
 
5896
5983
  /**
5897
5984
  * --------------------------------------------------------------------------
5898
- * Bootstrap (v5.0.0-beta3): popover.js
5985
+ * Bootstrap (v5.1.0): popover.js
5899
5986
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5900
5987
  * --------------------------------------------------------------------------
5901
5988
  */
@@ -5909,7 +5996,6 @@
5909
5996
  const DATA_KEY$3 = 'bs.popover';
5910
5997
  const EVENT_KEY$3 = `.${DATA_KEY$3}`;
5911
5998
  const CLASS_PREFIX = 'bs-popover';
5912
- const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
5913
5999
  const Default$2 = { ...Tooltip.Default,
5914
6000
  placement: 'right',
5915
6001
  offset: [0, 8],
@@ -5932,8 +6018,6 @@
5932
6018
  MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
5933
6019
  MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
5934
6020
  };
5935
- const CLASS_NAME_FADE$2 = 'fade';
5936
- const CLASS_NAME_SHOW$2 = 'show';
5937
6021
  const SELECTOR_TITLE = '.popover-header';
5938
6022
  const SELECTOR_CONTENT = '.popover-body';
5939
6023
  /**
@@ -5952,18 +6036,10 @@
5952
6036
  return NAME$3;
5953
6037
  }
5954
6038
 
5955
- static get DATA_KEY() {
5956
- return DATA_KEY$3;
5957
- }
5958
-
5959
6039
  static get Event() {
5960
6040
  return Event$1;
5961
6041
  }
5962
6042
 
5963
- static get EVENT_KEY() {
5964
- return EVENT_KEY$3;
5965
- }
5966
-
5967
6043
  static get DefaultType() {
5968
6044
  return DefaultType$2;
5969
6045
  } // Overrides
@@ -5973,54 +6049,25 @@
5973
6049
  return this.getTitle() || this._getContent();
5974
6050
  }
5975
6051
 
5976
- setContent() {
5977
- const tip = this.getTipElement(); // we use append for html objects to maintain js events
5978
-
5979
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
6052
+ setContent(tip) {
6053
+ this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
5980
6054
 
5981
- let content = this._getContent();
5982
-
5983
- if (typeof content === 'function') {
5984
- content = content.call(this._element);
5985
- }
5986
-
5987
- this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
5988
- tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
6055
+ this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
5989
6056
  } // Private
5990
6057
 
5991
6058
 
5992
- _addAttachmentClass(attachment) {
5993
- this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
5994
- }
5995
-
5996
6059
  _getContent() {
5997
- return this._element.getAttribute('data-bs-content') || this.config.content;
6060
+ return this._resolvePossibleFunction(this._config.content);
5998
6061
  }
5999
6062
 
6000
- _cleanTipClass() {
6001
- const tip = this.getTipElement();
6002
- const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
6003
-
6004
- if (tabClass !== null && tabClass.length > 0) {
6005
- tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
6006
- }
6063
+ _getBasicClassPrefix() {
6064
+ return CLASS_PREFIX;
6007
6065
  } // Static
6008
6066
 
6009
6067
 
6010
6068
  static jQueryInterface(config) {
6011
6069
  return this.each(function () {
6012
- let data = Data.get(this, DATA_KEY$3);
6013
-
6014
- const _config = typeof config === 'object' ? config : null;
6015
-
6016
- if (!data && /dispose|hide/.test(config)) {
6017
- return;
6018
- }
6019
-
6020
- if (!data) {
6021
- data = new Popover(this, _config);
6022
- Data.set(this, DATA_KEY$3, data);
6023
- }
6070
+ const data = Popover.getOrCreateInstance(this, config);
6024
6071
 
6025
6072
  if (typeof config === 'string') {
6026
6073
  if (typeof data[config] === 'undefined') {
@@ -6041,11 +6088,11 @@
6041
6088
  */
6042
6089
 
6043
6090
 
6044
- defineJQueryPlugin(NAME$3, Popover);
6091
+ defineJQueryPlugin(Popover);
6045
6092
 
6046
6093
  /**
6047
6094
  * --------------------------------------------------------------------------
6048
- * Bootstrap (v5.0.0-beta3): scrollspy.js
6095
+ * Bootstrap (v5.1.0): scrollspy.js
6049
6096
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
6050
6097
  * --------------------------------------------------------------------------
6051
6098
  */
@@ -6079,6 +6126,7 @@
6079
6126
  const SELECTOR_NAV_LINKS = '.nav-link';
6080
6127
  const SELECTOR_NAV_ITEMS = '.nav-item';
6081
6128
  const SELECTOR_LIST_ITEMS = '.list-group-item';
6129
+ const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`;
6082
6130
  const SELECTOR_DROPDOWN$1 = '.dropdown';
6083
6131
  const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
6084
6132
  const METHOD_OFFSET = 'offset';
@@ -6094,7 +6142,6 @@
6094
6142
  super(element);
6095
6143
  this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
6096
6144
  this._config = this._getConfig(config);
6097
- this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
6098
6145
  this._offsets = [];
6099
6146
  this._targets = [];
6100
6147
  this._activeTarget = null;
@@ -6110,8 +6157,8 @@
6110
6157
  return Default$1;
6111
6158
  }
6112
6159
 
6113
- static get DATA_KEY() {
6114
- return DATA_KEY$2;
6160
+ static get NAME() {
6161
+ return NAME$2;
6115
6162
  } // Public
6116
6163
 
6117
6164
 
@@ -6122,7 +6169,7 @@
6122
6169
  this._offsets = [];
6123
6170
  this._targets = [];
6124
6171
  this._scrollHeight = this._getScrollHeight();
6125
- const targets = SelectorEngine.find(this._selector);
6172
+ const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target);
6126
6173
  targets.map(element => {
6127
6174
  const targetSelector = getSelectorFromElement(element);
6128
6175
  const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
@@ -6144,36 +6191,17 @@
6144
6191
  }
6145
6192
 
6146
6193
  dispose() {
6147
- super.dispose();
6148
6194
  EventHandler.off(this._scrollElement, EVENT_KEY$2);
6149
- this._scrollElement = null;
6150
- this._config = null;
6151
- this._selector = null;
6152
- this._offsets = null;
6153
- this._targets = null;
6154
- this._activeTarget = null;
6155
- this._scrollHeight = null;
6195
+ super.dispose();
6156
6196
  } // Private
6157
6197
 
6158
6198
 
6159
6199
  _getConfig(config) {
6160
6200
  config = { ...Default$1,
6201
+ ...Manipulator.getDataAttributes(this._element),
6161
6202
  ...(typeof config === 'object' && config ? config : {})
6162
6203
  };
6163
-
6164
- if (typeof config.target !== 'string' && isElement$1(config.target)) {
6165
- let {
6166
- id
6167
- } = config.target;
6168
-
6169
- if (!id) {
6170
- id = getUID(NAME$2);
6171
- config.target.id = id;
6172
- }
6173
-
6174
- config.target = `#${id}`;
6175
- }
6176
-
6204
+ config.target = getElement(config.target) || document.documentElement;
6177
6205
  typeCheckConfig(NAME$2, config, DefaultType$1);
6178
6206
  return config;
6179
6207
  }
@@ -6233,16 +6261,13 @@
6233
6261
 
6234
6262
  this._clear();
6235
6263
 
6236
- const queries = this._selector.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
6237
-
6238
- const link = SelectorEngine.findOne(queries.join(','));
6264
+ const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
6265
+ const link = SelectorEngine.findOne(queries.join(','), this._config.target);
6266
+ link.classList.add(CLASS_NAME_ACTIVE$1);
6239
6267
 
6240
6268
  if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
6241
6269
  SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
6242
- link.classList.add(CLASS_NAME_ACTIVE$1);
6243
6270
  } else {
6244
- // Set triggered link as active
6245
- link.classList.add(CLASS_NAME_ACTIVE$1);
6246
6271
  SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => {
6247
6272
  // Set triggered links parents as active
6248
6273
  // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
@@ -6260,27 +6285,23 @@
6260
6285
  }
6261
6286
 
6262
6287
  _clear() {
6263
- SelectorEngine.find(this._selector).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1));
6288
+ SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1));
6264
6289
  } // Static
6265
6290
 
6266
6291
 
6267
6292
  static jQueryInterface(config) {
6268
6293
  return this.each(function () {
6269
- let data = Data.get(this, DATA_KEY$2);
6294
+ const data = ScrollSpy.getOrCreateInstance(this, config);
6270
6295
 
6271
- const _config = typeof config === 'object' && config;
6272
-
6273
- if (!data) {
6274
- data = new ScrollSpy(this, _config);
6296
+ if (typeof config !== 'string') {
6297
+ return;
6275
6298
  }
6276
6299
 
6277
- if (typeof config === 'string') {
6278
- if (typeof data[config] === 'undefined') {
6279
- throw new TypeError(`No method named "${config}"`);
6280
- }
6281
-
6282
- data[config]();
6300
+ if (typeof data[config] === 'undefined') {
6301
+ throw new TypeError(`No method named "${config}"`);
6283
6302
  }
6303
+
6304
+ data[config]();
6284
6305
  });
6285
6306
  }
6286
6307
 
@@ -6293,7 +6314,7 @@
6293
6314
 
6294
6315
 
6295
6316
  EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
6296
- SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy, Manipulator.getDataAttributes(spy)));
6317
+ SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
6297
6318
  });
6298
6319
  /**
6299
6320
  * ------------------------------------------------------------------------
@@ -6302,11 +6323,11 @@
6302
6323
  * add .ScrollSpy to jQuery only if jQuery is present
6303
6324
  */
6304
6325
 
6305
- defineJQueryPlugin(NAME$2, ScrollSpy);
6326
+ defineJQueryPlugin(ScrollSpy);
6306
6327
 
6307
6328
  /**
6308
6329
  * --------------------------------------------------------------------------
6309
- * Bootstrap (v5.0.0-beta3): tab.js
6330
+ * Bootstrap (v5.1.0): tab.js
6310
6331
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
6311
6332
  * --------------------------------------------------------------------------
6312
6333
  */
@@ -6344,13 +6365,13 @@
6344
6365
 
6345
6366
  class Tab extends BaseComponent {
6346
6367
  // Getters
6347
- static get DATA_KEY() {
6348
- return DATA_KEY$1;
6368
+ static get NAME() {
6369
+ return NAME$1;
6349
6370
  } // Public
6350
6371
 
6351
6372
 
6352
6373
  show() {
6353
- if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE) || isDisabled(this._element)) {
6374
+ if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
6354
6375
  return;
6355
6376
  }
6356
6377
 
@@ -6403,10 +6424,9 @@
6403
6424
  const complete = () => this._transitionComplete(element, active, callback);
6404
6425
 
6405
6426
  if (active && isTransitioning) {
6406
- const transitionDuration = getTransitionDurationFromElement(active);
6407
6427
  active.classList.remove(CLASS_NAME_SHOW$1);
6408
- EventHandler.one(active, 'transitionend', complete);
6409
- emulateTransitionEnd(active, transitionDuration);
6428
+
6429
+ this._queueCallback(complete, element, true);
6410
6430
  } else {
6411
6431
  complete();
6412
6432
  }
@@ -6438,11 +6458,17 @@
6438
6458
  element.classList.add(CLASS_NAME_SHOW$1);
6439
6459
  }
6440
6460
 
6441
- if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
6461
+ let parent = element.parentNode;
6462
+
6463
+ if (parent && parent.nodeName === 'LI') {
6464
+ parent = parent.parentNode;
6465
+ }
6466
+
6467
+ if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
6442
6468
  const dropdownElement = element.closest(SELECTOR_DROPDOWN);
6443
6469
 
6444
6470
  if (dropdownElement) {
6445
- SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
6471
+ SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
6446
6472
  }
6447
6473
 
6448
6474
  element.setAttribute('aria-expanded', true);
@@ -6456,7 +6482,7 @@
6456
6482
 
6457
6483
  static jQueryInterface(config) {
6458
6484
  return this.each(function () {
6459
- const data = Data.get(this, DATA_KEY$1) || new Tab(this);
6485
+ const data = Tab.getOrCreateInstance(this);
6460
6486
 
6461
6487
  if (typeof config === 'string') {
6462
6488
  if (typeof data[config] === 'undefined') {
@@ -6477,8 +6503,15 @@
6477
6503
 
6478
6504
 
6479
6505
  EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
6480
- event.preventDefault();
6481
- const data = Data.get(this, DATA_KEY$1) || new Tab(this);
6506
+ if (['A', 'AREA'].includes(this.tagName)) {
6507
+ event.preventDefault();
6508
+ }
6509
+
6510
+ if (isDisabled(this)) {
6511
+ return;
6512
+ }
6513
+
6514
+ const data = Tab.getOrCreateInstance(this);
6482
6515
  data.show();
6483
6516
  });
6484
6517
  /**
@@ -6488,11 +6521,11 @@
6488
6521
  * add .Tab to jQuery only if jQuery is present
6489
6522
  */
6490
6523
 
6491
- defineJQueryPlugin(NAME$1, Tab);
6524
+ defineJQueryPlugin(Tab);
6492
6525
 
6493
6526
  /**
6494
6527
  * --------------------------------------------------------------------------
6495
- * Bootstrap (v5.0.0-beta3): toast.js
6528
+ * Bootstrap (v5.1.0): toast.js
6496
6529
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
6497
6530
  * --------------------------------------------------------------------------
6498
6531
  */
@@ -6505,13 +6538,17 @@
6505
6538
  const NAME = 'toast';
6506
6539
  const DATA_KEY = 'bs.toast';
6507
6540
  const EVENT_KEY = `.${DATA_KEY}`;
6508
- const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
6541
+ const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
6542
+ const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
6543
+ const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
6544
+ const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
6509
6545
  const EVENT_HIDE = `hide${EVENT_KEY}`;
6510
6546
  const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
6511
6547
  const EVENT_SHOW = `show${EVENT_KEY}`;
6512
6548
  const EVENT_SHOWN = `shown${EVENT_KEY}`;
6513
6549
  const CLASS_NAME_FADE = 'fade';
6514
- const CLASS_NAME_HIDE = 'hide';
6550
+ const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
6551
+
6515
6552
  const CLASS_NAME_SHOW = 'show';
6516
6553
  const CLASS_NAME_SHOWING = 'showing';
6517
6554
  const DefaultType = {
@@ -6524,7 +6561,6 @@
6524
6561
  autohide: true,
6525
6562
  delay: 5000
6526
6563
  };
6527
- const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
6528
6564
  /**
6529
6565
  * ------------------------------------------------------------------------
6530
6566
  * Class Definition
@@ -6536,6 +6572,8 @@
6536
6572
  super(element);
6537
6573
  this._config = this._getConfig(config);
6538
6574
  this._timeout = null;
6575
+ this._hasMouseInteraction = false;
6576
+ this._hasKeyboardInteraction = false;
6539
6577
 
6540
6578
  this._setListeners();
6541
6579
  } // Getters
@@ -6549,8 +6587,8 @@
6549
6587
  return Default;
6550
6588
  }
6551
6589
 
6552
- static get DATA_KEY() {
6553
- return DATA_KEY;
6590
+ static get NAME() {
6591
+ return NAME;
6554
6592
  } // Public
6555
6593
 
6556
6594
 
@@ -6570,30 +6608,21 @@
6570
6608
  const complete = () => {
6571
6609
  this._element.classList.remove(CLASS_NAME_SHOWING);
6572
6610
 
6573
- this._element.classList.add(CLASS_NAME_SHOW);
6574
-
6575
6611
  EventHandler.trigger(this._element, EVENT_SHOWN);
6576
6612
 
6577
- if (this._config.autohide) {
6578
- this._timeout = setTimeout(() => {
6579
- this.hide();
6580
- }, this._config.delay);
6581
- }
6613
+ this._maybeScheduleHide();
6582
6614
  };
6583
6615
 
6584
- this._element.classList.remove(CLASS_NAME_HIDE);
6616
+ this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
6617
+
6585
6618
 
6586
6619
  reflow(this._element);
6587
6620
 
6621
+ this._element.classList.add(CLASS_NAME_SHOW);
6622
+
6588
6623
  this._element.classList.add(CLASS_NAME_SHOWING);
6589
6624
 
6590
- if (this._config.animation) {
6591
- const transitionDuration = getTransitionDurationFromElement(this._element);
6592
- EventHandler.one(this._element, 'transitionend', complete);
6593
- emulateTransitionEnd(this._element, transitionDuration);
6594
- } else {
6595
- complete();
6596
- }
6625
+ this._queueCallback(complete, this._element, this._config.animation);
6597
6626
  }
6598
6627
 
6599
6628
  hide() {
@@ -6608,20 +6637,19 @@
6608
6637
  }
6609
6638
 
6610
6639
  const complete = () => {
6611
- this._element.classList.add(CLASS_NAME_HIDE);
6640
+ this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
6641
+
6642
+
6643
+ this._element.classList.remove(CLASS_NAME_SHOWING);
6644
+
6645
+ this._element.classList.remove(CLASS_NAME_SHOW);
6612
6646
 
6613
6647
  EventHandler.trigger(this._element, EVENT_HIDDEN);
6614
6648
  };
6615
6649
 
6616
- this._element.classList.remove(CLASS_NAME_SHOW);
6650
+ this._element.classList.add(CLASS_NAME_SHOWING);
6617
6651
 
6618
- if (this._config.animation) {
6619
- const transitionDuration = getTransitionDurationFromElement(this._element);
6620
- EventHandler.one(this._element, 'transitionend', complete);
6621
- emulateTransitionEnd(this._element, transitionDuration);
6622
- } else {
6623
- complete();
6624
- }
6652
+ this._queueCallback(complete, this._element, this._config.animation);
6625
6653
  }
6626
6654
 
6627
6655
  dispose() {
@@ -6631,9 +6659,7 @@
6631
6659
  this._element.classList.remove(CLASS_NAME_SHOW);
6632
6660
  }
6633
6661
 
6634
- EventHandler.off(this._element, EVENT_CLICK_DISMISS);
6635
6662
  super.dispose();
6636
- this._config = null;
6637
6663
  } // Private
6638
6664
 
6639
6665
 
@@ -6646,8 +6672,53 @@
6646
6672
  return config;
6647
6673
  }
6648
6674
 
6675
+ _maybeScheduleHide() {
6676
+ if (!this._config.autohide) {
6677
+ return;
6678
+ }
6679
+
6680
+ if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
6681
+ return;
6682
+ }
6683
+
6684
+ this._timeout = setTimeout(() => {
6685
+ this.hide();
6686
+ }, this._config.delay);
6687
+ }
6688
+
6689
+ _onInteraction(event, isInteracting) {
6690
+ switch (event.type) {
6691
+ case 'mouseover':
6692
+ case 'mouseout':
6693
+ this._hasMouseInteraction = isInteracting;
6694
+ break;
6695
+
6696
+ case 'focusin':
6697
+ case 'focusout':
6698
+ this._hasKeyboardInteraction = isInteracting;
6699
+ break;
6700
+ }
6701
+
6702
+ if (isInteracting) {
6703
+ this._clearTimeout();
6704
+
6705
+ return;
6706
+ }
6707
+
6708
+ const nextElement = event.relatedTarget;
6709
+
6710
+ if (this._element === nextElement || this._element.contains(nextElement)) {
6711
+ return;
6712
+ }
6713
+
6714
+ this._maybeScheduleHide();
6715
+ }
6716
+
6649
6717
  _setListeners() {
6650
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
6718
+ EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
6719
+ EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
6720
+ EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
6721
+ EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
6651
6722
  }
6652
6723
 
6653
6724
  _clearTimeout() {
@@ -6658,13 +6729,7 @@
6658
6729
 
6659
6730
  static jQueryInterface(config) {
6660
6731
  return this.each(function () {
6661
- let data = Data.get(this, DATA_KEY);
6662
-
6663
- const _config = typeof config === 'object' && config;
6664
-
6665
- if (!data) {
6666
- data = new Toast(this, _config);
6667
- }
6732
+ const data = Toast.getOrCreateInstance(this, config);
6668
6733
 
6669
6734
  if (typeof config === 'string') {
6670
6735
  if (typeof data[config] === 'undefined') {
@@ -6677,6 +6742,8 @@
6677
6742
  }
6678
6743
 
6679
6744
  }
6745
+
6746
+ enableDismissTrigger(Toast);
6680
6747
  /**
6681
6748
  * ------------------------------------------------------------------------
6682
6749
  * jQuery
@@ -6684,12 +6751,11 @@
6684
6751
  * add .Toast to jQuery only if jQuery is present
6685
6752
  */
6686
6753
 
6687
-
6688
- defineJQueryPlugin(NAME, Toast);
6754
+ defineJQueryPlugin(Toast);
6689
6755
 
6690
6756
  /**
6691
6757
  * --------------------------------------------------------------------------
6692
- * Bootstrap (v5.0.0-beta3): index.umd.js
6758
+ * Bootstrap (v5.1.0): index.umd.js
6693
6759
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
6694
6760
  * --------------------------------------------------------------------------
6695
6761
  */