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.

4410 lines
132 KiB

4 years ago
  1. /*!
  2. * Bootstrap v4.5.2 (https://getbootstrap.com/)
  3. * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) :
  8. typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
  9. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper));
  10. }(this, (function (exports, $, Popper) { 'use strict';
  11. $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
  12. Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper;
  13. function _defineProperties(target, props) {
  14. for (var i = 0; i < props.length; i++) {
  15. var descriptor = props[i];
  16. descriptor.enumerable = descriptor.enumerable || false;
  17. descriptor.configurable = true;
  18. if ("value" in descriptor) descriptor.writable = true;
  19. Object.defineProperty(target, descriptor.key, descriptor);
  20. }
  21. }
  22. function _createClass(Constructor, protoProps, staticProps) {
  23. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  24. if (staticProps) _defineProperties(Constructor, staticProps);
  25. return Constructor;
  26. }
  27. function _extends() {
  28. _extends = Object.assign || function (target) {
  29. for (var i = 1; i < arguments.length; i++) {
  30. var source = arguments[i];
  31. for (var key in source) {
  32. if (Object.prototype.hasOwnProperty.call(source, key)) {
  33. target[key] = source[key];
  34. }
  35. }
  36. }
  37. return target;
  38. };
  39. return _extends.apply(this, arguments);
  40. }
  41. function _inheritsLoose(subClass, superClass) {
  42. subClass.prototype = Object.create(superClass.prototype);
  43. subClass.prototype.constructor = subClass;
  44. subClass.__proto__ = superClass;
  45. }
  46. /**
  47. * --------------------------------------------------------------------------
  48. * Bootstrap (v4.5.2): util.js
  49. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  50. * --------------------------------------------------------------------------
  51. */
  52. /**
  53. * ------------------------------------------------------------------------
  54. * Private TransitionEnd Helpers
  55. * ------------------------------------------------------------------------
  56. */
  57. var TRANSITION_END = 'transitionend';
  58. var MAX_UID = 1000000;
  59. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  60. function toType(obj) {
  61. if (obj === null || typeof obj === 'undefined') {
  62. return "" + obj;
  63. }
  64. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  65. }
  66. function getSpecialTransitionEndEvent() {
  67. return {
  68. bindType: TRANSITION_END,
  69. delegateType: TRANSITION_END,
  70. handle: function handle(event) {
  71. if ($(event.target).is(this)) {
  72. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  73. }
  74. return undefined;
  75. }
  76. };
  77. }
  78. function transitionEndEmulator(duration) {
  79. var _this = this;
  80. var called = false;
  81. $(this).one(Util.TRANSITION_END, function () {
  82. called = true;
  83. });
  84. setTimeout(function () {
  85. if (!called) {
  86. Util.triggerTransitionEnd(_this);
  87. }
  88. }, duration);
  89. return this;
  90. }
  91. function setTransitionEndSupport() {
  92. $.fn.emulateTransitionEnd = transitionEndEmulator;
  93. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  94. }
  95. /**
  96. * --------------------------------------------------------------------------
  97. * Public Util Api
  98. * --------------------------------------------------------------------------
  99. */
  100. var Util = {
  101. TRANSITION_END: 'bsTransitionEnd',
  102. getUID: function getUID(prefix) {
  103. do {
  104. // eslint-disable-next-line no-bitwise
  105. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  106. } while (document.getElementById(prefix));
  107. return prefix;
  108. },
  109. getSelectorFromElement: function getSelectorFromElement(element) {
  110. var selector = element.getAttribute('data-target');
  111. if (!selector || selector === '#') {
  112. var hrefAttr = element.getAttribute('href');
  113. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  114. }
  115. try {
  116. return document.querySelector(selector) ? selector : null;
  117. } catch (err) {
  118. return null;
  119. }
  120. },
  121. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  122. if (!element) {
  123. return 0;
  124. } // Get transition-duration of the element
  125. var transitionDuration = $(element).css('transition-duration');
  126. var transitionDelay = $(element).css('transition-delay');
  127. var floatTransitionDuration = parseFloat(transitionDuration);
  128. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  129. if (!floatTransitionDuration && !floatTransitionDelay) {
  130. return 0;
  131. } // If multiple durations are defined, take the first
  132. transitionDuration = transitionDuration.split(',')[0];
  133. transitionDelay = transitionDelay.split(',')[0];
  134. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  135. },
  136. reflow: function reflow(element) {
  137. return element.offsetHeight;
  138. },
  139. triggerTransitionEnd: function triggerTransitionEnd(element) {
  140. $(element).trigger(TRANSITION_END);
  141. },
  142. // TODO: Remove in v5
  143. supportsTransitionEnd: function supportsTransitionEnd() {
  144. return Boolean(TRANSITION_END);
  145. },
  146. isElement: function isElement(obj) {
  147. return (obj[0] || obj).nodeType;
  148. },
  149. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  150. for (var property in configTypes) {
  151. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  152. var expectedTypes = configTypes[property];
  153. var value = config[property];
  154. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  155. if (!new RegExp(expectedTypes).test(valueType)) {
  156. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  157. }
  158. }
  159. }
  160. },
  161. findShadowRoot: function findShadowRoot(element) {
  162. if (!document.documentElement.attachShadow) {
  163. return null;
  164. } // Can find the shadow root otherwise it'll return the document
  165. if (typeof element.getRootNode === 'function') {
  166. var root = element.getRootNode();
  167. return root instanceof ShadowRoot ? root : null;
  168. }
  169. if (element instanceof ShadowRoot) {
  170. return element;
  171. } // when we don't find a shadow root
  172. if (!element.parentNode) {
  173. return null;
  174. }
  175. return Util.findShadowRoot(element.parentNode);
  176. },
  177. jQueryDetection: function jQueryDetection() {
  178. if (typeof $ === 'undefined') {
  179. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  180. }
  181. var version = $.fn.jquery.split(' ')[0].split('.');
  182. var minMajor = 1;
  183. var ltMajor = 2;
  184. var minMinor = 9;
  185. var minPatch = 1;
  186. var maxMajor = 4;
  187. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  188. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  189. }
  190. }
  191. };
  192. Util.jQueryDetection();
  193. setTransitionEndSupport();
  194. /**
  195. * ------------------------------------------------------------------------
  196. * Constants
  197. * ------------------------------------------------------------------------
  198. */
  199. var NAME = 'alert';
  200. var VERSION = '4.5.2';
  201. var DATA_KEY = 'bs.alert';
  202. var EVENT_KEY = "." + DATA_KEY;
  203. var DATA_API_KEY = '.data-api';
  204. var JQUERY_NO_CONFLICT = $.fn[NAME];
  205. var SELECTOR_DISMISS = '[data-dismiss="alert"]';
  206. var EVENT_CLOSE = "close" + EVENT_KEY;
  207. var EVENT_CLOSED = "closed" + EVENT_KEY;
  208. var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
  209. var CLASS_NAME_ALERT = 'alert';
  210. var CLASS_NAME_FADE = 'fade';
  211. var CLASS_NAME_SHOW = 'show';
  212. /**
  213. * ------------------------------------------------------------------------
  214. * Class Definition
  215. * ------------------------------------------------------------------------
  216. */
  217. var Alert = /*#__PURE__*/function () {
  218. function Alert(element) {
  219. this._element = element;
  220. } // Getters
  221. var _proto = Alert.prototype;
  222. // Public
  223. _proto.close = function close(element) {
  224. var rootElement = this._element;
  225. if (element) {
  226. rootElement = this._getRootElement(element);
  227. }
  228. var customEvent = this._triggerCloseEvent(rootElement);
  229. if (customEvent.isDefaultPrevented()) {
  230. return;
  231. }
  232. this._removeElement(rootElement);
  233. };
  234. _proto.dispose = function dispose() {
  235. $.removeData(this._element, DATA_KEY);
  236. this._element = null;
  237. } // Private
  238. ;
  239. _proto._getRootElement = function _getRootElement(element) {
  240. var selector = Util.getSelectorFromElement(element);
  241. var parent = false;
  242. if (selector) {
  243. parent = document.querySelector(selector);
  244. }
  245. if (!parent) {
  246. parent = $(element).closest("." + CLASS_NAME_ALERT)[0];
  247. }
  248. return parent;
  249. };
  250. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  251. var closeEvent = $.Event(EVENT_CLOSE);
  252. $(element).trigger(closeEvent);
  253. return closeEvent;
  254. };
  255. _proto._removeElement = function _removeElement(element) {
  256. var _this = this;
  257. $(element).removeClass(CLASS_NAME_SHOW);
  258. if (!$(element).hasClass(CLASS_NAME_FADE)) {
  259. this._destroyElement(element);
  260. return;
  261. }
  262. var transitionDuration = Util.getTransitionDurationFromElement(element);
  263. $(element).one(Util.TRANSITION_END, function (event) {
  264. return _this._destroyElement(element, event);
  265. }).emulateTransitionEnd(transitionDuration);
  266. };
  267. _proto._destroyElement = function _destroyElement(element) {
  268. $(element).detach().trigger(EVENT_CLOSED).remove();
  269. } // Static
  270. ;
  271. Alert._jQueryInterface = function _jQueryInterface(config) {
  272. return this.each(function () {
  273. var $element = $(this);
  274. var data = $element.data(DATA_KEY);
  275. if (!data) {
  276. data = new Alert(this);
  277. $element.data(DATA_KEY, data);
  278. }
  279. if (config === 'close') {
  280. data[config](this);
  281. }
  282. });
  283. };
  284. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  285. return function (event) {
  286. if (event) {
  287. event.preventDefault();
  288. }
  289. alertInstance.close(this);
  290. };
  291. };
  292. _createClass(Alert, null, [{
  293. key: "VERSION",
  294. get: function get() {
  295. return VERSION;
  296. }
  297. }]);
  298. return Alert;
  299. }();
  300. /**
  301. * ------------------------------------------------------------------------
  302. * Data Api implementation
  303. * ------------------------------------------------------------------------
  304. */
  305. $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert()));
  306. /**
  307. * ------------------------------------------------------------------------
  308. * jQuery
  309. * ------------------------------------------------------------------------
  310. */
  311. $.fn[NAME] = Alert._jQueryInterface;
  312. $.fn[NAME].Constructor = Alert;
  313. $.fn[NAME].noConflict = function () {
  314. $.fn[NAME] = JQUERY_NO_CONFLICT;
  315. return Alert._jQueryInterface;
  316. };
  317. /**
  318. * ------------------------------------------------------------------------
  319. * Constants
  320. * ------------------------------------------------------------------------
  321. */
  322. var NAME$1 = 'button';
  323. var VERSION$1 = '4.5.2';
  324. var DATA_KEY$1 = 'bs.button';
  325. var EVENT_KEY$1 = "." + DATA_KEY$1;
  326. var DATA_API_KEY$1 = '.data-api';
  327. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  328. var CLASS_NAME_ACTIVE = 'active';
  329. var CLASS_NAME_BUTTON = 'btn';
  330. var CLASS_NAME_FOCUS = 'focus';
  331. var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]';
  332. var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]';
  333. var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
  334. var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn';
  335. var SELECTOR_INPUT = 'input:not([type="hidden"])';
  336. var SELECTOR_ACTIVE = '.active';
  337. var SELECTOR_BUTTON = '.btn';
  338. var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
  339. var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1);
  340. var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$1 + DATA_API_KEY$1;
  341. /**
  342. * ------------------------------------------------------------------------
  343. * Class Definition
  344. * ------------------------------------------------------------------------
  345. */
  346. var Button = /*#__PURE__*/function () {
  347. function Button(element) {
  348. this._element = element;
  349. } // Getters
  350. var _proto = Button.prototype;
  351. // Public
  352. _proto.toggle = function toggle() {
  353. var triggerChangeEvent = true;
  354. var addAriaPressed = true;
  355. var rootElement = $(this._element).closest(SELECTOR_DATA_TOGGLES)[0];
  356. if (rootElement) {
  357. var input = this._element.querySelector(SELECTOR_INPUT);
  358. if (input) {
  359. if (input.type === 'radio') {
  360. if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
  361. triggerChangeEvent = false;
  362. } else {
  363. var activeElement = rootElement.querySelector(SELECTOR_ACTIVE);
  364. if (activeElement) {
  365. $(activeElement).removeClass(CLASS_NAME_ACTIVE);
  366. }
  367. }
  368. }
  369. if (triggerChangeEvent) {
  370. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  371. if (input.type === 'checkbox' || input.type === 'radio') {
  372. input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE);
  373. }
  374. $(input).trigger('change');
  375. }
  376. input.focus();
  377. addAriaPressed = false;
  378. }
  379. }
  380. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  381. if (addAriaPressed) {
  382. this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE));
  383. }
  384. if (triggerChangeEvent) {
  385. $(this._element).toggleClass(CLASS_NAME_ACTIVE);
  386. }
  387. }
  388. };
  389. _proto.dispose = function dispose() {
  390. $.removeData(this._element, DATA_KEY$1);
  391. this._element = null;
  392. } // Static
  393. ;
  394. Button._jQueryInterface = function _jQueryInterface(config) {
  395. return this.each(function () {
  396. var data = $(this).data(DATA_KEY$1);
  397. if (!data) {
  398. data = new Button(this);
  399. $(this).data(DATA_KEY$1, data);
  400. }
  401. if (config === 'toggle') {
  402. data[config]();
  403. }
  404. });
  405. };
  406. _createClass(Button, null, [{
  407. key: "VERSION",
  408. get: function get() {
  409. return VERSION$1;
  410. }
  411. }]);
  412. return Button;
  413. }();
  414. /**
  415. * ------------------------------------------------------------------------
  416. * Data Api implementation
  417. * ------------------------------------------------------------------------
  418. */
  419. $(document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  420. var button = event.target;
  421. var initialButton = button;
  422. if (!$(button).hasClass(CLASS_NAME_BUTTON)) {
  423. button = $(button).closest(SELECTOR_BUTTON)[0];
  424. }
  425. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  426. event.preventDefault(); // work around Firefox bug #1540995
  427. } else {
  428. var inputBtn = button.querySelector(SELECTOR_INPUT);
  429. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  430. event.preventDefault(); // work around Firefox bug #1540995
  431. return;
  432. }
  433. if (initialButton.tagName !== 'LABEL' || inputBtn && inputBtn.type !== 'checkbox') {
  434. Button._jQueryInterface.call($(button), 'toggle');
  435. }
  436. }
  437. }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  438. var button = $(event.target).closest(SELECTOR_BUTTON)[0];
  439. $(button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type));
  440. });
  441. $(window).on(EVENT_LOAD_DATA_API, function () {
  442. // ensure correct active class is set to match the controls' actual values/states
  443. // find all checkboxes/readio buttons inside data-toggle groups
  444. var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS));
  445. for (var i = 0, len = buttons.length; i < len; i++) {
  446. var button = buttons[i];
  447. var input = button.querySelector(SELECTOR_INPUT);
  448. if (input.checked || input.hasAttribute('checked')) {
  449. button.classList.add(CLASS_NAME_ACTIVE);
  450. } else {
  451. button.classList.remove(CLASS_NAME_ACTIVE);
  452. }
  453. } // find all button toggles
  454. buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
  455. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  456. var _button = buttons[_i];
  457. if (_button.getAttribute('aria-pressed') === 'true') {
  458. _button.classList.add(CLASS_NAME_ACTIVE);
  459. } else {
  460. _button.classList.remove(CLASS_NAME_ACTIVE);
  461. }
  462. }
  463. });
  464. /**
  465. * ------------------------------------------------------------------------
  466. * jQuery
  467. * ------------------------------------------------------------------------
  468. */
  469. $.fn[NAME$1] = Button._jQueryInterface;
  470. $.fn[NAME$1].Constructor = Button;
  471. $.fn[NAME$1].noConflict = function () {
  472. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  473. return Button._jQueryInterface;
  474. };
  475. /**
  476. * ------------------------------------------------------------------------
  477. * Constants
  478. * ------------------------------------------------------------------------
  479. */
  480. var NAME$2 = 'carousel';
  481. var VERSION$2 = '4.5.2';
  482. var DATA_KEY$2 = 'bs.carousel';
  483. var EVENT_KEY$2 = "." + DATA_KEY$2;
  484. var DATA_API_KEY$2 = '.data-api';
  485. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  486. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  487. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  488. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  489. var SWIPE_THRESHOLD = 40;
  490. var Default = {
  491. interval: 5000,
  492. keyboard: true,
  493. slide: false,
  494. pause: 'hover',
  495. wrap: true,
  496. touch: true
  497. };
  498. var DefaultType = {
  499. interval: '(number|boolean)',
  500. keyboard: 'boolean',
  501. slide: '(boolean|string)',
  502. pause: '(string|boolean)',
  503. wrap: 'boolean',
  504. touch: 'boolean'
  505. };
  506. var DIRECTION_NEXT = 'next';
  507. var DIRECTION_PREV = 'prev';
  508. var DIRECTION_LEFT = 'left';
  509. var DIRECTION_RIGHT = 'right';
  510. var EVENT_SLIDE = "slide" + EVENT_KEY$2;
  511. var EVENT_SLID = "slid" + EVENT_KEY$2;
  512. var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
  513. var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
  514. var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
  515. var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
  516. var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
  517. var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
  518. var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
  519. var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
  520. var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
  521. var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
  522. var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
  523. var CLASS_NAME_CAROUSEL = 'carousel';
  524. var CLASS_NAME_ACTIVE$1 = 'active';
  525. var CLASS_NAME_SLIDE = 'slide';
  526. var CLASS_NAME_RIGHT = 'carousel-item-right';
  527. var CLASS_NAME_LEFT = 'carousel-item-left';
  528. var CLASS_NAME_NEXT = 'carousel-item-next';
  529. var CLASS_NAME_PREV = 'carousel-item-prev';
  530. var CLASS_NAME_POINTER_EVENT = 'pointer-event';
  531. var SELECTOR_ACTIVE$1 = '.active';
  532. var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
  533. var SELECTOR_ITEM = '.carousel-item';
  534. var SELECTOR_ITEM_IMG = '.carousel-item img';
  535. var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
  536. var SELECTOR_INDICATORS = '.carousel-indicators';
  537. var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
  538. var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
  539. var PointerType = {
  540. TOUCH: 'touch',
  541. PEN: 'pen'
  542. };
  543. /**
  544. * ------------------------------------------------------------------------
  545. * Class Definition
  546. * ------------------------------------------------------------------------
  547. */
  548. var Carousel = /*#__PURE__*/function () {
  549. function Carousel(element, config) {
  550. this._items = null;
  551. this._interval = null;
  552. this._activeElement = null;
  553. this._isPaused = false;
  554. this._isSliding = false;
  555. this.touchTimeout = null;
  556. this.touchStartX = 0;
  557. this.touchDeltaX = 0;
  558. this._config = this._getConfig(config);
  559. this._element = element;
  560. this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
  561. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  562. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  563. this._addEventListeners();
  564. } // Getters
  565. var _proto = Carousel.prototype;
  566. // Public
  567. _proto.next = function next() {
  568. if (!this._isSliding) {
  569. this._slide(DIRECTION_NEXT);
  570. }
  571. };
  572. _proto.nextWhenVisible = function nextWhenVisible() {
  573. // Don't call next when the page isn't visible
  574. // or the carousel or its parent isn't visible
  575. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  576. this.next();
  577. }
  578. };
  579. _proto.prev = function prev() {
  580. if (!this._isSliding) {
  581. this._slide(DIRECTION_PREV);
  582. }
  583. };
  584. _proto.pause = function pause(event) {
  585. if (!event) {
  586. this._isPaused = true;
  587. }
  588. if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
  589. Util.triggerTransitionEnd(this._element);
  590. this.cycle(true);
  591. }
  592. clearInterval(this._interval);
  593. this._interval = null;
  594. };
  595. _proto.cycle = function cycle(event) {
  596. if (!event) {
  597. this._isPaused = false;
  598. }
  599. if (this._interval) {
  600. clearInterval(this._interval);
  601. this._interval = null;
  602. }
  603. if (this._config.interval && !this._isPaused) {
  604. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  605. }
  606. };
  607. _proto.to = function to(index) {
  608. var _this = this;
  609. this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
  610. var activeIndex = this._getItemIndex(this._activeElement);
  611. if (index > this._items.length - 1 || index < 0) {
  612. return;
  613. }
  614. if (this._isSliding) {
  615. $(this._element).one(EVENT_SLID, function () {
  616. return _this.to(index);
  617. });
  618. return;
  619. }
  620. if (activeIndex === index) {
  621. this.pause();
  622. this.cycle();
  623. return;
  624. }
  625. var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
  626. this._slide(direction, this._items[index]);
  627. };
  628. _proto.dispose = function dispose() {
  629. $(this._element).off(EVENT_KEY$2);
  630. $.removeData(this._element, DATA_KEY$2);
  631. this._items = null;
  632. this._config = null;
  633. this._element = null;
  634. this._interval = null;
  635. this._isPaused = null;
  636. this._isSliding = null;
  637. this._activeElement = null;
  638. this._indicatorsElement = null;
  639. } // Private
  640. ;
  641. _proto._getConfig = function _getConfig(config) {
  642. config = _extends({}, Default, config);
  643. Util.typeCheckConfig(NAME$2, config, DefaultType);
  644. return config;
  645. };
  646. _proto._handleSwipe = function _handleSwipe() {
  647. var absDeltax = Math.abs(this.touchDeltaX);
  648. if (absDeltax <= SWIPE_THRESHOLD) {
  649. return;
  650. }
  651. var direction = absDeltax / this.touchDeltaX;
  652. this.touchDeltaX = 0; // swipe left
  653. if (direction > 0) {
  654. this.prev();
  655. } // swipe right
  656. if (direction < 0) {
  657. this.next();
  658. }
  659. };
  660. _proto._addEventListeners = function _addEventListeners() {
  661. var _this2 = this;
  662. if (this._config.keyboard) {
  663. $(this._element).on(EVENT_KEYDOWN, function (event) {
  664. return _this2._keydown(event);
  665. });
  666. }
  667. if (this._config.pause === 'hover') {
  668. $(this._element).on(EVENT_MOUSEENTER, function (event) {
  669. return _this2.pause(event);
  670. }).on(EVENT_MOUSELEAVE, function (event) {
  671. return _this2.cycle(event);
  672. });
  673. }
  674. if (this._config.touch) {
  675. this._addTouchEventListeners();
  676. }
  677. };
  678. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  679. var _this3 = this;
  680. if (!this._touchSupported) {
  681. return;
  682. }
  683. var start = function start(event) {
  684. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  685. _this3.touchStartX = event.originalEvent.clientX;
  686. } else if (!_this3._pointerEvent) {
  687. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  688. }
  689. };
  690. var move = function move(event) {
  691. // ensure swiping with one touch and not pinching
  692. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  693. _this3.touchDeltaX = 0;
  694. } else {
  695. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  696. }
  697. };
  698. var end = function end(event) {
  699. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  700. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  701. }
  702. _this3._handleSwipe();
  703. if (_this3._config.pause === 'hover') {
  704. // If it's a touch-enabled device, mouseenter/leave are fired as
  705. // part of the mouse compatibility events on first tap - the carousel
  706. // would stop cycling until user tapped out of it;
  707. // here, we listen for touchend, explicitly pause the carousel
  708. // (as if it's the second time we tap on it, mouseenter compat event
  709. // is NOT fired) and after a timeout (to allow for mouse compatibility
  710. // events to fire) we explicitly restart cycling
  711. _this3.pause();
  712. if (_this3.touchTimeout) {
  713. clearTimeout(_this3.touchTimeout);
  714. }
  715. _this3.touchTimeout = setTimeout(function (event) {
  716. return _this3.cycle(event);
  717. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  718. }
  719. };
  720. $(this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) {
  721. return e.preventDefault();
  722. });
  723. if (this._pointerEvent) {
  724. $(this._element).on(EVENT_POINTERDOWN, function (event) {
  725. return start(event);
  726. });
  727. $(this._element).on(EVENT_POINTERUP, function (event) {
  728. return end(event);
  729. });
  730. this._element.classList.add(CLASS_NAME_POINTER_EVENT);
  731. } else {
  732. $(this._element).on(EVENT_TOUCHSTART, function (event) {
  733. return start(event);
  734. });
  735. $(this._element).on(EVENT_TOUCHMOVE, function (event) {
  736. return move(event);
  737. });
  738. $(this._element).on(EVENT_TOUCHEND, function (event) {
  739. return end(event);
  740. });
  741. }
  742. };
  743. _proto._keydown = function _keydown(event) {
  744. if (/input|textarea/i.test(event.target.tagName)) {
  745. return;
  746. }
  747. switch (event.which) {
  748. case ARROW_LEFT_KEYCODE:
  749. event.preventDefault();
  750. this.prev();
  751. break;
  752. case ARROW_RIGHT_KEYCODE:
  753. event.preventDefault();
  754. this.next();
  755. break;
  756. }
  757. };
  758. _proto._getItemIndex = function _getItemIndex(element) {
  759. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
  760. return this._items.indexOf(element);
  761. };
  762. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  763. var isNextDirection = direction === DIRECTION_NEXT;
  764. var isPrevDirection = direction === DIRECTION_PREV;
  765. var activeIndex = this._getItemIndex(activeElement);
  766. var lastItemIndex = this._items.length - 1;
  767. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  768. if (isGoingToWrap && !this._config.wrap) {
  769. return activeElement;
  770. }
  771. var delta = direction === DIRECTION_PREV ? -1 : 1;
  772. var itemIndex = (activeIndex + delta) % this._items.length;
  773. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  774. };
  775. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  776. var targetIndex = this._getItemIndex(relatedTarget);
  777. var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
  778. var slideEvent = $.Event(EVENT_SLIDE, {
  779. relatedTarget: relatedTarget,
  780. direction: eventDirectionName,
  781. from: fromIndex,
  782. to: targetIndex
  783. });
  784. $(this._element).trigger(slideEvent);
  785. return slideEvent;
  786. };
  787. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  788. if (this._indicatorsElement) {
  789. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1));
  790. $(indicators).removeClass(CLASS_NAME_ACTIVE$1);
  791. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  792. if (nextIndicator) {
  793. $(nextIndicator).addClass(CLASS_NAME_ACTIVE$1);
  794. }
  795. }
  796. };
  797. _proto._slide = function _slide(direction, element) {
  798. var _this4 = this;
  799. var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
  800. var activeElementIndex = this._getItemIndex(activeElement);
  801. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  802. var nextElementIndex = this._getItemIndex(nextElement);
  803. var isCycling = Boolean(this._interval);
  804. var directionalClassName;
  805. var orderClassName;
  806. var eventDirectionName;
  807. if (direction === DIRECTION_NEXT) {
  808. directionalClassName = CLASS_NAME_LEFT;
  809. orderClassName = CLASS_NAME_NEXT;
  810. eventDirectionName = DIRECTION_LEFT;
  811. } else {
  812. directionalClassName = CLASS_NAME_RIGHT;
  813. orderClassName = CLASS_NAME_PREV;
  814. eventDirectionName = DIRECTION_RIGHT;
  815. }
  816. if (nextElement && $(nextElement).hasClass(CLASS_NAME_ACTIVE$1)) {
  817. this._isSliding = false;
  818. return;
  819. }
  820. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  821. if (slideEvent.isDefaultPrevented()) {
  822. return;
  823. }
  824. if (!activeElement || !nextElement) {
  825. // Some weirdness is happening, so we bail
  826. return;
  827. }
  828. this._isSliding = true;
  829. if (isCycling) {
  830. this.pause();
  831. }
  832. this._setActiveIndicatorElement(nextElement);
  833. var slidEvent = $.Event(EVENT_SLID, {
  834. relatedTarget: nextElement,
  835. direction: eventDirectionName,
  836. from: activeElementIndex,
  837. to: nextElementIndex
  838. });
  839. if ($(this._element).hasClass(CLASS_NAME_SLIDE)) {
  840. $(nextElement).addClass(orderClassName);
  841. Util.reflow(nextElement);
  842. $(activeElement).addClass(directionalClassName);
  843. $(nextElement).addClass(directionalClassName);
  844. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  845. if (nextElementInterval) {
  846. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  847. this._config.interval = nextElementInterval;
  848. } else {
  849. this._config.interval = this._config.defaultInterval || this._config.interval;
  850. }
  851. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  852. $(activeElement).one(Util.TRANSITION_END, function () {
  853. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$1);
  854. $(activeElement).removeClass(CLASS_NAME_ACTIVE$1 + " " + orderClassName + " " + directionalClassName);
  855. _this4._isSliding = false;
  856. setTimeout(function () {
  857. return $(_this4._element).trigger(slidEvent);
  858. }, 0);
  859. }).emulateTransitionEnd(transitionDuration);
  860. } else {
  861. $(activeElement).removeClass(CLASS_NAME_ACTIVE$1);
  862. $(nextElement).addClass(CLASS_NAME_ACTIVE$1);
  863. this._isSliding = false;
  864. $(this._element).trigger(slidEvent);
  865. }
  866. if (isCycling) {
  867. this.cycle();
  868. }
  869. } // Static
  870. ;
  871. Carousel._jQueryInterface = function _jQueryInterface(config) {
  872. return this.each(function () {
  873. var data = $(this).data(DATA_KEY$2);
  874. var _config = _extends({}, Default, $(this).data());
  875. if (typeof config === 'object') {
  876. _config = _extends({}, _config, config);
  877. }
  878. var action = typeof config === 'string' ? config : _config.slide;
  879. if (!data) {
  880. data = new Carousel(this, _config);
  881. $(this).data(DATA_KEY$2, data);
  882. }
  883. if (typeof config === 'number') {
  884. data.to(config);
  885. } else if (typeof action === 'string') {
  886. if (typeof data[action] === 'undefined') {
  887. throw new TypeError("No method named \"" + action + "\"");
  888. }
  889. data[action]();
  890. } else if (_config.interval && _config.ride) {
  891. data.pause();
  892. data.cycle();
  893. }
  894. });
  895. };
  896. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  897. var selector = Util.getSelectorFromElement(this);
  898. if (!selector) {
  899. return;
  900. }
  901. var target = $(selector)[0];
  902. if (!target || !$(target).hasClass(CLASS_NAME_CAROUSEL)) {
  903. return;
  904. }
  905. var config = _extends({}, $(target).data(), $(this).data());
  906. var slideIndex = this.getAttribute('data-slide-to');
  907. if (slideIndex) {
  908. config.interval = false;
  909. }
  910. Carousel._jQueryInterface.call($(target), config);
  911. if (slideIndex) {
  912. $(target).data(DATA_KEY$2).to(slideIndex);
  913. }
  914. event.preventDefault();
  915. };
  916. _createClass(Carousel, null, [{
  917. key: "VERSION",
  918. get: function get() {
  919. return VERSION$2;
  920. }
  921. }, {
  922. key: "Default",
  923. get: function get() {
  924. return Default;
  925. }
  926. }]);
  927. return Carousel;
  928. }();
  929. /**
  930. * ------------------------------------------------------------------------
  931. * Data Api implementation
  932. * ------------------------------------------------------------------------
  933. */
  934. $(document).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler);
  935. $(window).on(EVENT_LOAD_DATA_API$1, function () {
  936. var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE));
  937. for (var i = 0, len = carousels.length; i < len; i++) {
  938. var $carousel = $(carousels[i]);
  939. Carousel._jQueryInterface.call($carousel, $carousel.data());
  940. }
  941. });
  942. /**
  943. * ------------------------------------------------------------------------
  944. * jQuery
  945. * ------------------------------------------------------------------------
  946. */
  947. $.fn[NAME$2] = Carousel._jQueryInterface;
  948. $.fn[NAME$2].Constructor = Carousel;
  949. $.fn[NAME$2].noConflict = function () {
  950. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  951. return Carousel._jQueryInterface;
  952. };
  953. /**
  954. * ------------------------------------------------------------------------
  955. * Constants
  956. * ------------------------------------------------------------------------
  957. */
  958. var NAME$3 = 'collapse';
  959. var VERSION$3 = '4.5.2';
  960. var DATA_KEY$3 = 'bs.collapse';
  961. var EVENT_KEY$3 = "." + DATA_KEY$3;
  962. var DATA_API_KEY$3 = '.data-api';
  963. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  964. var Default$1 = {
  965. toggle: true,
  966. parent: ''
  967. };
  968. var DefaultType$1 = {
  969. toggle: 'boolean',
  970. parent: '(string|element)'
  971. };
  972. var EVENT_SHOW = "show" + EVENT_KEY$3;
  973. var EVENT_SHOWN = "shown" + EVENT_KEY$3;
  974. var EVENT_HIDE = "hide" + EVENT_KEY$3;
  975. var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
  976. var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
  977. var CLASS_NAME_SHOW$1 = 'show';
  978. var CLASS_NAME_COLLAPSE = 'collapse';
  979. var CLASS_NAME_COLLAPSING = 'collapsing';
  980. var CLASS_NAME_COLLAPSED = 'collapsed';
  981. var DIMENSION_WIDTH = 'width';
  982. var DIMENSION_HEIGHT = 'height';
  983. var SELECTOR_ACTIVES = '.show, .collapsing';
  984. var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]';
  985. /**
  986. * ------------------------------------------------------------------------
  987. * Class Definition
  988. * ------------------------------------------------------------------------
  989. */
  990. var Collapse = /*#__PURE__*/function () {
  991. function Collapse(element, config) {
  992. this._isTransitioning = false;
  993. this._element = element;
  994. this._config = this._getConfig(config);
  995. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  996. var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$1));
  997. for (var i = 0, len = toggleList.length; i < len; i++) {
  998. var elem = toggleList[i];
  999. var selector = Util.getSelectorFromElement(elem);
  1000. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  1001. return foundElem === element;
  1002. });
  1003. if (selector !== null && filterElement.length > 0) {
  1004. this._selector = selector;
  1005. this._triggerArray.push(elem);
  1006. }
  1007. }
  1008. this._parent = this._config.parent ? this._getParent() : null;
  1009. if (!this._config.parent) {
  1010. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  1011. }
  1012. if (this._config.toggle) {
  1013. this.toggle();
  1014. }
  1015. } // Getters
  1016. var _proto = Collapse.prototype;
  1017. // Public
  1018. _proto.toggle = function toggle() {
  1019. if ($(this._element).hasClass(CLASS_NAME_SHOW$1)) {
  1020. this.hide();
  1021. } else {
  1022. this.show();
  1023. }
  1024. };
  1025. _proto.show = function show() {
  1026. var _this = this;
  1027. if (this._isTransitioning || $(this._element).hasClass(CLASS_NAME_SHOW$1)) {
  1028. return;
  1029. }
  1030. var actives;
  1031. var activesData;
  1032. if (this._parent) {
  1033. actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) {
  1034. if (typeof _this._config.parent === 'string') {
  1035. return elem.getAttribute('data-parent') === _this._config.parent;
  1036. }
  1037. return elem.classList.contains(CLASS_NAME_COLLAPSE);
  1038. });
  1039. if (actives.length === 0) {
  1040. actives = null;
  1041. }
  1042. }
  1043. if (actives) {
  1044. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  1045. if (activesData && activesData._isTransitioning) {
  1046. return;
  1047. }
  1048. }
  1049. var startEvent = $.Event(EVENT_SHOW);
  1050. $(this._element).trigger(startEvent);
  1051. if (startEvent.isDefaultPrevented()) {
  1052. return;
  1053. }
  1054. if (actives) {
  1055. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  1056. if (!activesData) {
  1057. $(actives).data(DATA_KEY$3, null);
  1058. }
  1059. }
  1060. var dimension = this._getDimension();
  1061. $(this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING);
  1062. this._element.style[dimension] = 0;
  1063. if (this._triggerArray.length) {
  1064. $(this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true);
  1065. }
  1066. this.setTransitioning(true);
  1067. var complete = function complete() {
  1068. $(_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
  1069. _this._element.style[dimension] = '';
  1070. _this.setTransitioning(false);
  1071. $(_this._element).trigger(EVENT_SHOWN);
  1072. };
  1073. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  1074. var scrollSize = "scroll" + capitalizedDimension;
  1075. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  1076. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  1077. this._element.style[dimension] = this._element[scrollSize] + "px";
  1078. };
  1079. _proto.hide = function hide() {
  1080. var _this2 = this;
  1081. if (this._isTransitioning || !$(this._element).hasClass(CLASS_NAME_SHOW$1)) {
  1082. return;
  1083. }
  1084. var startEvent = $.Event(EVENT_HIDE);
  1085. $(this._element).trigger(startEvent);
  1086. if (startEvent.isDefaultPrevented()) {
  1087. return;
  1088. }
  1089. var dimension = this._getDimension();
  1090. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  1091. Util.reflow(this._element);
  1092. $(this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
  1093. var triggerArrayLength = this._triggerArray.length;
  1094. if (triggerArrayLength > 0) {
  1095. for (var i = 0; i < triggerArrayLength; i++) {
  1096. var trigger = this._triggerArray[i];
  1097. var selector = Util.getSelectorFromElement(trigger);
  1098. if (selector !== null) {
  1099. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  1100. if (!$elem.hasClass(CLASS_NAME_SHOW$1)) {
  1101. $(trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false);
  1102. }
  1103. }
  1104. }
  1105. }
  1106. this.setTransitioning(true);
  1107. var complete = function complete() {
  1108. _this2.setTransitioning(false);
  1109. $(_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN);
  1110. };
  1111. this._element.style[dimension] = '';
  1112. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  1113. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  1114. };
  1115. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  1116. this._isTransitioning = isTransitioning;
  1117. };
  1118. _proto.dispose = function dispose() {
  1119. $.removeData(this._element, DATA_KEY$3);
  1120. this._config = null;
  1121. this._parent = null;
  1122. this._element = null;
  1123. this._triggerArray = null;
  1124. this._isTransitioning = null;
  1125. } // Private
  1126. ;
  1127. _proto._getConfig = function _getConfig(config) {
  1128. config = _extends({}, Default$1, config);
  1129. config.toggle = Boolean(config.toggle); // Coerce string values
  1130. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  1131. return config;
  1132. };
  1133. _proto._getDimension = function _getDimension() {
  1134. var hasWidth = $(this._element).hasClass(DIMENSION_WIDTH);
  1135. return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT;
  1136. };
  1137. _proto._getParent = function _getParent() {
  1138. var _this3 = this;
  1139. var parent;
  1140. if (Util.isElement(this._config.parent)) {
  1141. parent = this._config.parent; // It's a jQuery object
  1142. if (typeof this._config.parent.jquery !== 'undefined') {
  1143. parent = this._config.parent[0];
  1144. }
  1145. } else {
  1146. parent = document.querySelector(this._config.parent);
  1147. }
  1148. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  1149. var children = [].slice.call(parent.querySelectorAll(selector));
  1150. $(children).each(function (i, element) {
  1151. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  1152. });
  1153. return parent;
  1154. };
  1155. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  1156. var isOpen = $(element).hasClass(CLASS_NAME_SHOW$1);
  1157. if (triggerArray.length) {
  1158. $(triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  1159. }
  1160. } // Static
  1161. ;
  1162. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  1163. var selector = Util.getSelectorFromElement(element);
  1164. return selector ? document.querySelector(selector) : null;
  1165. };
  1166. Collapse._jQueryInterface = function _jQueryInterface(config) {
  1167. return this.each(function () {
  1168. var $this = $(this);
  1169. var data = $this.data(DATA_KEY$3);
  1170. var _config = _extends({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {});
  1171. if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
  1172. _config.toggle = false;
  1173. }
  1174. if (!data) {
  1175. data = new Collapse(this, _config);
  1176. $this.data(DATA_KEY$3, data);
  1177. }
  1178. if (typeof config === 'string') {
  1179. if (typeof data[config] === 'undefined') {
  1180. throw new TypeError("No method named \"" + config + "\"");
  1181. }
  1182. data[config]();
  1183. }
  1184. });
  1185. };
  1186. _createClass(Collapse, null, [{
  1187. key: "VERSION",
  1188. get: function get() {
  1189. return VERSION$3;
  1190. }
  1191. }, {
  1192. key: "Default",
  1193. get: function get() {
  1194. return Default$1;
  1195. }
  1196. }]);
  1197. return Collapse;
  1198. }();
  1199. /**
  1200. * ------------------------------------------------------------------------
  1201. * Data Api implementation
  1202. * ------------------------------------------------------------------------
  1203. */
  1204. $(document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
  1205. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  1206. if (event.currentTarget.tagName === 'A') {
  1207. event.preventDefault();
  1208. }
  1209. var $trigger = $(this);
  1210. var selector = Util.getSelectorFromElement(this);
  1211. var selectors = [].slice.call(document.querySelectorAll(selector));
  1212. $(selectors).each(function () {
  1213. var $target = $(this);
  1214. var data = $target.data(DATA_KEY$3);
  1215. var config = data ? 'toggle' : $trigger.data();
  1216. Collapse._jQueryInterface.call($target, config);
  1217. });
  1218. });
  1219. /**
  1220. * ------------------------------------------------------------------------
  1221. * jQuery
  1222. * ------------------------------------------------------------------------
  1223. */
  1224. $.fn[NAME$3] = Collapse._jQueryInterface;
  1225. $.fn[NAME$3].Constructor = Collapse;
  1226. $.fn[NAME$3].noConflict = function () {
  1227. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  1228. return Collapse._jQueryInterface;
  1229. };
  1230. /**
  1231. * ------------------------------------------------------------------------
  1232. * Constants
  1233. * ------------------------------------------------------------------------
  1234. */
  1235. var NAME$4 = 'dropdown';
  1236. var VERSION$4 = '4.5.2';
  1237. var DATA_KEY$4 = 'bs.dropdown';
  1238. var EVENT_KEY$4 = "." + DATA_KEY$4;
  1239. var DATA_API_KEY$4 = '.data-api';
  1240. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  1241. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  1242. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  1243. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  1244. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  1245. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  1246. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  1247. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  1248. var EVENT_HIDE$1 = "hide" + EVENT_KEY$4;
  1249. var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4;
  1250. var EVENT_SHOW$1 = "show" + EVENT_KEY$4;
  1251. var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4;
  1252. var EVENT_CLICK = "click" + EVENT_KEY$4;
  1253. var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4;
  1254. var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4;
  1255. var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4;
  1256. var CLASS_NAME_DISABLED = 'disabled';
  1257. var CLASS_NAME_SHOW$2 = 'show';
  1258. var CLASS_NAME_DROPUP = 'dropup';
  1259. var CLASS_NAME_DROPRIGHT = 'dropright';
  1260. var CLASS_NAME_DROPLEFT = 'dropleft';
  1261. var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
  1262. var CLASS_NAME_POSITION_STATIC = 'position-static';
  1263. var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]';
  1264. var SELECTOR_FORM_CHILD = '.dropdown form';
  1265. var SELECTOR_MENU = '.dropdown-menu';
  1266. var SELECTOR_NAVBAR_NAV = '.navbar-nav';
  1267. var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  1268. var PLACEMENT_TOP = 'top-start';
  1269. var PLACEMENT_TOPEND = 'top-end';
  1270. var PLACEMENT_BOTTOM = 'bottom-start';
  1271. var PLACEMENT_BOTTOMEND = 'bottom-end';
  1272. var PLACEMENT_RIGHT = 'right-start';
  1273. var PLACEMENT_LEFT = 'left-start';
  1274. var Default$2 = {
  1275. offset: 0,
  1276. flip: true,
  1277. boundary: 'scrollParent',
  1278. reference: 'toggle',
  1279. display: 'dynamic',
  1280. popperConfig: null
  1281. };
  1282. var DefaultType$2 = {
  1283. offset: '(number|string|function)',
  1284. flip: 'boolean',
  1285. boundary: '(string|element)',
  1286. reference: '(string|element)',
  1287. display: 'string',
  1288. popperConfig: '(null|object)'
  1289. };
  1290. /**
  1291. * ------------------------------------------------------------------------
  1292. * Class Definition
  1293. * ------------------------------------------------------------------------
  1294. */
  1295. var Dropdown = /*#__PURE__*/function () {
  1296. function Dropdown(element, config) {
  1297. this._element = element;
  1298. this._popper = null;
  1299. this._config = this._getConfig(config);
  1300. this._menu = this._getMenuElement();
  1301. this._inNavbar = this._detectNavbar();
  1302. this._addEventListeners();
  1303. } // Getters
  1304. var _proto = Dropdown.prototype;
  1305. // Public
  1306. _proto.toggle = function toggle() {
  1307. if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED)) {
  1308. return;
  1309. }
  1310. var isActive = $(this._menu).hasClass(CLASS_NAME_SHOW$2);
  1311. Dropdown._clearMenus();
  1312. if (isActive) {
  1313. return;
  1314. }
  1315. this.show(true);
  1316. };
  1317. _proto.show = function show(usePopper) {
  1318. if (usePopper === void 0) {
  1319. usePopper = false;
  1320. }
  1321. if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || $(this._menu).hasClass(CLASS_NAME_SHOW$2)) {
  1322. return;
  1323. }
  1324. var relatedTarget = {
  1325. relatedTarget: this._element
  1326. };
  1327. var showEvent = $.Event(EVENT_SHOW$1, relatedTarget);
  1328. var parent = Dropdown._getParentFromElement(this._element);
  1329. $(parent).trigger(showEvent);
  1330. if (showEvent.isDefaultPrevented()) {
  1331. return;
  1332. } // Disable totally Popper.js for Dropdown in Navbar
  1333. if (!this._inNavbar && usePopper) {
  1334. /**
  1335. * Check for Popper dependency
  1336. * Popper - https://popper.js.org
  1337. */
  1338. if (typeof Popper === 'undefined') {
  1339. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  1340. }
  1341. var referenceElement = this._element;
  1342. if (this._config.reference === 'parent') {
  1343. referenceElement = parent;
  1344. } else if (Util.isElement(this._config.reference)) {
  1345. referenceElement = this._config.reference; // Check if it's jQuery element
  1346. if (typeof this._config.reference.jquery !== 'undefined') {
  1347. referenceElement = this._config.reference[0];
  1348. }
  1349. } // If boundary is not `scrollParent`, then set position to `static`
  1350. // to allow the menu to "escape" the scroll parent's boundaries
  1351. // https://github.com/twbs/bootstrap/issues/24251
  1352. if (this._config.boundary !== 'scrollParent') {
  1353. $(parent).addClass(CLASS_NAME_POSITION_STATIC);
  1354. }
  1355. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  1356. } // If this is a touch-enabled device we add extra
  1357. // empty mouseover listeners to the body's immediate children;
  1358. // only needed because of broken event delegation on iOS
  1359. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  1360. if ('ontouchstart' in document.documentElement && $(parent).closest(SELECTOR_NAVBAR_NAV).length === 0) {
  1361. $(document.body).children().on('mouseover', null, $.noop);
  1362. }
  1363. this._element.focus();
  1364. this._element.setAttribute('aria-expanded', true);
  1365. $(this._menu).toggleClass(CLASS_NAME_SHOW$2);
  1366. $(parent).toggleClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_SHOWN$1, relatedTarget));
  1367. };
  1368. _proto.hide = function hide() {
  1369. if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || !$(this._menu).hasClass(CLASS_NAME_SHOW$2)) {
  1370. return;
  1371. }
  1372. var relatedTarget = {
  1373. relatedTarget: this._element
  1374. };
  1375. var hideEvent = $.Event(EVENT_HIDE$1, relatedTarget);
  1376. var parent = Dropdown._getParentFromElement(this._element);
  1377. $(parent).trigger(hideEvent);
  1378. if (hideEvent.isDefaultPrevented()) {
  1379. return;
  1380. }
  1381. if (this._popper) {
  1382. this._popper.destroy();
  1383. }
  1384. $(this._menu).toggleClass(CLASS_NAME_SHOW$2);
  1385. $(parent).toggleClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_HIDDEN$1, relatedTarget));
  1386. };
  1387. _proto.dispose = function dispose() {
  1388. $.removeData(this._element, DATA_KEY$4);
  1389. $(this._element).off(EVENT_KEY$4);
  1390. this._element = null;
  1391. this._menu = null;
  1392. if (this._popper !== null) {
  1393. this._popper.destroy();
  1394. this._popper = null;
  1395. }
  1396. };
  1397. _proto.update = function update() {
  1398. this._inNavbar = this._detectNavbar();
  1399. if (this._popper !== null) {
  1400. this._popper.scheduleUpdate();
  1401. }
  1402. } // Private
  1403. ;
  1404. _proto._addEventListeners = function _addEventListeners() {
  1405. var _this = this;
  1406. $(this._element).on(EVENT_CLICK, function (event) {
  1407. event.preventDefault();
  1408. event.stopPropagation();
  1409. _this.toggle();
  1410. });
  1411. };
  1412. _proto._getConfig = function _getConfig(config) {
  1413. config = _extends({}, this.constructor.Default, $(this._element).data(), config);
  1414. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  1415. return config;
  1416. };
  1417. _proto._getMenuElement = function _getMenuElement() {
  1418. if (!this._menu) {
  1419. var parent = Dropdown._getParentFromElement(this._element);
  1420. if (parent) {
  1421. this._menu = parent.querySelector(SELECTOR_MENU);
  1422. }
  1423. }
  1424. return this._menu;
  1425. };
  1426. _proto._getPlacement = function _getPlacement() {
  1427. var $parentDropdown = $(this._element.parentNode);
  1428. var placement = PLACEMENT_BOTTOM; // Handle dropup
  1429. if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
  1430. placement = $(this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
  1431. } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
  1432. placement = PLACEMENT_RIGHT;
  1433. } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
  1434. placement = PLACEMENT_LEFT;
  1435. } else if ($(this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
  1436. placement = PLACEMENT_BOTTOMEND;
  1437. }
  1438. return placement;
  1439. };
  1440. _proto._detectNavbar = function _detectNavbar() {
  1441. return $(this._element).closest('.navbar').length > 0;
  1442. };
  1443. _proto._getOffset = function _getOffset() {
  1444. var _this2 = this;
  1445. var offset = {};
  1446. if (typeof this._config.offset === 'function') {
  1447. offset.fn = function (data) {
  1448. data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
  1449. return data;
  1450. };
  1451. } else {
  1452. offset.offset = this._config.offset;
  1453. }
  1454. return offset;
  1455. };
  1456. _proto._getPopperConfig = function _getPopperConfig() {
  1457. var popperConfig = {
  1458. placement: this._getPlacement(),
  1459. modifiers: {
  1460. offset: this._getOffset(),
  1461. flip: {
  1462. enabled: this._config.flip
  1463. },
  1464. preventOverflow: {
  1465. boundariesElement: this._config.boundary
  1466. }
  1467. }
  1468. }; // Disable Popper.js if we have a static display
  1469. if (this._config.display === 'static') {
  1470. popperConfig.modifiers.applyStyle = {
  1471. enabled: false
  1472. };
  1473. }
  1474. return _extends({}, popperConfig, this._config.popperConfig);
  1475. } // Static
  1476. ;
  1477. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  1478. return this.each(function () {
  1479. var data = $(this).data(DATA_KEY$4);
  1480. var _config = typeof config === 'object' ? config : null;
  1481. if (!data) {
  1482. data = new Dropdown(this, _config);
  1483. $(this).data(DATA_KEY$4, data);
  1484. }
  1485. if (typeof config === 'string') {
  1486. if (typeof data[config] === 'undefined') {
  1487. throw new TypeError("No method named \"" + config + "\"");
  1488. }
  1489. data[config]();
  1490. }
  1491. });
  1492. };
  1493. Dropdown._clearMenus = function _clearMenus(event) {
  1494. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  1495. return;
  1496. }
  1497. var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2));
  1498. for (var i = 0, len = toggles.length; i < len; i++) {
  1499. var parent = Dropdown._getParentFromElement(toggles[i]);
  1500. var context = $(toggles[i]).data(DATA_KEY$4);
  1501. var relatedTarget = {
  1502. relatedTarget: toggles[i]
  1503. };
  1504. if (event && event.type === 'click') {
  1505. relatedTarget.clickEvent = event;
  1506. }
  1507. if (!context) {
  1508. continue;
  1509. }
  1510. var dropdownMenu = context._menu;
  1511. if (!$(parent).hasClass(CLASS_NAME_SHOW$2)) {
  1512. continue;
  1513. }
  1514. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  1515. continue;
  1516. }
  1517. var hideEvent = $.Event(EVENT_HIDE$1, relatedTarget);
  1518. $(parent).trigger(hideEvent);
  1519. if (hideEvent.isDefaultPrevented()) {
  1520. continue;
  1521. } // If this is a touch-enabled device we remove the extra
  1522. // empty mouseover listeners we added for iOS support
  1523. if ('ontouchstart' in document.documentElement) {
  1524. $(document.body).children().off('mouseover', null, $.noop);
  1525. }
  1526. toggles[i].setAttribute('aria-expanded', 'false');
  1527. if (context._popper) {
  1528. context._popper.destroy();
  1529. }
  1530. $(dropdownMenu).removeClass(CLASS_NAME_SHOW$2);
  1531. $(parent).removeClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_HIDDEN$1, relatedTarget));
  1532. }
  1533. };
  1534. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  1535. var parent;
  1536. var selector = Util.getSelectorFromElement(element);
  1537. if (selector) {
  1538. parent = document.querySelector(selector);
  1539. }
  1540. return parent || element.parentNode;
  1541. } // eslint-disable-next-line complexity
  1542. ;
  1543. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  1544. // If not input/textarea:
  1545. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  1546. // If input/textarea:
  1547. // - If space key => not a dropdown command
  1548. // - If key is other than escape
  1549. // - If key is not up or down => not a dropdown command
  1550. // - If trigger inside the menu => not a dropdown command
  1551. if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  1552. return;
  1553. }
  1554. if (this.disabled || $(this).hasClass(CLASS_NAME_DISABLED)) {
  1555. return;
  1556. }
  1557. var parent = Dropdown._getParentFromElement(this);
  1558. var isActive = $(parent).hasClass(CLASS_NAME_SHOW$2);
  1559. if (!isActive && event.which === ESCAPE_KEYCODE) {
  1560. return;
  1561. }
  1562. event.preventDefault();
  1563. event.stopPropagation();
  1564. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  1565. if (event.which === ESCAPE_KEYCODE) {
  1566. $(parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus');
  1567. }
  1568. $(this).trigger('click');
  1569. return;
  1570. }
  1571. var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) {
  1572. return $(item).is(':visible');
  1573. });
  1574. if (items.length === 0) {
  1575. return;
  1576. }
  1577. var index = items.indexOf(event.target);
  1578. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  1579. // Up
  1580. index--;
  1581. }
  1582. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  1583. // Down
  1584. index++;
  1585. }
  1586. if (index < 0) {
  1587. index = 0;
  1588. }
  1589. items[index].focus();
  1590. };
  1591. _createClass(Dropdown, null, [{
  1592. key: "VERSION",
  1593. get: function get() {
  1594. return VERSION$4;
  1595. }
  1596. }, {
  1597. key: "Default",
  1598. get: function get() {
  1599. return Default$2;
  1600. }
  1601. }, {
  1602. key: "DefaultType",
  1603. get: function get() {
  1604. return DefaultType$2;
  1605. }
  1606. }]);
  1607. return Dropdown;
  1608. }();
  1609. /**
  1610. * ------------------------------------------------------------------------
  1611. * Data Api implementation
  1612. * ------------------------------------------------------------------------
  1613. */
  1614. $(document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$4 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) {
  1615. event.preventDefault();
  1616. event.stopPropagation();
  1617. Dropdown._jQueryInterface.call($(this), 'toggle');
  1618. }).on(EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
  1619. e.stopPropagation();
  1620. });
  1621. /**
  1622. * ------------------------------------------------------------------------
  1623. * jQuery
  1624. * ------------------------------------------------------------------------
  1625. */
  1626. $.fn[NAME$4] = Dropdown._jQueryInterface;
  1627. $.fn[NAME$4].Constructor = Dropdown;
  1628. $.fn[NAME$4].noConflict = function () {
  1629. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  1630. return Dropdown._jQueryInterface;
  1631. };
  1632. /**
  1633. * ------------------------------------------------------------------------
  1634. * Constants
  1635. * ------------------------------------------------------------------------
  1636. */
  1637. var NAME$5 = 'modal';
  1638. var VERSION$5 = '4.5.2';
  1639. var DATA_KEY$5 = 'bs.modal';
  1640. var EVENT_KEY$5 = "." + DATA_KEY$5;
  1641. var DATA_API_KEY$5 = '.data-api';
  1642. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  1643. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  1644. var Default$3 = {
  1645. backdrop: true,
  1646. keyboard: true,
  1647. focus: true,
  1648. show: true
  1649. };
  1650. var DefaultType$3 = {
  1651. backdrop: '(boolean|string)',
  1652. keyboard: 'boolean',
  1653. focus: 'boolean',
  1654. show: 'boolean'
  1655. };
  1656. var EVENT_HIDE$2 = "hide" + EVENT_KEY$5;
  1657. var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5;
  1658. var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5;
  1659. var EVENT_SHOW$2 = "show" + EVENT_KEY$5;
  1660. var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5;
  1661. var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5;
  1662. var EVENT_RESIZE = "resize" + EVENT_KEY$5;
  1663. var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5;
  1664. var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5;
  1665. var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5;
  1666. var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5;
  1667. var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5;
  1668. var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable';
  1669. var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
  1670. var CLASS_NAME_BACKDROP = 'modal-backdrop';
  1671. var CLASS_NAME_OPEN = 'modal-open';
  1672. var CLASS_NAME_FADE$1 = 'fade';
  1673. var CLASS_NAME_SHOW$3 = 'show';
  1674. var CLASS_NAME_STATIC = 'modal-static';
  1675. var SELECTOR_DIALOG = '.modal-dialog';
  1676. var SELECTOR_MODAL_BODY = '.modal-body';
  1677. var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]';
  1678. var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
  1679. var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  1680. var SELECTOR_STICKY_CONTENT = '.sticky-top';
  1681. /**
  1682. * ------------------------------------------------------------------------
  1683. * Class Definition
  1684. * ------------------------------------------------------------------------
  1685. */
  1686. var Modal = /*#__PURE__*/function () {
  1687. function Modal(element, config) {
  1688. this._config = this._getConfig(config);
  1689. this._element = element;
  1690. this._dialog = element.querySelector(SELECTOR_DIALOG);
  1691. this._backdrop = null;
  1692. this._isShown = false;
  1693. this._isBodyOverflowing = false;
  1694. this._ignoreBackdropClick = false;
  1695. this._isTransitioning = false;
  1696. this._scrollbarWidth = 0;
  1697. } // Getters
  1698. var _proto = Modal.prototype;
  1699. // Public
  1700. _proto.toggle = function toggle(relatedTarget) {
  1701. return this._isShown ? this.hide() : this.show(relatedTarget);
  1702. };
  1703. _proto.show = function show(relatedTarget) {
  1704. var _this = this;
  1705. if (this._isShown || this._isTransitioning) {
  1706. return;
  1707. }
  1708. if ($(this._element).hasClass(CLASS_NAME_FADE$1)) {
  1709. this._isTransitioning = true;
  1710. }
  1711. var showEvent = $.Event(EVENT_SHOW$2, {
  1712. relatedTarget: relatedTarget
  1713. });
  1714. $(this._element).trigger(showEvent);
  1715. if (this._isShown || showEvent.isDefaultPrevented()) {
  1716. return;
  1717. }
  1718. this._isShown = true;
  1719. this._checkScrollbar();
  1720. this._setScrollbar();
  1721. this._adjustDialog();
  1722. this._setEscapeEvent();
  1723. this._setResizeEvent();
  1724. $(this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
  1725. return _this.hide(event);
  1726. });
  1727. $(this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () {
  1728. $(_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) {
  1729. if ($(event.target).is(_this._element)) {
  1730. _this._ignoreBackdropClick = true;
  1731. }
  1732. });
  1733. });
  1734. this._showBackdrop(function () {
  1735. return _this._showElement(relatedTarget);
  1736. });
  1737. };
  1738. _proto.hide = function hide(event) {
  1739. var _this2 = this;
  1740. if (event) {
  1741. event.preventDefault();
  1742. }
  1743. if (!this._isShown || this._isTransitioning) {
  1744. return;
  1745. }
  1746. var hideEvent = $.Event(EVENT_HIDE$2);
  1747. $(this._element).trigger(hideEvent);
  1748. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  1749. return;
  1750. }
  1751. this._isShown = false;
  1752. var transition = $(this._element).hasClass(CLASS_NAME_FADE$1);
  1753. if (transition) {
  1754. this._isTransitioning = true;
  1755. }
  1756. this._setEscapeEvent();
  1757. this._setResizeEvent();
  1758. $(document).off(EVENT_FOCUSIN);
  1759. $(this._element).removeClass(CLASS_NAME_SHOW$3);
  1760. $(this._element).off(EVENT_CLICK_DISMISS);
  1761. $(this._dialog).off(EVENT_MOUSEDOWN_DISMISS);
  1762. if (transition) {
  1763. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  1764. $(this._element).one(Util.TRANSITION_END, function (event) {
  1765. return _this2._hideModal(event);
  1766. }).emulateTransitionEnd(transitionDuration);
  1767. } else {
  1768. this._hideModal();
  1769. }
  1770. };
  1771. _proto.dispose = function dispose() {
  1772. [window, this._element, this._dialog].forEach(function (htmlElement) {
  1773. return $(htmlElement).off(EVENT_KEY$5);
  1774. });
  1775. /**
  1776. * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
  1777. * Do not move `document` in `htmlElements` array
  1778. * It will remove `EVENT_CLICK_DATA_API` event that should remain
  1779. */
  1780. $(document).off(EVENT_FOCUSIN);
  1781. $.removeData(this._element, DATA_KEY$5);
  1782. this._config = null;
  1783. this._element = null;
  1784. this._dialog = null;
  1785. this._backdrop = null;
  1786. this._isShown = null;
  1787. this._isBodyOverflowing = null;
  1788. this._ignoreBackdropClick = null;
  1789. this._isTransitioning = null;
  1790. this._scrollbarWidth = null;
  1791. };
  1792. _proto.handleUpdate = function handleUpdate() {
  1793. this._adjustDialog();
  1794. } // Private
  1795. ;
  1796. _proto._getConfig = function _getConfig(config) {
  1797. config = _extends({}, Default$3, config);
  1798. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  1799. return config;
  1800. };
  1801. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  1802. var _this3 = this;
  1803. if (this._config.backdrop === 'static') {
  1804. var hideEventPrevented = $.Event(EVENT_HIDE_PREVENTED);
  1805. $(this._element).trigger(hideEventPrevented);
  1806. if (hideEventPrevented.defaultPrevented) {
  1807. return;
  1808. }
  1809. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  1810. if (!isModalOverflowing) {
  1811. this._element.style.overflowY = 'hidden';
  1812. }
  1813. this._element.classList.add(CLASS_NAME_STATIC);
  1814. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  1815. $(this._element).off(Util.TRANSITION_END);
  1816. $(this._element).one(Util.TRANSITION_END, function () {
  1817. _this3._element.classList.remove(CLASS_NAME_STATIC);
  1818. if (!isModalOverflowing) {
  1819. $(_this3._element).one(Util.TRANSITION_END, function () {
  1820. _this3._element.style.overflowY = '';
  1821. }).emulateTransitionEnd(_this3._element, modalTransitionDuration);
  1822. }
  1823. }).emulateTransitionEnd(modalTransitionDuration);
  1824. this._element.focus();
  1825. } else {
  1826. this.hide();
  1827. }
  1828. };
  1829. _proto._showElement = function _showElement(relatedTarget) {
  1830. var _this4 = this;
  1831. var transition = $(this._element).hasClass(CLASS_NAME_FADE$1);
  1832. var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null;
  1833. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  1834. // Don't move modal's DOM position
  1835. document.body.appendChild(this._element);
  1836. }
  1837. this._element.style.display = 'block';
  1838. this._element.removeAttribute('aria-hidden');
  1839. this._element.setAttribute('aria-modal', true);
  1840. this._element.setAttribute('role', 'dialog');
  1841. if ($(this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
  1842. modalBody.scrollTop = 0;
  1843. } else {
  1844. this._element.scrollTop = 0;
  1845. }
  1846. if (transition) {
  1847. Util.reflow(this._element);
  1848. }
  1849. $(this._element).addClass(CLASS_NAME_SHOW$3);
  1850. if (this._config.focus) {
  1851. this._enforceFocus();
  1852. }
  1853. var shownEvent = $.Event(EVENT_SHOWN$2, {
  1854. relatedTarget: relatedTarget
  1855. });
  1856. var transitionComplete = function transitionComplete() {
  1857. if (_this4._config.focus) {
  1858. _this4._element.focus();
  1859. }
  1860. _this4._isTransitioning = false;
  1861. $(_this4._element).trigger(shownEvent);
  1862. };
  1863. if (transition) {
  1864. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  1865. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  1866. } else {
  1867. transitionComplete();
  1868. }
  1869. };
  1870. _proto._enforceFocus = function _enforceFocus() {
  1871. var _this5 = this;
  1872. $(document).off(EVENT_FOCUSIN) // Guard against infinite focus loop
  1873. .on(EVENT_FOCUSIN, function (event) {
  1874. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  1875. _this5._element.focus();
  1876. }
  1877. });
  1878. };
  1879. _proto._setEscapeEvent = function _setEscapeEvent() {
  1880. var _this6 = this;
  1881. if (this._isShown) {
  1882. $(this._element).on(EVENT_KEYDOWN_DISMISS, function (event) {
  1883. if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
  1884. event.preventDefault();
  1885. _this6.hide();
  1886. } else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
  1887. _this6._triggerBackdropTransition();
  1888. }
  1889. });
  1890. } else if (!this._isShown) {
  1891. $(this._element).off(EVENT_KEYDOWN_DISMISS);
  1892. }
  1893. };
  1894. _proto._setResizeEvent = function _setResizeEvent() {
  1895. var _this7 = this;
  1896. if (this._isShown) {
  1897. $(window).on(EVENT_RESIZE, function (event) {
  1898. return _this7.handleUpdate(event);
  1899. });
  1900. } else {
  1901. $(window).off(EVENT_RESIZE);
  1902. }
  1903. };
  1904. _proto._hideModal = function _hideModal() {
  1905. var _this8 = this;
  1906. this._element.style.display = 'none';
  1907. this._element.setAttribute('aria-hidden', true);
  1908. this._element.removeAttribute('aria-modal');
  1909. this._element.removeAttribute('role');
  1910. this._isTransitioning = false;
  1911. this._showBackdrop(function () {
  1912. $(document.body).removeClass(CLASS_NAME_OPEN);
  1913. _this8._resetAdjustments();
  1914. _this8._resetScrollbar();
  1915. $(_this8._element).trigger(EVENT_HIDDEN$2);
  1916. });
  1917. };
  1918. _proto._removeBackdrop = function _removeBackdrop() {
  1919. if (this._backdrop) {
  1920. $(this._backdrop).remove();
  1921. this._backdrop = null;
  1922. }
  1923. };
  1924. _proto._showBackdrop = function _showBackdrop(callback) {
  1925. var _this9 = this;
  1926. var animate = $(this._element).hasClass(CLASS_NAME_FADE$1) ? CLASS_NAME_FADE$1 : '';
  1927. if (this._isShown && this._config.backdrop) {
  1928. this._backdrop = document.createElement('div');
  1929. this._backdrop.className = CLASS_NAME_BACKDROP;
  1930. if (animate) {
  1931. this._backdrop.classList.add(animate);
  1932. }
  1933. $(this._backdrop).appendTo(document.body);
  1934. $(this._element).on(EVENT_CLICK_DISMISS, function (event) {
  1935. if (_this9._ignoreBackdropClick) {
  1936. _this9._ignoreBackdropClick = false;
  1937. return;
  1938. }
  1939. if (event.target !== event.currentTarget) {
  1940. return;
  1941. }
  1942. _this9._triggerBackdropTransition();
  1943. });
  1944. if (animate) {
  1945. Util.reflow(this._backdrop);
  1946. }
  1947. $(this._backdrop).addClass(CLASS_NAME_SHOW$3);
  1948. if (!callback) {
  1949. return;
  1950. }
  1951. if (!animate) {
  1952. callback();
  1953. return;
  1954. }
  1955. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  1956. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  1957. } else if (!this._isShown && this._backdrop) {
  1958. $(this._backdrop).removeClass(CLASS_NAME_SHOW$3);
  1959. var callbackRemove = function callbackRemove() {
  1960. _this9._removeBackdrop();
  1961. if (callback) {
  1962. callback();
  1963. }
  1964. };
  1965. if ($(this._element).hasClass(CLASS_NAME_FADE$1)) {
  1966. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  1967. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  1968. } else {
  1969. callbackRemove();
  1970. }
  1971. } else if (callback) {
  1972. callback();
  1973. }
  1974. } // ----------------------------------------------------------------------
  1975. // the following methods are used to handle overflowing modals
  1976. // todo (fat): these should probably be refactored out of modal.js
  1977. // ----------------------------------------------------------------------
  1978. ;
  1979. _proto._adjustDialog = function _adjustDialog() {
  1980. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  1981. if (!this._isBodyOverflowing && isModalOverflowing) {
  1982. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  1983. }
  1984. if (this._isBodyOverflowing && !isModalOverflowing) {
  1985. this._element.style.paddingRight = this._scrollbarWidth + "px";
  1986. }
  1987. };
  1988. _proto._resetAdjustments = function _resetAdjustments() {
  1989. this._element.style.paddingLeft = '';
  1990. this._element.style.paddingRight = '';
  1991. };
  1992. _proto._checkScrollbar = function _checkScrollbar() {
  1993. var rect = document.body.getBoundingClientRect();
  1994. this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
  1995. this._scrollbarWidth = this._getScrollbarWidth();
  1996. };
  1997. _proto._setScrollbar = function _setScrollbar() {
  1998. var _this10 = this;
  1999. if (this._isBodyOverflowing) {
  2000. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  2001. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  2002. var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
  2003. var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding
  2004. $(fixedContent).each(function (index, element) {
  2005. var actualPadding = element.style.paddingRight;
  2006. var calculatedPadding = $(element).css('padding-right');
  2007. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  2008. }); // Adjust sticky content margin
  2009. $(stickyContent).each(function (index, element) {
  2010. var actualMargin = element.style.marginRight;
  2011. var calculatedMargin = $(element).css('margin-right');
  2012. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  2013. }); // Adjust body padding
  2014. var actualPadding = document.body.style.paddingRight;
  2015. var calculatedPadding = $(document.body).css('padding-right');
  2016. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  2017. }
  2018. $(document.body).addClass(CLASS_NAME_OPEN);
  2019. };
  2020. _proto._resetScrollbar = function _resetScrollbar() {
  2021. // Restore fixed content padding
  2022. var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
  2023. $(fixedContent).each(function (index, element) {
  2024. var padding = $(element).data('padding-right');
  2025. $(element).removeData('padding-right');
  2026. element.style.paddingRight = padding ? padding : '';
  2027. }); // Restore sticky content
  2028. var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT));
  2029. $(elements).each(function (index, element) {
  2030. var margin = $(element).data('margin-right');
  2031. if (typeof margin !== 'undefined') {
  2032. $(element).css('margin-right', margin).removeData('margin-right');
  2033. }
  2034. }); // Restore body padding
  2035. var padding = $(document.body).data('padding-right');
  2036. $(document.body).removeData('padding-right');
  2037. document.body.style.paddingRight = padding ? padding : '';
  2038. };
  2039. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  2040. // thx d.walsh
  2041. var scrollDiv = document.createElement('div');
  2042. scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
  2043. document.body.appendChild(scrollDiv);
  2044. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  2045. document.body.removeChild(scrollDiv);
  2046. return scrollbarWidth;
  2047. } // Static
  2048. ;
  2049. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  2050. return this.each(function () {
  2051. var data = $(this).data(DATA_KEY$5);
  2052. var _config = _extends({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {});
  2053. if (!data) {
  2054. data = new Modal(this, _config);
  2055. $(this).data(DATA_KEY$5, data);
  2056. }
  2057. if (typeof config === 'string') {
  2058. if (typeof data[config] === 'undefined') {
  2059. throw new TypeError("No method named \"" + config + "\"");
  2060. }
  2061. data[config](relatedTarget);
  2062. } else if (_config.show) {
  2063. data.show(relatedTarget);
  2064. }
  2065. });
  2066. };
  2067. _createClass(Modal, null, [{
  2068. key: "VERSION",
  2069. get: function get() {
  2070. return VERSION$5;
  2071. }
  2072. }, {
  2073. key: "Default",
  2074. get: function get() {
  2075. return Default$3;
  2076. }
  2077. }]);
  2078. return Modal;
  2079. }();
  2080. /**
  2081. * ------------------------------------------------------------------------
  2082. * Data Api implementation
  2083. * ------------------------------------------------------------------------
  2084. */
  2085. $(document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
  2086. var _this11 = this;
  2087. var target;
  2088. var selector = Util.getSelectorFromElement(this);
  2089. if (selector) {
  2090. target = document.querySelector(selector);
  2091. }
  2092. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _extends({}, $(target).data(), $(this).data());
  2093. if (this.tagName === 'A' || this.tagName === 'AREA') {
  2094. event.preventDefault();
  2095. }
  2096. var $target = $(target).one(EVENT_SHOW$2, function (showEvent) {
  2097. if (showEvent.isDefaultPrevented()) {
  2098. // Only register focus restorer if modal will actually get shown
  2099. return;
  2100. }
  2101. $target.one(EVENT_HIDDEN$2, function () {
  2102. if ($(_this11).is(':visible')) {
  2103. _this11.focus();
  2104. }
  2105. });
  2106. });
  2107. Modal._jQueryInterface.call($(target), config, this);
  2108. });
  2109. /**
  2110. * ------------------------------------------------------------------------
  2111. * jQuery
  2112. * ------------------------------------------------------------------------
  2113. */
  2114. $.fn[NAME$5] = Modal._jQueryInterface;
  2115. $.fn[NAME$5].Constructor = Modal;
  2116. $.fn[NAME$5].noConflict = function () {
  2117. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  2118. return Modal._jQueryInterface;
  2119. };
  2120. /**
  2121. * --------------------------------------------------------------------------
  2122. * Bootstrap (v4.5.2): tools/sanitizer.js
  2123. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2124. * --------------------------------------------------------------------------
  2125. */
  2126. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  2127. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  2128. var DefaultWhitelist = {
  2129. // Global attributes allowed on any supplied element below.
  2130. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  2131. a: ['target', 'href', 'title', 'rel'],
  2132. area: [],
  2133. b: [],
  2134. br: [],
  2135. col: [],
  2136. code: [],
  2137. div: [],
  2138. em: [],
  2139. hr: [],
  2140. h1: [],
  2141. h2: [],
  2142. h3: [],
  2143. h4: [],
  2144. h5: [],
  2145. h6: [],
  2146. i: [],
  2147. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  2148. li: [],
  2149. ol: [],
  2150. p: [],
  2151. pre: [],
  2152. s: [],
  2153. small: [],
  2154. span: [],
  2155. sub: [],
  2156. sup: [],
  2157. strong: [],
  2158. u: [],
  2159. ul: []
  2160. };
  2161. /**
  2162. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  2163. *
  2164. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  2165. */
  2166. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
  2167. /**
  2168. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  2169. *
  2170. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  2171. */
  2172. var 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;
  2173. function allowedAttribute(attr, allowedAttributeList) {
  2174. var attrName = attr.nodeName.toLowerCase();
  2175. if (allowedAttributeList.indexOf(attrName) !== -1) {
  2176. if (uriAttrs.indexOf(attrName) !== -1) {
  2177. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  2178. }
  2179. return true;
  2180. }
  2181. var regExp = allowedAttributeList.filter(function (attrRegex) {
  2182. return attrRegex instanceof RegExp;
  2183. }); // Check if a regular expression validates the attribute.
  2184. for (var i = 0, len = regExp.length; i < len; i++) {
  2185. if (attrName.match(regExp[i])) {
  2186. return true;
  2187. }
  2188. }
  2189. return false;
  2190. }
  2191. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  2192. if (unsafeHtml.length === 0) {
  2193. return unsafeHtml;
  2194. }
  2195. if (sanitizeFn && typeof sanitizeFn === 'function') {
  2196. return sanitizeFn(unsafeHtml);
  2197. }
  2198. var domParser = new window.DOMParser();
  2199. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  2200. var whitelistKeys = Object.keys(whiteList);
  2201. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  2202. var _loop = function _loop(i, len) {
  2203. var el = elements[i];
  2204. var elName = el.nodeName.toLowerCase();
  2205. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  2206. el.parentNode.removeChild(el);
  2207. return "continue";
  2208. }
  2209. var attributeList = [].slice.call(el.attributes);
  2210. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  2211. attributeList.forEach(function (attr) {
  2212. if (!allowedAttribute(attr, whitelistedAttributes)) {
  2213. el.removeAttribute(attr.nodeName);
  2214. }
  2215. });
  2216. };
  2217. for (var i = 0, len = elements.length; i < len; i++) {
  2218. var _ret = _loop(i);
  2219. if (_ret === "continue") continue;
  2220. }
  2221. return createdDocument.body.innerHTML;
  2222. }
  2223. /**
  2224. * ------------------------------------------------------------------------
  2225. * Constants
  2226. * ------------------------------------------------------------------------
  2227. */
  2228. var NAME$6 = 'tooltip';
  2229. var VERSION$6 = '4.5.2';
  2230. var DATA_KEY$6 = 'bs.tooltip';
  2231. var EVENT_KEY$6 = "." + DATA_KEY$6;
  2232. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  2233. var CLASS_PREFIX = 'bs-tooltip';
  2234. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  2235. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  2236. var DefaultType$4 = {
  2237. animation: 'boolean',
  2238. template: 'string',
  2239. title: '(string|element|function)',
  2240. trigger: 'string',
  2241. delay: '(number|object)',
  2242. html: 'boolean',
  2243. selector: '(string|boolean)',
  2244. placement: '(string|function)',
  2245. offset: '(number|string|function)',
  2246. container: '(string|element|boolean)',
  2247. fallbackPlacement: '(string|array)',
  2248. boundary: '(string|element)',
  2249. sanitize: 'boolean',
  2250. sanitizeFn: '(null|function)',
  2251. whiteList: 'object',
  2252. popperConfig: '(null|object)'
  2253. };
  2254. var AttachmentMap = {
  2255. AUTO: 'auto',
  2256. TOP: 'top',
  2257. RIGHT: 'right',
  2258. BOTTOM: 'bottom',
  2259. LEFT: 'left'
  2260. };
  2261. var Default$4 = {
  2262. animation: true,
  2263. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  2264. trigger: 'hover focus',
  2265. title: '',
  2266. delay: 0,
  2267. html: false,
  2268. selector: false,
  2269. placement: 'top',
  2270. offset: 0,
  2271. container: false,
  2272. fallbackPlacement: 'flip',
  2273. boundary: 'scrollParent',
  2274. sanitize: true,
  2275. sanitizeFn: null,
  2276. whiteList: DefaultWhitelist,
  2277. popperConfig: null
  2278. };
  2279. var HOVER_STATE_SHOW = 'show';
  2280. var HOVER_STATE_OUT = 'out';
  2281. var Event = {
  2282. HIDE: "hide" + EVENT_KEY$6,
  2283. HIDDEN: "hidden" + EVENT_KEY$6,
  2284. SHOW: "show" + EVENT_KEY$6,
  2285. SHOWN: "shown" + EVENT_KEY$6,
  2286. INSERTED: "inserted" + EVENT_KEY$6,
  2287. CLICK: "click" + EVENT_KEY$6,
  2288. FOCUSIN: "focusin" + EVENT_KEY$6,
  2289. FOCUSOUT: "focusout" + EVENT_KEY$6,
  2290. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  2291. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  2292. };
  2293. var CLASS_NAME_FADE$2 = 'fade';
  2294. var CLASS_NAME_SHOW$4 = 'show';
  2295. var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  2296. var SELECTOR_ARROW = '.arrow';
  2297. var TRIGGER_HOVER = 'hover';
  2298. var TRIGGER_FOCUS = 'focus';
  2299. var TRIGGER_CLICK = 'click';
  2300. var TRIGGER_MANUAL = 'manual';
  2301. /**
  2302. * ------------------------------------------------------------------------
  2303. * Class Definition
  2304. * ------------------------------------------------------------------------
  2305. */
  2306. var Tooltip = /*#__PURE__*/function () {
  2307. function Tooltip(element, config) {
  2308. if (typeof Popper === 'undefined') {
  2309. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  2310. } // private
  2311. this._isEnabled = true;
  2312. this._timeout = 0;
  2313. this._hoverState = '';
  2314. this._activeTrigger = {};
  2315. this._popper = null; // Protected
  2316. this.element = element;
  2317. this.config = this._getConfig(config);
  2318. this.tip = null;
  2319. this._setListeners();
  2320. } // Getters
  2321. var _proto = Tooltip.prototype;
  2322. // Public
  2323. _proto.enable = function enable() {
  2324. this._isEnabled = true;
  2325. };
  2326. _proto.disable = function disable() {
  2327. this._isEnabled = false;
  2328. };
  2329. _proto.toggleEnabled = function toggleEnabled() {
  2330. this._isEnabled = !this._isEnabled;
  2331. };
  2332. _proto.toggle = function toggle(event) {
  2333. if (!this._isEnabled) {
  2334. return;
  2335. }
  2336. if (event) {
  2337. var dataKey = this.constructor.DATA_KEY;
  2338. var context = $(event.currentTarget).data(dataKey);
  2339. if (!context) {
  2340. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  2341. $(event.currentTarget).data(dataKey, context);
  2342. }
  2343. context._activeTrigger.click = !context._activeTrigger.click;
  2344. if (context._isWithActiveTrigger()) {
  2345. context._enter(null, context);
  2346. } else {
  2347. context._leave(null, context);
  2348. }
  2349. } else {
  2350. if ($(this.getTipElement()).hasClass(CLASS_NAME_SHOW$4)) {
  2351. this._leave(null, this);
  2352. return;
  2353. }
  2354. this._enter(null, this);
  2355. }
  2356. };
  2357. _proto.dispose = function dispose() {
  2358. clearTimeout(this._timeout);
  2359. $.removeData(this.element, this.constructor.DATA_KEY);
  2360. $(this.element).off(this.constructor.EVENT_KEY);
  2361. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  2362. if (this.tip) {
  2363. $(this.tip).remove();
  2364. }
  2365. this._isEnabled = null;
  2366. this._timeout = null;
  2367. this._hoverState = null;
  2368. this._activeTrigger = null;
  2369. if (this._popper) {
  2370. this._popper.destroy();
  2371. }
  2372. this._popper = null;
  2373. this.element = null;
  2374. this.config = null;
  2375. this.tip = null;
  2376. };
  2377. _proto.show = function show() {
  2378. var _this = this;
  2379. if ($(this.element).css('display') === 'none') {
  2380. throw new Error('Please use show on visible elements');
  2381. }
  2382. var showEvent = $.Event(this.constructor.Event.SHOW);
  2383. if (this.isWithContent() && this._isEnabled) {
  2384. $(this.element).trigger(showEvent);
  2385. var shadowRoot = Util.findShadowRoot(this.element);
  2386. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  2387. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  2388. return;
  2389. }
  2390. var tip = this.getTipElement();
  2391. var tipId = Util.getUID(this.constructor.NAME);
  2392. tip.setAttribute('id', tipId);
  2393. this.element.setAttribute('aria-describedby', tipId);
  2394. this.setContent();
  2395. if (this.config.animation) {
  2396. $(tip).addClass(CLASS_NAME_FADE$2);
  2397. }
  2398. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  2399. var attachment = this._getAttachment(placement);
  2400. this.addAttachmentClass(attachment);
  2401. var container = this._getContainer();
  2402. $(tip).data(this.constructor.DATA_KEY, this);
  2403. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  2404. $(tip).appendTo(container);
  2405. }
  2406. $(this.element).trigger(this.constructor.Event.INSERTED);
  2407. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  2408. $(tip).addClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we add extra
  2409. // empty mouseover listeners to the body's immediate children;
  2410. // only needed because of broken event delegation on iOS
  2411. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  2412. if ('ontouchstart' in document.documentElement) {
  2413. $(document.body).children().on('mouseover', null, $.noop);
  2414. }
  2415. var complete = function complete() {
  2416. if (_this.config.animation) {
  2417. _this._fixTransition();
  2418. }
  2419. var prevHoverState = _this._hoverState;
  2420. _this._hoverState = null;
  2421. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  2422. if (prevHoverState === HOVER_STATE_OUT) {
  2423. _this._leave(null, _this);
  2424. }
  2425. };
  2426. if ($(this.tip).hasClass(CLASS_NAME_FADE$2)) {
  2427. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  2428. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2429. } else {
  2430. complete();
  2431. }
  2432. }
  2433. };
  2434. _proto.hide = function hide(callback) {
  2435. var _this2 = this;
  2436. var tip = this.getTipElement();
  2437. var hideEvent = $.Event(this.constructor.Event.HIDE);
  2438. var complete = function complete() {
  2439. if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
  2440. tip.parentNode.removeChild(tip);
  2441. }
  2442. _this2._cleanTipClass();
  2443. _this2.element.removeAttribute('aria-describedby');
  2444. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  2445. if (_this2._popper !== null) {
  2446. _this2._popper.destroy();
  2447. }
  2448. if (callback) {
  2449. callback();
  2450. }
  2451. };
  2452. $(this.element).trigger(hideEvent);
  2453. if (hideEvent.isDefaultPrevented()) {
  2454. return;
  2455. }
  2456. $(tip).removeClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we remove the extra
  2457. // empty mouseover listeners we added for iOS support
  2458. if ('ontouchstart' in document.documentElement) {
  2459. $(document.body).children().off('mouseover', null, $.noop);
  2460. }
  2461. this._activeTrigger[TRIGGER_CLICK] = false;
  2462. this._activeTrigger[TRIGGER_FOCUS] = false;
  2463. this._activeTrigger[TRIGGER_HOVER] = false;
  2464. if ($(this.tip).hasClass(CLASS_NAME_FADE$2)) {
  2465. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  2466. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2467. } else {
  2468. complete();
  2469. }
  2470. this._hoverState = '';
  2471. };
  2472. _proto.update = function update() {
  2473. if (this._popper !== null) {
  2474. this._popper.scheduleUpdate();
  2475. }
  2476. } // Protected
  2477. ;
  2478. _proto.isWithContent = function isWithContent() {
  2479. return Boolean(this.getTitle());
  2480. };
  2481. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  2482. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  2483. };
  2484. _proto.getTipElement = function getTipElement() {
  2485. this.tip = this.tip || $(this.config.template)[0];
  2486. return this.tip;
  2487. };
  2488. _proto.setContent = function setContent() {
  2489. var tip = this.getTipElement();
  2490. this.setElementContent($(tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle());
  2491. $(tip).removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$4);
  2492. };
  2493. _proto.setElementContent = function setElementContent($element, content) {
  2494. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  2495. // Content is a DOM node or a jQuery
  2496. if (this.config.html) {
  2497. if (!$(content).parent().is($element)) {
  2498. $element.empty().append(content);
  2499. }
  2500. } else {
  2501. $element.text($(content).text());
  2502. }
  2503. return;
  2504. }
  2505. if (this.config.html) {
  2506. if (this.config.sanitize) {
  2507. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  2508. }
  2509. $element.html(content);
  2510. } else {
  2511. $element.text(content);
  2512. }
  2513. };
  2514. _proto.getTitle = function getTitle() {
  2515. var title = this.element.getAttribute('data-original-title');
  2516. if (!title) {
  2517. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  2518. }
  2519. return title;
  2520. } // Private
  2521. ;
  2522. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  2523. var _this3 = this;
  2524. var defaultBsConfig = {
  2525. placement: attachment,
  2526. modifiers: {
  2527. offset: this._getOffset(),
  2528. flip: {
  2529. behavior: this.config.fallbackPlacement
  2530. },
  2531. arrow: {
  2532. element: SELECTOR_ARROW
  2533. },
  2534. preventOverflow: {
  2535. boundariesElement: this.config.boundary
  2536. }
  2537. },
  2538. onCreate: function onCreate(data) {
  2539. if (data.originalPlacement !== data.placement) {
  2540. _this3._handlePopperPlacementChange(data);
  2541. }
  2542. },
  2543. onUpdate: function onUpdate(data) {
  2544. return _this3._handlePopperPlacementChange(data);
  2545. }
  2546. };
  2547. return _extends({}, defaultBsConfig, this.config.popperConfig);
  2548. };
  2549. _proto._getOffset = function _getOffset() {
  2550. var _this4 = this;
  2551. var offset = {};
  2552. if (typeof this.config.offset === 'function') {
  2553. offset.fn = function (data) {
  2554. data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
  2555. return data;
  2556. };
  2557. } else {
  2558. offset.offset = this.config.offset;
  2559. }
  2560. return offset;
  2561. };
  2562. _proto._getContainer = function _getContainer() {
  2563. if (this.config.container === false) {
  2564. return document.body;
  2565. }
  2566. if (Util.isElement(this.config.container)) {
  2567. return $(this.config.container);
  2568. }
  2569. return $(document).find(this.config.container);
  2570. };
  2571. _proto._getAttachment = function _getAttachment(placement) {
  2572. return AttachmentMap[placement.toUpperCase()];
  2573. };
  2574. _proto._setListeners = function _setListeners() {
  2575. var _this5 = this;
  2576. var triggers = this.config.trigger.split(' ');
  2577. triggers.forEach(function (trigger) {
  2578. if (trigger === 'click') {
  2579. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  2580. return _this5.toggle(event);
  2581. });
  2582. } else if (trigger !== TRIGGER_MANUAL) {
  2583. var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  2584. var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  2585. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  2586. return _this5._enter(event);
  2587. }).on(eventOut, _this5.config.selector, function (event) {
  2588. return _this5._leave(event);
  2589. });
  2590. }
  2591. });
  2592. this._hideModalHandler = function () {
  2593. if (_this5.element) {
  2594. _this5.hide();
  2595. }
  2596. };
  2597. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  2598. if (this.config.selector) {
  2599. this.config = _extends({}, this.config, {
  2600. trigger: 'manual',
  2601. selector: ''
  2602. });
  2603. } else {
  2604. this._fixTitle();
  2605. }
  2606. };
  2607. _proto._fixTitle = function _fixTitle() {
  2608. var titleType = typeof this.element.getAttribute('data-original-title');
  2609. if (this.element.getAttribute('title') || titleType !== 'string') {
  2610. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  2611. this.element.setAttribute('title', '');
  2612. }
  2613. };
  2614. _proto._enter = function _enter(event, context) {
  2615. var dataKey = this.constructor.DATA_KEY;
  2616. context = context || $(event.currentTarget).data(dataKey);
  2617. if (!context) {
  2618. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  2619. $(event.currentTarget).data(dataKey, context);
  2620. }
  2621. if (event) {
  2622. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  2623. }
  2624. if ($(context.getTipElement()).hasClass(CLASS_NAME_SHOW$4) || context._hoverState === HOVER_STATE_SHOW) {
  2625. context._hoverState = HOVER_STATE_SHOW;
  2626. return;
  2627. }
  2628. clearTimeout(context._timeout);
  2629. context._hoverState = HOVER_STATE_SHOW;
  2630. if (!context.config.delay || !context.config.delay.show) {
  2631. context.show();
  2632. return;
  2633. }
  2634. context._timeout = setTimeout(function () {
  2635. if (context._hoverState === HOVER_STATE_SHOW) {
  2636. context.show();
  2637. }
  2638. }, context.config.delay.show);
  2639. };
  2640. _proto._leave = function _leave(event, context) {
  2641. var dataKey = this.constructor.DATA_KEY;
  2642. context = context || $(event.currentTarget).data(dataKey);
  2643. if (!context) {
  2644. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  2645. $(event.currentTarget).data(dataKey, context);
  2646. }
  2647. if (event) {
  2648. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
  2649. }
  2650. if (context._isWithActiveTrigger()) {
  2651. return;
  2652. }
  2653. clearTimeout(context._timeout);
  2654. context._hoverState = HOVER_STATE_OUT;
  2655. if (!context.config.delay || !context.config.delay.hide) {
  2656. context.hide();
  2657. return;
  2658. }
  2659. context._timeout = setTimeout(function () {
  2660. if (context._hoverState === HOVER_STATE_OUT) {
  2661. context.hide();
  2662. }
  2663. }, context.config.delay.hide);
  2664. };
  2665. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  2666. for (var trigger in this._activeTrigger) {
  2667. if (this._activeTrigger[trigger]) {
  2668. return true;
  2669. }
  2670. }
  2671. return false;
  2672. };
  2673. _proto._getConfig = function _getConfig(config) {
  2674. var dataAttributes = $(this.element).data();
  2675. Object.keys(dataAttributes).forEach(function (dataAttr) {
  2676. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  2677. delete dataAttributes[dataAttr];
  2678. }
  2679. });
  2680. config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
  2681. if (typeof config.delay === 'number') {
  2682. config.delay = {
  2683. show: config.delay,
  2684. hide: config.delay
  2685. };
  2686. }
  2687. if (typeof config.title === 'number') {
  2688. config.title = config.title.toString();
  2689. }
  2690. if (typeof config.content === 'number') {
  2691. config.content = config.content.toString();
  2692. }
  2693. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  2694. if (config.sanitize) {
  2695. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  2696. }
  2697. return config;
  2698. };
  2699. _proto._getDelegateConfig = function _getDelegateConfig() {
  2700. var config = {};
  2701. if (this.config) {
  2702. for (var key in this.config) {
  2703. if (this.constructor.Default[key] !== this.config[key]) {
  2704. config[key] = this.config[key];
  2705. }
  2706. }
  2707. }
  2708. return config;
  2709. };
  2710. _proto._cleanTipClass = function _cleanTipClass() {
  2711. var $tip = $(this.getTipElement());
  2712. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  2713. if (tabClass !== null && tabClass.length) {
  2714. $tip.removeClass(tabClass.join(''));
  2715. }
  2716. };
  2717. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  2718. this.tip = popperData.instance.popper;
  2719. this._cleanTipClass();
  2720. this.addAttachmentClass(this._getAttachment(popperData.placement));
  2721. };
  2722. _proto._fixTransition = function _fixTransition() {
  2723. var tip = this.getTipElement();
  2724. var initConfigAnimation = this.config.animation;
  2725. if (tip.getAttribute('x-placement') !== null) {
  2726. return;
  2727. }
  2728. $(tip).removeClass(CLASS_NAME_FADE$2);
  2729. this.config.animation = false;
  2730. this.hide();
  2731. this.show();
  2732. this.config.animation = initConfigAnimation;
  2733. } // Static
  2734. ;
  2735. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  2736. return this.each(function () {
  2737. var data = $(this).data(DATA_KEY$6);
  2738. var _config = typeof config === 'object' && config;
  2739. if (!data && /dispose|hide/.test(config)) {
  2740. return;
  2741. }
  2742. if (!data) {
  2743. data = new Tooltip(this, _config);
  2744. $(this).data(DATA_KEY$6, data);
  2745. }
  2746. if (typeof config === 'string') {
  2747. if (typeof data[config] === 'undefined') {
  2748. throw new TypeError("No method named \"" + config + "\"");
  2749. }
  2750. data[config]();
  2751. }
  2752. });
  2753. };
  2754. _createClass(Tooltip, null, [{
  2755. key: "VERSION",
  2756. get: function get() {
  2757. return VERSION$6;
  2758. }
  2759. }, {
  2760. key: "Default",
  2761. get: function get() {
  2762. return Default$4;
  2763. }
  2764. }, {
  2765. key: "NAME",
  2766. get: function get() {
  2767. return NAME$6;
  2768. }
  2769. }, {
  2770. key: "DATA_KEY",
  2771. get: function get() {
  2772. return DATA_KEY$6;
  2773. }
  2774. }, {
  2775. key: "Event",
  2776. get: function get() {
  2777. return Event;
  2778. }
  2779. }, {
  2780. key: "EVENT_KEY",
  2781. get: function get() {
  2782. return EVENT_KEY$6;
  2783. }
  2784. }, {
  2785. key: "DefaultType",
  2786. get: function get() {
  2787. return DefaultType$4;
  2788. }
  2789. }]);
  2790. return Tooltip;
  2791. }();
  2792. /**
  2793. * ------------------------------------------------------------------------
  2794. * jQuery
  2795. * ------------------------------------------------------------------------
  2796. */
  2797. $.fn[NAME$6] = Tooltip._jQueryInterface;
  2798. $.fn[NAME$6].Constructor = Tooltip;
  2799. $.fn[NAME$6].noConflict = function () {
  2800. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  2801. return Tooltip._jQueryInterface;
  2802. };
  2803. /**
  2804. * ------------------------------------------------------------------------
  2805. * Constants
  2806. * ------------------------------------------------------------------------
  2807. */
  2808. var NAME$7 = 'popover';
  2809. var VERSION$7 = '4.5.2';
  2810. var DATA_KEY$7 = 'bs.popover';
  2811. var EVENT_KEY$7 = "." + DATA_KEY$7;
  2812. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  2813. var CLASS_PREFIX$1 = 'bs-popover';
  2814. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  2815. var Default$5 = _extends({}, Tooltip.Default, {
  2816. placement: 'right',
  2817. trigger: 'click',
  2818. content: '',
  2819. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  2820. });
  2821. var DefaultType$5 = _extends({}, Tooltip.DefaultType, {
  2822. content: '(string|element|function)'
  2823. });
  2824. var CLASS_NAME_FADE$3 = 'fade';
  2825. var CLASS_NAME_SHOW$5 = 'show';
  2826. var SELECTOR_TITLE = '.popover-header';
  2827. var SELECTOR_CONTENT = '.popover-body';
  2828. var Event$1 = {
  2829. HIDE: "hide" + EVENT_KEY$7,
  2830. HIDDEN: "hidden" + EVENT_KEY$7,
  2831. SHOW: "show" + EVENT_KEY$7,
  2832. SHOWN: "shown" + EVENT_KEY$7,
  2833. INSERTED: "inserted" + EVENT_KEY$7,
  2834. CLICK: "click" + EVENT_KEY$7,
  2835. FOCUSIN: "focusin" + EVENT_KEY$7,
  2836. FOCUSOUT: "focusout" + EVENT_KEY$7,
  2837. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  2838. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  2839. };
  2840. /**
  2841. * ------------------------------------------------------------------------
  2842. * Class Definition
  2843. * ------------------------------------------------------------------------
  2844. */
  2845. var Popover = /*#__PURE__*/function (_Tooltip) {
  2846. _inheritsLoose(Popover, _Tooltip);
  2847. function Popover() {
  2848. return _Tooltip.apply(this, arguments) || this;
  2849. }
  2850. var _proto = Popover.prototype;
  2851. // Overrides
  2852. _proto.isWithContent = function isWithContent() {
  2853. return this.getTitle() || this._getContent();
  2854. };
  2855. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  2856. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  2857. };
  2858. _proto.getTipElement = function getTipElement() {
  2859. this.tip = this.tip || $(this.config.template)[0];
  2860. return this.tip;
  2861. };
  2862. _proto.setContent = function setContent() {
  2863. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  2864. this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle());
  2865. var content = this._getContent();
  2866. if (typeof content === 'function') {
  2867. content = content.call(this.element);
  2868. }
  2869. this.setElementContent($tip.find(SELECTOR_CONTENT), content);
  2870. $tip.removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$5);
  2871. } // Private
  2872. ;
  2873. _proto._getContent = function _getContent() {
  2874. return this.element.getAttribute('data-content') || this.config.content;
  2875. };
  2876. _proto._cleanTipClass = function _cleanTipClass() {
  2877. var $tip = $(this.getTipElement());
  2878. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  2879. if (tabClass !== null && tabClass.length > 0) {
  2880. $tip.removeClass(tabClass.join(''));
  2881. }
  2882. } // Static
  2883. ;
  2884. Popover._jQueryInterface = function _jQueryInterface(config) {
  2885. return this.each(function () {
  2886. var data = $(this).data(DATA_KEY$7);
  2887. var _config = typeof config === 'object' ? config : null;
  2888. if (!data && /dispose|hide/.test(config)) {
  2889. return;
  2890. }
  2891. if (!data) {
  2892. data = new Popover(this, _config);
  2893. $(this).data(DATA_KEY$7, data);
  2894. }
  2895. if (typeof config === 'string') {
  2896. if (typeof data[config] === 'undefined') {
  2897. throw new TypeError("No method named \"" + config + "\"");
  2898. }
  2899. data[config]();
  2900. }
  2901. });
  2902. };
  2903. _createClass(Popover, null, [{
  2904. key: "VERSION",
  2905. // Getters
  2906. get: function get() {
  2907. return VERSION$7;
  2908. }
  2909. }, {
  2910. key: "Default",
  2911. get: function get() {
  2912. return Default$5;
  2913. }
  2914. }, {
  2915. key: "NAME",
  2916. get: function get() {
  2917. return NAME$7;
  2918. }
  2919. }, {
  2920. key: "DATA_KEY",
  2921. get: function get() {
  2922. return DATA_KEY$7;
  2923. }
  2924. }, {
  2925. key: "Event",
  2926. get: function get() {
  2927. return Event$1;
  2928. }
  2929. }, {
  2930. key: "EVENT_KEY",
  2931. get: function get() {
  2932. return EVENT_KEY$7;
  2933. }
  2934. }, {
  2935. key: "DefaultType",
  2936. get: function get() {
  2937. return DefaultType$5;
  2938. }
  2939. }]);
  2940. return Popover;
  2941. }(Tooltip);
  2942. /**
  2943. * ------------------------------------------------------------------------
  2944. * jQuery
  2945. * ------------------------------------------------------------------------
  2946. */
  2947. $.fn[NAME$7] = Popover._jQueryInterface;
  2948. $.fn[NAME$7].Constructor = Popover;
  2949. $.fn[NAME$7].noConflict = function () {
  2950. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  2951. return Popover._jQueryInterface;
  2952. };
  2953. /**
  2954. * ------------------------------------------------------------------------
  2955. * Constants
  2956. * ------------------------------------------------------------------------
  2957. */
  2958. var NAME$8 = 'scrollspy';
  2959. var VERSION$8 = '4.5.2';
  2960. var DATA_KEY$8 = 'bs.scrollspy';
  2961. var EVENT_KEY$8 = "." + DATA_KEY$8;
  2962. var DATA_API_KEY$6 = '.data-api';
  2963. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  2964. var Default$6 = {
  2965. offset: 10,
  2966. method: 'auto',
  2967. target: ''
  2968. };
  2969. var DefaultType$6 = {
  2970. offset: 'number',
  2971. method: 'string',
  2972. target: '(string|element)'
  2973. };
  2974. var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
  2975. var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
  2976. var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
  2977. var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  2978. var CLASS_NAME_ACTIVE$2 = 'active';
  2979. var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
  2980. var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  2981. var SELECTOR_NAV_LINKS = '.nav-link';
  2982. var SELECTOR_NAV_ITEMS = '.nav-item';
  2983. var SELECTOR_LIST_ITEMS = '.list-group-item';
  2984. var SELECTOR_DROPDOWN = '.dropdown';
  2985. var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item';
  2986. var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  2987. var METHOD_OFFSET = 'offset';
  2988. var METHOD_POSITION = 'position';
  2989. /**
  2990. * ------------------------------------------------------------------------
  2991. * Class Definition
  2992. * ------------------------------------------------------------------------
  2993. */
  2994. var ScrollSpy = /*#__PURE__*/function () {
  2995. function ScrollSpy(element, config) {
  2996. var _this = this;
  2997. this._element = element;
  2998. this._scrollElement = element.tagName === 'BODY' ? window : element;
  2999. this._config = this._getConfig(config);
  3000. this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS);
  3001. this._offsets = [];
  3002. this._targets = [];
  3003. this._activeTarget = null;
  3004. this._scrollHeight = 0;
  3005. $(this._scrollElement).on(EVENT_SCROLL, function (event) {
  3006. return _this._process(event);
  3007. });
  3008. this.refresh();
  3009. this._process();
  3010. } // Getters
  3011. var _proto = ScrollSpy.prototype;
  3012. // Public
  3013. _proto.refresh = function refresh() {
  3014. var _this2 = this;
  3015. var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
  3016. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  3017. var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
  3018. this._offsets = [];
  3019. this._targets = [];
  3020. this._scrollHeight = this._getScrollHeight();
  3021. var targets = [].slice.call(document.querySelectorAll(this._selector));
  3022. targets.map(function (element) {
  3023. var target;
  3024. var targetSelector = Util.getSelectorFromElement(element);
  3025. if (targetSelector) {
  3026. target = document.querySelector(targetSelector);
  3027. }
  3028. if (target) {
  3029. var targetBCR = target.getBoundingClientRect();
  3030. if (targetBCR.width || targetBCR.height) {
  3031. // TODO (fat): remove sketch reliance on jQuery position/offset
  3032. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  3033. }
  3034. }
  3035. return null;
  3036. }).filter(function (item) {
  3037. return item;
  3038. }).sort(function (a, b) {
  3039. return a[0] - b[0];
  3040. }).forEach(function (item) {
  3041. _this2._offsets.push(item[0]);
  3042. _this2._targets.push(item[1]);
  3043. });
  3044. };
  3045. _proto.dispose = function dispose() {
  3046. $.removeData(this._element, DATA_KEY$8);
  3047. $(this._scrollElement).off(EVENT_KEY$8);
  3048. this._element = null;
  3049. this._scrollElement = null;
  3050. this._config = null;
  3051. this._selector = null;
  3052. this._offsets = null;
  3053. this._targets = null;
  3054. this._activeTarget = null;
  3055. this._scrollHeight = null;
  3056. } // Private
  3057. ;
  3058. _proto._getConfig = function _getConfig(config) {
  3059. config = _extends({}, Default$6, typeof config === 'object' && config ? config : {});
  3060. if (typeof config.target !== 'string' && Util.isElement(config.target)) {
  3061. var id = $(config.target).attr('id');
  3062. if (!id) {
  3063. id = Util.getUID(NAME$8);
  3064. $(config.target).attr('id', id);
  3065. }
  3066. config.target = "#" + id;
  3067. }
  3068. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  3069. return config;
  3070. };
  3071. _proto._getScrollTop = function _getScrollTop() {
  3072. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  3073. };
  3074. _proto._getScrollHeight = function _getScrollHeight() {
  3075. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  3076. };
  3077. _proto._getOffsetHeight = function _getOffsetHeight() {
  3078. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  3079. };
  3080. _proto._process = function _process() {
  3081. var scrollTop = this._getScrollTop() + this._config.offset;
  3082. var scrollHeight = this._getScrollHeight();
  3083. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  3084. if (this._scrollHeight !== scrollHeight) {
  3085. this.refresh();
  3086. }
  3087. if (scrollTop >= maxScroll) {
  3088. var target = this._targets[this._targets.length - 1];
  3089. if (this._activeTarget !== target) {
  3090. this._activate(target);
  3091. }
  3092. return;
  3093. }
  3094. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  3095. this._activeTarget = null;
  3096. this._clear();
  3097. return;
  3098. }
  3099. for (var i = this._offsets.length; i--;) {
  3100. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  3101. if (isActiveTarget) {
  3102. this._activate(this._targets[i]);
  3103. }
  3104. }
  3105. };
  3106. _proto._activate = function _activate(target) {
  3107. this._activeTarget = target;
  3108. this._clear();
  3109. var queries = this._selector.split(',').map(function (selector) {
  3110. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  3111. });
  3112. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  3113. if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) {
  3114. $link.closest(SELECTOR_DROPDOWN).find(SELECTOR_DROPDOWN_TOGGLE).addClass(CLASS_NAME_ACTIVE$2);
  3115. $link.addClass(CLASS_NAME_ACTIVE$2);
  3116. } else {
  3117. // Set triggered link as active
  3118. $link.addClass(CLASS_NAME_ACTIVE$2); // Set triggered links parents as active
  3119. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  3120. $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$2); // Handle special case when .nav-link is inside .nav-item
  3121. $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$2);
  3122. }
  3123. $(this._scrollElement).trigger(EVENT_ACTIVATE, {
  3124. relatedTarget: target
  3125. });
  3126. };
  3127. _proto._clear = function _clear() {
  3128. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  3129. return node.classList.contains(CLASS_NAME_ACTIVE$2);
  3130. }).forEach(function (node) {
  3131. return node.classList.remove(CLASS_NAME_ACTIVE$2);
  3132. });
  3133. } // Static
  3134. ;
  3135. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  3136. return this.each(function () {
  3137. var data = $(this).data(DATA_KEY$8);
  3138. var _config = typeof config === 'object' && config;
  3139. if (!data) {
  3140. data = new ScrollSpy(this, _config);
  3141. $(this).data(DATA_KEY$8, data);
  3142. }
  3143. if (typeof config === 'string') {
  3144. if (typeof data[config] === 'undefined') {
  3145. throw new TypeError("No method named \"" + config + "\"");
  3146. }
  3147. data[config]();
  3148. }
  3149. });
  3150. };
  3151. _createClass(ScrollSpy, null, [{
  3152. key: "VERSION",
  3153. get: function get() {
  3154. return VERSION$8;
  3155. }
  3156. }, {
  3157. key: "Default",
  3158. get: function get() {
  3159. return Default$6;
  3160. }
  3161. }]);
  3162. return ScrollSpy;
  3163. }();
  3164. /**
  3165. * ------------------------------------------------------------------------
  3166. * Data Api implementation
  3167. * ------------------------------------------------------------------------
  3168. */
  3169. $(window).on(EVENT_LOAD_DATA_API$2, function () {
  3170. var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY));
  3171. var scrollSpysLength = scrollSpys.length;
  3172. for (var i = scrollSpysLength; i--;) {
  3173. var $spy = $(scrollSpys[i]);
  3174. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  3175. }
  3176. });
  3177. /**
  3178. * ------------------------------------------------------------------------
  3179. * jQuery
  3180. * ------------------------------------------------------------------------
  3181. */
  3182. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  3183. $.fn[NAME$8].Constructor = ScrollSpy;
  3184. $.fn[NAME$8].noConflict = function () {
  3185. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  3186. return ScrollSpy._jQueryInterface;
  3187. };
  3188. /**
  3189. * ------------------------------------------------------------------------
  3190. * Constants
  3191. * ------------------------------------------------------------------------
  3192. */
  3193. var NAME$9 = 'tab';
  3194. var VERSION$9 = '4.5.2';
  3195. var DATA_KEY$9 = 'bs.tab';
  3196. var EVENT_KEY$9 = "." + DATA_KEY$9;
  3197. var DATA_API_KEY$7 = '.data-api';
  3198. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  3199. var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
  3200. var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
  3201. var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
  3202. var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
  3203. var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
  3204. var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
  3205. var CLASS_NAME_ACTIVE$3 = 'active';
  3206. var CLASS_NAME_DISABLED$1 = 'disabled';
  3207. var CLASS_NAME_FADE$4 = 'fade';
  3208. var CLASS_NAME_SHOW$6 = 'show';
  3209. var SELECTOR_DROPDOWN$1 = '.dropdown';
  3210. var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
  3211. var SELECTOR_ACTIVE$2 = '.active';
  3212. var SELECTOR_ACTIVE_UL = '> li > .active';
  3213. var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
  3214. var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  3215. var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active';
  3216. /**
  3217. * ------------------------------------------------------------------------
  3218. * Class Definition
  3219. * ------------------------------------------------------------------------
  3220. */
  3221. var Tab = /*#__PURE__*/function () {
  3222. function Tab(element) {
  3223. this._element = element;
  3224. } // Getters
  3225. var _proto = Tab.prototype;
  3226. // Public
  3227. _proto.show = function show() {
  3228. var _this = this;
  3229. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(CLASS_NAME_ACTIVE$3) || $(this._element).hasClass(CLASS_NAME_DISABLED$1)) {
  3230. return;
  3231. }
  3232. var target;
  3233. var previous;
  3234. var listElement = $(this._element).closest(SELECTOR_NAV_LIST_GROUP$1)[0];
  3235. var selector = Util.getSelectorFromElement(this._element);
  3236. if (listElement) {
  3237. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2;
  3238. previous = $.makeArray($(listElement).find(itemSelector));
  3239. previous = previous[previous.length - 1];
  3240. }
  3241. var hideEvent = $.Event(EVENT_HIDE$3, {
  3242. relatedTarget: this._element
  3243. });
  3244. var showEvent = $.Event(EVENT_SHOW$3, {
  3245. relatedTarget: previous
  3246. });
  3247. if (previous) {
  3248. $(previous).trigger(hideEvent);
  3249. }
  3250. $(this._element).trigger(showEvent);
  3251. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  3252. return;
  3253. }
  3254. if (selector) {
  3255. target = document.querySelector(selector);
  3256. }
  3257. this._activate(this._element, listElement);
  3258. var complete = function complete() {
  3259. var hiddenEvent = $.Event(EVENT_HIDDEN$3, {
  3260. relatedTarget: _this._element
  3261. });
  3262. var shownEvent = $.Event(EVENT_SHOWN$3, {
  3263. relatedTarget: previous
  3264. });
  3265. $(previous).trigger(hiddenEvent);
  3266. $(_this._element).trigger(shownEvent);
  3267. };
  3268. if (target) {
  3269. this._activate(target, target.parentNode, complete);
  3270. } else {
  3271. complete();
  3272. }
  3273. };
  3274. _proto.dispose = function dispose() {
  3275. $.removeData(this._element, DATA_KEY$9);
  3276. this._element = null;
  3277. } // Private
  3278. ;
  3279. _proto._activate = function _activate(element, container, callback) {
  3280. var _this2 = this;
  3281. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(SELECTOR_ACTIVE_UL) : $(container).children(SELECTOR_ACTIVE$2);
  3282. var active = activeElements[0];
  3283. var isTransitioning = callback && active && $(active).hasClass(CLASS_NAME_FADE$4);
  3284. var complete = function complete() {
  3285. return _this2._transitionComplete(element, active, callback);
  3286. };
  3287. if (active && isTransitioning) {
  3288. var transitionDuration = Util.getTransitionDurationFromElement(active);
  3289. $(active).removeClass(CLASS_NAME_SHOW$6).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3290. } else {
  3291. complete();
  3292. }
  3293. };
  3294. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  3295. if (active) {
  3296. $(active).removeClass(CLASS_NAME_ACTIVE$3);
  3297. var dropdownChild = $(active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0];
  3298. if (dropdownChild) {
  3299. $(dropdownChild).removeClass(CLASS_NAME_ACTIVE$3);
  3300. }
  3301. if (active.getAttribute('role') === 'tab') {
  3302. active.setAttribute('aria-selected', false);
  3303. }
  3304. }
  3305. $(element).addClass(CLASS_NAME_ACTIVE$3);
  3306. if (element.getAttribute('role') === 'tab') {
  3307. element.setAttribute('aria-selected', true);
  3308. }
  3309. Util.reflow(element);
  3310. if (element.classList.contains(CLASS_NAME_FADE$4)) {
  3311. element.classList.add(CLASS_NAME_SHOW$6);
  3312. }
  3313. if (element.parentNode && $(element.parentNode).hasClass(CLASS_NAME_DROPDOWN_MENU)) {
  3314. var dropdownElement = $(element).closest(SELECTOR_DROPDOWN$1)[0];
  3315. if (dropdownElement) {
  3316. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE$1));
  3317. $(dropdownToggleList).addClass(CLASS_NAME_ACTIVE$3);
  3318. }
  3319. element.setAttribute('aria-expanded', true);
  3320. }
  3321. if (callback) {
  3322. callback();
  3323. }
  3324. } // Static
  3325. ;
  3326. Tab._jQueryInterface = function _jQueryInterface(config) {
  3327. return this.each(function () {
  3328. var $this = $(this);
  3329. var data = $this.data(DATA_KEY$9);
  3330. if (!data) {
  3331. data = new Tab(this);
  3332. $this.data(DATA_KEY$9, data);
  3333. }
  3334. if (typeof config === 'string') {
  3335. if (typeof data[config] === 'undefined') {
  3336. throw new TypeError("No method named \"" + config + "\"");
  3337. }
  3338. data[config]();
  3339. }
  3340. });
  3341. };
  3342. _createClass(Tab, null, [{
  3343. key: "VERSION",
  3344. get: function get() {
  3345. return VERSION$9;
  3346. }
  3347. }]);
  3348. return Tab;
  3349. }();
  3350. /**
  3351. * ------------------------------------------------------------------------
  3352. * Data Api implementation
  3353. * ------------------------------------------------------------------------
  3354. */
  3355. $(document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
  3356. event.preventDefault();
  3357. Tab._jQueryInterface.call($(this), 'show');
  3358. });
  3359. /**
  3360. * ------------------------------------------------------------------------
  3361. * jQuery
  3362. * ------------------------------------------------------------------------
  3363. */
  3364. $.fn[NAME$9] = Tab._jQueryInterface;
  3365. $.fn[NAME$9].Constructor = Tab;
  3366. $.fn[NAME$9].noConflict = function () {
  3367. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  3368. return Tab._jQueryInterface;
  3369. };
  3370. /**
  3371. * ------------------------------------------------------------------------
  3372. * Constants
  3373. * ------------------------------------------------------------------------
  3374. */
  3375. var NAME$a = 'toast';
  3376. var VERSION$a = '4.5.2';
  3377. var DATA_KEY$a = 'bs.toast';
  3378. var EVENT_KEY$a = "." + DATA_KEY$a;
  3379. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  3380. var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
  3381. var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
  3382. var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
  3383. var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
  3384. var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
  3385. var CLASS_NAME_FADE$5 = 'fade';
  3386. var CLASS_NAME_HIDE = 'hide';
  3387. var CLASS_NAME_SHOW$7 = 'show';
  3388. var CLASS_NAME_SHOWING = 'showing';
  3389. var DefaultType$7 = {
  3390. animation: 'boolean',
  3391. autohide: 'boolean',
  3392. delay: 'number'
  3393. };
  3394. var Default$7 = {
  3395. animation: true,
  3396. autohide: true,
  3397. delay: 500
  3398. };
  3399. var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
  3400. /**
  3401. * ------------------------------------------------------------------------
  3402. * Class Definition
  3403. * ------------------------------------------------------------------------
  3404. */
  3405. var Toast = /*#__PURE__*/function () {
  3406. function Toast(element, config) {
  3407. this._element = element;
  3408. this._config = this._getConfig(config);
  3409. this._timeout = null;
  3410. this._setListeners();
  3411. } // Getters
  3412. var _proto = Toast.prototype;
  3413. // Public
  3414. _proto.show = function show() {
  3415. var _this = this;
  3416. var showEvent = $.Event(EVENT_SHOW$4);
  3417. $(this._element).trigger(showEvent);
  3418. if (showEvent.isDefaultPrevented()) {
  3419. return;
  3420. }
  3421. this._clearTimeout();
  3422. if (this._config.animation) {
  3423. this._element.classList.add(CLASS_NAME_FADE$5);
  3424. }
  3425. var complete = function complete() {
  3426. _this._element.classList.remove(CLASS_NAME_SHOWING);
  3427. _this._element.classList.add(CLASS_NAME_SHOW$7);
  3428. $(_this._element).trigger(EVENT_SHOWN$4);
  3429. if (_this._config.autohide) {
  3430. _this._timeout = setTimeout(function () {
  3431. _this.hide();
  3432. }, _this._config.delay);
  3433. }
  3434. };
  3435. this._element.classList.remove(CLASS_NAME_HIDE);
  3436. Util.reflow(this._element);
  3437. this._element.classList.add(CLASS_NAME_SHOWING);
  3438. if (this._config.animation) {
  3439. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3440. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3441. } else {
  3442. complete();
  3443. }
  3444. };
  3445. _proto.hide = function hide() {
  3446. if (!this._element.classList.contains(CLASS_NAME_SHOW$7)) {
  3447. return;
  3448. }
  3449. var hideEvent = $.Event(EVENT_HIDE$4);
  3450. $(this._element).trigger(hideEvent);
  3451. if (hideEvent.isDefaultPrevented()) {
  3452. return;
  3453. }
  3454. this._close();
  3455. };
  3456. _proto.dispose = function dispose() {
  3457. this._clearTimeout();
  3458. if (this._element.classList.contains(CLASS_NAME_SHOW$7)) {
  3459. this._element.classList.remove(CLASS_NAME_SHOW$7);
  3460. }
  3461. $(this._element).off(EVENT_CLICK_DISMISS$1);
  3462. $.removeData(this._element, DATA_KEY$a);
  3463. this._element = null;
  3464. this._config = null;
  3465. } // Private
  3466. ;
  3467. _proto._getConfig = function _getConfig(config) {
  3468. config = _extends({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {});
  3469. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  3470. return config;
  3471. };
  3472. _proto._setListeners = function _setListeners() {
  3473. var _this2 = this;
  3474. $(this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
  3475. return _this2.hide();
  3476. });
  3477. };
  3478. _proto._close = function _close() {
  3479. var _this3 = this;
  3480. var complete = function complete() {
  3481. _this3._element.classList.add(CLASS_NAME_HIDE);
  3482. $(_this3._element).trigger(EVENT_HIDDEN$4);
  3483. };
  3484. this._element.classList.remove(CLASS_NAME_SHOW$7);
  3485. if (this._config.animation) {
  3486. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3487. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3488. } else {
  3489. complete();
  3490. }
  3491. };
  3492. _proto._clearTimeout = function _clearTimeout() {
  3493. clearTimeout(this._timeout);
  3494. this._timeout = null;
  3495. } // Static
  3496. ;
  3497. Toast._jQueryInterface = function _jQueryInterface(config) {
  3498. return this.each(function () {
  3499. var $element = $(this);
  3500. var data = $element.data(DATA_KEY$a);
  3501. var _config = typeof config === 'object' && config;
  3502. if (!data) {
  3503. data = new Toast(this, _config);
  3504. $element.data(DATA_KEY$a, data);
  3505. }
  3506. if (typeof config === 'string') {
  3507. if (typeof data[config] === 'undefined') {
  3508. throw new TypeError("No method named \"" + config + "\"");
  3509. }
  3510. data[config](this);
  3511. }
  3512. });
  3513. };
  3514. _createClass(Toast, null, [{
  3515. key: "VERSION",
  3516. get: function get() {
  3517. return VERSION$a;
  3518. }
  3519. }, {
  3520. key: "DefaultType",
  3521. get: function get() {
  3522. return DefaultType$7;
  3523. }
  3524. }, {
  3525. key: "Default",
  3526. get: function get() {
  3527. return Default$7;
  3528. }
  3529. }]);
  3530. return Toast;
  3531. }();
  3532. /**
  3533. * ------------------------------------------------------------------------
  3534. * jQuery
  3535. * ------------------------------------------------------------------------
  3536. */
  3537. $.fn[NAME$a] = Toast._jQueryInterface;
  3538. $.fn[NAME$a].Constructor = Toast;
  3539. $.fn[NAME$a].noConflict = function () {
  3540. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  3541. return Toast._jQueryInterface;
  3542. };
  3543. exports.Alert = Alert;
  3544. exports.Button = Button;
  3545. exports.Carousel = Carousel;
  3546. exports.Collapse = Collapse;
  3547. exports.Dropdown = Dropdown;
  3548. exports.Modal = Modal;
  3549. exports.Popover = Popover;
  3550. exports.Scrollspy = ScrollSpy;
  3551. exports.Tab = Tab;
  3552. exports.Toast = Toast;
  3553. exports.Tooltip = Tooltip;
  3554. exports.Util = Util;
  3555. Object.defineProperty(exports, '__esModule', { value: true });
  3556. })));
  3557. //# sourceMappingURL=bootstrap.js.map