vendor: 10,027 bytes, lines 1-344
1/*! 2 * Bootstrap v5.1.3 (https://getbootstrap.com/) 3 * Copyright 2011-2021 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.1.3): 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'; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 21 22 const toType = obj => { 23 if (obj === null || obj === undefined) { 24 return `${obj}`; 25 } 26 27 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 28 }; 29 /** 30 * -------------------------------------------------------------------------- 31 * Public Util Api 32 * -------------------------------------------------------------------------- 33 */ 34 35 36 const getUID = prefix => { 37 do { 38 prefix += Math.floor(Math.random() * MAX_UID); 39 } while (document.getElementById(prefix)); 40 41 return prefix; 42 }; 43 44 const getSelector = element => { 45 let selector = element.getAttribute('data-bs-target'); 46 47 if (!selector || selector === '#') { 48 let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes, 49 // so everything starting with `#` or `.`. If a "real" URL is used as the selector, 50 // `document.querySelector` will rightfully complain it is invalid. 51 // See https://github.com/twbs/bootstrap/issues/32273 52 53 if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) { 54 return null; 55 } // Just in case some CMS puts out a full URL with the anchor appended 56 57 58 if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { 59 hrefAttr = `#${hrefAttr.split('#')[1]}`; 60 } 61 62 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; 63 } 64 65 return selector; 66 }; 67 68 const getSelectorFromElement = element => { 69 const selector = getSelector(element); 70 71 if (selector) { 72 return document.querySelector(selector) ? selector : null; 73 } 74 75 return null; 76 }; 77 78 const getElementFromSelector = element => { 79 const selector = getSelector(element); 80 return selector ? document.querySelector(selector) : null; 81 }; 82 83 const getTransitionDurationFromElement = element => { 84 if (!element) { 85 return 0; 86 } // Get transition-duration of the element 87 88 89 let { 90 transitionDuration, 91 transitionDelay 92 } = window.getComputedStyle(element); 93 const floatTransitionDuration = Number.parseFloat(transitionDuration); 94 const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 95 96 if (!floatTransitionDuration && !floatTransitionDelay) { 97 return 0; 98 } // If multiple durations are defined, take the first 99 100 101 transitionDuration = transitionDuration.split(',')[0]; 102 transitionDelay = transitionDelay.split(',')[0]; 103 return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 104 }; 105 106 const triggerTransitionEnd = element => { 107 element.dispatchEvent(new Event(TRANSITION_END)); 108 }; 109 110 const isElement$1 = obj => { 111 if (!obj || typeof obj !== 'object') { 112 return false; 113 } 114 115 if (typeof obj.jquery !== 'undefined') { 116 obj = obj[0]; 117 } 118 119 return typeof obj.nodeType !== 'undefined'; 120 }; 121 122 const getElement = obj => { 123 if (isElement$1(obj)) { 124 // it's a jQuery object or a node element 125 return obj.jquery ? obj[0] : obj; 126 } 127 128 if (typeof obj === 'string' && obj.length > 0) { 129 return document.querySelector(obj); 130 } 131 132 return null; 133 }; 134 135 const typeCheckConfig = (componentName, config, configTypes) => { 136 Object.keys(configTypes).forEach(property => { 137 const expectedTypes = configTypes[property]; 138 const value = config[property]; 139 const valueType = value && isElement$1(value) ? 'element' : toType(value); 140 141 if (!new RegExp(expectedTypes).test(valueType)) { 142 throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`); 143 } 144 }); 145 }; 146 147 const isVisible = element => { 148 if (!isElement$1(element) || element.getClientRects().length === 0) { 149 return false; 150 } 151 152 return getComputedStyle(element).getPropertyValue('visibility') === 'visible'; 153 }; 154 155 const isDisabled = element => { 156 if (!element || element.nodeType !== Node.ELEMENT_NODE) { 157 return true; 158 } 159 160 if (element.classList.contains('disabled')) { 161 return true; 162 } 163 164 if (typeof element.disabled !== 'undefined') { 165 return element.disabled; 166 } 167 168 return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; 169 }; 170 171 const findShadowRoot = element => { 172 if (!document.documentElement.attachShadow) { 173 return null; 174 } // Can find the shadow root otherwise it'll return the document 175 176 177 if (typeof element.getRootNode === 'function') { 178 const root = element.getRootNode(); 179 return root instanceof ShadowRoot ? root : null; 180 } 181 182 if (element instanceof ShadowRoot) { 183 return element; 184 } // when we don't find a shadow root 185 186 187 if (!element.parentNode) { 188 return null; 189 } 190 191 return findShadowRoot(element.parentNode); 192 }; 193 194 const noop = () => {}; 195 /** 196 * Trick to restart an element's animation 197 * 198 * @param {HTMLElement} element 199 * @return void 200 * 201 * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation 202 */ 203 204 205 const reflow = element => { 206 // eslint-disable-next-line no-unused-expressions 207 element.offsetHeight; 208 }; 209 210 const getjQuery = () => { 211 const { 212 jQuery 213 } = window; 214 215 if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { 216 return jQuery; 217 } 218 219 return null; 220 }; 221 222 const DOMContentLoadedCallbacks = []; 223 224 const onDOMContentLoaded = callback => { 225 if (document.readyState === 'loading') { 226 // add listener on the first call when the document is in loading state 227 if (!DOMContentLoadedCallbacks.length) { 228 document.addEventListener('DOMContentLoaded', () => { 229 DOMContentLoadedCallbacks.forEach(callback => callback()); 230 }); 231 } 232 233 DOMContentLoadedCallbacks.push(callback); 234 } else { 235 callback(); 236 } 237 }; 238 239 const isRTL = () => document.documentElement.dir === 'rtl'; 240 241 const defineJQueryPlugin = plugin => { 242 onDOMContentLoaded(() => { 243 const $ = getjQuery(); 244 /* istanbul ignore if */ 245 246 if ($) { 247 const name = plugin.NAME; 248 const JQUERY_NO_CONFLICT = $.fn[name]; 249 $.fn[name] = plugin.jQueryInterface; 250 $.fn[name].Constructor = plugin; 251 252 $.fn[name].noConflict = () => { 253 $.fn[name] = JQUERY_NO_CONFLICT; 254 return plugin.jQueryInterface; 255 }; 256 } 257 }); 258 }; 259 260 const execute = callback => { 261 if (typeof callback === 'function') { 262 callback(); 263 } 264 }; 265 266 const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => { 267 if (!waitForTransition) { 268 execute(callback); 269 return; 270 } 271 272 const durationPadding = 5; 273 const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding; 274 let called = false; 275 276 const handler = ({ 277 target 278 }) => { 279 if (target !== transitionElement) { 280 return; 281 } 282 283 called = true; 284 transitionElement.removeEventListener(TRANSITION_END, handler); 285 execute(callback); 286 }; 287 288 transitionElement.addEventListener(TRANSITION_END, handler); 289 setTimeout(() => { 290 if (!called) { 291 triggerTransitionEnd(transitionElement); 292 } 293 }, emulatedDuration); 294 }; 295 /** 296 * Return the previous/next element of a list. 297 * 298 * @param {array} list The list of elements 299 * @param activeElement The active element 300 * @param shouldGetNext Choose to get next or previous element 301 * @param isCycleAllowed 302 * @return {Element|elem} The proper element 303 */ 304 305 306 const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => { 307 let index = list.indexOf(activeElement); // if the element does not exist in the list return an element depending on the direction and if cycle is allowed 308 309 if (index === -1) { 310 return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0]; 311 } 312 313 const listLength = list.length; 314 index += shouldGetNext ? 1 : -1; 315 316 if (isCycleAllowed) { 317 index = (index + listLength) % listLength; 318 } 319 320 return list[Math.max(0, Math.min(index, listLength - 1))]; 321 }; 322 323 /** 324 * -------------------------------------------------------------------------- 325 * Bootstrap (v5.1.3): dom/event-handler.js 326 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 327 * -------------------------------------------------------------------------- 328 */ 329 /** 330 * ------------------------------------------------------------------------ 331 * Constants 332 * ------------------------------------------------------------------------ 333 */ 334 335 const namespaceRegex = /[^.]*(?=\..*)\.|.*/; 336 const stripNameRegex = /\..*/; 337 const stripUidRegex = /::\d+$/; 338 const eventRegistry = {}; // Events storage 339 340 let uidEvent = 1; 341 const customEvents = { 342 mouseenter: 'mouseover', 343 mouseleave: 'mouseout' 344 };
vendor: 15,960 bytes, lines 345-854
345 const customEventsRegex = /^(mouseenter|mouseleave)/i; 346 const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']); 347 /** 348 * ------------------------------------------------------------------------ 349 * Private methods 350 * ------------------------------------------------------------------------ 351 */ 352 353 function getUidEvent(element, uid) { 354 return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; 355 } 356 357 function getEvent(element) { 358 const uid = getUidEvent(element); 359 element.uidEvent = uid; 360 eventRegistry[uid] = eventRegistry[uid] || {}; 361 return eventRegistry[uid]; 362 } 363 364 function bootstrapHandler(element, fn) { 365 return function handler(event) { 366 event.delegateTarget = element; 367 368 if (handler.oneOff) { 369 EventHandler.off(element, event.type, fn); 370 } 371 372 return fn.apply(element, [event]); 373 }; 374 } 375 376 function bootstrapDelegationHandler(element, selector, fn) { 377 return function handler(event) { 378 const domElements = element.querySelectorAll(selector); 379 380 for (let { 381 target 382 } = event; target && target !== this; target = target.parentNode) { 383 for (let i = domElements.length; i--;) { 384 if (domElements[i] === target) { 385 event.delegateTarget = target; 386 387 if (handler.oneOff) { 388 EventHandler.off(element, event.type, selector, fn); 389 } 390 391 return fn.apply(target, [event]); 392 } 393 } 394 } // To please ESLint 395 396 397 return null; 398 }; 399 } 400 401 function findHandler(events, handler, delegationSelector = null) { 402 const uidEventList = Object.keys(events); 403 404 for (let i = 0, len = uidEventList.length; i < len; i++) { 405 const event = events[uidEventList[i]]; 406 407 if (event.originalHandler === handler && event.delegationSelector === delegationSelector) { 408 return event; 409 } 410 } 411 412 return null; 413 } 414 415 function normalizeParams(originalTypeEvent, handler, delegationFn) { 416 const delegation = typeof handler === 'string'; 417 const originalHandler = delegation ? delegationFn : handler; 418 let typeEvent = getTypeEvent(originalTypeEvent); 419 const isNative = nativeEvents.has(typeEvent); 420 421 if (!isNative) { 422 typeEvent = originalTypeEvent; 423 } 424 425 return [delegation, originalHandler, typeEvent]; 426 } 427 428 function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) { 429 if (typeof originalTypeEvent !== 'string' || !element) { 430 return; 431 } 432 433 if (!handler) { 434 handler = delegationFn; 435 delegationFn = null; 436 } // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position 437 // this prevents the handler from being dispatched the same way as mouseover or mouseout does 438 439 440 if (customEventsRegex.test(originalTypeEvent)) { 441 const wrapFn = fn => { 442 return function (event) { 443 if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) { 444 return fn.call(this, event); 445 } 446 }; 447 }; 448 449 if (delegationFn) { 450 delegationFn = wrapFn(delegationFn); 451 } else { 452 handler = wrapFn(handler); 453 } 454 } 455 456 const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn); 457 const events = getEvent(element); 458 const handlers = events[typeEvent] || (events[typeEvent] = {}); 459 const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null); 460 461 if (previousFn) { 462 previousFn.oneOff = previousFn.oneOff && oneOff; 463 return; 464 } 465 466 const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, '')); 467 const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler); 468 fn.delegationSelector = delegation ? handler : null; 469 fn.originalHandler = originalHandler; 470 fn.oneOff = oneOff; 471 fn.uidEvent = uid; 472 handlers[uid] = fn; 473 element.addEventListener(typeEvent, fn, delegation); 474 } 475 476 function removeHandler(element, events, typeEvent, handler, delegationSelector) { 477 const fn = findHandler(events[typeEvent], handler, delegationSelector); 478 479 if (!fn) { 480 return; 481 } 482 483 element.removeEventListener(typeEvent, fn, Boolean(delegationSelector)); 484 delete events[typeEvent][fn.uidEvent]; 485 } 486 487 function removeNamespacedHandlers(element, events, typeEvent, namespace) { 488 const storeElementEvent = events[typeEvent] || {}; 489 Object.keys(storeElementEvent).forEach(handlerKey => { 490 if (handlerKey.includes(namespace)) { 491 const event = storeElementEvent[handlerKey]; 492 removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); 493 } 494 }); 495 } 496 497 function getTypeEvent(event) { 498 // allow to get the native events from namespaced events ('click.bs.button' --> 'click') 499 event = event.replace(stripNameRegex, ''); 500 return customEvents[event] || event; 501 } 502 503 const EventHandler = { 504 on(element, event, handler, delegationFn) { 505 addHandler(element, event, handler, delegationFn, false); 506 }, 507 508 one(element, event, handler, delegationFn) { 509 addHandler(element, event, handler, delegationFn, true); 510 }, 511 512 off(element, originalTypeEvent, handler, delegationFn) { 513 if (typeof originalTypeEvent !== 'string' || !element) { 514 return; 515 } 516 517 const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn); 518 const inNamespace = typeEvent !== originalTypeEvent; 519 const events = getEvent(element); 520 const isNamespace = originalTypeEvent.startsWith('.'); 521 522 if (typeof originalHandler !== 'undefined') { 523 // Simplest case: handler is passed, remove that listener ONLY. 524 if (!events || !events[typeEvent]) { 525 return; 526 } 527 528 removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null); 529 return; 530 } 531 532 if (isNamespace) { 533 Object.keys(events).forEach(elementEvent => { 534 removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); 535 }); 536 } 537 538 const storeElementEvent = events[typeEvent] || {}; 539 Object.keys(storeElementEvent).forEach(keyHandlers => { 540 const handlerKey = keyHandlers.replace(stripUidRegex, ''); 541 542 if (!inNamespace || originalTypeEvent.includes(handlerKey)) { 543 const event = storeElementEvent[keyHandlers]; 544 removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); 545 } 546 }); 547 }, 548 549 trigger(element, event, args) { 550 if (typeof event !== 'string' || !element) { 551 return null; 552 } 553 554 const $ = getjQuery(); 555 const typeEvent = getTypeEvent(event); 556 const inNamespace = event !== typeEvent; 557 const isNative = nativeEvents.has(typeEvent); 558 let jQueryEvent; 559 let bubbles = true; 560 let nativeDispatch = true; 561 let defaultPrevented = false; 562 let evt = null; 563 564 if (inNamespace && $) { 565 jQueryEvent = $.Event(event, args); 566 $(element).trigger(jQueryEvent); 567 bubbles = !jQueryEvent.isPropagationStopped(); 568 nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); 569 defaultPrevented = jQueryEvent.isDefaultPrevented(); 570 } 571 572 if (isNative) { 573 evt = document.createEvent('HTMLEvents'); 574 evt.initEvent(typeEvent, bubbles, true); 575 } else { 576 evt = new CustomEvent(event, { 577 bubbles, 578 cancelable: true 579 }); 580 } // merge custom information in our event 581 582 583 if (typeof args !== 'undefined') { 584 Object.keys(args).forEach(key => { 585 Object.defineProperty(evt, key, { 586 get() { 587 return args[key]; 588 } 589 590 }); 591 }); 592 } 593 594 if (defaultPrevented) { 595 evt.preventDefault(); 596 } 597 598 if (nativeDispatch) { 599 element.dispatchEvent(evt); 600 } 601 602 if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') { 603 jQueryEvent.preventDefault(); 604 } 605 606 return evt; 607 } 608 609 }; 610 611 /** 612 * -------------------------------------------------------------------------- 613 * Bootstrap (v5.1.3): dom/data.js 614 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 615 * -------------------------------------------------------------------------- 616 */ 617 618 /** 619 * ------------------------------------------------------------------------ 620 * Constants 621 * ------------------------------------------------------------------------ 622 */ 623 const elementMap = new Map(); 624 const Data = { 625 set(element, key, instance) { 626 if (!elementMap.has(element)) { 627 elementMap.set(element, new Map()); 628 } 629 630 const instanceMap = elementMap.get(element); // make it clear we only want one instance per element 631 // can be removed later when multiple key/instances are fine to be used 632 633 if (!instanceMap.has(key) && instanceMap.size !== 0) { 634 // eslint-disable-next-line no-console 635 console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); 636 return; 637 } 638 639 instanceMap.set(key, instance); 640 }, 641 642 get(element, key) { 643 if (elementMap.has(element)) { 644 return elementMap.get(element).get(key) || null; 645 } 646 647 return null; 648 }, 649 650 remove(element, key) { 651 if (!elementMap.has(element)) { 652 return; 653 } 654 655 const instanceMap = elementMap.get(element); 656 instanceMap.delete(key); // free up element references if there are no instances left for an element 657 658 if (instanceMap.size === 0) { 659 elementMap.delete(element); 660 } 661 } 662 663 }; 664 665 /** 666 * -------------------------------------------------------------------------- 667 * Bootstrap (v5.1.3): base-component.js 668 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 669 * -------------------------------------------------------------------------- 670 */ 671 /** 672 * ------------------------------------------------------------------------ 673 * Constants 674 * ------------------------------------------------------------------------ 675 */ 676 677 const VERSION = '5.1.3'; 678 679 class BaseComponent { 680 constructor(element) { 681 element = getElement(element); 682 683 if (!element) { 684 return; 685 } 686 687 this._element = element; 688 Data.set(this._element, this.constructor.DATA_KEY, this); 689 } 690 691 dispose() { 692 Data.remove(this._element, this.constructor.DATA_KEY); 693 EventHandler.off(this._element, this.constructor.EVENT_KEY); 694 Object.getOwnPropertyNames(this).forEach(propertyName => { 695 this[propertyName] = null; 696 }); 697 } 698 699 _queueCallback(callback, element, isAnimated = true) { 700 executeAfterTransition(callback, element, isAnimated); 701 } 702 /** Static */ 703 704 705 static getInstance(element) { 706 return Data.get(getElement(element), this.DATA_KEY); 707 } 708 709 static getOrCreateInstance(element, config = {}) { 710 return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null); 711 } 712 713 static get VERSION() { 714 return VERSION; 715 } 716 717 static get NAME() { 718 throw new Error('You have to implement the static method "NAME", for each component!'); 719 } 720 721 static get DATA_KEY() { 722 return `bs.${this.NAME}`; 723 } 724 725 static get EVENT_KEY() { 726 return `.${this.DATA_KEY}`; 727 } 728 729 } 730 731 /** 732 * -------------------------------------------------------------------------- 733 * Bootstrap (v5.1.3): util/component-functions.js 734 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 735 * -------------------------------------------------------------------------- 736 */ 737 738 const enableDismissTrigger = (component, method = 'hide') => { 739 const clickEvent = `click.dismiss${component.EVENT_KEY}`; 740 const name = component.NAME; 741 EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) { 742 if (['A', 'AREA'].includes(this.tagName)) { 743 event.preventDefault(); 744 } 745 746 if (isDisabled(this)) { 747 return; 748 } 749 750 const target = getElementFromSelector(this) || this.closest(`.${name}`); 751 const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method 752 753 instance[method](); 754 }); 755 }; 756 757 758 759 const NODE_TEXT = 3; 760 const SelectorEngine = { 761 find(selector, element = document.documentElement) { 762 return [].concat(...Element.prototype.querySelectorAll.call(element, selector)); 763 }, 764 765 findOne(selector, element = document.documentElement) { 766 return Element.prototype.querySelector.call(element, selector); 767 }, 768 769 children(element, selector) { 770 return [].concat(...element.children).filter(child => child.matches(selector)); 771 }, 772 773 parents(element, selector) { 774 const parents = []; 775 let ancestor = element.parentNode; 776 777 while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) { 778 if (ancestor.matches(selector)) { 779 parents.push(ancestor); 780 } 781 782 ancestor = ancestor.parentNode; 783 } 784 785 return parents; 786 }, 787 788 prev(element, selector) { 789 let previous = element.previousElementSibling; 790 791 while (previous) { 792 if (previous.matches(selector)) { 793 return [previous]; 794 } 795 796 previous = previous.previousElementSibling; 797 } 798 799 return []; 800 }, 801 802 next(element, selector) { 803 let next = element.nextElementSibling; 804 805 while (next) { 806 if (next.matches(selector)) { 807 return [next]; 808 } 809 810 next = next.nextElementSibling; 811 } 812 813 return []; 814 }, 815 816 focusableChildren(element) { 817 const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', '); 818 return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el)); 819 } 820 821 }; 822 823 824 /** 825 * ------------------------------------------------------------------------ 826 * Constants 827 * ------------------------------------------------------------------------ 828 */ 829 830 const NAME$a = 'collapse'; 831 const DATA_KEY$9 = 'bs.collapse'; 832 const EVENT_KEY$9 = `.${DATA_KEY$9}`; 833 const DATA_API_KEY$5 = '.data-api'; 834 const Default$9 = { 835 toggle: true, 836 parent: null 837 }; 838 const DefaultType$9 = { 839 toggle: 'boolean', 840 parent: '(null|element)' 841 }; 842 const EVENT_SHOW$5 = `show${EVENT_KEY$9}`; 843 const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`; 844 const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`; 845 const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`; 846 const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`; 847 const CLASS_NAME_SHOW$7 = 'show'; 848 const CLASS_NAME_COLLAPSE = 'collapse'; 849 const CLASS_NAME_COLLAPSING = 'collapsing'; 850 const CLASS_NAME_COLLAPSED = 'collapsed'; 851 const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; 852 const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; 853 const WIDTH = 'width'; 854 const HEIGHT = 'height';
855 const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; 856 const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; 857 /** 858 * ------------------------------------------------------------------------ 859 * Class Definition 860 * ------------------------------------------------------------------------ 861 */ 862 863 class Collapse extends BaseComponent { 864 constructor(element, config) { 865 super(element); 866 this._isTransitioning = false; 867 this._config = this._getConfig(config); 868 this._triggerArray = []; 869 const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4); 870 871 for (let i = 0, len = toggleList.length; i < len; i++) { 872 const elem = toggleList[i]; 873 const selector = getSelectorFromElement(elem); 874 const filterElement = SelectorEngine.find(selector).filter(foundElem => foundElem === this._element); 875 876 if (selector !== null && filterElement.length) { 877 this._selector = selector; 878 879 this._triggerArray.push(elem); 880 } 881 } 882 883 this._initializeChildren(); 884 885 if (!this._config.parent) { 886 this._addAriaAndCollapsedClass(this._triggerArray, this._isShown()); 887 } 888 889 if (this._config.toggle) { 890 this.toggle(); 891 } 892 } // Getters 893 894 895 static get Default() { 896 return Default$9; 897 } 898 899 static get NAME() { 900 return NAME$a; 901 } // Public 902 903 904 toggle() { 905 if (this._isShown()) { 906 this.hide(); 907 } else { 908 this.show(); 909 } 910 } 911 912 show() { 913 if (this._isTransitioning || this._isShown()) { 914 return; 915 } 916 917 let actives = []; 918 let activesData; 919 920 if (this._config.parent) { 921 const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); 922 actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth 923 } 924 925 const container = SelectorEngine.findOne(this._selector); 926 927 if (actives.length) { 928 const tempActiveData = actives.find(elem => container !== elem); 929 activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null; 930 931 if (activesData && activesData._isTransitioning) { 932 return; 933 } 934 } 935 936 const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5); 937 938 if (startEvent.defaultPrevented) { 939 return; 940 } 941 942 actives.forEach(elemActive => { 943 if (container !== elemActive) { 944 Collapse.getOrCreateInstance(elemActive, { 945 toggle: false 946 }).hide(); 947 } 948 949 if (!activesData) { 950 Data.set(elemActive, DATA_KEY$9, null); 951 } 952 }); 953 954 const dimension = this._getDimension(); 955 956 this._element.classList.remove(CLASS_NAME_COLLAPSE); 957 958 this._element.classList.add(CLASS_NAME_COLLAPSING); 959 960 this._element.style[dimension] = 0; 961 962 this._addAriaAndCollapsedClass(this._triggerArray, true); 963 964 this._isTransitioning = true; 965 966 const complete = () => { 967 this._isTransitioning = false; 968 969 this._element.classList.remove(CLASS_NAME_COLLAPSING); 970 971 this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 972 973 this._element.style[dimension] = ''; 974 EventHandler.trigger(this._element, EVENT_SHOWN$5); 975 }; 976 977 const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 978 const scrollSize = `scroll${capitalizedDimension}`; 979 980 this._queueCallback(complete, this._element, true); 981 982 this._element.style[dimension] = `${this._element[scrollSize]}px`; 983 } 984 985 hide() { 986 if (this._isTransitioning || !this._isShown()) { 987 return; 988 } 989 990 const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5); 991 992 if (startEvent.defaultPrevented) { 993 return; 994 } 995 996 const dimension = this._getDimension(); 997 998 this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; 999 reflow(this._element); 1000 1001 this._element.classList.add(CLASS_NAME_COLLAPSING); 1002 1003 this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 1004 1005 const triggerArrayLength = this._triggerArray.length; 1006 1007 for (let i = 0; i < triggerArrayLength; i++) { 1008 const trigger = this._triggerArray[i]; 1009 const elem = getElementFromSelector(trigger); 1010 1011 if (elem && !this._isShown(elem)) { 1012 this._addAriaAndCollapsedClass([trigger], false); 1013 } 1014 } 1015 1016 this._isTransitioning = true; 1017 1018 const complete = () => { 1019 this._isTransitioning = false;
vendor: 5,387 bytes, lines 1020-1199
1020 1021 this._element.classList.remove(CLASS_NAME_COLLAPSING); 1022 1023 this._element.classList.add(CLASS_NAME_COLLAPSE); 1024 1025 EventHandler.trigger(this._element, EVENT_HIDDEN$5); 1026 }; 1027 1028 this._element.style[dimension] = ''; 1029 1030 this._queueCallback(complete, this._element, true); 1031 } 1032 1033 _isShown(element = this._element) { 1034 return element.classList.contains(CLASS_NAME_SHOW$7); 1035 } // Private 1036 1037 1038 _getConfig(config) { 1039 config = { ...Default$9, 1040 ...Manipulator.getDataAttributes(this._element), 1041 ...config 1042 }; 1043 config.toggle = Boolean(config.toggle); // Coerce string values 1044 1045 config.parent = getElement(config.parent); 1046 typeCheckConfig(NAME$a, config, DefaultType$9); 1047 return config; 1048 } 1049 1050 _getDimension() { 1051 return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT; 1052 } 1053 1054 _initializeChildren() { 1055 if (!this._config.parent) { 1056 return; 1057 } 1058 1059 const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); 1060 SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => { 1061 const selected = getElementFromSelector(element); 1062 1063 if (selected) { 1064 this._addAriaAndCollapsedClass([element], this._isShown(selected)); 1065 } 1066 }); 1067 } 1068 1069 _addAriaAndCollapsedClass(triggerArray, isOpen) { 1070 if (!triggerArray.length) { 1071 return; 1072 } 1073 1074 triggerArray.forEach(elem => { 1075 if (isOpen) { 1076 elem.classList.remove(CLASS_NAME_COLLAPSED); 1077 } else { 1078 elem.classList.add(CLASS_NAME_COLLAPSED); 1079 } 1080 1081 elem.setAttribute('aria-expanded', isOpen); 1082 }); 1083 } // Static 1084 1085 1086 static jQueryInterface(config) { 1087 return this.each(function () { 1088 const _config = {}; 1089 1090 if (typeof config === 'string' && /show|hide/.test(config)) { 1091 _config.toggle = false; 1092 } 1093 1094 const data = Collapse.getOrCreateInstance(this, _config); 1095 1096 if (typeof config === 'string') { 1097 if (typeof data[config] === 'undefined') { 1098 throw new TypeError(`No method named "${config}"`); 1099 } 1100 1101 data[config](); 1102 } 1103 }); 1104 } 1105 1106 } 1107 /** 1108 * ------------------------------------------------------------------------ 1109 * Data Api implementation 1110 * ------------------------------------------------------------------------ 1111 */ 1112 1113 1114 EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) { 1115 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 1116 if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') { 1117 event.preventDefault(); 1118 } 1119 1120 const selector = getSelectorFromElement(this); 1121 const selectorElements = SelectorEngine.find(selector); 1122 selectorElements.forEach(element => { 1123 Collapse.getOrCreateInstance(element, { 1124 toggle: false 1125 }).toggle(); 1126 }); 1127 }); 1128 /** 1129 * ------------------------------------------------------------------------ 1130 * jQuery 1131 * ------------------------------------------------------------------------ 1132 * add .Collapse to jQuery only if jQuery is present 1133 */ 1134 1135 defineJQueryPlugin(Collapse); 1136 1137 var top = 'top'; 1138 var bottom = 'bottom'; 1139 var right = 'right'; 1140 var left = 'left'; 1141 var auto = 'auto'; 1142 var basePlacements = [top, bottom, right, left]; 1143 var start = 'start'; 1144 var end = 'end'; 1145 var clippingParents = 'clippingParents'; 1146 var viewport = 'viewport'; 1147 var popper = 'popper'; 1148 var reference = 'reference'; 1149 var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) { 1150 return acc.concat([placement + "-" + start, placement + "-" + end]); 1151 }, []); 1152 var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) { 1153 return acc.concat([placement, placement + "-" + start, placement + "-" + end]); 1154 }, []); // modifiers that need to read the DOM 1155 1156 var beforeRead = 'beforeRead'; 1157 var read = 'read'; 1158 var afterRead = 'afterRead'; // pure-logic modifiers 1159 1160 var beforeMain = 'beforeMain'; 1161 var main = 'main'; 1162 var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state) 1163 1164 var beforeWrite = 'beforeWrite'; 1165 var write = 'write'; 1166 var afterWrite = 'afterWrite'; 1167 var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite]; 1168 1169 function getNodeName(element) { 1170 return element ? (element.nodeName || '').toLowerCase() : null; 1171 } 1172 1173 function getWindow(node) { 1174 if (node == null) { 1175 return window; 1176 } 1177 1178 if (node.toString() !== '[object Window]') { 1179 var ownerDocument = node.ownerDocument; 1180 return ownerDocument ? ownerDocument.defaultView || window : window; 1181 } 1182 1183 return node; 1184 } 1185 1186 function isElement(node) { 1187 var OwnElement = getWindow(node).Element; 1188 return node instanceof OwnElement || node instanceof Element; 1189 } 1190 1191 function isHTMLElement(node) { 1192 var OwnElement = getWindow(node).HTMLElement; 1193 return node instanceof OwnElement || node instanceof HTMLElement; 1194 } 1195 1196 function isShadowRoot(node) { 1197 // IE 11 has no ShadowRoot 1198 if (typeof ShadowRoot === 'undefined') { 1199 return false;
vendor: 5,267 bytes, lines 1200-1374
1200 } 1201 1202 var OwnElement = getWindow(node).ShadowRoot; 1203 return node instanceof OwnElement || node instanceof ShadowRoot; 1204 } 1205 1206 // and applies them to the HTMLElements such as popper and arrow 1207 1208 function applyStyles(_ref) { 1209 var state = _ref.state; 1210 Object.keys(state.elements).forEach(function (name) { 1211 var style = state.styles[name] || {}; 1212 var attributes = state.attributes[name] || {}; 1213 var element = state.elements[name]; // arrow is optional + virtual elements 1214 1215 if (!isHTMLElement(element) || !getNodeName(element)) { 1216 return; 1217 } // Flow doesn't support to extend this property, but it's the most 1218 // effective way to apply styles to an HTMLElement 1219 // $FlowFixMe[cannot-write] 1220 1221 1222 Object.assign(element.style, style); 1223 Object.keys(attributes).forEach(function (name) { 1224 var value = attributes[name]; 1225 1226 if (value === false) { 1227 element.removeAttribute(name); 1228 } else { 1229 element.setAttribute(name, value === true ? '' : value); 1230 } 1231 }); 1232 }); 1233 } 1234 1235 function effect$2(_ref2) { 1236 var state = _ref2.state; 1237 var initialStyles = { 1238 popper: { 1239 position: state.options.strategy, 1240 left: '0', 1241 top: '0', 1242 margin: '0' 1243 }, 1244 arrow: { 1245 position: 'absolute' 1246 }, 1247 reference: {} 1248 }; 1249 Object.assign(state.elements.popper.style, initialStyles.popper); 1250 state.styles = initialStyles; 1251 1252 if (state.elements.arrow) { 1253 Object.assign(state.elements.arrow.style, initialStyles.arrow); 1254 } 1255 1256 return function () { 1257 Object.keys(state.elements).forEach(function (name) { 1258 var element = state.elements[name]; 1259 var attributes = state.attributes[name] || {}; 1260 var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them 1261 1262 var style = styleProperties.reduce(function (style, property) { 1263 style[property] = ''; 1264 return style; 1265 }, {}); // arrow is optional + virtual elements 1266 1267 if (!isHTMLElement(element) || !getNodeName(element)) { 1268 return; 1269 } 1270 1271 Object.assign(element.style, style); 1272 Object.keys(attributes).forEach(function (attribute) { 1273 element.removeAttribute(attribute); 1274 }); 1275 }); 1276 }; 1277 } // eslint-disable-next-line import/no-unused-modules 1278 1279 1280 const applyStyles$1 = { 1281 name: 'applyStyles', 1282 enabled: true, 1283 phase: 'write', 1284 fn: applyStyles, 1285 effect: effect$2, 1286 requires: ['computeStyles'] 1287 }; 1288 1289 function getBasePlacement(placement) { 1290 return placement.split('-')[0]; 1291 } 1292 1293 // import { isHTMLElement } from './instanceOf'; 1294 function getBoundingClientRect(element, // eslint-disable-next-line unused-imports/no-unused-vars 1295 includeScale) { 1296 1297 var rect = element.getBoundingClientRect(); 1298 var scaleX = 1; 1299 var scaleY = 1; // FIXME: 1300 // `offsetWidth` returns an integer while `getBoundingClientRect` 1301 // returns a float. This results in `scaleX` or `scaleY` being 1302 // non-1 when it should be for elements that aren't a full pixel in 1303 // width or height. 1304 // if (isHTMLElement(element) && includeScale) { 1305 // const offsetHeight = element.offsetHeight; 1306 // const offsetWidth = element.offsetWidth; 1307 // // Do not attempt to divide by 0, otherwise we get `Infinity` as scale 1308 // // Fallback to 1 in case both values are `0` 1309 // if (offsetWidth > 0) { 1310 // scaleX = rect.width / offsetWidth || 1; 1311 // } 1312 // if (offsetHeight > 0) { 1313 // scaleY = rect.height / offsetHeight || 1; 1314 // } 1315 // } 1316 1317 return { 1318 width: rect.width / scaleX, 1319 height: rect.height / scaleY, 1320 top: rect.top / scaleY, 1321 right: rect.right / scaleX, 1322 bottom: rect.bottom / scaleY, 1323 left: rect.left / scaleX, 1324 x: rect.left / scaleX, 1325 y: rect.top / scaleY 1326 }; 1327 } 1328 1329 // means it doesn't take into account transforms. 1330 1331 function getLayoutRect(element) { 1332 var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed. 1333 // Fixes https://github.com/popperjs/popper-core/issues/1223 1334 1335 var width = element.offsetWidth; 1336 var height = element.offsetHeight; 1337 1338 if (Math.abs(clientRect.width - width) <= 1) { 1339 width = clientRect.width; 1340 } 1341 1342 if (Math.abs(clientRect.height - height) <= 1) { 1343 height = clientRect.height; 1344 } 1345 1346 return { 1347 x: element.offsetLeft, 1348 y: element.offsetTop, 1349 width: width, 1350 height: height 1351 }; 1352 } 1353 1354 function contains(parent, child) { 1355 var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method 1356 1357 if (parent.contains(child)) { 1358 return true; 1359 } // then fallback to custom implementation with Shadow DOM support 1360 else if (rootNode && isShadowRoot(rootNode)) { 1361 var next = child; 1362 1363 do { 1364 if (next && parent.isSameNode(next)) { 1365 return true; 1366 } // $FlowFixMe[prop-missing]: need a better way to handle this... 1367 1368 1369 next = next.parentNode || next.host; 1370 } while (next); 1371 } // Give up, the result is false 1372 1373 1374 return false;
vendor: 8,638 bytes, lines 1375-1631
1375 } 1376 1377 function getComputedStyle$1(element) { 1378 return getWindow(element).getComputedStyle(element); 1379 } 1380 1381 function isTableElement(element) { 1382 return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0; 1383 } 1384 1385 function getDocumentElement(element) { 1386 // $FlowFixMe[incompatible-return]: assume body is always available 1387 return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing] 1388 element.document) || window.document).documentElement; 1389 } 1390 1391 function getParentNode(element) { 1392 if (getNodeName(element) === 'html') { 1393 return element; 1394 } 1395 1396 return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle 1397 // $FlowFixMe[incompatible-return] 1398 // $FlowFixMe[prop-missing] 1399 element.assignedSlot || // step into the shadow DOM of the parent of a slotted node 1400 element.parentNode || ( // DOM Element detected 1401 isShadowRoot(element) ? element.host : null) || // ShadowRoot detected 1402 // $FlowFixMe[incompatible-call]: HTMLElement is a Node 1403 getDocumentElement(element) // fallback 1404 1405 ); 1406 } 1407 1408 function getTrueOffsetParent(element) { 1409 if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837 1410 getComputedStyle$1(element).position === 'fixed') { 1411 return null; 1412 } 1413 1414 return element.offsetParent; 1415 } // `.offsetParent` reports `null` for fixed elements, while absolute elements 1416 // return the containing block 1417 1418 1419 function getContainingBlock(element) { 1420 var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1; 1421 var isIE = navigator.userAgent.indexOf('Trident') !== -1; 1422 1423 if (isIE && isHTMLElement(element)) { 1424 // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport 1425 var elementCss = getComputedStyle$1(element); 1426 1427 if (elementCss.position === 'fixed') { 1428 return null; 1429 } 1430 } 1431 1432 var currentNode = getParentNode(element); 1433 1434 while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) { 1435 var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that 1436 // create a containing block. 1437 // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block 1438 1439 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') { 1440 return currentNode; 1441 } else { 1442 currentNode = currentNode.parentNode; 1443 } 1444 } 1445 1446 return null; 1447 } // Gets the closest ancestor positioned element. Handles some edge cases, 1448 // such as table ancestors and cross browser bugs. 1449 1450 1451 function getOffsetParent(element) { 1452 var window = getWindow(element); 1453 var offsetParent = getTrueOffsetParent(element); 1454 1455 while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') { 1456 offsetParent = getTrueOffsetParent(offsetParent); 1457 } 1458 1459 if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) { 1460 return window; 1461 } 1462 1463 return offsetParent || getContainingBlock(element) || window; 1464 } 1465 1466 function getMainAxisFromPlacement(placement) { 1467 return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y'; 1468 } 1469 1470 var max = Math.max; 1471 var min = Math.min; 1472 var round = Math.round; 1473 1474 function within(min$1, value, max$1) { 1475 return max(min$1, min(value, max$1)); 1476 } 1477 1478 function getFreshSideObject() { 1479 return { 1480 top: 0, 1481 right: 0, 1482 bottom: 0, 1483 left: 0 1484 }; 1485 } 1486 1487 function mergePaddingObject(paddingObject) { 1488 return Object.assign({}, getFreshSideObject(), paddingObject); 1489 } 1490 1491 function expandToHashMap(value, keys) { 1492 return keys.reduce(function (hashMap, key) { 1493 hashMap[key] = value; 1494 return hashMap; 1495 }, {}); 1496 } 1497 1498 var toPaddingObject = function toPaddingObject(padding, state) { 1499 padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, { 1500 placement: state.placement 1501 })) : padding; 1502 return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); 1503 }; 1504 1505 function arrow(_ref) { 1506 var _state$modifiersData$; 1507 1508 var state = _ref.state, 1509 name = _ref.name, 1510 options = _ref.options; 1511 var arrowElement = state.elements.arrow; 1512 var popperOffsets = state.modifiersData.popperOffsets; 1513 var basePlacement = getBasePlacement(state.placement); 1514 var axis = getMainAxisFromPlacement(basePlacement); 1515 var isVertical = [left, right].indexOf(basePlacement) >= 0; 1516 var len = isVertical ? 'height' : 'width'; 1517 1518 if (!arrowElement || !popperOffsets) { 1519 return; 1520 } 1521 1522 var paddingObject = toPaddingObject(options.padding, state); 1523 var arrowRect = getLayoutRect(arrowElement); 1524 var minProp = axis === 'y' ? top : left; 1525 var maxProp = axis === 'y' ? bottom : right; 1526 var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len]; 1527 var startDiff = popperOffsets[axis] - state.rects.reference[axis]; 1528 var arrowOffsetParent = getOffsetParent(arrowElement); 1529 var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0; 1530 var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is 1531 // outside of the popper bounds 1532 1533 var min = paddingObject[minProp]; 1534 var max = clientSize - arrowRect[len] - paddingObject[maxProp]; 1535 var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference; 1536 var offset = within(min, center, max); // Prevents breaking syntax highlighting... 1537 1538 var axisProp = axis; 1539 state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$); 1540 } 1541 1542 function effect$1(_ref2) { 1543 var state = _ref2.state, 1544 options = _ref2.options; 1545 var _options$element = options.element, 1546 arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element; 1547 1548 if (arrowElement == null) { 1549 return; 1550 } // CSS selector 1551 1552 1553 if (typeof arrowElement === 'string') { 1554 arrowElement = state.elements.popper.querySelector(arrowElement); 1555 1556 if (!arrowElement) { 1557 return; 1558 } 1559 } 1560 1561 if (!contains(state.elements.popper, arrowElement)) { 1562 1563 return; 1564 } 1565 1566 state.elements.arrow = arrowElement; 1567 } // eslint-disable-next-line import/no-unused-modules 1568 1569 1570 const arrow$1 = { 1571 name: 'arrow', 1572 enabled: true, 1573 phase: 'main', 1574 fn: arrow, 1575 effect: effect$1, 1576 requires: ['popperOffsets'], 1577 requiresIfExists: ['preventOverflow'] 1578 }; 1579 1580 function getVariation(placement) { 1581 return placement.split('-')[1]; 1582 } 1583 1584 var unsetSides = { 1585 top: 'auto', 1586 right: 'auto', 1587 bottom: 'auto', 1588 left: 'auto' 1589 }; // Round the offsets to the nearest suitable subpixel based on the DPR. 1590 // Zooming can change the DPR, but it seems to report a value that will 1591 // cleanly divide the values into the appropriate subpixels. 1592 1593 function roundOffsetsByDPR(_ref) { 1594 var x = _ref.x, 1595 y = _ref.y; 1596 var win = window; 1597 var dpr = win.devicePixelRatio || 1; 1598 return { 1599 x: round(round(x * dpr) / dpr) || 0, 1600 y: round(round(y * dpr) / dpr) || 0 1601 }; 1602 } 1603 1604 function mapToStyles(_ref2) { 1605 var _Object$assign2; 1606 1607 var popper = _ref2.popper, 1608 popperRect = _ref2.popperRect, 1609 placement = _ref2.placement, 1610 variation = _ref2.variation, 1611 offsets = _ref2.offsets, 1612 position = _ref2.position, 1613 gpuAcceleration = _ref2.gpuAcceleration, 1614 adaptive = _ref2.adaptive, 1615 roundOffsets = _ref2.roundOffsets; 1616 1617 var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets, 1618 _ref3$x = _ref3.x, 1619 x = _ref3$x === void 0 ? 0 : _ref3$x, 1620 _ref3$y = _ref3.y, 1621 y = _ref3$y === void 0 ? 0 : _ref3$y; 1622 1623 var hasX = offsets.hasOwnProperty('x'); 1624 var hasY = offsets.hasOwnProperty('y'); 1625 var sideX = left; 1626 var sideY = top; 1627 var win = window; 1628 1629 if (adaptive) { 1630 var offsetParent = getOffsetParent(popper); 1631 var heightProp = 'clientHeight';
vendor: 4,274 bytes, lines 1632-1750
1632 var widthProp = 'clientWidth'; 1633 1634 if (offsetParent === getWindow(popper)) { 1635 offsetParent = getDocumentElement(popper); 1636 1637 if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') { 1638 heightProp = 'scrollHeight'; 1639 widthProp = 'scrollWidth'; 1640 } 1641 } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it 1642 1643 1644 offsetParent = offsetParent; 1645 1646 if (placement === top || (placement === left || placement === right) && variation === end) { 1647 sideY = bottom; // $FlowFixMe[prop-missing] 1648 1649 y -= offsetParent[heightProp] - popperRect.height; 1650 y *= gpuAcceleration ? 1 : -1; 1651 } 1652 1653 if (placement === left || (placement === top || placement === bottom) && variation === end) { 1654 sideX = right; // $FlowFixMe[prop-missing] 1655 1656 x -= offsetParent[widthProp] - popperRect.width; 1657 x *= gpuAcceleration ? 1 : -1; 1658 } 1659 } 1660 1661 var commonStyles = Object.assign({ 1662 position: position 1663 }, adaptive && unsetSides); 1664 1665 if (gpuAcceleration) { 1666 var _Object$assign; 1667 1668 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)); 1669 } 1670 1671 return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2)); 1672 } 1673 1674 function computeStyles(_ref4) { 1675 var state = _ref4.state, 1676 options = _ref4.options; 1677 var _options$gpuAccelerat = options.gpuAcceleration, 1678 gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, 1679 _options$adaptive = options.adaptive, 1680 adaptive = _options$adaptive === void 0 ? true : _options$adaptive, 1681 _options$roundOffsets = options.roundOffsets, 1682 roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets; 1683 1684 var commonStyles = { 1685 placement: getBasePlacement(state.placement), 1686 variation: getVariation(state.placement), 1687 popper: state.elements.popper, 1688 popperRect: state.rects.popper, 1689 gpuAcceleration: gpuAcceleration 1690 }; 1691 1692 if (state.modifiersData.popperOffsets != null) { 1693 state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, { 1694 offsets: state.modifiersData.popperOffsets, 1695 position: state.options.strategy, 1696 adaptive: adaptive, 1697 roundOffsets: roundOffsets 1698 }))); 1699 } 1700 1701 if (state.modifiersData.arrow != null) { 1702 state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, { 1703 offsets: state.modifiersData.arrow, 1704 position: 'absolute', 1705 adaptive: false, 1706 roundOffsets: roundOffsets 1707 }))); 1708 } 1709 1710 state.attributes.popper = Object.assign({}, state.attributes.popper, { 1711 'data-popper-placement': state.placement 1712 }); 1713 } // eslint-disable-next-line import/no-unused-modules 1714 1715 1716 const computeStyles$1 = { 1717 name: 'computeStyles', 1718 enabled: true, 1719 phase: 'beforeWrite', 1720 fn: computeStyles, 1721 data: {} 1722 }; 1723 1724 var passive = { 1725 passive: true 1726 }; 1727 1728 function effect(_ref) { 1729 var state = _ref.state, 1730 instance = _ref.instance, 1731 options = _ref.options; 1732 var _options$scroll = options.scroll, 1733 scroll = _options$scroll === void 0 ? true : _options$scroll, 1734 _options$resize = options.resize, 1735 resize = _options$resize === void 0 ? true : _options$resize; 1736 var window = getWindow(state.elements.popper); 1737 var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper); 1738 1739 if (scroll) { 1740 scrollParents.forEach(function (scrollParent) { 1741 scrollParent.addEventListener('scroll', instance.update, passive); 1742 }); 1743 } 1744 1745 if (resize) { 1746 window.addEventListener('resize', instance.update, passive); 1747 } 1748 1749 return function () { 1750 if (scroll) {
1751 scrollParents.forEach(function (scrollParent) { 1752 scrollParent.removeEventListener('scroll', instance.update, passive); 1753 }); 1754 } 1755 1756 if (resize) { 1757 window.removeEventListener('resize', instance.update, passive); 1758 } 1759 }; 1760 } // eslint-disable-next-line import/no-unused-modules 1761 1762 1763 const eventListeners = { 1764 name: 'eventListeners', 1765 enabled: true, 1766 phase: 'write', 1767 fn: function fn() {}, 1768 effect: effect, 1769 data: {} 1770 }; 1771 1772 var hash$1 = { 1773 left: 'right', 1774 right: 'left', 1775 bottom: 'top', 1776 top: 'bottom' 1777 }; 1778 function getOppositePlacement(placement) { 1779 return placement.replace(/left|right|bottom|top/g, function (matched) { 1780 return hash$1[matched]; 1781 }); 1782 } 1783 1784 var hash = { 1785 start: 'end', 1786 end: 'start' 1787 }; 1788 function getOppositeVariationPlacement(placement) { 1789 return placement.replace(/start|end/g, function (matched) { 1790 return hash[matched]; 1791 }); 1792 } 1793 1794 function getWindowScroll(node) { 1795 var win = getWindow(node); 1796 var scrollLeft = win.pageXOffset; 1797 var scrollTop = win.pageYOffset; 1798 return { 1799 scrollLeft: scrollLeft, 1800 scrollTop: scrollTop 1801 }; 1802 } 1803 1804 function getWindowScrollBarX(element) { 1805 // If <html> has a CSS width greater than the viewport, then this will be 1806 // incorrect for RTL. 1807 // Popper 1 is broken in this case and never had a bug report so let's assume 1808 // it's not an issue. I don't think anyone ever specifies width on <html> 1809 // anyway. 1810 // Browsers where the left scrollbar doesn't cause an issue report `0` for 1811 // this (e.g. Edge 2019, IE11, Safari) 1812 return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft; 1813 } 1814 1815 function getViewportRect(element) { 1816 var win = getWindow(element); 1817 var html = getDocumentElement(element); 1818 var visualViewport = win.visualViewport; 1819 var width = html.clientWidth; 1820 var height = html.clientHeight; 1821 var x = 0; 1822 var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper 1823 // can be obscured underneath it. 1824 // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even 1825 // if it isn't open, so if this isn't available, the popper will be detected 1826 // to overflow the bottom of the screen too early. 1827 1828 if (visualViewport) { 1829 width = visualViewport.width;
vendor: 5,262 bytes, lines 1830-1964
1830 height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently) 1831 // In Chrome, it returns a value very close to 0 (+/-) but contains rounding 1832 // errors due to floating point numbers, so we need to check precision. 1833 // Safari returns a number <= 0, usually < -1 when pinch-zoomed 1834 // Feature detection fails in mobile emulation mode in Chrome. 1835 // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < 1836 // 0.001 1837 // Fallback here: "Not Safari" userAgent 1838 1839 if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) { 1840 x = visualViewport.offsetLeft; 1841 y = visualViewport.offsetTop; 1842 } 1843 } 1844 1845 return { 1846 width: width, 1847 height: height, 1848 x: x + getWindowScrollBarX(element), 1849 y: y 1850 }; 1851 } 1852 1853 // of the `<html>` and `<body>` rect bounds if horizontally scrollable 1854 1855 function getDocumentRect(element) { 1856 var _element$ownerDocumen; 1857 1858 var html = getDocumentElement(element); 1859 var winScroll = getWindowScroll(element); 1860 var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body; 1861 var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); 1862 var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); 1863 var x = -winScroll.scrollLeft + getWindowScrollBarX(element); 1864 var y = -winScroll.scrollTop; 1865 1866 if (getComputedStyle$1(body || html).direction === 'rtl') { 1867 x += max(html.clientWidth, body ? body.clientWidth : 0) - width; 1868 } 1869 1870 return { 1871 width: width, 1872 height: height, 1873 x: x, 1874 y: y 1875 }; 1876 } 1877 1878 function isScrollParent(element) { 1879 // Firefox wants us to check `-x` and `-y` variations as well 1880 var _getComputedStyle = getComputedStyle$1(element), 1881 overflow = _getComputedStyle.overflow, 1882 overflowX = _getComputedStyle.overflowX, 1883 overflowY = _getComputedStyle.overflowY; 1884 1885 return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); 1886 } 1887 1888 function getScrollParent(node) { 1889 if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) { 1890 // $FlowFixMe[incompatible-return]: assume body is always available 1891 return node.ownerDocument.body; 1892 } 1893 1894 if (isHTMLElement(node) && isScrollParent(node)) { 1895 return node; 1896 } 1897 1898 return getScrollParent(getParentNode(node)); 1899 } 1900 1901 /* 1902 given a DOM element, return the list of all scroll parents, up the list of ancesors 1903 until we get to the top window object. This list is what we attach scroll listeners 1904 to, because if any of these parent elements scroll, we'll need to re-calculate the 1905 reference element's position. 1906 */ 1907 1908 function listScrollParents(element, list) { 1909 var _element$ownerDocumen; 1910 1911 if (list === void 0) { 1912 list = []; 1913 } 1914 1915 var scrollParent = getScrollParent(element); 1916 var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body); 1917 var win = getWindow(scrollParent); 1918 var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent; 1919 var updatedList = list.concat(target); 1920 return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here 1921 updatedList.concat(listScrollParents(getParentNode(target))); 1922 } 1923 1924 function rectToClientRect(rect) { 1925 return Object.assign({}, rect, { 1926 left: rect.x, 1927 top: rect.y, 1928 right: rect.x + rect.width, 1929 bottom: rect.y + rect.height 1930 }); 1931 } 1932 1933 function getInnerBoundingClientRect(element) { 1934 var rect = getBoundingClientRect(element); 1935 rect.top = rect.top + element.clientTop; 1936 rect.left = rect.left + element.clientLeft; 1937 rect.bottom = rect.top + element.clientHeight; 1938 rect.right = rect.left + element.clientWidth; 1939 rect.width = element.clientWidth; 1940 rect.height = element.clientHeight; 1941 rect.x = rect.left; 1942 rect.y = rect.top; 1943 return rect; 1944 } 1945 1946 function getClientRectFromMixedType(element, clippingParent) { 1947 return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element))); 1948 } // A "clipping parent" is an overflowable container with the characteristic of 1949 // clipping (or hiding) overflowing elements with a position different from 1950 // `initial` 1951 1952 1953 function getClippingParents(element) { 1954 var clippingParents = listScrollParents(getParentNode(element)); 1955 var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0; 1956 var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element; 1957 1958 if (!isElement(clipperElement)) { 1959 return []; 1960 } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414 1961 1962 1963 return clippingParents.filter(function (clippingParent) { 1964 return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body'
vendor: 5,218 bytes, lines 1964-2097
1964; 1965 }); 1966 } // Gets the maximum area that the element is visible in due to any number of 1967 // clipping parents 1968 1969 1970 function getClippingRect(element, boundary, rootBoundary) { 1971 var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary); 1972 var clippingParents = [].concat(mainClippingParents, [rootBoundary]); 1973 var firstClippingParent = clippingParents[0]; 1974 var clippingRect = clippingParents.reduce(function (accRect, clippingParent) { 1975 var rect = getClientRectFromMixedType(element, clippingParent); 1976 accRect.top = max(rect.top, accRect.top); 1977 accRect.right = min(rect.right, accRect.right); 1978 accRect.bottom = min(rect.bottom, accRect.bottom); 1979 accRect.left = max(rect.left, accRect.left); 1980 return accRect; 1981 }, getClientRectFromMixedType(element, firstClippingParent)); 1982 clippingRect.width = clippingRect.right - clippingRect.left; 1983 clippingRect.height = clippingRect.bottom - clippingRect.top; 1984 clippingRect.x = clippingRect.left; 1985 clippingRect.y = clippingRect.top; 1986 return clippingRect; 1987 } 1988 1989 function computeOffsets(_ref) { 1990 var reference = _ref.reference, 1991 element = _ref.element, 1992 placement = _ref.placement; 1993 var basePlacement = placement ? getBasePlacement(placement) : null; 1994 var variation = placement ? getVariation(placement) : null; 1995 var commonX = reference.x + reference.width / 2 - element.width / 2; 1996 var commonY = reference.y + reference.height / 2 - element.height / 2; 1997 var offsets; 1998 1999 switch (basePlacement) { 2000 case top: 2001 offsets = { 2002 x: commonX, 2003 y: reference.y - element.height 2004 }; 2005 break; 2006 2007 case bottom: 2008 offsets = { 2009 x: commonX, 2010 y: reference.y + reference.height 2011 }; 2012 break; 2013 2014 case right: 2015 offsets = { 2016 x: reference.x + reference.width, 2017 y: commonY 2018 }; 2019 break; 2020 2021 case left: 2022 offsets = { 2023 x: reference.x - element.width, 2024 y: commonY 2025 }; 2026 break; 2027 2028 default: 2029 offsets = { 2030 x: reference.x, 2031 y: reference.y 2032 }; 2033 } 2034 2035 var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null; 2036 2037 if (mainAxis != null) { 2038 var len = mainAxis === 'y' ? 'height' : 'width'; 2039 2040 switch (variation) { 2041 case start: 2042 offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2); 2043 break; 2044 2045 case end: 2046 offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2); 2047 break; 2048 } 2049 } 2050 2051 return offsets; 2052 } 2053 2054 function detectOverflow(state, options) { 2055 if (options === void 0) { 2056 options = {}; 2057 } 2058 2059 var _options = options, 2060 _options$placement = _options.placement, 2061 placement = _options$placement === void 0 ? state.placement : _options$placement, 2062 _options$boundary = _options.boundary, 2063 boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, 2064 _options$rootBoundary = _options.rootBoundary, 2065 rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, 2066 _options$elementConte = _options.elementContext, 2067 elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, 2068 _options$altBoundary = _options.altBoundary, 2069 altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, 2070 _options$padding = _options.padding, 2071 padding = _options$padding === void 0 ? 0 : _options$padding; 2072 var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); 2073 var altContext = elementContext === popper ? reference : popper; 2074 var popperRect = state.rects.popper; 2075 var element = state.elements[altBoundary ? altContext : elementContext]; 2076 var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary); 2077 var referenceClientRect = getBoundingClientRect(state.elements.reference); 2078 var popperOffsets = computeOffsets({ 2079 reference: referenceClientRect, 2080 element: popperRect, 2081 strategy: 'absolute', 2082 placement: placement 2083 }); 2084 var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets)); 2085 var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect 2086 // 0 or negative = within the clipping rect 2087 2088 var overflowOffsets = { 2089 top: clippingClientRect.top - elementClientRect.top + paddingObject.top, 2090 bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom, 2091 left: clippingClientRect.left - elementClientRect.left + paddingObject.left, 2092 right: elementClientRect.right - clippingClientRect.right + paddingObject.right 2093 }; 2094 var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element 2095 2096 if (elementContext === popper && offsetData) { 2097 var offset = offsetData[placement];
vendor: 12,183 bytes, lines 2098-2460
2098 Object.keys(overflowOffsets).forEach(function (key) { 2099 var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1; 2100 var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x'; 2101 overflowOffsets[key] += offset[axis] * multiply; 2102 }); 2103 } 2104 2105 return overflowOffsets; 2106 } 2107 2108 function computeAutoPlacement(state, options) { 2109 if (options === void 0) { 2110 options = {}; 2111 } 2112 2113 var _options = options, 2114 placement = _options.placement, 2115 boundary = _options.boundary, 2116 rootBoundary = _options.rootBoundary, 2117 padding = _options.padding, 2118 flipVariations = _options.flipVariations, 2119 _options$allowedAutoP = _options.allowedAutoPlacements, 2120 allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP; 2121 var variation = getVariation(placement); 2122 var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) { 2123 return getVariation(placement) === variation; 2124 }) : basePlacements; 2125 var allowedPlacements = placements$1.filter(function (placement) { 2126 return allowedAutoPlacements.indexOf(placement) >= 0; 2127 }); 2128 2129 if (allowedPlacements.length === 0) { 2130 allowedPlacements = placements$1; 2131 } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions... 2132 2133 2134 var overflows = allowedPlacements.reduce(function (acc, placement) { 2135 acc[placement] = detectOverflow(state, { 2136 placement: placement, 2137 boundary: boundary, 2138 rootBoundary: rootBoundary, 2139 padding: padding 2140 })[getBasePlacement(placement)]; 2141 return acc; 2142 }, {}); 2143 return Object.keys(overflows).sort(function (a, b) { 2144 return overflows[a] - overflows[b]; 2145 }); 2146 } 2147 2148 function getExpandedFallbackPlacements(placement) { 2149 if (getBasePlacement(placement) === auto) { 2150 return []; 2151 } 2152 2153 var oppositePlacement = getOppositePlacement(placement); 2154 return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)]; 2155 } 2156 2157 function flip(_ref) { 2158 var state = _ref.state, 2159 options = _ref.options, 2160 name = _ref.name; 2161 2162 if (state.modifiersData[name]._skip) { 2163 return; 2164 } 2165 2166 var _options$mainAxis = options.mainAxis, 2167 checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, 2168 _options$altAxis = options.altAxis, 2169 checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, 2170 specifiedFallbackPlacements = options.fallbackPlacements, 2171 padding = options.padding, 2172 boundary = options.boundary, 2173 rootBoundary = options.rootBoundary, 2174 altBoundary = options.altBoundary, 2175 _options$flipVariatio = options.flipVariations, 2176 flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, 2177 allowedAutoPlacements = options.allowedAutoPlacements; 2178 var preferredPlacement = state.options.placement; 2179 var basePlacement = getBasePlacement(preferredPlacement); 2180 var isBasePlacement = basePlacement === preferredPlacement; 2181 var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement)); 2182 var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) { 2183 return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, { 2184 placement: placement, 2185 boundary: boundary, 2186 rootBoundary: rootBoundary, 2187 padding: padding, 2188 flipVariations: flipVariations, 2189 allowedAutoPlacements: allowedAutoPlacements 2190 }) : placement); 2191 }, []); 2192 var referenceRect = state.rects.reference; 2193 var popperRect = state.rects.popper; 2194 var checksMap = new Map(); 2195 var makeFallbackChecks = true; 2196 var firstFittingPlacement = placements[0]; 2197 2198 for (var i = 0; i < placements.length; i++) { 2199 var placement = placements[i]; 2200 2201 var _basePlacement = getBasePlacement(placement); 2202 2203 var isStartVariation = getVariation(placement) === start; 2204 var isVertical = [top, bottom].indexOf(_basePlacement) >= 0; 2205 var len = isVertical ? 'width' : 'height'; 2206 var overflow = detectOverflow(state, { 2207 placement: placement, 2208 boundary: boundary, 2209 rootBoundary: rootBoundary, 2210 altBoundary: altBoundary, 2211 padding: padding 2212 }); 2213 var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top; 2214 2215 if (referenceRect[len] > popperRect[len]) { 2216 mainVariationSide = getOppositePlacement(mainVariationSide); 2217 } 2218 2219 var altVariationSide = getOppositePlacement(mainVariationSide); 2220 var checks = []; 2221 2222 if (checkMainAxis) { 2223 checks.push(overflow[_basePlacement] <= 0); 2224 } 2225 2226 if (checkAltAxis) { 2227 checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0); 2228 } 2229 2230 if (checks.every(function (check) { 2231 return check; 2232 })) { 2233 firstFittingPlacement = placement; 2234 makeFallbackChecks = false; 2235 break; 2236 } 2237 2238 checksMap.set(placement, checks); 2239 } 2240 2241 if (makeFallbackChecks) { 2242 // `2` may be desired in some cases – research later 2243 var numberOfChecks = flipVariations ? 3 : 1; 2244 2245 var _loop = function _loop(_i) { 2246 var fittingPlacement = placements.find(function (placement) { 2247 var checks = checksMap.get(placement); 2248 2249 if (checks) { 2250 return checks.slice(0, _i).every(function (check) { 2251 return check; 2252 }); 2253 } 2254 }); 2255 2256 if (fittingPlacement) { 2257 firstFittingPlacement = fittingPlacement; 2258 return "break"; 2259 } 2260 }; 2261 2262 for (var _i = numberOfChecks; _i > 0; _i--) { 2263 var _ret = _loop(_i); 2264 2265 if (_ret === "break") break; 2266 } 2267 } 2268 2269 if (state.placement !== firstFittingPlacement) { 2270 state.modifiersData[name]._skip = true; 2271 state.placement = firstFittingPlacement; 2272 state.reset = true; 2273 } 2274 } // eslint-disable-next-line import/no-unused-modules 2275 2276 2277 const flip$1 = { 2278 name: 'flip', 2279 enabled: true, 2280 phase: 'main', 2281 fn: flip, 2282 requiresIfExists: ['offset'], 2283 data: { 2284 _skip: false 2285 } 2286 }; 2287 2288 function getSideOffsets(overflow, rect, preventedOffsets) { 2289 if (preventedOffsets === void 0) { 2290 preventedOffsets = { 2291 x: 0, 2292 y: 0 2293 }; 2294 } 2295 2296 return { 2297 top: overflow.top - rect.height - preventedOffsets.y, 2298 right: overflow.right - rect.width + preventedOffsets.x, 2299 bottom: overflow.bottom - rect.height + preventedOffsets.y, 2300 left: overflow.left - rect.width - preventedOffsets.x 2301 }; 2302 } 2303 2304 function isAnySideFullyClipped(overflow) { 2305 return [top, right, bottom, left].some(function (side) { 2306 return overflow[side] >= 0; 2307 }); 2308 } 2309 2310 function hide(_ref) { 2311 var state = _ref.state, 2312 name = _ref.name; 2313 var referenceRect = state.rects.reference; 2314 var popperRect = state.rects.popper; 2315 var preventedOffsets = state.modifiersData.preventOverflow; 2316 var referenceOverflow = detectOverflow(state, { 2317 elementContext: 'reference' 2318 }); 2319 var popperAltOverflow = detectOverflow(state, { 2320 altBoundary: true 2321 }); 2322 var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect); 2323 var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets); 2324 var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets); 2325 var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets); 2326 state.modifiersData[name] = { 2327 referenceClippingOffsets: referenceClippingOffsets, 2328 popperEscapeOffsets: popperEscapeOffsets, 2329 isReferenceHidden: isReferenceHidden, 2330 hasPopperEscaped: hasPopperEscaped 2331 }; 2332 state.attributes.popper = Object.assign({}, state.attributes.popper, { 2333 'data-popper-reference-hidden': isReferenceHidden, 2334 'data-popper-escaped': hasPopperEscaped 2335 }); 2336 } // eslint-disable-next-line import/no-unused-modules 2337 2338 2339 const hide$1 = { 2340 name: 'hide', 2341 enabled: true, 2342 phase: 'main', 2343 requiresIfExists: ['preventOverflow'], 2344 fn: hide 2345 }; 2346 2347 function distanceAndSkiddingToXY(placement, rects, offset) { 2348 var basePlacement = getBasePlacement(placement); 2349 var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1; 2350 2351 var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, { 2352 placement: placement 2353 })) : offset, 2354 skidding = _ref[0], 2355 distance = _ref[1]; 2356 2357 skidding = skidding || 0; 2358 distance = (distance || 0) * invertDistance; 2359 return [left, right].indexOf(basePlacement) >= 0 ? { 2360 x: distance, 2361 y: skidding 2362 } : { 2363 x: skidding, 2364 y: distance 2365 }; 2366 } 2367 2368 function offset(_ref2) { 2369 var state = _ref2.state, 2370 options = _ref2.options, 2371 name = _ref2.name; 2372 var _options$offset = options.offset, 2373 offset = _options$offset === void 0 ? [0, 0] : _options$offset; 2374 var data = placements.reduce(function (acc, placement) { 2375 acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset); 2376 return acc; 2377 }, {}); 2378 var _data$state$placement = data[state.placement], 2379 x = _data$state$placement.x, 2380 y = _data$state$placement.y; 2381 2382 if (state.modifiersData.popperOffsets != null) { 2383 state.modifiersData.popperOffsets.x += x; 2384 state.modifiersData.popperOffsets.y += y; 2385 } 2386 2387 state.modifiersData[name] = data; 2388 } // eslint-disable-next-line import/no-unused-modules 2389 2390 2391 const offset$1 = { 2392 name: 'offset', 2393 enabled: true, 2394 phase: 'main', 2395 requires: ['popperOffsets'], 2396 fn: offset 2397 }; 2398 2399 function popperOffsets(_ref) { 2400 var state = _ref.state, 2401 name = _ref.name; 2402 // Offsets are the actual position the popper needs to have to be 2403 // properly positioned near its reference element 2404 // This is the most basic placement, and will be adjusted by 2405 // the modifiers in the next step 2406 state.modifiersData[name] = computeOffsets({ 2407 reference: state.rects.reference, 2408 element: state.rects.popper, 2409 strategy: 'absolute', 2410 placement: state.placement 2411 }); 2412 } // eslint-disable-next-line import/no-unused-modules 2413 2414 2415 const popperOffsets$1 = { 2416 name: 'popperOffsets', 2417 enabled: true, 2418 phase: 'read', 2419 fn: popperOffsets, 2420 data: {} 2421 }; 2422 2423 function getAltAxis(axis) { 2424 return axis === 'x' ? 'y' : 'x'; 2425 } 2426 2427 function preventOverflow(_ref) { 2428 var state = _ref.state, 2429 options = _ref.options, 2430 name = _ref.name; 2431 var _options$mainAxis = options.mainAxis, 2432 checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, 2433 _options$altAxis = options.altAxis, 2434 checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, 2435 boundary = options.boundary, 2436 rootBoundary = options.rootBoundary, 2437 altBoundary = options.altBoundary, 2438 padding = options.padding, 2439 _options$tether = options.tether, 2440 tether = _options$tether === void 0 ? true : _options$tether, 2441 _options$tetherOffset = options.tetherOffset, 2442 tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset; 2443 var overflow = detectOverflow(state, { 2444 boundary: boundary, 2445 rootBoundary: rootBoundary, 2446 padding: padding, 2447 altBoundary: altBoundary 2448 }); 2449 var basePlacement = getBasePlacement(state.placement); 2450 var variation = getVariation(state.placement); 2451 var isBasePlacement = !variation; 2452 var mainAxis = getMainAxisFromPlacement(basePlacement); 2453 var altAxis = getAltAxis(mainAxis); 2454 var popperOffsets = state.modifiersData.popperOffsets; 2455 var referenceRect = state.rects.reference; 2456 var popperRect = state.rects.popper; 2457 var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, { 2458 placement: state.placement 2459 })) : tetherOffset; 2460 var
vendor: 962 bytes, lines 2460-2485
2460data = { 2461 x: 0, 2462 y: 0 2463 }; 2464 2465 if (!popperOffsets) { 2466 return; 2467 } 2468 2469 if (checkMainAxis || checkAltAxis) { 2470 var mainSide = mainAxis === 'y' ? top : left; 2471 var altSide = mainAxis === 'y' ? bottom : right; 2472 var len = mainAxis === 'y' ? 'height' : 'width'; 2473 var offset = popperOffsets[mainAxis]; 2474 var min$1 = popperOffsets[mainAxis] + overflow[mainSide]; 2475 var max$1 = popperOffsets[mainAxis] - overflow[altSide]; 2476 var additive = tether ? -popperRect[len] / 2 : 0; 2477 var minLen = variation === start ? referenceRect[len] : popperRect[len]; 2478 var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go 2479 // outside the reference bounds 2480 2481 var arrowElement = state.elements.arrow; 2482 var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { 2483 width: 0, 2484 height: 0 2485 };
vendor: 4,704 bytes, lines 2486-2607
2486 var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject(); 2487 var arrowPaddingMin = arrowPaddingObject[mainSide]; 2488 var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want 2489 // to include its full size in the calculation. If the reference is small 2490 // and near the edge of a boundary, the popper can overflow even if the 2491 // reference is not overflowing as well (e.g. virtual elements with no 2492 // width or height) 2493 2494 var arrowLen = within(0, referenceRect[len], arrowRect[len]); 2495 var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue; 2496 var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue; 2497 var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow); 2498 var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; 2499 var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0; 2500 var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset; 2501 var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue; 2502 2503 if (checkMainAxis) { 2504 var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1); 2505 popperOffsets[mainAxis] = preventedOffset; 2506 data[mainAxis] = preventedOffset - offset; 2507 } 2508 2509 if (checkAltAxis) { 2510 var _mainSide = mainAxis === 'x' ? top : left; 2511 2512 var _altSide = mainAxis === 'x' ? bottom : right; 2513 2514 var _offset = popperOffsets[altAxis]; 2515 2516 var _min = _offset + overflow[_mainSide]; 2517 2518 var _max = _offset - overflow[_altSide]; 2519 2520 var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max); 2521 2522 popperOffsets[altAxis] = _preventedOffset; 2523 data[altAxis] = _preventedOffset - _offset; 2524 } 2525 } 2526 2527 state.modifiersData[name] = data; 2528 } // eslint-disable-next-line import/no-unused-modules 2529 2530 2531 const preventOverflow$1 = { 2532 name: 'preventOverflow', 2533 enabled: true, 2534 phase: 'main', 2535 fn: preventOverflow, 2536 requiresIfExists: ['offset'] 2537 }; 2538 2539 function getHTMLElementScroll(element) { 2540 return { 2541 scrollLeft: element.scrollLeft, 2542 scrollTop: element.scrollTop 2543 }; 2544 } 2545 2546 function getNodeScroll(node) { 2547 if (node === getWindow(node) || !isHTMLElement(node)) { 2548 return getWindowScroll(node); 2549 } else { 2550 return getHTMLElementScroll(node); 2551 } 2552 } 2553 2554 function isElementScaled(element) { 2555 var rect = element.getBoundingClientRect(); 2556 var scaleX = rect.width / element.offsetWidth || 1; 2557 var scaleY = rect.height / element.offsetHeight || 1; 2558 return scaleX !== 1 || scaleY !== 1; 2559 } // Returns the composite rect of an element relative to its offsetParent. 2560 // Composite means it takes into account transforms as well as layout. 2561 2562 2563 function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) { 2564 if (isFixed === void 0) { 2565 isFixed = false; 2566 } 2567 2568 var isOffsetParentAnElement = isHTMLElement(offsetParent); 2569 isHTMLElement(offsetParent) && isElementScaled(offsetParent); 2570 var documentElement = getDocumentElement(offsetParent); 2571 var rect = getBoundingClientRect(elementOrVirtualElement); 2572 var scroll = { 2573 scrollLeft: 0, 2574 scrollTop: 0 2575 }; 2576 var offsets = { 2577 x: 0, 2578 y: 0 2579 }; 2580 2581 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 2582 if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078 2583 isScrollParent(documentElement)) { 2584 scroll = getNodeScroll(offsetParent); 2585 } 2586 2587 if (isHTMLElement(offsetParent)) { 2588 offsets = getBoundingClientRect(offsetParent); 2589 offsets.x += offsetParent.clientLeft; 2590 offsets.y += offsetParent.clientTop; 2591 } else if (documentElement) { 2592 offsets.x = getWindowScrollBarX(documentElement); 2593 } 2594 } 2595 2596 return { 2597 x: rect.left + scroll.scrollLeft - offsets.x, 2598 y: rect.top + scroll.scrollTop - offsets.y, 2599 width: rect.width, 2600 height: rect.height 2601 }; 2602 } 2603 2604 function order(modifiers) { 2605 var map = new Map(); 2606 var visited = new Set(); 2607 var result = [];
vendor: 11,066 bytes, lines 2608-2937
2608 modifiers.forEach(function (modifier) { 2609 map.set(modifier.name, modifier); 2610 }); // On visiting object, check for its dependencies and visit them recursively 2611 2612 function sort(modifier) { 2613 visited.add(modifier.name); 2614 var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []); 2615 requires.forEach(function (dep) { 2616 if (!visited.has(dep)) { 2617 var depModifier = map.get(dep); 2618 2619 if (depModifier) { 2620 sort(depModifier); 2621 } 2622 } 2623 }); 2624 result.push(modifier); 2625 } 2626 2627 modifiers.forEach(function (modifier) { 2628 if (!visited.has(modifier.name)) { 2629 // check for visited object 2630 sort(modifier); 2631 } 2632 }); 2633 return result; 2634 } 2635 2636 function orderModifiers(modifiers) { 2637 // order based on dependencies 2638 var orderedModifiers = order(modifiers); // order based on phase 2639 2640 return modifierPhases.reduce(function (acc, phase) { 2641 return acc.concat(orderedModifiers.filter(function (modifier) { 2642 return modifier.phase === phase; 2643 })); 2644 }, []); 2645 } 2646 2647 function debounce(fn) { 2648 var pending; 2649 return function () { 2650 if (!pending) { 2651 pending = new Promise(function (resolve) { 2652 Promise.resolve().then(function () { 2653 pending = undefined; 2654 resolve(fn()); 2655 }); 2656 }); 2657 } 2658 2659 return pending; 2660 }; 2661 } 2662 2663 function mergeByName(modifiers) { 2664 var merged = modifiers.reduce(function (merged, current) { 2665 var existing = merged[current.name]; 2666 merged[current.name] = existing ? Object.assign({}, existing, current, { 2667 options: Object.assign({}, existing.options, current.options), 2668 data: Object.assign({}, existing.data, current.data) 2669 }) : current; 2670 return merged; 2671 }, {}); // IE11 does not support Object.values 2672 2673 return Object.keys(merged).map(function (key) { 2674 return merged[key]; 2675 }); 2676 } 2677 2678 var DEFAULT_OPTIONS = { 2679 placement: 'bottom', 2680 modifiers: [], 2681 strategy: 'absolute' 2682 }; 2683 2684 function areValidElements() { 2685 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 2686 args[_key] = arguments[_key]; 2687 } 2688 2689 return !args.some(function (element) { 2690 return !(element && typeof element.getBoundingClientRect === 'function'); 2691 }); 2692 } 2693 2694 function popperGenerator(generatorOptions) { 2695 if (generatorOptions === void 0) { 2696 generatorOptions = {}; 2697 } 2698 2699 var _generatorOptions = generatorOptions, 2700 _generatorOptions$def = _generatorOptions.defaultModifiers, 2701 defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, 2702 _generatorOptions$def2 = _generatorOptions.defaultOptions, 2703 defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2; 2704 return function createPopper(reference, popper, options) { 2705 if (options === void 0) { 2706 options = defaultOptions; 2707 } 2708 2709 var state = { 2710 placement: 'bottom', 2711 orderedModifiers: [], 2712 options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions), 2713 modifiersData: {}, 2714 elements: { 2715 reference: reference, 2716 popper: popper 2717 }, 2718 attributes: {}, 2719 styles: {} 2720 }; 2721 var effectCleanupFns = []; 2722 var isDestroyed = false; 2723 var instance = { 2724 state: state, 2725 setOptions: function setOptions(setOptionsAction) { 2726 var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction; 2727 cleanupModifierEffects(); 2728 state.options = Object.assign({}, defaultOptions, state.options, options); 2729 state.scrollParents = { 2730 reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [], 2731 popper: listScrollParents(popper) 2732 }; // Orders the modifiers based on their dependencies and `phase` 2733 // properties 2734 2735 var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers 2736 2737 state.orderedModifiers = orderedModifiers.filter(function (m) { 2738 return m.enabled; 2739 }); // Validate the provided modifiers so that the consumer will get warned 2740 2741 runModifierEffects(); 2742 return instance.update(); 2743 }, 2744 // Sync update – it will always be executed, even if not necessary. This 2745 // is useful for low frequency updates where sync behavior simplifies the 2746 // logic. 2747 // For high frequency updates (e.g. `resize` and `scroll` events), always 2748 // prefer the async Popper#update method 2749 forceUpdate: function forceUpdate() { 2750 if (isDestroyed) { 2751 return; 2752 } 2753 2754 var _state$elements = state.elements, 2755 reference = _state$elements.reference, 2756 popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements 2757 // anymore 2758 2759 if (!areValidElements(reference, popper)) { 2760 2761 return; 2762 } // Store the reference and popper rects to be read by modifiers 2763 2764 2765 state.rects = { 2766 reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'), 2767 popper: getLayoutRect(popper) 2768 }; // Modifiers have the ability to reset the current update cycle. The 2769 // most common use case for this is the `flip` modifier changing the 2770 // placement, which then needs to re-run all the modifiers, because the 2771 // logic was previously ran for the previous placement and is therefore 2772 // stale/incorrect 2773 2774 state.reset = false; 2775 state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier 2776 // is filled with the initial data specified by the modifier. This means 2777 // it doesn't persist and is fresh on each update. 2778 // To ensure persistent data, use `${name}#persistent` 2779 2780 state.orderedModifiers.forEach(function (modifier) { 2781 return state.modifiersData[modifier.name] = Object.assign({}, modifier.data); 2782 }); 2783 2784 for (var index = 0; index < state.orderedModifiers.length; index++) { 2785 2786 if (state.reset === true) { 2787 state.reset = false; 2788 index = -1; 2789 continue; 2790 } 2791 2792 var _state$orderedModifie = state.orderedModifiers[index], 2793 fn = _state$orderedModifie.fn, 2794 _state$orderedModifie2 = _state$orderedModifie.options, 2795 _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, 2796 name = _state$orderedModifie.name; 2797 2798 if (typeof fn === 'function') { 2799 state = fn({ 2800 state: state, 2801 options: _options, 2802 name: name, 2803 instance: instance 2804 }) || state; 2805 } 2806 } 2807 }, 2808 // Async and optimistically optimized update – it will not be executed if 2809 // not necessary (debounced to run at most once-per-tick) 2810 update: debounce(function () { 2811 return new Promise(function (resolve) { 2812 instance.forceUpdate(); 2813 resolve(state); 2814 }); 2815 }), 2816 destroy: function destroy() { 2817 cleanupModifierEffects(); 2818 isDestroyed = true; 2819 } 2820 }; 2821 2822 if (!areValidElements(reference, popper)) { 2823 2824 return instance; 2825 } 2826 2827 instance.setOptions(options).then(function (state) { 2828 if (!isDestroyed && options.onFirstUpdate) { 2829 options.onFirstUpdate(state); 2830 } 2831 }); // Modifiers have the ability to execute arbitrary code before the first 2832 // update cycle runs. They will be executed in the same order as the update 2833 // cycle. This is useful when a modifier adds some persistent data that 2834 // other modifiers need to use, but the modifier is run after the dependent 2835 // one. 2836 2837 function runModifierEffects() { 2838 state.orderedModifiers.forEach(function (_ref3) { 2839 var name = _ref3.name, 2840 _ref3$options = _ref3.options, 2841 options = _ref3$options === void 0 ? {} : _ref3$options, 2842 effect = _ref3.effect; 2843 2844 if (typeof effect === 'function') { 2845 var cleanupFn = effect({ 2846 state: state, 2847 name: name, 2848 instance: instance, 2849 options: options 2850 }); 2851 2852 var noopFn = function noopFn() {}; 2853 2854 effectCleanupFns.push(cleanupFn || noopFn); 2855 } 2856 }); 2857 } 2858 2859 function cleanupModifierEffects() { 2860 effectCleanupFns.forEach(function (fn) { 2861 return fn(); 2862 }); 2863 effectCleanupFns = []; 2864 } 2865 2866 return instance; 2867 }; 2868 } 2869 var createPopper$2 = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules 2870 2871 var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1]; 2872 var createPopper$1 = /*#__PURE__*/popperGenerator({ 2873 defaultModifiers: defaultModifiers$1 2874 }); // eslint-disable-next-line import/no-unused-modules 2875 2876 var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1]; 2877 var createPopper = /*#__PURE__*/popperGenerator({ 2878 defaultModifiers: defaultModifiers 2879 }); // eslint-disable-next-line import/no-unused-modules 2880 2881 const Popper = /*#__PURE__*/Object.freeze({ 2882 __proto__: null, 2883 popperGenerator, 2884 detectOverflow, 2885 createPopperBase: createPopper$2, 2886 createPopper, 2887 createPopperLite: createPopper$1, 2888 top, 2889 bottom, 2890 right, 2891 left, 2892 auto, 2893 basePlacements, 2894 start, 2895 end, 2896 clippingParents, 2897 viewport, 2898 popper, 2899 reference, 2900 variationPlacements, 2901 placements, 2902 beforeRead, 2903 read, 2904 afterRead, 2905 beforeMain, 2906 main, 2907 afterMain, 2908 beforeWrite, 2909 write, 2910 afterWrite, 2911 modifierPhases, 2912 applyStyles: applyStyles$1, 2913 arrow: arrow$1, 2914 computeStyles: computeStyles$1, 2915 eventListeners, 2916 flip: flip$1, 2917 hide: hide$1, 2918 offset: offset$1, 2919 popperOffsets: popperOffsets$1, 2920 preventOverflow: preventOverflow$1 2921 }); 2922 2923 /** 2924 * -------------------------------------------------------------------------- 2925 * Bootstrap (v5.1.3): dropdown.js 2926 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2927 * -------------------------------------------------------------------------- 2928 */ 2929 /** 2930 * ------------------------------------------------------------------------ 2931 * Constants 2932 * ------------------------------------------------------------------------ 2933 */ 2934 2935 const NAME$9 = 'dropdown'; 2936 const DATA_KEY$8 = 'bs.dropdown'; 2937 const EVENT_KEY$8 = `.${DATA_KEY$8}`;
2938 const DATA_API_KEY$4 = '.data-api'; 2939 const ESCAPE_KEY$2 = 'Escape'; 2940 const SPACE_KEY = 'Space'; 2941 const TAB_KEY$1 = 'Tab'; 2942 const ARROW_UP_KEY = 'ArrowUp'; 2943 const ARROW_DOWN_KEY = 'ArrowDown'; 2944 const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button 2945 2946 const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`); 2947 const EVENT_HIDE$4 = `hide${EVENT_KEY$8}`; 2948 const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`; 2949 const EVENT_SHOW$4 = `show${EVENT_KEY$8}`; 2950 const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`; 2951 const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$8}${DATA_API_KEY$4}`; 2952 const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$8}${DATA_API_KEY$4}`; 2953 const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$8}${DATA_API_KEY$4}`; 2954 const CLASS_NAME_SHOW$6 = 'show'; 2955 const CLASS_NAME_DROPUP = 'dropup'; 2956 const CLASS_NAME_DROPEND = 'dropend'; 2957 const CLASS_NAME_DROPSTART = 'dropstart'; 2958 const CLASS_NAME_NAVBAR = 'navbar'; 2959 const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]'; 2960 const SELECTOR_MENU = '.dropdown-menu'; 2961 const SELECTOR_NAVBAR_NAV = '.navvduyurubar-nav'; 2962 const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; 2963 const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'; 2964 const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'; 2965 const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'; 2966 const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; 2967 const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; 2968 const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; 2969 const Default$8 = { 2970 offset: [0, 2], 2971 boundary: 'clippingParents', 2972 reference: 'toggle', 2973 display: 'dynamic', 2974 popperConfig: null, 2975 autoClose: true 2976 }; 2977 const DefaultType$8 = { 2978 offset: '(array|string|function)', 2979 boundary: '(string|element)', 2980 reference: '(string|element|object)', 2981 display: 'string', 2982 popperConfig: '(null|object|function)', 2983 autoClose: '(boolean|string)' 2984 }; 2985 /** 2986 * ------------------------------------------------------------------------ 2987 * Class Definition 2988 * ------------------------------------------------------------------------ 2989 */ 2990 2991 class Dropdown extends BaseComponent { 2992 constructor(element, config) { 2993 super(element); 2994 this._popper = null; 2995 this._config = this._getConfig(config); 2996 this._menu = this._getMenuElement(); 2997 this._inNavbar = this._detectNavbar(); 2998 } // Getters 2999 3000 3001 static get Default() { 3002 return Default$8; 3003 } 3004 3005 static get DefaultType() { 3006 return DefaultType$8; 3007 } 3008 3009 static get NAME() { 3010 return NAME$9; 3011 } // Public 3012 3013 3014 toggle() { 3015 return this._isShown() ? this.hide() : this.show(); 3016 } 3017 3018 show() { 3019 if (isDisabled(this._element) || this._isShown(this._menu)) { 3020 return; 3021 } 3022 3023 const relatedTarget = { 3024 relatedTarget: this._element 3025 }; 3026 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget); 3027 3028 if (showEvent.defaultPrevented) { 3029 return; 3030 } 3031 3032 const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar 3033 3034 if (this._inNavbar) { 3035 Manipulator.setDataAttribute(this._menu, 'popper', 'none'); 3036 } else { 3037 this._createPopper(parent); 3038 } // If this is a touch-enabled device we add extra 3039 // empty mouseover listeners to the body's immediate children; 3040 // only needed because of broken event delegation on iOS 3041 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 3042 3043 3044 if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) { 3045 [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop)); 3046 } 3047 3048 this._element.focus(); 3049 3050 this._element.setAttribute('aria-expanded', true); 3051 3052 this._menu.classList.add(CLASS_NAME_SHOW$6); 3053 3054 this._element.classList.add(CLASS_NAME_SHOW$6); 3055 3056 EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget); 3057 } 3058 3059 hide() { 3060 if (isDisabled(this._element) || !this._isShown(this._menu)) { 3061 return; 3062 } 3063 3064 const relatedTarget = { 3065 relatedTarget: this._element 3066 }; 3067 3068 this._completeHide(relatedTarget); 3069 } 3070 3071 dispose() { 3072 if (this._popper) { 3073 this._popper.destroy(); 3074 } 3075 3076 super.dispose(); 3077 } 3078 3079 update() { 3080 this._inNavbar = this._detectNavbar(); 3081 3082 if (this._popper) {
3083 this._popper.update(); 3084 } 3085 } // Private 3086 3087 3088 _completeHide(relatedTarget) { 3089 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget); 3090 3091 if (hideEvent.defaultPrevented) { 3092 return; 3093 } // If this is a touch-enabled device we remove the extra 3094 // empty mouseover listeners we added for iOS support 3095 3096 3097 if ('ontouchstart' in document.documentElement) { 3098 [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop)); 3099 } 3100 3101 if (this._popper) { 3102 this._popper.destroy(); 3103 } 3104 3105 this._menu.classList.remove(CLASS_NAME_SHOW$6); 3106 3107 this._element.classList.remove(CLASS_NAME_SHOW$6); 3108 3109 this._element.setAttribute('aria-expanded', 'false'); 3110 3111 Manipulator.removeDataAttribute(this._menu, 'popper'); 3112 EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget); 3113 } 3114 3115 _getConfig(config) { 3116 config = { ...this.constructor.Default, 3117 ...Manipulator.getDataAttributes(this._element), 3118 ...config 3119 }; 3120 typeCheckConfig(NAME$9, config, this.constructor.DefaultType); 3121 3122 if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { 3123 // Popper virtual elements require a getBoundingClientRect method 3124 throw new TypeError(`${NAME$9.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); 3125 } 3126 3127 return config; 3128 } 3129 3130 _createPopper(parent) { 3131 if (typeof Popper === 'undefined') { 3132 throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); 3133 } 3134 3135 let referenceElement = this._element; 3136 3137 if (this._config.reference === 'parent') { 3138 referenceElement = parent; 3139 } else if (isElement$1(this._config.reference)) { 3140 referenceElement = getElement(this._config.reference); 3141 } else if (typeof this._config.reference === 'object') { 3142 referenceElement = this._config.reference; 3143 } 3144 3145 const popperConfig = this._getPopperConfig(); 3146 3147 const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false); 3148 this._popper = createPopper(referenceElement, this._menu, popperConfig); 3149 3150 if (isDisplayStatic) { 3151 Manipulator.setDataAttribute(this._menu, 'popper', 'static'); 3152 } 3153 } 3154 3155 _isShown(element = this._element) { 3156 return element.classList.contains(CLASS_NAME_SHOW$6); 3157 } 3158 3159 _getMenuElement() { 3160 return SelectorEngine.next(this._element, SELECTOR_MENU)[0]; 3161 } 3162 3163 _getPlacement() { 3164 const parentDropdown = this._element.parentNode; 3165 3166 if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { 3167 return PLACEMENT_RIGHT; 3168 } 3169 3170 if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { 3171 return PLACEMENT_LEFT; 3172 } // We need to trim the value because custom properties can also include spaces 3173 3174 3175 const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; 3176 3177 if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { 3178 return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP; 3179 } 3180 3181 return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM; 3182 } 3183 3184 _detectNavbar() { 3185 return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null; 3186 } 3187 3188 _getOffset() { 3189 const { 3190 offset 3191 } = this._config; 3192 3193 if (typeof offset === 'string') { 3194 return offset.split(',').map(val => Number.parseInt(val, 10)); 3195 } 3196 3197 if (typeof offset === 'function') { 3198 return popperData => offset(popperData, this._element); 3199 } 3200 3201 return offset; 3202 } 3203 3204 _getPopperConfig() { 3205 const defaultBsPopperConfig = { 3206 placement: this._getPlacement(), 3207 modifiers: [{ 3208 name: 'preventOverflow', 3209 options: { 3210 boundary: this._config.boundary 3211 } 3212 }, { 3213 name: 'offset', 3214 options: { 3215 offset: this._getOffset() 3216 } 3217 }] 3218 }; // Disable Popper if we have a static display 3219 3220 if (this._config.display === 'static') { 3221 defaultBsPopperConfig.modifiers = [{ 3222 name: 'applyStyles', 3223 enabled: false 3224 }]; 3225 } 3226 3227 return { ...defaultBsPopperConfig, 3228 ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) 3229 }; 3230 } 3231 3232 _selectMenuItem({ 3233 key, 3234 target 3235 }) { 3236 const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible); 3237 3238 if (!items.length) { 3239 return; 3240 } // if target isn't included in items (e.g. when expanding the dropdown) 3241 // allow cycling to get the last item in case key equals ARROW_UP_KEY 3242 3243 3244 getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus(); 3245 } // Static 3246 3247 3248 static jQueryInterface(config) { 3249 return this.each(function () { 3250 const data = Dropdown.getOrCreateInstance(this, config); 3251 3252 if (typeof config !== 'string') { 3253 return; 3254 } 3255 3256 if (typeof data[config] === 'undefined') {
3257 throw new TypeError(`No method named "${config}"`); 3258 } 3259 3260 data[config](); 3261 }); 3262 } 3263 3264 static clearMenus(event) { 3265 if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) { 3266 return; 3267 } 3268 3269 const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3); 3270 3271 for (let i = 0, len = toggles.length; i < len; i++) { 3272 const context = Dropdown.getInstance(toggles[i]); 3273 3274 if (!context || context._config.autoClose === false) { 3275 continue; 3276 } 3277 3278 if (!context._isShown()) { 3279 continue; 3280 } 3281 3282 const relatedTarget = { 3283 relatedTarget: context._element 3284 }; 3285 3286 if (event) { 3287 const composedPath = event.composedPath(); 3288 const isMenuTarget = composedPath.includes(context._menu); 3289 3290 if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) { 3291 continue; 3292 } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu 3293 3294 3295 if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) { 3296 continue; 3297 } 3298 3299 if (event.type === 'click') { 3300 relatedTarget.clickEvent = event; 3301 } 3302 } 3303 3304 context._completeHide(relatedTarget); 3305 } 3306 } 3307 3308 static getParentFromElement(element) { 3309 return getElementFromSelector(element) || element.parentNode; 3310 } 3311 3312 static dataApiKeydownHandler(event) { 3313 // If not input/textarea: 3314 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 3315 // If input/textarea: 3316 // - If space key => not a dropdown command 3317 // - If key is other than escape 3318 // - If key is not up or down => not a dropdown command 3319 // - If trigger inside the menu => not a dropdown command 3320 if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) { 3321 return; 3322 } 3323 3324 const isActive = this.classList.contains(CLASS_NAME_SHOW$6); 3325 3326 if (!isActive && event.key === ESCAPE_KEY$2) { 3327 return; 3328 } 3329 3330 event.preventDefault(); 3331 event.stopPropagation(); 3332 3333 if (isDisabled(this)) { 3334 return; 3335 } 3336 3337 const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; 3338 const instance = Dropdown.getOrCreateInstance(getToggleButton); 3339 3340 if (event.key === ESCAPE_KEY$2) { 3341 instance.hide(); 3342 return; 3343 } 3344 3345 if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) { 3346 if (!isActive) { 3347 instance.show(); 3348 } 3349 3350 instance._selectMenuItem(event); 3351 3352 return; 3353 } 3354 3355 if (!isActive || event.key === SPACE_KEY) { 3356 Dropdown.clearMenus(); 3357 } 3358 } 3359 3360 } 3361 /** 3362 * ------------------------------------------------------------------------ 3363 * Data Api implementation 3364 * ------------------------------------------------------------------------ 3365 */ 3366 3367 3368 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler); 3369 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); 3370 EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus); 3371 EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); 3372 EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { 3373 event.preventDefault(); 3374 Dropdown.getOrCreateInstance(this).toggle(); 3375 }); 3376 /** 3377 * ------------------------------------------------------------------------ 3378 * jQuery 3379 * ------------------------------------------------------------------------ 3380 * add .Dropdown to jQuery only if jQuery is present 3381 */ 3382 3383 defineJQueryPlugin(Dropdown); 3384 3385 /** 3386 * -------------------------------------------------------------------------- 3387 * Bootstrap (v5.1.3): util/scrollBar.js 3388 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3389 * -------------------------------------------------------------------------- 3390 */ 3391 const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 3392 const SELECTOR_STICKY_CONTENT = '.sticky-top'; 3393 3394 class ScrollBarHelper { 3395 constructor() { 3396 this._element = document.body; 3397 } 3398 3399 getWidth() { 3400 // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes 3401 const documentWidth = document.documentElement.clientWidth; 3402 return Math.abs(window.innerWidth - documentWidth); 3403 } 3404 3405 hide() { 3406 const width = this.getWidth(); 3407 3408 this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width 3409 3410 3411 this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width);
3411 // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth 3412 3413 3414 this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width); 3415 3416 this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width); 3417 } 3418 3419 _disableOverFlow() { 3420 this._saveInitialAttribute(this._element, 'overflow'); 3421 3422 this._element.style.overflow = 'hidden'; 3423 } 3424 3425 _setElementAttributes(selector, styleProp, callback) { 3426 const scrollbarWidth = this.getWidth(); 3427 3428 const manipulationCallBack = element => { 3429 if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) { 3430 return; 3431 } 3432 3433 this._saveInitialAttribute(element, styleProp); 3434 3435 const calculatedValue = window.getComputedStyle(element)[styleProp]; 3436 element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`; 3437 }; 3438 3439 this._applyManipulationCallback(selector, manipulationCallBack); 3440 } 3441 3442 reset() { 3443 this._resetElementAttributes(this._element, 'overflow'); 3444 3445 this._resetElementAttributes(this._element, 'paddingRight'); 3446 3447 this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight'); 3448 3449 this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight'); 3450 } 3451 3452 _saveInitialAttribute(element, styleProp) { 3453 const actualValue = element.style[styleProp]; 3454 3455 if (actualValue) { 3456 Manipulator.setDataAttribute(element, styleProp, actualValue); 3457 } 3458 } 3459 3460 _resetElementAttributes(selector, styleProp) { 3461 const manipulationCallBack = element => { 3462 const value = Manipulator.getDataAttribute(element, styleProp); 3463 3464 if (typeof value === 'undefined') { 3465 element.style.removeProperty(styleProp); 3466 } else { 3467 Manipulator.removeDataAttribute(element, styleProp); 3468 element.style[styleProp] = value; 3469 } 3470 }; 3471 3472 this._applyManipulationCallback(selector, manipulationCallBack); 3473 } 3474 3475 _applyManipulationCallback(selector, callBack) { 3476 if (isElement$1(selector)) { 3477 callBack(selector); 3478 } else { 3479 SelectorEngine.find(selector, this._element).forEach(callBack); 3480 } 3481 } 3482 3483 isOverflowing() { 3484 return this.getWidth() > 0; 3485 } 3486 3487 } 3488 3489 /** 3490 * -------------------------------------------------------------------------- 3491 * Bootstrap (v5.1.3): util/backdrop.js 3492 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3493 * -------------------------------------------------------------------------- 3494 */ 3495 const Default$7 = { 3496 className: 'modal-backdrop', 3497 isVisible: true, 3498 // if false, we use the backdrop helper without adding any element to the dom 3499 isAnimated: false, 3500 rootElement: 'body', 3501 // give the choice to place backdrop under different elements 3502 clickCallback: null 3503 }; 3504 const DefaultType$7 = { 3505 className: 'string', 3506 isVisible: 'boolean', 3507 isAnimated: 'boolean', 3508 rootElement: '(element|string)', 3509 clickCallback: '(function|null)' 3510 }; 3511 const NAME$8 = 'backdrop'; 3512 const CLASS_NAME_FADE$4 = 'fade';
3513 const CLASS_NAME_SHOW$5 = 'show'; 3514 const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$8}`; 3515 3516 class Backdrop { 3517 constructor(config) { 3518 this._config = this._getConfig(config); 3519 this._isAppended = false; 3520 this._element = null; 3521 } 3522 3523 show(callback) { 3524 if (!this._config.isVisible) { 3525 execute(callback); 3526 return; 3527 } 3528 3529 this._append(); 3530 3531 if (this._config.isAnimated) { 3532 reflow(this._getElement()); 3533 } 3534 3535 this._getElement().classList.add(CLASS_NAME_SHOW$5); 3536 3537 this._emulateAnimation(() => { 3538 execute(callback); 3539 }); 3540 } 3541 3542 hide(callback) { 3543 if (!this._config.isVisible) { 3544 execute(callback); 3545 return; 3546 } 3547 3548 this._getElement().classList.remove(CLASS_NAME_SHOW$5); 3549 3550 this._emulateAnimation(() => { 3551 this.dispose(); 3552 execute(callback); 3553 }); 3554 } // Private 3555 3556 3557 _getElement() { 3558 if (!this._element) { 3559 const backdrop = document.createElement('div'); 3560 backdrop.className = this._config.className; 3561 3562 if (this._config.isAnimated) { 3563 backdrop.classList.add(CLASS_NAME_FADE$4); 3564 } 3565 3566 this._element = backdrop; 3567 } 3568 3569 return this._element; 3570 } 3571 3572 _getConfig(config) { 3573 config = { ...Default$7, 3574 ...(typeof config === 'object' ? config : {}) 3575 }; // use getElement() with the default "body" to get a fresh Element on each instantiation 3576 3577 config.rootElement = getElement(config.rootElement); 3578 typeCheckConfig(NAME$8, config, DefaultType$7); 3579 return config; 3580 } 3581 3582 _append() { 3583 if (this._isAppended) { 3584 return; 3585 } 3586 3587 this._config.rootElement.append(this._getElement()); 3588 3589 EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => { 3590 execute(this._config.clickCallback); 3591 }); 3592 this._isAppended = true; 3593 } 3594 3595 dispose() { 3596 if (!this._isAppended) { 3597 return; 3598 } 3599 3600 EventHandler.off(this._element, EVENT_MOUSEDOWN); 3601 3602 this._element.remove(); 3603 3604 this._isAppended = false; 3605 } 3606 3607 _emulateAnimation(callback) { 3608 executeAfterTransition(callback, this._getElement(), this._config.isAnimated); 3609 } 3610 3611 } 3612 3613 /** 3614 * -------------------------------------------------------------------------- 3615 * Bootstrap (v5.1.3): util/focustrap.js 3616 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3617 * -------------------------------------------------------------------------- 3618 */ 3619 const Default$6 = { 3620 trapElement: null, 3621 // The element to trap focus inside of 3622 autofocus: true 3623 }; 3624 const DefaultType$6 = { 3625 trapElement: 'element', 3626 autofocus: 'boolean' 3627 }; 3628 const NAME$7 = 'focustrap'; 3629 const DATA_KEY$7 = 'bs.focustrap'; 3630 const EVENT_KEY$7 = `.${DATA_KEY$7}`; 3631 const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$7}`; 3632 const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$7}`; 3633 const TAB_KEY = 'Tab'; 3634 const TAB_NAV_FORWARD = 'forward'; 3635 const TAB_NAV_BACKWARD = 'backward'; 3636 3637 class FocusTrap { 3638 constructor(config) { 3639 this._config = this._getConfig(config); 3640 this._isActive = false; 3641 this._lastTabNavDirection = null; 3642 } 3643 3644 activate() { 3645 const { 3646 trapElement, 3647 autofocus 3648 } = this._config; 3649 3650 if (this._isActive) { 3651 return; 3652 } 3653 3654 if (autofocus) { 3655 trapElement.focus(); 3656 } 3657 3658 EventHandler.off(document, EVENT_KEY$7); // guard against infinite focus loop 3659 3660 EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event)); 3661 EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event)); 3662 this._isActive = true; 3663 } 3664 3665 deactivate() { 3666 if (!this._isActive) { 3667 return; 3668 } 3669 3670 this._isActive = false; 3671 EventHandler.off(document, EVENT_KEY$7); 3672 } // Private 3673 3674 3675 _handleFocusin(event) { 3676 const { 3677 target 3678 } = event; 3679 const { 3680 trapElement 3681 } = this._config; 3682 3683 if (target === document || target === trapElement || trapElement.contains(target)) { 3684 return; 3685 } 3686 3687 const elements = SelectorEngine.focusableChildren(trapElement); 3688 3689 if (elements.length === 0) { 3690 trapElement.focus(); 3691 } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) { 3692 elements[elements.length - 1].focus(); 3693 } else { 3694 elements[0].focus(); 3695 } 3696 } 3697 3698 _handleKeydown(event) { 3699 if (event.key !== TAB_KEY) { 3700 return; 3701 } 3702 3703 this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD; 3704 } 3705 3706 _getConfig(config) { 3707 config = { ...Default$6, 3708 ...(typeof config === 'object' ? config : {}) 3709 }; 3710 typeCheckConfig(NAME$7, config, DefaultType$6); 3711 return config; 3712 } 3713 3714 } 3715 3716 /** 3717 * -------------------------------------------------------------------------- 3718 * Bootstrap (v5.1.3): modal.js 3719 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3720 * -------------------------------------------------------------------------- 3721 */ 3722 /** 3723 * ------------------------------------------------------------------------ 3724 * Constants 3725 * ------------------------------------------------------------------------ 3726 */ 3727 3728 const NAME$6 = 'modal'; 3729 const DATA_KEY$6 = 'bs.modal'; 3730 const EVENT_KEY$6 = `.${DATA_KEY$6}`; 3731 const DATA_API_KEY$3 = '.data-api'; 3732 const ESCAPE_KEY$1 = 'Escape';
3733 const Default$5 = { 3734 backdrop: true, 3735 keyboard: true, 3736 focus: true 3737 }; 3738 const DefaultType$5 = { 3739 backdrop: '(boolean|string)', 3740 keyboard: 'boolean', 3741 focus: 'boolean' 3742 }; 3743 const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`; 3744 const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`; 3745 const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`; 3746 const EVENT_SHOW$3 = `show${EVENT_KEY$6}`; 3747 const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`; 3748 const EVENT_RESIZE = `resize${EVENT_KEY$6}`; 3749 const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$6}`; 3750 const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`; 3751 const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`; 3752 const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`; 3753 const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; 3754 const CLASS_NAME_OPEN = 'modal-open'; 3755 const CLASS_NAME_FADE$3 = 'fade'; 3756 const CLASS_NAME_SHOW$4 = 'show'; 3757 const CLASS_NAME_STATIC = 'modal-static'; 3758 const OPEN_SELECTOR$1 = '.modal.show'; 3759 const SELECTOR_DIALOG = '.modal-dialog'; 3760 const SELECTOR_MODAL_BODY = '.modal-body'; 3761 const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; 3762 /** 3763 * ------------------------------------------------------------------------ 3764 * Class Definition 3765 * ------------------------------------------------------------------------ 3766 */ 3767 3768 class Modal extends BaseComponent { 3769 constructor(element, config) { 3770 super(element); 3771 this._config = this._getConfig(config); 3772 this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); 3773 this._backdrop = this._initializeBackDrop(); 3774 this._focustrap = this._initializeFocusTrap(); 3775 this._isShown = false; 3776 this._ignoreBackdropClick = false; 3777 this._isTransitioning = false; 3778 this._scrollBar = new ScrollBarHelper(); 3779 } // Getters 3780 3781 3782 static get Default() { 3783 return Default$5; 3784 } 3785 3786 static get NAME() { 3787 return NAME$6; 3788 } // Public 3789 3790 3791 toggle(relatedTarget) { 3792 return this._isShown ? this.hide() : this.show(relatedTarget); 3793 } 3794 3795 show(relatedTarget) { 3796 if (this._isShown || this._isTransitioning) { 3797 return; 3798 } 3799 3800 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, { 3801 relatedTarget 3802 }); 3803 3804 if (showEvent.defaultPrevented) { 3805 return; 3806 } 3807 3808 this._isShown = true; 3809 3810 if (this._isAnimated()) { 3811 this._isTransitioning = true; 3812 } 3813 3814 this._scrollBar.hide(); 3815 3816 document.body.classList.add(CLASS_NAME_OPEN); 3817 3818 this._adjustDialog(); 3819 3820 this._setEscapeEvent(); 3821 3822 this._setResizeEvent(); 3823 3824 EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => { 3825 EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => { 3826 if (event.target === this._element) { 3827 this._ignoreBackdropClick = true; 3828 } 3829 }); 3830 }); 3831 3832 this._showBackdrop(() => this._showElement(relatedTarget)); 3833 } 3834 3835 hide() { 3836 if (!this._isShown || this._isTransitioning) { 3837 return; 3838 } 3839 3840 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3); 3841 3842 if (hideEvent.defaultPrevented) { 3843 return; 3844 } 3845 3846 this._isShown = false; 3847 3848 const isAnimated = this._isAnimated(); 3849 3850 if (isAnimated) { 3851 this._isTransitioning = true; 3852 } 3853 3854 this._setEscapeEvent(); 3855 3856 this._setResizeEvent(); 3857 3858 this._focustrap.deactivate(); 3859 3860 this._element.classList.remove(CLASS_NAME_SHOW$4); 3861 3862 EventHandler.off(this._element, EVENT_CLICK_DISMISS); 3863 EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS); 3864 3865 this._queueCallback(() => this._hideModal(), this._element, isAnimated); 3866 } 3867 3868 dispose() { 3869 [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6)); 3870 3871 this._backdrop.dispose(); 3872 3873 this._focustrap.deactivate(); 3874 3875 super.dispose(); 3876 } 3877 3878 handleUpdate() { 3879 this._adjustDialog(); 3880 } // Private 3881 3882 3883 _initializeBackDrop() { 3884 return new Backdrop({ 3885 isVisible: Boolean(this._config.backdrop), 3886 // 'static' option will be translated to true, and booleans will keep their value 3887 isAnimated: this._isAnimated() 3888 }); 3889 } 3890 3891 _initializeFocusTrap() { 3892 return new FocusTrap({ 3893 trapElement: this._element 3894 }); 3895 } 3896 3897 _getConfig(config) { 3898 config = { ...Default$5, 3899 ...Manipulator.getDataAttributes(this._element), 3900 ...(typeof config === 'object' ? config : {}) 3901 }; 3902 typeCheckConfig(NAME$6, config, DefaultType$5); 3903 return config; 3904 } 3905 3906 _showElement(relatedTarget) { 3907 const isAnimated = this._isAnimated(); 3908 3909 const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); 3910 3911 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 3912 // Don't move modal's DOM position 3913 document.body.append(this._element); 3914 } 3915 3916 this._element.style.display = 'block'; 3917 3918 this._element.removeAttribute('aria-hidden'); 3919 3920 this._element.setAttribute('aria-modal', true); 3921 3922 this._element.setAttribute('role', 'dialog'); 3923 3924 this._element.scrollTop = 0; 3925 3926 if (modalBody) { 3927 modalBody.scrollTop = 0; 3928 } 3929 3930 if (isAnimated) { 3931 reflow(this._element); 3932 } 3933 3934 this._element.classList.add(CLASS_NAME_SHOW$4); 3935 3936 const transitionComplete = () => { 3937 if (this._config.focus) { 3938 this._focustrap.activate(); 3939 } 3940 3941 this._isTransitioning = false;
3942 EventHandler.trigger(this._element, EVENT_SHOWN$3, { 3943 relatedTarget 3944 }); 3945 }; 3946 3947 this._queueCallback(transitionComplete, this._dialog, isAnimated); 3948 } 3949 3950 _setEscapeEvent() { 3951 if (this._isShown) { 3952 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => { 3953 if (this._config.keyboard && event.key === ESCAPE_KEY$1) { 3954 event.preventDefault(); 3955 this.hide(); 3956 } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) { 3957 this._triggerBackdropTransition(); 3958 } 3959 }); 3960 } else { 3961 EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1); 3962 } 3963 } 3964 3965 _setResizeEvent() { 3966 if (this._isShown) { 3967 EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog()); 3968 } else { 3969 EventHandler.off(window, EVENT_RESIZE); 3970 } 3971 } 3972 3973 _hideModal() { 3974 this._element.style.display = 'none'; 3975 3976 this._element.setAttribute('aria-hidden', true); 3977 3978 this._element.removeAttribute('aria-modal'); 3979 3980 this._element.removeAttribute('role'); 3981 3982 this._isTransitioning = false; 3983 3984 this._backdrop.hide(() => { 3985 document.body.classList.remove(CLASS_NAME_OPEN); 3986 3987 this._resetAdjustments(); 3988 3989 this._scrollBar.reset(); 3990 3991 EventHandler.trigger(this._element, EVENT_HIDDEN$3); 3992 }); 3993 } 3994 3995 _showBackdrop(callback) { 3996 EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => { 3997 if (this._ignoreBackdropClick) { 3998 this._ignoreBackdropClick = false; 3999 return; 4000 } 4001 4002 if (event.target !== event.currentTarget) { 4003 return; 4004 } 4005 4006 if (this._config.backdrop === true) { 4007 this.hide(); 4008 } else if (this._config.backdrop === 'static') { 4009 this._triggerBackdropTransition(); 4010 } 4011 }); 4012 4013 this._backdrop.show(callback); 4014 } 4015 4016 _isAnimated() { 4017 return this._element.classList.contains(CLASS_NAME_FADE$3); 4018 } 4019 4020 _triggerBackdropTransition() { 4021 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); 4022 4023 if (hideEvent.defaultPrevented) { 4024 return; 4025 } 4026 4027 const { 4028 classList, 4029 scrollHeight, 4030 style 4031 } = this._element; 4032 const isModalOverflowing = scrollHeight > document.documentElement.clientHeight; // return if the following background transition hasn't yet completed 4033 4034 if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) { 4035 return; 4036 } 4037 4038 if (!isModalOverflowing) { 4039 style.overflowY = 'hidden'; 4040 } 4041 4042 classList.add(CLASS_NAME_STATIC); 4043 4044 this._queueCallback(() => { 4045 classList.remove(CLASS_NAME_STATIC); 4046 4047 if (!isModalOverflowing) { 4048 this._queueCallback(() => { 4049 style.overflowY = ''; 4050 }, this._dialog); 4051 } 4052 }, this._dialog); 4053 4054 this._element.focus(); 4055 } // ---------------------------------------------------------------------- 4056 // the following methods are used to handle overflowing modals 4057 // ---------------------------------------------------------------------- 4058 4059 4060 _adjustDialog() { 4061 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4062 4063 const scrollbarWidth = this._scrollBar.getWidth(); 4064 4065 const isBodyOverflowing = scrollbarWidth > 0; 4066 4067 if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) { 4068 this._element.style.paddingLeft = `${scrollbarWidth}px`; 4069 } 4070 4071 if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) { 4072 this._element.style.paddingRight = `${scrollbarWidth}px`; 4073 } 4074 } 4075 4076 _resetAdjustments() { 4077 this._element.style.paddingLeft = ''; 4078 this._element.style.paddingRight = ''; 4079 } // Static 4080 4081 4082 static jQueryInterface(config, relatedTarget) { 4083 return this.each(function () { 4084 const data = Modal.getOrCreateInstance(this, config); 4085 4086 if (typeof config !== 'string') { 4087 return; 4088 } 4089 4090 if (typeof data[config] === 'undefined') {
vendor: 4,925 bytes, lines 4091-4272
4091 throw new TypeError(`No method named "${config}"`); 4092 } 4093 4094 data[config](relatedTarget); 4095 }); 4096 } 4097 4098 } 4099 /** 4100 * ------------------------------------------------------------------------ 4101 * Data Api implementation 4102 * ------------------------------------------------------------------------ 4103 */ 4104 4105 4106 EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { 4107 const target = getElementFromSelector(this); 4108 4109 if (['A', 'AREA'].includes(this.tagName)) { 4110 event.preventDefault(); 4111 } 4112 4113 EventHandler.one(target, EVENT_SHOW$3, showEvent => { 4114 if (showEvent.defaultPrevented) { 4115 // only register focus restorer if modal will actually get shown 4116 return; 4117 } 4118 4119 EventHandler.one(target, EVENT_HIDDEN$3, () => { 4120 if (isVisible(this)) { 4121 this.focus(); 4122 } 4123 }); 4124 }); // avoid conflict when clicking moddal toggler while another one is open 4125 4126 const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1); 4127 4128 if (allReadyOpen) { 4129 Modal.getInstance(allReadyOpen).hide(); 4130 } 4131 4132 const data = Modal.getOrCreateInstance(target); 4133 data.toggle(this); 4134 }); 4135 enableDismissTrigger(Modal); 4136 /** 4137 * ------------------------------------------------------------------------ 4138 * jQuery 4139 * ------------------------------------------------------------------------ 4140 * add .Modal to jQuery only if jQuery is present 4141 */ 4142 4143 defineJQueryPlugin(Modal); 4144 4145 /** 4146 * -------------------------------------------------------------------------- 4147 * Bootstrap (v5.1.3): offcanvas.js 4148 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4149 * -------------------------------------------------------------------------- 4150 */ 4151 /** 4152 * ------------------------------------------------------------------------ 4153 * Constants 4154 * ------------------------------------------------------------------------ 4155 */ 4156 4157 const NAME$5 = 'offcanvas'; 4158 const DATA_KEY$5 = 'bs.offcanvas'; 4159 const EVENT_KEY$5 = `.${DATA_KEY$5}`; 4160 const DATA_API_KEY$2 = '.data-api'; 4161 const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`; 4162 const ESCAPE_KEY = 'Escape'; 4163 const Default$4 = { 4164 backdrop: true, 4165 keyboard: true, 4166 scroll: false 4167 }; 4168 const DefaultType$4 = { 4169 backdrop: 'boolean', 4170 keyboard: 'boolean', 4171 scroll: 'boolean' 4172 }; 4173 const CLASS_NAME_SHOW$3 = 'show'; 4174 const CLASS_NAME_BACKDROP = 'offcanvas-backdrop'; 4175 const OPEN_SELECTOR = '.offcanvas.show'; 4176 const EVENT_SHOW$2 = `show${EVENT_KEY$5}`; 4177 const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`; 4178 const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`; 4179 const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`; 4180 const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`; 4181 const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`; 4182 const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; 4183 /** 4184 * ------------------------------------------------------------------------ 4185 * Class Definition 4186 * ------------------------------------------------------------------------ 4187 */ 4188 4189 class Offcanvas extends BaseComponent { 4190 constructor(element, config) { 4191 super(element); 4192 this._config = this._getConfig(config); 4193 this._isShown = false; 4194 this._backdrop = this._initializeBackDrop(); 4195 this._focustrap = this._initializeFocusTrap(); 4196 4197 this._addEventListeners(); 4198 } // Getters 4199 4200 4201 static get NAME() { 4202 return NAME$5; 4203 } 4204 4205 static get Default() { 4206 return Default$4; 4207 } // Public 4208 4209 4210 toggle(relatedTarget) { 4211 return this._isShown ? this.hide() : this.show(relatedTarget); 4212 } 4213 4214 show(relatedTarget) { 4215 if (this._isShown) { 4216 return; 4217 } 4218 4219 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, { 4220 relatedTarget 4221 }); 4222 4223 if (showEvent.defaultPrevented) { 4224 return; 4225 } 4226 4227 this._isShown = true; 4228 this._element.style.visibility = 'visible'; 4229 4230 this._backdrop.show(); 4231 4232 if (!this._config.scroll) { 4233 new ScrollBarHelper().hide(); 4234 } 4235 4236 this._element.removeAttribute('aria-hidden'); 4237 4238 this._element.setAttribute('aria-modal', true); 4239 4240 this._element.setAttribute('role', 'dialog'); 4241 4242 this._element.classList.add(CLASS_NAME_SHOW$3); 4243 4244 const completeCallBack = () => { 4245 if (!this._config.scroll) { 4246 this._focustrap.activate(); 4247 } 4248 4249 EventHandler.trigger(this._element, EVENT_SHOWN$2, { 4250 relatedTarget 4251 }); 4252 }; 4253 4254 this._queueCallback(completeCallBack, this._element, true); 4255 } 4256 4257 hide() { 4258 if (!this._isShown) { 4259 return; 4260 } 4261 4262 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2); 4263 4264 if (hideEvent.defaultPrevented) { 4265 return; 4266 } 4267 4268 this._focustrap.deactivate(); 4269 4270 this._element.blur(); 4271 4272 this._isShown = false;
4273 4274 this._element.classList.remove(CLASS_NAME_SHOW$3); 4275 4276 this._backdrop.hide(); 4277 4278 const completeCallback = () => { 4279 this._element.setAttribute('aria-hidden', true); 4280 4281 this._element.removeAttribute('aria-modal'); 4282 4283 this._element.removeAttribute('role'); 4284 4285 this._element.style.visibility = 'hidden'; 4286 4287 if (!this._config.scroll) { 4288 new ScrollBarHelper().reset(); 4289 } 4290 4291 EventHandler.trigger(this._element, EVENT_HIDDEN$2); 4292 }; 4293 4294 this._queueCallback(completeCallback, this._element, true); 4295 } 4296 4297 dispose() { 4298 this._backdrop.dispose(); 4299 4300 this._focustrap.deactivate(); 4301 4302 super.dispose(); 4303 } // Private 4304 4305 4306 _getConfig(config) { 4307 config = { ...Default$4, 4308 ...Manipulator.getDataAttributes(this._element), 4309 ...(typeof config === 'object' ? config : {}) 4310 }; 4311 typeCheckConfig(NAME$5, config, DefaultType$4); 4312 return config; 4313 } 4314 4315 _initializeBackDrop() { 4316 return new Backdrop({ 4317 className: CLASS_NAME_BACKDROP, 4318 isVisible: this._config.backdrop, 4319 isAnimated: true, 4320 rootElement: this._element.parentNode, 4321 clickCallback: () => this.hide() 4322 }); 4323 } 4324 4325 _initializeFocusTrap() { 4326 return new FocusTrap({ 4327 trapElement: this._element 4328 }); 4329 } 4330 4331 _addEventListeners() { 4332 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { 4333 if (this._config.keyboard && event.key === ESCAPE_KEY) { 4334 this.hide(); 4335 } 4336 }); 4337 } // Static 4338 4339 4340 static jQueryInterface(config) { 4341 return this.each(function () { 4342 const data = Offcanvas.getOrCreateInstance(this, config); 4343 4344 if (typeof config !== 'string') { 4345 return; 4346 } 4347 4348 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 4349 throw new TypeError(`No method named "${config}"`); 4350 } 4351 4352 data[config](this); 4353 }); 4354 } 4355 4356 } 4357 /** 4358 * ------------------------------------------------------------------------ 4359 * Data Api implementation 4360 * ------------------------------------------------------------------------ 4361 */ 4362 4363 4364 EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { 4365 const target = getElementFromSelector(this); 4366 4367 if (['A', 'AREA'].includes(this.tagName)) { 4368 event.preventDefault(); 4369 } 4370 4371 if (isDisabled(this)) { 4372 return; 4373 } 4374 4375 EventHandler.one(target, EVENT_HIDDEN$2, () => { 4376 // focus on trigger when it is closed 4377 if (isVisible(this)) { 4378 this.focus(); 4379 } 4380 }); // avoid conflict when clicking a toggler of an offcanvas, while another is open 4381 4382 const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR); 4383 4384 if (allReadyOpen && allReadyOpen !== target) { 4385 Offcanvas.getInstance(allReadyOpen).hide(); 4386 } 4387 4388 const data = Offcanvas.getOrCreateInstance(target); 4389 data.toggle(this); 4390 }); 4391 EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show())); 4392 enableDismissTrigger(Offcanvas); 4393 /** 4394 * ------------------------------------------------------------------------ 4395 * jQuery 4396 * ------------------------------------------------------------------------ 4397 */ 4398 4399 defineJQueryPlugin(Offcanvas); 4400 4401 /** 4402 * -------------------------------------------------------------------------- 4403 * Bootstrap (v5.1.3): util/sanitizer.js 4404 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4405 * -------------------------------------------------------------------------- 4406 */ 4407 const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); 4408 const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 4409 /** 4410 * A pattern that recognizes a commonly useful subset of URLs that are safe. 4411 * 4412 * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 4413 */ 4414 4415 const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; 4416 /** 4417 * A pattern that matches safe data URLs. Only matches image, video and audio types. 4418 * 4419 * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 4420 */ 4421 4422 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; 4423 4424 const allowedAttribute = (attribute, allowedAttributeList) => {
4425 const attributeName = attribute.nodeName.toLowerCase(); 4426 4427 if (allowedAttributeList.includes(attributeName)) { 4428 if (uriAttributes.has(attributeName)) { 4429 return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue)); 4430 } 4431 4432 return true; 4433 } 4434 4435 const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp); // Check if a regular expression validates the attribute. 4436 4437 for (let i = 0, len = regExp.length; i < len; i++) { 4438 if (regExp[i].test(attributeName)) { 4439 return true; 4440 } 4441 } 4442 4443 return false; 4444 }; 4445 4446 const DefaultAllowlist = { 4447 // Global attributes allowed on any supplied element below. 4448 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 4449 a: ['target', 'href', 'title', 'rel'], 4450 area: [], 4451 b: [], 4452 br: [], 4453 col: [], 4454 code: [], 4455 div: [], 4456 em: [], 4457 hr: [], 4458 h1: [], 4459 h2: [], 4460 h3: [], 4461 h4: [], 4462 h5: [], 4463 h6: [], 4464 i: [], 4465 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 4466 li: [], 4467 ol: [], 4468 p: [], 4469 pre: [], 4470 s: [], 4471 small: [], 4472 span: [], 4473 sub: [], 4474 sup: [], 4475 strong: [], 4476 u: [], 4477 ul: [] 4478 }; 4479 function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) { 4480 if (!unsafeHtml.length) { 4481 return unsafeHtml; 4482 } 4483 4484 if (sanitizeFn && typeof sanitizeFn === 'function') { 4485 return sanitizeFn(unsafeHtml); 4486 } 4487 4488 const domParser = new window.DOMParser(); 4489 const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 4490 const elements = [].concat(...createdDocument.body.querySelectorAll('*')); 4491 4492 for (let i = 0, len = elements.length; i < len; i++) { 4493 const element = elements[i]; 4494 const elementName = element.nodeName.toLowerCase(); 4495 4496 if (!Object.keys(allowList).includes(elementName)) { 4497 element.remove(); 4498 continue; 4499 } 4500 4501 const attributeList = [].concat(...element.attributes); 4502 const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []); 4503 attributeList.forEach(attribute => { 4504 if (!allowedAttribute(attribute, allowedAttributes)) { 4505 element.removeAttribute(attribute.nodeName); 4506 } 4507 }); 4508 } 4509 4510 return createdDocument.body.innerHTML; 4511 } 4512 4513 /** 4514 * -------------------------------------------------------------------------- 4515 * Bootstrap (v5.1.3): tooltip.js 4516 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4517 * -------------------------------------------------------------------------- 4518 */ 4519 /** 4520 * ------------------------------------------------------------------------ 4521 * Constants 4522 * ------------------------------------------------------------------------ 4523 */ 4524 4525 const NAME$4 = 'tooltip'; 4526 const DATA_KEY$4 = 'bs.tooltip'; 4527 const EVENT_KEY$4 = `.${DATA_KEY$4}`; 4528 const CLASS_PREFIX$1 = 'bs-tooltip'; 4529 const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']); 4530 const DefaultType$3 = { 4531 animation: 'boolean', 4532 template: 'string', 4533 title: '(string|element|function)', 4534 trigger: 'string', 4535 delay: '(number|object)', 4536 html: 'boolean', 4537 selector: '(string|boolean)', 4538 placement: '(string|function)', 4539 offset: '(array|string|function)', 4540 container: '(string|element|boolean)', 4541 fallbackPlacements: 'array', 4542 boundary: '(string|element)', 4543 customClass: '(string|function)', 4544 sanitize: 'boolean', 4545 sanitizeFn: '(null|function)', 4546 allowList: 'object', 4547 popperConfig: '(null|object|function)' 4548 }; 4549 const AttachmentMap = { 4550 AUTO: 'auto', 4551 TOP: 'top', 4552 RIGHT: isRTL() ? 'left' : 'right', 4553 BOTTOM: 'bottom', 4554 LEFT: isRTL() ? 'right' : 'left' 4555 }; 4556 const Default$3 = { 4557 animation: true, 4558 template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>', 4559 trigger: 'hover focus', 4560 title: '', 4561 delay: 0, 4562 html: false, 4563 selector: false, 4564 placement: 'top', 4565 offset: [0, 0], 4566 container: false, 4567 fallbackPlacements: ['top', 'right', 'bottom', 'left'], 4568 boundary: 'clippingParents', 4569 customClass: '', 4570 sanitize: true, 4571 sanitizeFn: null, 4572 allowList: DefaultAllowlist, 4573 popperConfig: null 4574 }; 4575 const Event$2 = { 4576 HIDE: `hide${EVENT_KEY$4}`, 4577 HIDDEN: `hidden${EVENT_KEY$4}`, 4578 SHOW: `show${EVENT_KEY$4}`, 4579 SHOWN: `shown${EVENT_KEY$4}`, 4580 INSERTED: `inserted${EVENT_KEY$4}`, 4581 CLICK: `click${EVENT_KEY$4}`, 4582 FOCUSIN: `focusin${EVENT_KEY$4}`, 4583 FOCUSOUT: `focusout${EVENT_KEY$4}`, 4584 MOUSEENTER: `mouseenter${EVENT_KEY$4}`, 4585 MOUSELEAVE: `mouseleave${EVENT_KEY$4}` 4586 }; 4587 const CLASS_NAME_FADE$2 = 'fade';
4588 const CLASS_NAME_MODAL = 'modal'; 4589 const CLASS_NAME_SHOW$2 = 'show'; 4590 const HOVER_STATE_SHOW = 'show'; 4591 const HOVER_STATE_OUT = 'out'; 4592 const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; 4593 const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`; 4594 const EVENT_MODAL_HIDE = 'hide.bs.modal'; 4595 const TRIGGER_HOVER = 'hover'; 4596 const TRIGGER_FOCUS = 'focus'; 4597 const TRIGGER_CLICK = 'click'; 4598 const TRIGGER_MANUAL = 'manual'; 4599 /** 4600 * ------------------------------------------------------------------------ 4601 * Class Definition 4602 * ------------------------------------------------------------------------ 4603 */ 4604 4605 class Tooltip extends BaseComponent { 4606 constructor(element, config) { 4607 if (typeof Popper === 'undefined') { 4608 throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); 4609 } 4610 4611 super(element); // private 4612 4613 this._isEnabled = true; 4614 this._timeout = 0; 4615 this._hoverState = ''; 4616 this._activeTrigger = {}; 4617 this._popper = null; // Protected 4618 4619 this._config = this._getConfig(config); 4620 this.tip = null; 4621 4622 this._setListeners(); 4623 } // Getters 4624 4625 4626 static get Default() { 4627 return Default$3; 4628 } 4629 4630 static get NAME() { 4631 return NAME$4; 4632 } 4633 4634 static get Event() { 4635 return Event$2; 4636 } 4637 4638 static get DefaultType() { 4639 return DefaultType$3; 4640 } // Public 4641 4642 4643 enable() { 4644 this._isEnabled = true; 4645 } 4646 4647 disable() { 4648 this._isEnabled = false; 4649 } 4650 4651 toggleEnabled() { 4652 this._isEnabled = !this._isEnabled; 4653 } 4654 4655 toggle(event) { 4656 if (!this._isEnabled) { 4657 return; 4658 } 4659 4660 if (event) { 4661 const context = this._initializeOnDelegatedTarget(event); 4662 4663 context._activeTrigger.click = !context._activeTrigger.click; 4664 4665 if (context._isWithActiveTrigger()) { 4666 context._enter(null, context); 4667 } else { 4668 context._leave(null, context); 4669 } 4670 } else { 4671 if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$2)) { 4672 this._leave(null, this); 4673 4674 return; 4675 } 4676 4677 this._enter(null, this); 4678 } 4679 } 4680 4681 dispose() { 4682 clearTimeout(this._timeout); 4683 EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 4684 4685 if (this.tip) { 4686 this.tip.remove(); 4687 } 4688 4689 this._disposePopper(); 4690 4691 super.dispose(); 4692 } 4693 4694 show() { 4695 if (this._element.style.display === 'none') { 4696 throw new Error('Please use show on visible elements'); 4697 } 4698 4699 if (!(this.isWithContent() && this._isEnabled)) { 4700 return; 4701 } 4702 4703 const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW); 4704 const shadowRoot = findShadowRoot(this._element); 4705 const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element); 4706 4707 if (showEvent.defaultPrevented || !isInTheDom) { 4708 return; 4709 } // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-bs-original-title` 4710 // This will be removed later in favor of a `setContent` method 4711 4712 4713 if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) { 4714 this._disposePopper(); 4715 4716 this.tip.remove(); 4717 this.tip = null; 4718 } 4719 4720 const tip = this.getTipElement(); 4721 const tipId = getUID(this.constructor.NAME);
4722 tip.setAttribute('id', tipId); 4723 4724 this._element.setAttribute('aria-describedby', tipId); 4725 4726 if (this._config.animation) { 4727 tip.classList.add(CLASS_NAME_FADE$2); 4728 } 4729 4730 const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement; 4731 4732 const attachment = this._getAttachment(placement); 4733 4734 this._addAttachmentClass(attachment); 4735 4736 const { 4737 container 4738 } = this._config; 4739 Data.set(tip, this.constructor.DATA_KEY, this); 4740 4741 if (!this._element.ownerDocument.documentElement.contains(this.tip)) { 4742 container.append(tip); 4743 EventHandler.trigger(this._element, this.constructor.Event.INSERTED); 4744 } 4745 4746 if (this._popper) { 4747 this._popper.update(); 4748 } else { 4749 this._popper = createPopper(this._element, tip, this._getPopperConfig(attachment)); 4750 } 4751 4752 tip.classList.add(CLASS_NAME_SHOW$2); 4753 4754 const customClass = this._resolvePossibleFunction(this._config.customClass); 4755 4756 if (customClass) { 4757 tip.classList.add(...customClass.split(' ')); 4758 } // If this is a touch-enabled device we add extra 4759 // empty mouseover listeners to the body's immediate children; 4760 // only needed because of broken event delegation on iOS 4761 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 4762 4763 4764 if ('ontouchstart' in document.documentElement) { 4765 [].concat(...document.body.children).forEach(element => { 4766 EventHandler.on(element, 'mouseover', noop); 4767 }); 4768 } 4769 4770 const complete = () => { 4771 const prevHoverState = this._hoverState; 4772 this._hoverState = null; 4773 EventHandler.trigger(this._element, this.constructor.Event.SHOWN); 4774 4775 if (prevHoverState === HOVER_STATE_OUT) { 4776 this._leave(null, this); 4777 } 4778 }; 4779 4780 const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2); 4781 4782 this._queueCallback(complete, this.tip, isAnimated); 4783 } 4784 4785 hide() { 4786 if (!this._popper) { 4787 return; 4788 } 4789 4790 const tip = this.getTipElement(); 4791 4792 const complete = () => { 4793 if (this._isWithActiveTrigger()) { 4794 return; 4795 } 4796 4797 if (this._hoverState !== HOVER_STATE_SHOW) { 4798 tip.remove(); 4799 } 4800 4801 this._cleanTipClass(); 4802 4803 this._element.removeAttribute('aria-describedby'); 4804 4805 EventHandler.trigger(this._element, this.constructor.Event.HIDDEN); 4806 4807 this._disposePopper(); 4808 }; 4809 4810 const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE); 4811 4812 if (hideEvent.defaultPrevented) { 4813 return; 4814 } 4815 4816 tip.classList.remove(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we remove the extra 4817 // empty mouseover listeners we added for iOS support 4818 4819 if ('ontouchstart' in document.documentElement) { 4820 [].concat(...document.body.children).forEach(element => EventHandler.off(element, 'mouseover', noop)); 4821 } 4822 4823 this._activeTrigger[TRIGGER_CLICK] = false; 4824 this._activeTrigger[TRIGGER_FOCUS] = false; 4825 this._activeTrigger[TRIGGER_HOVER] = false; 4826 const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2); 4827 4828 this._queueCallback(complete, this.tip, isAnimated); 4829 4830 this._hoverState = ''; 4831 } 4832 4833 update() { 4834 if (this._popper !== null) { 4835 this._popper.update(); 4836 } 4837 } // Protected 4838 4839 4840 isWithContent() { 4841 return Boolean(this.getTitle()); 4842 } 4843 4844 getTipElement() { 4845 if (this.tip) { 4846 return this.tip; 4847 } 4848 4849 const element = document.createElement('div'); 4850 element.innerHTML = this._config.template; 4851 const tip = element.children[0]; 4852 this.setContent(tip); 4853 tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2); 4854 this.tip = tip; 4855 return this.tip; 4856 } 4857 4858 setContent(tip) { 4859 this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER); 4860 } 4861 4862 _sanitizeAndSetContent(template, content, selector) { 4863 const templateElement = SelectorEngine.findOne(selector, template); 4864 4865 if (!content && templateElement) { 4866 templateElement.remove(); 4867 return; 4868 } // we use append for html objects to maintain js events 4869 4870 4871 this.setElementContent(templateElement, content); 4872 } 4873 4874 setElementContent(element, content) { 4875 if (element === null) { 4876 return; 4877 } 4878 4879 if (isElement$1(content)) { 4880 content = getElement(content); // content is a DOM node or a jQuery 4881 4882 if (this._config.html) { 4883 if (content.parentNode !== element) { 4884 element.innerHTML = ''; 4885 element.append(content); 4886 } 4887 } else { 4888 element.textContent = content.textContent; 4889 } 4890 4891 return; 4892 } 4893 4894 if (this._config.html) { 4895 if (this._config.sanitize) { 4896 content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn); 4897 } 4898 4899 element.innerHTML = content; 4900 } else { 4901 element.textContent = content; 4902 } 4903 } 4904 4905 getTitle() { 4906 const title = this._element.getAttribute('data-bs-original-title') || this._config.title; 4907 4908 return this._resolvePossibleFunction(title); 4909 } 4910 4911 updateAttachment(attachment) { 4912 if (attachment === 'right') { 4913 return 'end'; 4914 } 4915 4916 if (attachment === 'left') { 4917 return 'start'; 4918 } 4919 4920 return attachment; 4921 } // Private 4922 4923 4924 _initializeOnDelegatedTarget(event, context) { 4925 return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig()); 4926 } 4927 4928 _getOffset() { 4929 const { 4930 offset 4931 } = this._config; 4932 4933 if (typeof offset === 'string') { 4934 return offset.split(',').map(val => Number.parseInt(val, 10)); 4935 } 4936 4937 if (typeof offset === 'function') { 4938 return popperData => offset(popperData, this._element); 4939 } 4940 4941 return offset; 4942 } 4943 4944 _resolvePossibleFunction(content) { 4945 return typeof content === 'function' ? content.call(this._element) : content; 4946 } 4947 4948 _getPopperConfig(attachment) { 4949 const defaultBsPopperConfig = { 4950 placement: attachment, 4951 modifiers: [{ 4952 name: 'flip', 4953 options: { 4954 fallbackPlacements: this._config.fallbackPlacements 4955 } 4956 }, { 4957 name: 'offset', 4958 options: { 4959 offset: this._getOffset() 4960 } 4961 }, { 4962 name: 'preventOverflow', 4963 options: {
4964 boundary: this._config.boundary 4965 } 4966 }, { 4967 name: 'arrow', 4968 options: { 4969 element: `.${this.constructor.NAME}-arrow` 4970 } 4971 }, { 4972 name: 'onChange', 4973 enabled: true, 4974 phase: 'afterWrite', 4975 fn: data => this._handlePopperPlacementChange(data) 4976 }], 4977 onFirstUpdate: data => { 4978 if (data.options.placement !== data.placement) { 4979 this._handlePopperPlacementChange(data); 4980 } 4981 } 4982 }; 4983 return { ...defaultBsPopperConfig, 4984 ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) 4985 }; 4986 } 4987 4988 _addAttachmentClass(attachment) { 4989 this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`); 4990 } 4991 4992 _getAttachment(placement) { 4993 return AttachmentMap[placement.toUpperCase()]; 4994 } 4995 4996 _setListeners() { 4997 const triggers = this._config.trigger.split(' '); 4998 4999 triggers.forEach(trigger => { 5000 if (trigger === 'click') { 5001 EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event)); 5002 } else if (trigger !== TRIGGER_MANUAL) { 5003 const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN; 5004 const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT; 5005 EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event)); 5006 EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event)); 5007 } 5008 }); 5009 5010 this._hideModalHandler = () => { 5011 if (this._element) { 5012 this.hide(); 5013 } 5014 }; 5015 5016 EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 5017 5018 if (this._config.selector) { 5019 this._config = { ...this._config, 5020 trigger: 'manual', 5021 selector: '' 5022 }; 5023 } else { 5024 this._fixTitle(); 5025 } 5026 } 5027 5028 _fixTitle() { 5029 const title = this._element.getAttribute('title'); 5030 5031 const originalTitleType = typeof this._element.getAttribute('data-bs-original-title'); 5032 5033 if (title || originalTitleType !== 'string') { 5034 this._element.setAttribute('data-bs-original-title', title || ''); 5035 5036 if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) { 5037 this._element.setAttribute('aria-label', title); 5038 } 5039 5040 this._element.setAttribute('title', ''); 5041 } 5042 } 5043 5044 _enter(event, context) { 5045 context = this._initializeOnDelegatedTarget(event, context); 5046 5047 if (event) { 5048 context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; 5049 } 5050 5051 if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$2) || context._hoverState === HOVER_STATE_SHOW) { 5052 context._hoverState = HOVER_STATE_SHOW; 5053 return; 5054 } 5055 5056 clearTimeout(context._timeout); 5057 context._hoverState = HOVER_STATE_SHOW; 5058 5059 if (!context._config.delay || !context._config.delay.show) { 5060 context.show(); 5061 return; 5062 } 5063 5064 context._timeout = setTimeout(() => { 5065 if (context._hoverState === HOVER_STATE_SHOW) { 5066 context.show(); 5067 } 5068 }, context._config.delay.show); 5069 } 5070 5071 _leave(event, context) { 5072 context = this._initializeOnDelegatedTarget(event, context); 5073 5074 if (event) { 5075 context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget); 5076 } 5077 5078 if (context._isWithActiveTrigger()) { 5079 return; 5080 } 5081 5082 clearTimeout(context._timeout); 5083 context._hoverState = HOVER_STATE_OUT; 5084 5085 if (!context._config.delay || !context._config.delay.hide) { 5086 context.hide(); 5087 return; 5088 } 5089 5090 context._timeout = setTimeout(() => { 5091 if (context._hoverState === HOVER_STATE_OUT) { 5092 context.hide(); 5093 } 5094 }, context._config.delay.hide); 5095 } 5096 5097 _isWithActiveTrigger() { 5098 for (const trigger in this._activeTrigger) { 5099 if (this._activeTrigger[trigger]) { 5100 return true; 5101 } 5102 } 5103 5104 return false;
5105 } 5106 5107 _getConfig(config) { 5108 const dataAttributes = Manipulator.getDataAttributes(this._element); 5109 Object.keys(dataAttributes).forEach(dataAttr => { 5110 if (DISALLOWED_ATTRIBUTES.has(dataAttr)) { 5111 delete dataAttributes[dataAttr]; 5112 } 5113 }); 5114 config = { ...this.constructor.Default, 5115 ...dataAttributes, 5116 ...(typeof config === 'object' && config ? config : {}) 5117 }; 5118 config.container = config.container === false ? document.body : getElement(config.container); 5119 5120 if (typeof config.delay === 'number') { 5121 config.delay = { 5122 show: config.delay, 5123 hide: config.delay 5124 }; 5125 } 5126 5127 if (typeof config.title === 'number') { 5128 config.title = config.title.toString(); 5129 } 5130 5131 if (typeof config.content === 'number') { 5132 config.content = config.content.toString(); 5133 } 5134 5135 typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 5136 5137 if (config.sanitize) { 5138 config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn); 5139 } 5140 5141 return config; 5142 } 5143 5144 _getDelegateConfig() { 5145 const config = {}; 5146 5147 for (const key in this._config) { 5148 if (this.constructor.Default[key] !== this._config[key]) { 5149 config[key] = this._config[key]; 5150 } 5151 } // In the future can be replaced with: 5152 // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]]) 5153 // `Object.fromEntries(keysWithDifferentValues)` 5154 5155 5156 return config; 5157 } 5158 5159 _cleanTipClass() { 5160 const tip = this.getTipElement(); 5161 const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g'); 5162 const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex); 5163 5164 if (tabClass !== null && tabClass.length > 0) { 5165 tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass)); 5166 } 5167 } 5168 5169 _getBasicClassPrefix() { 5170 return CLASS_PREFIX$1; 5171 } 5172 5173 _handlePopperPlacementChange(popperData) { 5174 const { 5175 state 5176 } = popperData; 5177 5178 if (!state) { 5179 return; 5180 } 5181 5182 this.tip = state.elements.popper; 5183 5184 this._cleanTipClass(); 5185 5186 this._addAttachmentClass(this._getAttachment(state.placement)); 5187 } 5188 5189 _disposePopper() { 5190 if (this._popper) { 5191 this._popper.destroy(); 5192 5193 this._popper = null; 5194 } 5195 } // Static 5196 5197 5198 static jQueryInterface(config) { 5199 return this.each(function () { 5200 const data = Tooltip.getOrCreateInstance(this, config); 5201 5202 if (typeof config === 'string') { 5203 if (typeof data[config] === 'undefined') { 5204 throw new TypeError(`No method named "${config}"`); 5205 } 5206 5207 data[config](); 5208 } 5209 }); 5210 } 5211 5212 } 5213 /** 5214 * ------------------------------------------------------------------------ 5215 * jQuery 5216 * ------------------------------------------------------------------------ 5217 * add .Tooltip to jQuery only if jQuery is present 5218 */ 5219 5220 5221 defineJQueryPlugin(Tooltip); 5222 5223 /** 5224 * -------------------------------------------------------------------------- 5225 * Bootstrap (v5.1.3): popover.js 5226 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5227 * -------------------------------------------------------------------------- 5228 */ 5229 /** 5230 * ------------------------------------------------------------------------ 5231 * Constants 5232 * ------------------------------------------------------------------------ 5233 */ 5234 5235 const NAME$3 = 'popover'; 5236 const DATA_KEY$3 = 'bs.popover'; 5237 const EVENT_KEY$3 = `.${DATA_KEY$3}`; 5238 const CLASS_PREFIX = 'bs-popover'; 5239 const Default$2 = { ...Tooltip.Default, 5240 placement: 'right', 5241 offset: [0, 8], 5242 trigger: 'click', 5243 content: '', 5244 template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>' 5245 }; 5246 const DefaultType$2 = { ...Tooltip.DefaultType, 5247 content: '(string|element|function)' 5248 }; 5249 const Event$1 = { 5250 HIDE: `hide${EVENT_KEY$3}`, 5251 HIDDEN: `hidden${EVENT_KEY$3}`, 5252 SHOW: `show${EVENT_KEY$3}`, 5253 SHOWN: `shown${EVENT_KEY$3}`, 5254 INSERTED: `inserted${EVENT_KEY$3}`, 5255 CLICK: `click${EVENT_KEY$3}`, 5256 FOCUSIN: `focusin${EVENT_KEY$3}`, 5257 FOCUSOUT: `focusout${EVENT_KEY$3}`, 5258 MOUSEENTER: `mouseenter${EVENT_KEY$3}`, 5259 MOUSELEAVE: `mouseleave${EVENT_KEY$3}` 5260 }; 5261 const SELECTOR_TITLE = '.popover-header';
5262 const SELECTOR_CONTENT = '.popover-body'; 5263 /** 5264 * ------------------------------------------------------------------------ 5265 * Class Definition 5266 * ------------------------------------------------------------------------ 5267 */ 5268 5269 class Popover extends Tooltip { 5270 // Getters 5271 static get Default() { 5272 return Default$2; 5273 } 5274 5275 static get NAME() { 5276 return NAME$3; 5277 } 5278 5279 static get Event() { 5280 return Event$1; 5281 } 5282 5283 static get DefaultType() { 5284 return DefaultType$2; 5285 } // Overrides 5286 5287 5288 isWithContent() { 5289 return this.getTitle() || this._getContent(); 5290 } 5291 5292 setContent(tip) { 5293 this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE); 5294 5295 this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT); 5296 } // Private 5297 5298 5299 _getContent() { 5300 return this._resolvePossibleFunction(this._config.content); 5301 } 5302 5303 _getBasicClassPrefix() { 5304 return CLASS_PREFIX; 5305 } // Static 5306 5307 5308 static jQueryInterface(config) { 5309 return this.each(function () { 5310 const data = Popover.getOrCreateInstance(this, config); 5311 5312 if (typeof config === 'string') { 5313 if (typeof data[config] === 'undefined') { 5314 throw new TypeError(`No method named "${config}"`); 5315 } 5316 5317 data[config](); 5318 } 5319 }); 5320 } 5321 5322 } 5323 /** 5324 * ------------------------------------------------------------------------ 5325 * jQuery 5326 * ------------------------------------------------------------------------ 5327 * add .Popover to jQuery only if jQuery is present 5328 */ 5329 5330 5331 defineJQueryPlugin(Popover); 5332 5333 /** 5334 * -------------------------------------------------------------------------- 5335 * Bootstrap (v5.1.3): scrollspy.js 5336 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5337 * -------------------------------------------------------------------------- 5338 */ 5339 /** 5340 * ------------------------------------------------------------------------ 5341 * Constants 5342 * ------------------------------------------------------------------------ 5343 */ 5344 5345 const NAME$2 = 'scrollspy'; 5346 const DATA_KEY$2 = 'bs.scrollspy'; 5347 const EVENT_KEY$2 = `.${DATA_KEY$2}`; 5348 const DATA_API_KEY$1 = '.data-api'; 5349 const Default$1 = { 5350 offset: 10, 5351 method: 'auto', 5352 target: '' 5353 }; 5354 const DefaultType$1 = { 5355 offset: 'number', 5356 method: 'string', 5357 target: '(string|element)' 5358 }; 5359 const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`; 5360 const EVENT_SCROLL = `scroll${EVENT_KEY$2}`; 5361 const EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`; 5362 const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; 5363 const CLASS_NAME_ACTIVE$1 = 'active'; 5364 const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'; 5365 const SELECTOR_NAV_LIST_GROUP$1 = '.navvduyuru, .list-group'; 5366 const SELECTOR_NAV_LINKS = '.navvduyuru-link'; 5367 const SELECTOR_NAV_ITEMS = '.navvduyuru-item'; 5368 const SELECTOR_LIST_ITEMS = '.list-group-item'; 5369 const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`; 5370 const SELECTOR_DROPDOWN$1 = '.dropdown'; 5371 const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; 5372 const METHOD_OFFSET = 'offset'; 5373 const METHOD_POSITION = 'position'; 5374 /** 5375 * ------------------------------------------------------------------------ 5376 * Class Definition 5377 * ------------------------------------------------------------------------ 5378 */ 5379 5380 class ScrollSpy extends BaseComponent { 5381 constructor(element, config) { 5382 super(element); 5383 this._scrollElement = this._element.tagName === 'BODY' ? window : this._element; 5384 this._config = this._getConfig(config); 5385 this._offsets = []; 5386 this._targets = []; 5387 this._activeTarget = null; 5388 this._scrollHeight = 0; 5389 EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process()); 5390 this.refresh(); 5391 5392 this._process(); 5393 } // Getters 5394 5395 5396 static get Default() { 5397 return Default$1; 5398 } 5399 5400 static get NAME() { 5401 return NAME$2; 5402 } // Public 5403 5404 5405 refresh() { 5406 const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION; 5407 const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 5408 const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0; 5409 this._offsets = []; 5410 this._targets = []; 5411 this._scrollHeight = this._getScrollHeight(); 5412 const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target); 5413 targets.map(element => { 5414 const targetSelector = getSelectorFromElement(element); 5415 const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null; 5416 5417 if (target) { 5418 const targetBCR = target.getBoundingClientRect(); 5419 5420 if (targetBCR.width || targetBCR.height) { 5421 return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector]; 5422 } 5423 } 5424 5425 return null; 5426 }).filter(item => item).sort((a, b) =>
5426 a[0] - b[0]).forEach(item => { 5427 this._offsets.push(item[0]); 5428 5429 this._targets.push(item[1]); 5430 }); 5431 } 5432 5433 dispose() { 5434 EventHandler.off(this._scrollElement, EVENT_KEY$2); 5435 super.dispose(); 5436 } // Private 5437 5438 5439 _getConfig(config) { 5440 config = { ...Default$1, 5441 ...Manipulator.getDataAttributes(this._element), 5442 ...(typeof config === 'object' && config ? config : {}) 5443 }; 5444 config.target = getElement(config.target) || document.documentElement; 5445 typeCheckConfig(NAME$2, config, DefaultType$1); 5446 return config; 5447 } 5448 5449 _getScrollTop() { 5450 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 5451 } 5452 5453 _getScrollHeight() { 5454 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 5455 } 5456 5457 _getOffsetHeight() { 5458 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 5459 } 5460 5461 _process() { 5462 const scrollTop = this._getScrollTop() + this._config.offset; 5463 5464 const scrollHeight = this._getScrollHeight(); 5465 5466 const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 5467 5468 if (this._scrollHeight !== scrollHeight) { 5469 this.refresh(); 5470 } 5471 5472 if (scrollTop >= maxScroll) { 5473 const target = this._targets[this._targets.length - 1]; 5474 5475 if (this._activeTarget !== target) { 5476 this._activate(target); 5477 } 5478 5479 return; 5480 } 5481 5482 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 5483 this._activeTarget = null; 5484 5485 this._clear(); 5486 5487 return; 5488 } 5489 5490 for (let i = this._offsets.length; i--;) { 5491 const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 5492 5493 if (isActiveTarget) { 5494 this._activate(this._targets[i]); 5495 } 5496 } 5497 } 5498 5499 _activate(target) { 5500 this._activeTarget = target; 5501 5502 this._clear(); 5503 5504 const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`); 5505 const link = SelectorEngine.findOne(queries.join(','), this._config.target); 5506 link.classList.add(CLASS_NAME_ACTIVE$1); 5507 5508 if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { 5509 SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1); 5510 } else { 5511 SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => { 5512 // Set triggered links parents as active
5513 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 5514 SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1)); // Handle special case when .nav-link is inside .nav-item 5515 5516 SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(navItem => { 5517 SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1)); 5518 }); 5519 }); 5520 } 5521 5522 EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, { 5523 relatedTarget: target 5524 }); 5525 } 5526 5527 _clear() { 5528 SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1)); 5529 } // Static 5530 5531 5532 static jQueryInterface(config) { 5533 return this.each(function () { 5534 const data = ScrollSpy.getOrCreateInstance(this, config); 5535 5536 if (typeof config !== 'string') { 5537 return; 5538 } 5539 5540 if (typeof data[config] === 'undefined') { 5541 throw new TypeError(`No method named "${config}"`); 5542 } 5543 5544 data[config](); 5545 }); 5546 } 5547 5548 } 5549 /** 5550 * ------------------------------------------------------------------------ 5551 * Data Api implementation 5552 * ------------------------------------------------------------------------ 5553 */ 5554 5555 5556 EventHandler.on(window, EVENT_LOAD_DATA_API, () => { 5557 SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy)); 5558 }); 5559 /** 5560 * ------------------------------------------------------------------------ 5561 * jQuery 5562 * ------------------------------------------------------------------------ 5563 * add .ScrollSpy to jQuery only if jQuery is present 5564 */ 5565 5566 defineJQueryPlugin(ScrollSpy); 5567 5568 /** 5569 * -------------------------------------------------------------------------- 5570 * Bootstrap (v5.1.3): tab.js 5571 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5572 * -------------------------------------------------------------------------- 5573 */ 5574 /** 5575 * ------------------------------------------------------------------------ 5576 * Constants 5577 * ------------------------------------------------------------------------ 5578 */ 5579 5580 const NAME$1 = 'tab'; 5581 const DATA_KEY$1 = 'bs.tab'; 5582 const EVENT_KEY$1 = `.${DATA_KEY$1}`; 5583 const DATA_API_KEY = '.data-api'; 5584 const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`; 5585 const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`; 5586 const EVENT_SHOW$1 = `show${EVENT_KEY$1}`; 5587 const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`; 5588 const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`; 5589 const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; 5590 const CLASS_NAME_ACTIVE = 'active'; 5591 const CLASS_NAME_FADE$1 = 'fade';
5592 const CLASS_NAME_SHOW$1 = 'show'; 5593 const SELECTOR_DROPDOWN = '.dropdown'; 5594 const SELECTOR_NAV_LIST_GROUP = '.navvduyuru, .list-group'; 5595 const SELECTOR_ACTIVE = '.active'; 5596 const SELECTOR_ACTIVE_UL = ':scope > li > .active'; 5597 const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; 5598 const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; 5599 const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active'; 5600 /** 5601 * ------------------------------------------------------------------------ 5602 * Class Definition 5603 * ------------------------------------------------------------------------ 5604 */ 5605 5606 class Tab extends BaseComponent { 5607 // Getters 5608 static get NAME() { 5609 return NAME$1; 5610 } // Public 5611 5612 5613 show() { 5614 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) { 5615 return; 5616 } 5617 5618 let previous; 5619 const target = getElementFromSelector(this._element); 5620 5621 const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP); 5622 5623 if (listElement) { 5624 const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE; 5625 previous = SelectorEngine.find(itemSelector, listElement); 5626 previous = previous[previous.length - 1]; 5627 } 5628 5629 const hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, { 5630 relatedTarget: this._element 5631 }) : null; 5632 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, { 5633 relatedTarget: previous 5634 }); 5635 5636 if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) { 5637 return; 5638 } 5639 5640 this._activate(this._element, listElement); 5641 5642 const complete = () => { 5643 EventHandler.trigger(previous, EVENT_HIDDEN$1, { 5644 relatedTarget: this._element 5645 }); 5646 EventHandler.trigger(this._element, EVENT_SHOWN$1, { 5647 relatedTarget: previous 5648 }); 5649 }; 5650 5651 if (target) { 5652 this._activate(target, target.parentNode, complete); 5653 } else { 5654 complete(); 5655 } 5656 } // Private 5657 5658 5659 _activate(element, container, callback) { 5660 const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE); 5661 const active = activeElements[0]; 5662 const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1); 5663 5664 const complete = () => this._transitionComplete(element, active, callback); 5665 5666 if (active && isTransitioning) { 5667 active.classList.remove(CLASS_NAME_SHOW$1); 5668 5669 this._queueCallback(complete, element, true); 5670 } else { 5671 complete(); 5672 } 5673 } 5674 5675 _transitionComplete(element, active, callback) { 5676 if (active) { 5677 active.classList.remove(CLASS_NAME_ACTIVE);
5678 const dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode); 5679 5680 if (dropdownChild) { 5681 dropdownChild.classList.remove(CLASS_NAME_ACTIVE); 5682 } 5683 5684 if (active.getAttribute('role') === 'tab') { 5685 active.setAttribute('aria-selected', false); 5686 } 5687 } 5688 5689 element.classList.add(CLASS_NAME_ACTIVE); 5690 5691 if (element.getAttribute('role') === 'tab') { 5692 element.setAttribute('aria-selected', true); 5693 } 5694 5695 reflow(element); 5696 5697 if (element.classList.contains(CLASS_NAME_FADE$1)) { 5698 element.classList.add(CLASS_NAME_SHOW$1); 5699 } 5700 5701 let parent = element.parentNode; 5702 5703 if (parent && parent.nodeName === 'LI') { 5704 parent = parent.parentNode; 5705 } 5706 5707 if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) { 5708 const dropdownElement = element.closest(SELECTOR_DROPDOWN); 5709 5710 if (dropdownElement) { 5711 SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE)); 5712 } 5713 5714 element.setAttribute('aria-expanded', true); 5715 } 5716 5717 if (callback) { 5718 callback(); 5719 } 5720 } // Static 5721 5722 5723 static jQueryInterface(config) { 5724 return this.each(function () { 5725 const data = Tab.getOrCreateInstance(this); 5726 5727 if (typeof config === 'string') { 5728 if (typeof data[config] === 'undefined') { 5729 throw new TypeError(`No method named "${config}"`); 5730 } 5731 5732 data[config](); 5733 } 5734 }); 5735 } 5736 5737 } 5738 5739 5740 5741 EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { 5742 if (['A', 'AREA'].includes(this.tagName)) { 5743 event.preventDefault(); 5744 } 5745 5746 if (isDisabled(this)) { 5747 return; 5748 } 5749 5750 const data = Tab.getOrCreateInstance(this); 5751 data.show(); 5752 }); 5753 5754 5755 defineJQueryPlugin(Tab); 5756 5757 5758 5759 const index_umd = { 5760 Alert, 5761 Button, 5762 Carousel, 5763 Collapse, 5764 Dropdown, 5765 Modal, 5766 Offcanvas, 5767 Popover, 5768 ScrollSpy, 5769 Tab, 5770 Toast, 5771 Tooltip 5772 }; 5773 5774 return index_umd; 5775 5776})); 5777//# sourceMappingURL=bootstrap.bundle.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.