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