bootstrap.bundle.js (208074B)
1 /*! 2 * Bootstrap v5.2.1 (https://getbootstrap.com/) 3 * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5 */ 6 (function (global, factory) { 7 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 8 typeof define === 'function' && define.amd ? define(factory) : 9 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory()); 10 })(this, (function () { 'use strict'; 11 12 /** 13 * -------------------------------------------------------------------------- 14 * Bootstrap (v5.2.1): util/index.js 15 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 16 * -------------------------------------------------------------------------- 17 */ 18 const MAX_UID = 1000000; 19 const MILLISECONDS_MULTIPLIER = 1000; 20 const TRANSITION_END = 'transitionend'; // Shout-out Angus Croll (https://goo.gl/pxwQGp) 21 22 const toType = object => { 23 if (object === null || object === undefined) { 24 return `${object}`; 25 } 26 27 return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase(); 28 }; 29 /** 30 * Public Util API 31 */ 32 33 34 const getUID = prefix => { 35 do { 36 prefix += Math.floor(Math.random() * MAX_UID); 37 } while (document.getElementById(prefix)); 38 39 return prefix; 40 }; 41 42 const getSelector = element => { 43 let selector = element.getAttribute('data-bs-target'); 44 45 if (!selector || selector === '#') { 46 let hrefAttribute = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes, 47 // so everything starting with `#` or `.`. If a "real" URL is used as the selector, 48 // `document.querySelector` will rightfully complain it is invalid. 49 // See https://github.com/twbs/bootstrap/issues/32273 50 51 if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) { 52 return null; 53 } // Just in case some CMS puts out a full URL with the anchor appended 54 55 56 if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) { 57 hrefAttribute = `#${hrefAttribute.split('#')[1]}`; 58 } 59 60 selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null; 61 } 62 63 return selector; 64 }; 65 66 const getSelectorFromElement = element => { 67 const selector = getSelector(element); 68 69 if (selector) { 70 return document.querySelector(selector) ? selector : null; 71 } 72 73 return null; 74 }; 75 76 const getElementFromSelector = element => { 77 const selector = getSelector(element); 78 return selector ? document.querySelector(selector) : null; 79 }; 80 81 const getTransitionDurationFromElement = element => { 82 if (!element) { 83 return 0; 84 } // Get transition-duration of the element 85 86 87 let { 88 transitionDuration, 89 transitionDelay 90 } = window.getComputedStyle(element); 91 const floatTransitionDuration = Number.parseFloat(transitionDuration); 92 const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 93 94 if (!floatTransitionDuration && !floatTransitionDelay) { 95 return 0; 96 } // If multiple durations are defined, take the first 97 98 99 transitionDuration = transitionDuration.split(',')[0]; 100 transitionDelay = transitionDelay.split(',')[0]; 101 return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 102 }; 103 104 const triggerTransitionEnd = element => { 105 element.dispatchEvent(new Event(TRANSITION_END)); 106 }; 107 108 const isElement$1 = object => { 109 if (!object || typeof object !== 'object') { 110 return false; 111 } 112 113 if (typeof object.jquery !== 'undefined') { 114 object = object[0]; 115 } 116 117 return typeof object.nodeType !== 'undefined'; 118 }; 119 120 const getElement = object => { 121 // it's a jQuery object or a node element 122 if (isElement$1(object)) { 123 return object.jquery ? object[0] : object; 124 } 125 126 if (typeof object === 'string' && object.length > 0) { 127 return document.querySelector(object); 128 } 129 130 return null; 131 }; 132 133 const isVisible = element => { 134 if (!isElement$1(element) || element.getClientRects().length === 0) { 135 return false; 136 } 137 138 const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'; // Handle `details` element as its content may falsie appear visible when it is closed 139 140 const closedDetails = element.closest('details:not([open])'); 141 142 if (!closedDetails) { 143 return elementIsVisible; 144 } 145 146 if (closedDetails !== element) { 147 const summary = element.closest('summary'); 148 149 if (summary && summary.parentNode !== closedDetails) { 150 return false; 151 } 152 153 if (summary === null) { 154 return false; 155 } 156 } 157 158 return elementIsVisible; 159 }; 160 161 const isDisabled = element => { 162 if (!element || element.nodeType !== Node.ELEMENT_NODE) { 163 return true; 164 } 165 166 if (element.classList.contains('disabled')) { 167 return true; 168 } 169 170 if (typeof element.disabled !== 'undefined') { 171 return element.disabled; 172 } 173 174 return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; 175 }; 176 177 const findShadowRoot = element => { 178 if (!document.documentElement.attachShadow) { 179 return null; 180 } // Can find the shadow root otherwise it'll return the document 181 182 183 if (typeof element.getRootNode === 'function') { 184 const root = element.getRootNode(); 185 return root instanceof ShadowRoot ? root : null; 186 } 187 188 if (element instanceof ShadowRoot) { 189 return element; 190 } // when we don't find a shadow root 191 192 193 if (!element.parentNode) { 194 return null; 195 } 196 197 return findShadowRoot(element.parentNode); 198 }; 199 200 const noop = () => {}; 201 /** 202 * Trick to restart an element's animation 203 * 204 * @param {HTMLElement} element 205 * @return void 206 * 207 * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation 208 */ 209 210 211 const reflow = element => { 212 element.offsetHeight; // eslint-disable-line no-unused-expressions 213 }; 214 215 const getjQuery = () => { 216 if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { 217 return window.jQuery; 218 } 219 220 return null; 221 }; 222 223 const DOMContentLoadedCallbacks = []; 224 225 const onDOMContentLoaded = callback => { 226 if (document.readyState === 'loading') { 227 // add listener on the first call when the document is in loading state 228 if (!DOMContentLoadedCallbacks.length) { 229 document.addEventListener('DOMContentLoaded', () => { 230 for (const callback of DOMContentLoadedCallbacks) { 231 callback(); 232 } 233 }); 234 } 235 236 DOMContentLoadedCallbacks.push(callback); 237 } else { 238 callback(); 239 } 240 }; 241 242 const isRTL = () => document.documentElement.dir === 'rtl'; 243 244 const defineJQueryPlugin = plugin => { 245 onDOMContentLoaded(() => { 246 const $ = getjQuery(); 247 /* istanbul ignore if */ 248 249 if ($) { 250 const name = plugin.NAME; 251 const JQUERY_NO_CONFLICT = $.fn[name]; 252 $.fn[name] = plugin.jQueryInterface; 253 $.fn[name].Constructor = plugin; 254 255 $.fn[name].noConflict = () => { 256 $.fn[name] = JQUERY_NO_CONFLICT; 257 return plugin.jQueryInterface; 258 }; 259 } 260 }); 261 }; 262 263 const execute = callback => { 264 if (typeof callback === 'function') { 265 callback(); 266 } 267 }; 268 269 const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => { 270 if (!waitForTransition) { 271 execute(callback); 272 return; 273 } 274 275 const durationPadding = 5; 276 const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding; 277 let called = false; 278 279 const handler = ({ 280 target 281 }) => { 282 if (target !== transitionElement) { 283 return; 284 } 285 286 called = true; 287 transitionElement.removeEventListener(TRANSITION_END, handler); 288 execute(callback); 289 }; 290 291 transitionElement.addEventListener(TRANSITION_END, handler); 292 setTimeout(() => { 293 if (!called) { 294 triggerTransitionEnd(transitionElement); 295 } 296 }, emulatedDuration); 297 }; 298 /** 299 * Return the previous/next element of a list. 300 * 301 * @param {array} list The list of elements 302 * @param activeElement The active element 303 * @param shouldGetNext Choose to get next or previous element 304 * @param isCycleAllowed 305 * @return {Element|elem} The proper element 306 */ 307 308 309 const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => { 310 const listLength = list.length; 311 let index = list.indexOf(activeElement); // if the element does not exist in the list return an element 312 // depending on the direction and if cycle is allowed 313 314 if (index === -1) { 315 return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]; 316 } 317 318 index += shouldGetNext ? 1 : -1; 319 320 if (isCycleAllowed) { 321 index = (index + listLength) % listLength; 322 } 323 324 return list[Math.max(0, Math.min(index, listLength - 1))]; 325 }; 326 327 /** 328 * -------------------------------------------------------------------------- 329 * Bootstrap (v5.2.1): dom/event-handler.js 330 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 331 * -------------------------------------------------------------------------- 332 */ 333 /** 334 * Constants 335 */ 336 337 const namespaceRegex = /[^.]*(?=\..*)\.|.*/; 338 const stripNameRegex = /\..*/; 339 const stripUidRegex = /::\d+$/; 340 const eventRegistry = {}; // Events storage 341 342 let uidEvent = 1; 343 const customEvents = { 344 mouseenter: 'mouseover', 345 mouseleave: 'mouseout' 346 }; 347 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']); 348 /** 349 * Private methods 350 */ 351 352 function makeEventUid(element, uid) { 353 return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; 354 } 355 356 function getElementEvents(element) { 357 const uid = makeEventUid(element); 358 element.uidEvent = uid; 359 eventRegistry[uid] = eventRegistry[uid] || {}; 360 return eventRegistry[uid]; 361 } 362 363 function bootstrapHandler(element, fn) { 364 return function handler(event) { 365 hydrateObj(event, { 366 delegateTarget: element 367 }); 368 369 if (handler.oneOff) { 370 EventHandler.off(element, event.type, fn); 371 } 372 373 return fn.apply(element, [event]); 374 }; 375 } 376 377 function bootstrapDelegationHandler(element, selector, fn) { 378 return function handler(event) { 379 const domElements = element.querySelectorAll(selector); 380 381 for (let { 382 target 383 } = event; target && target !== this; target = target.parentNode) { 384 for (const domElement of domElements) { 385 if (domElement !== target) { 386 continue; 387 } 388 389 hydrateObj(event, { 390 delegateTarget: target 391 }); 392 393 if (handler.oneOff) { 394 EventHandler.off(element, event.type, selector, fn); 395 } 396 397 return fn.apply(target, [event]); 398 } 399 } 400 }; 401 } 402 403 function findHandler(events, callable, delegationSelector = null) { 404 return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector); 405 } 406 407 function normalizeParameters(originalTypeEvent, handler, delegationFunction) { 408 const isDelegated = typeof handler === 'string'; // todo: tooltip passes `false` instead of selector, so we need to check 409 410 const callable = isDelegated ? delegationFunction : handler || delegationFunction; 411 let typeEvent = getTypeEvent(originalTypeEvent); 412 413 if (!nativeEvents.has(typeEvent)) { 414 typeEvent = originalTypeEvent; 415 } 416 417 return [isDelegated, callable, typeEvent]; 418 } 419 420 function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { 421 if (typeof originalTypeEvent !== 'string' || !element) { 422 return; 423 } 424 425 let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position 426 // this prevents the handler from being dispatched the same way as mouseover or mouseout does 427 428 if (originalTypeEvent in customEvents) { 429 const wrapFunction = fn => { 430 return function (event) { 431 if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) { 432 return fn.call(this, event); 433 } 434 }; 435 }; 436 437 callable = wrapFunction(callable); 438 } 439 440 const events = getElementEvents(element); 441 const handlers = events[typeEvent] || (events[typeEvent] = {}); 442 const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null); 443 444 if (previousFunction) { 445 previousFunction.oneOff = previousFunction.oneOff && oneOff; 446 return; 447 } 448 449 const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, '')); 450 const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable); 451 fn.delegationSelector = isDelegated ? handler : null; 452 fn.callable = callable; 453 fn.oneOff = oneOff; 454 fn.uidEvent = uid; 455 handlers[uid] = fn; 456 element.addEventListener(typeEvent, fn, isDelegated); 457 } 458 459 function removeHandler(element, events, typeEvent, handler, delegationSelector) { 460 const fn = findHandler(events[typeEvent], handler, delegationSelector); 461 462 if (!fn) { 463 return; 464 } 465 466 element.removeEventListener(typeEvent, fn, Boolean(delegationSelector)); 467 delete events[typeEvent][fn.uidEvent]; 468 } 469 470 function removeNamespacedHandlers(element, events, typeEvent, namespace) { 471 const storeElementEvent = events[typeEvent] || {}; 472 473 for (const handlerKey of Object.keys(storeElementEvent)) { 474 if (handlerKey.includes(namespace)) { 475 const event = storeElementEvent[handlerKey]; 476 removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); 477 } 478 } 479 } 480 481 function getTypeEvent(event) { 482 // allow to get the native events from namespaced events ('click.bs.button' --> 'click') 483 event = event.replace(stripNameRegex, ''); 484 return customEvents[event] || event; 485 } 486 487 const EventHandler = { 488 on(element, event, handler, delegationFunction) { 489 addHandler(element, event, handler, delegationFunction, false); 490 }, 491 492 one(element, event, handler, delegationFunction) { 493 addHandler(element, event, handler, delegationFunction, true); 494 }, 495 496 off(element, originalTypeEvent, handler, delegationFunction) { 497 if (typeof originalTypeEvent !== 'string' || !element) { 498 return; 499 } 500 501 const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); 502 const inNamespace = typeEvent !== originalTypeEvent; 503 const events = getElementEvents(element); 504 const storeElementEvent = events[typeEvent] || {}; 505 const isNamespace = originalTypeEvent.startsWith('.'); 506 507 if (typeof callable !== 'undefined') { 508 // Simplest case: handler is passed, remove that listener ONLY. 509 if (!Object.keys(storeElementEvent).length) { 510 return; 511 } 512 513 removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null); 514 return; 515 } 516 517 if (isNamespace) { 518 for (const elementEvent of Object.keys(events)) { 519 removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); 520 } 521 } 522 523 for (const keyHandlers of Object.keys(storeElementEvent)) { 524 const handlerKey = keyHandlers.replace(stripUidRegex, ''); 525 526 if (!inNamespace || originalTypeEvent.includes(handlerKey)) { 527 const event = storeElementEvent[keyHandlers]; 528 removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); 529 } 530 } 531 }, 532 533 trigger(element, event, args) { 534 if (typeof event !== 'string' || !element) { 535 return null; 536 } 537 538 const $ = getjQuery(); 539 const typeEvent = getTypeEvent(event); 540 const inNamespace = event !== typeEvent; 541 let jQueryEvent = null; 542 let bubbles = true; 543 let nativeDispatch = true; 544 let defaultPrevented = false; 545 546 if (inNamespace && $) { 547 jQueryEvent = $.Event(event, args); 548 $(element).trigger(jQueryEvent); 549 bubbles = !jQueryEvent.isPropagationStopped(); 550 nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); 551 defaultPrevented = jQueryEvent.isDefaultPrevented(); 552 } 553 554 let evt = new Event(event, { 555 bubbles, 556 cancelable: true 557 }); 558 evt = hydrateObj(evt, args); 559 560 if (defaultPrevented) { 561 evt.preventDefault(); 562 } 563 564 if (nativeDispatch) { 565 element.dispatchEvent(evt); 566 } 567 568 if (evt.defaultPrevented && jQueryEvent) { 569 jQueryEvent.preventDefault(); 570 } 571 572 return evt; 573 } 574 575 }; 576 577 function hydrateObj(obj, meta) { 578 for (const [key, value] of Object.entries(meta || {})) { 579 try { 580 obj[key] = value; 581 } catch (_unused) { 582 Object.defineProperty(obj, key, { 583 configurable: true, 584 585 get() { 586 return value; 587 } 588 589 }); 590 } 591 } 592 593 return obj; 594 } 595 596 /** 597 * -------------------------------------------------------------------------- 598 * Bootstrap (v5.2.1): dom/data.js 599 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 600 * -------------------------------------------------------------------------- 601 */ 602 603 /** 604 * Constants 605 */ 606 const elementMap = new Map(); 607 const Data = { 608 set(element, key, instance) { 609 if (!elementMap.has(element)) { 610 elementMap.set(element, new Map()); 611 } 612 613 const instanceMap = elementMap.get(element); // make it clear we only want one instance per element 614 // can be removed later when multiple key/instances are fine to be used 615 616 if (!instanceMap.has(key) && instanceMap.size !== 0) { 617 // eslint-disable-next-line no-console 618 console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); 619 return; 620 } 621 622 instanceMap.set(key, instance); 623 }, 624 625 get(element, key) { 626 if (elementMap.has(element)) { 627 return elementMap.get(element).get(key) || null; 628 } 629 630 return null; 631 }, 632 633 remove(element, key) { 634 if (!elementMap.has(element)) { 635 return; 636 } 637 638 const instanceMap = elementMap.get(element); 639 instanceMap.delete(key); // free up element references if there are no instances left for an element 640 641 if (instanceMap.size === 0) { 642 elementMap.delete(element); 643 } 644 } 645 646 }; 647 648 /** 649 * -------------------------------------------------------------------------- 650 * Bootstrap (v5.2.1): dom/manipulator.js 651 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 652 * -------------------------------------------------------------------------- 653 */ 654 function normalizeData(value) { 655 if (value === 'true') { 656 return true; 657 } 658 659 if (value === 'false') { 660 return false; 661 } 662 663 if (value === Number(value).toString()) { 664 return Number(value); 665 } 666 667 if (value === '' || value === 'null') { 668 return null; 669 } 670 671 if (typeof value !== 'string') { 672 return value; 673 } 674 675 try { 676 return JSON.parse(decodeURIComponent(value)); 677 } catch (_unused) { 678 return value; 679 } 680 } 681 682 function normalizeDataKey(key) { 683 return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`); 684 } 685 686 const Manipulator = { 687 setDataAttribute(element, key, value) { 688 element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value); 689 }, 690 691 removeDataAttribute(element, key) { 692 element.removeAttribute(`data-bs-${normalizeDataKey(key)}`); 693 }, 694 695 getDataAttributes(element) { 696 if (!element) { 697 return {}; 698 } 699 700 const attributes = {}; 701 const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig')); 702 703 for (const key of bsKeys) { 704 let pureKey = key.replace(/^bs/, ''); 705 pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length); 706 attributes[pureKey] = normalizeData(element.dataset[key]); 707 } 708 709 return attributes; 710 }, 711 712 getDataAttribute(element, key) { 713 return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)); 714 } 715 716 }; 717 718 /** 719 * -------------------------------------------------------------------------- 720 * Bootstrap (v5.2.1): util/config.js 721 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 722 * -------------------------------------------------------------------------- 723 */ 724 /** 725 * Class definition 726 */ 727 728 class Config { 729 // Getters 730 static get Default() { 731 return {}; 732 } 733 734 static get DefaultType() { 735 return {}; 736 } 737 738 static get NAME() { 739 throw new Error('You have to implement the static method "NAME", for each component!'); 740 } 741 742 _getConfig(config) { 743 config = this._mergeConfigObj(config); 744 config = this._configAfterMerge(config); 745 746 this._typeCheckConfig(config); 747 748 return config; 749 } 750 751 _configAfterMerge(config) { 752 return config; 753 } 754 755 _mergeConfigObj(config, element) { 756 const jsonConfig = isElement$1(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse 757 758 return { ...this.constructor.Default, 759 ...(typeof jsonConfig === 'object' ? jsonConfig : {}), 760 ...(isElement$1(element) ? Manipulator.getDataAttributes(element) : {}), 761 ...(typeof config === 'object' ? config : {}) 762 }; 763 } 764 765 _typeCheckConfig(config, configTypes = this.constructor.DefaultType) { 766 for (const property of Object.keys(configTypes)) { 767 const expectedTypes = configTypes[property]; 768 const value = config[property]; 769 const valueType = isElement$1(value) ? 'element' : toType(value); 770 771 if (!new RegExp(expectedTypes).test(valueType)) { 772 throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`); 773 } 774 } 775 } 776 777 } 778 779 /** 780 * -------------------------------------------------------------------------- 781 * Bootstrap (v5.2.1): base-component.js 782 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 783 * -------------------------------------------------------------------------- 784 */ 785 /** 786 * Constants 787 */ 788 789 const VERSION = '5.2.1'; 790 /** 791 * Class definition 792 */ 793 794 class BaseComponent extends Config { 795 constructor(element, config) { 796 super(); 797 element = getElement(element); 798 799 if (!element) { 800 return; 801 } 802 803 this._element = element; 804 this._config = this._getConfig(config); 805 Data.set(this._element, this.constructor.DATA_KEY, this); 806 } // Public 807 808 809 dispose() { 810 Data.remove(this._element, this.constructor.DATA_KEY); 811 EventHandler.off(this._element, this.constructor.EVENT_KEY); 812 813 for (const propertyName of Object.getOwnPropertyNames(this)) { 814 this[propertyName] = null; 815 } 816 } 817 818 _queueCallback(callback, element, isAnimated = true) { 819 executeAfterTransition(callback, element, isAnimated); 820 } 821 822 _getConfig(config) { 823 config = this._mergeConfigObj(config, this._element); 824 config = this._configAfterMerge(config); 825 826 this._typeCheckConfig(config); 827 828 return config; 829 } // Static 830 831 832 static getInstance(element) { 833 return Data.get(getElement(element), this.DATA_KEY); 834 } 835 836 static getOrCreateInstance(element, config = {}) { 837 return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null); 838 } 839 840 static get VERSION() { 841 return VERSION; 842 } 843 844 static get DATA_KEY() { 845 return `bs.${this.NAME}`; 846 } 847 848 static get EVENT_KEY() { 849 return `.${this.DATA_KEY}`; 850 } 851 852 static eventName(name) { 853 return `${name}${this.EVENT_KEY}`; 854 } 855 856 } 857 858 /** 859 * -------------------------------------------------------------------------- 860 * Bootstrap (v5.2.1): util/component-functions.js 861 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 862 * -------------------------------------------------------------------------- 863 */ 864 865 const enableDismissTrigger = (component, method = 'hide') => { 866 const clickEvent = `click.dismiss${component.EVENT_KEY}`; 867 const name = component.NAME; 868 EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) { 869 if (['A', 'AREA'].includes(this.tagName)) { 870 event.preventDefault(); 871 } 872 873 if (isDisabled(this)) { 874 return; 875 } 876 877 const target = getElementFromSelector(this) || this.closest(`.${name}`); 878 const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method 879 880 instance[method](); 881 }); 882 }; 883 884 /** 885 * -------------------------------------------------------------------------- 886 * Bootstrap (v5.2.1): alert.js 887 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 888 * -------------------------------------------------------------------------- 889 */ 890 /** 891 * Constants 892 */ 893 894 const NAME$f = 'alert'; 895 const DATA_KEY$a = 'bs.alert'; 896 const EVENT_KEY$b = `.${DATA_KEY$a}`; 897 const EVENT_CLOSE = `close${EVENT_KEY$b}`; 898 const EVENT_CLOSED = `closed${EVENT_KEY$b}`; 899 const CLASS_NAME_FADE$5 = 'fade'; 900 const CLASS_NAME_SHOW$8 = 'show'; 901 /** 902 * Class definition 903 */ 904 905 class Alert extends BaseComponent { 906 // Getters 907 static get NAME() { 908 return NAME$f; 909 } // Public 910 911 912 close() { 913 const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE); 914 915 if (closeEvent.defaultPrevented) { 916 return; 917 } 918 919 this._element.classList.remove(CLASS_NAME_SHOW$8); 920 921 const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5); 922 923 this._queueCallback(() => this._destroyElement(), this._element, isAnimated); 924 } // Private 925 926 927 _destroyElement() { 928 this._element.remove(); 929 930 EventHandler.trigger(this._element, EVENT_CLOSED); 931 this.dispose(); 932 } // Static 933 934 935 static jQueryInterface(config) { 936 return this.each(function () { 937 const data = Alert.getOrCreateInstance(this); 938 939 if (typeof config !== 'string') { 940 return; 941 } 942 943 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 944 throw new TypeError(`No method named "${config}"`); 945 } 946 947 data[config](this); 948 }); 949 } 950 951 } 952 /** 953 * Data API implementation 954 */ 955 956 957 enableDismissTrigger(Alert, 'close'); 958 /** 959 * jQuery 960 */ 961 962 defineJQueryPlugin(Alert); 963 964 /** 965 * -------------------------------------------------------------------------- 966 * Bootstrap (v5.2.1): button.js 967 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 968 * -------------------------------------------------------------------------- 969 */ 970 /** 971 * Constants 972 */ 973 974 const NAME$e = 'button'; 975 const DATA_KEY$9 = 'bs.button'; 976 const EVENT_KEY$a = `.${DATA_KEY$9}`; 977 const DATA_API_KEY$6 = '.data-api'; 978 const CLASS_NAME_ACTIVE$3 = 'active'; 979 const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]'; 980 const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`; 981 /** 982 * Class definition 983 */ 984 985 class Button extends BaseComponent { 986 // Getters 987 static get NAME() { 988 return NAME$e; 989 } // Public 990 991 992 toggle() { 993 // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method 994 this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3)); 995 } // Static 996 997 998 static jQueryInterface(config) { 999 return this.each(function () { 1000 const data = Button.getOrCreateInstance(this); 1001 1002 if (config === 'toggle') { 1003 data[config](); 1004 } 1005 }); 1006 } 1007 1008 } 1009 /** 1010 * Data API implementation 1011 */ 1012 1013 1014 EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => { 1015 event.preventDefault(); 1016 const button = event.target.closest(SELECTOR_DATA_TOGGLE$5); 1017 const data = Button.getOrCreateInstance(button); 1018 data.toggle(); 1019 }); 1020 /** 1021 * jQuery 1022 */ 1023 1024 defineJQueryPlugin(Button); 1025 1026 /** 1027 * -------------------------------------------------------------------------- 1028 * Bootstrap (v5.2.1): dom/selector-engine.js 1029 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1030 * -------------------------------------------------------------------------- 1031 */ 1032 /** 1033 * Constants 1034 */ 1035 1036 const SelectorEngine = { 1037 find(selector, element = document.documentElement) { 1038 return [].concat(...Element.prototype.querySelectorAll.call(element, selector)); 1039 }, 1040 1041 findOne(selector, element = document.documentElement) { 1042 return Element.prototype.querySelector.call(element, selector); 1043 }, 1044 1045 children(element, selector) { 1046 return [].concat(...element.children).filter(child => child.matches(selector)); 1047 }, 1048 1049 parents(element, selector) { 1050 const parents = []; 1051 let ancestor = element.parentNode.closest(selector); 1052 1053 while (ancestor) { 1054 parents.push(ancestor); 1055 ancestor = ancestor.parentNode.closest(selector); 1056 } 1057 1058 return parents; 1059 }, 1060 1061 prev(element, selector) { 1062 let previous = element.previousElementSibling; 1063 1064 while (previous) { 1065 if (previous.matches(selector)) { 1066 return [previous]; 1067 } 1068 1069 previous = previous.previousElementSibling; 1070 } 1071 1072 return []; 1073 }, 1074 1075 // TODO: this is now unused; remove later along with prev() 1076 next(element, selector) { 1077 let next = element.nextElementSibling; 1078 1079 while (next) { 1080 if (next.matches(selector)) { 1081 return [next]; 1082 } 1083 1084 next = next.nextElementSibling; 1085 } 1086 1087 return []; 1088 }, 1089 1090 focusableChildren(element) { 1091 const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(','); 1092 return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el)); 1093 } 1094 1095 }; 1096 1097 /** 1098 * -------------------------------------------------------------------------- 1099 * Bootstrap (v5.2.1): util/swipe.js 1100 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1101 * -------------------------------------------------------------------------- 1102 */ 1103 /** 1104 * Constants 1105 */ 1106 1107 const NAME$d = 'swipe'; 1108 const EVENT_KEY$9 = '.bs.swipe'; 1109 const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`; 1110 const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`; 1111 const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`; 1112 const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`; 1113 const EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`; 1114 const POINTER_TYPE_TOUCH = 'touch'; 1115 const POINTER_TYPE_PEN = 'pen'; 1116 const CLASS_NAME_POINTER_EVENT = 'pointer-event'; 1117 const SWIPE_THRESHOLD = 40; 1118 const Default$c = { 1119 endCallback: null, 1120 leftCallback: null, 1121 rightCallback: null 1122 }; 1123 const DefaultType$c = { 1124 endCallback: '(function|null)', 1125 leftCallback: '(function|null)', 1126 rightCallback: '(function|null)' 1127 }; 1128 /** 1129 * Class definition 1130 */ 1131 1132 class Swipe extends Config { 1133 constructor(element, config) { 1134 super(); 1135 this._element = element; 1136 1137 if (!element || !Swipe.isSupported()) { 1138 return; 1139 } 1140 1141 this._config = this._getConfig(config); 1142 this._deltaX = 0; 1143 this._supportPointerEvents = Boolean(window.PointerEvent); 1144 1145 this._initEvents(); 1146 } // Getters 1147 1148 1149 static get Default() { 1150 return Default$c; 1151 } 1152 1153 static get DefaultType() { 1154 return DefaultType$c; 1155 } 1156 1157 static get NAME() { 1158 return NAME$d; 1159 } // Public 1160 1161 1162 dispose() { 1163 EventHandler.off(this._element, EVENT_KEY$9); 1164 } // Private 1165 1166 1167 _start(event) { 1168 if (!this._supportPointerEvents) { 1169 this._deltaX = event.touches[0].clientX; 1170 return; 1171 } 1172 1173 if (this._eventIsPointerPenTouch(event)) { 1174 this._deltaX = event.clientX; 1175 } 1176 } 1177 1178 _end(event) { 1179 if (this._eventIsPointerPenTouch(event)) { 1180 this._deltaX = event.clientX - this._deltaX; 1181 } 1182 1183 this._handleSwipe(); 1184 1185 execute(this._config.endCallback); 1186 } 1187 1188 _move(event) { 1189 this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX; 1190 } 1191 1192 _handleSwipe() { 1193 const absDeltaX = Math.abs(this._deltaX); 1194 1195 if (absDeltaX <= SWIPE_THRESHOLD) { 1196 return; 1197 } 1198 1199 const direction = absDeltaX / this._deltaX; 1200 this._deltaX = 0; 1201 1202 if (!direction) { 1203 return; 1204 } 1205 1206 execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback); 1207 } 1208 1209 _initEvents() { 1210 if (this._supportPointerEvents) { 1211 EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event)); 1212 EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event)); 1213 1214 this._element.classList.add(CLASS_NAME_POINTER_EVENT); 1215 } else { 1216 EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event)); 1217 EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event)); 1218 EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event)); 1219 } 1220 } 1221 1222 _eventIsPointerPenTouch(event) { 1223 return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH); 1224 } // Static 1225 1226 1227 static isSupported() { 1228 return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 1229 } 1230 1231 } 1232 1233 /** 1234 * -------------------------------------------------------------------------- 1235 * Bootstrap (v5.2.1): carousel.js 1236 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1237 * -------------------------------------------------------------------------- 1238 */ 1239 /** 1240 * Constants 1241 */ 1242 1243 const NAME$c = 'carousel'; 1244 const DATA_KEY$8 = 'bs.carousel'; 1245 const EVENT_KEY$8 = `.${DATA_KEY$8}`; 1246 const DATA_API_KEY$5 = '.data-api'; 1247 const ARROW_LEFT_KEY$1 = 'ArrowLeft'; 1248 const ARROW_RIGHT_KEY$1 = 'ArrowRight'; 1249 const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 1250 1251 const ORDER_NEXT = 'next'; 1252 const ORDER_PREV = 'prev'; 1253 const DIRECTION_LEFT = 'left'; 1254 const DIRECTION_RIGHT = 'right'; 1255 const EVENT_SLIDE = `slide${EVENT_KEY$8}`; 1256 const EVENT_SLID = `slid${EVENT_KEY$8}`; 1257 const EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`; 1258 const EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`; 1259 const EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`; 1260 const EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`; 1261 const EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`; 1262 const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`; 1263 const CLASS_NAME_CAROUSEL = 'carousel'; 1264 const CLASS_NAME_ACTIVE$2 = 'active'; 1265 const CLASS_NAME_SLIDE = 'slide'; 1266 const CLASS_NAME_END = 'carousel-item-end'; 1267 const CLASS_NAME_START = 'carousel-item-start'; 1268 const CLASS_NAME_NEXT = 'carousel-item-next'; 1269 const CLASS_NAME_PREV = 'carousel-item-prev'; 1270 const SELECTOR_ACTIVE = '.active'; 1271 const SELECTOR_ITEM = '.carousel-item'; 1272 const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM; 1273 const SELECTOR_ITEM_IMG = '.carousel-item img'; 1274 const SELECTOR_INDICATORS = '.carousel-indicators'; 1275 const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; 1276 const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; 1277 const KEY_TO_DIRECTION = { 1278 [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT, 1279 [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT 1280 }; 1281 const Default$b = { 1282 interval: 5000, 1283 keyboard: true, 1284 pause: 'hover', 1285 ride: false, 1286 touch: true, 1287 wrap: true 1288 }; 1289 const DefaultType$b = { 1290 interval: '(number|boolean)', 1291 // TODO:v6 remove boolean support 1292 keyboard: 'boolean', 1293 pause: '(string|boolean)', 1294 ride: '(boolean|string)', 1295 touch: 'boolean', 1296 wrap: 'boolean' 1297 }; 1298 /** 1299 * Class definition 1300 */ 1301 1302 class Carousel extends BaseComponent { 1303 constructor(element, config) { 1304 super(element, config); 1305 this._interval = null; 1306 this._activeElement = null; 1307 this._isSliding = false; 1308 this.touchTimeout = null; 1309 this._swipeHelper = null; 1310 this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); 1311 1312 this._addEventListeners(); 1313 1314 if (this._config.ride === CLASS_NAME_CAROUSEL) { 1315 this.cycle(); 1316 } 1317 } // Getters 1318 1319 1320 static get Default() { 1321 return Default$b; 1322 } 1323 1324 static get DefaultType() { 1325 return DefaultType$b; 1326 } 1327 1328 static get NAME() { 1329 return NAME$c; 1330 } // Public 1331 1332 1333 next() { 1334 this._slide(ORDER_NEXT); 1335 } 1336 1337 nextWhenVisible() { 1338 // FIXME TODO use `document.visibilityState` 1339 // Don't call next when the page isn't visible 1340 // or the carousel or its parent isn't visible 1341 if (!document.hidden && isVisible(this._element)) { 1342 this.next(); 1343 } 1344 } 1345 1346 prev() { 1347 this._slide(ORDER_PREV); 1348 } 1349 1350 pause() { 1351 if (this._isSliding) { 1352 triggerTransitionEnd(this._element); 1353 } 1354 1355 this._clearInterval(); 1356 } 1357 1358 cycle() { 1359 this._clearInterval(); 1360 1361 this._updateInterval(); 1362 1363 this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval); 1364 } 1365 1366 _maybeEnableCycle() { 1367 if (!this._config.ride) { 1368 return; 1369 } 1370 1371 if (this._isSliding) { 1372 EventHandler.one(this._element, EVENT_SLID, () => this.cycle()); 1373 return; 1374 } 1375 1376 this.cycle(); 1377 } 1378 1379 to(index) { 1380 const items = this._getItems(); 1381 1382 if (index > items.length - 1 || index < 0) { 1383 return; 1384 } 1385 1386 if (this._isSliding) { 1387 EventHandler.one(this._element, EVENT_SLID, () => this.to(index)); 1388 return; 1389 } 1390 1391 const activeIndex = this._getItemIndex(this._getActive()); 1392 1393 if (activeIndex === index) { 1394 return; 1395 } 1396 1397 const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV; 1398 1399 this._slide(order, items[index]); 1400 } 1401 1402 dispose() { 1403 if (this._swipeHelper) { 1404 this._swipeHelper.dispose(); 1405 } 1406 1407 super.dispose(); 1408 } // Private 1409 1410 1411 _configAfterMerge(config) { 1412 config.defaultInterval = config.interval; 1413 return config; 1414 } 1415 1416 _addEventListeners() { 1417 if (this._config.keyboard) { 1418 EventHandler.on(this._element, EVENT_KEYDOWN$1, event => this._keydown(event)); 1419 } 1420 1421 if (this._config.pause === 'hover') { 1422 EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause()); 1423 EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle()); 1424 } 1425 1426 if (this._config.touch && Swipe.isSupported()) { 1427 this._addTouchEventListeners(); 1428 } 1429 } 1430 1431 _addTouchEventListeners() { 1432 for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) { 1433 EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault()); 1434 } 1435 1436 const endCallBack = () => { 1437 if (this._config.pause !== 'hover') { 1438 return; 1439 } // If it's a touch-enabled device, mouseenter/leave are fired as 1440 // part of the mouse compatibility events on first tap - the carousel 1441 // would stop cycling until user tapped out of it; 1442 // here, we listen for touchend, explicitly pause the carousel 1443 // (as if it's the second time we tap on it, mouseenter compat event 1444 // is NOT fired) and after a timeout (to allow for mouse compatibility 1445 // events to fire) we explicitly restart cycling 1446 1447 1448 this.pause(); 1449 1450 if (this.touchTimeout) { 1451 clearTimeout(this.touchTimeout); 1452 } 1453 1454 this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval); 1455 }; 1456 1457 const swipeConfig = { 1458 leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)), 1459 rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)), 1460 endCallback: endCallBack 1461 }; 1462 this._swipeHelper = new Swipe(this._element, swipeConfig); 1463 } 1464 1465 _keydown(event) { 1466 if (/input|textarea/i.test(event.target.tagName)) { 1467 return; 1468 } 1469 1470 const direction = KEY_TO_DIRECTION[event.key]; 1471 1472 if (direction) { 1473 event.preventDefault(); 1474 1475 this._slide(this._directionToOrder(direction)); 1476 } 1477 } 1478 1479 _getItemIndex(element) { 1480 return this._getItems().indexOf(element); 1481 } 1482 1483 _setActiveIndicatorElement(index) { 1484 if (!this._indicatorsElement) { 1485 return; 1486 } 1487 1488 const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement); 1489 activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2); 1490 activeIndicator.removeAttribute('aria-current'); 1491 const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement); 1492 1493 if (newActiveIndicator) { 1494 newActiveIndicator.classList.add(CLASS_NAME_ACTIVE$2); 1495 newActiveIndicator.setAttribute('aria-current', 'true'); 1496 } 1497 } 1498 1499 _updateInterval() { 1500 const element = this._activeElement || this._getActive(); 1501 1502 if (!element) { 1503 return; 1504 } 1505 1506 const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10); 1507 this._config.interval = elementInterval || this._config.defaultInterval; 1508 } 1509 1510 _slide(order, element = null) { 1511 if (this._isSliding) { 1512 return; 1513 } 1514 1515 const activeElement = this._getActive(); 1516 1517 const isNext = order === ORDER_NEXT; 1518 const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap); 1519 1520 if (nextElement === activeElement) { 1521 return; 1522 } 1523 1524 const nextElementIndex = this._getItemIndex(nextElement); 1525 1526 const triggerEvent = eventName => { 1527 return EventHandler.trigger(this._element, eventName, { 1528 relatedTarget: nextElement, 1529 direction: this._orderToDirection(order), 1530 from: this._getItemIndex(activeElement), 1531 to: nextElementIndex 1532 }); 1533 }; 1534 1535 const slideEvent = triggerEvent(EVENT_SLIDE); 1536 1537 if (slideEvent.defaultPrevented) { 1538 return; 1539 } 1540 1541 if (!activeElement || !nextElement) { 1542 // Some weirdness is happening, so we bail 1543 // todo: change tests that use empty divs to avoid this check 1544 return; 1545 } 1546 1547 const isCycling = Boolean(this._interval); 1548 this.pause(); 1549 this._isSliding = true; 1550 1551 this._setActiveIndicatorElement(nextElementIndex); 1552 1553 this._activeElement = nextElement; 1554 const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END; 1555 const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV; 1556 nextElement.classList.add(orderClassName); 1557 reflow(nextElement); 1558 activeElement.classList.add(directionalClassName); 1559 nextElement.classList.add(directionalClassName); 1560 1561 const completeCallBack = () => { 1562 nextElement.classList.remove(directionalClassName, orderClassName); 1563 nextElement.classList.add(CLASS_NAME_ACTIVE$2); 1564 activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName); 1565 this._isSliding = false; 1566 triggerEvent(EVENT_SLID); 1567 }; 1568 1569 this._queueCallback(completeCallBack, activeElement, this._isAnimated()); 1570 1571 if (isCycling) { 1572 this.cycle(); 1573 } 1574 } 1575 1576 _isAnimated() { 1577 return this._element.classList.contains(CLASS_NAME_SLIDE); 1578 } 1579 1580 _getActive() { 1581 return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); 1582 } 1583 1584 _getItems() { 1585 return SelectorEngine.find(SELECTOR_ITEM, this._element); 1586 } 1587 1588 _clearInterval() { 1589 if (this._interval) { 1590 clearInterval(this._interval); 1591 this._interval = null; 1592 } 1593 } 1594 1595 _directionToOrder(direction) { 1596 if (isRTL()) { 1597 return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT; 1598 } 1599 1600 return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV; 1601 } 1602 1603 _orderToDirection(order) { 1604 if (isRTL()) { 1605 return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT; 1606 } 1607 1608 return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT; 1609 } // Static 1610 1611 1612 static jQueryInterface(config) { 1613 return this.each(function () { 1614 const data = Carousel.getOrCreateInstance(this, config); 1615 1616 if (typeof config === 'number') { 1617 data.to(config); 1618 return; 1619 } 1620 1621 if (typeof config === 'string') { 1622 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 1623 throw new TypeError(`No method named "${config}"`); 1624 } 1625 1626 data[config](); 1627 } 1628 }); 1629 } 1630 1631 } 1632 /** 1633 * Data API implementation 1634 */ 1635 1636 1637 EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, function (event) { 1638 const target = getElementFromSelector(this); 1639 1640 if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { 1641 return; 1642 } 1643 1644 event.preventDefault(); 1645 const carousel = Carousel.getOrCreateInstance(target); 1646 const slideIndex = this.getAttribute('data-bs-slide-to'); 1647 1648 if (slideIndex) { 1649 carousel.to(slideIndex); 1650 1651 carousel._maybeEnableCycle(); 1652 1653 return; 1654 } 1655 1656 if (Manipulator.getDataAttribute(this, 'slide') === 'next') { 1657 carousel.next(); 1658 1659 carousel._maybeEnableCycle(); 1660 1661 return; 1662 } 1663 1664 carousel.prev(); 1665 1666 carousel._maybeEnableCycle(); 1667 }); 1668 EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => { 1669 const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); 1670 1671 for (const carousel of carousels) { 1672 Carousel.getOrCreateInstance(carousel); 1673 } 1674 }); 1675 /** 1676 * jQuery 1677 */ 1678 1679 defineJQueryPlugin(Carousel); 1680 1681 /** 1682 * -------------------------------------------------------------------------- 1683 * Bootstrap (v5.2.1): collapse.js 1684 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1685 * -------------------------------------------------------------------------- 1686 */ 1687 /** 1688 * Constants 1689 */ 1690 1691 const NAME$b = 'collapse'; 1692 const DATA_KEY$7 = 'bs.collapse'; 1693 const EVENT_KEY$7 = `.${DATA_KEY$7}`; 1694 const DATA_API_KEY$4 = '.data-api'; 1695 const EVENT_SHOW$6 = `show${EVENT_KEY$7}`; 1696 const EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`; 1697 const EVENT_HIDE$6 = `hide${EVENT_KEY$7}`; 1698 const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`; 1699 const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`; 1700 const CLASS_NAME_SHOW$7 = 'show'; 1701 const CLASS_NAME_COLLAPSE = 'collapse'; 1702 const CLASS_NAME_COLLAPSING = 'collapsing'; 1703 const CLASS_NAME_COLLAPSED = 'collapsed'; 1704 const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; 1705 const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; 1706 const WIDTH = 'width'; 1707 const HEIGHT = 'height'; 1708 const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; 1709 const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; 1710 const Default$a = { 1711 parent: null, 1712 toggle: true 1713 }; 1714 const DefaultType$a = { 1715 parent: '(null|element)', 1716 toggle: 'boolean' 1717 }; 1718 /** 1719 * Class definition 1720 */ 1721 1722 class Collapse extends BaseComponent { 1723 constructor(element, config) { 1724 super(element, config); 1725 this._isTransitioning = false; 1726 this._triggerArray = []; 1727 const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4); 1728 1729 for (const elem of toggleList) { 1730 const selector = getSelectorFromElement(elem); 1731 const filterElement = SelectorEngine.find(selector).filter(foundElement => foundElement === this._element); 1732 1733 if (selector !== null && filterElement.length) { 1734 this._triggerArray.push(elem); 1735 } 1736 } 1737 1738 this._initializeChildren(); 1739 1740 if (!this._config.parent) { 1741 this._addAriaAndCollapsedClass(this._triggerArray, this._isShown()); 1742 } 1743 1744 if (this._config.toggle) { 1745 this.toggle(); 1746 } 1747 } // Getters 1748 1749 1750 static get Default() { 1751 return Default$a; 1752 } 1753 1754 static get DefaultType() { 1755 return DefaultType$a; 1756 } 1757 1758 static get NAME() { 1759 return NAME$b; 1760 } // Public 1761 1762 1763 toggle() { 1764 if (this._isShown()) { 1765 this.hide(); 1766 } else { 1767 this.show(); 1768 } 1769 } 1770 1771 show() { 1772 if (this._isTransitioning || this._isShown()) { 1773 return; 1774 } 1775 1776 let activeChildren = []; // find active children 1777 1778 if (this._config.parent) { 1779 activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, { 1780 toggle: false 1781 })); 1782 } 1783 1784 if (activeChildren.length && activeChildren[0]._isTransitioning) { 1785 return; 1786 } 1787 1788 const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6); 1789 1790 if (startEvent.defaultPrevented) { 1791 return; 1792 } 1793 1794 for (const activeInstance of activeChildren) { 1795 activeInstance.hide(); 1796 } 1797 1798 const dimension = this._getDimension(); 1799 1800 this._element.classList.remove(CLASS_NAME_COLLAPSE); 1801 1802 this._element.classList.add(CLASS_NAME_COLLAPSING); 1803 1804 this._element.style[dimension] = 0; 1805 1806 this._addAriaAndCollapsedClass(this._triggerArray, true); 1807 1808 this._isTransitioning = true; 1809 1810 const complete = () => { 1811 this._isTransitioning = false; 1812 1813 this._element.classList.remove(CLASS_NAME_COLLAPSING); 1814 1815 this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 1816 1817 this._element.style[dimension] = ''; 1818 EventHandler.trigger(this._element, EVENT_SHOWN$6); 1819 }; 1820 1821 const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 1822 const scrollSize = `scroll${capitalizedDimension}`; 1823 1824 this._queueCallback(complete, this._element, true); 1825 1826 this._element.style[dimension] = `${this._element[scrollSize]}px`; 1827 } 1828 1829 hide() { 1830 if (this._isTransitioning || !this._isShown()) { 1831 return; 1832 } 1833 1834 const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6); 1835 1836 if (startEvent.defaultPrevented) { 1837 return; 1838 } 1839 1840 const dimension = this._getDimension(); 1841 1842 this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; 1843 reflow(this._element); 1844 1845 this._element.classList.add(CLASS_NAME_COLLAPSING); 1846 1847 this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 1848 1849 for (const trigger of this._triggerArray) { 1850 const element = getElementFromSelector(trigger); 1851 1852 if (element && !this._isShown(element)) { 1853 this._addAriaAndCollapsedClass([trigger], false); 1854 } 1855 } 1856 1857 this._isTransitioning = true; 1858 1859 const complete = () => { 1860 this._isTransitioning = false; 1861 1862 this._element.classList.remove(CLASS_NAME_COLLAPSING); 1863 1864 this._element.classList.add(CLASS_NAME_COLLAPSE); 1865 1866 EventHandler.trigger(this._element, EVENT_HIDDEN$6); 1867 }; 1868 1869 this._element.style[dimension] = ''; 1870 1871 this._queueCallback(complete, this._element, true); 1872 } 1873 1874 _isShown(element = this._element) { 1875 return element.classList.contains(CLASS_NAME_SHOW$7); 1876 } // Private 1877 1878 1879 _configAfterMerge(config) { 1880 config.toggle = Boolean(config.toggle); // Coerce string values 1881 1882 config.parent = getElement(config.parent); 1883 return config; 1884 } 1885 1886 _getDimension() { 1887 return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT; 1888 } 1889 1890 _initializeChildren() { 1891 if (!this._config.parent) { 1892 return; 1893 } 1894 1895 const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4); 1896 1897 for (const element of children) { 1898 const selected = getElementFromSelector(element); 1899 1900 if (selected) { 1901 this._addAriaAndCollapsedClass([element], this._isShown(selected)); 1902 } 1903 } 1904 } 1905 1906 _getFirstLevelChildren(selector) { 1907 const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); // remove children if greater depth 1908 1909 return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element)); 1910 } 1911 1912 _addAriaAndCollapsedClass(triggerArray, isOpen) { 1913 if (!triggerArray.length) { 1914 return; 1915 } 1916 1917 for (const element of triggerArray) { 1918 element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen); 1919 element.setAttribute('aria-expanded', isOpen); 1920 } 1921 } // Static 1922 1923 1924 static jQueryInterface(config) { 1925 const _config = {}; 1926 1927 if (typeof config === 'string' && /show|hide/.test(config)) { 1928 _config.toggle = false; 1929 } 1930 1931 return this.each(function () { 1932 const data = Collapse.getOrCreateInstance(this, _config); 1933 1934 if (typeof config === 'string') { 1935 if (typeof data[config] === 'undefined') { 1936 throw new TypeError(`No method named "${config}"`); 1937 } 1938 1939 data[config](); 1940 } 1941 }); 1942 } 1943 1944 } 1945 /** 1946 * Data API implementation 1947 */ 1948 1949 1950 EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) { 1951 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 1952 if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') { 1953 event.preventDefault(); 1954 } 1955 1956 const selector = getSelectorFromElement(this); 1957 const selectorElements = SelectorEngine.find(selector); 1958 1959 for (const element of selectorElements) { 1960 Collapse.getOrCreateInstance(element, { 1961 toggle: false 1962 }).toggle(); 1963 } 1964 }); 1965 /** 1966 * jQuery 1967 */ 1968 1969 defineJQueryPlugin(Collapse); 1970 1971 var top = 'top'; 1972 var bottom = 'bottom'; 1973 var right = 'right'; 1974 var left = 'left'; 1975 var auto = 'auto'; 1976 var basePlacements = [top, bottom, right, left]; 1977 var start = 'start'; 1978 var end = 'end'; 1979 var clippingParents = 'clippingParents'; 1980 var viewport = 'viewport'; 1981 var popper = 'popper'; 1982 var reference = 'reference'; 1983 var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) { 1984 return acc.concat([placement + "-" + start, placement + "-" + end]); 1985 }, []); 1986 var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) { 1987 return acc.concat([placement, placement + "-" + start, placement + "-" + end]); 1988 }, []); // modifiers that need to read the DOM 1989 1990 var beforeRead = 'beforeRead'; 1991 var read = 'read'; 1992 var afterRead = 'afterRead'; // pure-logic modifiers 1993 1994 var beforeMain = 'beforeMain'; 1995 var main = 'main'; 1996 var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state) 1997 1998 var beforeWrite = 'beforeWrite'; 1999 var write = 'write'; 2000 var afterWrite = 'afterWrite'; 2001 var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite]; 2002 2003 function getNodeName(element) { 2004 return element ? (element.nodeName || '').toLowerCase() : null; 2005 } 2006 2007 function getWindow(node) { 2008 if (node == null) { 2009 return window; 2010 } 2011 2012 if (node.toString() !== '[object Window]') { 2013 var ownerDocument = node.ownerDocument; 2014 return ownerDocument ? ownerDocument.defaultView || window : window; 2015 } 2016 2017 return node; 2018 } 2019 2020 function isElement(node) { 2021 var OwnElement = getWindow(node).Element; 2022 return node instanceof OwnElement || node instanceof Element; 2023 } 2024 2025 function isHTMLElement(node) { 2026 var OwnElement = getWindow(node).HTMLElement; 2027 return node instanceof OwnElement || node instanceof HTMLElement; 2028 } 2029 2030 function isShadowRoot(node) { 2031 // IE 11 has no ShadowRoot 2032 if (typeof ShadowRoot === 'undefined') { 2033 return false; 2034 } 2035 2036 var OwnElement = getWindow(node).ShadowRoot; 2037 return node instanceof OwnElement || node instanceof ShadowRoot; 2038 } 2039 2040 // and applies them to the HTMLElements such as popper and arrow 2041 2042 function applyStyles(_ref) { 2043 var state = _ref.state; 2044 Object.keys(state.elements).forEach(function (name) { 2045 var style = state.styles[name] || {}; 2046 var attributes = state.attributes[name] || {}; 2047 var element = state.elements[name]; // arrow is optional + virtual elements 2048 2049 if (!isHTMLElement(element) || !getNodeName(element)) { 2050 return; 2051 } // Flow doesn't support to extend this property, but it's the most 2052 // effective way to apply styles to an HTMLElement 2053 // $FlowFixMe[cannot-write] 2054 2055 2056 Object.assign(element.style, style); 2057 Object.keys(attributes).forEach(function (name) { 2058 var value = attributes[name]; 2059 2060 if (value === false) { 2061 element.removeAttribute(name); 2062 } else { 2063 element.setAttribute(name, value === true ? '' : value); 2064 } 2065 }); 2066 }); 2067 } 2068 2069 function effect$2(_ref2) { 2070 var state = _ref2.state; 2071 var initialStyles = { 2072 popper: { 2073 position: state.options.strategy, 2074 left: '0', 2075 top: '0', 2076 margin: '0' 2077 }, 2078 arrow: { 2079 position: 'absolute' 2080 }, 2081 reference: {} 2082 }; 2083 Object.assign(state.elements.popper.style, initialStyles.popper); 2084 state.styles = initialStyles; 2085 2086 if (state.elements.arrow) { 2087 Object.assign(state.elements.arrow.style, initialStyles.arrow); 2088 } 2089 2090 return function () { 2091 Object.keys(state.elements).forEach(function (name) { 2092 var element = state.elements[name]; 2093 var attributes = state.attributes[name] || {}; 2094 var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them 2095 2096 var style = styleProperties.reduce(function (style, property) { 2097 style[property] = ''; 2098 return style; 2099 }, {}); // arrow is optional + virtual elements 2100 2101 if (!isHTMLElement(element) || !getNodeName(element)) { 2102 return; 2103 } 2104 2105 Object.assign(element.style, style); 2106 Object.keys(attributes).forEach(function (attribute) { 2107 element.removeAttribute(attribute); 2108 }); 2109 }); 2110 }; 2111 } // eslint-disable-next-line import/no-unused-modules 2112 2113 2114 const applyStyles$1 = { 2115 name: 'applyStyles', 2116 enabled: true, 2117 phase: 'write', 2118 fn: applyStyles, 2119 effect: effect$2, 2120 requires: ['computeStyles'] 2121 }; 2122 2123 function getBasePlacement(placement) { 2124 return placement.split('-')[0]; 2125 } 2126 2127 var max = Math.max; 2128 var min = Math.min; 2129 var round = Math.round; 2130 2131 function getUAString() { 2132 var uaData = navigator.userAgentData; 2133 2134 if (uaData != null && uaData.brands) { 2135 return uaData.brands.map(function (item) { 2136 return item.brand + "/" + item.version; 2137 }).join(' '); 2138 } 2139 2140 return navigator.userAgent; 2141 } 2142 2143 function isLayoutViewport() { 2144 return !/^((?!chrome|android).)*safari/i.test(getUAString()); 2145 } 2146 2147 function getBoundingClientRect(element, includeScale, isFixedStrategy) { 2148 if (includeScale === void 0) { 2149 includeScale = false; 2150 } 2151 2152 if (isFixedStrategy === void 0) { 2153 isFixedStrategy = false; 2154 } 2155 2156 var clientRect = element.getBoundingClientRect(); 2157 var scaleX = 1; 2158 var scaleY = 1; 2159 2160 if (includeScale && isHTMLElement(element)) { 2161 scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1; 2162 scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1; 2163 } 2164 2165 var _ref = isElement(element) ? getWindow(element) : window, 2166 visualViewport = _ref.visualViewport; 2167 2168 var addVisualOffsets = !isLayoutViewport() && isFixedStrategy; 2169 var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX; 2170 var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY; 2171 var width = clientRect.width / scaleX; 2172 var height = clientRect.height / scaleY; 2173 return { 2174 width: width, 2175 height: height, 2176 top: y, 2177 right: x + width, 2178 bottom: y + height, 2179 left: x, 2180 x: x, 2181 y: y 2182 }; 2183 } 2184 2185 // means it doesn't take into account transforms. 2186 2187 function getLayoutRect(element) { 2188 var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed. 2189 // Fixes https://github.com/popperjs/popper-core/issues/1223 2190 2191 var width = element.offsetWidth; 2192 var height = element.offsetHeight; 2193 2194 if (Math.abs(clientRect.width - width) <= 1) { 2195 width = clientRect.width; 2196 } 2197 2198 if (Math.abs(clientRect.height - height) <= 1) { 2199 height = clientRect.height; 2200 } 2201 2202 return { 2203 x: element.offsetLeft, 2204 y: element.offsetTop, 2205 width: width, 2206 height: height 2207 }; 2208 } 2209 2210 function contains(parent, child) { 2211 var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method 2212 2213 if (parent.contains(child)) { 2214 return true; 2215 } // then fallback to custom implementation with Shadow DOM support 2216 else if (rootNode && isShadowRoot(rootNode)) { 2217 var next = child; 2218 2219 do { 2220 if (next && parent.isSameNode(next)) { 2221 return true; 2222 } // $FlowFixMe[prop-missing]: need a better way to handle this... 2223 2224 2225 next = next.parentNode || next.host; 2226 } while (next); 2227 } // Give up, the result is false 2228 2229 2230 return false; 2231 } 2232 2233 function getComputedStyle$1(element) { 2234 return getWindow(element).getComputedStyle(element); 2235 } 2236 2237 function isTableElement(element) { 2238 return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0; 2239 } 2240 2241 function getDocumentElement(element) { 2242 // $FlowFixMe[incompatible-return]: assume body is always available 2243 return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing] 2244 element.document) || window.document).documentElement; 2245 } 2246 2247 function getParentNode(element) { 2248 if (getNodeName(element) === 'html') { 2249 return element; 2250 } 2251 2252 return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle 2253 // $FlowFixMe[incompatible-return] 2254 // $FlowFixMe[prop-missing] 2255 element.assignedSlot || // step into the shadow DOM of the parent of a slotted node 2256 element.parentNode || ( // DOM Element detected 2257 isShadowRoot(element) ? element.host : null) || // ShadowRoot detected 2258 // $FlowFixMe[incompatible-call]: HTMLElement is a Node 2259 getDocumentElement(element) // fallback 2260 2261 ); 2262 } 2263 2264 function getTrueOffsetParent(element) { 2265 if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837 2266 getComputedStyle$1(element).position === 'fixed') { 2267 return null; 2268 } 2269 2270 return element.offsetParent; 2271 } // `.offsetParent` reports `null` for fixed elements, while absolute elements 2272 // return the containing block 2273 2274 2275 function getContainingBlock(element) { 2276 var isFirefox = /firefox/i.test(getUAString()); 2277 var isIE = /Trident/i.test(getUAString()); 2278 2279 if (isIE && isHTMLElement(element)) { 2280 // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport 2281 var elementCss = getComputedStyle$1(element); 2282 2283 if (elementCss.position === 'fixed') { 2284 return null; 2285 } 2286 } 2287 2288 var currentNode = getParentNode(element); 2289 2290 if (isShadowRoot(currentNode)) { 2291 currentNode = currentNode.host; 2292 } 2293 2294 while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) { 2295 var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that 2296 // create a containing block. 2297 // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block 2298 2299 if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') { 2300 return currentNode; 2301 } else { 2302 currentNode = currentNode.parentNode; 2303 } 2304 } 2305 2306 return null; 2307 } // Gets the closest ancestor positioned element. Handles some edge cases, 2308 // such as table ancestors and cross browser bugs. 2309 2310 2311 function getOffsetParent(element) { 2312 var window = getWindow(element); 2313 var offsetParent = getTrueOffsetParent(element); 2314 2315 while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') { 2316 offsetParent = getTrueOffsetParent(offsetParent); 2317 } 2318 2319 if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) { 2320 return window; 2321 } 2322 2323 return offsetParent || getContainingBlock(element) || window; 2324 } 2325 2326 function getMainAxisFromPlacement(placement) { 2327 return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y'; 2328 } 2329 2330 function within(min$1, value, max$1) { 2331 return max(min$1, min(value, max$1)); 2332 } 2333 function withinMaxClamp(min, value, max) { 2334 var v = within(min, value, max); 2335 return v > max ? max : v; 2336 } 2337 2338 function getFreshSideObject() { 2339 return { 2340 top: 0, 2341 right: 0, 2342 bottom: 0, 2343 left: 0 2344 }; 2345 } 2346 2347 function mergePaddingObject(paddingObject) { 2348 return Object.assign({}, getFreshSideObject(), paddingObject); 2349 } 2350 2351 function expandToHashMap(value, keys) { 2352 return keys.reduce(function (hashMap, key) { 2353 hashMap[key] = value; 2354 return hashMap; 2355 }, {}); 2356 } 2357 2358 var toPaddingObject = function toPaddingObject(padding, state) { 2359 padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, { 2360 placement: state.placement 2361 })) : padding; 2362 return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); 2363 }; 2364 2365 function arrow(_ref) { 2366 var _state$modifiersData$; 2367 2368 var state = _ref.state, 2369 name = _ref.name, 2370 options = _ref.options; 2371 var arrowElement = state.elements.arrow; 2372 var popperOffsets = state.modifiersData.popperOffsets; 2373 var basePlacement = getBasePlacement(state.placement); 2374 var axis = getMainAxisFromPlacement(basePlacement); 2375 var isVertical = [left, right].indexOf(basePlacement) >= 0; 2376 var len = isVertical ? 'height' : 'width'; 2377 2378 if (!arrowElement || !popperOffsets) { 2379 return; 2380 } 2381 2382 var paddingObject = toPaddingObject(options.padding, state); 2383 var arrowRect = getLayoutRect(arrowElement); 2384 var minProp = axis === 'y' ? top : left; 2385 var maxProp = axis === 'y' ? bottom : right; 2386 var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len]; 2387 var startDiff = popperOffsets[axis] - state.rects.reference[axis]; 2388 var arrowOffsetParent = getOffsetParent(arrowElement); 2389 var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0; 2390 var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is 2391 // outside of the popper bounds 2392 2393 var min = paddingObject[minProp]; 2394 var max = clientSize - arrowRect[len] - paddingObject[maxProp]; 2395 var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference; 2396 var offset = within(min, center, max); // Prevents breaking syntax highlighting... 2397 2398 var axisProp = axis; 2399 state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$); 2400 } 2401 2402 function effect$1(_ref2) { 2403 var state = _ref2.state, 2404 options = _ref2.options; 2405 var _options$element = options.element, 2406 arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element; 2407 2408 if (arrowElement == null) { 2409 return; 2410 } // CSS selector 2411 2412 2413 if (typeof arrowElement === 'string') { 2414 arrowElement = state.elements.popper.querySelector(arrowElement); 2415 2416 if (!arrowElement) { 2417 return; 2418 } 2419 } 2420 2421 if (!contains(state.elements.popper, arrowElement)) { 2422 2423 return; 2424 } 2425 2426 state.elements.arrow = arrowElement; 2427 } // eslint-disable-next-line import/no-unused-modules 2428 2429 2430 const arrow$1 = { 2431 name: 'arrow', 2432 enabled: true, 2433 phase: 'main', 2434 fn: arrow, 2435 effect: effect$1, 2436 requires: ['popperOffsets'], 2437 requiresIfExists: ['preventOverflow'] 2438 }; 2439 2440 function getVariation(placement) { 2441 return placement.split('-')[1]; 2442 } 2443 2444 var unsetSides = { 2445 top: 'auto', 2446 right: 'auto', 2447 bottom: 'auto', 2448 left: 'auto' 2449 }; // Round the offsets to the nearest suitable subpixel based on the DPR. 2450 // Zooming can change the DPR, but it seems to report a value that will 2451 // cleanly divide the values into the appropriate subpixels. 2452 2453 function roundOffsetsByDPR(_ref) { 2454 var x = _ref.x, 2455 y = _ref.y; 2456 var win = window; 2457 var dpr = win.devicePixelRatio || 1; 2458 return { 2459 x: round(x * dpr) / dpr || 0, 2460 y: round(y * dpr) / dpr || 0 2461 }; 2462 } 2463 2464 function mapToStyles(_ref2) { 2465 var _Object$assign2; 2466 2467 var popper = _ref2.popper, 2468 popperRect = _ref2.popperRect, 2469 placement = _ref2.placement, 2470 variation = _ref2.variation, 2471 offsets = _ref2.offsets, 2472 position = _ref2.position, 2473 gpuAcceleration = _ref2.gpuAcceleration, 2474 adaptive = _ref2.adaptive, 2475 roundOffsets = _ref2.roundOffsets, 2476 isFixed = _ref2.isFixed; 2477 var _offsets$x = offsets.x, 2478 x = _offsets$x === void 0 ? 0 : _offsets$x, 2479 _offsets$y = offsets.y, 2480 y = _offsets$y === void 0 ? 0 : _offsets$y; 2481 2482 var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({ 2483 x: x, 2484 y: y 2485 }) : { 2486 x: x, 2487 y: y 2488 }; 2489 2490 x = _ref3.x; 2491 y = _ref3.y; 2492 var hasX = offsets.hasOwnProperty('x'); 2493 var hasY = offsets.hasOwnProperty('y'); 2494 var sideX = left; 2495 var sideY = top; 2496 var win = window; 2497 2498 if (adaptive) { 2499 var offsetParent = getOffsetParent(popper); 2500 var heightProp = 'clientHeight'; 2501 var widthProp = 'clientWidth'; 2502 2503 if (offsetParent === getWindow(popper)) { 2504 offsetParent = getDocumentElement(popper); 2505 2506 if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') { 2507 heightProp = 'scrollHeight'; 2508 widthProp = 'scrollWidth'; 2509 } 2510 } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it 2511 2512 2513 offsetParent = offsetParent; 2514 2515 if (placement === top || (placement === left || placement === right) && variation === end) { 2516 sideY = bottom; 2517 var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing] 2518 offsetParent[heightProp]; 2519 y -= offsetY - popperRect.height; 2520 y *= gpuAcceleration ? 1 : -1; 2521 } 2522 2523 if (placement === left || (placement === top || placement === bottom) && variation === end) { 2524 sideX = right; 2525 var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing] 2526 offsetParent[widthProp]; 2527 x -= offsetX - popperRect.width; 2528 x *= gpuAcceleration ? 1 : -1; 2529 } 2530 } 2531 2532 var commonStyles = Object.assign({ 2533 position: position 2534 }, adaptive && unsetSides); 2535 2536 var _ref4 = roundOffsets === true ? roundOffsetsByDPR({ 2537 x: x, 2538 y: y 2539 }) : { 2540 x: x, 2541 y: y 2542 }; 2543 2544 x = _ref4.x; 2545 y = _ref4.y; 2546 2547 if (gpuAcceleration) { 2548 var _Object$assign; 2549 2550 return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign)); 2551 } 2552 2553 return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2)); 2554 } 2555 2556 function computeStyles(_ref5) { 2557 var state = _ref5.state, 2558 options = _ref5.options; 2559 var _options$gpuAccelerat = options.gpuAcceleration, 2560 gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, 2561 _options$adaptive = options.adaptive, 2562 adaptive = _options$adaptive === void 0 ? true : _options$adaptive, 2563 _options$roundOffsets = options.roundOffsets, 2564 roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets; 2565 2566 var commonStyles = { 2567 placement: getBasePlacement(state.placement), 2568 variation: getVariation(state.placement), 2569 popper: state.elements.popper, 2570 popperRect: state.rects.popper, 2571 gpuAcceleration: gpuAcceleration, 2572 isFixed: state.options.strategy === 'fixed' 2573 }; 2574 2575 if (state.modifiersData.popperOffsets != null) { 2576 state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, { 2577 offsets: state.modifiersData.popperOffsets, 2578 position: state.options.strategy, 2579 adaptive: adaptive, 2580 roundOffsets: roundOffsets 2581 }))); 2582 } 2583 2584 if (state.modifiersData.arrow != null) { 2585 state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, { 2586 offsets: state.modifiersData.arrow, 2587 position: 'absolute', 2588 adaptive: false, 2589 roundOffsets: roundOffsets 2590 }))); 2591 } 2592 2593 state.attributes.popper = Object.assign({}, state.attributes.popper, { 2594 'data-popper-placement': state.placement 2595 }); 2596 } // eslint-disable-next-line import/no-unused-modules 2597 2598 2599 const computeStyles$1 = { 2600 name: 'computeStyles', 2601 enabled: true, 2602 phase: 'beforeWrite', 2603 fn: computeStyles, 2604 data: {} 2605 }; 2606 2607 var passive = { 2608 passive: true 2609 }; 2610 2611 function effect(_ref) { 2612 var state = _ref.state, 2613 instance = _ref.instance, 2614 options = _ref.options; 2615 var _options$scroll = options.scroll, 2616 scroll = _options$scroll === void 0 ? true : _options$scroll, 2617 _options$resize = options.resize, 2618 resize = _options$resize === void 0 ? true : _options$resize; 2619 var window = getWindow(state.elements.popper); 2620 var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper); 2621 2622 if (scroll) { 2623 scrollParents.forEach(function (scrollParent) { 2624 scrollParent.addEventListener('scroll', instance.update, passive); 2625 }); 2626 } 2627 2628 if (resize) { 2629 window.addEventListener('resize', instance.update, passive); 2630 } 2631 2632 return function () { 2633 if (scroll) { 2634 scrollParents.forEach(function (scrollParent) { 2635 scrollParent.removeEventListener('scroll', instance.update, passive); 2636 }); 2637 } 2638 2639 if (resize) { 2640 window.removeEventListener('resize', instance.update, passive); 2641 } 2642 }; 2643 } // eslint-disable-next-line import/no-unused-modules 2644 2645 2646 const eventListeners = { 2647 name: 'eventListeners', 2648 enabled: true, 2649 phase: 'write', 2650 fn: function fn() {}, 2651 effect: effect, 2652 data: {} 2653 }; 2654 2655 var hash$1 = { 2656 left: 'right', 2657 right: 'left', 2658 bottom: 'top', 2659 top: 'bottom' 2660 }; 2661 function getOppositePlacement(placement) { 2662 return placement.replace(/left|right|bottom|top/g, function (matched) { 2663 return hash$1[matched]; 2664 }); 2665 } 2666 2667 var hash = { 2668 start: 'end', 2669 end: 'start' 2670 }; 2671 function getOppositeVariationPlacement(placement) { 2672 return placement.replace(/start|end/g, function (matched) { 2673 return hash[matched]; 2674 }); 2675 } 2676 2677 function getWindowScroll(node) { 2678 var win = getWindow(node); 2679 var scrollLeft = win.pageXOffset; 2680 var scrollTop = win.pageYOffset; 2681 return { 2682 scrollLeft: scrollLeft, 2683 scrollTop: scrollTop 2684 }; 2685 } 2686 2687 function getWindowScrollBarX(element) { 2688 // If <html> has a CSS width greater than the viewport, then this will be 2689 // incorrect for RTL. 2690 // Popper 1 is broken in this case and never had a bug report so let's assume 2691 // it's not an issue. I don't think anyone ever specifies width on <html> 2692 // anyway. 2693 // Browsers where the left scrollbar doesn't cause an issue report `0` for 2694 // this (e.g. Edge 2019, IE11, Safari) 2695 return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft; 2696 } 2697 2698 function getViewportRect(element, strategy) { 2699 var win = getWindow(element); 2700 var html = getDocumentElement(element); 2701 var visualViewport = win.visualViewport; 2702 var width = html.clientWidth; 2703 var height = html.clientHeight; 2704 var x = 0; 2705 var y = 0; 2706 2707 if (visualViewport) { 2708 width = visualViewport.width; 2709 height = visualViewport.height; 2710 var layoutViewport = isLayoutViewport(); 2711 2712 if (layoutViewport || !layoutViewport && strategy === 'fixed') { 2713 x = visualViewport.offsetLeft; 2714 y = visualViewport.offsetTop; 2715 } 2716 } 2717 2718 return { 2719 width: width, 2720 height: height, 2721 x: x + getWindowScrollBarX(element), 2722 y: y 2723 }; 2724 } 2725 2726 // of the `<html>` and `<body>` rect bounds if horizontally scrollable 2727 2728 function getDocumentRect(element) { 2729 var _element$ownerDocumen; 2730 2731 var html = getDocumentElement(element); 2732 var winScroll = getWindowScroll(element); 2733 var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body; 2734 var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); 2735 var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); 2736 var x = -winScroll.scrollLeft + getWindowScrollBarX(element); 2737 var y = -winScroll.scrollTop; 2738 2739 if (getComputedStyle$1(body || html).direction === 'rtl') { 2740 x += max(html.clientWidth, body ? body.clientWidth : 0) - width; 2741 } 2742 2743 return { 2744 width: width, 2745 height: height, 2746 x: x, 2747 y: y 2748 }; 2749 } 2750 2751 function isScrollParent(element) { 2752 // Firefox wants us to check `-x` and `-y` variations as well 2753 var _getComputedStyle = getComputedStyle$1(element), 2754 overflow = _getComputedStyle.overflow, 2755 overflowX = _getComputedStyle.overflowX, 2756 overflowY = _getComputedStyle.overflowY; 2757 2758 return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); 2759 } 2760 2761 function getScrollParent(node) { 2762 if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) { 2763 // $FlowFixMe[incompatible-return]: assume body is always available 2764 return node.ownerDocument.body; 2765 } 2766 2767 if (isHTMLElement(node) && isScrollParent(node)) { 2768 return node; 2769 } 2770 2771 return getScrollParent(getParentNode(node)); 2772 } 2773 2774 /* 2775 given a DOM element, return the list of all scroll parents, up the list of ancesors 2776 until we get to the top window object. This list is what we attach scroll listeners 2777 to, because if any of these parent elements scroll, we'll need to re-calculate the 2778 reference element's position. 2779 */ 2780 2781 function listScrollParents(element, list) { 2782 var _element$ownerDocumen; 2783 2784 if (list === void 0) { 2785 list = []; 2786 } 2787 2788 var scrollParent = getScrollParent(element); 2789 var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body); 2790 var win = getWindow(scrollParent); 2791 var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent; 2792 var updatedList = list.concat(target); 2793 return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here 2794 updatedList.concat(listScrollParents(getParentNode(target))); 2795 } 2796 2797 function rectToClientRect(rect) { 2798 return Object.assign({}, rect, { 2799 left: rect.x, 2800 top: rect.y, 2801 right: rect.x + rect.width, 2802 bottom: rect.y + rect.height 2803 }); 2804 } 2805 2806 function getInnerBoundingClientRect(element, strategy) { 2807 var rect = getBoundingClientRect(element, false, strategy === 'fixed'); 2808 rect.top = rect.top + element.clientTop; 2809 rect.left = rect.left + element.clientLeft; 2810 rect.bottom = rect.top + element.clientHeight; 2811 rect.right = rect.left + element.clientWidth; 2812 rect.width = element.clientWidth; 2813 rect.height = element.clientHeight; 2814 rect.x = rect.left; 2815 rect.y = rect.top; 2816 return rect; 2817 } 2818 2819 function getClientRectFromMixedType(element, clippingParent, strategy) { 2820 return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element))); 2821 } // A "clipping parent" is an overflowable container with the characteristic of 2822 // clipping (or hiding) overflowing elements with a position different from 2823 // `initial` 2824 2825 2826 function getClippingParents(element) { 2827 var clippingParents = listScrollParents(getParentNode(element)); 2828 var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0; 2829 var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element; 2830 2831 if (!isElement(clipperElement)) { 2832 return []; 2833 } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414 2834 2835 2836 return clippingParents.filter(function (clippingParent) { 2837 return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body'; 2838 }); 2839 } // Gets the maximum area that the element is visible in due to any number of 2840 // clipping parents 2841 2842 2843 function getClippingRect(element, boundary, rootBoundary, strategy) { 2844 var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary); 2845 var clippingParents = [].concat(mainClippingParents, [rootBoundary]); 2846 var firstClippingParent = clippingParents[0]; 2847 var clippingRect = clippingParents.reduce(function (accRect, clippingParent) { 2848 var rect = getClientRectFromMixedType(element, clippingParent, strategy); 2849 accRect.top = max(rect.top, accRect.top); 2850 accRect.right = min(rect.right, accRect.right); 2851 accRect.bottom = min(rect.bottom, accRect.bottom); 2852 accRect.left = max(rect.left, accRect.left); 2853 return accRect; 2854 }, getClientRectFromMixedType(element, firstClippingParent, strategy)); 2855 clippingRect.width = clippingRect.right - clippingRect.left; 2856 clippingRect.height = clippingRect.bottom - clippingRect.top; 2857 clippingRect.x = clippingRect.left; 2858 clippingRect.y = clippingRect.top; 2859 return clippingRect; 2860 } 2861 2862 function computeOffsets(_ref) { 2863 var reference = _ref.reference, 2864 element = _ref.element, 2865 placement = _ref.placement; 2866 var basePlacement = placement ? getBasePlacement(placement) : null; 2867 var variation = placement ? getVariation(placement) : null; 2868 var commonX = reference.x + reference.width / 2 - element.width / 2; 2869 var commonY = reference.y + reference.height / 2 - element.height / 2; 2870 var offsets; 2871 2872 switch (basePlacement) { 2873 case top: 2874 offsets = { 2875 x: commonX, 2876 y: reference.y - element.height 2877 }; 2878 break; 2879 2880 case bottom: 2881 offsets = { 2882 x: commonX, 2883 y: reference.y + reference.height 2884 }; 2885 break; 2886 2887 case right: 2888 offsets = { 2889 x: reference.x + reference.width, 2890 y: commonY 2891 }; 2892 break; 2893 2894 case left: 2895 offsets = { 2896 x: reference.x - element.width, 2897 y: commonY 2898 }; 2899 break; 2900 2901 default: 2902 offsets = { 2903 x: reference.x, 2904 y: reference.y 2905 }; 2906 } 2907 2908 var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null; 2909 2910 if (mainAxis != null) { 2911 var len = mainAxis === 'y' ? 'height' : 'width'; 2912 2913 switch (variation) { 2914 case start: 2915 offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2); 2916 break; 2917 2918 case end: 2919 offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2); 2920 break; 2921 } 2922 } 2923 2924 return offsets; 2925 } 2926 2927 function detectOverflow(state, options) { 2928 if (options === void 0) { 2929 options = {}; 2930 } 2931 2932 var _options = options, 2933 _options$placement = _options.placement, 2934 placement = _options$placement === void 0 ? state.placement : _options$placement, 2935 _options$strategy = _options.strategy, 2936 strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, 2937 _options$boundary = _options.boundary, 2938 boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, 2939 _options$rootBoundary = _options.rootBoundary, 2940 rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, 2941 _options$elementConte = _options.elementContext, 2942 elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, 2943 _options$altBoundary = _options.altBoundary, 2944 altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, 2945 _options$padding = _options.padding, 2946 padding = _options$padding === void 0 ? 0 : _options$padding; 2947 var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); 2948 var altContext = elementContext === popper ? reference : popper; 2949 var popperRect = state.rects.popper; 2950 var element = state.elements[altBoundary ? altContext : elementContext]; 2951 var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy); 2952 var referenceClientRect = getBoundingClientRect(state.elements.reference); 2953 var popperOffsets = computeOffsets({ 2954 reference: referenceClientRect, 2955 element: popperRect, 2956 strategy: 'absolute', 2957 placement: placement 2958 }); 2959 var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets)); 2960 var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect 2961 // 0 or negative = within the clipping rect 2962 2963 var overflowOffsets = { 2964 top: clippingClientRect.top - elementClientRect.top + paddingObject.top, 2965 bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom, 2966 left: clippingClientRect.left - elementClientRect.left + paddingObject.left, 2967 right: elementClientRect.right - clippingClientRect.right + paddingObject.right 2968 }; 2969 var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element 2970 2971 if (elementContext === popper && offsetData) { 2972 var offset = offsetData[placement]; 2973 Object.keys(overflowOffsets).forEach(function (key) { 2974 var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1; 2975 var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x'; 2976 overflowOffsets[key] += offset[axis] * multiply; 2977 }); 2978 } 2979 2980 return overflowOffsets; 2981 } 2982 2983 function computeAutoPlacement(state, options) { 2984 if (options === void 0) { 2985 options = {}; 2986 } 2987 2988 var _options = options, 2989 placement = _options.placement, 2990 boundary = _options.boundary, 2991 rootBoundary = _options.rootBoundary, 2992 padding = _options.padding, 2993 flipVariations = _options.flipVariations, 2994 _options$allowedAutoP = _options.allowedAutoPlacements, 2995 allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP; 2996 var variation = getVariation(placement); 2997 var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) { 2998 return getVariation(placement) === variation; 2999 }) : basePlacements; 3000 var allowedPlacements = placements$1.filter(function (placement) { 3001 return allowedAutoPlacements.indexOf(placement) >= 0; 3002 }); 3003 3004 if (allowedPlacements.length === 0) { 3005 allowedPlacements = placements$1; 3006 } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions... 3007 3008 3009 var overflows = allowedPlacements.reduce(function (acc, placement) { 3010 acc[placement] = detectOverflow(state, { 3011 placement: placement, 3012 boundary: boundary, 3013 rootBoundary: rootBoundary, 3014 padding: padding 3015 })[getBasePlacement(placement)]; 3016 return acc; 3017 }, {}); 3018 return Object.keys(overflows).sort(function (a, b) { 3019 return overflows[a] - overflows[b]; 3020 }); 3021 } 3022 3023 function getExpandedFallbackPlacements(placement) { 3024 if (getBasePlacement(placement) === auto) { 3025 return []; 3026 } 3027 3028 var oppositePlacement = getOppositePlacement(placement); 3029 return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)]; 3030 } 3031 3032 function flip(_ref) { 3033 var state = _ref.state, 3034 options = _ref.options, 3035 name = _ref.name; 3036 3037 if (state.modifiersData[name]._skip) { 3038 return; 3039 } 3040 3041 var _options$mainAxis = options.mainAxis, 3042 checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, 3043 _options$altAxis = options.altAxis, 3044 checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, 3045 specifiedFallbackPlacements = options.fallbackPlacements, 3046 padding = options.padding, 3047 boundary = options.boundary, 3048 rootBoundary = options.rootBoundary, 3049 altBoundary = options.altBoundary, 3050 _options$flipVariatio = options.flipVariations, 3051 flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, 3052 allowedAutoPlacements = options.allowedAutoPlacements; 3053 var preferredPlacement = state.options.placement; 3054 var basePlacement = getBasePlacement(preferredPlacement); 3055 var isBasePlacement = basePlacement === preferredPlacement; 3056 var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement)); 3057 var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) { 3058 return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, { 3059 placement: placement, 3060 boundary: boundary, 3061 rootBoundary: rootBoundary, 3062 padding: padding, 3063 flipVariations: flipVariations, 3064 allowedAutoPlacements: allowedAutoPlacements 3065 }) : placement); 3066 }, []); 3067 var referenceRect = state.rects.reference; 3068 var popperRect = state.rects.popper; 3069 var checksMap = new Map(); 3070 var makeFallbackChecks = true; 3071 var firstFittingPlacement = placements[0]; 3072 3073 for (var i = 0; i < placements.length; i++) { 3074 var placement = placements[i]; 3075 3076 var _basePlacement = getBasePlacement(placement); 3077 3078 var isStartVariation = getVariation(placement) === start; 3079 var isVertical = [top, bottom].indexOf(_basePlacement) >= 0; 3080 var len = isVertical ? 'width' : 'height'; 3081 var overflow = detectOverflow(state, { 3082 placement: placement, 3083 boundary: boundary, 3084 rootBoundary: rootBoundary, 3085 altBoundary: altBoundary, 3086 padding: padding 3087 }); 3088 var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top; 3089 3090 if (referenceRect[len] > popperRect[len]) { 3091 mainVariationSide = getOppositePlacement(mainVariationSide); 3092 } 3093 3094 var altVariationSide = getOppositePlacement(mainVariationSide); 3095 var checks = []; 3096 3097 if (checkMainAxis) { 3098 checks.push(overflow[_basePlacement] <= 0); 3099 } 3100 3101 if (checkAltAxis) { 3102 checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0); 3103 } 3104 3105 if (checks.every(function (check) { 3106 return check; 3107 })) { 3108 firstFittingPlacement = placement; 3109 makeFallbackChecks = false; 3110 break; 3111 } 3112 3113 checksMap.set(placement, checks); 3114 } 3115 3116 if (makeFallbackChecks) { 3117 // `2` may be desired in some cases – research later 3118 var numberOfChecks = flipVariations ? 3 : 1; 3119 3120 var _loop = function _loop(_i) { 3121 var fittingPlacement = placements.find(function (placement) { 3122 var checks = checksMap.get(placement); 3123 3124 if (checks) { 3125 return checks.slice(0, _i).every(function (check) { 3126 return check; 3127 }); 3128 } 3129 }); 3130 3131 if (fittingPlacement) { 3132 firstFittingPlacement = fittingPlacement; 3133 return "break"; 3134 } 3135 }; 3136 3137 for (var _i = numberOfChecks; _i > 0; _i--) { 3138 var _ret = _loop(_i); 3139 3140 if (_ret === "break") break; 3141 } 3142 } 3143 3144 if (state.placement !== firstFittingPlacement) { 3145 state.modifiersData[name]._skip = true; 3146 state.placement = firstFittingPlacement; 3147 state.reset = true; 3148 } 3149 } // eslint-disable-next-line import/no-unused-modules 3150 3151 3152 const flip$1 = { 3153 name: 'flip', 3154 enabled: true, 3155 phase: 'main', 3156 fn: flip, 3157 requiresIfExists: ['offset'], 3158 data: { 3159 _skip: false 3160 } 3161 }; 3162 3163 function getSideOffsets(overflow, rect, preventedOffsets) { 3164 if (preventedOffsets === void 0) { 3165 preventedOffsets = { 3166 x: 0, 3167 y: 0 3168 }; 3169 } 3170 3171 return { 3172 top: overflow.top - rect.height - preventedOffsets.y, 3173 right: overflow.right - rect.width + preventedOffsets.x, 3174 bottom: overflow.bottom - rect.height + preventedOffsets.y, 3175 left: overflow.left - rect.width - preventedOffsets.x 3176 }; 3177 } 3178 3179 function isAnySideFullyClipped(overflow) { 3180 return [top, right, bottom, left].some(function (side) { 3181 return overflow[side] >= 0; 3182 }); 3183 } 3184 3185 function hide(_ref) { 3186 var state = _ref.state, 3187 name = _ref.name; 3188 var referenceRect = state.rects.reference; 3189 var popperRect = state.rects.popper; 3190 var preventedOffsets = state.modifiersData.preventOverflow; 3191 var referenceOverflow = detectOverflow(state, { 3192 elementContext: 'reference' 3193 }); 3194 var popperAltOverflow = detectOverflow(state, { 3195 altBoundary: true 3196 }); 3197 var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect); 3198 var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets); 3199 var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets); 3200 var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets); 3201 state.modifiersData[name] = { 3202 referenceClippingOffsets: referenceClippingOffsets, 3203 popperEscapeOffsets: popperEscapeOffsets, 3204 isReferenceHidden: isReferenceHidden, 3205 hasPopperEscaped: hasPopperEscaped 3206 }; 3207 state.attributes.popper = Object.assign({}, state.attributes.popper, { 3208 'data-popper-reference-hidden': isReferenceHidden, 3209 'data-popper-escaped': hasPopperEscaped 3210 }); 3211 } // eslint-disable-next-line import/no-unused-modules 3212 3213 3214 const hide$1 = { 3215 name: 'hide', 3216 enabled: true, 3217 phase: 'main', 3218 requiresIfExists: ['preventOverflow'], 3219 fn: hide 3220 }; 3221 3222 function distanceAndSkiddingToXY(placement, rects, offset) { 3223 var basePlacement = getBasePlacement(placement); 3224 var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1; 3225 3226 var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, { 3227 placement: placement 3228 })) : offset, 3229 skidding = _ref[0], 3230 distance = _ref[1]; 3231 3232 skidding = skidding || 0; 3233 distance = (distance || 0) * invertDistance; 3234 return [left, right].indexOf(basePlacement) >= 0 ? { 3235 x: distance, 3236 y: skidding 3237 } : { 3238 x: skidding, 3239 y: distance 3240 }; 3241 } 3242 3243 function offset(_ref2) { 3244 var state = _ref2.state, 3245 options = _ref2.options, 3246 name = _ref2.name; 3247 var _options$offset = options.offset, 3248 offset = _options$offset === void 0 ? [0, 0] : _options$offset; 3249 var data = placements.reduce(function (acc, placement) { 3250 acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset); 3251 return acc; 3252 }, {}); 3253 var _data$state$placement = data[state.placement], 3254 x = _data$state$placement.x, 3255 y = _data$state$placement.y; 3256 3257 if (state.modifiersData.popperOffsets != null) { 3258 state.modifiersData.popperOffsets.x += x; 3259 state.modifiersData.popperOffsets.y += y; 3260 } 3261 3262 state.modifiersData[name] = data; 3263 } // eslint-disable-next-line import/no-unused-modules 3264 3265 3266 const offset$1 = { 3267 name: 'offset', 3268 enabled: true, 3269 phase: 'main', 3270 requires: ['popperOffsets'], 3271 fn: offset 3272 }; 3273 3274 function popperOffsets(_ref) { 3275 var state = _ref.state, 3276 name = _ref.name; 3277 // Offsets are the actual position the popper needs to have to be 3278 // properly positioned near its reference element 3279 // This is the most basic placement, and will be adjusted by 3280 // the modifiers in the next step 3281 state.modifiersData[name] = computeOffsets({ 3282 reference: state.rects.reference, 3283 element: state.rects.popper, 3284 strategy: 'absolute', 3285 placement: state.placement 3286 }); 3287 } // eslint-disable-next-line import/no-unused-modules 3288 3289 3290 const popperOffsets$1 = { 3291 name: 'popperOffsets', 3292 enabled: true, 3293 phase: 'read', 3294 fn: popperOffsets, 3295 data: {} 3296 }; 3297 3298 function getAltAxis(axis) { 3299 return axis === 'x' ? 'y' : 'x'; 3300 } 3301 3302 function preventOverflow(_ref) { 3303 var state = _ref.state, 3304 options = _ref.options, 3305 name = _ref.name; 3306 var _options$mainAxis = options.mainAxis, 3307 checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, 3308 _options$altAxis = options.altAxis, 3309 checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, 3310 boundary = options.boundary, 3311 rootBoundary = options.rootBoundary, 3312 altBoundary = options.altBoundary, 3313 padding = options.padding, 3314 _options$tether = options.tether, 3315 tether = _options$tether === void 0 ? true : _options$tether, 3316 _options$tetherOffset = options.tetherOffset, 3317 tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset; 3318 var overflow = detectOverflow(state, { 3319 boundary: boundary, 3320 rootBoundary: rootBoundary, 3321 padding: padding, 3322 altBoundary: altBoundary 3323 }); 3324 var basePlacement = getBasePlacement(state.placement); 3325 var variation = getVariation(state.placement); 3326 var isBasePlacement = !variation; 3327 var mainAxis = getMainAxisFromPlacement(basePlacement); 3328 var altAxis = getAltAxis(mainAxis); 3329 var popperOffsets = state.modifiersData.popperOffsets; 3330 var referenceRect = state.rects.reference; 3331 var popperRect = state.rects.popper; 3332 var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, { 3333 placement: state.placement 3334 })) : tetherOffset; 3335 var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? { 3336 mainAxis: tetherOffsetValue, 3337 altAxis: tetherOffsetValue 3338 } : Object.assign({ 3339 mainAxis: 0, 3340 altAxis: 0 3341 }, tetherOffsetValue); 3342 var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null; 3343 var data = { 3344 x: 0, 3345 y: 0 3346 }; 3347 3348 if (!popperOffsets) { 3349 return; 3350 } 3351 3352 if (checkMainAxis) { 3353 var _offsetModifierState$; 3354 3355 var mainSide = mainAxis === 'y' ? top : left; 3356 var altSide = mainAxis === 'y' ? bottom : right; 3357 var len = mainAxis === 'y' ? 'height' : 'width'; 3358 var offset = popperOffsets[mainAxis]; 3359 var min$1 = offset + overflow[mainSide]; 3360 var max$1 = offset - overflow[altSide]; 3361 var additive = tether ? -popperRect[len] / 2 : 0; 3362 var minLen = variation === start ? referenceRect[len] : popperRect[len]; 3363 var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go 3364 // outside the reference bounds 3365 3366 var arrowElement = state.elements.arrow; 3367 var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { 3368 width: 0, 3369 height: 0 3370 }; 3371 var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject(); 3372 var arrowPaddingMin = arrowPaddingObject[mainSide]; 3373 var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want 3374 // to include its full size in the calculation. If the reference is small 3375 // and near the edge of a boundary, the popper can overflow even if the 3376 // reference is not overflowing as well (e.g. virtual elements with no 3377 // width or height) 3378 3379 var arrowLen = within(0, referenceRect[len], arrowRect[len]); 3380 var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis; 3381 var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis; 3382 var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow); 3383 var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; 3384 var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0; 3385 var tetherMin = offset + minOffset - offsetModifierValue - clientOffset; 3386 var tetherMax = offset + maxOffset - offsetModifierValue; 3387 var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1); 3388 popperOffsets[mainAxis] = preventedOffset; 3389 data[mainAxis] = preventedOffset - offset; 3390 } 3391 3392 if (checkAltAxis) { 3393 var _offsetModifierState$2; 3394 3395 var _mainSide = mainAxis === 'x' ? top : left; 3396 3397 var _altSide = mainAxis === 'x' ? bottom : right; 3398 3399 var _offset = popperOffsets[altAxis]; 3400 3401 var _len = altAxis === 'y' ? 'height' : 'width'; 3402 3403 var _min = _offset + overflow[_mainSide]; 3404 3405 var _max = _offset - overflow[_altSide]; 3406 3407 var isOriginSide = [top, left].indexOf(basePlacement) !== -1; 3408 3409 var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0; 3410 3411 var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis; 3412 3413 var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max; 3414 3415 var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max); 3416 3417 popperOffsets[altAxis] = _preventedOffset; 3418 data[altAxis] = _preventedOffset - _offset; 3419 } 3420 3421 state.modifiersData[name] = data; 3422 } // eslint-disable-next-line import/no-unused-modules 3423 3424 3425 const preventOverflow$1 = { 3426 name: 'preventOverflow', 3427 enabled: true, 3428 phase: 'main', 3429 fn: preventOverflow, 3430 requiresIfExists: ['offset'] 3431 }; 3432 3433 function getHTMLElementScroll(element) { 3434 return { 3435 scrollLeft: element.scrollLeft, 3436 scrollTop: element.scrollTop 3437 }; 3438 } 3439 3440 function getNodeScroll(node) { 3441 if (node === getWindow(node) || !isHTMLElement(node)) { 3442 return getWindowScroll(node); 3443 } else { 3444 return getHTMLElementScroll(node); 3445 } 3446 } 3447 3448 function isElementScaled(element) { 3449 var rect = element.getBoundingClientRect(); 3450 var scaleX = round(rect.width) / element.offsetWidth || 1; 3451 var scaleY = round(rect.height) / element.offsetHeight || 1; 3452 return scaleX !== 1 || scaleY !== 1; 3453 } // Returns the composite rect of an element relative to its offsetParent. 3454 // Composite means it takes into account transforms as well as layout. 3455 3456 3457 function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) { 3458 if (isFixed === void 0) { 3459 isFixed = false; 3460 } 3461 3462 var isOffsetParentAnElement = isHTMLElement(offsetParent); 3463 var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent); 3464 var documentElement = getDocumentElement(offsetParent); 3465 var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed); 3466 var scroll = { 3467 scrollLeft: 0, 3468 scrollTop: 0 3469 }; 3470 var offsets = { 3471 x: 0, 3472 y: 0 3473 }; 3474 3475 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 3476 if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078 3477 isScrollParent(documentElement)) { 3478 scroll = getNodeScroll(offsetParent); 3479 } 3480 3481 if (isHTMLElement(offsetParent)) { 3482 offsets = getBoundingClientRect(offsetParent, true); 3483 offsets.x += offsetParent.clientLeft; 3484 offsets.y += offsetParent.clientTop; 3485 } else if (documentElement) { 3486 offsets.x = getWindowScrollBarX(documentElement); 3487 } 3488 } 3489 3490 return { 3491 x: rect.left + scroll.scrollLeft - offsets.x, 3492 y: rect.top + scroll.scrollTop - offsets.y, 3493 width: rect.width, 3494 height: rect.height 3495 }; 3496 } 3497 3498 function order(modifiers) { 3499 var map = new Map(); 3500 var visited = new Set(); 3501 var result = []; 3502 modifiers.forEach(function (modifier) { 3503 map.set(modifier.name, modifier); 3504 }); // On visiting object, check for its dependencies and visit them recursively 3505 3506 function sort(modifier) { 3507 visited.add(modifier.name); 3508 var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []); 3509 requires.forEach(function (dep) { 3510 if (!visited.has(dep)) { 3511 var depModifier = map.get(dep); 3512 3513 if (depModifier) { 3514 sort(depModifier); 3515 } 3516 } 3517 }); 3518 result.push(modifier); 3519 } 3520 3521 modifiers.forEach(function (modifier) { 3522 if (!visited.has(modifier.name)) { 3523 // check for visited object 3524 sort(modifier); 3525 } 3526 }); 3527 return result; 3528 } 3529 3530 function orderModifiers(modifiers) { 3531 // order based on dependencies 3532 var orderedModifiers = order(modifiers); // order based on phase 3533 3534 return modifierPhases.reduce(function (acc, phase) { 3535 return acc.concat(orderedModifiers.filter(function (modifier) { 3536 return modifier.phase === phase; 3537 })); 3538 }, []); 3539 } 3540 3541 function debounce(fn) { 3542 var pending; 3543 return function () { 3544 if (!pending) { 3545 pending = new Promise(function (resolve) { 3546 Promise.resolve().then(function () { 3547 pending = undefined; 3548 resolve(fn()); 3549 }); 3550 }); 3551 } 3552 3553 return pending; 3554 }; 3555 } 3556 3557 function mergeByName(modifiers) { 3558 var merged = modifiers.reduce(function (merged, current) { 3559 var existing = merged[current.name]; 3560 merged[current.name] = existing ? Object.assign({}, existing, current, { 3561 options: Object.assign({}, existing.options, current.options), 3562 data: Object.assign({}, existing.data, current.data) 3563 }) : current; 3564 return merged; 3565 }, {}); // IE11 does not support Object.values 3566 3567 return Object.keys(merged).map(function (key) { 3568 return merged[key]; 3569 }); 3570 } 3571 3572 var DEFAULT_OPTIONS = { 3573 placement: 'bottom', 3574 modifiers: [], 3575 strategy: 'absolute' 3576 }; 3577 3578 function areValidElements() { 3579 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 3580 args[_key] = arguments[_key]; 3581 } 3582 3583 return !args.some(function (element) { 3584 return !(element && typeof element.getBoundingClientRect === 'function'); 3585 }); 3586 } 3587 3588 function popperGenerator(generatorOptions) { 3589 if (generatorOptions === void 0) { 3590 generatorOptions = {}; 3591 } 3592 3593 var _generatorOptions = generatorOptions, 3594 _generatorOptions$def = _generatorOptions.defaultModifiers, 3595 defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, 3596 _generatorOptions$def2 = _generatorOptions.defaultOptions, 3597 defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2; 3598 return function createPopper(reference, popper, options) { 3599 if (options === void 0) { 3600 options = defaultOptions; 3601 } 3602 3603 var state = { 3604 placement: 'bottom', 3605 orderedModifiers: [], 3606 options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions), 3607 modifiersData: {}, 3608 elements: { 3609 reference: reference, 3610 popper: popper 3611 }, 3612 attributes: {}, 3613 styles: {} 3614 }; 3615 var effectCleanupFns = []; 3616 var isDestroyed = false; 3617 var instance = { 3618 state: state, 3619 setOptions: function setOptions(setOptionsAction) { 3620 var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction; 3621 cleanupModifierEffects(); 3622 state.options = Object.assign({}, defaultOptions, state.options, options); 3623 state.scrollParents = { 3624 reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [], 3625 popper: listScrollParents(popper) 3626 }; // Orders the modifiers based on their dependencies and `phase` 3627 // properties 3628 3629 var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers 3630 3631 state.orderedModifiers = orderedModifiers.filter(function (m) { 3632 return m.enabled; 3633 }); // Validate the provided modifiers so that the consumer will get warned 3634 3635 runModifierEffects(); 3636 return instance.update(); 3637 }, 3638 // Sync update – it will always be executed, even if not necessary. This 3639 // is useful for low frequency updates where sync behavior simplifies the 3640 // logic. 3641 // For high frequency updates (e.g. `resize` and `scroll` events), always 3642 // prefer the async Popper#update method 3643 forceUpdate: function forceUpdate() { 3644 if (isDestroyed) { 3645 return; 3646 } 3647 3648 var _state$elements = state.elements, 3649 reference = _state$elements.reference, 3650 popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements 3651 // anymore 3652 3653 if (!areValidElements(reference, popper)) { 3654 3655 return; 3656 } // Store the reference and popper rects to be read by modifiers 3657 3658 3659 state.rects = { 3660 reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'), 3661 popper: getLayoutRect(popper) 3662 }; // Modifiers have the ability to reset the current update cycle. The 3663 // most common use case for this is the `flip` modifier changing the 3664 // placement, which then needs to re-run all the modifiers, because the 3665 // logic was previously ran for the previous placement and is therefore 3666 // stale/incorrect 3667 3668 state.reset = false; 3669 state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier 3670 // is filled with the initial data specified by the modifier. This means 3671 // it doesn't persist and is fresh on each update. 3672 // To ensure persistent data, use `${name}#persistent` 3673 3674 state.orderedModifiers.forEach(function (modifier) { 3675 return state.modifiersData[modifier.name] = Object.assign({}, modifier.data); 3676 }); 3677 3678 for (var index = 0; index < state.orderedModifiers.length; index++) { 3679 3680 if (state.reset === true) { 3681 state.reset = false; 3682 index = -1; 3683 continue; 3684 } 3685 3686 var _state$orderedModifie = state.orderedModifiers[index], 3687 fn = _state$orderedModifie.fn, 3688 _state$orderedModifie2 = _state$orderedModifie.options, 3689 _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, 3690 name = _state$orderedModifie.name; 3691 3692 if (typeof fn === 'function') { 3693 state = fn({ 3694 state: state, 3695 options: _options, 3696 name: name, 3697 instance: instance 3698 }) || state; 3699 } 3700 } 3701 }, 3702 // Async and optimistically optimized update – it will not be executed if 3703 // not necessary (debounced to run at most once-per-tick) 3704 update: debounce(function () { 3705 return new Promise(function (resolve) { 3706 instance.forceUpdate(); 3707 resolve(state); 3708 }); 3709 }), 3710 destroy: function destroy() { 3711 cleanupModifierEffects(); 3712 isDestroyed = true; 3713 } 3714 }; 3715 3716 if (!areValidElements(reference, popper)) { 3717 3718 return instance; 3719 } 3720 3721 instance.setOptions(options).then(function (state) { 3722 if (!isDestroyed && options.onFirstUpdate) { 3723 options.onFirstUpdate(state); 3724 } 3725 }); // Modifiers have the ability to execute arbitrary code before the first 3726 // update cycle runs. They will be executed in the same order as the update 3727 // cycle. This is useful when a modifier adds some persistent data that 3728 // other modifiers need to use, but the modifier is run after the dependent 3729 // one. 3730 3731 function runModifierEffects() { 3732 state.orderedModifiers.forEach(function (_ref3) { 3733 var name = _ref3.name, 3734 _ref3$options = _ref3.options, 3735 options = _ref3$options === void 0 ? {} : _ref3$options, 3736 effect = _ref3.effect; 3737 3738 if (typeof effect === 'function') { 3739 var cleanupFn = effect({ 3740 state: state, 3741 name: name, 3742 instance: instance, 3743 options: options 3744 }); 3745 3746 var noopFn = function noopFn() {}; 3747 3748 effectCleanupFns.push(cleanupFn || noopFn); 3749 } 3750 }); 3751 } 3752 3753 function cleanupModifierEffects() { 3754 effectCleanupFns.forEach(function (fn) { 3755 return fn(); 3756 }); 3757 effectCleanupFns = []; 3758 } 3759 3760 return instance; 3761 }; 3762 } 3763 var createPopper$2 = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules 3764 3765 var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1]; 3766 var createPopper$1 = /*#__PURE__*/popperGenerator({ 3767 defaultModifiers: defaultModifiers$1 3768 }); // eslint-disable-next-line import/no-unused-modules 3769 3770 var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1]; 3771 var createPopper = /*#__PURE__*/popperGenerator({ 3772 defaultModifiers: defaultModifiers 3773 }); // eslint-disable-next-line import/no-unused-modules 3774 3775 const Popper = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 3776 __proto__: null, 3777 popperGenerator, 3778 detectOverflow, 3779 createPopperBase: createPopper$2, 3780 createPopper, 3781 createPopperLite: createPopper$1, 3782 top, 3783 bottom, 3784 right, 3785 left, 3786 auto, 3787 basePlacements, 3788 start, 3789 end, 3790 clippingParents, 3791 viewport, 3792 popper, 3793 reference, 3794 variationPlacements, 3795 placements, 3796 beforeRead, 3797 read, 3798 afterRead, 3799 beforeMain, 3800 main, 3801 afterMain, 3802 beforeWrite, 3803 write, 3804 afterWrite, 3805 modifierPhases, 3806 applyStyles: applyStyles$1, 3807 arrow: arrow$1, 3808 computeStyles: computeStyles$1, 3809 eventListeners, 3810 flip: flip$1, 3811 hide: hide$1, 3812 offset: offset$1, 3813 popperOffsets: popperOffsets$1, 3814 preventOverflow: preventOverflow$1 3815 }, Symbol.toStringTag, { value: 'Module' })); 3816 3817 /** 3818 * -------------------------------------------------------------------------- 3819 * Bootstrap (v5.2.1): dropdown.js 3820 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3821 * -------------------------------------------------------------------------- 3822 */ 3823 /** 3824 * Constants 3825 */ 3826 3827 const NAME$a = 'dropdown'; 3828 const DATA_KEY$6 = 'bs.dropdown'; 3829 const EVENT_KEY$6 = `.${DATA_KEY$6}`; 3830 const DATA_API_KEY$3 = '.data-api'; 3831 const ESCAPE_KEY$2 = 'Escape'; 3832 const TAB_KEY$1 = 'Tab'; 3833 const ARROW_UP_KEY$1 = 'ArrowUp'; 3834 const ARROW_DOWN_KEY$1 = 'ArrowDown'; 3835 const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button 3836 3837 const EVENT_HIDE$5 = `hide${EVENT_KEY$6}`; 3838 const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`; 3839 const EVENT_SHOW$5 = `show${EVENT_KEY$6}`; 3840 const EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`; 3841 const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; 3842 const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`; 3843 const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`; 3844 const CLASS_NAME_SHOW$6 = 'show'; 3845 const CLASS_NAME_DROPUP = 'dropup'; 3846 const CLASS_NAME_DROPEND = 'dropend'; 3847 const CLASS_NAME_DROPSTART = 'dropstart'; 3848 const CLASS_NAME_DROPUP_CENTER = 'dropup-center'; 3849 const CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center'; 3850 const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)'; 3851 const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`; 3852 const SELECTOR_MENU = '.dropdown-menu'; 3853 const SELECTOR_NAVBAR = '.navbar'; 3854 const SELECTOR_NAVBAR_NAV = '.navbar-nav'; 3855 const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; 3856 const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'; 3857 const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'; 3858 const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'; 3859 const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; 3860 const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; 3861 const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; 3862 const PLACEMENT_TOPCENTER = 'top'; 3863 const PLACEMENT_BOTTOMCENTER = 'bottom'; 3864 const Default$9 = { 3865 autoClose: true, 3866 boundary: 'clippingParents', 3867 display: 'dynamic', 3868 offset: [0, 2], 3869 popperConfig: null, 3870 reference: 'toggle' 3871 }; 3872 const DefaultType$9 = { 3873 autoClose: '(boolean|string)', 3874 boundary: '(string|element)', 3875 display: 'string', 3876 offset: '(array|string|function)', 3877 popperConfig: '(null|object|function)', 3878 reference: '(string|element|object)' 3879 }; 3880 /** 3881 * Class definition 3882 */ 3883 3884 class Dropdown extends BaseComponent { 3885 constructor(element, config) { 3886 super(element, config); 3887 this._popper = null; 3888 this._parent = this._element.parentNode; // dropdown wrapper 3889 // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/ 3890 3891 this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0]; 3892 this._inNavbar = this._detectNavbar(); 3893 } // Getters 3894 3895 3896 static get Default() { 3897 return Default$9; 3898 } 3899 3900 static get DefaultType() { 3901 return DefaultType$9; 3902 } 3903 3904 static get NAME() { 3905 return NAME$a; 3906 } // Public 3907 3908 3909 toggle() { 3910 return this._isShown() ? this.hide() : this.show(); 3911 } 3912 3913 show() { 3914 if (isDisabled(this._element) || this._isShown()) { 3915 return; 3916 } 3917 3918 const relatedTarget = { 3919 relatedTarget: this._element 3920 }; 3921 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget); 3922 3923 if (showEvent.defaultPrevented) { 3924 return; 3925 } 3926 3927 this._createPopper(); // If this is a touch-enabled device we add extra 3928 // empty mouseover listeners to the body's immediate children; 3929 // only needed because of broken event delegation on iOS 3930 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 3931 3932 3933 if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) { 3934 for (const element of [].concat(...document.body.children)) { 3935 EventHandler.on(element, 'mouseover', noop); 3936 } 3937 } 3938 3939 this._element.focus(); 3940 3941 this._element.setAttribute('aria-expanded', true); 3942 3943 this._menu.classList.add(CLASS_NAME_SHOW$6); 3944 3945 this._element.classList.add(CLASS_NAME_SHOW$6); 3946 3947 EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget); 3948 } 3949 3950 hide() { 3951 if (isDisabled(this._element) || !this._isShown()) { 3952 return; 3953 } 3954 3955 const relatedTarget = { 3956 relatedTarget: this._element 3957 }; 3958 3959 this._completeHide(relatedTarget); 3960 } 3961 3962 dispose() { 3963 if (this._popper) { 3964 this._popper.destroy(); 3965 } 3966 3967 super.dispose(); 3968 } 3969 3970 update() { 3971 this._inNavbar = this._detectNavbar(); 3972 3973 if (this._popper) { 3974 this._popper.update(); 3975 } 3976 } // Private 3977 3978 3979 _completeHide(relatedTarget) { 3980 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget); 3981 3982 if (hideEvent.defaultPrevented) { 3983 return; 3984 } // If this is a touch-enabled device we remove the extra 3985 // empty mouseover listeners we added for iOS support 3986 3987 3988 if ('ontouchstart' in document.documentElement) { 3989 for (const element of [].concat(...document.body.children)) { 3990 EventHandler.off(element, 'mouseover', noop); 3991 } 3992 } 3993 3994 if (this._popper) { 3995 this._popper.destroy(); 3996 } 3997 3998 this._menu.classList.remove(CLASS_NAME_SHOW$6); 3999 4000 this._element.classList.remove(CLASS_NAME_SHOW$6); 4001 4002 this._element.setAttribute('aria-expanded', 'false'); 4003 4004 Manipulator.removeDataAttribute(this._menu, 'popper'); 4005 EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget); 4006 } 4007 4008 _getConfig(config) { 4009 config = super._getConfig(config); 4010 4011 if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { 4012 // Popper virtual elements require a getBoundingClientRect method 4013 throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); 4014 } 4015 4016 return config; 4017 } 4018 4019 _createPopper() { 4020 if (typeof Popper === 'undefined') { 4021 throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); 4022 } 4023 4024 let referenceElement = this._element; 4025 4026 if (this._config.reference === 'parent') { 4027 referenceElement = this._parent; 4028 } else if (isElement$1(this._config.reference)) { 4029 referenceElement = getElement(this._config.reference); 4030 } else if (typeof this._config.reference === 'object') { 4031 referenceElement = this._config.reference; 4032 } 4033 4034 const popperConfig = this._getPopperConfig(); 4035 4036 this._popper = createPopper(referenceElement, this._menu, popperConfig); 4037 } 4038 4039 _isShown() { 4040 return this._menu.classList.contains(CLASS_NAME_SHOW$6); 4041 } 4042 4043 _getPlacement() { 4044 const parentDropdown = this._parent; 4045 4046 if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { 4047 return PLACEMENT_RIGHT; 4048 } 4049 4050 if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { 4051 return PLACEMENT_LEFT; 4052 } 4053 4054 if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) { 4055 return PLACEMENT_TOPCENTER; 4056 } 4057 4058 if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) { 4059 return PLACEMENT_BOTTOMCENTER; 4060 } // We need to trim the value because custom properties can also include spaces 4061 4062 4063 const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; 4064 4065 if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { 4066 return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP; 4067 } 4068 4069 return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM; 4070 } 4071 4072 _detectNavbar() { 4073 return this._element.closest(SELECTOR_NAVBAR) !== null; 4074 } 4075 4076 _getOffset() { 4077 const { 4078 offset 4079 } = this._config; 4080 4081 if (typeof offset === 'string') { 4082 return offset.split(',').map(value => Number.parseInt(value, 10)); 4083 } 4084 4085 if (typeof offset === 'function') { 4086 return popperData => offset(popperData, this._element); 4087 } 4088 4089 return offset; 4090 } 4091 4092 _getPopperConfig() { 4093 const defaultBsPopperConfig = { 4094 placement: this._getPlacement(), 4095 modifiers: [{ 4096 name: 'preventOverflow', 4097 options: { 4098 boundary: this._config.boundary 4099 } 4100 }, { 4101 name: 'offset', 4102 options: { 4103 offset: this._getOffset() 4104 } 4105 }] 4106 }; // Disable Popper if we have a static display or Dropdown is in Navbar 4107 4108 if (this._inNavbar || this._config.display === 'static') { 4109 Manipulator.setDataAttribute(this._menu, 'popper', 'static'); // todo:v6 remove 4110 4111 defaultBsPopperConfig.modifiers = [{ 4112 name: 'applyStyles', 4113 enabled: false 4114 }]; 4115 } 4116 4117 return { ...defaultBsPopperConfig, 4118 ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) 4119 }; 4120 } 4121 4122 _selectMenuItem({ 4123 key, 4124 target 4125 }) { 4126 const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element)); 4127 4128 if (!items.length) { 4129 return; 4130 } // if target isn't included in items (e.g. when expanding the dropdown) 4131 // allow cycling to get the last item in case key equals ARROW_UP_KEY 4132 4133 4134 getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus(); 4135 } // Static 4136 4137 4138 static jQueryInterface(config) { 4139 return this.each(function () { 4140 const data = Dropdown.getOrCreateInstance(this, config); 4141 4142 if (typeof config !== 'string') { 4143 return; 4144 } 4145 4146 if (typeof data[config] === 'undefined') { 4147 throw new TypeError(`No method named "${config}"`); 4148 } 4149 4150 data[config](); 4151 }); 4152 } 4153 4154 static clearMenus(event) { 4155 if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1) { 4156 return; 4157 } 4158 4159 const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN); 4160 4161 for (const toggle of openToggles) { 4162 const context = Dropdown.getInstance(toggle); 4163 4164 if (!context || context._config.autoClose === false) { 4165 continue; 4166 } 4167 4168 const composedPath = event.composedPath(); 4169 const isMenuTarget = composedPath.includes(context._menu); 4170 4171 if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) { 4172 continue; 4173 } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu 4174 4175 4176 if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) { 4177 continue; 4178 } 4179 4180 const relatedTarget = { 4181 relatedTarget: context._element 4182 }; 4183 4184 if (event.type === 'click') { 4185 relatedTarget.clickEvent = event; 4186 } 4187 4188 context._completeHide(relatedTarget); 4189 } 4190 } 4191 4192 static dataApiKeydownHandler(event) { 4193 // If not an UP | DOWN | ESCAPE key => not a dropdown command 4194 // If input/textarea && if key is other than ESCAPE => not a dropdown command 4195 const isInput = /input|textarea/i.test(event.target.tagName); 4196 const isEscapeEvent = event.key === ESCAPE_KEY$2; 4197 const isUpOrDownEvent = [ARROW_UP_KEY$1, ARROW_DOWN_KEY$1].includes(event.key); 4198 4199 if (!isUpOrDownEvent && !isEscapeEvent) { 4200 return; 4201 } 4202 4203 if (isInput && !isEscapeEvent) { 4204 return; 4205 } 4206 4207 event.preventDefault(); // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/ 4208 4209 const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE$3)[0]; 4210 const instance = Dropdown.getOrCreateInstance(getToggleButton); 4211 4212 if (isUpOrDownEvent) { 4213 event.stopPropagation(); 4214 instance.show(); 4215 4216 instance._selectMenuItem(event); 4217 4218 return; 4219 } 4220 4221 if (instance._isShown()) { 4222 // else is escape and we check if it is shown 4223 event.stopPropagation(); 4224 instance.hide(); 4225 getToggleButton.focus(); 4226 } 4227 } 4228 4229 } 4230 /** 4231 * Data API implementation 4232 */ 4233 4234 4235 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler); 4236 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); 4237 EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus); 4238 EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); 4239 EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { 4240 event.preventDefault(); 4241 Dropdown.getOrCreateInstance(this).toggle(); 4242 }); 4243 /** 4244 * jQuery 4245 */ 4246 4247 defineJQueryPlugin(Dropdown); 4248 4249 /** 4250 * -------------------------------------------------------------------------- 4251 * Bootstrap (v5.2.1): util/scrollBar.js 4252 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4253 * -------------------------------------------------------------------------- 4254 */ 4255 /** 4256 * Constants 4257 */ 4258 4259 const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 4260 const SELECTOR_STICKY_CONTENT = '.sticky-top'; 4261 const PROPERTY_PADDING = 'padding-right'; 4262 const PROPERTY_MARGIN = 'margin-right'; 4263 /** 4264 * Class definition 4265 */ 4266 4267 class ScrollBarHelper { 4268 constructor() { 4269 this._element = document.body; 4270 } // Public 4271 4272 4273 getWidth() { 4274 // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes 4275 const documentWidth = document.documentElement.clientWidth; 4276 return Math.abs(window.innerWidth - documentWidth); 4277 } 4278 4279 hide() { 4280 const width = this.getWidth(); 4281 4282 this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width 4283 4284 4285 this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth 4286 4287 4288 this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width); 4289 4290 this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width); 4291 } 4292 4293 reset() { 4294 this._resetElementAttributes(this._element, 'overflow'); 4295 4296 this._resetElementAttributes(this._element, PROPERTY_PADDING); 4297 4298 this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING); 4299 4300 this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN); 4301 } 4302 4303 isOverflowing() { 4304 return this.getWidth() > 0; 4305 } // Private 4306 4307 4308 _disableOverFlow() { 4309 this._saveInitialAttribute(this._element, 'overflow'); 4310 4311 this._element.style.overflow = 'hidden'; 4312 } 4313 4314 _setElementAttributes(selector, styleProperty, callback) { 4315 const scrollbarWidth = this.getWidth(); 4316 4317 const manipulationCallBack = element => { 4318 if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) { 4319 return; 4320 } 4321 4322 this._saveInitialAttribute(element, styleProperty); 4323 4324 const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty); 4325 element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`); 4326 }; 4327 4328 this._applyManipulationCallback(selector, manipulationCallBack); 4329 } 4330 4331 _saveInitialAttribute(element, styleProperty) { 4332 const actualValue = element.style.getPropertyValue(styleProperty); 4333 4334 if (actualValue) { 4335 Manipulator.setDataAttribute(element, styleProperty, actualValue); 4336 } 4337 } 4338 4339 _resetElementAttributes(selector, styleProperty) { 4340 const manipulationCallBack = element => { 4341 const value = Manipulator.getDataAttribute(element, styleProperty); // We only want to remove the property if the value is `null`; the value can also be zero 4342 4343 if (value === null) { 4344 element.style.removeProperty(styleProperty); 4345 return; 4346 } 4347 4348 Manipulator.removeDataAttribute(element, styleProperty); 4349 element.style.setProperty(styleProperty, value); 4350 }; 4351 4352 this._applyManipulationCallback(selector, manipulationCallBack); 4353 } 4354 4355 _applyManipulationCallback(selector, callBack) { 4356 if (isElement$1(selector)) { 4357 callBack(selector); 4358 return; 4359 } 4360 4361 for (const sel of SelectorEngine.find(selector, this._element)) { 4362 callBack(sel); 4363 } 4364 } 4365 4366 } 4367 4368 /** 4369 * -------------------------------------------------------------------------- 4370 * Bootstrap (v5.2.1): util/backdrop.js 4371 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4372 * -------------------------------------------------------------------------- 4373 */ 4374 /** 4375 * Constants 4376 */ 4377 4378 const NAME$9 = 'backdrop'; 4379 const CLASS_NAME_FADE$4 = 'fade'; 4380 const CLASS_NAME_SHOW$5 = 'show'; 4381 const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`; 4382 const Default$8 = { 4383 className: 'modal-backdrop', 4384 clickCallback: null, 4385 isAnimated: false, 4386 isVisible: true, 4387 // if false, we use the backdrop helper without adding any element to the dom 4388 rootElement: 'body' // give the choice to place backdrop under different elements 4389 4390 }; 4391 const DefaultType$8 = { 4392 className: 'string', 4393 clickCallback: '(function|null)', 4394 isAnimated: 'boolean', 4395 isVisible: 'boolean', 4396 rootElement: '(element|string)' 4397 }; 4398 /** 4399 * Class definition 4400 */ 4401 4402 class Backdrop extends Config { 4403 constructor(config) { 4404 super(); 4405 this._config = this._getConfig(config); 4406 this._isAppended = false; 4407 this._element = null; 4408 } // Getters 4409 4410 4411 static get Default() { 4412 return Default$8; 4413 } 4414 4415 static get DefaultType() { 4416 return DefaultType$8; 4417 } 4418 4419 static get NAME() { 4420 return NAME$9; 4421 } // Public 4422 4423 4424 show(callback) { 4425 if (!this._config.isVisible) { 4426 execute(callback); 4427 return; 4428 } 4429 4430 this._append(); 4431 4432 const element = this._getElement(); 4433 4434 if (this._config.isAnimated) { 4435 reflow(element); 4436 } 4437 4438 element.classList.add(CLASS_NAME_SHOW$5); 4439 4440 this._emulateAnimation(() => { 4441 execute(callback); 4442 }); 4443 } 4444 4445 hide(callback) { 4446 if (!this._config.isVisible) { 4447 execute(callback); 4448 return; 4449 } 4450 4451 this._getElement().classList.remove(CLASS_NAME_SHOW$5); 4452 4453 this._emulateAnimation(() => { 4454 this.dispose(); 4455 execute(callback); 4456 }); 4457 } 4458 4459 dispose() { 4460 if (!this._isAppended) { 4461 return; 4462 } 4463 4464 EventHandler.off(this._element, EVENT_MOUSEDOWN); 4465 4466 this._element.remove(); 4467 4468 this._isAppended = false; 4469 } // Private 4470 4471 4472 _getElement() { 4473 if (!this._element) { 4474 const backdrop = document.createElement('div'); 4475 backdrop.className = this._config.className; 4476 4477 if (this._config.isAnimated) { 4478 backdrop.classList.add(CLASS_NAME_FADE$4); 4479 } 4480 4481 this._element = backdrop; 4482 } 4483 4484 return this._element; 4485 } 4486 4487 _configAfterMerge(config) { 4488 // use getElement() with the default "body" to get a fresh Element on each instantiation 4489 config.rootElement = getElement(config.rootElement); 4490 return config; 4491 } 4492 4493 _append() { 4494 if (this._isAppended) { 4495 return; 4496 } 4497 4498 const element = this._getElement(); 4499 4500 this._config.rootElement.append(element); 4501 4502 EventHandler.on(element, EVENT_MOUSEDOWN, () => { 4503 execute(this._config.clickCallback); 4504 }); 4505 this._isAppended = true; 4506 } 4507 4508 _emulateAnimation(callback) { 4509 executeAfterTransition(callback, this._getElement(), this._config.isAnimated); 4510 } 4511 4512 } 4513 4514 /** 4515 * -------------------------------------------------------------------------- 4516 * Bootstrap (v5.2.1): util/focustrap.js 4517 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4518 * -------------------------------------------------------------------------- 4519 */ 4520 /** 4521 * Constants 4522 */ 4523 4524 const NAME$8 = 'focustrap'; 4525 const DATA_KEY$5 = 'bs.focustrap'; 4526 const EVENT_KEY$5 = `.${DATA_KEY$5}`; 4527 const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`; 4528 const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`; 4529 const TAB_KEY = 'Tab'; 4530 const TAB_NAV_FORWARD = 'forward'; 4531 const TAB_NAV_BACKWARD = 'backward'; 4532 const Default$7 = { 4533 autofocus: true, 4534 trapElement: null // The element to trap focus inside of 4535 4536 }; 4537 const DefaultType$7 = { 4538 autofocus: 'boolean', 4539 trapElement: 'element' 4540 }; 4541 /** 4542 * Class definition 4543 */ 4544 4545 class FocusTrap extends Config { 4546 constructor(config) { 4547 super(); 4548 this._config = this._getConfig(config); 4549 this._isActive = false; 4550 this._lastTabNavDirection = null; 4551 } // Getters 4552 4553 4554 static get Default() { 4555 return Default$7; 4556 } 4557 4558 static get DefaultType() { 4559 return DefaultType$7; 4560 } 4561 4562 static get NAME() { 4563 return NAME$8; 4564 } // Public 4565 4566 4567 activate() { 4568 if (this._isActive) { 4569 return; 4570 } 4571 4572 if (this._config.autofocus) { 4573 this._config.trapElement.focus(); 4574 } 4575 4576 EventHandler.off(document, EVENT_KEY$5); // guard against infinite focus loop 4577 4578 EventHandler.on(document, EVENT_FOCUSIN$2, event => this._handleFocusin(event)); 4579 EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event)); 4580 this._isActive = true; 4581 } 4582 4583 deactivate() { 4584 if (!this._isActive) { 4585 return; 4586 } 4587 4588 this._isActive = false; 4589 EventHandler.off(document, EVENT_KEY$5); 4590 } // Private 4591 4592 4593 _handleFocusin(event) { 4594 const { 4595 trapElement 4596 } = this._config; 4597 4598 if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) { 4599 return; 4600 } 4601 4602 const elements = SelectorEngine.focusableChildren(trapElement); 4603 4604 if (elements.length === 0) { 4605 trapElement.focus(); 4606 } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) { 4607 elements[elements.length - 1].focus(); 4608 } else { 4609 elements[0].focus(); 4610 } 4611 } 4612 4613 _handleKeydown(event) { 4614 if (event.key !== TAB_KEY) { 4615 return; 4616 } 4617 4618 this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD; 4619 } 4620 4621 } 4622 4623 /** 4624 * -------------------------------------------------------------------------- 4625 * Bootstrap (v5.2.1): modal.js 4626 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4627 * -------------------------------------------------------------------------- 4628 */ 4629 /** 4630 * Constants 4631 */ 4632 4633 const NAME$7 = 'modal'; 4634 const DATA_KEY$4 = 'bs.modal'; 4635 const EVENT_KEY$4 = `.${DATA_KEY$4}`; 4636 const DATA_API_KEY$2 = '.data-api'; 4637 const ESCAPE_KEY$1 = 'Escape'; 4638 const EVENT_HIDE$4 = `hide${EVENT_KEY$4}`; 4639 const EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`; 4640 const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`; 4641 const EVENT_SHOW$4 = `show${EVENT_KEY$4}`; 4642 const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`; 4643 const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`; 4644 const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`; 4645 const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`; 4646 const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`; 4647 const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`; 4648 const CLASS_NAME_OPEN = 'modal-open'; 4649 const CLASS_NAME_FADE$3 = 'fade'; 4650 const CLASS_NAME_SHOW$4 = 'show'; 4651 const CLASS_NAME_STATIC = 'modal-static'; 4652 const OPEN_SELECTOR$1 = '.modal.show'; 4653 const SELECTOR_DIALOG = '.modal-dialog'; 4654 const SELECTOR_MODAL_BODY = '.modal-body'; 4655 const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; 4656 const Default$6 = { 4657 backdrop: true, 4658 focus: true, 4659 keyboard: true 4660 }; 4661 const DefaultType$6 = { 4662 backdrop: '(boolean|string)', 4663 focus: 'boolean', 4664 keyboard: 'boolean' 4665 }; 4666 /** 4667 * Class definition 4668 */ 4669 4670 class Modal extends BaseComponent { 4671 constructor(element, config) { 4672 super(element, config); 4673 this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); 4674 this._backdrop = this._initializeBackDrop(); 4675 this._focustrap = this._initializeFocusTrap(); 4676 this._isShown = false; 4677 this._isTransitioning = false; 4678 this._scrollBar = new ScrollBarHelper(); 4679 4680 this._addEventListeners(); 4681 } // Getters 4682 4683 4684 static get Default() { 4685 return Default$6; 4686 } 4687 4688 static get DefaultType() { 4689 return DefaultType$6; 4690 } 4691 4692 static get NAME() { 4693 return NAME$7; 4694 } // Public 4695 4696 4697 toggle(relatedTarget) { 4698 return this._isShown ? this.hide() : this.show(relatedTarget); 4699 } 4700 4701 show(relatedTarget) { 4702 if (this._isShown || this._isTransitioning) { 4703 return; 4704 } 4705 4706 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, { 4707 relatedTarget 4708 }); 4709 4710 if (showEvent.defaultPrevented) { 4711 return; 4712 } 4713 4714 this._isShown = true; 4715 this._isTransitioning = true; 4716 4717 this._scrollBar.hide(); 4718 4719 document.body.classList.add(CLASS_NAME_OPEN); 4720 4721 this._adjustDialog(); 4722 4723 this._backdrop.show(() => this._showElement(relatedTarget)); 4724 } 4725 4726 hide() { 4727 if (!this._isShown || this._isTransitioning) { 4728 return; 4729 } 4730 4731 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4); 4732 4733 if (hideEvent.defaultPrevented) { 4734 return; 4735 } 4736 4737 this._isShown = false; 4738 this._isTransitioning = true; 4739 4740 this._focustrap.deactivate(); 4741 4742 this._element.classList.remove(CLASS_NAME_SHOW$4); 4743 4744 this._queueCallback(() => this._hideModal(), this._element, this._isAnimated()); 4745 } 4746 4747 dispose() { 4748 for (const htmlElement of [window, this._dialog]) { 4749 EventHandler.off(htmlElement, EVENT_KEY$4); 4750 } 4751 4752 this._backdrop.dispose(); 4753 4754 this._focustrap.deactivate(); 4755 4756 super.dispose(); 4757 } 4758 4759 handleUpdate() { 4760 this._adjustDialog(); 4761 } // Private 4762 4763 4764 _initializeBackDrop() { 4765 return new Backdrop({ 4766 isVisible: Boolean(this._config.backdrop), 4767 // 'static' option will be translated to true, and booleans will keep their value, 4768 isAnimated: this._isAnimated() 4769 }); 4770 } 4771 4772 _initializeFocusTrap() { 4773 return new FocusTrap({ 4774 trapElement: this._element 4775 }); 4776 } 4777 4778 _showElement(relatedTarget) { 4779 // try to append dynamic modal 4780 if (!document.body.contains(this._element)) { 4781 document.body.append(this._element); 4782 } 4783 4784 this._element.style.display = 'block'; 4785 4786 this._element.removeAttribute('aria-hidden'); 4787 4788 this._element.setAttribute('aria-modal', true); 4789 4790 this._element.setAttribute('role', 'dialog'); 4791 4792 this._element.scrollTop = 0; 4793 const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); 4794 4795 if (modalBody) { 4796 modalBody.scrollTop = 0; 4797 } 4798 4799 reflow(this._element); 4800 4801 this._element.classList.add(CLASS_NAME_SHOW$4); 4802 4803 const transitionComplete = () => { 4804 if (this._config.focus) { 4805 this._focustrap.activate(); 4806 } 4807 4808 this._isTransitioning = false; 4809 EventHandler.trigger(this._element, EVENT_SHOWN$4, { 4810 relatedTarget 4811 }); 4812 }; 4813 4814 this._queueCallback(transitionComplete, this._dialog, this._isAnimated()); 4815 } 4816 4817 _addEventListeners() { 4818 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => { 4819 if (event.key !== ESCAPE_KEY$1) { 4820 return; 4821 } 4822 4823 if (this._config.keyboard) { 4824 event.preventDefault(); 4825 this.hide(); 4826 return; 4827 } 4828 4829 this._triggerBackdropTransition(); 4830 }); 4831 EventHandler.on(window, EVENT_RESIZE$1, () => { 4832 if (this._isShown && !this._isTransitioning) { 4833 this._adjustDialog(); 4834 } 4835 }); 4836 EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => { 4837 EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => { 4838 // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks 4839 if (this._dialog.contains(event.target) || this._dialog.contains(event2.target)) { 4840 return; 4841 } 4842 4843 if (this._config.backdrop === 'static') { 4844 this._triggerBackdropTransition(); 4845 4846 return; 4847 } 4848 4849 if (this._config.backdrop) { 4850 this.hide(); 4851 } 4852 }); 4853 }); 4854 } 4855 4856 _hideModal() { 4857 this._element.style.display = 'none'; 4858 4859 this._element.setAttribute('aria-hidden', true); 4860 4861 this._element.removeAttribute('aria-modal'); 4862 4863 this._element.removeAttribute('role'); 4864 4865 this._isTransitioning = false; 4866 4867 this._backdrop.hide(() => { 4868 document.body.classList.remove(CLASS_NAME_OPEN); 4869 4870 this._resetAdjustments(); 4871 4872 this._scrollBar.reset(); 4873 4874 EventHandler.trigger(this._element, EVENT_HIDDEN$4); 4875 }); 4876 } 4877 4878 _isAnimated() { 4879 return this._element.classList.contains(CLASS_NAME_FADE$3); 4880 } 4881 4882 _triggerBackdropTransition() { 4883 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1); 4884 4885 if (hideEvent.defaultPrevented) { 4886 return; 4887 } 4888 4889 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4890 const initialOverflowY = this._element.style.overflowY; // return if the following background transition hasn't yet completed 4891 4892 if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) { 4893 return; 4894 } 4895 4896 if (!isModalOverflowing) { 4897 this._element.style.overflowY = 'hidden'; 4898 } 4899 4900 this._element.classList.add(CLASS_NAME_STATIC); 4901 4902 this._queueCallback(() => { 4903 this._element.classList.remove(CLASS_NAME_STATIC); 4904 4905 this._queueCallback(() => { 4906 this._element.style.overflowY = initialOverflowY; 4907 }, this._dialog); 4908 }, this._dialog); 4909 4910 this._element.focus(); 4911 } 4912 /** 4913 * The following methods are used to handle overflowing modals 4914 */ 4915 4916 4917 _adjustDialog() { 4918 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4919 4920 const scrollbarWidth = this._scrollBar.getWidth(); 4921 4922 const isBodyOverflowing = scrollbarWidth > 0; 4923 4924 if (isBodyOverflowing && !isModalOverflowing) { 4925 const property = isRTL() ? 'paddingLeft' : 'paddingRight'; 4926 this._element.style[property] = `${scrollbarWidth}px`; 4927 } 4928 4929 if (!isBodyOverflowing && isModalOverflowing) { 4930 const property = isRTL() ? 'paddingRight' : 'paddingLeft'; 4931 this._element.style[property] = `${scrollbarWidth}px`; 4932 } 4933 } 4934 4935 _resetAdjustments() { 4936 this._element.style.paddingLeft = ''; 4937 this._element.style.paddingRight = ''; 4938 } // Static 4939 4940 4941 static jQueryInterface(config, relatedTarget) { 4942 return this.each(function () { 4943 const data = Modal.getOrCreateInstance(this, config); 4944 4945 if (typeof config !== 'string') { 4946 return; 4947 } 4948 4949 if (typeof data[config] === 'undefined') { 4950 throw new TypeError(`No method named "${config}"`); 4951 } 4952 4953 data[config](relatedTarget); 4954 }); 4955 } 4956 4957 } 4958 /** 4959 * Data API implementation 4960 */ 4961 4962 4963 EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { 4964 const target = getElementFromSelector(this); 4965 4966 if (['A', 'AREA'].includes(this.tagName)) { 4967 event.preventDefault(); 4968 } 4969 4970 EventHandler.one(target, EVENT_SHOW$4, showEvent => { 4971 if (showEvent.defaultPrevented) { 4972 // only register focus restorer if modal will actually get shown 4973 return; 4974 } 4975 4976 EventHandler.one(target, EVENT_HIDDEN$4, () => { 4977 if (isVisible(this)) { 4978 this.focus(); 4979 } 4980 }); 4981 }); // avoid conflict when clicking modal toggler while another one is open 4982 4983 const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1); 4984 4985 if (alreadyOpen) { 4986 Modal.getInstance(alreadyOpen).hide(); 4987 } 4988 4989 const data = Modal.getOrCreateInstance(target); 4990 data.toggle(this); 4991 }); 4992 enableDismissTrigger(Modal); 4993 /** 4994 * jQuery 4995 */ 4996 4997 defineJQueryPlugin(Modal); 4998 4999 /** 5000 * -------------------------------------------------------------------------- 5001 * Bootstrap (v5.2.1): offcanvas.js 5002 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5003 * -------------------------------------------------------------------------- 5004 */ 5005 /** 5006 * Constants 5007 */ 5008 5009 const NAME$6 = 'offcanvas'; 5010 const DATA_KEY$3 = 'bs.offcanvas'; 5011 const EVENT_KEY$3 = `.${DATA_KEY$3}`; 5012 const DATA_API_KEY$1 = '.data-api'; 5013 const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`; 5014 const ESCAPE_KEY = 'Escape'; 5015 const CLASS_NAME_SHOW$3 = 'show'; 5016 const CLASS_NAME_SHOWING$1 = 'showing'; 5017 const CLASS_NAME_HIDING = 'hiding'; 5018 const CLASS_NAME_BACKDROP = 'offcanvas-backdrop'; 5019 const OPEN_SELECTOR = '.offcanvas.show'; 5020 const EVENT_SHOW$3 = `show${EVENT_KEY$3}`; 5021 const EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`; 5022 const EVENT_HIDE$3 = `hide${EVENT_KEY$3}`; 5023 const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`; 5024 const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`; 5025 const EVENT_RESIZE = `resize${EVENT_KEY$3}`; 5026 const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`; 5027 const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`; 5028 const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; 5029 const Default$5 = { 5030 backdrop: true, 5031 keyboard: true, 5032 scroll: false 5033 }; 5034 const DefaultType$5 = { 5035 backdrop: '(boolean|string)', 5036 keyboard: 'boolean', 5037 scroll: 'boolean' 5038 }; 5039 /** 5040 * Class definition 5041 */ 5042 5043 class Offcanvas extends BaseComponent { 5044 constructor(element, config) { 5045 super(element, config); 5046 this._isShown = false; 5047 this._backdrop = this._initializeBackDrop(); 5048 this._focustrap = this._initializeFocusTrap(); 5049 5050 this._addEventListeners(); 5051 } // Getters 5052 5053 5054 static get Default() { 5055 return Default$5; 5056 } 5057 5058 static get DefaultType() { 5059 return DefaultType$5; 5060 } 5061 5062 static get NAME() { 5063 return NAME$6; 5064 } // Public 5065 5066 5067 toggle(relatedTarget) { 5068 return this._isShown ? this.hide() : this.show(relatedTarget); 5069 } 5070 5071 show(relatedTarget) { 5072 if (this._isShown) { 5073 return; 5074 } 5075 5076 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, { 5077 relatedTarget 5078 }); 5079 5080 if (showEvent.defaultPrevented) { 5081 return; 5082 } 5083 5084 this._isShown = true; 5085 5086 this._backdrop.show(); 5087 5088 if (!this._config.scroll) { 5089 new ScrollBarHelper().hide(); 5090 } 5091 5092 this._element.setAttribute('aria-modal', true); 5093 5094 this._element.setAttribute('role', 'dialog'); 5095 5096 this._element.classList.add(CLASS_NAME_SHOWING$1); 5097 5098 const completeCallBack = () => { 5099 if (!this._config.scroll || this._config.backdrop) { 5100 this._focustrap.activate(); 5101 } 5102 5103 this._element.classList.add(CLASS_NAME_SHOW$3); 5104 5105 this._element.classList.remove(CLASS_NAME_SHOWING$1); 5106 5107 EventHandler.trigger(this._element, EVENT_SHOWN$3, { 5108 relatedTarget 5109 }); 5110 }; 5111 5112 this._queueCallback(completeCallBack, this._element, true); 5113 } 5114 5115 hide() { 5116 if (!this._isShown) { 5117 return; 5118 } 5119 5120 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3); 5121 5122 if (hideEvent.defaultPrevented) { 5123 return; 5124 } 5125 5126 this._focustrap.deactivate(); 5127 5128 this._element.blur(); 5129 5130 this._isShown = false; 5131 5132 this._element.classList.add(CLASS_NAME_HIDING); 5133 5134 this._backdrop.hide(); 5135 5136 const completeCallback = () => { 5137 this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING); 5138 5139 this._element.removeAttribute('aria-modal'); 5140 5141 this._element.removeAttribute('role'); 5142 5143 if (!this._config.scroll) { 5144 new ScrollBarHelper().reset(); 5145 } 5146 5147 EventHandler.trigger(this._element, EVENT_HIDDEN$3); 5148 }; 5149 5150 this._queueCallback(completeCallback, this._element, true); 5151 } 5152 5153 dispose() { 5154 this._backdrop.dispose(); 5155 5156 this._focustrap.deactivate(); 5157 5158 super.dispose(); 5159 } // Private 5160 5161 5162 _initializeBackDrop() { 5163 const clickCallback = () => { 5164 if (this._config.backdrop === 'static') { 5165 EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); 5166 return; 5167 } 5168 5169 this.hide(); 5170 }; // 'static' option will be translated to true, and booleans will keep their value 5171 5172 5173 const isVisible = Boolean(this._config.backdrop); 5174 return new Backdrop({ 5175 className: CLASS_NAME_BACKDROP, 5176 isVisible, 5177 isAnimated: true, 5178 rootElement: this._element.parentNode, 5179 clickCallback: isVisible ? clickCallback : null 5180 }); 5181 } 5182 5183 _initializeFocusTrap() { 5184 return new FocusTrap({ 5185 trapElement: this._element 5186 }); 5187 } 5188 5189 _addEventListeners() { 5190 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { 5191 if (event.key !== ESCAPE_KEY) { 5192 return; 5193 } 5194 5195 if (!this._config.keyboard) { 5196 EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); 5197 return; 5198 } 5199 5200 this.hide(); 5201 }); 5202 } // Static 5203 5204 5205 static jQueryInterface(config) { 5206 return this.each(function () { 5207 const data = Offcanvas.getOrCreateInstance(this, config); 5208 5209 if (typeof config !== 'string') { 5210 return; 5211 } 5212 5213 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 5214 throw new TypeError(`No method named "${config}"`); 5215 } 5216 5217 data[config](this); 5218 }); 5219 } 5220 5221 } 5222 /** 5223 * Data API implementation 5224 */ 5225 5226 5227 EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { 5228 const target = getElementFromSelector(this); 5229 5230 if (['A', 'AREA'].includes(this.tagName)) { 5231 event.preventDefault(); 5232 } 5233 5234 if (isDisabled(this)) { 5235 return; 5236 } 5237 5238 EventHandler.one(target, EVENT_HIDDEN$3, () => { 5239 // focus on trigger when it is closed 5240 if (isVisible(this)) { 5241 this.focus(); 5242 } 5243 }); // avoid conflict when clicking a toggler of an offcanvas, while another is open 5244 5245 const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR); 5246 5247 if (alreadyOpen && alreadyOpen !== target) { 5248 Offcanvas.getInstance(alreadyOpen).hide(); 5249 } 5250 5251 const data = Offcanvas.getOrCreateInstance(target); 5252 data.toggle(this); 5253 }); 5254 EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => { 5255 for (const selector of SelectorEngine.find(OPEN_SELECTOR)) { 5256 Offcanvas.getOrCreateInstance(selector).show(); 5257 } 5258 }); 5259 EventHandler.on(window, EVENT_RESIZE, () => { 5260 for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) { 5261 if (getComputedStyle(element).position !== 'fixed') { 5262 Offcanvas.getOrCreateInstance(element).hide(); 5263 } 5264 } 5265 }); 5266 enableDismissTrigger(Offcanvas); 5267 /** 5268 * jQuery 5269 */ 5270 5271 defineJQueryPlugin(Offcanvas); 5272 5273 /** 5274 * -------------------------------------------------------------------------- 5275 * Bootstrap (v5.2.1): util/sanitizer.js 5276 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5277 * -------------------------------------------------------------------------- 5278 */ 5279 const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); 5280 const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 5281 /** 5282 * A pattern that recognizes a commonly useful subset of URLs that are safe. 5283 * 5284 * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 5285 */ 5286 5287 const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; 5288 /** 5289 * A pattern that matches safe data URLs. Only matches image, video and audio types. 5290 * 5291 * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 5292 */ 5293 5294 const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; 5295 5296 const allowedAttribute = (attribute, allowedAttributeList) => { 5297 const attributeName = attribute.nodeName.toLowerCase(); 5298 5299 if (allowedAttributeList.includes(attributeName)) { 5300 if (uriAttributes.has(attributeName)) { 5301 return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue)); 5302 } 5303 5304 return true; 5305 } // Check if a regular expression validates the attribute. 5306 5307 5308 return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName)); 5309 }; 5310 5311 const DefaultAllowlist = { 5312 // Global attributes allowed on any supplied element below. 5313 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 5314 a: ['target', 'href', 'title', 'rel'], 5315 area: [], 5316 b: [], 5317 br: [], 5318 col: [], 5319 code: [], 5320 div: [], 5321 em: [], 5322 hr: [], 5323 h1: [], 5324 h2: [], 5325 h3: [], 5326 h4: [], 5327 h5: [], 5328 h6: [], 5329 i: [], 5330 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 5331 li: [], 5332 ol: [], 5333 p: [], 5334 pre: [], 5335 s: [], 5336 small: [], 5337 span: [], 5338 sub: [], 5339 sup: [], 5340 strong: [], 5341 u: [], 5342 ul: [] 5343 }; 5344 function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) { 5345 if (!unsafeHtml.length) { 5346 return unsafeHtml; 5347 } 5348 5349 if (sanitizeFunction && typeof sanitizeFunction === 'function') { 5350 return sanitizeFunction(unsafeHtml); 5351 } 5352 5353 const domParser = new window.DOMParser(); 5354 const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 5355 const elements = [].concat(...createdDocument.body.querySelectorAll('*')); 5356 5357 for (const element of elements) { 5358 const elementName = element.nodeName.toLowerCase(); 5359 5360 if (!Object.keys(allowList).includes(elementName)) { 5361 element.remove(); 5362 continue; 5363 } 5364 5365 const attributeList = [].concat(...element.attributes); 5366 const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []); 5367 5368 for (const attribute of attributeList) { 5369 if (!allowedAttribute(attribute, allowedAttributes)) { 5370 element.removeAttribute(attribute.nodeName); 5371 } 5372 } 5373 } 5374 5375 return createdDocument.body.innerHTML; 5376 } 5377 5378 /** 5379 * -------------------------------------------------------------------------- 5380 * Bootstrap (v5.2.1): util/template-factory.js 5381 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5382 * -------------------------------------------------------------------------- 5383 */ 5384 /** 5385 * Constants 5386 */ 5387 5388 const NAME$5 = 'TemplateFactory'; 5389 const Default$4 = { 5390 allowList: DefaultAllowlist, 5391 content: {}, 5392 // { selector : text , selector2 : text2 , } 5393 extraClass: '', 5394 html: false, 5395 sanitize: true, 5396 sanitizeFn: null, 5397 template: '<div></div>' 5398 }; 5399 const DefaultType$4 = { 5400 allowList: 'object', 5401 content: 'object', 5402 extraClass: '(string|function)', 5403 html: 'boolean', 5404 sanitize: 'boolean', 5405 sanitizeFn: '(null|function)', 5406 template: 'string' 5407 }; 5408 const DefaultContentType = { 5409 entry: '(string|element|function|null)', 5410 selector: '(string|element)' 5411 }; 5412 /** 5413 * Class definition 5414 */ 5415 5416 class TemplateFactory extends Config { 5417 constructor(config) { 5418 super(); 5419 this._config = this._getConfig(config); 5420 } // Getters 5421 5422 5423 static get Default() { 5424 return Default$4; 5425 } 5426 5427 static get DefaultType() { 5428 return DefaultType$4; 5429 } 5430 5431 static get NAME() { 5432 return NAME$5; 5433 } // Public 5434 5435 5436 getContent() { 5437 return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean); 5438 } 5439 5440 hasContent() { 5441 return this.getContent().length > 0; 5442 } 5443 5444 changeContent(content) { 5445 this._checkContent(content); 5446 5447 this._config.content = { ...this._config.content, 5448 ...content 5449 }; 5450 return this; 5451 } 5452 5453 toHtml() { 5454 const templateWrapper = document.createElement('div'); 5455 templateWrapper.innerHTML = this._maybeSanitize(this._config.template); 5456 5457 for (const [selector, text] of Object.entries(this._config.content)) { 5458 this._setContent(templateWrapper, text, selector); 5459 } 5460 5461 const template = templateWrapper.children[0]; 5462 5463 const extraClass = this._resolvePossibleFunction(this._config.extraClass); 5464 5465 if (extraClass) { 5466 template.classList.add(...extraClass.split(' ')); 5467 } 5468 5469 return template; 5470 } // Private 5471 5472 5473 _typeCheckConfig(config) { 5474 super._typeCheckConfig(config); 5475 5476 this._checkContent(config.content); 5477 } 5478 5479 _checkContent(arg) { 5480 for (const [selector, content] of Object.entries(arg)) { 5481 super._typeCheckConfig({ 5482 selector, 5483 entry: content 5484 }, DefaultContentType); 5485 } 5486 } 5487 5488 _setContent(template, content, selector) { 5489 const templateElement = SelectorEngine.findOne(selector, template); 5490 5491 if (!templateElement) { 5492 return; 5493 } 5494 5495 content = this._resolvePossibleFunction(content); 5496 5497 if (!content) { 5498 templateElement.remove(); 5499 return; 5500 } 5501 5502 if (isElement$1(content)) { 5503 this._putElementInTemplate(getElement(content), templateElement); 5504 5505 return; 5506 } 5507 5508 if (this._config.html) { 5509 templateElement.innerHTML = this._maybeSanitize(content); 5510 return; 5511 } 5512 5513 templateElement.textContent = content; 5514 } 5515 5516 _maybeSanitize(arg) { 5517 return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg; 5518 } 5519 5520 _resolvePossibleFunction(arg) { 5521 return typeof arg === 'function' ? arg(this) : arg; 5522 } 5523 5524 _putElementInTemplate(element, templateElement) { 5525 if (this._config.html) { 5526 templateElement.innerHTML = ''; 5527 templateElement.append(element); 5528 return; 5529 } 5530 5531 templateElement.textContent = element.textContent; 5532 } 5533 5534 } 5535 5536 /** 5537 * -------------------------------------------------------------------------- 5538 * Bootstrap (v5.2.1): tooltip.js 5539 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5540 * -------------------------------------------------------------------------- 5541 */ 5542 /** 5543 * Constants 5544 */ 5545 5546 const NAME$4 = 'tooltip'; 5547 const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']); 5548 const CLASS_NAME_FADE$2 = 'fade'; 5549 const CLASS_NAME_MODAL = 'modal'; 5550 const CLASS_NAME_SHOW$2 = 'show'; 5551 const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; 5552 const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`; 5553 const EVENT_MODAL_HIDE = 'hide.bs.modal'; 5554 const TRIGGER_HOVER = 'hover'; 5555 const TRIGGER_FOCUS = 'focus'; 5556 const TRIGGER_CLICK = 'click'; 5557 const TRIGGER_MANUAL = 'manual'; 5558 const EVENT_HIDE$2 = 'hide'; 5559 const EVENT_HIDDEN$2 = 'hidden'; 5560 const EVENT_SHOW$2 = 'show'; 5561 const EVENT_SHOWN$2 = 'shown'; 5562 const EVENT_INSERTED = 'inserted'; 5563 const EVENT_CLICK$1 = 'click'; 5564 const EVENT_FOCUSIN$1 = 'focusin'; 5565 const EVENT_FOCUSOUT$1 = 'focusout'; 5566 const EVENT_MOUSEENTER = 'mouseenter'; 5567 const EVENT_MOUSELEAVE = 'mouseleave'; 5568 const AttachmentMap = { 5569 AUTO: 'auto', 5570 TOP: 'top', 5571 RIGHT: isRTL() ? 'left' : 'right', 5572 BOTTOM: 'bottom', 5573 LEFT: isRTL() ? 'right' : 'left' 5574 }; 5575 const Default$3 = { 5576 allowList: DefaultAllowlist, 5577 animation: true, 5578 boundary: 'clippingParents', 5579 container: false, 5580 customClass: '', 5581 delay: 0, 5582 fallbackPlacements: ['top', 'right', 'bottom', 'left'], 5583 html: false, 5584 offset: [0, 0], 5585 placement: 'top', 5586 popperConfig: null, 5587 sanitize: true, 5588 sanitizeFn: null, 5589 selector: false, 5590 template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>', 5591 title: '', 5592 trigger: 'hover focus' 5593 }; 5594 const DefaultType$3 = { 5595 allowList: 'object', 5596 animation: 'boolean', 5597 boundary: '(string|element)', 5598 container: '(string|element|boolean)', 5599 customClass: '(string|function)', 5600 delay: '(number|object)', 5601 fallbackPlacements: 'array', 5602 html: 'boolean', 5603 offset: '(array|string|function)', 5604 placement: '(string|function)', 5605 popperConfig: '(null|object|function)', 5606 sanitize: 'boolean', 5607 sanitizeFn: '(null|function)', 5608 selector: '(string|boolean)', 5609 template: 'string', 5610 title: '(string|element|function)', 5611 trigger: 'string' 5612 }; 5613 /** 5614 * Class definition 5615 */ 5616 5617 class Tooltip extends BaseComponent { 5618 constructor(element, config) { 5619 if (typeof Popper === 'undefined') { 5620 throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); 5621 } 5622 5623 super(element, config); // Private 5624 5625 this._isEnabled = true; 5626 this._timeout = 0; 5627 this._isHovered = null; 5628 this._activeTrigger = {}; 5629 this._popper = null; 5630 this._templateFactory = null; 5631 this._newContent = null; // Protected 5632 5633 this.tip = null; 5634 5635 this._setListeners(); 5636 } // Getters 5637 5638 5639 static get Default() { 5640 return Default$3; 5641 } 5642 5643 static get DefaultType() { 5644 return DefaultType$3; 5645 } 5646 5647 static get NAME() { 5648 return NAME$4; 5649 } // Public 5650 5651 5652 enable() { 5653 this._isEnabled = true; 5654 } 5655 5656 disable() { 5657 this._isEnabled = false; 5658 } 5659 5660 toggleEnabled() { 5661 this._isEnabled = !this._isEnabled; 5662 } 5663 5664 toggle(event) { 5665 if (!this._isEnabled) { 5666 return; 5667 } 5668 5669 if (event) { 5670 const context = this._initializeOnDelegatedTarget(event); 5671 5672 context._activeTrigger.click = !context._activeTrigger.click; 5673 5674 if (context._isWithActiveTrigger()) { 5675 context._enter(); 5676 } else { 5677 context._leave(); 5678 } 5679 5680 return; 5681 } 5682 5683 if (this._isShown()) { 5684 this._leave(); 5685 5686 return; 5687 } 5688 5689 this._enter(); 5690 } 5691 5692 dispose() { 5693 clearTimeout(this._timeout); 5694 EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 5695 5696 if (this.tip) { 5697 this.tip.remove(); 5698 } 5699 5700 if (this._config.originalTitle) { 5701 this._element.setAttribute('title', this._config.originalTitle); 5702 } 5703 5704 this._disposePopper(); 5705 5706 super.dispose(); 5707 } 5708 5709 show() { 5710 if (this._element.style.display === 'none') { 5711 throw new Error('Please use show on visible elements'); 5712 } 5713 5714 if (!(this._isWithContent() && this._isEnabled)) { 5715 return; 5716 } 5717 5718 const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2)); 5719 const shadowRoot = findShadowRoot(this._element); 5720 5721 const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element); 5722 5723 if (showEvent.defaultPrevented || !isInTheDom) { 5724 return; 5725 } // todo v6 remove this OR make it optional 5726 5727 5728 if (this.tip) { 5729 this.tip.remove(); 5730 this.tip = null; 5731 } 5732 5733 const tip = this._getTipElement(); 5734 5735 this._element.setAttribute('aria-describedby', tip.getAttribute('id')); 5736 5737 const { 5738 container 5739 } = this._config; 5740 5741 if (!this._element.ownerDocument.documentElement.contains(this.tip)) { 5742 container.append(tip); 5743 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED)); 5744 } 5745 5746 if (this._popper) { 5747 this._popper.update(); 5748 } else { 5749 this._popper = this._createPopper(tip); 5750 } 5751 5752 tip.classList.add(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we add extra 5753 // empty mouseover listeners to the body's immediate children; 5754 // only needed because of broken event delegation on iOS 5755 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 5756 5757 if ('ontouchstart' in document.documentElement) { 5758 for (const element of [].concat(...document.body.children)) { 5759 EventHandler.on(element, 'mouseover', noop); 5760 } 5761 } 5762 5763 const complete = () => { 5764 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2)); 5765 5766 if (this._isHovered === false) { 5767 this._leave(); 5768 } 5769 5770 this._isHovered = false; 5771 }; 5772 5773 this._queueCallback(complete, this.tip, this._isAnimated()); 5774 } 5775 5776 hide() { 5777 if (!this._isShown()) { 5778 return; 5779 } 5780 5781 const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2)); 5782 5783 if (hideEvent.defaultPrevented) { 5784 return; 5785 } 5786 5787 const tip = this._getTipElement(); 5788 5789 tip.classList.remove(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we remove the extra 5790 // empty mouseover listeners we added for iOS support 5791 5792 if ('ontouchstart' in document.documentElement) { 5793 for (const element of [].concat(...document.body.children)) { 5794 EventHandler.off(element, 'mouseover', noop); 5795 } 5796 } 5797 5798 this._activeTrigger[TRIGGER_CLICK] = false; 5799 this._activeTrigger[TRIGGER_FOCUS] = false; 5800 this._activeTrigger[TRIGGER_HOVER] = false; 5801 this._isHovered = null; // it is a trick to support manual triggering 5802 5803 const complete = () => { 5804 if (this._isWithActiveTrigger()) { 5805 return; 5806 } 5807 5808 if (!this._isHovered) { 5809 tip.remove(); 5810 } 5811 5812 this._element.removeAttribute('aria-describedby'); 5813 5814 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2)); 5815 5816 this._disposePopper(); 5817 }; 5818 5819 this._queueCallback(complete, this.tip, this._isAnimated()); 5820 } 5821 5822 update() { 5823 if (this._popper) { 5824 this._popper.update(); 5825 } 5826 } // Protected 5827 5828 5829 _isWithContent() { 5830 return Boolean(this._getTitle()); 5831 } 5832 5833 _getTipElement() { 5834 if (!this.tip) { 5835 this.tip = this._createTipElement(this._newContent || this._getContentForTemplate()); 5836 } 5837 5838 return this.tip; 5839 } 5840 5841 _createTipElement(content) { 5842 const tip = this._getTemplateFactory(content).toHtml(); // todo: remove this check on v6 5843 5844 5845 if (!tip) { 5846 return null; 5847 } 5848 5849 tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2); // todo: on v6 the following can be achieved with CSS only 5850 5851 tip.classList.add(`bs-${this.constructor.NAME}-auto`); 5852 const tipId = getUID(this.constructor.NAME).toString(); 5853 tip.setAttribute('id', tipId); 5854 5855 if (this._isAnimated()) { 5856 tip.classList.add(CLASS_NAME_FADE$2); 5857 } 5858 5859 return tip; 5860 } 5861 5862 setContent(content) { 5863 this._newContent = content; 5864 5865 if (this._isShown()) { 5866 this._disposePopper(); 5867 5868 this.show(); 5869 } 5870 } 5871 5872 _getTemplateFactory(content) { 5873 if (this._templateFactory) { 5874 this._templateFactory.changeContent(content); 5875 } else { 5876 this._templateFactory = new TemplateFactory({ ...this._config, 5877 // the `content` var has to be after `this._config` 5878 // to override config.content in case of popover 5879 content, 5880 extraClass: this._resolvePossibleFunction(this._config.customClass) 5881 }); 5882 } 5883 5884 return this._templateFactory; 5885 } 5886 5887 _getContentForTemplate() { 5888 return { 5889 [SELECTOR_TOOLTIP_INNER]: this._getTitle() 5890 }; 5891 } 5892 5893 _getTitle() { 5894 return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle; 5895 } // Private 5896 5897 5898 _initializeOnDelegatedTarget(event) { 5899 return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig()); 5900 } 5901 5902 _isAnimated() { 5903 return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2); 5904 } 5905 5906 _isShown() { 5907 return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2); 5908 } 5909 5910 _createPopper(tip) { 5911 const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement; 5912 const attachment = AttachmentMap[placement.toUpperCase()]; 5913 return createPopper(this._element, tip, this._getPopperConfig(attachment)); 5914 } 5915 5916 _getOffset() { 5917 const { 5918 offset 5919 } = this._config; 5920 5921 if (typeof offset === 'string') { 5922 return offset.split(',').map(value => Number.parseInt(value, 10)); 5923 } 5924 5925 if (typeof offset === 'function') { 5926 return popperData => offset(popperData, this._element); 5927 } 5928 5929 return offset; 5930 } 5931 5932 _resolvePossibleFunction(arg) { 5933 return typeof arg === 'function' ? arg.call(this._element) : arg; 5934 } 5935 5936 _getPopperConfig(attachment) { 5937 const defaultBsPopperConfig = { 5938 placement: attachment, 5939 modifiers: [{ 5940 name: 'flip', 5941 options: { 5942 fallbackPlacements: this._config.fallbackPlacements 5943 } 5944 }, { 5945 name: 'offset', 5946 options: { 5947 offset: this._getOffset() 5948 } 5949 }, { 5950 name: 'preventOverflow', 5951 options: { 5952 boundary: this._config.boundary 5953 } 5954 }, { 5955 name: 'arrow', 5956 options: { 5957 element: `.${this.constructor.NAME}-arrow` 5958 } 5959 }, { 5960 name: 'preSetPlacement', 5961 enabled: true, 5962 phase: 'beforeMain', 5963 fn: data => { 5964 // Pre-set Popper's placement attribute in order to read the arrow sizes properly. 5965 // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement 5966 this._getTipElement().setAttribute('data-popper-placement', data.state.placement); 5967 } 5968 }] 5969 }; 5970 return { ...defaultBsPopperConfig, 5971 ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) 5972 }; 5973 } 5974 5975 _setListeners() { 5976 const triggers = this._config.trigger.split(' '); 5977 5978 for (const trigger of triggers) { 5979 if (trigger === 'click') { 5980 EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => this.toggle(event)); 5981 } else if (trigger !== TRIGGER_MANUAL) { 5982 const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1); 5983 const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1); 5984 EventHandler.on(this._element, eventIn, this._config.selector, event => { 5985 const context = this._initializeOnDelegatedTarget(event); 5986 5987 context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; 5988 5989 context._enter(); 5990 }); 5991 EventHandler.on(this._element, eventOut, this._config.selector, event => { 5992 const context = this._initializeOnDelegatedTarget(event); 5993 5994 context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget); 5995 5996 context._leave(); 5997 }); 5998 } 5999 } 6000 6001 this._hideModalHandler = () => { 6002 if (this._element) { 6003 this.hide(); 6004 } 6005 }; 6006 6007 EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 6008 6009 if (this._config.selector) { 6010 this._config = { ...this._config, 6011 trigger: 'manual', 6012 selector: '' 6013 }; 6014 } else { 6015 this._fixTitle(); 6016 } 6017 } 6018 6019 _fixTitle() { 6020 const title = this._config.originalTitle; 6021 6022 if (!title) { 6023 return; 6024 } 6025 6026 if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) { 6027 this._element.setAttribute('aria-label', title); 6028 } 6029 6030 this._element.removeAttribute('title'); 6031 } 6032 6033 _enter() { 6034 if (this._isShown() || this._isHovered) { 6035 this._isHovered = true; 6036 return; 6037 } 6038 6039 this._isHovered = true; 6040 6041 this._setTimeout(() => { 6042 if (this._isHovered) { 6043 this.show(); 6044 } 6045 }, this._config.delay.show); 6046 } 6047 6048 _leave() { 6049 if (this._isWithActiveTrigger()) { 6050 return; 6051 } 6052 6053 this._isHovered = false; 6054 6055 this._setTimeout(() => { 6056 if (!this._isHovered) { 6057 this.hide(); 6058 } 6059 }, this._config.delay.hide); 6060 } 6061 6062 _setTimeout(handler, timeout) { 6063 clearTimeout(this._timeout); 6064 this._timeout = setTimeout(handler, timeout); 6065 } 6066 6067 _isWithActiveTrigger() { 6068 return Object.values(this._activeTrigger).includes(true); 6069 } 6070 6071 _getConfig(config) { 6072 const dataAttributes = Manipulator.getDataAttributes(this._element); 6073 6074 for (const dataAttribute of Object.keys(dataAttributes)) { 6075 if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) { 6076 delete dataAttributes[dataAttribute]; 6077 } 6078 } 6079 6080 config = { ...dataAttributes, 6081 ...(typeof config === 'object' && config ? config : {}) 6082 }; 6083 config = this._mergeConfigObj(config); 6084 config = this._configAfterMerge(config); 6085 6086 this._typeCheckConfig(config); 6087 6088 return config; 6089 } 6090 6091 _configAfterMerge(config) { 6092 config.container = config.container === false ? document.body : getElement(config.container); 6093 6094 if (typeof config.delay === 'number') { 6095 config.delay = { 6096 show: config.delay, 6097 hide: config.delay 6098 }; 6099 } 6100 6101 config.originalTitle = this._element.getAttribute('title') || ''; 6102 6103 if (typeof config.title === 'number') { 6104 config.title = config.title.toString(); 6105 } 6106 6107 if (typeof config.content === 'number') { 6108 config.content = config.content.toString(); 6109 } 6110 6111 return config; 6112 } 6113 6114 _getDelegateConfig() { 6115 const config = {}; 6116 6117 for (const key in this._config) { 6118 if (this.constructor.Default[key] !== this._config[key]) { 6119 config[key] = this._config[key]; 6120 } 6121 } // In the future can be replaced with: 6122 // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]]) 6123 // `Object.fromEntries(keysWithDifferentValues)` 6124 6125 6126 return config; 6127 } 6128 6129 _disposePopper() { 6130 if (this._popper) { 6131 this._popper.destroy(); 6132 6133 this._popper = null; 6134 } 6135 } // Static 6136 6137 6138 static jQueryInterface(config) { 6139 return this.each(function () { 6140 const data = Tooltip.getOrCreateInstance(this, config); 6141 6142 if (typeof config !== 'string') { 6143 return; 6144 } 6145 6146 if (typeof data[config] === 'undefined') { 6147 throw new TypeError(`No method named "${config}"`); 6148 } 6149 6150 data[config](); 6151 }); 6152 } 6153 6154 } 6155 /** 6156 * jQuery 6157 */ 6158 6159 6160 defineJQueryPlugin(Tooltip); 6161 6162 /** 6163 * -------------------------------------------------------------------------- 6164 * Bootstrap (v5.2.1): popover.js 6165 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 6166 * -------------------------------------------------------------------------- 6167 */ 6168 /** 6169 * Constants 6170 */ 6171 6172 const NAME$3 = 'popover'; 6173 const SELECTOR_TITLE = '.popover-header'; 6174 const SELECTOR_CONTENT = '.popover-body'; 6175 const Default$2 = { ...Tooltip.Default, 6176 content: '', 6177 offset: [0, 8], 6178 placement: 'right', 6179 template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>', 6180 trigger: 'click' 6181 }; 6182 const DefaultType$2 = { ...Tooltip.DefaultType, 6183 content: '(null|string|element|function)' 6184 }; 6185 /** 6186 * Class definition 6187 */ 6188 6189 class Popover extends Tooltip { 6190 // Getters 6191 static get Default() { 6192 return Default$2; 6193 } 6194 6195 static get DefaultType() { 6196 return DefaultType$2; 6197 } 6198 6199 static get NAME() { 6200 return NAME$3; 6201 } // Overrides 6202 6203 6204 _isWithContent() { 6205 return this._getTitle() || this._getContent(); 6206 } // Private 6207 6208 6209 _getContentForTemplate() { 6210 return { 6211 [SELECTOR_TITLE]: this._getTitle(), 6212 [SELECTOR_CONTENT]: this._getContent() 6213 }; 6214 } 6215 6216 _getContent() { 6217 return this._resolvePossibleFunction(this._config.content); 6218 } // Static 6219 6220 6221 static jQueryInterface(config) { 6222 return this.each(function () { 6223 const data = Popover.getOrCreateInstance(this, config); 6224 6225 if (typeof config !== 'string') { 6226 return; 6227 } 6228 6229 if (typeof data[config] === 'undefined') { 6230 throw new TypeError(`No method named "${config}"`); 6231 } 6232 6233 data[config](); 6234 }); 6235 } 6236 6237 } 6238 /** 6239 * jQuery 6240 */ 6241 6242 6243 defineJQueryPlugin(Popover); 6244 6245 /** 6246 * -------------------------------------------------------------------------- 6247 * Bootstrap (v5.2.1): scrollspy.js 6248 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 6249 * -------------------------------------------------------------------------- 6250 */ 6251 /** 6252 * Constants 6253 */ 6254 6255 const NAME$2 = 'scrollspy'; 6256 const DATA_KEY$2 = 'bs.scrollspy'; 6257 const EVENT_KEY$2 = `.${DATA_KEY$2}`; 6258 const DATA_API_KEY = '.data-api'; 6259 const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`; 6260 const EVENT_CLICK = `click${EVENT_KEY$2}`; 6261 const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`; 6262 const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; 6263 const CLASS_NAME_ACTIVE$1 = 'active'; 6264 const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'; 6265 const SELECTOR_TARGET_LINKS = '[href]'; 6266 const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; 6267 const SELECTOR_NAV_LINKS = '.nav-link'; 6268 const SELECTOR_NAV_ITEMS = '.nav-item'; 6269 const SELECTOR_LIST_ITEMS = '.list-group-item'; 6270 const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`; 6271 const SELECTOR_DROPDOWN = '.dropdown'; 6272 const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; 6273 const Default$1 = { 6274 offset: null, 6275 // TODO: v6 @deprecated, keep it for backwards compatibility reasons 6276 rootMargin: '0px 0px -25%', 6277 smoothScroll: false, 6278 target: null, 6279 threshold: [0.1, 0.5, 1] 6280 }; 6281 const DefaultType$1 = { 6282 offset: '(number|null)', 6283 // TODO v6 @deprecated, keep it for backwards compatibility reasons 6284 rootMargin: 'string', 6285 smoothScroll: 'boolean', 6286 target: 'element', 6287 threshold: 'array' 6288 }; 6289 /** 6290 * Class definition 6291 */ 6292 6293 class ScrollSpy extends BaseComponent { 6294 constructor(element, config) { 6295 super(element, config); // this._element is the observablesContainer and config.target the menu links wrapper 6296 6297 this._targetLinks = new Map(); 6298 this._observableSections = new Map(); 6299 this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element; 6300 this._activeTarget = null; 6301 this._observer = null; 6302 this._previousScrollData = { 6303 visibleEntryTop: 0, 6304 parentScrollTop: 0 6305 }; 6306 this.refresh(); // initialize 6307 } // Getters 6308 6309 6310 static get Default() { 6311 return Default$1; 6312 } 6313 6314 static get DefaultType() { 6315 return DefaultType$1; 6316 } 6317 6318 static get NAME() { 6319 return NAME$2; 6320 } // Public 6321 6322 6323 refresh() { 6324 this._initializeTargetsAndObservables(); 6325 6326 this._maybeEnableSmoothScroll(); 6327 6328 if (this._observer) { 6329 this._observer.disconnect(); 6330 } else { 6331 this._observer = this._getNewObserver(); 6332 } 6333 6334 for (const section of this._observableSections.values()) { 6335 this._observer.observe(section); 6336 } 6337 } 6338 6339 dispose() { 6340 this._observer.disconnect(); 6341 6342 super.dispose(); 6343 } // Private 6344 6345 6346 _configAfterMerge(config) { 6347 // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case 6348 config.target = getElement(config.target) || document.body; // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only 6349 6350 config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin; 6351 6352 if (typeof config.threshold === 'string') { 6353 config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value)); 6354 } 6355 6356 return config; 6357 } 6358 6359 _maybeEnableSmoothScroll() { 6360 if (!this._config.smoothScroll) { 6361 return; 6362 } // unregister any previous listeners 6363 6364 6365 EventHandler.off(this._config.target, EVENT_CLICK); 6366 EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => { 6367 const observableSection = this._observableSections.get(event.target.hash); 6368 6369 if (observableSection) { 6370 event.preventDefault(); 6371 const root = this._rootElement || window; 6372 const height = observableSection.offsetTop - this._element.offsetTop; 6373 6374 if (root.scrollTo) { 6375 root.scrollTo({ 6376 top: height, 6377 behavior: 'smooth' 6378 }); 6379 return; 6380 } // Chrome 60 doesn't support `scrollTo` 6381 6382 6383 root.scrollTop = height; 6384 } 6385 }); 6386 } 6387 6388 _getNewObserver() { 6389 const options = { 6390 root: this._rootElement, 6391 threshold: this._config.threshold, 6392 rootMargin: this._config.rootMargin 6393 }; 6394 return new IntersectionObserver(entries => this._observerCallback(entries), options); 6395 } // The logic of selection 6396 6397 6398 _observerCallback(entries) { 6399 const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`); 6400 6401 const activate = entry => { 6402 this._previousScrollData.visibleEntryTop = entry.target.offsetTop; 6403 6404 this._process(targetElement(entry)); 6405 }; 6406 6407 const parentScrollTop = (this._rootElement || document.documentElement).scrollTop; 6408 const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop; 6409 this._previousScrollData.parentScrollTop = parentScrollTop; 6410 6411 for (const entry of entries) { 6412 if (!entry.isIntersecting) { 6413 this._activeTarget = null; 6414 6415 this._clearActiveClass(targetElement(entry)); 6416 6417 continue; 6418 } 6419 6420 const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop; // if we are scrolling down, pick the bigger offsetTop 6421 6422 if (userScrollsDown && entryIsLowerThanPrevious) { 6423 activate(entry); // if parent isn't scrolled, let's keep the first visible item, breaking the iteration 6424 6425 if (!parentScrollTop) { 6426 return; 6427 } 6428 6429 continue; 6430 } // if we are scrolling up, pick the smallest offsetTop 6431 6432 6433 if (!userScrollsDown && !entryIsLowerThanPrevious) { 6434 activate(entry); 6435 } 6436 } 6437 } 6438 6439 _initializeTargetsAndObservables() { 6440 this._targetLinks = new Map(); 6441 this._observableSections = new Map(); 6442 const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target); 6443 6444 for (const anchor of targetLinks) { 6445 // ensure that the anchor has an id and is not disabled 6446 if (!anchor.hash || isDisabled(anchor)) { 6447 continue; 6448 } 6449 6450 const observableSection = SelectorEngine.findOne(anchor.hash, this._element); // ensure that the observableSection exists & is visible 6451 6452 if (isVisible(observableSection)) { 6453 this._targetLinks.set(anchor.hash, anchor); 6454 6455 this._observableSections.set(anchor.hash, observableSection); 6456 } 6457 } 6458 } 6459 6460 _process(target) { 6461 if (this._activeTarget === target) { 6462 return; 6463 } 6464 6465 this._clearActiveClass(this._config.target); 6466 6467 this._activeTarget = target; 6468 target.classList.add(CLASS_NAME_ACTIVE$1); 6469 6470 this._activateParents(target); 6471 6472 EventHandler.trigger(this._element, EVENT_ACTIVATE, { 6473 relatedTarget: target 6474 }); 6475 } 6476 6477 _activateParents(target) { 6478 // Activate dropdown parents 6479 if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { 6480 SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1); 6481 return; 6482 } 6483 6484 for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) { 6485 // Set triggered links parents as active 6486 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 6487 for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) { 6488 item.classList.add(CLASS_NAME_ACTIVE$1); 6489 } 6490 } 6491 } 6492 6493 _clearActiveClass(parent) { 6494 parent.classList.remove(CLASS_NAME_ACTIVE$1); 6495 const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent); 6496 6497 for (const node of activeNodes) { 6498 node.classList.remove(CLASS_NAME_ACTIVE$1); 6499 } 6500 } // Static 6501 6502 6503 static jQueryInterface(config) { 6504 return this.each(function () { 6505 const data = ScrollSpy.getOrCreateInstance(this, config); 6506 6507 if (typeof config !== 'string') { 6508 return; 6509 } 6510 6511 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 6512 throw new TypeError(`No method named "${config}"`); 6513 } 6514 6515 data[config](); 6516 }); 6517 } 6518 6519 } 6520 /** 6521 * Data API implementation 6522 */ 6523 6524 6525 EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => { 6526 for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) { 6527 ScrollSpy.getOrCreateInstance(spy); 6528 } 6529 }); 6530 /** 6531 * jQuery 6532 */ 6533 6534 defineJQueryPlugin(ScrollSpy); 6535 6536 /** 6537 * -------------------------------------------------------------------------- 6538 * Bootstrap (v5.2.1): tab.js 6539 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 6540 * -------------------------------------------------------------------------- 6541 */ 6542 /** 6543 * Constants 6544 */ 6545 6546 const NAME$1 = 'tab'; 6547 const DATA_KEY$1 = 'bs.tab'; 6548 const EVENT_KEY$1 = `.${DATA_KEY$1}`; 6549 const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`; 6550 const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`; 6551 const EVENT_SHOW$1 = `show${EVENT_KEY$1}`; 6552 const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`; 6553 const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`; 6554 const EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`; 6555 const EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`; 6556 const ARROW_LEFT_KEY = 'ArrowLeft'; 6557 const ARROW_RIGHT_KEY = 'ArrowRight'; 6558 const ARROW_UP_KEY = 'ArrowUp'; 6559 const ARROW_DOWN_KEY = 'ArrowDown'; 6560 const CLASS_NAME_ACTIVE = 'active'; 6561 const CLASS_NAME_FADE$1 = 'fade'; 6562 const CLASS_NAME_SHOW$1 = 'show'; 6563 const CLASS_DROPDOWN = 'dropdown'; 6564 const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; 6565 const SELECTOR_DROPDOWN_MENU = '.dropdown-menu'; 6566 const SELECTOR_DROPDOWN_ITEM = '.dropdown-item'; 6567 const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)'; 6568 const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'; 6569 const SELECTOR_OUTER = '.nav-item, .list-group-item'; 6570 const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`; 6571 const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // todo:v6: could be only `tab` 6572 6573 const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`; 6574 const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`; 6575 /** 6576 * Class definition 6577 */ 6578 6579 class Tab extends BaseComponent { 6580 constructor(element) { 6581 super(element); 6582 this._parent = this._element.closest(SELECTOR_TAB_PANEL); 6583 6584 if (!this._parent) { 6585 return; // todo: should Throw exception on v6 6586 // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`) 6587 } // Set up initial aria attributes 6588 6589 6590 this._setInitialAttributes(this._parent, this._getChildren()); 6591 6592 EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event)); 6593 } // Getters 6594 6595 6596 static get NAME() { 6597 return NAME$1; 6598 } // Public 6599 6600 6601 show() { 6602 // Shows this elem and deactivate the active sibling if exists 6603 const innerElem = this._element; 6604 6605 if (this._elemIsActive(innerElem)) { 6606 return; 6607 } // Search for active tab on same parent to deactivate it 6608 6609 6610 const active = this._getActiveElem(); 6611 6612 const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, { 6613 relatedTarget: innerElem 6614 }) : null; 6615 const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, { 6616 relatedTarget: active 6617 }); 6618 6619 if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) { 6620 return; 6621 } 6622 6623 this._deactivate(active, innerElem); 6624 6625 this._activate(innerElem, active); 6626 } // Private 6627 6628 6629 _activate(element, relatedElem) { 6630 if (!element) { 6631 return; 6632 } 6633 6634 element.classList.add(CLASS_NAME_ACTIVE); 6635 6636 this._activate(getElementFromSelector(element)); // Search and activate/show the proper section 6637 6638 6639 const complete = () => { 6640 if (element.getAttribute('role') !== 'tab') { 6641 element.classList.add(CLASS_NAME_SHOW$1); 6642 return; 6643 } 6644 6645 element.focus(); 6646 element.removeAttribute('tabindex'); 6647 element.setAttribute('aria-selected', true); 6648 6649 this._toggleDropDown(element, true); 6650 6651 EventHandler.trigger(element, EVENT_SHOWN$1, { 6652 relatedTarget: relatedElem 6653 }); 6654 }; 6655 6656 this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1)); 6657 } 6658 6659 _deactivate(element, relatedElem) { 6660 if (!element) { 6661 return; 6662 } 6663 6664 element.classList.remove(CLASS_NAME_ACTIVE); 6665 element.blur(); 6666 6667 this._deactivate(getElementFromSelector(element)); // Search and deactivate the shown section too 6668 6669 6670 const complete = () => { 6671 if (element.getAttribute('role') !== 'tab') { 6672 element.classList.remove(CLASS_NAME_SHOW$1); 6673 return; 6674 } 6675 6676 element.setAttribute('aria-selected', false); 6677 element.setAttribute('tabindex', '-1'); 6678 6679 this._toggleDropDown(element, false); 6680 6681 EventHandler.trigger(element, EVENT_HIDDEN$1, { 6682 relatedTarget: relatedElem 6683 }); 6684 }; 6685 6686 this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1)); 6687 } 6688 6689 _keydown(event) { 6690 if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) { 6691 return; 6692 } 6693 6694 event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page 6695 6696 event.preventDefault(); 6697 const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key); 6698 const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true); 6699 6700 if (nextActiveElement) { 6701 Tab.getOrCreateInstance(nextActiveElement).show(); 6702 } 6703 } 6704 6705 _getChildren() { 6706 // collection of inner elements 6707 return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent); 6708 } 6709 6710 _getActiveElem() { 6711 return this._getChildren().find(child => this._elemIsActive(child)) || null; 6712 } 6713 6714 _setInitialAttributes(parent, children) { 6715 this._setAttributeIfNotExists(parent, 'role', 'tablist'); 6716 6717 for (const child of children) { 6718 this._setInitialAttributesOnChild(child); 6719 } 6720 } 6721 6722 _setInitialAttributesOnChild(child) { 6723 child = this._getInnerElement(child); 6724 6725 const isActive = this._elemIsActive(child); 6726 6727 const outerElem = this._getOuterElement(child); 6728 6729 child.setAttribute('aria-selected', isActive); 6730 6731 if (outerElem !== child) { 6732 this._setAttributeIfNotExists(outerElem, 'role', 'presentation'); 6733 } 6734 6735 if (!isActive) { 6736 child.setAttribute('tabindex', '-1'); 6737 } 6738 6739 this._setAttributeIfNotExists(child, 'role', 'tab'); // set attributes to the related panel too 6740 6741 6742 this._setInitialAttributesOnTargetPanel(child); 6743 } 6744 6745 _setInitialAttributesOnTargetPanel(child) { 6746 const target = getElementFromSelector(child); 6747 6748 if (!target) { 6749 return; 6750 } 6751 6752 this._setAttributeIfNotExists(target, 'role', 'tabpanel'); 6753 6754 if (child.id) { 6755 this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`); 6756 } 6757 } 6758 6759 _toggleDropDown(element, open) { 6760 const outerElem = this._getOuterElement(element); 6761 6762 if (!outerElem.classList.contains(CLASS_DROPDOWN)) { 6763 return; 6764 } 6765 6766 const toggle = (selector, className) => { 6767 const element = SelectorEngine.findOne(selector, outerElem); 6768 6769 if (element) { 6770 element.classList.toggle(className, open); 6771 } 6772 }; 6773 6774 toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE); 6775 toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1); 6776 toggle(SELECTOR_DROPDOWN_ITEM, CLASS_NAME_ACTIVE); 6777 outerElem.setAttribute('aria-expanded', open); 6778 } 6779 6780 _setAttributeIfNotExists(element, attribute, value) { 6781 if (!element.hasAttribute(attribute)) { 6782 element.setAttribute(attribute, value); 6783 } 6784 } 6785 6786 _elemIsActive(elem) { 6787 return elem.classList.contains(CLASS_NAME_ACTIVE); 6788 } // Try to get the inner element (usually the .nav-link) 6789 6790 6791 _getInnerElement(elem) { 6792 return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem); 6793 } // Try to get the outer element (usually the .nav-item) 6794 6795 6796 _getOuterElement(elem) { 6797 return elem.closest(SELECTOR_OUTER) || elem; 6798 } // Static 6799 6800 6801 static jQueryInterface(config) { 6802 return this.each(function () { 6803 const data = Tab.getOrCreateInstance(this); 6804 6805 if (typeof config !== 'string') { 6806 return; 6807 } 6808 6809 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 6810 throw new TypeError(`No method named "${config}"`); 6811 } 6812 6813 data[config](); 6814 }); 6815 } 6816 6817 } 6818 /** 6819 * Data API implementation 6820 */ 6821 6822 6823 EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { 6824 if (['A', 'AREA'].includes(this.tagName)) { 6825 event.preventDefault(); 6826 } 6827 6828 if (isDisabled(this)) { 6829 return; 6830 } 6831 6832 Tab.getOrCreateInstance(this).show(); 6833 }); 6834 /** 6835 * Initialize on focus 6836 */ 6837 6838 EventHandler.on(window, EVENT_LOAD_DATA_API, () => { 6839 for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) { 6840 Tab.getOrCreateInstance(element); 6841 } 6842 }); 6843 /** 6844 * jQuery 6845 */ 6846 6847 defineJQueryPlugin(Tab); 6848 6849 /** 6850 * -------------------------------------------------------------------------- 6851 * Bootstrap (v5.2.1): toast.js 6852 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 6853 * -------------------------------------------------------------------------- 6854 */ 6855 /** 6856 * Constants 6857 */ 6858 6859 const NAME = 'toast'; 6860 const DATA_KEY = 'bs.toast'; 6861 const EVENT_KEY = `.${DATA_KEY}`; 6862 const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`; 6863 const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`; 6864 const EVENT_FOCUSIN = `focusin${EVENT_KEY}`; 6865 const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`; 6866 const EVENT_HIDE = `hide${EVENT_KEY}`; 6867 const EVENT_HIDDEN = `hidden${EVENT_KEY}`; 6868 const EVENT_SHOW = `show${EVENT_KEY}`; 6869 const EVENT_SHOWN = `shown${EVENT_KEY}`; 6870 const CLASS_NAME_FADE = 'fade'; 6871 const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility 6872 6873 const CLASS_NAME_SHOW = 'show'; 6874 const CLASS_NAME_SHOWING = 'showing'; 6875 const DefaultType = { 6876 animation: 'boolean', 6877 autohide: 'boolean', 6878 delay: 'number' 6879 }; 6880 const Default = { 6881 animation: true, 6882 autohide: true, 6883 delay: 5000 6884 }; 6885 /** 6886 * Class definition 6887 */ 6888 6889 class Toast extends BaseComponent { 6890 constructor(element, config) { 6891 super(element, config); 6892 this._timeout = null; 6893 this._hasMouseInteraction = false; 6894 this._hasKeyboardInteraction = false; 6895 6896 this._setListeners(); 6897 } // Getters 6898 6899 6900 static get Default() { 6901 return Default; 6902 } 6903 6904 static get DefaultType() { 6905 return DefaultType; 6906 } 6907 6908 static get NAME() { 6909 return NAME; 6910 } // Public 6911 6912 6913 show() { 6914 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW); 6915 6916 if (showEvent.defaultPrevented) { 6917 return; 6918 } 6919 6920 this._clearTimeout(); 6921 6922 if (this._config.animation) { 6923 this._element.classList.add(CLASS_NAME_FADE); 6924 } 6925 6926 const complete = () => { 6927 this._element.classList.remove(CLASS_NAME_SHOWING); 6928 6929 EventHandler.trigger(this._element, EVENT_SHOWN); 6930 6931 this._maybeScheduleHide(); 6932 }; 6933 6934 this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated 6935 6936 6937 reflow(this._element); 6938 6939 this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING); 6940 6941 this._queueCallback(complete, this._element, this._config.animation); 6942 } 6943 6944 hide() { 6945 if (!this.isShown()) { 6946 return; 6947 } 6948 6949 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE); 6950 6951 if (hideEvent.defaultPrevented) { 6952 return; 6953 } 6954 6955 const complete = () => { 6956 this._element.classList.add(CLASS_NAME_HIDE); // @deprecated 6957 6958 6959 this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW); 6960 6961 EventHandler.trigger(this._element, EVENT_HIDDEN); 6962 }; 6963 6964 this._element.classList.add(CLASS_NAME_SHOWING); 6965 6966 this._queueCallback(complete, this._element, this._config.animation); 6967 } 6968 6969 dispose() { 6970 this._clearTimeout(); 6971 6972 if (this.isShown()) { 6973 this._element.classList.remove(CLASS_NAME_SHOW); 6974 } 6975 6976 super.dispose(); 6977 } 6978 6979 isShown() { 6980 return this._element.classList.contains(CLASS_NAME_SHOW); 6981 } // Private 6982 6983 6984 _maybeScheduleHide() { 6985 if (!this._config.autohide) { 6986 return; 6987 } 6988 6989 if (this._hasMouseInteraction || this._hasKeyboardInteraction) { 6990 return; 6991 } 6992 6993 this._timeout = setTimeout(() => { 6994 this.hide(); 6995 }, this._config.delay); 6996 } 6997 6998 _onInteraction(event, isInteracting) { 6999 switch (event.type) { 7000 case 'mouseover': 7001 case 'mouseout': 7002 this._hasMouseInteraction = isInteracting; 7003 break; 7004 7005 case 'focusin': 7006 case 'focusout': 7007 this._hasKeyboardInteraction = isInteracting; 7008 break; 7009 } 7010 7011 if (isInteracting) { 7012 this._clearTimeout(); 7013 7014 return; 7015 } 7016 7017 const nextElement = event.relatedTarget; 7018 7019 if (this._element === nextElement || this._element.contains(nextElement)) { 7020 return; 7021 } 7022 7023 this._maybeScheduleHide(); 7024 } 7025 7026 _setListeners() { 7027 EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true)); 7028 EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false)); 7029 EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true)); 7030 EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false)); 7031 } 7032 7033 _clearTimeout() { 7034 clearTimeout(this._timeout); 7035 this._timeout = null; 7036 } // Static 7037 7038 7039 static jQueryInterface(config) { 7040 return this.each(function () { 7041 const data = Toast.getOrCreateInstance(this, config); 7042 7043 if (typeof config === 'string') { 7044 if (typeof data[config] === 'undefined') { 7045 throw new TypeError(`No method named "${config}"`); 7046 } 7047 7048 data[config](this); 7049 } 7050 }); 7051 } 7052 7053 } 7054 /** 7055 * Data API implementation 7056 */ 7057 7058 7059 enableDismissTrigger(Toast); 7060 /** 7061 * jQuery 7062 */ 7063 7064 defineJQueryPlugin(Toast); 7065 7066 /** 7067 * -------------------------------------------------------------------------- 7068 * Bootstrap (v5.2.1): index.umd.js 7069 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 7070 * -------------------------------------------------------------------------- 7071 */ 7072 const index_umd = { 7073 Alert, 7074 Button, 7075 Carousel, 7076 Collapse, 7077 Dropdown, 7078 Modal, 7079 Offcanvas, 7080 Popover, 7081 ScrollSpy, 7082 Tab, 7083 Toast, 7084 Tooltip 7085 }; 7086 7087 return index_umd; 7088 7089 })); 7090 //# sourceMappingURL=bootstrap.bundle.js.map