You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4999 lines
136 KiB

  1. /*!
  2. * Bootstrap v5.1.3 (https://getbootstrap.com/)
  3. * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5. */
  6. import * as Popper from '@popperjs/core';
  7. /**
  8. * --------------------------------------------------------------------------
  9. * Bootstrap (v5.1.3): util/index.js
  10. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  11. * --------------------------------------------------------------------------
  12. */
  13. const MAX_UID = 1000000;
  14. const MILLISECONDS_MULTIPLIER = 1000;
  15. const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  16. const toType = obj => {
  17. if (obj === null || obj === undefined) {
  18. return `${obj}`;
  19. }
  20. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  21. };
  22. /**
  23. * --------------------------------------------------------------------------
  24. * Public Util Api
  25. * --------------------------------------------------------------------------
  26. */
  27. const getUID = prefix => {
  28. do {
  29. prefix += Math.floor(Math.random() * MAX_UID);
  30. } while (document.getElementById(prefix));
  31. return prefix;
  32. };
  33. const getSelector = element => {
  34. let selector = element.getAttribute('data-bs-target');
  35. if (!selector || selector === '#') {
  36. let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
  37. // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
  38. // `document.querySelector` will rightfully complain it is invalid.
  39. // See https://github.com/twbs/bootstrap/issues/32273
  40. if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
  41. return null;
  42. } // Just in case some CMS puts out a full URL with the anchor appended
  43. if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
  44. hrefAttr = `#${hrefAttr.split('#')[1]}`;
  45. }
  46. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
  47. }
  48. return selector;
  49. };
  50. const getSelectorFromElement = element => {
  51. const selector = getSelector(element);
  52. if (selector) {
  53. return document.querySelector(selector) ? selector : null;
  54. }
  55. return null;
  56. };
  57. const getElementFromSelector = element => {
  58. const selector = getSelector(element);
  59. return selector ? document.querySelector(selector) : null;
  60. };
  61. const getTransitionDurationFromElement = element => {
  62. if (!element) {
  63. return 0;
  64. } // Get transition-duration of the element
  65. let {
  66. transitionDuration,
  67. transitionDelay
  68. } = window.getComputedStyle(element);
  69. const floatTransitionDuration = Number.parseFloat(transitionDuration);
  70. const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  71. if (!floatTransitionDuration && !floatTransitionDelay) {
  72. return 0;
  73. } // If multiple durations are defined, take the first
  74. transitionDuration = transitionDuration.split(',')[0];
  75. transitionDelay = transitionDelay.split(',')[0];
  76. return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  77. };
  78. const triggerTransitionEnd = element => {
  79. element.dispatchEvent(new Event(TRANSITION_END));
  80. };
  81. const isElement = obj => {
  82. if (!obj || typeof obj !== 'object') {
  83. return false;
  84. }
  85. if (typeof obj.jquery !== 'undefined') {
  86. obj = obj[0];
  87. }
  88. return typeof obj.nodeType !== 'undefined';
  89. };
  90. const getElement = obj => {
  91. if (isElement(obj)) {
  92. // it's a jQuery object or a node element
  93. return obj.jquery ? obj[0] : obj;
  94. }
  95. if (typeof obj === 'string' && obj.length > 0) {
  96. return document.querySelector(obj);
  97. }
  98. return null;
  99. };
  100. const typeCheckConfig = (componentName, config, configTypes) => {
  101. Object.keys(configTypes).forEach(property => {
  102. const expectedTypes = configTypes[property];
  103. const value = config[property];
  104. const valueType = value && isElement(value) ? 'element' : toType(value);
  105. if (!new RegExp(expectedTypes).test(valueType)) {
  106. throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
  107. }
  108. });
  109. };
  110. const isVisible = element => {
  111. if (!isElement(element) || element.getClientRects().length === 0) {
  112. return false;
  113. }
  114. return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
  115. };
  116. const isDisabled = element => {
  117. if (!element || element.nodeType !== Node.ELEMENT_NODE) {
  118. return true;
  119. }
  120. if (element.classList.contains('disabled')) {
  121. return true;
  122. }
  123. if (typeof element.disabled !== 'undefined') {
  124. return element.disabled;
  125. }
  126. return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
  127. };
  128. const findShadowRoot = element => {
  129. if (!document.documentElement.attachShadow) {
  130. return null;
  131. } // Can find the shadow root otherwise it'll return the document
  132. if (typeof element.getRootNode === 'function') {
  133. const root = element.getRootNode();
  134. return root instanceof ShadowRoot ? root : null;
  135. }
  136. if (element instanceof ShadowRoot) {
  137. return element;
  138. } // when we don't find a shadow root
  139. if (!element.parentNode) {
  140. return null;
  141. }
  142. return findShadowRoot(element.parentNode);
  143. };
  144. const noop = () => {};
  145. /**
  146. * Trick to restart an element's animation
  147. *
  148. * @param {HTMLElement} element
  149. * @return void
  150. *
  151. * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
  152. */
  153. const reflow = element => {
  154. // eslint-disable-next-line no-unused-expressions
  155. element.offsetHeight;
  156. };
  157. const getjQuery = () => {
  158. const {
  159. jQuery
  160. } = window;
  161. if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
  162. return jQuery;
  163. }
  164. return null;
  165. };
  166. const DOMContentLoadedCallbacks = [];
  167. const onDOMContentLoaded = callback => {
  168. if (document.readyState === 'loading') {
  169. // add listener on the first call when the document is in loading state
  170. if (!DOMContentLoadedCallbacks.length) {
  171. document.addEventListener('DOMContentLoaded', () => {
  172. DOMContentLoadedCallbacks.forEach(callback => callback());
  173. });
  174. }
  175. DOMContentLoadedCallbacks.push(callback);
  176. } else {
  177. callback();
  178. }
  179. };
  180. const isRTL = () => document.documentElement.dir === 'rtl';
  181. const defineJQueryPlugin = plugin => {
  182. onDOMContentLoaded(() => {
  183. const $ = getjQuery();
  184. /* istanbul ignore if */
  185. if ($) {
  186. const name = plugin.NAME;
  187. const JQUERY_NO_CONFLICT = $.fn[name];
  188. $.fn[name] = plugin.jQueryInterface;
  189. $.fn[name].Constructor = plugin;
  190. $.fn[name].noConflict = () => {
  191. $.fn[name] = JQUERY_NO_CONFLICT;
  192. return plugin.jQueryInterface;
  193. };
  194. }
  195. });
  196. };
  197. const execute = callback => {
  198. if (typeof callback === 'function') {
  199. callback();
  200. }
  201. };
  202. const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
  203. if (!waitForTransition) {
  204. execute(callback);
  205. return;
  206. }
  207. const durationPadding = 5;
  208. const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
  209. let called = false;
  210. const handler = ({
  211. target
  212. }) => {
  213. if (target !== transitionElement) {
  214. return;
  215. }
  216. called = true;
  217. transitionElement.removeEventListener(TRANSITION_END, handler);
  218. execute(callback);
  219. };
  220. transitionElement.addEventListener(TRANSITION_END, handler);
  221. setTimeout(() => {
  222. if (!called) {
  223. triggerTransitionEnd(transitionElement);
  224. }
  225. }, emulatedDuration);
  226. };
  227. /**
  228. * Return the previous/next element of a list.
  229. *
  230. * @param {array} list The list of elements
  231. * @param activeElement The active element
  232. * @param shouldGetNext Choose to get next or previous element
  233. * @param isCycleAllowed
  234. * @return {Element|elem} The proper element
  235. */
  236. const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
  237. let index = list.indexOf(activeElement); // if the element does not exist in the list return an element depending on the direction and if cycle is allowed
  238. if (index === -1) {
  239. return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
  240. }
  241. const listLength = list.length;
  242. index += shouldGetNext ? 1 : -1;
  243. if (isCycleAllowed) {
  244. index = (index + listLength) % listLength;
  245. }
  246. return list[Math.max(0, Math.min(index, listLength - 1))];
  247. };
  248. /**
  249. * --------------------------------------------------------------------------
  250. * Bootstrap (v5.1.3): dom/event-handler.js
  251. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  252. * --------------------------------------------------------------------------
  253. */
  254. /**
  255. * ------------------------------------------------------------------------
  256. * Constants
  257. * ------------------------------------------------------------------------
  258. */
  259. const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
  260. const stripNameRegex = /\..*/;
  261. const stripUidRegex = /::\d+$/;
  262. const eventRegistry = {}; // Events storage
  263. let uidEvent = 1;
  264. const customEvents = {
  265. mouseenter: 'mouseover',
  266. mouseleave: 'mouseout'
  267. };
  268. const customEventsRegex = /^(mouseenter|mouseleave)/i;
  269. 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']);
  270. /**
  271. * ------------------------------------------------------------------------
  272. * Private methods
  273. * ------------------------------------------------------------------------
  274. */
  275. function getUidEvent(element, uid) {
  276. return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
  277. }
  278. function getEvent(element) {
  279. const uid = getUidEvent(element);
  280. element.uidEvent = uid;
  281. eventRegistry[uid] = eventRegistry[uid] || {};
  282. return eventRegistry[uid];
  283. }
  284. function bootstrapHandler(element, fn) {
  285. return function handler(event) {
  286. event.delegateTarget = element;
  287. if (handler.oneOff) {
  288. EventHandler.off(element, event.type, fn);
  289. }
  290. return fn.apply(element, [event]);
  291. };
  292. }
  293. function bootstrapDelegationHandler(element, selector, fn) {
  294. return function handler(event) {
  295. const domElements = element.querySelectorAll(selector);
  296. for (let {
  297. target
  298. } = event; target && target !== this; target = target.parentNode) {
  299. for (let i = domElements.length; i--;) {
  300. if (domElements[i] === target) {
  301. event.delegateTarget = target;
  302. if (handler.oneOff) {
  303. EventHandler.off(element, event.type, selector, fn);
  304. }
  305. return fn.apply(target, [event]);
  306. }
  307. }
  308. } // To please ESLint
  309. return null;
  310. };
  311. }
  312. function findHandler(events, handler, delegationSelector = null) {
  313. const uidEventList = Object.keys(events);
  314. for (let i = 0, len = uidEventList.length; i < len; i++) {
  315. const event = events[uidEventList[i]];
  316. if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
  317. return event;
  318. }
  319. }
  320. return null;
  321. }
  322. function normalizeParams(originalTypeEvent, handler, delegationFn) {
  323. const delegation = typeof handler === 'string';
  324. const originalHandler = delegation ? delegationFn : handler;
  325. let typeEvent = getTypeEvent(originalTypeEvent);
  326. const isNative = nativeEvents.has(typeEvent);
  327. if (!isNative) {
  328. typeEvent = originalTypeEvent;
  329. }
  330. return [delegation, originalHandler, typeEvent];
  331. }
  332. function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
  333. if (typeof originalTypeEvent !== 'string' || !element) {
  334. return;
  335. }
  336. if (!handler) {
  337. handler = delegationFn;
  338. delegationFn = null;
  339. } // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
  340. // this prevents the handler from being dispatched the same way as mouseover or mouseout does
  341. if (customEventsRegex.test(originalTypeEvent)) {
  342. const wrapFn = fn => {
  343. return function (event) {
  344. if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
  345. return fn.call(this, event);
  346. }
  347. };
  348. };
  349. if (delegationFn) {
  350. delegationFn = wrapFn(delegationFn);
  351. } else {
  352. handler = wrapFn(handler);
  353. }
  354. }
  355. const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
  356. const events = getEvent(element);
  357. const handlers = events[typeEvent] || (events[typeEvent] = {});
  358. const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
  359. if (previousFn) {
  360. previousFn.oneOff = previousFn.oneOff && oneOff;
  361. return;
  362. }
  363. const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
  364. const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
  365. fn.delegationSelector = delegation ? handler : null;
  366. fn.originalHandler = originalHandler;
  367. fn.oneOff = oneOff;
  368. fn.uidEvent = uid;
  369. handlers[uid] = fn;
  370. element.addEventListener(typeEvent, fn, delegation);
  371. }
  372. function removeHandler(element, events, typeEvent, handler, delegationSelector) {
  373. const fn = findHandler(events[typeEvent], handler, delegationSelector);
  374. if (!fn) {
  375. return;
  376. }
  377. element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
  378. delete events[typeEvent][fn.uidEvent];
  379. }
  380. function removeNamespacedHandlers(element, events, typeEvent, namespace) {
  381. const storeElementEvent = events[typeEvent] || {};
  382. Object.keys(storeElementEvent).forEach(handlerKey => {
  383. if (handlerKey.includes(namespace)) {
  384. const event = storeElementEvent[handlerKey];
  385. removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
  386. }
  387. });
  388. }
  389. function getTypeEvent(event) {
  390. // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
  391. event = event.replace(stripNameRegex, '');
  392. return customEvents[event] || event;
  393. }
  394. const EventHandler = {
  395. on(element, event, handler, delegationFn) {
  396. addHandler(element, event, handler, delegationFn, false);
  397. },
  398. one(element, event, handler, delegationFn) {
  399. addHandler(element, event, handler, delegationFn, true);
  400. },
  401. off(element, originalTypeEvent, handler, delegationFn) {
  402. if (typeof originalTypeEvent !== 'string' || !element) {
  403. return;
  404. }
  405. const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
  406. const inNamespace = typeEvent !== originalTypeEvent;
  407. const events = getEvent(element);
  408. const isNamespace = originalTypeEvent.startsWith('.');
  409. if (typeof originalHandler !== 'undefined') {
  410. // Simplest case: handler is passed, remove that listener ONLY.
  411. if (!events || !events[typeEvent]) {
  412. return;
  413. }
  414. removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
  415. return;
  416. }
  417. if (isNamespace) {
  418. Object.keys(events).forEach(elementEvent => {
  419. removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
  420. });
  421. }
  422. const storeElementEvent = events[typeEvent] || {};
  423. Object.keys(storeElementEvent).forEach(keyHandlers => {
  424. const handlerKey = keyHandlers.replace(stripUidRegex, '');
  425. if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
  426. const event = storeElementEvent[keyHandlers];
  427. removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
  428. }
  429. });
  430. },
  431. trigger(element, event, args) {
  432. if (typeof event !== 'string' || !element) {
  433. return null;
  434. }
  435. const $ = getjQuery();
  436. const typeEvent = getTypeEvent(event);
  437. const inNamespace = event !== typeEvent;
  438. const isNative = nativeEvents.has(typeEvent);
  439. let jQueryEvent;
  440. let bubbles = true;
  441. let nativeDispatch = true;
  442. let defaultPrevented = false;
  443. let evt = null;
  444. if (inNamespace && $) {
  445. jQueryEvent = $.Event(event, args);
  446. $(element).trigger(jQueryEvent);
  447. bubbles = !jQueryEvent.isPropagationStopped();
  448. nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
  449. defaultPrevented = jQueryEvent.isDefaultPrevented();
  450. }
  451. if (isNative) {
  452. evt = document.createEvent('HTMLEvents');
  453. evt.initEvent(typeEvent, bubbles, true);
  454. } else {
  455. evt = new CustomEvent(event, {
  456. bubbles,
  457. cancelable: true
  458. });
  459. } // merge custom information in our event
  460. if (typeof args !== 'undefined') {
  461. Object.keys(args).forEach(key => {
  462. Object.defineProperty(evt, key, {
  463. get() {
  464. return args[key];
  465. }
  466. });
  467. });
  468. }
  469. if (defaultPrevented) {
  470. evt.preventDefault();
  471. }
  472. if (nativeDispatch) {
  473. element.dispatchEvent(evt);
  474. }
  475. if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
  476. jQueryEvent.preventDefault();
  477. }
  478. return evt;
  479. }
  480. };
  481. /**
  482. * --------------------------------------------------------------------------
  483. * Bootstrap (v5.1.3): dom/data.js
  484. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  485. * --------------------------------------------------------------------------
  486. */
  487. /**
  488. * ------------------------------------------------------------------------
  489. * Constants
  490. * ------------------------------------------------------------------------
  491. */
  492. const elementMap = new Map();
  493. const Data = {
  494. set(element, key, instance) {
  495. if (!elementMap.has(element)) {
  496. elementMap.set(element, new Map());
  497. }
  498. const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
  499. // can be removed later when multiple key/instances are fine to be used
  500. if (!instanceMap.has(key) && instanceMap.size !== 0) {
  501. // eslint-disable-next-line no-console
  502. console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
  503. return;
  504. }
  505. instanceMap.set(key, instance);
  506. },
  507. get(element, key) {
  508. if (elementMap.has(element)) {
  509. return elementMap.get(element).get(key) || null;
  510. }
  511. return null;
  512. },
  513. remove(element, key) {
  514. if (!elementMap.has(element)) {
  515. return;
  516. }
  517. const instanceMap = elementMap.get(element);
  518. instanceMap.delete(key); // free up element references if there are no instances left for an element
  519. if (instanceMap.size === 0) {
  520. elementMap.delete(element);
  521. }
  522. }
  523. };
  524. /**
  525. * --------------------------------------------------------------------------
  526. * Bootstrap (v5.1.3): base-component.js
  527. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  528. * --------------------------------------------------------------------------
  529. */
  530. /**
  531. * ------------------------------------------------------------------------
  532. * Constants
  533. * ------------------------------------------------------------------------
  534. */
  535. const VERSION = '5.1.3';
  536. class BaseComponent {
  537. constructor(element) {
  538. element = getElement(element);
  539. if (!element) {
  540. return;
  541. }
  542. this._element = element;
  543. Data.set(this._element, this.constructor.DATA_KEY, this);
  544. }
  545. dispose() {
  546. Data.remove(this._element, this.constructor.DATA_KEY);
  547. EventHandler.off(this._element, this.constructor.EVENT_KEY);
  548. Object.getOwnPropertyNames(this).forEach(propertyName => {
  549. this[propertyName] = null;
  550. });
  551. }
  552. _queueCallback(callback, element, isAnimated = true) {
  553. executeAfterTransition(callback, element, isAnimated);
  554. }
  555. /** Static */
  556. static getInstance(element) {
  557. return Data.get(getElement(element), this.DATA_KEY);
  558. }
  559. static getOrCreateInstance(element, config = {}) {
  560. return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
  561. }
  562. static get VERSION() {
  563. return VERSION;
  564. }
  565. static get NAME() {
  566. throw new Error('You have to implement the static method "NAME", for each component!');
  567. }
  568. static get DATA_KEY() {
  569. return `bs.${this.NAME}`;
  570. }
  571. static get EVENT_KEY() {
  572. return `.${this.DATA_KEY}`;
  573. }
  574. }
  575. /**
  576. * --------------------------------------------------------------------------
  577. * Bootstrap (v5.1.3): util/component-functions.js
  578. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  579. * --------------------------------------------------------------------------
  580. */
  581. const enableDismissTrigger = (component, method = 'hide') => {
  582. const clickEvent = `click.dismiss${component.EVENT_KEY}`;
  583. const name = component.NAME;
  584. EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
  585. if (['A', 'AREA'].includes(this.tagName)) {
  586. event.preventDefault();
  587. }
  588. if (isDisabled(this)) {
  589. return;
  590. }
  591. const target = getElementFromSelector(this) || this.closest(`.${name}`);
  592. const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
  593. instance[method]();
  594. });
  595. };
  596. /**
  597. * --------------------------------------------------------------------------
  598. * Bootstrap (v5.1.3): alert.js
  599. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  600. * --------------------------------------------------------------------------
  601. */
  602. /**
  603. * ------------------------------------------------------------------------
  604. * Constants
  605. * ------------------------------------------------------------------------
  606. */
  607. const NAME$d = 'alert';
  608. const DATA_KEY$c = 'bs.alert';
  609. const EVENT_KEY$c = `.${DATA_KEY$c}`;
  610. const EVENT_CLOSE = `close${EVENT_KEY$c}`;
  611. const EVENT_CLOSED = `closed${EVENT_KEY$c}`;
  612. const CLASS_NAME_FADE$5 = 'fade';
  613. const CLASS_NAME_SHOW$8 = 'show';
  614. /**
  615. * ------------------------------------------------------------------------
  616. * Class Definition
  617. * ------------------------------------------------------------------------
  618. */
  619. class Alert extends BaseComponent {
  620. // Getters
  621. static get NAME() {
  622. return NAME$d;
  623. } // Public
  624. close() {
  625. const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
  626. if (closeEvent.defaultPrevented) {
  627. return;
  628. }
  629. this._element.classList.remove(CLASS_NAME_SHOW$8);
  630. const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5);
  631. this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
  632. } // Private
  633. _destroyElement() {
  634. this._element.remove();
  635. EventHandler.trigger(this._element, EVENT_CLOSED);
  636. this.dispose();
  637. } // Static
  638. static jQueryInterface(config) {
  639. return this.each(function () {
  640. const data = Alert.getOrCreateInstance(this);
  641. if (typeof config !== 'string') {
  642. return;
  643. }
  644. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  645. throw new TypeError(`No method named "${config}"`);
  646. }
  647. data[config](this);
  648. });
  649. }
  650. }
  651. /**
  652. * ------------------------------------------------------------------------
  653. * Data Api implementation
  654. * ------------------------------------------------------------------------
  655. */
  656. enableDismissTrigger(Alert, 'close');
  657. /**
  658. * ------------------------------------------------------------------------
  659. * jQuery
  660. * ------------------------------------------------------------------------
  661. * add .Alert to jQuery only if jQuery is present
  662. */
  663. defineJQueryPlugin(Alert);
  664. /**
  665. * --------------------------------------------------------------------------
  666. * Bootstrap (v5.1.3): button.js
  667. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  668. * --------------------------------------------------------------------------
  669. */
  670. /**
  671. * ------------------------------------------------------------------------
  672. * Constants
  673. * ------------------------------------------------------------------------
  674. */
  675. const NAME$c = 'button';
  676. const DATA_KEY$b = 'bs.button';
  677. const EVENT_KEY$b = `.${DATA_KEY$b}`;
  678. const DATA_API_KEY$7 = '.data-api';
  679. const CLASS_NAME_ACTIVE$3 = 'active';
  680. const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
  681. const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`;
  682. /**
  683. * ------------------------------------------------------------------------
  684. * Class Definition
  685. * ------------------------------------------------------------------------
  686. */
  687. class Button extends BaseComponent {
  688. // Getters
  689. static get NAME() {
  690. return NAME$c;
  691. } // Public
  692. toggle() {
  693. // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
  694. this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3));
  695. } // Static
  696. static jQueryInterface(config) {
  697. return this.each(function () {
  698. const data = Button.getOrCreateInstance(this);
  699. if (config === 'toggle') {
  700. data[config]();
  701. }
  702. });
  703. }
  704. }
  705. /**
  706. * ------------------------------------------------------------------------
  707. * Data Api implementation
  708. * ------------------------------------------------------------------------
  709. */
  710. EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => {
  711. event.preventDefault();
  712. const button = event.target.closest(SELECTOR_DATA_TOGGLE$5);
  713. const data = Button.getOrCreateInstance(button);
  714. data.toggle();
  715. });
  716. /**
  717. * ------------------------------------------------------------------------
  718. * jQuery
  719. * ------------------------------------------------------------------------
  720. * add .Button to jQuery only if jQuery is present
  721. */
  722. defineJQueryPlugin(Button);
  723. /**
  724. * --------------------------------------------------------------------------
  725. * Bootstrap (v5.1.3): dom/manipulator.js
  726. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  727. * --------------------------------------------------------------------------
  728. */
  729. function normalizeData(val) {
  730. if (val === 'true') {
  731. return true;
  732. }
  733. if (val === 'false') {
  734. return false;
  735. }
  736. if (val === Number(val).toString()) {
  737. return Number(val);
  738. }
  739. if (val === '' || val === 'null') {
  740. return null;
  741. }
  742. return val;
  743. }
  744. function normalizeDataKey(key) {
  745. return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
  746. }
  747. const Manipulator = {
  748. setDataAttribute(element, key, value) {
  749. element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
  750. },
  751. removeDataAttribute(element, key) {
  752. element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
  753. },
  754. getDataAttributes(element) {
  755. if (!element) {
  756. return {};
  757. }
  758. const attributes = {};
  759. Object.keys(element.dataset).filter(key => key.startsWith('bs')).forEach(key => {
  760. let pureKey = key.replace(/^bs/, '');
  761. pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
  762. attributes[pureKey] = normalizeData(element.dataset[key]);
  763. });
  764. return attributes;
  765. },
  766. getDataAttribute(element, key) {
  767. return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
  768. },
  769. offset(element) {
  770. const rect = element.getBoundingClientRect();
  771. return {
  772. top: rect.top + window.pageYOffset,
  773. left: rect.left + window.pageXOffset
  774. };
  775. },
  776. position(element) {
  777. return {
  778. top: element.offsetTop,
  779. left: element.offsetLeft
  780. };
  781. }
  782. };
  783. /**
  784. * --------------------------------------------------------------------------
  785. * Bootstrap (v5.1.3): dom/selector-engine.js
  786. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  787. * --------------------------------------------------------------------------
  788. */
  789. const NODE_TEXT = 3;
  790. const SelectorEngine = {
  791. find(selector, element = document.documentElement) {
  792. return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
  793. },
  794. findOne(selector, element = document.documentElement) {
  795. return Element.prototype.querySelector.call(element, selector);
  796. },
  797. children(element, selector) {
  798. return [].concat(...element.children).filter(child => child.matches(selector));
  799. },
  800. parents(element, selector) {
  801. const parents = [];
  802. let ancestor = element.parentNode;
  803. while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
  804. if (ancestor.matches(selector)) {
  805. parents.push(ancestor);
  806. }
  807. ancestor = ancestor.parentNode;
  808. }
  809. return parents;
  810. },
  811. prev(element, selector) {
  812. let previous = element.previousElementSibling;
  813. while (previous) {
  814. if (previous.matches(selector)) {
  815. return [previous];
  816. }
  817. previous = previous.previousElementSibling;
  818. }
  819. return [];
  820. },
  821. next(element, selector) {
  822. let next = element.nextElementSibling;
  823. while (next) {
  824. if (next.matches(selector)) {
  825. return [next];
  826. }
  827. next = next.nextElementSibling;
  828. }
  829. return [];
  830. },
  831. focusableChildren(element) {
  832. const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
  833. return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
  834. }
  835. };
  836. /**
  837. * --------------------------------------------------------------------------
  838. * Bootstrap (v5.1.3): carousel.js
  839. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  840. * --------------------------------------------------------------------------
  841. */
  842. /**
  843. * ------------------------------------------------------------------------
  844. * Constants
  845. * ------------------------------------------------------------------------
  846. */
  847. const NAME$b = 'carousel';
  848. const DATA_KEY$a = 'bs.carousel';
  849. const EVENT_KEY$a = `.${DATA_KEY$a}`;
  850. const DATA_API_KEY$6 = '.data-api';
  851. const ARROW_LEFT_KEY = 'ArrowLeft';
  852. const ARROW_RIGHT_KEY = 'ArrowRight';
  853. const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  854. const SWIPE_THRESHOLD = 40;
  855. const Default$a = {
  856. interval: 5000,
  857. keyboard: true,
  858. slide: false,
  859. pause: 'hover',
  860. wrap: true,
  861. touch: true
  862. };
  863. const DefaultType$a = {
  864. interval: '(number|boolean)',
  865. keyboard: 'boolean',
  866. slide: '(boolean|string)',
  867. pause: '(string|boolean)',
  868. wrap: 'boolean',
  869. touch: 'boolean'
  870. };
  871. const ORDER_NEXT = 'next';
  872. const ORDER_PREV = 'prev';
  873. const DIRECTION_LEFT = 'left';
  874. const DIRECTION_RIGHT = 'right';
  875. const KEY_TO_DIRECTION = {
  876. [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
  877. [ARROW_RIGHT_KEY]: DIRECTION_LEFT
  878. };
  879. const EVENT_SLIDE = `slide${EVENT_KEY$a}`;
  880. const EVENT_SLID = `slid${EVENT_KEY$a}`;
  881. const EVENT_KEYDOWN = `keydown${EVENT_KEY$a}`;
  882. const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$a}`;
  883. const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$a}`;
  884. const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$a}`;
  885. const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$a}`;
  886. const EVENT_TOUCHEND = `touchend${EVENT_KEY$a}`;
  887. const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$a}`;
  888. const EVENT_POINTERUP = `pointerup${EVENT_KEY$a}`;
  889. const EVENT_DRAG_START = `dragstart${EVENT_KEY$a}`;
  890. const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$a}${DATA_API_KEY$6}`;
  891. const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
  892. const CLASS_NAME_CAROUSEL = 'carousel';
  893. const CLASS_NAME_ACTIVE$2 = 'active';
  894. const CLASS_NAME_SLIDE = 'slide';
  895. const CLASS_NAME_END = 'carousel-item-end';
  896. const CLASS_NAME_START = 'carousel-item-start';
  897. const CLASS_NAME_NEXT = 'carousel-item-next';
  898. const CLASS_NAME_PREV = 'carousel-item-prev';
  899. const CLASS_NAME_POINTER_EVENT = 'pointer-event';
  900. const SELECTOR_ACTIVE$1 = '.active';
  901. const SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
  902. const SELECTOR_ITEM = '.carousel-item';
  903. const SELECTOR_ITEM_IMG = '.carousel-item img';
  904. const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
  905. const SELECTOR_INDICATORS = '.carousel-indicators';
  906. const SELECTOR_INDICATOR = '[data-bs-target]';
  907. const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
  908. const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
  909. const POINTER_TYPE_TOUCH = 'touch';
  910. const POINTER_TYPE_PEN = 'pen';
  911. /**
  912. * ------------------------------------------------------------------------
  913. * Class Definition
  914. * ------------------------------------------------------------------------
  915. */
  916. class Carousel extends BaseComponent {
  917. constructor(element, config) {
  918. super(element);
  919. this._items = null;
  920. this._interval = null;
  921. this._activeElement = null;
  922. this._isPaused = false;
  923. this._isSliding = false;
  924. this.touchTimeout = null;
  925. this.touchStartX = 0;
  926. this.touchDeltaX = 0;
  927. this._config = this._getConfig(config);
  928. this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
  929. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  930. this._pointerEvent = Boolean(window.PointerEvent);
  931. this._addEventListeners();
  932. } // Getters
  933. static get Default() {
  934. return Default$a;
  935. }
  936. static get NAME() {
  937. return NAME$b;
  938. } // Public
  939. next() {
  940. this._slide(ORDER_NEXT);
  941. }
  942. nextWhenVisible() {
  943. // Don't call next when the page isn't visible
  944. // or the carousel or its parent isn't visible
  945. if (!document.hidden && isVisible(this._element)) {
  946. this.next();
  947. }
  948. }
  949. prev() {
  950. this._slide(ORDER_PREV);
  951. }
  952. pause(event) {
  953. if (!event) {
  954. this._isPaused = true;
  955. }
  956. if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
  957. triggerTransitionEnd(this._element);
  958. this.cycle(true);
  959. }
  960. clearInterval(this._interval);
  961. this._interval = null;
  962. }
  963. cycle(event) {
  964. if (!event) {
  965. this._isPaused = false;
  966. }
  967. if (this._interval) {
  968. clearInterval(this._interval);
  969. this._interval = null;
  970. }
  971. if (this._config && this._config.interval && !this._isPaused) {
  972. this._updateInterval();
  973. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  974. }
  975. }
  976. to(index) {
  977. this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
  978. const activeIndex = this._getItemIndex(this._activeElement);
  979. if (index > this._items.length - 1 || index < 0) {
  980. return;
  981. }
  982. if (this._isSliding) {
  983. EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
  984. return;
  985. }
  986. if (activeIndex === index) {
  987. this.pause();
  988. this.cycle();
  989. return;
  990. }
  991. const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
  992. this._slide(order, this._items[index]);
  993. } // Private
  994. _getConfig(config) {
  995. config = { ...Default$a,
  996. ...Manipulator.getDataAttributes(this._element),
  997. ...(typeof config === 'object' ? config : {})
  998. };
  999. typeCheckConfig(NAME$b, config, DefaultType$a);
  1000. return config;
  1001. }
  1002. _handleSwipe() {
  1003. const absDeltax = Math.abs(this.touchDeltaX);
  1004. if (absDeltax <= SWIPE_THRESHOLD) {
  1005. return;
  1006. }
  1007. const direction = absDeltax / this.touchDeltaX;
  1008. this.touchDeltaX = 0;
  1009. if (!direction) {
  1010. return;
  1011. }
  1012. this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
  1013. }
  1014. _addEventListeners() {
  1015. if (this._config.keyboard) {
  1016. EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
  1017. }
  1018. if (this._config.pause === 'hover') {
  1019. EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event));
  1020. EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event));
  1021. }
  1022. if (this._config.touch && this._touchSupported) {
  1023. this._addTouchEventListeners();
  1024. }
  1025. }
  1026. _addTouchEventListeners() {
  1027. const hasPointerPenTouch = event => {
  1028. return this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
  1029. };
  1030. const start = event => {
  1031. if (hasPointerPenTouch(event)) {
  1032. this.touchStartX = event.clientX;
  1033. } else if (!this._pointerEvent) {
  1034. this.touchStartX = event.touches[0].clientX;
  1035. }
  1036. };
  1037. const move = event => {
  1038. // ensure swiping with one touch and not pinching
  1039. this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
  1040. };
  1041. const end = event => {
  1042. if (hasPointerPenTouch(event)) {
  1043. this.touchDeltaX = event.clientX - this.touchStartX;
  1044. }
  1045. this._handleSwipe();
  1046. if (this._config.pause === 'hover') {
  1047. // If it's a touch-enabled device, mouseenter/leave are fired as
  1048. // part of the mouse compatibility events on first tap - the carousel
  1049. // would stop cycling until user tapped out of it;
  1050. // here, we listen for touchend, explicitly pause the carousel
  1051. // (as if it's the second time we tap on it, mouseenter compat event
  1052. // is NOT fired) and after a timeout (to allow for mouse compatibility
  1053. // events to fire) we explicitly restart cycling
  1054. this.pause();
  1055. if (this.touchTimeout) {
  1056. clearTimeout(this.touchTimeout);
  1057. }
  1058. this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
  1059. }
  1060. };
  1061. SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {
  1062. EventHandler.on(itemImg, EVENT_DRAG_START, event => event.preventDefault());
  1063. });
  1064. if (this._pointerEvent) {
  1065. EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event));
  1066. EventHandler.on(this._element, EVENT_POINTERUP, event => end(event));
  1067. this._element.classList.add(CLASS_NAME_POINTER_EVENT);
  1068. } else {
  1069. EventHandler.on(this._element, EVENT_TOUCHSTART, event => start(event));
  1070. EventHandler.on(this._element, EVENT_TOUCHMOVE, event => move(event));
  1071. EventHandler.on(this._element, EVENT_TOUCHEND, event => end(event));
  1072. }
  1073. }
  1074. _keydown(event) {
  1075. if (/input|textarea/i.test(event.target.tagName)) {
  1076. return;
  1077. }
  1078. const direction = KEY_TO_DIRECTION[event.key];
  1079. if (direction) {
  1080. event.preventDefault();
  1081. this._slide(direction);
  1082. }
  1083. }
  1084. _getItemIndex(element) {
  1085. this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
  1086. return this._items.indexOf(element);
  1087. }
  1088. _getItemByOrder(order, activeElement) {
  1089. const isNext = order === ORDER_NEXT;
  1090. return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
  1091. }
  1092. _triggerSlideEvent(relatedTarget, eventDirectionName) {
  1093. const targetIndex = this._getItemIndex(relatedTarget);
  1094. const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
  1095. return EventHandler.trigger(this._element, EVENT_SLIDE, {
  1096. relatedTarget,
  1097. direction: eventDirectionName,
  1098. from: fromIndex,
  1099. to: targetIndex
  1100. });
  1101. }
  1102. _setActiveIndicatorElement(element) {
  1103. if (this._indicatorsElement) {
  1104. const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement);
  1105. activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
  1106. activeIndicator.removeAttribute('aria-current');
  1107. const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
  1108. for (let i = 0; i < indicators.length; i++) {
  1109. if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) {
  1110. indicators[i].classList.add(CLASS_NAME_ACTIVE$2);
  1111. indicators[i].setAttribute('aria-current', 'true');
  1112. break;
  1113. }
  1114. }
  1115. }
  1116. }
  1117. _updateInterval() {
  1118. const element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
  1119. if (!element) {
  1120. return;
  1121. }
  1122. const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
  1123. if (elementInterval) {
  1124. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  1125. this._config.interval = elementInterval;
  1126. } else {
  1127. this._config.interval = this._config.defaultInterval || this._config.interval;
  1128. }
  1129. }
  1130. _slide(directionOrOrder, element) {
  1131. const order = this._directionToOrder(directionOrOrder);
  1132. const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
  1133. const activeElementIndex = this._getItemIndex(activeElement);
  1134. const nextElement = element || this._getItemByOrder(order, activeElement);
  1135. const nextElementIndex = this._getItemIndex(nextElement);
  1136. const isCycling = Boolean(this._interval);
  1137. const isNext = order === ORDER_NEXT;
  1138. const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
  1139. const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
  1140. const eventDirectionName = this._orderToDirection(order);
  1141. if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$2)) {
  1142. this._isSliding = false;
  1143. return;
  1144. }
  1145. if (this._isSliding) {
  1146. return;
  1147. }
  1148. const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  1149. if (slideEvent.defaultPrevented) {
  1150. return;
  1151. }
  1152. if (!activeElement || !nextElement) {
  1153. // Some weirdness is happening, so we bail
  1154. return;
  1155. }
  1156. this._isSliding = true;
  1157. if (isCycling) {
  1158. this.pause();
  1159. }
  1160. this._setActiveIndicatorElement(nextElement);
  1161. this._activeElement = nextElement;
  1162. const triggerSlidEvent = () => {
  1163. EventHandler.trigger(this._element, EVENT_SLID, {
  1164. relatedTarget: nextElement,
  1165. direction: eventDirectionName,
  1166. from: activeElementIndex,
  1167. to: nextElementIndex
  1168. });
  1169. };
  1170. if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
  1171. nextElement.classList.add(orderClassName);
  1172. reflow(nextElement);
  1173. activeElement.classList.add(directionalClassName);
  1174. nextElement.classList.add(directionalClassName);
  1175. const completeCallBack = () => {
  1176. nextElement.classList.remove(directionalClassName, orderClassName);
  1177. nextElement.classList.add(CLASS_NAME_ACTIVE$2);
  1178. activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
  1179. this._isSliding = false;
  1180. setTimeout(triggerSlidEvent, 0);
  1181. };
  1182. this._queueCallback(completeCallBack, activeElement, true);
  1183. } else {
  1184. activeElement.classList.remove(CLASS_NAME_ACTIVE$2);
  1185. nextElement.classList.add(CLASS_NAME_ACTIVE$2);
  1186. this._isSliding = false;
  1187. triggerSlidEvent();
  1188. }
  1189. if (isCycling) {
  1190. this.cycle();
  1191. }
  1192. }
  1193. _directionToOrder(direction) {
  1194. if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
  1195. return direction;
  1196. }
  1197. if (isRTL()) {
  1198. return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
  1199. }
  1200. return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
  1201. }
  1202. _orderToDirection(order) {
  1203. if (![ORDER_NEXT, ORDER_PREV].includes(order)) {
  1204. return order;
  1205. }
  1206. if (isRTL()) {
  1207. return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
  1208. }
  1209. return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
  1210. } // Static
  1211. static carouselInterface(element, config) {
  1212. const data = Carousel.getOrCreateInstance(element, config);
  1213. let {
  1214. _config
  1215. } = data;
  1216. if (typeof config === 'object') {
  1217. _config = { ..._config,
  1218. ...config
  1219. };
  1220. }
  1221. const action = typeof config === 'string' ? config : _config.slide;
  1222. if (typeof config === 'number') {
  1223. data.to(config);
  1224. } else if (typeof action === 'string') {
  1225. if (typeof data[action] === 'undefined') {
  1226. throw new TypeError(`No method named "${action}"`);
  1227. }
  1228. data[action]();
  1229. } else if (_config.interval && _config.ride) {
  1230. data.pause();
  1231. data.cycle();
  1232. }
  1233. }
  1234. static jQueryInterface(config) {
  1235. return this.each(function () {
  1236. Carousel.carouselInterface(this, config);
  1237. });
  1238. }
  1239. static dataApiClickHandler(event) {
  1240. const target = getElementFromSelector(this);
  1241. if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
  1242. return;
  1243. }
  1244. const config = { ...Manipulator.getDataAttributes(target),
  1245. ...Manipulator.getDataAttributes(this)
  1246. };
  1247. const slideIndex = this.getAttribute('data-bs-slide-to');
  1248. if (slideIndex) {
  1249. config.interval = false;
  1250. }
  1251. Carousel.carouselInterface(target, config);
  1252. if (slideIndex) {
  1253. Carousel.getInstance(target).to(slideIndex);
  1254. }
  1255. event.preventDefault();
  1256. }
  1257. }
  1258. /**
  1259. * ------------------------------------------------------------------------
  1260. * Data Api implementation
  1261. * ------------------------------------------------------------------------
  1262. */
  1263. EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
  1264. EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
  1265. const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
  1266. for (let i = 0, len = carousels.length; i < len; i++) {
  1267. Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
  1268. }
  1269. });
  1270. /**
  1271. * ------------------------------------------------------------------------
  1272. * jQuery
  1273. * ------------------------------------------------------------------------
  1274. * add .Carousel to jQuery only if jQuery is present
  1275. */
  1276. defineJQueryPlugin(Carousel);
  1277. /**
  1278. * --------------------------------------------------------------------------
  1279. * Bootstrap (v5.1.3): collapse.js
  1280. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1281. * --------------------------------------------------------------------------
  1282. */
  1283. /**
  1284. * ------------------------------------------------------------------------
  1285. * Constants
  1286. * ------------------------------------------------------------------------
  1287. */
  1288. const NAME$a = 'collapse';
  1289. const DATA_KEY$9 = 'bs.collapse';
  1290. const EVENT_KEY$9 = `.${DATA_KEY$9}`;
  1291. const DATA_API_KEY$5 = '.data-api';
  1292. const Default$9 = {
  1293. toggle: true,
  1294. parent: null
  1295. };
  1296. const DefaultType$9 = {
  1297. toggle: 'boolean',
  1298. parent: '(null|element)'
  1299. };
  1300. const EVENT_SHOW$5 = `show${EVENT_KEY$9}`;
  1301. const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`;
  1302. const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`;
  1303. const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`;
  1304. const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`;
  1305. const CLASS_NAME_SHOW$7 = 'show';
  1306. const CLASS_NAME_COLLAPSE = 'collapse';
  1307. const CLASS_NAME_COLLAPSING = 'collapsing';
  1308. const CLASS_NAME_COLLAPSED = 'collapsed';
  1309. const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
  1310. const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
  1311. const WIDTH = 'width';
  1312. const HEIGHT = 'height';
  1313. const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
  1314. const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
  1315. /**
  1316. * ------------------------------------------------------------------------
  1317. * Class Definition
  1318. * ------------------------------------------------------------------------
  1319. */
  1320. class Collapse extends BaseComponent {
  1321. constructor(element, config) {
  1322. super(element);
  1323. this._isTransitioning = false;
  1324. this._config = this._getConfig(config);
  1325. this._triggerArray = [];
  1326. const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
  1327. for (let i = 0, len = toggleList.length; i < len; i++) {
  1328. const elem = toggleList[i];
  1329. const selector = getSelectorFromElement(elem);
  1330. const filterElement = SelectorEngine.find(selector).filter(foundElem => foundElem === this._element);
  1331. if (selector !== null && filterElement.length) {
  1332. this._selector = selector;
  1333. this._triggerArray.push(elem);
  1334. }
  1335. }
  1336. this._initializeChildren();
  1337. if (!this._config.parent) {
  1338. this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
  1339. }
  1340. if (this._config.toggle) {
  1341. this.toggle();
  1342. }
  1343. } // Getters
  1344. static get Default() {
  1345. return Default$9;
  1346. }
  1347. static get NAME() {
  1348. return NAME$a;
  1349. } // Public
  1350. toggle() {
  1351. if (this._isShown()) {
  1352. this.hide();
  1353. } else {
  1354. this.show();
  1355. }
  1356. }
  1357. show() {
  1358. if (this._isTransitioning || this._isShown()) {
  1359. return;
  1360. }
  1361. let actives = [];
  1362. let activesData;
  1363. if (this._config.parent) {
  1364. const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
  1365. actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth
  1366. }
  1367. const container = SelectorEngine.findOne(this._selector);
  1368. if (actives.length) {
  1369. const tempActiveData = actives.find(elem => container !== elem);
  1370. activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
  1371. if (activesData && activesData._isTransitioning) {
  1372. return;
  1373. }
  1374. }
  1375. const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5);
  1376. if (startEvent.defaultPrevented) {
  1377. return;
  1378. }
  1379. actives.forEach(elemActive => {
  1380. if (container !== elemActive) {
  1381. Collapse.getOrCreateInstance(elemActive, {
  1382. toggle: false
  1383. }).hide();
  1384. }
  1385. if (!activesData) {
  1386. Data.set(elemActive, DATA_KEY$9, null);
  1387. }
  1388. });
  1389. const dimension = this._getDimension();
  1390. this._element.classList.remove(CLASS_NAME_COLLAPSE);
  1391. this._element.classList.add(CLASS_NAME_COLLAPSING);
  1392. this._element.style[dimension] = 0;
  1393. this._addAriaAndCollapsedClass(this._triggerArray, true);
  1394. this._isTransitioning = true;
  1395. const complete = () => {
  1396. this._isTransitioning = false;
  1397. this._element.classList.remove(CLASS_NAME_COLLAPSING);
  1398. this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
  1399. this._element.style[dimension] = '';
  1400. EventHandler.trigger(this._element, EVENT_SHOWN$5);
  1401. };
  1402. const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  1403. const scrollSize = `scroll${capitalizedDimension}`;
  1404. this._queueCallback(complete, this._element, true);
  1405. this._element.style[dimension] = `${this._element[scrollSize]}px`;
  1406. }
  1407. hide() {
  1408. if (this._isTransitioning || !this._isShown()) {
  1409. return;
  1410. }
  1411. const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5);
  1412. if (startEvent.defaultPrevented) {
  1413. return;
  1414. }
  1415. const dimension = this._getDimension();
  1416. this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
  1417. reflow(this._element);
  1418. this._element.classList.add(CLASS_NAME_COLLAPSING);
  1419. this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
  1420. const triggerArrayLength = this._triggerArray.length;
  1421. for (let i = 0; i < triggerArrayLength; i++) {
  1422. const trigger = this._triggerArray[i];
  1423. const elem = getElementFromSelector(trigger);
  1424. if (elem && !this._isShown(elem)) {
  1425. this._addAriaAndCollapsedClass([trigger], false);
  1426. }
  1427. }
  1428. this._isTransitioning = true;
  1429. const complete = () => {
  1430. this._isTransitioning = false;
  1431. this._element.classList.remove(CLASS_NAME_COLLAPSING);
  1432. this._element.classList.add(CLASS_NAME_COLLAPSE);
  1433. EventHandler.trigger(this._element, EVENT_HIDDEN$5);
  1434. };
  1435. this._element.style[dimension] = '';
  1436. this._queueCallback(complete, this._element, true);
  1437. }
  1438. _isShown(element = this._element) {
  1439. return element.classList.contains(CLASS_NAME_SHOW$7);
  1440. } // Private
  1441. _getConfig(config) {
  1442. config = { ...Default$9,
  1443. ...Manipulator.getDataAttributes(this._element),
  1444. ...config
  1445. };
  1446. config.toggle = Boolean(config.toggle); // Coerce string values
  1447. config.parent = getElement(config.parent);
  1448. typeCheckConfig(NAME$a, config, DefaultType$9);
  1449. return config;
  1450. }
  1451. _getDimension() {
  1452. return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
  1453. }
  1454. _initializeChildren() {
  1455. if (!this._config.parent) {
  1456. return;
  1457. }
  1458. const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
  1459. SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
  1460. const selected = getElementFromSelector(element);
  1461. if (selected) {
  1462. this._addAriaAndCollapsedClass([element], this._isShown(selected));
  1463. }
  1464. });
  1465. }
  1466. _addAriaAndCollapsedClass(triggerArray, isOpen) {
  1467. if (!triggerArray.length) {
  1468. return;
  1469. }
  1470. triggerArray.forEach(elem => {
  1471. if (isOpen) {
  1472. elem.classList.remove(CLASS_NAME_COLLAPSED);
  1473. } else {
  1474. elem.classList.add(CLASS_NAME_COLLAPSED);
  1475. }
  1476. elem.setAttribute('aria-expanded', isOpen);
  1477. });
  1478. } // Static
  1479. static jQueryInterface(config) {
  1480. return this.each(function () {
  1481. const _config = {};
  1482. if (typeof config === 'string' && /show|hide/.test(config)) {
  1483. _config.toggle = false;
  1484. }
  1485. const data = Collapse.getOrCreateInstance(this, _config);
  1486. if (typeof config === 'string') {
  1487. if (typeof data[config] === 'undefined') {
  1488. throw new TypeError(`No method named "${config}"`);
  1489. }
  1490. data[config]();
  1491. }
  1492. });
  1493. }
  1494. }
  1495. /**
  1496. * ------------------------------------------------------------------------
  1497. * Data Api implementation
  1498. * ------------------------------------------------------------------------
  1499. */
  1500. EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) {
  1501. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  1502. if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') {
  1503. event.preventDefault();
  1504. }
  1505. const selector = getSelectorFromElement(this);
  1506. const selectorElements = SelectorEngine.find(selector);
  1507. selectorElements.forEach(element => {
  1508. Collapse.getOrCreateInstance(element, {
  1509. toggle: false
  1510. }).toggle();
  1511. });
  1512. });
  1513. /**
  1514. * ------------------------------------------------------------------------
  1515. * jQuery
  1516. * ------------------------------------------------------------------------
  1517. * add .Collapse to jQuery only if jQuery is present
  1518. */
  1519. defineJQueryPlugin(Collapse);
  1520. /**
  1521. * --------------------------------------------------------------------------
  1522. * Bootstrap (v5.1.3): dropdown.js
  1523. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1524. * --------------------------------------------------------------------------
  1525. */
  1526. /**
  1527. * ------------------------------------------------------------------------
  1528. * Constants
  1529. * ------------------------------------------------------------------------
  1530. */
  1531. const NAME$9 = 'dropdown';
  1532. const DATA_KEY$8 = 'bs.dropdown';
  1533. const EVENT_KEY$8 = `.${DATA_KEY$8}`;
  1534. const DATA_API_KEY$4 = '.data-api';
  1535. const ESCAPE_KEY$2 = 'Escape';
  1536. const SPACE_KEY = 'Space';
  1537. const TAB_KEY$1 = 'Tab';
  1538. const ARROW_UP_KEY = 'ArrowUp';
  1539. const ARROW_DOWN_KEY = 'ArrowDown';
  1540. const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
  1541. const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
  1542. const EVENT_HIDE$4 = `hide${EVENT_KEY$8}`;
  1543. const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`;
  1544. const EVENT_SHOW$4 = `show${EVENT_KEY$8}`;
  1545. const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`;
  1546. const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$8}${DATA_API_KEY$4}`;
  1547. const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$8}${DATA_API_KEY$4}`;
  1548. const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$8}${DATA_API_KEY$4}`;
  1549. const CLASS_NAME_SHOW$6 = 'show';
  1550. const CLASS_NAME_DROPUP = 'dropup';
  1551. const CLASS_NAME_DROPEND = 'dropend';
  1552. const CLASS_NAME_DROPSTART = 'dropstart';
  1553. const CLASS_NAME_NAVBAR = 'navbar';
  1554. const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]';
  1555. const SELECTOR_MENU = '.dropdown-menu';
  1556. const SELECTOR_NAVBAR_NAV = '.navbar-nav';
  1557. const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  1558. const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start';
  1559. const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end';
  1560. const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
  1561. const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
  1562. const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
  1563. const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
  1564. const Default$8 = {
  1565. offset: [0, 2],
  1566. boundary: 'clippingParents',
  1567. reference: 'toggle',
  1568. display: 'dynamic',
  1569. popperConfig: null,
  1570. autoClose: true
  1571. };
  1572. const DefaultType$8 = {
  1573. offset: '(array|string|function)',
  1574. boundary: '(string|element)',
  1575. reference: '(string|element|object)',
  1576. display: 'string',
  1577. popperConfig: '(null|object|function)',
  1578. autoClose: '(boolean|string)'
  1579. };
  1580. /**
  1581. * ------------------------------------------------------------------------
  1582. * Class Definition
  1583. * ------------------------------------------------------------------------
  1584. */
  1585. class Dropdown extends BaseComponent {
  1586. constructor(element, config) {
  1587. super(element);
  1588. this._popper = null;
  1589. this._config = this._getConfig(config);
  1590. this._menu = this._getMenuElement();
  1591. this._inNavbar = this._detectNavbar();
  1592. } // Getters
  1593. static get Default() {
  1594. return Default$8;
  1595. }
  1596. static get DefaultType() {
  1597. return DefaultType$8;
  1598. }
  1599. static get NAME() {
  1600. return NAME$9;
  1601. } // Public
  1602. toggle() {
  1603. return this._isShown() ? this.hide() : this.show();
  1604. }
  1605. show() {
  1606. if (isDisabled(this._element) || this._isShown(this._menu)) {
  1607. return;
  1608. }
  1609. const relatedTarget = {
  1610. relatedTarget: this._element
  1611. };
  1612. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget);
  1613. if (showEvent.defaultPrevented) {
  1614. return;
  1615. }
  1616. const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar
  1617. if (this._inNavbar) {
  1618. Manipulator.setDataAttribute(this._menu, 'popper', 'none');
  1619. } else {
  1620. this._createPopper(parent);
  1621. } // If this is a touch-enabled device we add extra
  1622. // empty mouseover listeners to the body's immediate children;
  1623. // only needed because of broken event delegation on iOS
  1624. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  1625. if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
  1626. [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop));
  1627. }
  1628. this._element.focus();
  1629. this._element.setAttribute('aria-expanded', true);
  1630. this._menu.classList.add(CLASS_NAME_SHOW$6);
  1631. this._element.classList.add(CLASS_NAME_SHOW$6);
  1632. EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
  1633. }
  1634. hide() {
  1635. if (isDisabled(this._element) || !this._isShown(this._menu)) {
  1636. return;
  1637. }
  1638. const relatedTarget = {
  1639. relatedTarget: this._element
  1640. };
  1641. this._completeHide(relatedTarget);
  1642. }
  1643. dispose() {
  1644. if (this._popper) {
  1645. this._popper.destroy();
  1646. }
  1647. super.dispose();
  1648. }
  1649. update() {
  1650. this._inNavbar = this._detectNavbar();
  1651. if (this._popper) {
  1652. this._popper.update();
  1653. }
  1654. } // Private
  1655. _completeHide(relatedTarget) {
  1656. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
  1657. if (hideEvent.defaultPrevented) {
  1658. return;
  1659. } // If this is a touch-enabled device we remove the extra
  1660. // empty mouseover listeners we added for iOS support
  1661. if ('ontouchstart' in document.documentElement) {
  1662. [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop));
  1663. }
  1664. if (this._popper) {
  1665. this._popper.destroy();
  1666. }
  1667. this._menu.classList.remove(CLASS_NAME_SHOW$6);
  1668. this._element.classList.remove(CLASS_NAME_SHOW$6);
  1669. this._element.setAttribute('aria-expanded', 'false');
  1670. Manipulator.removeDataAttribute(this._menu, 'popper');
  1671. EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
  1672. }
  1673. _getConfig(config) {
  1674. config = { ...this.constructor.Default,
  1675. ...Manipulator.getDataAttributes(this._element),
  1676. ...config
  1677. };
  1678. typeCheckConfig(NAME$9, config, this.constructor.DefaultType);
  1679. if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
  1680. // Popper virtual elements require a getBoundingClientRect method
  1681. throw new TypeError(`${NAME$9.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
  1682. }
  1683. return config;
  1684. }
  1685. _createPopper(parent) {
  1686. if (typeof Popper === 'undefined') {
  1687. throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
  1688. }
  1689. let referenceElement = this._element;
  1690. if (this._config.reference === 'parent') {
  1691. referenceElement = parent;
  1692. } else if (isElement(this._config.reference)) {
  1693. referenceElement = getElement(this._config.reference);
  1694. } else if (typeof this._config.reference === 'object') {
  1695. referenceElement = this._config.reference;
  1696. }
  1697. const popperConfig = this._getPopperConfig();
  1698. const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
  1699. this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
  1700. if (isDisplayStatic) {
  1701. Manipulator.setDataAttribute(this._menu, 'popper', 'static');
  1702. }
  1703. }
  1704. _isShown(element = this._element) {
  1705. return element.classList.contains(CLASS_NAME_SHOW$6);
  1706. }
  1707. _getMenuElement() {
  1708. return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
  1709. }
  1710. _getPlacement() {
  1711. const parentDropdown = this._element.parentNode;
  1712. if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
  1713. return PLACEMENT_RIGHT;
  1714. }
  1715. if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
  1716. return PLACEMENT_LEFT;
  1717. } // We need to trim the value because custom properties can also include spaces
  1718. const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
  1719. if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
  1720. return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
  1721. }
  1722. return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
  1723. }
  1724. _detectNavbar() {
  1725. return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
  1726. }
  1727. _getOffset() {
  1728. const {
  1729. offset
  1730. } = this._config;
  1731. if (typeof offset === 'string') {
  1732. return offset.split(',').map(val => Number.parseInt(val, 10));
  1733. }
  1734. if (typeof offset === 'function') {
  1735. return popperData => offset(popperData, this._element);
  1736. }
  1737. return offset;
  1738. }
  1739. _getPopperConfig() {
  1740. const defaultBsPopperConfig = {
  1741. placement: this._getPlacement(),
  1742. modifiers: [{
  1743. name: 'preventOverflow',
  1744. options: {
  1745. boundary: this._config.boundary
  1746. }
  1747. }, {
  1748. name: 'offset',
  1749. options: {
  1750. offset: this._getOffset()
  1751. }
  1752. }]
  1753. }; // Disable Popper if we have a static display
  1754. if (this._config.display === 'static') {
  1755. defaultBsPopperConfig.modifiers = [{
  1756. name: 'applyStyles',
  1757. enabled: false
  1758. }];
  1759. }
  1760. return { ...defaultBsPopperConfig,
  1761. ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
  1762. };
  1763. }
  1764. _selectMenuItem({
  1765. key,
  1766. target
  1767. }) {
  1768. const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
  1769. if (!items.length) {
  1770. return;
  1771. } // if target isn't included in items (e.g. when expanding the dropdown)
  1772. // allow cycling to get the last item in case key equals ARROW_UP_KEY
  1773. getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
  1774. } // Static
  1775. static jQueryInterface(config) {
  1776. return this.each(function () {
  1777. const data = Dropdown.getOrCreateInstance(this, config);
  1778. if (typeof config !== 'string') {
  1779. return;
  1780. }
  1781. if (typeof data[config] === 'undefined') {
  1782. throw new TypeError(`No method named "${config}"`);
  1783. }
  1784. data[config]();
  1785. });
  1786. }
  1787. static clearMenus(event) {
  1788. if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) {
  1789. return;
  1790. }
  1791. const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
  1792. for (let i = 0, len = toggles.length; i < len; i++) {
  1793. const context = Dropdown.getInstance(toggles[i]);
  1794. if (!context || context._config.autoClose === false) {
  1795. continue;
  1796. }
  1797. if (!context._isShown()) {
  1798. continue;
  1799. }
  1800. const relatedTarget = {
  1801. relatedTarget: context._element
  1802. };
  1803. if (event) {
  1804. const composedPath = event.composedPath();
  1805. const isMenuTarget = composedPath.includes(context._menu);
  1806. if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
  1807. continue;
  1808. } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
  1809. if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
  1810. continue;
  1811. }
  1812. if (event.type === 'click') {
  1813. relatedTarget.clickEvent = event;
  1814. }
  1815. }
  1816. context._completeHide(relatedTarget);
  1817. }
  1818. }
  1819. static getParentFromElement(element) {
  1820. return getElementFromSelector(element) || element.parentNode;
  1821. }
  1822. static dataApiKeydownHandler(event) {
  1823. // If not input/textarea:
  1824. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  1825. // If input/textarea:
  1826. // - If space key => not a dropdown command
  1827. // - If key is other than escape
  1828. // - If key is not up or down => not a dropdown command
  1829. // - If trigger inside the menu => not a dropdown command
  1830. if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) {
  1831. return;
  1832. }
  1833. const isActive = this.classList.contains(CLASS_NAME_SHOW$6);
  1834. if (!isActive && event.key === ESCAPE_KEY$2) {
  1835. return;
  1836. }
  1837. event.preventDefault();
  1838. event.stopPropagation();
  1839. if (isDisabled(this)) {
  1840. return;
  1841. }
  1842. const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
  1843. const instance = Dropdown.getOrCreateInstance(getToggleButton);
  1844. if (event.key === ESCAPE_KEY$2) {
  1845. instance.hide();
  1846. return;
  1847. }
  1848. if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
  1849. if (!isActive) {
  1850. instance.show();
  1851. }
  1852. instance._selectMenuItem(event);
  1853. return;
  1854. }
  1855. if (!isActive || event.key === SPACE_KEY) {
  1856. Dropdown.clearMenus();
  1857. }
  1858. }
  1859. }
  1860. /**
  1861. * ------------------------------------------------------------------------
  1862. * Data Api implementation
  1863. * ------------------------------------------------------------------------
  1864. */
  1865. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler);
  1866. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
  1867. EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus);
  1868. EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
  1869. EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) {
  1870. event.preventDefault();
  1871. Dropdown.getOrCreateInstance(this).toggle();
  1872. });
  1873. /**
  1874. * ------------------------------------------------------------------------
  1875. * jQuery
  1876. * ------------------------------------------------------------------------
  1877. * add .Dropdown to jQuery only if jQuery is present
  1878. */
  1879. defineJQueryPlugin(Dropdown);
  1880. /**
  1881. * --------------------------------------------------------------------------
  1882. * Bootstrap (v5.1.3): util/scrollBar.js
  1883. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1884. * --------------------------------------------------------------------------
  1885. */
  1886. const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  1887. const SELECTOR_STICKY_CONTENT = '.sticky-top';
  1888. class ScrollBarHelper {
  1889. constructor() {
  1890. this._element = document.body;
  1891. }
  1892. getWidth() {
  1893. // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
  1894. const documentWidth = document.documentElement.clientWidth;
  1895. return Math.abs(window.innerWidth - documentWidth);
  1896. }
  1897. hide() {
  1898. const width = this.getWidth();
  1899. this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width
  1900. this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
  1901. this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
  1902. this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
  1903. }
  1904. _disableOverFlow() {
  1905. this._saveInitialAttribute(this._element, 'overflow');
  1906. this._element.style.overflow = 'hidden';
  1907. }
  1908. _setElementAttributes(selector, styleProp, callback) {
  1909. const scrollbarWidth = this.getWidth();
  1910. const manipulationCallBack = element => {
  1911. if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
  1912. return;
  1913. }
  1914. this._saveInitialAttribute(element, styleProp);
  1915. const calculatedValue = window.getComputedStyle(element)[styleProp];
  1916. element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
  1917. };
  1918. this._applyManipulationCallback(selector, manipulationCallBack);
  1919. }
  1920. reset() {
  1921. this._resetElementAttributes(this._element, 'overflow');
  1922. this._resetElementAttributes(this._element, 'paddingRight');
  1923. this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
  1924. this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
  1925. }
  1926. _saveInitialAttribute(element, styleProp) {
  1927. const actualValue = element.style[styleProp];
  1928. if (actualValue) {
  1929. Manipulator.setDataAttribute(element, styleProp, actualValue);
  1930. }
  1931. }
  1932. _resetElementAttributes(selector, styleProp) {
  1933. const manipulationCallBack = element => {
  1934. const value = Manipulator.getDataAttribute(element, styleProp);
  1935. if (typeof value === 'undefined') {
  1936. element.style.removeProperty(styleProp);
  1937. } else {
  1938. Manipulator.removeDataAttribute(element, styleProp);
  1939. element.style[styleProp] = value;
  1940. }
  1941. };
  1942. this._applyManipulationCallback(selector, manipulationCallBack);
  1943. }
  1944. _applyManipulationCallback(selector, callBack) {
  1945. if (isElement(selector)) {
  1946. callBack(selector);
  1947. } else {
  1948. SelectorEngine.find(selector, this._element).forEach(callBack);
  1949. }
  1950. }
  1951. isOverflowing() {
  1952. return this.getWidth() > 0;
  1953. }
  1954. }
  1955. /**
  1956. * --------------------------------------------------------------------------
  1957. * Bootstrap (v5.1.3): util/backdrop.js
  1958. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1959. * --------------------------------------------------------------------------
  1960. */
  1961. const Default$7 = {
  1962. className: 'modal-backdrop',
  1963. isVisible: true,
  1964. // if false, we use the backdrop helper without adding any element to the dom
  1965. isAnimated: false,
  1966. rootElement: 'body',
  1967. // give the choice to place backdrop under different elements
  1968. clickCallback: null
  1969. };
  1970. const DefaultType$7 = {
  1971. className: 'string',
  1972. isVisible: 'boolean',
  1973. isAnimated: 'boolean',
  1974. rootElement: '(element|string)',
  1975. clickCallback: '(function|null)'
  1976. };
  1977. const NAME$8 = 'backdrop';
  1978. const CLASS_NAME_FADE$4 = 'fade';
  1979. const CLASS_NAME_SHOW$5 = 'show';
  1980. const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$8}`;
  1981. class Backdrop {
  1982. constructor(config) {
  1983. this._config = this._getConfig(config);
  1984. this._isAppended = false;
  1985. this._element = null;
  1986. }
  1987. show(callback) {
  1988. if (!this._config.isVisible) {
  1989. execute(callback);
  1990. return;
  1991. }
  1992. this._append();
  1993. if (this._config.isAnimated) {
  1994. reflow(this._getElement());
  1995. }
  1996. this._getElement().classList.add(CLASS_NAME_SHOW$5);
  1997. this._emulateAnimation(() => {
  1998. execute(callback);
  1999. });
  2000. }
  2001. hide(callback) {
  2002. if (!this._config.isVisible) {
  2003. execute(callback);
  2004. return;
  2005. }
  2006. this._getElement().classList.remove(CLASS_NAME_SHOW$5);
  2007. this._emulateAnimation(() => {
  2008. this.dispose();
  2009. execute(callback);
  2010. });
  2011. } // Private
  2012. _getElement() {
  2013. if (!this._element) {
  2014. const backdrop = document.createElement('div');
  2015. backdrop.className = this._config.className;
  2016. if (this._config.isAnimated) {
  2017. backdrop.classList.add(CLASS_NAME_FADE$4);
  2018. }
  2019. this._element = backdrop;
  2020. }
  2021. return this._element;
  2022. }
  2023. _getConfig(config) {
  2024. config = { ...Default$7,
  2025. ...(typeof config === 'object' ? config : {})
  2026. }; // use getElement() with the default "body" to get a fresh Element on each instantiation
  2027. config.rootElement = getElement(config.rootElement);
  2028. typeCheckConfig(NAME$8, config, DefaultType$7);
  2029. return config;
  2030. }
  2031. _append() {
  2032. if (this._isAppended) {
  2033. return;
  2034. }
  2035. this._config.rootElement.append(this._getElement());
  2036. EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
  2037. execute(this._config.clickCallback);
  2038. });
  2039. this._isAppended = true;
  2040. }
  2041. dispose() {
  2042. if (!this._isAppended) {
  2043. return;
  2044. }
  2045. EventHandler.off(this._element, EVENT_MOUSEDOWN);
  2046. this._element.remove();
  2047. this._isAppended = false;
  2048. }
  2049. _emulateAnimation(callback) {
  2050. executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
  2051. }
  2052. }
  2053. /**
  2054. * --------------------------------------------------------------------------
  2055. * Bootstrap (v5.1.3): util/focustrap.js
  2056. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2057. * --------------------------------------------------------------------------
  2058. */
  2059. const Default$6 = {
  2060. trapElement: null,
  2061. // The element to trap focus inside of
  2062. autofocus: true
  2063. };
  2064. const DefaultType$6 = {
  2065. trapElement: 'element',
  2066. autofocus: 'boolean'
  2067. };
  2068. const NAME$7 = 'focustrap';
  2069. const DATA_KEY$7 = 'bs.focustrap';
  2070. const EVENT_KEY$7 = `.${DATA_KEY$7}`;
  2071. const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$7}`;
  2072. const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$7}`;
  2073. const TAB_KEY = 'Tab';
  2074. const TAB_NAV_FORWARD = 'forward';
  2075. const TAB_NAV_BACKWARD = 'backward';
  2076. class FocusTrap {
  2077. constructor(config) {
  2078. this._config = this._getConfig(config);
  2079. this._isActive = false;
  2080. this._lastTabNavDirection = null;
  2081. }
  2082. activate() {
  2083. const {
  2084. trapElement,
  2085. autofocus
  2086. } = this._config;
  2087. if (this._isActive) {
  2088. return;
  2089. }
  2090. if (autofocus) {
  2091. trapElement.focus();
  2092. }
  2093. EventHandler.off(document, EVENT_KEY$7); // guard against infinite focus loop
  2094. EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event));
  2095. EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
  2096. this._isActive = true;
  2097. }
  2098. deactivate() {
  2099. if (!this._isActive) {
  2100. return;
  2101. }
  2102. this._isActive = false;
  2103. EventHandler.off(document, EVENT_KEY$7);
  2104. } // Private
  2105. _handleFocusin(event) {
  2106. const {
  2107. target
  2108. } = event;
  2109. const {
  2110. trapElement
  2111. } = this._config;
  2112. if (target === document || target === trapElement || trapElement.contains(target)) {
  2113. return;
  2114. }
  2115. const elements = SelectorEngine.focusableChildren(trapElement);
  2116. if (elements.length === 0) {
  2117. trapElement.focus();
  2118. } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
  2119. elements[elements.length - 1].focus();
  2120. } else {
  2121. elements[0].focus();
  2122. }
  2123. }
  2124. _handleKeydown(event) {
  2125. if (event.key !== TAB_KEY) {
  2126. return;
  2127. }
  2128. this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
  2129. }
  2130. _getConfig(config) {
  2131. config = { ...Default$6,
  2132. ...(typeof config === 'object' ? config : {})
  2133. };
  2134. typeCheckConfig(NAME$7, config, DefaultType$6);
  2135. return config;
  2136. }
  2137. }
  2138. /**
  2139. * --------------------------------------------------------------------------
  2140. * Bootstrap (v5.1.3): modal.js
  2141. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2142. * --------------------------------------------------------------------------
  2143. */
  2144. /**
  2145. * ------------------------------------------------------------------------
  2146. * Constants
  2147. * ------------------------------------------------------------------------
  2148. */
  2149. const NAME$6 = 'modal';
  2150. const DATA_KEY$6 = 'bs.modal';
  2151. const EVENT_KEY$6 = `.${DATA_KEY$6}`;
  2152. const DATA_API_KEY$3 = '.data-api';
  2153. const ESCAPE_KEY$1 = 'Escape';
  2154. const Default$5 = {
  2155. backdrop: true,
  2156. keyboard: true,
  2157. focus: true
  2158. };
  2159. const DefaultType$5 = {
  2160. backdrop: '(boolean|string)',
  2161. keyboard: 'boolean',
  2162. focus: 'boolean'
  2163. };
  2164. const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
  2165. const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`;
  2166. const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
  2167. const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
  2168. const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
  2169. const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
  2170. const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$6}`;
  2171. const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
  2172. const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
  2173. const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
  2174. const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
  2175. const CLASS_NAME_OPEN = 'modal-open';
  2176. const CLASS_NAME_FADE$3 = 'fade';
  2177. const CLASS_NAME_SHOW$4 = 'show';
  2178. const CLASS_NAME_STATIC = 'modal-static';
  2179. const OPEN_SELECTOR$1 = '.modal.show';
  2180. const SELECTOR_DIALOG = '.modal-dialog';
  2181. const SELECTOR_MODAL_BODY = '.modal-body';
  2182. const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
  2183. /**
  2184. * ------------------------------------------------------------------------
  2185. * Class Definition
  2186. * ------------------------------------------------------------------------
  2187. */
  2188. class Modal extends BaseComponent {
  2189. constructor(element, config) {
  2190. super(element);
  2191. this._config = this._getConfig(config);
  2192. this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
  2193. this._backdrop = this._initializeBackDrop();
  2194. this._focustrap = this._initializeFocusTrap();
  2195. this._isShown = false;
  2196. this._ignoreBackdropClick = false;
  2197. this._isTransitioning = false;
  2198. this._scrollBar = new ScrollBarHelper();
  2199. } // Getters
  2200. static get Default() {
  2201. return Default$5;
  2202. }
  2203. static get NAME() {
  2204. return NAME$6;
  2205. } // Public
  2206. toggle(relatedTarget) {
  2207. return this._isShown ? this.hide() : this.show(relatedTarget);
  2208. }
  2209. show(relatedTarget) {
  2210. if (this._isShown || this._isTransitioning) {
  2211. return;
  2212. }
  2213. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
  2214. relatedTarget
  2215. });
  2216. if (showEvent.defaultPrevented) {
  2217. return;
  2218. }
  2219. this._isShown = true;
  2220. if (this._isAnimated()) {
  2221. this._isTransitioning = true;
  2222. }
  2223. this._scrollBar.hide();
  2224. document.body.classList.add(CLASS_NAME_OPEN);
  2225. this._adjustDialog();
  2226. this._setEscapeEvent();
  2227. this._setResizeEvent();
  2228. EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
  2229. EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
  2230. if (event.target === this._element) {
  2231. this._ignoreBackdropClick = true;
  2232. }
  2233. });
  2234. });
  2235. this._showBackdrop(() => this._showElement(relatedTarget));
  2236. }
  2237. hide() {
  2238. if (!this._isShown || this._isTransitioning) {
  2239. return;
  2240. }
  2241. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
  2242. if (hideEvent.defaultPrevented) {
  2243. return;
  2244. }
  2245. this._isShown = false;
  2246. const isAnimated = this._isAnimated();
  2247. if (isAnimated) {
  2248. this._isTransitioning = true;
  2249. }
  2250. this._setEscapeEvent();
  2251. this._setResizeEvent();
  2252. this._focustrap.deactivate();
  2253. this._element.classList.remove(CLASS_NAME_SHOW$4);
  2254. EventHandler.off(this._element, EVENT_CLICK_DISMISS);
  2255. EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
  2256. this._queueCallback(() => this._hideModal(), this._element, isAnimated);
  2257. }
  2258. dispose() {
  2259. [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
  2260. this._backdrop.dispose();
  2261. this._focustrap.deactivate();
  2262. super.dispose();
  2263. }
  2264. handleUpdate() {
  2265. this._adjustDialog();
  2266. } // Private
  2267. _initializeBackDrop() {
  2268. return new Backdrop({
  2269. isVisible: Boolean(this._config.backdrop),
  2270. // 'static' option will be translated to true, and booleans will keep their value
  2271. isAnimated: this._isAnimated()
  2272. });
  2273. }
  2274. _initializeFocusTrap() {
  2275. return new FocusTrap({
  2276. trapElement: this._element
  2277. });
  2278. }
  2279. _getConfig(config) {
  2280. config = { ...Default$5,
  2281. ...Manipulator.getDataAttributes(this._element),
  2282. ...(typeof config === 'object' ? config : {})
  2283. };
  2284. typeCheckConfig(NAME$6, config, DefaultType$5);
  2285. return config;
  2286. }
  2287. _showElement(relatedTarget) {
  2288. const isAnimated = this._isAnimated();
  2289. const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
  2290. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  2291. // Don't move modal's DOM position
  2292. document.body.append(this._element);
  2293. }
  2294. this._element.style.display = 'block';
  2295. this._element.removeAttribute('aria-hidden');
  2296. this._element.setAttribute('aria-modal', true);
  2297. this._element.setAttribute('role', 'dialog');
  2298. this._element.scrollTop = 0;
  2299. if (modalBody) {
  2300. modalBody.scrollTop = 0;
  2301. }
  2302. if (isAnimated) {
  2303. reflow(this._element);
  2304. }
  2305. this._element.classList.add(CLASS_NAME_SHOW$4);
  2306. const transitionComplete = () => {
  2307. if (this._config.focus) {
  2308. this._focustrap.activate();
  2309. }
  2310. this._isTransitioning = false;
  2311. EventHandler.trigger(this._element, EVENT_SHOWN$3, {
  2312. relatedTarget
  2313. });
  2314. };
  2315. this._queueCallback(transitionComplete, this._dialog, isAnimated);
  2316. }
  2317. _setEscapeEvent() {
  2318. if (this._isShown) {
  2319. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
  2320. if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
  2321. event.preventDefault();
  2322. this.hide();
  2323. } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) {
  2324. this._triggerBackdropTransition();
  2325. }
  2326. });
  2327. } else {
  2328. EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
  2329. }
  2330. }
  2331. _setResizeEvent() {
  2332. if (this._isShown) {
  2333. EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog());
  2334. } else {
  2335. EventHandler.off(window, EVENT_RESIZE);
  2336. }
  2337. }
  2338. _hideModal() {
  2339. this._element.style.display = 'none';
  2340. this._element.setAttribute('aria-hidden', true);
  2341. this._element.removeAttribute('aria-modal');
  2342. this._element.removeAttribute('role');
  2343. this._isTransitioning = false;
  2344. this._backdrop.hide(() => {
  2345. document.body.classList.remove(CLASS_NAME_OPEN);
  2346. this._resetAdjustments();
  2347. this._scrollBar.reset();
  2348. EventHandler.trigger(this._element, EVENT_HIDDEN$3);
  2349. });
  2350. }
  2351. _showBackdrop(callback) {
  2352. EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
  2353. if (this._ignoreBackdropClick) {
  2354. this._ignoreBackdropClick = false;
  2355. return;
  2356. }
  2357. if (event.target !== event.currentTarget) {
  2358. return;
  2359. }
  2360. if (this._config.backdrop === true) {
  2361. this.hide();
  2362. } else if (this._config.backdrop === 'static') {
  2363. this._triggerBackdropTransition();
  2364. }
  2365. });
  2366. this._backdrop.show(callback);
  2367. }
  2368. _isAnimated() {
  2369. return this._element.classList.contains(CLASS_NAME_FADE$3);
  2370. }
  2371. _triggerBackdropTransition() {
  2372. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  2373. if (hideEvent.defaultPrevented) {
  2374. return;
  2375. }
  2376. const {
  2377. classList,
  2378. scrollHeight,
  2379. style
  2380. } = this._element;
  2381. const isModalOverflowing = scrollHeight > document.documentElement.clientHeight; // return if the following background transition hasn't yet completed
  2382. if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
  2383. return;
  2384. }
  2385. if (!isModalOverflowing) {
  2386. style.overflowY = 'hidden';
  2387. }
  2388. classList.add(CLASS_NAME_STATIC);
  2389. this._queueCallback(() => {
  2390. classList.remove(CLASS_NAME_STATIC);
  2391. if (!isModalOverflowing) {
  2392. this._queueCallback(() => {
  2393. style.overflowY = '';
  2394. }, this._dialog);
  2395. }
  2396. }, this._dialog);
  2397. this._element.focus();
  2398. } // ----------------------------------------------------------------------
  2399. // the following methods are used to handle overflowing modals
  2400. // ----------------------------------------------------------------------
  2401. _adjustDialog() {
  2402. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  2403. const scrollbarWidth = this._scrollBar.getWidth();
  2404. const isBodyOverflowing = scrollbarWidth > 0;
  2405. if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
  2406. this._element.style.paddingLeft = `${scrollbarWidth}px`;
  2407. }
  2408. if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
  2409. this._element.style.paddingRight = `${scrollbarWidth}px`;
  2410. }
  2411. }
  2412. _resetAdjustments() {
  2413. this._element.style.paddingLeft = '';
  2414. this._element.style.paddingRight = '';
  2415. } // Static
  2416. static jQueryInterface(config, relatedTarget) {
  2417. return this.each(function () {
  2418. const data = Modal.getOrCreateInstance(this, config);
  2419. if (typeof config !== 'string') {
  2420. return;
  2421. }
  2422. if (typeof data[config] === 'undefined') {
  2423. throw new TypeError(`No method named "${config}"`);
  2424. }
  2425. data[config](relatedTarget);
  2426. });
  2427. }
  2428. }
  2429. /**
  2430. * ------------------------------------------------------------------------
  2431. * Data Api implementation
  2432. * ------------------------------------------------------------------------
  2433. */
  2434. EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
  2435. const target = getElementFromSelector(this);
  2436. if (['A', 'AREA'].includes(this.tagName)) {
  2437. event.preventDefault();
  2438. }
  2439. EventHandler.one(target, EVENT_SHOW$3, showEvent => {
  2440. if (showEvent.defaultPrevented) {
  2441. // only register focus restorer if modal will actually get shown
  2442. return;
  2443. }
  2444. EventHandler.one(target, EVENT_HIDDEN$3, () => {
  2445. if (isVisible(this)) {
  2446. this.focus();
  2447. }
  2448. });
  2449. }); // avoid conflict when clicking moddal toggler while another one is open
  2450. const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
  2451. if (allReadyOpen) {
  2452. Modal.getInstance(allReadyOpen).hide();
  2453. }
  2454. const data = Modal.getOrCreateInstance(target);
  2455. data.toggle(this);
  2456. });
  2457. enableDismissTrigger(Modal);
  2458. /**
  2459. * ------------------------------------------------------------------------
  2460. * jQuery
  2461. * ------------------------------------------------------------------------
  2462. * add .Modal to jQuery only if jQuery is present
  2463. */
  2464. defineJQueryPlugin(Modal);
  2465. /**
  2466. * --------------------------------------------------------------------------
  2467. * Bootstrap (v5.1.3): offcanvas.js
  2468. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2469. * --------------------------------------------------------------------------
  2470. */
  2471. /**
  2472. * ------------------------------------------------------------------------
  2473. * Constants
  2474. * ------------------------------------------------------------------------
  2475. */
  2476. const NAME$5 = 'offcanvas';
  2477. const DATA_KEY$5 = 'bs.offcanvas';
  2478. const EVENT_KEY$5 = `.${DATA_KEY$5}`;
  2479. const DATA_API_KEY$2 = '.data-api';
  2480. const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`;
  2481. const ESCAPE_KEY = 'Escape';
  2482. const Default$4 = {
  2483. backdrop: true,
  2484. keyboard: true,
  2485. scroll: false
  2486. };
  2487. const DefaultType$4 = {
  2488. backdrop: 'boolean',
  2489. keyboard: 'boolean',
  2490. scroll: 'boolean'
  2491. };
  2492. const CLASS_NAME_SHOW$3 = 'show';
  2493. const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
  2494. const OPEN_SELECTOR = '.offcanvas.show';
  2495. const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
  2496. const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
  2497. const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
  2498. const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
  2499. const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
  2500. const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
  2501. const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
  2502. /**
  2503. * ------------------------------------------------------------------------
  2504. * Class Definition
  2505. * ------------------------------------------------------------------------
  2506. */
  2507. class Offcanvas extends BaseComponent {
  2508. constructor(element, config) {
  2509. super(element);
  2510. this._config = this._getConfig(config);
  2511. this._isShown = false;
  2512. this._backdrop = this._initializeBackDrop();
  2513. this._focustrap = this._initializeFocusTrap();
  2514. this._addEventListeners();
  2515. } // Getters
  2516. static get NAME() {
  2517. return NAME$5;
  2518. }
  2519. static get Default() {
  2520. return Default$4;
  2521. } // Public
  2522. toggle(relatedTarget) {
  2523. return this._isShown ? this.hide() : this.show(relatedTarget);
  2524. }
  2525. show(relatedTarget) {
  2526. if (this._isShown) {
  2527. return;
  2528. }
  2529. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
  2530. relatedTarget
  2531. });
  2532. if (showEvent.defaultPrevented) {
  2533. return;
  2534. }
  2535. this._isShown = true;
  2536. this._element.style.visibility = 'visible';
  2537. this._backdrop.show();
  2538. if (!this._config.scroll) {
  2539. new ScrollBarHelper().hide();
  2540. }
  2541. this._element.removeAttribute('aria-hidden');
  2542. this._element.setAttribute('aria-modal', true);
  2543. this._element.setAttribute('role', 'dialog');
  2544. this._element.classList.add(CLASS_NAME_SHOW$3);
  2545. const completeCallBack = () => {
  2546. if (!this._config.scroll) {
  2547. this._focustrap.activate();
  2548. }
  2549. EventHandler.trigger(this._element, EVENT_SHOWN$2, {
  2550. relatedTarget
  2551. });
  2552. };
  2553. this._queueCallback(completeCallBack, this._element, true);
  2554. }
  2555. hide() {
  2556. if (!this._isShown) {
  2557. return;
  2558. }
  2559. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
  2560. if (hideEvent.defaultPrevented) {
  2561. return;
  2562. }
  2563. this._focustrap.deactivate();
  2564. this._element.blur();
  2565. this._isShown = false;
  2566. this._element.classList.remove(CLASS_NAME_SHOW$3);
  2567. this._backdrop.hide();
  2568. const completeCallback = () => {
  2569. this._element.setAttribute('aria-hidden', true);
  2570. this._element.removeAttribute('aria-modal');
  2571. this._element.removeAttribute('role');
  2572. this._element.style.visibility = 'hidden';
  2573. if (!this._config.scroll) {
  2574. new ScrollBarHelper().reset();
  2575. }
  2576. EventHandler.trigger(this._element, EVENT_HIDDEN$2);
  2577. };
  2578. this._queueCallback(completeCallback, this._element, true);
  2579. }
  2580. dispose() {
  2581. this._backdrop.dispose();
  2582. this._focustrap.deactivate();
  2583. super.dispose();
  2584. } // Private
  2585. _getConfig(config) {
  2586. config = { ...Default$4,
  2587. ...Manipulator.getDataAttributes(this._element),
  2588. ...(typeof config === 'object' ? config : {})
  2589. };
  2590. typeCheckConfig(NAME$5, config, DefaultType$4);
  2591. return config;
  2592. }
  2593. _initializeBackDrop() {
  2594. return new Backdrop({
  2595. className: CLASS_NAME_BACKDROP,
  2596. isVisible: this._config.backdrop,
  2597. isAnimated: true,
  2598. rootElement: this._element.parentNode,
  2599. clickCallback: () => this.hide()
  2600. });
  2601. }
  2602. _initializeFocusTrap() {
  2603. return new FocusTrap({
  2604. trapElement: this._element
  2605. });
  2606. }
  2607. _addEventListeners() {
  2608. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
  2609. if (this._config.keyboard && event.key === ESCAPE_KEY) {
  2610. this.hide();
  2611. }
  2612. });
  2613. } // Static
  2614. static jQueryInterface(config) {
  2615. return this.each(function () {
  2616. const data = Offcanvas.getOrCreateInstance(this, config);
  2617. if (typeof config !== 'string') {
  2618. return;
  2619. }
  2620. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  2621. throw new TypeError(`No method named "${config}"`);
  2622. }
  2623. data[config](this);
  2624. });
  2625. }
  2626. }
  2627. /**
  2628. * ------------------------------------------------------------------------
  2629. * Data Api implementation
  2630. * ------------------------------------------------------------------------
  2631. */
  2632. EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) {
  2633. const target = getElementFromSelector(this);
  2634. if (['A', 'AREA'].includes(this.tagName)) {
  2635. event.preventDefault();
  2636. }
  2637. if (isDisabled(this)) {
  2638. return;
  2639. }
  2640. EventHandler.one(target, EVENT_HIDDEN$2, () => {
  2641. // focus on trigger when it is closed
  2642. if (isVisible(this)) {
  2643. this.focus();
  2644. }
  2645. }); // avoid conflict when clicking a toggler of an offcanvas, while another is open
  2646. const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
  2647. if (allReadyOpen && allReadyOpen !== target) {
  2648. Offcanvas.getInstance(allReadyOpen).hide();
  2649. }
  2650. const data = Offcanvas.getOrCreateInstance(target);
  2651. data.toggle(this);
  2652. });
  2653. EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
  2654. enableDismissTrigger(Offcanvas);
  2655. /**
  2656. * ------------------------------------------------------------------------
  2657. * jQuery
  2658. * ------------------------------------------------------------------------
  2659. */
  2660. defineJQueryPlugin(Offcanvas);
  2661. /**
  2662. * --------------------------------------------------------------------------
  2663. * Bootstrap (v5.1.3): util/sanitizer.js
  2664. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2665. * --------------------------------------------------------------------------
  2666. */
  2667. const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
  2668. const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  2669. /**
  2670. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  2671. *
  2672. * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
  2673. */
  2674. const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
  2675. /**
  2676. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  2677. *
  2678. * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
  2679. */
  2680. 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;
  2681. const allowedAttribute = (attribute, allowedAttributeList) => {
  2682. const attributeName = attribute.nodeName.toLowerCase();
  2683. if (allowedAttributeList.includes(attributeName)) {
  2684. if (uriAttributes.has(attributeName)) {
  2685. return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue));
  2686. }
  2687. return true;
  2688. }
  2689. const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp); // Check if a regular expression validates the attribute.
  2690. for (let i = 0, len = regExp.length; i < len; i++) {
  2691. if (regExp[i].test(attributeName)) {
  2692. return true;
  2693. }
  2694. }
  2695. return false;
  2696. };
  2697. const DefaultAllowlist = {
  2698. // Global attributes allowed on any supplied element below.
  2699. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  2700. a: ['target', 'href', 'title', 'rel'],
  2701. area: [],
  2702. b: [],
  2703. br: [],
  2704. col: [],
  2705. code: [],
  2706. div: [],
  2707. em: [],
  2708. hr: [],
  2709. h1: [],
  2710. h2: [],
  2711. h3: [],
  2712. h4: [],
  2713. h5: [],
  2714. h6: [],
  2715. i: [],
  2716. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  2717. li: [],
  2718. ol: [],
  2719. p: [],
  2720. pre: [],
  2721. s: [],
  2722. small: [],
  2723. span: [],
  2724. sub: [],
  2725. sup: [],
  2726. strong: [],
  2727. u: [],
  2728. ul: []
  2729. };
  2730. function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
  2731. if (!unsafeHtml.length) {
  2732. return unsafeHtml;
  2733. }
  2734. if (sanitizeFn && typeof sanitizeFn === 'function') {
  2735. return sanitizeFn(unsafeHtml);
  2736. }
  2737. const domParser = new window.DOMParser();
  2738. const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  2739. const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
  2740. for (let i = 0, len = elements.length; i < len; i++) {
  2741. const element = elements[i];
  2742. const elementName = element.nodeName.toLowerCase();
  2743. if (!Object.keys(allowList).includes(elementName)) {
  2744. element.remove();
  2745. continue;
  2746. }
  2747. const attributeList = [].concat(...element.attributes);
  2748. const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
  2749. attributeList.forEach(attribute => {
  2750. if (!allowedAttribute(attribute, allowedAttributes)) {
  2751. element.removeAttribute(attribute.nodeName);
  2752. }
  2753. });
  2754. }
  2755. return createdDocument.body.innerHTML;
  2756. }
  2757. /**
  2758. * --------------------------------------------------------------------------
  2759. * Bootstrap (v5.1.3): tooltip.js
  2760. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2761. * --------------------------------------------------------------------------
  2762. */
  2763. /**
  2764. * ------------------------------------------------------------------------
  2765. * Constants
  2766. * ------------------------------------------------------------------------
  2767. */
  2768. const NAME$4 = 'tooltip';
  2769. const DATA_KEY$4 = 'bs.tooltip';
  2770. const EVENT_KEY$4 = `.${DATA_KEY$4}`;
  2771. const CLASS_PREFIX$1 = 'bs-tooltip';
  2772. const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
  2773. const DefaultType$3 = {
  2774. animation: 'boolean',
  2775. template: 'string',
  2776. title: '(string|element|function)',
  2777. trigger: 'string',
  2778. delay: '(number|object)',
  2779. html: 'boolean',
  2780. selector: '(string|boolean)',
  2781. placement: '(string|function)',
  2782. offset: '(array|string|function)',
  2783. container: '(string|element|boolean)',
  2784. fallbackPlacements: 'array',
  2785. boundary: '(string|element)',
  2786. customClass: '(string|function)',
  2787. sanitize: 'boolean',
  2788. sanitizeFn: '(null|function)',
  2789. allowList: 'object',
  2790. popperConfig: '(null|object|function)'
  2791. };
  2792. const AttachmentMap = {
  2793. AUTO: 'auto',
  2794. TOP: 'top',
  2795. RIGHT: isRTL() ? 'left' : 'right',
  2796. BOTTOM: 'bottom',
  2797. LEFT: isRTL() ? 'right' : 'left'
  2798. };
  2799. const Default$3 = {
  2800. animation: true,
  2801. template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
  2802. trigger: 'hover focus',
  2803. title: '',
  2804. delay: 0,
  2805. html: false,
  2806. selector: false,
  2807. placement: 'top',
  2808. offset: [0, 0],
  2809. container: false,
  2810. fallbackPlacements: ['top', 'right', 'bottom', 'left'],
  2811. boundary: 'clippingParents',
  2812. customClass: '',
  2813. sanitize: true,
  2814. sanitizeFn: null,
  2815. allowList: DefaultAllowlist,
  2816. popperConfig: null
  2817. };
  2818. const Event$2 = {
  2819. HIDE: `hide${EVENT_KEY$4}`,
  2820. HIDDEN: `hidden${EVENT_KEY$4}`,
  2821. SHOW: `show${EVENT_KEY$4}`,
  2822. SHOWN: `shown${EVENT_KEY$4}`,
  2823. INSERTED: `inserted${EVENT_KEY$4}`,
  2824. CLICK: `click${EVENT_KEY$4}`,
  2825. FOCUSIN: `focusin${EVENT_KEY$4}`,
  2826. FOCUSOUT: `focusout${EVENT_KEY$4}`,
  2827. MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
  2828. MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
  2829. };
  2830. const CLASS_NAME_FADE$2 = 'fade';
  2831. const CLASS_NAME_MODAL = 'modal';
  2832. const CLASS_NAME_SHOW$2 = 'show';
  2833. const HOVER_STATE_SHOW = 'show';
  2834. const HOVER_STATE_OUT = 'out';
  2835. const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  2836. const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
  2837. const EVENT_MODAL_HIDE = 'hide.bs.modal';
  2838. const TRIGGER_HOVER = 'hover';
  2839. const TRIGGER_FOCUS = 'focus';
  2840. const TRIGGER_CLICK = 'click';
  2841. const TRIGGER_MANUAL = 'manual';
  2842. /**
  2843. * ------------------------------------------------------------------------
  2844. * Class Definition
  2845. * ------------------------------------------------------------------------
  2846. */
  2847. class Tooltip extends BaseComponent {
  2848. constructor(element, config) {
  2849. if (typeof Popper === 'undefined') {
  2850. throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
  2851. }
  2852. super(element); // private
  2853. this._isEnabled = true;
  2854. this._timeout = 0;
  2855. this._hoverState = '';
  2856. this._activeTrigger = {};
  2857. this._popper = null; // Protected
  2858. this._config = this._getConfig(config);
  2859. this.tip = null;
  2860. this._setListeners();
  2861. } // Getters
  2862. static get Default() {
  2863. return Default$3;
  2864. }
  2865. static get NAME() {
  2866. return NAME$4;
  2867. }
  2868. static get Event() {
  2869. return Event$2;
  2870. }
  2871. static get DefaultType() {
  2872. return DefaultType$3;
  2873. } // Public
  2874. enable() {
  2875. this._isEnabled = true;
  2876. }
  2877. disable() {
  2878. this._isEnabled = false;
  2879. }
  2880. toggleEnabled() {
  2881. this._isEnabled = !this._isEnabled;
  2882. }
  2883. toggle(event) {
  2884. if (!this._isEnabled) {
  2885. return;
  2886. }
  2887. if (event) {
  2888. const context = this._initializeOnDelegatedTarget(event);
  2889. context._activeTrigger.click = !context._activeTrigger.click;
  2890. if (context._isWithActiveTrigger()) {
  2891. context._enter(null, context);
  2892. } else {
  2893. context._leave(null, context);
  2894. }
  2895. } else {
  2896. if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$2)) {
  2897. this._leave(null, this);
  2898. return;
  2899. }
  2900. this._enter(null, this);
  2901. }
  2902. }
  2903. dispose() {
  2904. clearTimeout(this._timeout);
  2905. EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  2906. if (this.tip) {
  2907. this.tip.remove();
  2908. }
  2909. this._disposePopper();
  2910. super.dispose();
  2911. }
  2912. show() {
  2913. if (this._element.style.display === 'none') {
  2914. throw new Error('Please use show on visible elements');
  2915. }
  2916. if (!(this.isWithContent() && this._isEnabled)) {
  2917. return;
  2918. }
  2919. const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
  2920. const shadowRoot = findShadowRoot(this._element);
  2921. const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
  2922. if (showEvent.defaultPrevented || !isInTheDom) {
  2923. return;
  2924. } // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-bs-original-title`
  2925. // This will be removed later in favor of a `setContent` method
  2926. if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
  2927. this._disposePopper();
  2928. this.tip.remove();
  2929. this.tip = null;
  2930. }
  2931. const tip = this.getTipElement();
  2932. const tipId = getUID(this.constructor.NAME);
  2933. tip.setAttribute('id', tipId);
  2934. this._element.setAttribute('aria-describedby', tipId);
  2935. if (this._config.animation) {
  2936. tip.classList.add(CLASS_NAME_FADE$2);
  2937. }
  2938. const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
  2939. const attachment = this._getAttachment(placement);
  2940. this._addAttachmentClass(attachment);
  2941. const {
  2942. container
  2943. } = this._config;
  2944. Data.set(tip, this.constructor.DATA_KEY, this);
  2945. if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
  2946. container.append(tip);
  2947. EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
  2948. }
  2949. if (this._popper) {
  2950. this._popper.update();
  2951. } else {
  2952. this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
  2953. }
  2954. tip.classList.add(CLASS_NAME_SHOW$2);
  2955. const customClass = this._resolvePossibleFunction(this._config.customClass);
  2956. if (customClass) {
  2957. tip.classList.add(...customClass.split(' '));
  2958. } // If this is a touch-enabled device we add extra
  2959. // empty mouseover listeners to the body's immediate children;
  2960. // only needed because of broken event delegation on iOS
  2961. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  2962. if ('ontouchstart' in document.documentElement) {
  2963. [].concat(...document.body.children).forEach(element => {
  2964. EventHandler.on(element, 'mouseover', noop);
  2965. });
  2966. }
  2967. const complete = () => {
  2968. const prevHoverState = this._hoverState;
  2969. this._hoverState = null;
  2970. EventHandler.trigger(this._element, this.constructor.Event.SHOWN);
  2971. if (prevHoverState === HOVER_STATE_OUT) {
  2972. this._leave(null, this);
  2973. }
  2974. };
  2975. const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
  2976. this._queueCallback(complete, this.tip, isAnimated);
  2977. }
  2978. hide() {
  2979. if (!this._popper) {
  2980. return;
  2981. }
  2982. const tip = this.getTipElement();
  2983. const complete = () => {
  2984. if (this._isWithActiveTrigger()) {
  2985. return;
  2986. }
  2987. if (this._hoverState !== HOVER_STATE_SHOW) {
  2988. tip.remove();
  2989. }
  2990. this._cleanTipClass();
  2991. this._element.removeAttribute('aria-describedby');
  2992. EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
  2993. this._disposePopper();
  2994. };
  2995. const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
  2996. if (hideEvent.defaultPrevented) {
  2997. return;
  2998. }
  2999. tip.classList.remove(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we remove the extra
  3000. // empty mouseover listeners we added for iOS support
  3001. if ('ontouchstart' in document.documentElement) {
  3002. [].concat(...document.body.children).forEach(element => EventHandler.off(element, 'mouseover', noop));
  3003. }
  3004. this._activeTrigger[TRIGGER_CLICK] = false;
  3005. this._activeTrigger[TRIGGER_FOCUS] = false;
  3006. this._activeTrigger[TRIGGER_HOVER] = false;
  3007. const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
  3008. this._queueCallback(complete, this.tip, isAnimated);
  3009. this._hoverState = '';
  3010. }
  3011. update() {
  3012. if (this._popper !== null) {
  3013. this._popper.update();
  3014. }
  3015. } // Protected
  3016. isWithContent() {
  3017. return Boolean(this.getTitle());
  3018. }
  3019. getTipElement() {
  3020. if (this.tip) {
  3021. return this.tip;
  3022. }
  3023. const element = document.createElement('div');
  3024. element.innerHTML = this._config.template;
  3025. const tip = element.children[0];
  3026. this.setContent(tip);
  3027. tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
  3028. this.tip = tip;
  3029. return this.tip;
  3030. }
  3031. setContent(tip) {
  3032. this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
  3033. }
  3034. _sanitizeAndSetContent(template, content, selector) {
  3035. const templateElement = SelectorEngine.findOne(selector, template);
  3036. if (!content && templateElement) {
  3037. templateElement.remove();
  3038. return;
  3039. } // we use append for html objects to maintain js events
  3040. this.setElementContent(templateElement, content);
  3041. }
  3042. setElementContent(element, content) {
  3043. if (element === null) {
  3044. return;
  3045. }
  3046. if (isElement(content)) {
  3047. content = getElement(content); // content is a DOM node or a jQuery
  3048. if (this._config.html) {
  3049. if (content.parentNode !== element) {
  3050. element.innerHTML = '';
  3051. element.append(content);
  3052. }
  3053. } else {
  3054. element.textContent = content.textContent;
  3055. }
  3056. return;
  3057. }
  3058. if (this._config.html) {
  3059. if (this._config.sanitize) {
  3060. content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
  3061. }
  3062. element.innerHTML = content;
  3063. } else {
  3064. element.textContent = content;
  3065. }
  3066. }
  3067. getTitle() {
  3068. const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
  3069. return this._resolvePossibleFunction(title);
  3070. }
  3071. updateAttachment(attachment) {
  3072. if (attachment === 'right') {
  3073. return 'end';
  3074. }
  3075. if (attachment === 'left') {
  3076. return 'start';
  3077. }
  3078. return attachment;
  3079. } // Private
  3080. _initializeOnDelegatedTarget(event, context) {
  3081. return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
  3082. }
  3083. _getOffset() {
  3084. const {
  3085. offset
  3086. } = this._config;
  3087. if (typeof offset === 'string') {
  3088. return offset.split(',').map(val => Number.parseInt(val, 10));
  3089. }
  3090. if (typeof offset === 'function') {
  3091. return popperData => offset(popperData, this._element);
  3092. }
  3093. return offset;
  3094. }
  3095. _resolvePossibleFunction(content) {
  3096. return typeof content === 'function' ? content.call(this._element) : content;
  3097. }
  3098. _getPopperConfig(attachment) {
  3099. const defaultBsPopperConfig = {
  3100. placement: attachment,
  3101. modifiers: [{
  3102. name: 'flip',
  3103. options: {
  3104. fallbackPlacements: this._config.fallbackPlacements
  3105. }
  3106. }, {
  3107. name: 'offset',
  3108. options: {
  3109. offset: this._getOffset()
  3110. }
  3111. }, {
  3112. name: 'preventOverflow',
  3113. options: {
  3114. boundary: this._config.boundary
  3115. }
  3116. }, {
  3117. name: 'arrow',
  3118. options: {
  3119. element: `.${this.constructor.NAME}-arrow`
  3120. }
  3121. }, {
  3122. name: 'onChange',
  3123. enabled: true,
  3124. phase: 'afterWrite',
  3125. fn: data => this._handlePopperPlacementChange(data)
  3126. }],
  3127. onFirstUpdate: data => {
  3128. if (data.options.placement !== data.placement) {
  3129. this._handlePopperPlacementChange(data);
  3130. }
  3131. }
  3132. };
  3133. return { ...defaultBsPopperConfig,
  3134. ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
  3135. };
  3136. }
  3137. _addAttachmentClass(attachment) {
  3138. this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
  3139. }
  3140. _getAttachment(placement) {
  3141. return AttachmentMap[placement.toUpperCase()];
  3142. }
  3143. _setListeners() {
  3144. const triggers = this._config.trigger.split(' ');
  3145. triggers.forEach(trigger => {
  3146. if (trigger === 'click') {
  3147. EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event));
  3148. } else if (trigger !== TRIGGER_MANUAL) {
  3149. const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
  3150. const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
  3151. EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event));
  3152. EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event));
  3153. }
  3154. });
  3155. this._hideModalHandler = () => {
  3156. if (this._element) {
  3157. this.hide();
  3158. }
  3159. };
  3160. EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  3161. if (this._config.selector) {
  3162. this._config = { ...this._config,
  3163. trigger: 'manual',
  3164. selector: ''
  3165. };
  3166. } else {
  3167. this._fixTitle();
  3168. }
  3169. }
  3170. _fixTitle() {
  3171. const title = this._element.getAttribute('title');
  3172. const originalTitleType = typeof this._element.getAttribute('data-bs-original-title');
  3173. if (title || originalTitleType !== 'string') {
  3174. this._element.setAttribute('data-bs-original-title', title || '');
  3175. if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
  3176. this._element.setAttribute('aria-label', title);
  3177. }
  3178. this._element.setAttribute('title', '');
  3179. }
  3180. }
  3181. _enter(event, context) {
  3182. context = this._initializeOnDelegatedTarget(event, context);
  3183. if (event) {
  3184. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  3185. }
  3186. if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$2) || context._hoverState === HOVER_STATE_SHOW) {
  3187. context._hoverState = HOVER_STATE_SHOW;
  3188. return;
  3189. }
  3190. clearTimeout(context._timeout);
  3191. context._hoverState = HOVER_STATE_SHOW;
  3192. if (!context._config.delay || !context._config.delay.show) {
  3193. context.show();
  3194. return;
  3195. }
  3196. context._timeout = setTimeout(() => {
  3197. if (context._hoverState === HOVER_STATE_SHOW) {
  3198. context.show();
  3199. }
  3200. }, context._config.delay.show);
  3201. }
  3202. _leave(event, context) {
  3203. context = this._initializeOnDelegatedTarget(event, context);
  3204. if (event) {
  3205. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
  3206. }
  3207. if (context._isWithActiveTrigger()) {
  3208. return;
  3209. }
  3210. clearTimeout(context._timeout);
  3211. context._hoverState = HOVER_STATE_OUT;
  3212. if (!context._config.delay || !context._config.delay.hide) {
  3213. context.hide();
  3214. return;
  3215. }
  3216. context._timeout = setTimeout(() => {
  3217. if (context._hoverState === HOVER_STATE_OUT) {
  3218. context.hide();
  3219. }
  3220. }, context._config.delay.hide);
  3221. }
  3222. _isWithActiveTrigger() {
  3223. for (const trigger in this._activeTrigger) {
  3224. if (this._activeTrigger[trigger]) {
  3225. return true;
  3226. }
  3227. }
  3228. return false;
  3229. }
  3230. _getConfig(config) {
  3231. const dataAttributes = Manipulator.getDataAttributes(this._element);
  3232. Object.keys(dataAttributes).forEach(dataAttr => {
  3233. if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
  3234. delete dataAttributes[dataAttr];
  3235. }
  3236. });
  3237. config = { ...this.constructor.Default,
  3238. ...dataAttributes,
  3239. ...(typeof config === 'object' && config ? config : {})
  3240. };
  3241. config.container = config.container === false ? document.body : getElement(config.container);
  3242. if (typeof config.delay === 'number') {
  3243. config.delay = {
  3244. show: config.delay,
  3245. hide: config.delay
  3246. };
  3247. }
  3248. if (typeof config.title === 'number') {
  3249. config.title = config.title.toString();
  3250. }
  3251. if (typeof config.content === 'number') {
  3252. config.content = config.content.toString();
  3253. }
  3254. typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3255. if (config.sanitize) {
  3256. config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
  3257. }
  3258. return config;
  3259. }
  3260. _getDelegateConfig() {
  3261. const config = {};
  3262. for (const key in this._config) {
  3263. if (this.constructor.Default[key] !== this._config[key]) {
  3264. config[key] = this._config[key];
  3265. }
  3266. } // In the future can be replaced with:
  3267. // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
  3268. // `Object.fromEntries(keysWithDifferentValues)`
  3269. return config;
  3270. }
  3271. _cleanTipClass() {
  3272. const tip = this.getTipElement();
  3273. const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
  3274. const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
  3275. if (tabClass !== null && tabClass.length > 0) {
  3276. tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
  3277. }
  3278. }
  3279. _getBasicClassPrefix() {
  3280. return CLASS_PREFIX$1;
  3281. }
  3282. _handlePopperPlacementChange(popperData) {
  3283. const {
  3284. state
  3285. } = popperData;
  3286. if (!state) {
  3287. return;
  3288. }
  3289. this.tip = state.elements.popper;
  3290. this._cleanTipClass();
  3291. this._addAttachmentClass(this._getAttachment(state.placement));
  3292. }
  3293. _disposePopper() {
  3294. if (this._popper) {
  3295. this._popper.destroy();
  3296. this._popper = null;
  3297. }
  3298. } // Static
  3299. static jQueryInterface(config) {
  3300. return this.each(function () {
  3301. const data = Tooltip.getOrCreateInstance(this, config);
  3302. if (typeof config === 'string') {
  3303. if (typeof data[config] === 'undefined') {
  3304. throw new TypeError(`No method named "${config}"`);
  3305. }
  3306. data[config]();
  3307. }
  3308. });
  3309. }
  3310. }
  3311. /**
  3312. * ------------------------------------------------------------------------
  3313. * jQuery
  3314. * ------------------------------------------------------------------------
  3315. * add .Tooltip to jQuery only if jQuery is present
  3316. */
  3317. defineJQueryPlugin(Tooltip);
  3318. /**
  3319. * --------------------------------------------------------------------------
  3320. * Bootstrap (v5.1.3): popover.js
  3321. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3322. * --------------------------------------------------------------------------
  3323. */
  3324. /**
  3325. * ------------------------------------------------------------------------
  3326. * Constants
  3327. * ------------------------------------------------------------------------
  3328. */
  3329. const NAME$3 = 'popover';
  3330. const DATA_KEY$3 = 'bs.popover';
  3331. const EVENT_KEY$3 = `.${DATA_KEY$3}`;
  3332. const CLASS_PREFIX = 'bs-popover';
  3333. const Default$2 = { ...Tooltip.Default,
  3334. placement: 'right',
  3335. offset: [0, 8],
  3336. trigger: 'click',
  3337. content: '',
  3338. template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>'
  3339. };
  3340. const DefaultType$2 = { ...Tooltip.DefaultType,
  3341. content: '(string|element|function)'
  3342. };
  3343. const Event$1 = {
  3344. HIDE: `hide${EVENT_KEY$3}`,
  3345. HIDDEN: `hidden${EVENT_KEY$3}`,
  3346. SHOW: `show${EVENT_KEY$3}`,
  3347. SHOWN: `shown${EVENT_KEY$3}`,
  3348. INSERTED: `inserted${EVENT_KEY$3}`,
  3349. CLICK: `click${EVENT_KEY$3}`,
  3350. FOCUSIN: `focusin${EVENT_KEY$3}`,
  3351. FOCUSOUT: `focusout${EVENT_KEY$3}`,
  3352. MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
  3353. MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
  3354. };
  3355. const SELECTOR_TITLE = '.popover-header';
  3356. const SELECTOR_CONTENT = '.popover-body';
  3357. /**
  3358. * ------------------------------------------------------------------------
  3359. * Class Definition
  3360. * ------------------------------------------------------------------------
  3361. */
  3362. class Popover extends Tooltip {
  3363. // Getters
  3364. static get Default() {
  3365. return Default$2;
  3366. }
  3367. static get NAME() {
  3368. return NAME$3;
  3369. }
  3370. static get Event() {
  3371. return Event$1;
  3372. }
  3373. static get DefaultType() {
  3374. return DefaultType$2;
  3375. } // Overrides
  3376. isWithContent() {
  3377. return this.getTitle() || this._getContent();
  3378. }
  3379. setContent(tip) {
  3380. this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
  3381. this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
  3382. } // Private
  3383. _getContent() {
  3384. return this._resolvePossibleFunction(this._config.content);
  3385. }
  3386. _getBasicClassPrefix() {
  3387. return CLASS_PREFIX;
  3388. } // Static
  3389. static jQueryInterface(config) {
  3390. return this.each(function () {
  3391. const data = Popover.getOrCreateInstance(this, config);
  3392. if (typeof config === 'string') {
  3393. if (typeof data[config] === 'undefined') {
  3394. throw new TypeError(`No method named "${config}"`);
  3395. }
  3396. data[config]();
  3397. }
  3398. });
  3399. }
  3400. }
  3401. /**
  3402. * ------------------------------------------------------------------------
  3403. * jQuery
  3404. * ------------------------------------------------------------------------
  3405. * add .Popover to jQuery only if jQuery is present
  3406. */
  3407. defineJQueryPlugin(Popover);
  3408. /**
  3409. * --------------------------------------------------------------------------
  3410. * Bootstrap (v5.1.3): scrollspy.js
  3411. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3412. * --------------------------------------------------------------------------
  3413. */
  3414. /**
  3415. * ------------------------------------------------------------------------
  3416. * Constants
  3417. * ------------------------------------------------------------------------
  3418. */
  3419. const NAME$2 = 'scrollspy';
  3420. const DATA_KEY$2 = 'bs.scrollspy';
  3421. const EVENT_KEY$2 = `.${DATA_KEY$2}`;
  3422. const DATA_API_KEY$1 = '.data-api';
  3423. const Default$1 = {
  3424. offset: 10,
  3425. method: 'auto',
  3426. target: ''
  3427. };
  3428. const DefaultType$1 = {
  3429. offset: 'number',
  3430. method: 'string',
  3431. target: '(string|element)'
  3432. };
  3433. const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
  3434. const EVENT_SCROLL = `scroll${EVENT_KEY$2}`;
  3435. const EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`;
  3436. const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  3437. const CLASS_NAME_ACTIVE$1 = 'active';
  3438. const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
  3439. const SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
  3440. const SELECTOR_NAV_LINKS = '.nav-link';
  3441. const SELECTOR_NAV_ITEMS = '.nav-item';
  3442. const SELECTOR_LIST_ITEMS = '.list-group-item';
  3443. const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`;
  3444. const SELECTOR_DROPDOWN$1 = '.dropdown';
  3445. const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  3446. const METHOD_OFFSET = 'offset';
  3447. const METHOD_POSITION = 'position';
  3448. /**
  3449. * ------------------------------------------------------------------------
  3450. * Class Definition
  3451. * ------------------------------------------------------------------------
  3452. */
  3453. class ScrollSpy extends BaseComponent {
  3454. constructor(element, config) {
  3455. super(element);
  3456. this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
  3457. this._config = this._getConfig(config);
  3458. this._offsets = [];
  3459. this._targets = [];
  3460. this._activeTarget = null;
  3461. this._scrollHeight = 0;
  3462. EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process());
  3463. this.refresh();
  3464. this._process();
  3465. } // Getters
  3466. static get Default() {
  3467. return Default$1;
  3468. }
  3469. static get NAME() {
  3470. return NAME$2;
  3471. } // Public
  3472. refresh() {
  3473. const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
  3474. const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  3475. const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
  3476. this._offsets = [];
  3477. this._targets = [];
  3478. this._scrollHeight = this._getScrollHeight();
  3479. const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target);
  3480. targets.map(element => {
  3481. const targetSelector = getSelectorFromElement(element);
  3482. const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
  3483. if (target) {
  3484. const targetBCR = target.getBoundingClientRect();
  3485. if (targetBCR.width || targetBCR.height) {
  3486. return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
  3487. }
  3488. }
  3489. return null;
  3490. }).filter(item => item).sort((a, b) => a[0] - b[0]).forEach(item => {
  3491. this._offsets.push(item[0]);
  3492. this._targets.push(item[1]);
  3493. });
  3494. }
  3495. dispose() {
  3496. EventHandler.off(this._scrollElement, EVENT_KEY$2);
  3497. super.dispose();
  3498. } // Private
  3499. _getConfig(config) {
  3500. config = { ...Default$1,
  3501. ...Manipulator.getDataAttributes(this._element),
  3502. ...(typeof config === 'object' && config ? config : {})
  3503. };
  3504. config.target = getElement(config.target) || document.documentElement;
  3505. typeCheckConfig(NAME$2, config, DefaultType$1);
  3506. return config;
  3507. }
  3508. _getScrollTop() {
  3509. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  3510. }
  3511. _getScrollHeight() {
  3512. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  3513. }
  3514. _getOffsetHeight() {
  3515. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  3516. }
  3517. _process() {
  3518. const scrollTop = this._getScrollTop() + this._config.offset;
  3519. const scrollHeight = this._getScrollHeight();
  3520. const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  3521. if (this._scrollHeight !== scrollHeight) {
  3522. this.refresh();
  3523. }
  3524. if (scrollTop >= maxScroll) {
  3525. const target = this._targets[this._targets.length - 1];
  3526. if (this._activeTarget !== target) {
  3527. this._activate(target);
  3528. }
  3529. return;
  3530. }
  3531. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  3532. this._activeTarget = null;
  3533. this._clear();
  3534. return;
  3535. }
  3536. for (let i = this._offsets.length; i--;) {
  3537. const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  3538. if (isActiveTarget) {
  3539. this._activate(this._targets[i]);
  3540. }
  3541. }
  3542. }
  3543. _activate(target) {
  3544. this._activeTarget = target;
  3545. this._clear();
  3546. const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
  3547. const link = SelectorEngine.findOne(queries.join(','), this._config.target);
  3548. link.classList.add(CLASS_NAME_ACTIVE$1);
  3549. if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
  3550. SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
  3551. } else {
  3552. SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => {
  3553. // Set triggered links parents as active
  3554. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  3555. SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1)); // Handle special case when .nav-link is inside .nav-item
  3556. SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(navItem => {
  3557. SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1));
  3558. });
  3559. });
  3560. }
  3561. EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
  3562. relatedTarget: target
  3563. });
  3564. }
  3565. _clear() {
  3566. SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1));
  3567. } // Static
  3568. static jQueryInterface(config) {
  3569. return this.each(function () {
  3570. const data = ScrollSpy.getOrCreateInstance(this, config);
  3571. if (typeof config !== 'string') {
  3572. return;
  3573. }
  3574. if (typeof data[config] === 'undefined') {
  3575. throw new TypeError(`No method named "${config}"`);
  3576. }
  3577. data[config]();
  3578. });
  3579. }
  3580. }
  3581. /**
  3582. * ------------------------------------------------------------------------
  3583. * Data Api implementation
  3584. * ------------------------------------------------------------------------
  3585. */
  3586. EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
  3587. SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
  3588. });
  3589. /**
  3590. * ------------------------------------------------------------------------
  3591. * jQuery
  3592. * ------------------------------------------------------------------------
  3593. * add .ScrollSpy to jQuery only if jQuery is present
  3594. */
  3595. defineJQueryPlugin(ScrollSpy);
  3596. /**
  3597. * --------------------------------------------------------------------------
  3598. * Bootstrap (v5.1.3): tab.js
  3599. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3600. * --------------------------------------------------------------------------
  3601. */
  3602. /**
  3603. * ------------------------------------------------------------------------
  3604. * Constants
  3605. * ------------------------------------------------------------------------
  3606. */
  3607. const NAME$1 = 'tab';
  3608. const DATA_KEY$1 = 'bs.tab';
  3609. const EVENT_KEY$1 = `.${DATA_KEY$1}`;
  3610. const DATA_API_KEY = '.data-api';
  3611. const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
  3612. const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
  3613. const EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
  3614. const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
  3615. const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`;
  3616. const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
  3617. const CLASS_NAME_ACTIVE = 'active';
  3618. const CLASS_NAME_FADE$1 = 'fade';
  3619. const CLASS_NAME_SHOW$1 = 'show';
  3620. const SELECTOR_DROPDOWN = '.dropdown';
  3621. const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  3622. const SELECTOR_ACTIVE = '.active';
  3623. const SELECTOR_ACTIVE_UL = ':scope > li > .active';
  3624. const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
  3625. const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  3626. const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
  3627. /**
  3628. * ------------------------------------------------------------------------
  3629. * Class Definition
  3630. * ------------------------------------------------------------------------
  3631. */
  3632. class Tab extends BaseComponent {
  3633. // Getters
  3634. static get NAME() {
  3635. return NAME$1;
  3636. } // Public
  3637. show() {
  3638. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
  3639. return;
  3640. }
  3641. let previous;
  3642. const target = getElementFromSelector(this._element);
  3643. const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
  3644. if (listElement) {
  3645. const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE;
  3646. previous = SelectorEngine.find(itemSelector, listElement);
  3647. previous = previous[previous.length - 1];
  3648. }
  3649. const hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, {
  3650. relatedTarget: this._element
  3651. }) : null;
  3652. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, {
  3653. relatedTarget: previous
  3654. });
  3655. if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
  3656. return;
  3657. }
  3658. this._activate(this._element, listElement);
  3659. const complete = () => {
  3660. EventHandler.trigger(previous, EVENT_HIDDEN$1, {
  3661. relatedTarget: this._element
  3662. });
  3663. EventHandler.trigger(this._element, EVENT_SHOWN$1, {
  3664. relatedTarget: previous
  3665. });
  3666. };
  3667. if (target) {
  3668. this._activate(target, target.parentNode, complete);
  3669. } else {
  3670. complete();
  3671. }
  3672. } // Private
  3673. _activate(element, container, callback) {
  3674. const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE);
  3675. const active = activeElements[0];
  3676. const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1);
  3677. const complete = () => this._transitionComplete(element, active, callback);
  3678. if (active && isTransitioning) {
  3679. active.classList.remove(CLASS_NAME_SHOW$1);
  3680. this._queueCallback(complete, element, true);
  3681. } else {
  3682. complete();
  3683. }
  3684. }
  3685. _transitionComplete(element, active, callback) {
  3686. if (active) {
  3687. active.classList.remove(CLASS_NAME_ACTIVE);
  3688. const dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
  3689. if (dropdownChild) {
  3690. dropdownChild.classList.remove(CLASS_NAME_ACTIVE);
  3691. }
  3692. if (active.getAttribute('role') === 'tab') {
  3693. active.setAttribute('aria-selected', false);
  3694. }
  3695. }
  3696. element.classList.add(CLASS_NAME_ACTIVE);
  3697. if (element.getAttribute('role') === 'tab') {
  3698. element.setAttribute('aria-selected', true);
  3699. }
  3700. reflow(element);
  3701. if (element.classList.contains(CLASS_NAME_FADE$1)) {
  3702. element.classList.add(CLASS_NAME_SHOW$1);
  3703. }
  3704. let parent = element.parentNode;
  3705. if (parent && parent.nodeName === 'LI') {
  3706. parent = parent.parentNode;
  3707. }
  3708. if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
  3709. const dropdownElement = element.closest(SELECTOR_DROPDOWN);
  3710. if (dropdownElement) {
  3711. SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
  3712. }
  3713. element.setAttribute('aria-expanded', true);
  3714. }
  3715. if (callback) {
  3716. callback();
  3717. }
  3718. } // Static
  3719. static jQueryInterface(config) {
  3720. return this.each(function () {
  3721. const data = Tab.getOrCreateInstance(this);
  3722. if (typeof config === 'string') {
  3723. if (typeof data[config] === 'undefined') {
  3724. throw new TypeError(`No method named "${config}"`);
  3725. }
  3726. data[config]();
  3727. }
  3728. });
  3729. }
  3730. }
  3731. /**
  3732. * ------------------------------------------------------------------------
  3733. * Data Api implementation
  3734. * ------------------------------------------------------------------------
  3735. */
  3736. EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
  3737. if (['A', 'AREA'].includes(this.tagName)) {
  3738. event.preventDefault();
  3739. }
  3740. if (isDisabled(this)) {
  3741. return;
  3742. }
  3743. const data = Tab.getOrCreateInstance(this);
  3744. data.show();
  3745. });
  3746. /**
  3747. * ------------------------------------------------------------------------
  3748. * jQuery
  3749. * ------------------------------------------------------------------------
  3750. * add .Tab to jQuery only if jQuery is present
  3751. */
  3752. defineJQueryPlugin(Tab);
  3753. /**
  3754. * --------------------------------------------------------------------------
  3755. * Bootstrap (v5.1.3): toast.js
  3756. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3757. * --------------------------------------------------------------------------
  3758. */
  3759. /**
  3760. * ------------------------------------------------------------------------
  3761. * Constants
  3762. * ------------------------------------------------------------------------
  3763. */
  3764. const NAME = 'toast';
  3765. const DATA_KEY = 'bs.toast';
  3766. const EVENT_KEY = `.${DATA_KEY}`;
  3767. const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
  3768. const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
  3769. const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
  3770. const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
  3771. const EVENT_HIDE = `hide${EVENT_KEY}`;
  3772. const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
  3773. const EVENT_SHOW = `show${EVENT_KEY}`;
  3774. const EVENT_SHOWN = `shown${EVENT_KEY}`;
  3775. const CLASS_NAME_FADE = 'fade';
  3776. const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
  3777. const CLASS_NAME_SHOW = 'show';
  3778. const CLASS_NAME_SHOWING = 'showing';
  3779. const DefaultType = {
  3780. animation: 'boolean',
  3781. autohide: 'boolean',
  3782. delay: 'number'
  3783. };
  3784. const Default = {
  3785. animation: true,
  3786. autohide: true,
  3787. delay: 5000
  3788. };
  3789. /**
  3790. * ------------------------------------------------------------------------
  3791. * Class Definition
  3792. * ------------------------------------------------------------------------
  3793. */
  3794. class Toast extends BaseComponent {
  3795. constructor(element, config) {
  3796. super(element);
  3797. this._config = this._getConfig(config);
  3798. this._timeout = null;
  3799. this._hasMouseInteraction = false;
  3800. this._hasKeyboardInteraction = false;
  3801. this._setListeners();
  3802. } // Getters
  3803. static get DefaultType() {
  3804. return DefaultType;
  3805. }
  3806. static get Default() {
  3807. return Default;
  3808. }
  3809. static get NAME() {
  3810. return NAME;
  3811. } // Public
  3812. show() {
  3813. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
  3814. if (showEvent.defaultPrevented) {
  3815. return;
  3816. }
  3817. this._clearTimeout();
  3818. if (this._config.animation) {
  3819. this._element.classList.add(CLASS_NAME_FADE);
  3820. }
  3821. const complete = () => {
  3822. this._element.classList.remove(CLASS_NAME_SHOWING);
  3823. EventHandler.trigger(this._element, EVENT_SHOWN);
  3824. this._maybeScheduleHide();
  3825. };
  3826. this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
  3827. reflow(this._element);
  3828. this._element.classList.add(CLASS_NAME_SHOW);
  3829. this._element.classList.add(CLASS_NAME_SHOWING);
  3830. this._queueCallback(complete, this._element, this._config.animation);
  3831. }
  3832. hide() {
  3833. if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
  3834. return;
  3835. }
  3836. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
  3837. if (hideEvent.defaultPrevented) {
  3838. return;
  3839. }
  3840. const complete = () => {
  3841. this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
  3842. this._element.classList.remove(CLASS_NAME_SHOWING);
  3843. this._element.classList.remove(CLASS_NAME_SHOW);
  3844. EventHandler.trigger(this._element, EVENT_HIDDEN);
  3845. };
  3846. this._element.classList.add(CLASS_NAME_SHOWING);
  3847. this._queueCallback(complete, this._element, this._config.animation);
  3848. }
  3849. dispose() {
  3850. this._clearTimeout();
  3851. if (this._element.classList.contains(CLASS_NAME_SHOW)) {
  3852. this._element.classList.remove(CLASS_NAME_SHOW);
  3853. }
  3854. super.dispose();
  3855. } // Private
  3856. _getConfig(config) {
  3857. config = { ...Default,
  3858. ...Manipulator.getDataAttributes(this._element),
  3859. ...(typeof config === 'object' && config ? config : {})
  3860. };
  3861. typeCheckConfig(NAME, config, this.constructor.DefaultType);
  3862. return config;
  3863. }
  3864. _maybeScheduleHide() {
  3865. if (!this._config.autohide) {
  3866. return;
  3867. }
  3868. if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
  3869. return;
  3870. }
  3871. this._timeout = setTimeout(() => {
  3872. this.hide();
  3873. }, this._config.delay);
  3874. }
  3875. _onInteraction(event, isInteracting) {
  3876. switch (event.type) {
  3877. case 'mouseover':
  3878. case 'mouseout':
  3879. this._hasMouseInteraction = isInteracting;
  3880. break;
  3881. case 'focusin':
  3882. case 'focusout':
  3883. this._hasKeyboardInteraction = isInteracting;
  3884. break;
  3885. }
  3886. if (isInteracting) {
  3887. this._clearTimeout();
  3888. return;
  3889. }
  3890. const nextElement = event.relatedTarget;
  3891. if (this._element === nextElement || this._element.contains(nextElement)) {
  3892. return;
  3893. }
  3894. this._maybeScheduleHide();
  3895. }
  3896. _setListeners() {
  3897. EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
  3898. EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
  3899. EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
  3900. EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
  3901. }
  3902. _clearTimeout() {
  3903. clearTimeout(this._timeout);
  3904. this._timeout = null;
  3905. } // Static
  3906. static jQueryInterface(config) {
  3907. return this.each(function () {
  3908. const data = Toast.getOrCreateInstance(this, config);
  3909. if (typeof config === 'string') {
  3910. if (typeof data[config] === 'undefined') {
  3911. throw new TypeError(`No method named "${config}"`);
  3912. }
  3913. data[config](this);
  3914. }
  3915. });
  3916. }
  3917. }
  3918. enableDismissTrigger(Toast);
  3919. /**
  3920. * ------------------------------------------------------------------------
  3921. * jQuery
  3922. * ------------------------------------------------------------------------
  3923. * add .Toast to jQuery only if jQuery is present
  3924. */
  3925. defineJQueryPlugin(Toast);
  3926. export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Offcanvas, Popover, ScrollSpy, Tab, Toast, Tooltip };
  3927. //# sourceMappingURL=bootstrap.esm.js.map