NoteOnMe博客平台搭建
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

7013 rindas
218 KiB

pirms 3 gadiem
  1. /*!
  2. * Bootstrap v4.3.1 (https://getbootstrap.com/)
  3. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) :
  8. typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) :
  9. (global = global || self, factory(global.bootstrap = {}, global.jQuery));
  10. }(this, function (exports, $) { 'use strict';
  11. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  12. function _defineProperties(target, props) {
  13. for (var i = 0; i < props.length; i++) {
  14. var descriptor = props[i];
  15. descriptor.enumerable = descriptor.enumerable || false;
  16. descriptor.configurable = true;
  17. if ("value" in descriptor) descriptor.writable = true;
  18. Object.defineProperty(target, descriptor.key, descriptor);
  19. }
  20. }
  21. function _createClass(Constructor, protoProps, staticProps) {
  22. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  23. if (staticProps) _defineProperties(Constructor, staticProps);
  24. return Constructor;
  25. }
  26. function _defineProperty(obj, key, value) {
  27. if (key in obj) {
  28. Object.defineProperty(obj, key, {
  29. value: value,
  30. enumerable: true,
  31. configurable: true,
  32. writable: true
  33. });
  34. } else {
  35. obj[key] = value;
  36. }
  37. return obj;
  38. }
  39. function _objectSpread(target) {
  40. for (var i = 1; i < arguments.length; i++) {
  41. var source = arguments[i] != null ? arguments[i] : {};
  42. var ownKeys = Object.keys(source);
  43. if (typeof Object.getOwnPropertySymbols === 'function') {
  44. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
  45. return Object.getOwnPropertyDescriptor(source, sym).enumerable;
  46. }));
  47. }
  48. ownKeys.forEach(function (key) {
  49. _defineProperty(target, key, source[key]);
  50. });
  51. }
  52. return target;
  53. }
  54. function _inheritsLoose(subClass, superClass) {
  55. subClass.prototype = Object.create(superClass.prototype);
  56. subClass.prototype.constructor = subClass;
  57. subClass.__proto__ = superClass;
  58. }
  59. /**
  60. * --------------------------------------------------------------------------
  61. * Bootstrap (v4.3.1): util.js
  62. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  63. * --------------------------------------------------------------------------
  64. */
  65. /**
  66. * ------------------------------------------------------------------------
  67. * Private TransitionEnd Helpers
  68. * ------------------------------------------------------------------------
  69. */
  70. var TRANSITION_END = 'transitionend';
  71. var MAX_UID = 1000000;
  72. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  73. function toType(obj) {
  74. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  75. }
  76. function getSpecialTransitionEndEvent() {
  77. return {
  78. bindType: TRANSITION_END,
  79. delegateType: TRANSITION_END,
  80. handle: function handle(event) {
  81. if ($(event.target).is(this)) {
  82. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  83. }
  84. return undefined; // eslint-disable-line no-undefined
  85. }
  86. };
  87. }
  88. function transitionEndEmulator(duration) {
  89. var _this = this;
  90. var called = false;
  91. $(this).one(Util.TRANSITION_END, function () {
  92. called = true;
  93. });
  94. setTimeout(function () {
  95. if (!called) {
  96. Util.triggerTransitionEnd(_this);
  97. }
  98. }, duration);
  99. return this;
  100. }
  101. function setTransitionEndSupport() {
  102. $.fn.emulateTransitionEnd = transitionEndEmulator;
  103. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  104. }
  105. /**
  106. * --------------------------------------------------------------------------
  107. * Public Util Api
  108. * --------------------------------------------------------------------------
  109. */
  110. var Util = {
  111. TRANSITION_END: 'bsTransitionEnd',
  112. getUID: function getUID(prefix) {
  113. do {
  114. // eslint-disable-next-line no-bitwise
  115. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  116. } while (document.getElementById(prefix));
  117. return prefix;
  118. },
  119. getSelectorFromElement: function getSelectorFromElement(element) {
  120. var selector = element.getAttribute('data-target');
  121. if (!selector || selector === '#') {
  122. var hrefAttr = element.getAttribute('href');
  123. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  124. }
  125. try {
  126. return document.querySelector(selector) ? selector : null;
  127. } catch (err) {
  128. return null;
  129. }
  130. },
  131. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  132. if (!element) {
  133. return 0;
  134. } // Get transition-duration of the element
  135. var transitionDuration = $(element).css('transition-duration');
  136. var transitionDelay = $(element).css('transition-delay');
  137. var floatTransitionDuration = parseFloat(transitionDuration);
  138. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  139. if (!floatTransitionDuration && !floatTransitionDelay) {
  140. return 0;
  141. } // If multiple durations are defined, take the first
  142. transitionDuration = transitionDuration.split(',')[0];
  143. transitionDelay = transitionDelay.split(',')[0];
  144. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  145. },
  146. reflow: function reflow(element) {
  147. return element.offsetHeight;
  148. },
  149. triggerTransitionEnd: function triggerTransitionEnd(element) {
  150. $(element).trigger(TRANSITION_END);
  151. },
  152. // TODO: Remove in v5
  153. supportsTransitionEnd: function supportsTransitionEnd() {
  154. return Boolean(TRANSITION_END);
  155. },
  156. isElement: function isElement(obj) {
  157. return (obj[0] || obj).nodeType;
  158. },
  159. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  160. for (var property in configTypes) {
  161. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  162. var expectedTypes = configTypes[property];
  163. var value = config[property];
  164. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  165. if (!new RegExp(expectedTypes).test(valueType)) {
  166. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  167. }
  168. }
  169. }
  170. },
  171. findShadowRoot: function findShadowRoot(element) {
  172. if (!document.documentElement.attachShadow) {
  173. return null;
  174. } // Can find the shadow root otherwise it'll return the document
  175. if (typeof element.getRootNode === 'function') {
  176. var root = element.getRootNode();
  177. return root instanceof ShadowRoot ? root : null;
  178. }
  179. if (element instanceof ShadowRoot) {
  180. return element;
  181. } // when we don't find a shadow root
  182. if (!element.parentNode) {
  183. return null;
  184. }
  185. return Util.findShadowRoot(element.parentNode);
  186. }
  187. };
  188. setTransitionEndSupport();
  189. /**
  190. * ------------------------------------------------------------------------
  191. * Constants
  192. * ------------------------------------------------------------------------
  193. */
  194. var NAME = 'alert';
  195. var VERSION = '4.3.1';
  196. var DATA_KEY = 'bs.alert';
  197. var EVENT_KEY = "." + DATA_KEY;
  198. var DATA_API_KEY = '.data-api';
  199. var JQUERY_NO_CONFLICT = $.fn[NAME];
  200. var Selector = {
  201. DISMISS: '[data-dismiss="alert"]'
  202. };
  203. var Event = {
  204. CLOSE: "close" + EVENT_KEY,
  205. CLOSED: "closed" + EVENT_KEY,
  206. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  207. };
  208. var ClassName = {
  209. ALERT: 'alert',
  210. FADE: 'fade',
  211. SHOW: 'show'
  212. /**
  213. * ------------------------------------------------------------------------
  214. * Class Definition
  215. * ------------------------------------------------------------------------
  216. */
  217. };
  218. var Alert =
  219. /*#__PURE__*/
  220. function () {
  221. function Alert(element) {
  222. this._element = element;
  223. } // Getters
  224. var _proto = Alert.prototype;
  225. // Public
  226. _proto.close = function close(element) {
  227. var rootElement = this._element;
  228. if (element) {
  229. rootElement = this._getRootElement(element);
  230. }
  231. var customEvent = this._triggerCloseEvent(rootElement);
  232. if (customEvent.isDefaultPrevented()) {
  233. return;
  234. }
  235. this._removeElement(rootElement);
  236. };
  237. _proto.dispose = function dispose() {
  238. $.removeData(this._element, DATA_KEY);
  239. this._element = null;
  240. } // Private
  241. ;
  242. _proto._getRootElement = function _getRootElement(element) {
  243. var selector = Util.getSelectorFromElement(element);
  244. var parent = false;
  245. if (selector) {
  246. parent = document.querySelector(selector);
  247. }
  248. if (!parent) {
  249. parent = $(element).closest("." + ClassName.ALERT)[0];
  250. }
  251. return parent;
  252. };
  253. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  254. var closeEvent = $.Event(Event.CLOSE);
  255. $(element).trigger(closeEvent);
  256. return closeEvent;
  257. };
  258. _proto._removeElement = function _removeElement(element) {
  259. var _this = this;
  260. $(element).removeClass(ClassName.SHOW);
  261. if (!$(element).hasClass(ClassName.FADE)) {
  262. this._destroyElement(element);
  263. return;
  264. }
  265. var transitionDuration = Util.getTransitionDurationFromElement(element);
  266. $(element).one(Util.TRANSITION_END, function (event) {
  267. return _this._destroyElement(element, event);
  268. }).emulateTransitionEnd(transitionDuration);
  269. };
  270. _proto._destroyElement = function _destroyElement(element) {
  271. $(element).detach().trigger(Event.CLOSED).remove();
  272. } // Static
  273. ;
  274. Alert._jQueryInterface = function _jQueryInterface(config) {
  275. return this.each(function () {
  276. var $element = $(this);
  277. var data = $element.data(DATA_KEY);
  278. if (!data) {
  279. data = new Alert(this);
  280. $element.data(DATA_KEY, data);
  281. }
  282. if (config === 'close') {
  283. data[config](this);
  284. }
  285. });
  286. };
  287. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  288. return function (event) {
  289. if (event) {
  290. event.preventDefault();
  291. }
  292. alertInstance.close(this);
  293. };
  294. };
  295. _createClass(Alert, null, [{
  296. key: "VERSION",
  297. get: function get() {
  298. return VERSION;
  299. }
  300. }]);
  301. return Alert;
  302. }();
  303. /**
  304. * ------------------------------------------------------------------------
  305. * Data Api implementation
  306. * ------------------------------------------------------------------------
  307. */
  308. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  309. /**
  310. * ------------------------------------------------------------------------
  311. * jQuery
  312. * ------------------------------------------------------------------------
  313. */
  314. $.fn[NAME] = Alert._jQueryInterface;
  315. $.fn[NAME].Constructor = Alert;
  316. $.fn[NAME].noConflict = function () {
  317. $.fn[NAME] = JQUERY_NO_CONFLICT;
  318. return Alert._jQueryInterface;
  319. };
  320. /**
  321. * ------------------------------------------------------------------------
  322. * Constants
  323. * ------------------------------------------------------------------------
  324. */
  325. var NAME$1 = 'button';
  326. var VERSION$1 = '4.3.1';
  327. var DATA_KEY$1 = 'bs.button';
  328. var EVENT_KEY$1 = "." + DATA_KEY$1;
  329. var DATA_API_KEY$1 = '.data-api';
  330. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  331. var ClassName$1 = {
  332. ACTIVE: 'active',
  333. BUTTON: 'btn',
  334. FOCUS: 'focus'
  335. };
  336. var Selector$1 = {
  337. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  338. DATA_TOGGLE: '[data-toggle="buttons"]',
  339. INPUT: 'input:not([type="hidden"])',
  340. ACTIVE: '.active',
  341. BUTTON: '.btn'
  342. };
  343. var Event$1 = {
  344. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  345. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1)
  346. /**
  347. * ------------------------------------------------------------------------
  348. * Class Definition
  349. * ------------------------------------------------------------------------
  350. */
  351. };
  352. var Button =
  353. /*#__PURE__*/
  354. function () {
  355. function Button(element) {
  356. this._element = element;
  357. } // Getters
  358. var _proto = Button.prototype;
  359. // Public
  360. _proto.toggle = function toggle() {
  361. var triggerChangeEvent = true;
  362. var addAriaPressed = true;
  363. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLE)[0];
  364. if (rootElement) {
  365. var input = this._element.querySelector(Selector$1.INPUT);
  366. if (input) {
  367. if (input.type === 'radio') {
  368. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  369. triggerChangeEvent = false;
  370. } else {
  371. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  372. if (activeElement) {
  373. $(activeElement).removeClass(ClassName$1.ACTIVE);
  374. }
  375. }
  376. }
  377. if (triggerChangeEvent) {
  378. if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
  379. return;
  380. }
  381. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  382. $(input).trigger('change');
  383. }
  384. input.focus();
  385. addAriaPressed = false;
  386. }
  387. }
  388. if (addAriaPressed) {
  389. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  390. }
  391. if (triggerChangeEvent) {
  392. $(this._element).toggleClass(ClassName$1.ACTIVE);
  393. }
  394. };
  395. _proto.dispose = function dispose() {
  396. $.removeData(this._element, DATA_KEY$1);
  397. this._element = null;
  398. } // Static
  399. ;
  400. Button._jQueryInterface = function _jQueryInterface(config) {
  401. return this.each(function () {
  402. var data = $(this).data(DATA_KEY$1);
  403. if (!data) {
  404. data = new Button(this);
  405. $(this).data(DATA_KEY$1, data);
  406. }
  407. if (config === 'toggle') {
  408. data[config]();
  409. }
  410. });
  411. };
  412. _createClass(Button, null, [{
  413. key: "VERSION",
  414. get: function get() {
  415. return VERSION$1;
  416. }
  417. }]);
  418. return Button;
  419. }();
  420. /**
  421. * ------------------------------------------------------------------------
  422. * Data Api implementation
  423. * ------------------------------------------------------------------------
  424. */
  425. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  426. event.preventDefault();
  427. var button = event.target;
  428. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  429. button = $(button).closest(Selector$1.BUTTON);
  430. }
  431. Button._jQueryInterface.call($(button), 'toggle');
  432. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  433. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  434. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  435. });
  436. /**
  437. * ------------------------------------------------------------------------
  438. * jQuery
  439. * ------------------------------------------------------------------------
  440. */
  441. $.fn[NAME$1] = Button._jQueryInterface;
  442. $.fn[NAME$1].Constructor = Button;
  443. $.fn[NAME$1].noConflict = function () {
  444. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  445. return Button._jQueryInterface;
  446. };
  447. /**
  448. * ------------------------------------------------------------------------
  449. * Constants
  450. * ------------------------------------------------------------------------
  451. */
  452. var NAME$2 = 'carousel';
  453. var VERSION$2 = '4.3.1';
  454. var DATA_KEY$2 = 'bs.carousel';
  455. var EVENT_KEY$2 = "." + DATA_KEY$2;
  456. var DATA_API_KEY$2 = '.data-api';
  457. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  458. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  459. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  460. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  461. var SWIPE_THRESHOLD = 40;
  462. var Default = {
  463. interval: 5000,
  464. keyboard: true,
  465. slide: false,
  466. pause: 'hover',
  467. wrap: true,
  468. touch: true
  469. };
  470. var DefaultType = {
  471. interval: '(number|boolean)',
  472. keyboard: 'boolean',
  473. slide: '(boolean|string)',
  474. pause: '(string|boolean)',
  475. wrap: 'boolean',
  476. touch: 'boolean'
  477. };
  478. var Direction = {
  479. NEXT: 'next',
  480. PREV: 'prev',
  481. LEFT: 'left',
  482. RIGHT: 'right'
  483. };
  484. var Event$2 = {
  485. SLIDE: "slide" + EVENT_KEY$2,
  486. SLID: "slid" + EVENT_KEY$2,
  487. KEYDOWN: "keydown" + EVENT_KEY$2,
  488. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  489. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  490. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  491. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  492. TOUCHEND: "touchend" + EVENT_KEY$2,
  493. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  494. POINTERUP: "pointerup" + EVENT_KEY$2,
  495. DRAG_START: "dragstart" + EVENT_KEY$2,
  496. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  497. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  498. };
  499. var ClassName$2 = {
  500. CAROUSEL: 'carousel',
  501. ACTIVE: 'active',
  502. SLIDE: 'slide',
  503. RIGHT: 'carousel-item-right',
  504. LEFT: 'carousel-item-left',
  505. NEXT: 'carousel-item-next',
  506. PREV: 'carousel-item-prev',
  507. ITEM: 'carousel-item',
  508. POINTER_EVENT: 'pointer-event'
  509. };
  510. var Selector$2 = {
  511. ACTIVE: '.active',
  512. ACTIVE_ITEM: '.active.carousel-item',
  513. ITEM: '.carousel-item',
  514. ITEM_IMG: '.carousel-item img',
  515. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  516. INDICATORS: '.carousel-indicators',
  517. DATA_SLIDE: '[data-slide], [data-slide-to]',
  518. DATA_RIDE: '[data-ride="carousel"]'
  519. };
  520. var PointerType = {
  521. TOUCH: 'touch',
  522. PEN: 'pen'
  523. /**
  524. * ------------------------------------------------------------------------
  525. * Class Definition
  526. * ------------------------------------------------------------------------
  527. */
  528. };
  529. var Carousel =
  530. /*#__PURE__*/
  531. function () {
  532. function Carousel(element, config) {
  533. this._items = null;
  534. this._interval = null;
  535. this._activeElement = null;
  536. this._isPaused = false;
  537. this._isSliding = false;
  538. this.touchTimeout = null;
  539. this.touchStartX = 0;
  540. this.touchDeltaX = 0;
  541. this._config = this._getConfig(config);
  542. this._element = element;
  543. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  544. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  545. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  546. this._addEventListeners();
  547. } // Getters
  548. var _proto = Carousel.prototype;
  549. // Public
  550. _proto.next = function next() {
  551. if (!this._isSliding) {
  552. this._slide(Direction.NEXT);
  553. }
  554. };
  555. _proto.nextWhenVisible = function nextWhenVisible() {
  556. // Don't call next when the page isn't visible
  557. // or the carousel or its parent isn't visible
  558. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  559. this.next();
  560. }
  561. };
  562. _proto.prev = function prev() {
  563. if (!this._isSliding) {
  564. this._slide(Direction.PREV);
  565. }
  566. };
  567. _proto.pause = function pause(event) {
  568. if (!event) {
  569. this._isPaused = true;
  570. }
  571. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  572. Util.triggerTransitionEnd(this._element);
  573. this.cycle(true);
  574. }
  575. clearInterval(this._interval);
  576. this._interval = null;
  577. };
  578. _proto.cycle = function cycle(event) {
  579. if (!event) {
  580. this._isPaused = false;
  581. }
  582. if (this._interval) {
  583. clearInterval(this._interval);
  584. this._interval = null;
  585. }
  586. if (this._config.interval && !this._isPaused) {
  587. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  588. }
  589. };
  590. _proto.to = function to(index) {
  591. var _this = this;
  592. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  593. var activeIndex = this._getItemIndex(this._activeElement);
  594. if (index > this._items.length - 1 || index < 0) {
  595. return;
  596. }
  597. if (this._isSliding) {
  598. $(this._element).one(Event$2.SLID, function () {
  599. return _this.to(index);
  600. });
  601. return;
  602. }
  603. if (activeIndex === index) {
  604. this.pause();
  605. this.cycle();
  606. return;
  607. }
  608. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  609. this._slide(direction, this._items[index]);
  610. };
  611. _proto.dispose = function dispose() {
  612. $(this._element).off(EVENT_KEY$2);
  613. $.removeData(this._element, DATA_KEY$2);
  614. this._items = null;
  615. this._config = null;
  616. this._element = null;
  617. this._interval = null;
  618. this._isPaused = null;
  619. this._isSliding = null;
  620. this._activeElement = null;
  621. this._indicatorsElement = null;
  622. } // Private
  623. ;
  624. _proto._getConfig = function _getConfig(config) {
  625. config = _objectSpread({}, Default, config);
  626. Util.typeCheckConfig(NAME$2, config, DefaultType);
  627. return config;
  628. };
  629. _proto._handleSwipe = function _handleSwipe() {
  630. var absDeltax = Math.abs(this.touchDeltaX);
  631. if (absDeltax <= SWIPE_THRESHOLD) {
  632. return;
  633. }
  634. var direction = absDeltax / this.touchDeltaX; // swipe left
  635. if (direction > 0) {
  636. this.prev();
  637. } // swipe right
  638. if (direction < 0) {
  639. this.next();
  640. }
  641. };
  642. _proto._addEventListeners = function _addEventListeners() {
  643. var _this2 = this;
  644. if (this._config.keyboard) {
  645. $(this._element).on(Event$2.KEYDOWN, function (event) {
  646. return _this2._keydown(event);
  647. });
  648. }
  649. if (this._config.pause === 'hover') {
  650. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  651. return _this2.pause(event);
  652. }).on(Event$2.MOUSELEAVE, function (event) {
  653. return _this2.cycle(event);
  654. });
  655. }
  656. if (this._config.touch) {
  657. this._addTouchEventListeners();
  658. }
  659. };
  660. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  661. var _this3 = this;
  662. if (!this._touchSupported) {
  663. return;
  664. }
  665. var start = function start(event) {
  666. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  667. _this3.touchStartX = event.originalEvent.clientX;
  668. } else if (!_this3._pointerEvent) {
  669. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  670. }
  671. };
  672. var move = function move(event) {
  673. // ensure swiping with one touch and not pinching
  674. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  675. _this3.touchDeltaX = 0;
  676. } else {
  677. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  678. }
  679. };
  680. var end = function end(event) {
  681. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  682. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  683. }
  684. _this3._handleSwipe();
  685. if (_this3._config.pause === 'hover') {
  686. // If it's a touch-enabled device, mouseenter/leave are fired as
  687. // part of the mouse compatibility events on first tap - the carousel
  688. // would stop cycling until user tapped out of it;
  689. // here, we listen for touchend, explicitly pause the carousel
  690. // (as if it's the second time we tap on it, mouseenter compat event
  691. // is NOT fired) and after a timeout (to allow for mouse compatibility
  692. // events to fire) we explicitly restart cycling
  693. _this3.pause();
  694. if (_this3.touchTimeout) {
  695. clearTimeout(_this3.touchTimeout);
  696. }
  697. _this3.touchTimeout = setTimeout(function (event) {
  698. return _this3.cycle(event);
  699. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  700. }
  701. };
  702. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  703. return e.preventDefault();
  704. });
  705. if (this._pointerEvent) {
  706. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  707. return start(event);
  708. });
  709. $(this._element).on(Event$2.POINTERUP, function (event) {
  710. return end(event);
  711. });
  712. this._element.classList.add(ClassName$2.POINTER_EVENT);
  713. } else {
  714. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  715. return start(event);
  716. });
  717. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  718. return move(event);
  719. });
  720. $(this._element).on(Event$2.TOUCHEND, function (event) {
  721. return end(event);
  722. });
  723. }
  724. };
  725. _proto._keydown = function _keydown(event) {
  726. if (/input|textarea/i.test(event.target.tagName)) {
  727. return;
  728. }
  729. switch (event.which) {
  730. case ARROW_LEFT_KEYCODE:
  731. event.preventDefault();
  732. this.prev();
  733. break;
  734. case ARROW_RIGHT_KEYCODE:
  735. event.preventDefault();
  736. this.next();
  737. break;
  738. default:
  739. }
  740. };
  741. _proto._getItemIndex = function _getItemIndex(element) {
  742. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  743. return this._items.indexOf(element);
  744. };
  745. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  746. var isNextDirection = direction === Direction.NEXT;
  747. var isPrevDirection = direction === Direction.PREV;
  748. var activeIndex = this._getItemIndex(activeElement);
  749. var lastItemIndex = this._items.length - 1;
  750. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  751. if (isGoingToWrap && !this._config.wrap) {
  752. return activeElement;
  753. }
  754. var delta = direction === Direction.PREV ? -1 : 1;
  755. var itemIndex = (activeIndex + delta) % this._items.length;
  756. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  757. };
  758. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  759. var targetIndex = this._getItemIndex(relatedTarget);
  760. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  761. var slideEvent = $.Event(Event$2.SLIDE, {
  762. relatedTarget: relatedTarget,
  763. direction: eventDirectionName,
  764. from: fromIndex,
  765. to: targetIndex
  766. });
  767. $(this._element).trigger(slideEvent);
  768. return slideEvent;
  769. };
  770. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  771. if (this._indicatorsElement) {
  772. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  773. $(indicators).removeClass(ClassName$2.ACTIVE);
  774. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  775. if (nextIndicator) {
  776. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  777. }
  778. }
  779. };
  780. _proto._slide = function _slide(direction, element) {
  781. var _this4 = this;
  782. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  783. var activeElementIndex = this._getItemIndex(activeElement);
  784. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  785. var nextElementIndex = this._getItemIndex(nextElement);
  786. var isCycling = Boolean(this._interval);
  787. var directionalClassName;
  788. var orderClassName;
  789. var eventDirectionName;
  790. if (direction === Direction.NEXT) {
  791. directionalClassName = ClassName$2.LEFT;
  792. orderClassName = ClassName$2.NEXT;
  793. eventDirectionName = Direction.LEFT;
  794. } else {
  795. directionalClassName = ClassName$2.RIGHT;
  796. orderClassName = ClassName$2.PREV;
  797. eventDirectionName = Direction.RIGHT;
  798. }
  799. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  800. this._isSliding = false;
  801. return;
  802. }
  803. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  804. if (slideEvent.isDefaultPrevented()) {
  805. return;
  806. }
  807. if (!activeElement || !nextElement) {
  808. // Some weirdness is happening, so we bail
  809. return;
  810. }
  811. this._isSliding = true;
  812. if (isCycling) {
  813. this.pause();
  814. }
  815. this._setActiveIndicatorElement(nextElement);
  816. var slidEvent = $.Event(Event$2.SLID, {
  817. relatedTarget: nextElement,
  818. direction: eventDirectionName,
  819. from: activeElementIndex,
  820. to: nextElementIndex
  821. });
  822. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  823. $(nextElement).addClass(orderClassName);
  824. Util.reflow(nextElement);
  825. $(activeElement).addClass(directionalClassName);
  826. $(nextElement).addClass(directionalClassName);
  827. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  828. if (nextElementInterval) {
  829. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  830. this._config.interval = nextElementInterval;
  831. } else {
  832. this._config.interval = this._config.defaultInterval || this._config.interval;
  833. }
  834. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  835. $(activeElement).one(Util.TRANSITION_END, function () {
  836. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  837. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  838. _this4._isSliding = false;
  839. setTimeout(function () {
  840. return $(_this4._element).trigger(slidEvent);
  841. }, 0);
  842. }).emulateTransitionEnd(transitionDuration);
  843. } else {
  844. $(activeElement).removeClass(ClassName$2.ACTIVE);
  845. $(nextElement).addClass(ClassName$2.ACTIVE);
  846. this._isSliding = false;
  847. $(this._element).trigger(slidEvent);
  848. }
  849. if (isCycling) {
  850. this.cycle();
  851. }
  852. } // Static
  853. ;
  854. Carousel._jQueryInterface = function _jQueryInterface(config) {
  855. return this.each(function () {
  856. var data = $(this).data(DATA_KEY$2);
  857. var _config = _objectSpread({}, Default, $(this).data());
  858. if (typeof config === 'object') {
  859. _config = _objectSpread({}, _config, config);
  860. }
  861. var action = typeof config === 'string' ? config : _config.slide;
  862. if (!data) {
  863. data = new Carousel(this, _config);
  864. $(this).data(DATA_KEY$2, data);
  865. }
  866. if (typeof config === 'number') {
  867. data.to(config);
  868. } else if (typeof action === 'string') {
  869. if (typeof data[action] === 'undefined') {
  870. throw new TypeError("No method named \"" + action + "\"");
  871. }
  872. data[action]();
  873. } else if (_config.interval && _config.ride) {
  874. data.pause();
  875. data.cycle();
  876. }
  877. });
  878. };
  879. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  880. var selector = Util.getSelectorFromElement(this);
  881. if (!selector) {
  882. return;
  883. }
  884. var target = $(selector)[0];
  885. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  886. return;
  887. }
  888. var config = _objectSpread({}, $(target).data(), $(this).data());
  889. var slideIndex = this.getAttribute('data-slide-to');
  890. if (slideIndex) {
  891. config.interval = false;
  892. }
  893. Carousel._jQueryInterface.call($(target), config);
  894. if (slideIndex) {
  895. $(target).data(DATA_KEY$2).to(slideIndex);
  896. }
  897. event.preventDefault();
  898. };
  899. _createClass(Carousel, null, [{
  900. key: "VERSION",
  901. get: function get() {
  902. return VERSION$2;
  903. }
  904. }, {
  905. key: "Default",
  906. get: function get() {
  907. return Default;
  908. }
  909. }]);
  910. return Carousel;
  911. }();
  912. /**
  913. * ------------------------------------------------------------------------
  914. * Data Api implementation
  915. * ------------------------------------------------------------------------
  916. */
  917. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  918. $(window).on(Event$2.LOAD_DATA_API, function () {
  919. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  920. for (var i = 0, len = carousels.length; i < len; i++) {
  921. var $carousel = $(carousels[i]);
  922. Carousel._jQueryInterface.call($carousel, $carousel.data());
  923. }
  924. });
  925. /**
  926. * ------------------------------------------------------------------------
  927. * jQuery
  928. * ------------------------------------------------------------------------
  929. */
  930. $.fn[NAME$2] = Carousel._jQueryInterface;
  931. $.fn[NAME$2].Constructor = Carousel;
  932. $.fn[NAME$2].noConflict = function () {
  933. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  934. return Carousel._jQueryInterface;
  935. };
  936. /**
  937. * ------------------------------------------------------------------------
  938. * Constants
  939. * ------------------------------------------------------------------------
  940. */
  941. var NAME$3 = 'collapse';
  942. var VERSION$3 = '4.3.1';
  943. var DATA_KEY$3 = 'bs.collapse';
  944. var EVENT_KEY$3 = "." + DATA_KEY$3;
  945. var DATA_API_KEY$3 = '.data-api';
  946. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  947. var Default$1 = {
  948. toggle: true,
  949. parent: ''
  950. };
  951. var DefaultType$1 = {
  952. toggle: 'boolean',
  953. parent: '(string|element)'
  954. };
  955. var Event$3 = {
  956. SHOW: "show" + EVENT_KEY$3,
  957. SHOWN: "shown" + EVENT_KEY$3,
  958. HIDE: "hide" + EVENT_KEY$3,
  959. HIDDEN: "hidden" + EVENT_KEY$3,
  960. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  961. };
  962. var ClassName$3 = {
  963. SHOW: 'show',
  964. COLLAPSE: 'collapse',
  965. COLLAPSING: 'collapsing',
  966. COLLAPSED: 'collapsed'
  967. };
  968. var Dimension = {
  969. WIDTH: 'width',
  970. HEIGHT: 'height'
  971. };
  972. var Selector$3 = {
  973. ACTIVES: '.show, .collapsing',
  974. DATA_TOGGLE: '[data-toggle="collapse"]'
  975. /**
  976. * ------------------------------------------------------------------------
  977. * Class Definition
  978. * ------------------------------------------------------------------------
  979. */
  980. };
  981. var Collapse =
  982. /*#__PURE__*/
  983. function () {
  984. function Collapse(element, config) {
  985. this._isTransitioning = false;
  986. this._element = element;
  987. this._config = this._getConfig(config);
  988. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  989. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  990. for (var i = 0, len = toggleList.length; i < len; i++) {
  991. var elem = toggleList[i];
  992. var selector = Util.getSelectorFromElement(elem);
  993. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  994. return foundElem === element;
  995. });
  996. if (selector !== null && filterElement.length > 0) {
  997. this._selector = selector;
  998. this._triggerArray.push(elem);
  999. }
  1000. }
  1001. this._parent = this._config.parent ? this._getParent() : null;
  1002. if (!this._config.parent) {
  1003. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  1004. }
  1005. if (this._config.toggle) {
  1006. this.toggle();
  1007. }
  1008. } // Getters
  1009. var _proto = Collapse.prototype;
  1010. // Public
  1011. _proto.toggle = function toggle() {
  1012. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  1013. this.hide();
  1014. } else {
  1015. this.show();
  1016. }
  1017. };
  1018. _proto.show = function show() {
  1019. var _this = this;
  1020. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  1021. return;
  1022. }
  1023. var actives;
  1024. var activesData;
  1025. if (this._parent) {
  1026. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  1027. if (typeof _this._config.parent === 'string') {
  1028. return elem.getAttribute('data-parent') === _this._config.parent;
  1029. }
  1030. return elem.classList.contains(ClassName$3.COLLAPSE);
  1031. });
  1032. if (actives.length === 0) {
  1033. actives = null;
  1034. }
  1035. }
  1036. if (actives) {
  1037. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  1038. if (activesData && activesData._isTransitioning) {
  1039. return;
  1040. }
  1041. }
  1042. var startEvent = $.Event(Event$3.SHOW);
  1043. $(this._element).trigger(startEvent);
  1044. if (startEvent.isDefaultPrevented()) {
  1045. return;
  1046. }
  1047. if (actives) {
  1048. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  1049. if (!activesData) {
  1050. $(actives).data(DATA_KEY$3, null);
  1051. }
  1052. }
  1053. var dimension = this._getDimension();
  1054. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  1055. this._element.style[dimension] = 0;
  1056. if (this._triggerArray.length) {
  1057. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  1058. }
  1059. this.setTransitioning(true);
  1060. var complete = function complete() {
  1061. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  1062. _this._element.style[dimension] = '';
  1063. _this.setTransitioning(false);
  1064. $(_this._element).trigger(Event$3.SHOWN);
  1065. };
  1066. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  1067. var scrollSize = "scroll" + capitalizedDimension;
  1068. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  1069. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  1070. this._element.style[dimension] = this._element[scrollSize] + "px";
  1071. };
  1072. _proto.hide = function hide() {
  1073. var _this2 = this;
  1074. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  1075. return;
  1076. }
  1077. var startEvent = $.Event(Event$3.HIDE);
  1078. $(this._element).trigger(startEvent);
  1079. if (startEvent.isDefaultPrevented()) {
  1080. return;
  1081. }
  1082. var dimension = this._getDimension();
  1083. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  1084. Util.reflow(this._element);
  1085. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  1086. var triggerArrayLength = this._triggerArray.length;
  1087. if (triggerArrayLength > 0) {
  1088. for (var i = 0; i < triggerArrayLength; i++) {
  1089. var trigger = this._triggerArray[i];
  1090. var selector = Util.getSelectorFromElement(trigger);
  1091. if (selector !== null) {
  1092. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  1093. if (!$elem.hasClass(ClassName$3.SHOW)) {
  1094. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  1095. }
  1096. }
  1097. }
  1098. }
  1099. this.setTransitioning(true);
  1100. var complete = function complete() {
  1101. _this2.setTransitioning(false);
  1102. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  1103. };
  1104. this._element.style[dimension] = '';
  1105. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  1106. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  1107. };
  1108. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  1109. this._isTransitioning = isTransitioning;
  1110. };
  1111. _proto.dispose = function dispose() {
  1112. $.removeData(this._element, DATA_KEY$3);
  1113. this._config = null;
  1114. this._parent = null;
  1115. this._element = null;
  1116. this._triggerArray = null;
  1117. this._isTransitioning = null;
  1118. } // Private
  1119. ;
  1120. _proto._getConfig = function _getConfig(config) {
  1121. config = _objectSpread({}, Default$1, config);
  1122. config.toggle = Boolean(config.toggle); // Coerce string values
  1123. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  1124. return config;
  1125. };
  1126. _proto._getDimension = function _getDimension() {
  1127. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  1128. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  1129. };
  1130. _proto._getParent = function _getParent() {
  1131. var _this3 = this;
  1132. var parent;
  1133. if (Util.isElement(this._config.parent)) {
  1134. parent = this._config.parent; // It's a jQuery object
  1135. if (typeof this._config.parent.jquery !== 'undefined') {
  1136. parent = this._config.parent[0];
  1137. }
  1138. } else {
  1139. parent = document.querySelector(this._config.parent);
  1140. }
  1141. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  1142. var children = [].slice.call(parent.querySelectorAll(selector));
  1143. $(children).each(function (i, element) {
  1144. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  1145. });
  1146. return parent;
  1147. };
  1148. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  1149. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  1150. if (triggerArray.length) {
  1151. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  1152. }
  1153. } // Static
  1154. ;
  1155. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  1156. var selector = Util.getSelectorFromElement(element);
  1157. return selector ? document.querySelector(selector) : null;
  1158. };
  1159. Collapse._jQueryInterface = function _jQueryInterface(config) {
  1160. return this.each(function () {
  1161. var $this = $(this);
  1162. var data = $this.data(DATA_KEY$3);
  1163. var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {});
  1164. if (!data && _config.toggle && /show|hide/.test(config)) {
  1165. _config.toggle = false;
  1166. }
  1167. if (!data) {
  1168. data = new Collapse(this, _config);
  1169. $this.data(DATA_KEY$3, data);
  1170. }
  1171. if (typeof config === 'string') {
  1172. if (typeof data[config] === 'undefined') {
  1173. throw new TypeError("No method named \"" + config + "\"");
  1174. }
  1175. data[config]();
  1176. }
  1177. });
  1178. };
  1179. _createClass(Collapse, null, [{
  1180. key: "VERSION",
  1181. get: function get() {
  1182. return VERSION$3;
  1183. }
  1184. }, {
  1185. key: "Default",
  1186. get: function get() {
  1187. return Default$1;
  1188. }
  1189. }]);
  1190. return Collapse;
  1191. }();
  1192. /**
  1193. * ------------------------------------------------------------------------
  1194. * Data Api implementation
  1195. * ------------------------------------------------------------------------
  1196. */
  1197. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  1198. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  1199. if (event.currentTarget.tagName === 'A') {
  1200. event.preventDefault();
  1201. }
  1202. var $trigger = $(this);
  1203. var selector = Util.getSelectorFromElement(this);
  1204. var selectors = [].slice.call(document.querySelectorAll(selector));
  1205. $(selectors).each(function () {
  1206. var $target = $(this);
  1207. var data = $target.data(DATA_KEY$3);
  1208. var config = data ? 'toggle' : $trigger.data();
  1209. Collapse._jQueryInterface.call($target, config);
  1210. });
  1211. });
  1212. /**
  1213. * ------------------------------------------------------------------------
  1214. * jQuery
  1215. * ------------------------------------------------------------------------
  1216. */
  1217. $.fn[NAME$3] = Collapse._jQueryInterface;
  1218. $.fn[NAME$3].Constructor = Collapse;
  1219. $.fn[NAME$3].noConflict = function () {
  1220. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  1221. return Collapse._jQueryInterface;
  1222. };
  1223. /**!
  1224. * @fileOverview Kickass library to create and place poppers near their reference elements.
  1225. * @version 1.14.7
  1226. * @license
  1227. * Copyright (c) 2016 Federico Zivolo and contributors
  1228. *
  1229. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1230. * of this software and associated documentation files (the "Software"), to deal
  1231. * in the Software without restriction, including without limitation the rights
  1232. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1233. * copies of the Software, and to permit persons to whom the Software is
  1234. * furnished to do so, subject to the following conditions:
  1235. *
  1236. * The above copyright notice and this permission notice shall be included in all
  1237. * copies or substantial portions of the Software.
  1238. *
  1239. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1240. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1241. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1242. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1243. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1244. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  1245. * SOFTWARE.
  1246. */
  1247. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
  1248. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  1249. var timeoutDuration = 0;
  1250. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  1251. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  1252. timeoutDuration = 1;
  1253. break;
  1254. }
  1255. }
  1256. function microtaskDebounce(fn) {
  1257. var called = false;
  1258. return function () {
  1259. if (called) {
  1260. return;
  1261. }
  1262. called = true;
  1263. window.Promise.resolve().then(function () {
  1264. called = false;
  1265. fn();
  1266. });
  1267. };
  1268. }
  1269. function taskDebounce(fn) {
  1270. var scheduled = false;
  1271. return function () {
  1272. if (!scheduled) {
  1273. scheduled = true;
  1274. setTimeout(function () {
  1275. scheduled = false;
  1276. fn();
  1277. }, timeoutDuration);
  1278. }
  1279. };
  1280. }
  1281. var supportsMicroTasks = isBrowser && window.Promise;
  1282. /**
  1283. * Create a debounced version of a method, that's asynchronously deferred
  1284. * but called in the minimum time possible.
  1285. *
  1286. * @method
  1287. * @memberof Popper.Utils
  1288. * @argument {Function} fn
  1289. * @returns {Function}
  1290. */
  1291. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  1292. /**
  1293. * Check if the given variable is a function
  1294. * @method
  1295. * @memberof Popper.Utils
  1296. * @argument {Any} functionToCheck - variable to check
  1297. * @returns {Boolean} answer to: is a function?
  1298. */
  1299. function isFunction(functionToCheck) {
  1300. var getType = {};
  1301. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  1302. }
  1303. /**
  1304. * Get CSS computed property of the given element
  1305. * @method
  1306. * @memberof Popper.Utils
  1307. * @argument {Eement} element
  1308. * @argument {String} property
  1309. */
  1310. function getStyleComputedProperty(element, property) {
  1311. if (element.nodeType !== 1) {
  1312. return [];
  1313. }
  1314. // NOTE: 1 DOM access here
  1315. var window = element.ownerDocument.defaultView;
  1316. var css = window.getComputedStyle(element, null);
  1317. return property ? css[property] : css;
  1318. }
  1319. /**
  1320. * Returns the parentNode or the host of the element
  1321. * @method
  1322. * @memberof Popper.Utils
  1323. * @argument {Element} element
  1324. * @returns {Element} parent
  1325. */
  1326. function getParentNode(element) {
  1327. if (element.nodeName === 'HTML') {
  1328. return element;
  1329. }
  1330. return element.parentNode || element.host;
  1331. }
  1332. /**
  1333. * Returns the scrolling parent of the given element
  1334. * @method
  1335. * @memberof Popper.Utils
  1336. * @argument {Element} element
  1337. * @returns {Element} scroll parent
  1338. */
  1339. function getScrollParent(element) {
  1340. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  1341. if (!element) {
  1342. return document.body;
  1343. }
  1344. switch (element.nodeName) {
  1345. case 'HTML':
  1346. case 'BODY':
  1347. return element.ownerDocument.body;
  1348. case '#document':
  1349. return element.body;
  1350. }
  1351. // Firefox want us to check `-x` and `-y` variations as well
  1352. var _getStyleComputedProp = getStyleComputedProperty(element),
  1353. overflow = _getStyleComputedProp.overflow,
  1354. overflowX = _getStyleComputedProp.overflowX,
  1355. overflowY = _getStyleComputedProp.overflowY;
  1356. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  1357. return element;
  1358. }
  1359. return getScrollParent(getParentNode(element));
  1360. }
  1361. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  1362. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  1363. /**
  1364. * Determines if the browser is Internet Explorer
  1365. * @method
  1366. * @memberof Popper.Utils
  1367. * @param {Number} version to check
  1368. * @returns {Boolean} isIE
  1369. */
  1370. function isIE(version) {
  1371. if (version === 11) {
  1372. return isIE11;
  1373. }
  1374. if (version === 10) {
  1375. return isIE10;
  1376. }
  1377. return isIE11 || isIE10;
  1378. }
  1379. /**
  1380. * Returns the offset parent of the given element
  1381. * @method
  1382. * @memberof Popper.Utils
  1383. * @argument {Element} element
  1384. * @returns {Element} offset parent
  1385. */
  1386. function getOffsetParent(element) {
  1387. if (!element) {
  1388. return document.documentElement;
  1389. }
  1390. var noOffsetParent = isIE(10) ? document.body : null;
  1391. // NOTE: 1 DOM access here
  1392. var offsetParent = element.offsetParent || null;
  1393. // Skip hidden elements which don't have an offsetParent
  1394. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  1395. offsetParent = (element = element.nextElementSibling).offsetParent;
  1396. }
  1397. var nodeName = offsetParent && offsetParent.nodeName;
  1398. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  1399. return element ? element.ownerDocument.documentElement : document.documentElement;
  1400. }
  1401. // .offsetParent will return the closest TH, TD or TABLE in case
  1402. // no offsetParent is present, I hate this job...
  1403. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  1404. return getOffsetParent(offsetParent);
  1405. }
  1406. return offsetParent;
  1407. }
  1408. function isOffsetContainer(element) {
  1409. var nodeName = element.nodeName;
  1410. if (nodeName === 'BODY') {
  1411. return false;
  1412. }
  1413. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  1414. }
  1415. /**
  1416. * Finds the root node (document, shadowDOM root) of the given element
  1417. * @method
  1418. * @memberof Popper.Utils
  1419. * @argument {Element} node
  1420. * @returns {Element} root node
  1421. */
  1422. function getRoot(node) {
  1423. if (node.parentNode !== null) {
  1424. return getRoot(node.parentNode);
  1425. }
  1426. return node;
  1427. }
  1428. /**
  1429. * Finds the offset parent common to the two provided nodes
  1430. * @method
  1431. * @memberof Popper.Utils
  1432. * @argument {Element} element1
  1433. * @argument {Element} element2
  1434. * @returns {Element} common offset parent
  1435. */
  1436. function findCommonOffsetParent(element1, element2) {
  1437. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  1438. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  1439. return document.documentElement;
  1440. }
  1441. // Here we make sure to give as "start" the element that comes first in the DOM
  1442. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  1443. var start = order ? element1 : element2;
  1444. var end = order ? element2 : element1;
  1445. // Get common ancestor container
  1446. var range = document.createRange();
  1447. range.setStart(start, 0);
  1448. range.setEnd(end, 0);
  1449. var commonAncestorContainer = range.commonAncestorContainer;
  1450. // Both nodes are inside #document
  1451. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  1452. if (isOffsetContainer(commonAncestorContainer)) {
  1453. return commonAncestorContainer;
  1454. }
  1455. return getOffsetParent(commonAncestorContainer);
  1456. }
  1457. // one of the nodes is inside shadowDOM, find which one
  1458. var element1root = getRoot(element1);
  1459. if (element1root.host) {
  1460. return findCommonOffsetParent(element1root.host, element2);
  1461. } else {
  1462. return findCommonOffsetParent(element1, getRoot(element2).host);
  1463. }
  1464. }
  1465. /**
  1466. * Gets the scroll value of the given element in the given side (top and left)
  1467. * @method
  1468. * @memberof Popper.Utils
  1469. * @argument {Element} element
  1470. * @argument {String} side `top` or `left`
  1471. * @returns {number} amount of scrolled pixels
  1472. */
  1473. function getScroll(element) {
  1474. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  1475. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  1476. var nodeName = element.nodeName;
  1477. if (nodeName === 'BODY' || nodeName === 'HTML') {
  1478. var html = element.ownerDocument.documentElement;
  1479. var scrollingElement = element.ownerDocument.scrollingElement || html;
  1480. return scrollingElement[upperSide];
  1481. }
  1482. return element[upperSide];
  1483. }
  1484. /*
  1485. * Sum or subtract the element scroll values (left and top) from a given rect object
  1486. * @method
  1487. * @memberof Popper.Utils
  1488. * @param {Object} rect - Rect object you want to change
  1489. * @param {HTMLElement} element - The element from the function reads the scroll values
  1490. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  1491. * @return {Object} rect - The modifier rect object
  1492. */
  1493. function includeScroll(rect, element) {
  1494. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1495. var scrollTop = getScroll(element, 'top');
  1496. var scrollLeft = getScroll(element, 'left');
  1497. var modifier = subtract ? -1 : 1;
  1498. rect.top += scrollTop * modifier;
  1499. rect.bottom += scrollTop * modifier;
  1500. rect.left += scrollLeft * modifier;
  1501. rect.right += scrollLeft * modifier;
  1502. return rect;
  1503. }
  1504. /*
  1505. * Helper to detect borders of a given element
  1506. * @method
  1507. * @memberof Popper.Utils
  1508. * @param {CSSStyleDeclaration} styles
  1509. * Result of `getStyleComputedProperty` on the given element
  1510. * @param {String} axis - `x` or `y`
  1511. * @return {number} borders - The borders size of the given axis
  1512. */
  1513. function getBordersSize(styles, axis) {
  1514. var sideA = axis === 'x' ? 'Left' : 'Top';
  1515. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  1516. return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
  1517. }
  1518. function getSize(axis, body, html, computedStyle) {
  1519. return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
  1520. }
  1521. function getWindowSizes(document) {
  1522. var body = document.body;
  1523. var html = document.documentElement;
  1524. var computedStyle = isIE(10) && getComputedStyle(html);
  1525. return {
  1526. height: getSize('Height', body, html, computedStyle),
  1527. width: getSize('Width', body, html, computedStyle)
  1528. };
  1529. }
  1530. var classCallCheck = function (instance, Constructor) {
  1531. if (!(instance instanceof Constructor)) {
  1532. throw new TypeError("Cannot call a class as a function");
  1533. }
  1534. };
  1535. var createClass = function () {
  1536. function defineProperties(target, props) {
  1537. for (var i = 0; i < props.length; i++) {
  1538. var descriptor = props[i];
  1539. descriptor.enumerable = descriptor.enumerable || false;
  1540. descriptor.configurable = true;
  1541. if ("value" in descriptor) descriptor.writable = true;
  1542. Object.defineProperty(target, descriptor.key, descriptor);
  1543. }
  1544. }
  1545. return function (Constructor, protoProps, staticProps) {
  1546. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  1547. if (staticProps) defineProperties(Constructor, staticProps);
  1548. return Constructor;
  1549. };
  1550. }();
  1551. var defineProperty = function (obj, key, value) {
  1552. if (key in obj) {
  1553. Object.defineProperty(obj, key, {
  1554. value: value,
  1555. enumerable: true,
  1556. configurable: true,
  1557. writable: true
  1558. });
  1559. } else {
  1560. obj[key] = value;
  1561. }
  1562. return obj;
  1563. };
  1564. var _extends = Object.assign || function (target) {
  1565. for (var i = 1; i < arguments.length; i++) {
  1566. var source = arguments[i];
  1567. for (var key in source) {
  1568. if (Object.prototype.hasOwnProperty.call(source, key)) {
  1569. target[key] = source[key];
  1570. }
  1571. }
  1572. }
  1573. return target;
  1574. };
  1575. /**
  1576. * Given element offsets, generate an output similar to getBoundingClientRect
  1577. * @method
  1578. * @memberof Popper.Utils
  1579. * @argument {Object} offsets
  1580. * @returns {Object} ClientRect like output
  1581. */
  1582. function getClientRect(offsets) {
  1583. return _extends({}, offsets, {
  1584. right: offsets.left + offsets.width,
  1585. bottom: offsets.top + offsets.height
  1586. });
  1587. }
  1588. /**
  1589. * Get bounding client rect of given element
  1590. * @method
  1591. * @memberof Popper.Utils
  1592. * @param {HTMLElement} element
  1593. * @return {Object} client rect
  1594. */
  1595. function getBoundingClientRect(element) {
  1596. var rect = {};
  1597. // IE10 10 FIX: Please, don't ask, the element isn't
  1598. // considered in DOM in some circumstances...
  1599. // This isn't reproducible in IE10 compatibility mode of IE11
  1600. try {
  1601. if (isIE(10)) {
  1602. rect = element.getBoundingClientRect();
  1603. var scrollTop = getScroll(element, 'top');
  1604. var scrollLeft = getScroll(element, 'left');
  1605. rect.top += scrollTop;
  1606. rect.left += scrollLeft;
  1607. rect.bottom += scrollTop;
  1608. rect.right += scrollLeft;
  1609. } else {
  1610. rect = element.getBoundingClientRect();
  1611. }
  1612. } catch (e) {}
  1613. var result = {
  1614. left: rect.left,
  1615. top: rect.top,
  1616. width: rect.right - rect.left,
  1617. height: rect.bottom - rect.top
  1618. };
  1619. // subtract scrollbar size from sizes
  1620. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  1621. var width = sizes.width || element.clientWidth || result.right - result.left;
  1622. var height = sizes.height || element.clientHeight || result.bottom - result.top;
  1623. var horizScrollbar = element.offsetWidth - width;
  1624. var vertScrollbar = element.offsetHeight - height;
  1625. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  1626. // we make this check conditional for performance reasons
  1627. if (horizScrollbar || vertScrollbar) {
  1628. var styles = getStyleComputedProperty(element);
  1629. horizScrollbar -= getBordersSize(styles, 'x');
  1630. vertScrollbar -= getBordersSize(styles, 'y');
  1631. result.width -= horizScrollbar;
  1632. result.height -= vertScrollbar;
  1633. }
  1634. return getClientRect(result);
  1635. }
  1636. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  1637. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1638. var isIE10 = isIE(10);
  1639. var isHTML = parent.nodeName === 'HTML';
  1640. var childrenRect = getBoundingClientRect(children);
  1641. var parentRect = getBoundingClientRect(parent);
  1642. var scrollParent = getScrollParent(children);
  1643. var styles = getStyleComputedProperty(parent);
  1644. var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
  1645. var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
  1646. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  1647. if (fixedPosition && isHTML) {
  1648. parentRect.top = Math.max(parentRect.top, 0);
  1649. parentRect.left = Math.max(parentRect.left, 0);
  1650. }
  1651. var offsets = getClientRect({
  1652. top: childrenRect.top - parentRect.top - borderTopWidth,
  1653. left: childrenRect.left - parentRect.left - borderLeftWidth,
  1654. width: childrenRect.width,
  1655. height: childrenRect.height
  1656. });
  1657. offsets.marginTop = 0;
  1658. offsets.marginLeft = 0;
  1659. // Subtract margins of documentElement in case it's being used as parent
  1660. // we do this only on HTML because it's the only element that behaves
  1661. // differently when margins are applied to it. The margins are included in
  1662. // the box of the documentElement, in the other cases not.
  1663. if (!isIE10 && isHTML) {
  1664. var marginTop = parseFloat(styles.marginTop, 10);
  1665. var marginLeft = parseFloat(styles.marginLeft, 10);
  1666. offsets.top -= borderTopWidth - marginTop;
  1667. offsets.bottom -= borderTopWidth - marginTop;
  1668. offsets.left -= borderLeftWidth - marginLeft;
  1669. offsets.right -= borderLeftWidth - marginLeft;
  1670. // Attach marginTop and marginLeft because in some circumstances we may need them
  1671. offsets.marginTop = marginTop;
  1672. offsets.marginLeft = marginLeft;
  1673. }
  1674. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  1675. offsets = includeScroll(offsets, parent);
  1676. }
  1677. return offsets;
  1678. }
  1679. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  1680. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1681. var html = element.ownerDocument.documentElement;
  1682. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  1683. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  1684. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  1685. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  1686. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  1687. var offset = {
  1688. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  1689. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  1690. width: width,
  1691. height: height
  1692. };
  1693. return getClientRect(offset);
  1694. }
  1695. /**
  1696. * Check if the given element is fixed or is inside a fixed parent
  1697. * @method
  1698. * @memberof Popper.Utils
  1699. * @argument {Element} element
  1700. * @argument {Element} customContainer
  1701. * @returns {Boolean} answer to "isFixed?"
  1702. */
  1703. function isFixed(element) {
  1704. var nodeName = element.nodeName;
  1705. if (nodeName === 'BODY' || nodeName === 'HTML') {
  1706. return false;
  1707. }
  1708. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  1709. return true;
  1710. }
  1711. var parentNode = getParentNode(element);
  1712. if (!parentNode) {
  1713. return false;
  1714. }
  1715. return isFixed(parentNode);
  1716. }
  1717. /**
  1718. * Finds the first parent of an element that has a transformed property defined
  1719. * @method
  1720. * @memberof Popper.Utils
  1721. * @argument {Element} element
  1722. * @returns {Element} first transformed parent or documentElement
  1723. */
  1724. function getFixedPositionOffsetParent(element) {
  1725. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  1726. if (!element || !element.parentElement || isIE()) {
  1727. return document.documentElement;
  1728. }
  1729. var el = element.parentElement;
  1730. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  1731. el = el.parentElement;
  1732. }
  1733. return el || document.documentElement;
  1734. }
  1735. /**
  1736. * Computed the boundaries limits and return them
  1737. * @method
  1738. * @memberof Popper.Utils
  1739. * @param {HTMLElement} popper
  1740. * @param {HTMLElement} reference
  1741. * @param {number} padding
  1742. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  1743. * @param {Boolean} fixedPosition - Is in fixed position mode
  1744. * @returns {Object} Coordinates of the boundaries
  1745. */
  1746. function getBoundaries(popper, reference, padding, boundariesElement) {
  1747. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  1748. // NOTE: 1 DOM access here
  1749. var boundaries = { top: 0, left: 0 };
  1750. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  1751. // Handle viewport case
  1752. if (boundariesElement === 'viewport') {
  1753. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  1754. } else {
  1755. // Handle other cases based on DOM element used as boundaries
  1756. var boundariesNode = void 0;
  1757. if (boundariesElement === 'scrollParent') {
  1758. boundariesNode = getScrollParent(getParentNode(reference));
  1759. if (boundariesNode.nodeName === 'BODY') {
  1760. boundariesNode = popper.ownerDocument.documentElement;
  1761. }
  1762. } else if (boundariesElement === 'window') {
  1763. boundariesNode = popper.ownerDocument.documentElement;
  1764. } else {
  1765. boundariesNode = boundariesElement;
  1766. }
  1767. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  1768. // In case of HTML, we need a different computation
  1769. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  1770. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  1771. height = _getWindowSizes.height,
  1772. width = _getWindowSizes.width;
  1773. boundaries.top += offsets.top - offsets.marginTop;
  1774. boundaries.bottom = height + offsets.top;
  1775. boundaries.left += offsets.left - offsets.marginLeft;
  1776. boundaries.right = width + offsets.left;
  1777. } else {
  1778. // for all the other DOM elements, this one is good
  1779. boundaries = offsets;
  1780. }
  1781. }
  1782. // Add paddings
  1783. padding = padding || 0;
  1784. var isPaddingNumber = typeof padding === 'number';
  1785. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  1786. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  1787. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  1788. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  1789. return boundaries;
  1790. }
  1791. function getArea(_ref) {
  1792. var width = _ref.width,
  1793. height = _ref.height;
  1794. return width * height;
  1795. }
  1796. /**
  1797. * Utility used to transform the `auto` placement to the placement with more
  1798. * available space.
  1799. * @method
  1800. * @memberof Popper.Utils
  1801. * @argument {Object} data - The data object generated by update method
  1802. * @argument {Object} options - Modifiers configuration and options
  1803. * @returns {Object} The data object, properly modified
  1804. */
  1805. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  1806. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  1807. if (placement.indexOf('auto') === -1) {
  1808. return placement;
  1809. }
  1810. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  1811. var rects = {
  1812. top: {
  1813. width: boundaries.width,
  1814. height: refRect.top - boundaries.top
  1815. },
  1816. right: {
  1817. width: boundaries.right - refRect.right,
  1818. height: boundaries.height
  1819. },
  1820. bottom: {
  1821. width: boundaries.width,
  1822. height: boundaries.bottom - refRect.bottom
  1823. },
  1824. left: {
  1825. width: refRect.left - boundaries.left,
  1826. height: boundaries.height
  1827. }
  1828. };
  1829. var sortedAreas = Object.keys(rects).map(function (key) {
  1830. return _extends({
  1831. key: key
  1832. }, rects[key], {
  1833. area: getArea(rects[key])
  1834. });
  1835. }).sort(function (a, b) {
  1836. return b.area - a.area;
  1837. });
  1838. var filteredAreas = sortedAreas.filter(function (_ref2) {
  1839. var width = _ref2.width,
  1840. height = _ref2.height;
  1841. return width >= popper.clientWidth && height >= popper.clientHeight;
  1842. });
  1843. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  1844. var variation = placement.split('-')[1];
  1845. return computedPlacement + (variation ? '-' + variation : '');
  1846. }
  1847. /**
  1848. * Get offsets to the reference element
  1849. * @method
  1850. * @memberof Popper.Utils
  1851. * @param {Object} state
  1852. * @param {Element} popper - the popper element
  1853. * @param {Element} reference - the reference element (the popper will be relative to this)
  1854. * @param {Element} fixedPosition - is in fixed position mode
  1855. * @returns {Object} An object containing the offsets which will be applied to the popper
  1856. */
  1857. function getReferenceOffsets(state, popper, reference) {
  1858. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  1859. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  1860. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  1861. }
  1862. /**
  1863. * Get the outer sizes of the given element (offset size + margins)
  1864. * @method
  1865. * @memberof Popper.Utils
  1866. * @argument {Element} element
  1867. * @returns {Object} object containing width and height properties
  1868. */
  1869. function getOuterSizes(element) {
  1870. var window = element.ownerDocument.defaultView;
  1871. var styles = window.getComputedStyle(element);
  1872. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  1873. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  1874. var result = {
  1875. width: element.offsetWidth + y,
  1876. height: element.offsetHeight + x
  1877. };
  1878. return result;
  1879. }
  1880. /**
  1881. * Get the opposite placement of the given one
  1882. * @method
  1883. * @memberof Popper.Utils
  1884. * @argument {String} placement
  1885. * @returns {String} flipped placement
  1886. */
  1887. function getOppositePlacement(placement) {
  1888. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  1889. return placement.replace(/left|right|bottom|top/g, function (matched) {
  1890. return hash[matched];
  1891. });
  1892. }
  1893. /**
  1894. * Get offsets to the popper
  1895. * @method
  1896. * @memberof Popper.Utils
  1897. * @param {Object} position - CSS position the Popper will get applied
  1898. * @param {HTMLElement} popper - the popper element
  1899. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  1900. * @param {String} placement - one of the valid placement options
  1901. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  1902. */
  1903. function getPopperOffsets(popper, referenceOffsets, placement) {
  1904. placement = placement.split('-')[0];
  1905. // Get popper node sizes
  1906. var popperRect = getOuterSizes(popper);
  1907. // Add position, width and height to our offsets object
  1908. var popperOffsets = {
  1909. width: popperRect.width,
  1910. height: popperRect.height
  1911. };
  1912. // depending by the popper placement we have to compute its offsets slightly differently
  1913. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  1914. var mainSide = isHoriz ? 'top' : 'left';
  1915. var secondarySide = isHoriz ? 'left' : 'top';
  1916. var measurement = isHoriz ? 'height' : 'width';
  1917. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  1918. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  1919. if (placement === secondarySide) {
  1920. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  1921. } else {
  1922. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  1923. }
  1924. return popperOffsets;
  1925. }
  1926. /**
  1927. * Mimics the `find` method of Array
  1928. * @method
  1929. * @memberof Popper.Utils
  1930. * @argument {Array} arr
  1931. * @argument prop
  1932. * @argument value
  1933. * @returns index or -1
  1934. */
  1935. function find(arr, check) {
  1936. // use native find if supported
  1937. if (Array.prototype.find) {
  1938. return arr.find(check);
  1939. }
  1940. // use `filter` to obtain the same behavior of `find`
  1941. return arr.filter(check)[0];
  1942. }
  1943. /**
  1944. * Return the index of the matching object
  1945. * @method
  1946. * @memberof Popper.Utils
  1947. * @argument {Array} arr
  1948. * @argument prop
  1949. * @argument value
  1950. * @returns index or -1
  1951. */
  1952. function findIndex(arr, prop, value) {
  1953. // use native findIndex if supported
  1954. if (Array.prototype.findIndex) {
  1955. return arr.findIndex(function (cur) {
  1956. return cur[prop] === value;
  1957. });
  1958. }
  1959. // use `find` + `indexOf` if `findIndex` isn't supported
  1960. var match = find(arr, function (obj) {
  1961. return obj[prop] === value;
  1962. });
  1963. return arr.indexOf(match);
  1964. }
  1965. /**
  1966. * Loop trough the list of modifiers and run them in order,
  1967. * each of them will then edit the data object.
  1968. * @method
  1969. * @memberof Popper.Utils
  1970. * @param {dataObject} data
  1971. * @param {Array} modifiers
  1972. * @param {String} ends - Optional modifier name used as stopper
  1973. * @returns {dataObject}
  1974. */
  1975. function runModifiers(modifiers, data, ends) {
  1976. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  1977. modifiersToRun.forEach(function (modifier) {
  1978. if (modifier['function']) {
  1979. // eslint-disable-line dot-notation
  1980. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  1981. }
  1982. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  1983. if (modifier.enabled && isFunction(fn)) {
  1984. // Add properties to offsets to make them a complete clientRect object
  1985. // we do this before each modifier to make sure the previous one doesn't
  1986. // mess with these values
  1987. data.offsets.popper = getClientRect(data.offsets.popper);
  1988. data.offsets.reference = getClientRect(data.offsets.reference);
  1989. data = fn(data, modifier);
  1990. }
  1991. });
  1992. return data;
  1993. }
  1994. /**
  1995. * Updates the position of the popper, computing the new offsets and applying
  1996. * the new style.<br />
  1997. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  1998. * @method
  1999. * @memberof Popper
  2000. */
  2001. function update() {
  2002. // if popper is destroyed, don't perform any further update
  2003. if (this.state.isDestroyed) {
  2004. return;
  2005. }
  2006. var data = {
  2007. instance: this,
  2008. styles: {},
  2009. arrowStyles: {},
  2010. attributes: {},
  2011. flipped: false,
  2012. offsets: {}
  2013. };
  2014. // compute reference element offsets
  2015. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  2016. // compute auto placement, store placement inside the data object,
  2017. // modifiers will be able to edit `placement` if needed
  2018. // and refer to originalPlacement to know the original value
  2019. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  2020. // store the computed placement inside `originalPlacement`
  2021. data.originalPlacement = data.placement;
  2022. data.positionFixed = this.options.positionFixed;
  2023. // compute the popper offsets
  2024. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  2025. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  2026. // run the modifiers
  2027. data = runModifiers(this.modifiers, data);
  2028. // the first `update` will call `onCreate` callback
  2029. // the other ones will call `onUpdate` callback
  2030. if (!this.state.isCreated) {
  2031. this.state.isCreated = true;
  2032. this.options.onCreate(data);
  2033. } else {
  2034. this.options.onUpdate(data);
  2035. }
  2036. }
  2037. /**
  2038. * Helper used to know if the given modifier is enabled.
  2039. * @method
  2040. * @memberof Popper.Utils
  2041. * @returns {Boolean}
  2042. */
  2043. function isModifierEnabled(modifiers, modifierName) {
  2044. return modifiers.some(function (_ref) {
  2045. var name = _ref.name,
  2046. enabled = _ref.enabled;
  2047. return enabled && name === modifierName;
  2048. });
  2049. }
  2050. /**
  2051. * Get the prefixed supported property name
  2052. * @method
  2053. * @memberof Popper.Utils
  2054. * @argument {String} property (camelCase)
  2055. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  2056. */
  2057. function getSupportedPropertyName(property) {
  2058. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  2059. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  2060. for (var i = 0; i < prefixes.length; i++) {
  2061. var prefix = prefixes[i];
  2062. var toCheck = prefix ? '' + prefix + upperProp : property;
  2063. if (typeof document.body.style[toCheck] !== 'undefined') {
  2064. return toCheck;
  2065. }
  2066. }
  2067. return null;
  2068. }
  2069. /**
  2070. * Destroys the popper.
  2071. * @method
  2072. * @memberof Popper
  2073. */
  2074. function destroy() {
  2075. this.state.isDestroyed = true;
  2076. // touch DOM only if `applyStyle` modifier is enabled
  2077. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  2078. this.popper.removeAttribute('x-placement');
  2079. this.popper.style.position = '';
  2080. this.popper.style.top = '';
  2081. this.popper.style.left = '';
  2082. this.popper.style.right = '';
  2083. this.popper.style.bottom = '';
  2084. this.popper.style.willChange = '';
  2085. this.popper.style[getSupportedPropertyName('transform')] = '';
  2086. }
  2087. this.disableEventListeners();
  2088. // remove the popper if user explicity asked for the deletion on destroy
  2089. // do not use `remove` because IE11 doesn't support it
  2090. if (this.options.removeOnDestroy) {
  2091. this.popper.parentNode.removeChild(this.popper);
  2092. }
  2093. return this;
  2094. }
  2095. /**
  2096. * Get the window associated with the element
  2097. * @argument {Element} element
  2098. * @returns {Window}
  2099. */
  2100. function getWindow(element) {
  2101. var ownerDocument = element.ownerDocument;
  2102. return ownerDocument ? ownerDocument.defaultView : window;
  2103. }
  2104. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  2105. var isBody = scrollParent.nodeName === 'BODY';
  2106. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  2107. target.addEventListener(event, callback, { passive: true });
  2108. if (!isBody) {
  2109. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  2110. }
  2111. scrollParents.push(target);
  2112. }
  2113. /**
  2114. * Setup needed event listeners used to update the popper position
  2115. * @method
  2116. * @memberof Popper.Utils
  2117. * @private
  2118. */
  2119. function setupEventListeners(reference, options, state, updateBound) {
  2120. // Resize event listener on window
  2121. state.updateBound = updateBound;
  2122. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  2123. // Scroll event listener on scroll parents
  2124. var scrollElement = getScrollParent(reference);
  2125. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  2126. state.scrollElement = scrollElement;
  2127. state.eventsEnabled = true;
  2128. return state;
  2129. }
  2130. /**
  2131. * It will add resize/scroll events and start recalculating
  2132. * position of the popper element when they are triggered.
  2133. * @method
  2134. * @memberof Popper
  2135. */
  2136. function enableEventListeners() {
  2137. if (!this.state.eventsEnabled) {
  2138. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  2139. }
  2140. }
  2141. /**
  2142. * Remove event listeners used to update the popper position
  2143. * @method
  2144. * @memberof Popper.Utils
  2145. * @private
  2146. */
  2147. function removeEventListeners(reference, state) {
  2148. // Remove resize event listener on window
  2149. getWindow(reference).removeEventListener('resize', state.updateBound);
  2150. // Remove scroll event listener on scroll parents
  2151. state.scrollParents.forEach(function (target) {
  2152. target.removeEventListener('scroll', state.updateBound);
  2153. });
  2154. // Reset state
  2155. state.updateBound = null;
  2156. state.scrollParents = [];
  2157. state.scrollElement = null;
  2158. state.eventsEnabled = false;
  2159. return state;
  2160. }
  2161. /**
  2162. * It will remove resize/scroll events and won't recalculate popper position
  2163. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  2164. * unless you call `update` method manually.
  2165. * @method
  2166. * @memberof Popper
  2167. */
  2168. function disableEventListeners() {
  2169. if (this.state.eventsEnabled) {
  2170. cancelAnimationFrame(this.scheduleUpdate);
  2171. this.state = removeEventListeners(this.reference, this.state);
  2172. }
  2173. }
  2174. /**
  2175. * Tells if a given input is a number
  2176. * @method
  2177. * @memberof Popper.Utils
  2178. * @param {*} input to check
  2179. * @return {Boolean}
  2180. */
  2181. function isNumeric(n) {
  2182. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  2183. }
  2184. /**
  2185. * Set the style to the given popper
  2186. * @method
  2187. * @memberof Popper.Utils
  2188. * @argument {Element} element - Element to apply the style to
  2189. * @argument {Object} styles
  2190. * Object with a list of properties and values which will be applied to the element
  2191. */
  2192. function setStyles(element, styles) {
  2193. Object.keys(styles).forEach(function (prop) {
  2194. var unit = '';
  2195. // add unit if the value is numeric and is one of the following
  2196. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  2197. unit = 'px';
  2198. }
  2199. element.style[prop] = styles[prop] + unit;
  2200. });
  2201. }
  2202. /**
  2203. * Set the attributes to the given popper
  2204. * @method
  2205. * @memberof Popper.Utils
  2206. * @argument {Element} element - Element to apply the attributes to
  2207. * @argument {Object} styles
  2208. * Object with a list of properties and values which will be applied to the element
  2209. */
  2210. function setAttributes(element, attributes) {
  2211. Object.keys(attributes).forEach(function (prop) {
  2212. var value = attributes[prop];
  2213. if (value !== false) {
  2214. element.setAttribute(prop, attributes[prop]);
  2215. } else {
  2216. element.removeAttribute(prop);
  2217. }
  2218. });
  2219. }
  2220. /**
  2221. * @function
  2222. * @memberof Modifiers
  2223. * @argument {Object} data - The data object generated by `update` method
  2224. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  2225. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  2226. * @argument {Object} options - Modifiers configuration and options
  2227. * @returns {Object} The same data object
  2228. */
  2229. function applyStyle(data) {
  2230. // any property present in `data.styles` will be applied to the popper,
  2231. // in this way we can make the 3rd party modifiers add custom styles to it
  2232. // Be aware, modifiers could override the properties defined in the previous
  2233. // lines of this modifier!
  2234. setStyles(data.instance.popper, data.styles);
  2235. // any property present in `data.attributes` will be applied to the popper,
  2236. // they will be set as HTML attributes of the element
  2237. setAttributes(data.instance.popper, data.attributes);
  2238. // if arrowElement is defined and arrowStyles has some properties
  2239. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  2240. setStyles(data.arrowElement, data.arrowStyles);
  2241. }
  2242. return data;
  2243. }
  2244. /**
  2245. * Set the x-placement attribute before everything else because it could be used
  2246. * to add margins to the popper margins needs to be calculated to get the
  2247. * correct popper offsets.
  2248. * @method
  2249. * @memberof Popper.modifiers
  2250. * @param {HTMLElement} reference - The reference element used to position the popper
  2251. * @param {HTMLElement} popper - The HTML element used as popper
  2252. * @param {Object} options - Popper.js options
  2253. */
  2254. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  2255. // compute reference element offsets
  2256. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  2257. // compute auto placement, store placement inside the data object,
  2258. // modifiers will be able to edit `placement` if needed
  2259. // and refer to originalPlacement to know the original value
  2260. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  2261. popper.setAttribute('x-placement', placement);
  2262. // Apply `position` to popper before anything else because
  2263. // without the position applied we can't guarantee correct computations
  2264. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  2265. return options;
  2266. }
  2267. /**
  2268. * @function
  2269. * @memberof Popper.Utils
  2270. * @argument {Object} data - The data object generated by `update` method
  2271. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  2272. * @returns {Object} The popper's position offsets rounded
  2273. *
  2274. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  2275. * good as it can be within reason.
  2276. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  2277. *
  2278. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  2279. * as well on High DPI screens).
  2280. *
  2281. * Firefox prefers no rounding for positioning and does not have blurriness on
  2282. * high DPI screens.
  2283. *
  2284. * Only horizontal placement and left/right values need to be considered.
  2285. */
  2286. function getRoundedOffsets(data, shouldRound) {
  2287. var _data$offsets = data.offsets,
  2288. popper = _data$offsets.popper,
  2289. reference = _data$offsets.reference;
  2290. var round = Math.round,
  2291. floor = Math.floor;
  2292. var noRound = function noRound(v) {
  2293. return v;
  2294. };
  2295. var referenceWidth = round(reference.width);
  2296. var popperWidth = round(popper.width);
  2297. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  2298. var isVariation = data.placement.indexOf('-') !== -1;
  2299. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  2300. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  2301. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  2302. var verticalToInteger = !shouldRound ? noRound : round;
  2303. return {
  2304. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  2305. top: verticalToInteger(popper.top),
  2306. bottom: verticalToInteger(popper.bottom),
  2307. right: horizontalToInteger(popper.right)
  2308. };
  2309. }
  2310. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  2311. /**
  2312. * @function
  2313. * @memberof Modifiers
  2314. * @argument {Object} data - The data object generated by `update` method
  2315. * @argument {Object} options - Modifiers configuration and options
  2316. * @returns {Object} The data object, properly modified
  2317. */
  2318. function computeStyle(data, options) {
  2319. var x = options.x,
  2320. y = options.y;
  2321. var popper = data.offsets.popper;
  2322. // Remove this legacy support in Popper.js v2
  2323. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  2324. return modifier.name === 'applyStyle';
  2325. }).gpuAcceleration;
  2326. if (legacyGpuAccelerationOption !== undefined) {
  2327. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  2328. }
  2329. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  2330. var offsetParent = getOffsetParent(data.instance.popper);
  2331. var offsetParentRect = getBoundingClientRect(offsetParent);
  2332. // Styles
  2333. var styles = {
  2334. position: popper.position
  2335. };
  2336. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  2337. var sideA = x === 'bottom' ? 'top' : 'bottom';
  2338. var sideB = y === 'right' ? 'left' : 'right';
  2339. // if gpuAcceleration is set to `true` and transform is supported,
  2340. // we use `translate3d` to apply the position to the popper we
  2341. // automatically use the supported prefixed version if needed
  2342. var prefixedProperty = getSupportedPropertyName('transform');
  2343. // now, let's make a step back and look at this code closely (wtf?)
  2344. // If the content of the popper grows once it's been positioned, it
  2345. // may happen that the popper gets misplaced because of the new content
  2346. // overflowing its reference element
  2347. // To avoid this problem, we provide two options (x and y), which allow
  2348. // the consumer to define the offset origin.
  2349. // If we position a popper on top of a reference element, we can set
  2350. // `x` to `top` to make the popper grow towards its top instead of
  2351. // its bottom.
  2352. var left = void 0,
  2353. top = void 0;
  2354. if (sideA === 'bottom') {
  2355. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  2356. // and not the bottom of the html element
  2357. if (offsetParent.nodeName === 'HTML') {
  2358. top = -offsetParent.clientHeight + offsets.bottom;
  2359. } else {
  2360. top = -offsetParentRect.height + offsets.bottom;
  2361. }
  2362. } else {
  2363. top = offsets.top;
  2364. }
  2365. if (sideB === 'right') {
  2366. if (offsetParent.nodeName === 'HTML') {
  2367. left = -offsetParent.clientWidth + offsets.right;
  2368. } else {
  2369. left = -offsetParentRect.width + offsets.right;
  2370. }
  2371. } else {
  2372. left = offsets.left;
  2373. }
  2374. if (gpuAcceleration && prefixedProperty) {
  2375. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  2376. styles[sideA] = 0;
  2377. styles[sideB] = 0;
  2378. styles.willChange = 'transform';
  2379. } else {
  2380. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  2381. var invertTop = sideA === 'bottom' ? -1 : 1;
  2382. var invertLeft = sideB === 'right' ? -1 : 1;
  2383. styles[sideA] = top * invertTop;
  2384. styles[sideB] = left * invertLeft;
  2385. styles.willChange = sideA + ', ' + sideB;
  2386. }
  2387. // Attributes
  2388. var attributes = {
  2389. 'x-placement': data.placement
  2390. };
  2391. // Update `data` attributes, styles and arrowStyles
  2392. data.attributes = _extends({}, attributes, data.attributes);
  2393. data.styles = _extends({}, styles, data.styles);
  2394. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  2395. return data;
  2396. }
  2397. /**
  2398. * Helper used to know if the given modifier depends from another one.<br />
  2399. * It checks if the needed modifier is listed and enabled.
  2400. * @method
  2401. * @memberof Popper.Utils
  2402. * @param {Array} modifiers - list of modifiers
  2403. * @param {String} requestingName - name of requesting modifier
  2404. * @param {String} requestedName - name of requested modifier
  2405. * @returns {Boolean}
  2406. */
  2407. function isModifierRequired(modifiers, requestingName, requestedName) {
  2408. var requesting = find(modifiers, function (_ref) {
  2409. var name = _ref.name;
  2410. return name === requestingName;
  2411. });
  2412. var isRequired = !!requesting && modifiers.some(function (modifier) {
  2413. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  2414. });
  2415. if (!isRequired) {
  2416. var _requesting = '`' + requestingName + '`';
  2417. var requested = '`' + requestedName + '`';
  2418. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  2419. }
  2420. return isRequired;
  2421. }
  2422. /**
  2423. * @function
  2424. * @memberof Modifiers
  2425. * @argument {Object} data - The data object generated by update method
  2426. * @argument {Object} options - Modifiers configuration and options
  2427. * @returns {Object} The data object, properly modified
  2428. */
  2429. function arrow(data, options) {
  2430. var _data$offsets$arrow;
  2431. // arrow depends on keepTogether in order to work
  2432. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  2433. return data;
  2434. }
  2435. var arrowElement = options.element;
  2436. // if arrowElement is a string, suppose it's a CSS selector
  2437. if (typeof arrowElement === 'string') {
  2438. arrowElement = data.instance.popper.querySelector(arrowElement);
  2439. // if arrowElement is not found, don't run the modifier
  2440. if (!arrowElement) {
  2441. return data;
  2442. }
  2443. } else {
  2444. // if the arrowElement isn't a query selector we must check that the
  2445. // provided DOM node is child of its popper node
  2446. if (!data.instance.popper.contains(arrowElement)) {
  2447. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  2448. return data;
  2449. }
  2450. }
  2451. var placement = data.placement.split('-')[0];
  2452. var _data$offsets = data.offsets,
  2453. popper = _data$offsets.popper,
  2454. reference = _data$offsets.reference;
  2455. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  2456. var len = isVertical ? 'height' : 'width';
  2457. var sideCapitalized = isVertical ? 'Top' : 'Left';
  2458. var side = sideCapitalized.toLowerCase();
  2459. var altSide = isVertical ? 'left' : 'top';
  2460. var opSide = isVertical ? 'bottom' : 'right';
  2461. var arrowElementSize = getOuterSizes(arrowElement)[len];
  2462. //
  2463. // extends keepTogether behavior making sure the popper and its
  2464. // reference have enough pixels in conjunction
  2465. //
  2466. // top/left side
  2467. if (reference[opSide] - arrowElementSize < popper[side]) {
  2468. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  2469. }
  2470. // bottom/right side
  2471. if (reference[side] + arrowElementSize > popper[opSide]) {
  2472. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  2473. }
  2474. data.offsets.popper = getClientRect(data.offsets.popper);
  2475. // compute center of the popper
  2476. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  2477. // Compute the sideValue using the updated popper offsets
  2478. // take popper margin in account because we don't have this info available
  2479. var css = getStyleComputedProperty(data.instance.popper);
  2480. var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10);
  2481. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10);
  2482. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  2483. // prevent arrowElement from being placed not contiguously to its popper
  2484. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  2485. data.arrowElement = arrowElement;
  2486. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  2487. return data;
  2488. }
  2489. /**
  2490. * Get the opposite placement variation of the given one
  2491. * @method
  2492. * @memberof Popper.Utils
  2493. * @argument {String} placement variation
  2494. * @returns {String} flipped placement variation
  2495. */
  2496. function getOppositeVariation(variation) {
  2497. if (variation === 'end') {
  2498. return 'start';
  2499. } else if (variation === 'start') {
  2500. return 'end';
  2501. }
  2502. return variation;
  2503. }
  2504. /**
  2505. * List of accepted placements to use as values of the `placement` option.<br />
  2506. * Valid placements are:
  2507. * - `auto`
  2508. * - `top`
  2509. * - `right`
  2510. * - `bottom`
  2511. * - `left`
  2512. *
  2513. * Each placement can have a variation from this list:
  2514. * - `-start`
  2515. * - `-end`
  2516. *
  2517. * Variations are interpreted easily if you think of them as the left to right
  2518. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  2519. * is right.<br />
  2520. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  2521. *
  2522. * Some valid examples are:
  2523. * - `top-end` (on top of reference, right aligned)
  2524. * - `right-start` (on right of reference, top aligned)
  2525. * - `bottom` (on bottom, centered)
  2526. * - `auto-end` (on the side with more space available, alignment depends by placement)
  2527. *
  2528. * @static
  2529. * @type {Array}
  2530. * @enum {String}
  2531. * @readonly
  2532. * @method placements
  2533. * @memberof Popper
  2534. */
  2535. var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
  2536. // Get rid of `auto` `auto-start` and `auto-end`
  2537. var validPlacements = placements.slice(3);
  2538. /**
  2539. * Given an initial placement, returns all the subsequent placements
  2540. * clockwise (or counter-clockwise).
  2541. *
  2542. * @method
  2543. * @memberof Popper.Utils
  2544. * @argument {String} placement - A valid placement (it accepts variations)
  2545. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  2546. * @returns {Array} placements including their variations
  2547. */
  2548. function clockwise(placement) {
  2549. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2550. var index = validPlacements.indexOf(placement);
  2551. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  2552. return counter ? arr.reverse() : arr;
  2553. }
  2554. var BEHAVIORS = {
  2555. FLIP: 'flip',
  2556. CLOCKWISE: 'clockwise',
  2557. COUNTERCLOCKWISE: 'counterclockwise'
  2558. };
  2559. /**
  2560. * @function
  2561. * @memberof Modifiers
  2562. * @argument {Object} data - The data object generated by update method
  2563. * @argument {Object} options - Modifiers configuration and options
  2564. * @returns {Object} The data object, properly modified
  2565. */
  2566. function flip(data, options) {
  2567. // if `inner` modifier is enabled, we can't use the `flip` modifier
  2568. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  2569. return data;
  2570. }
  2571. if (data.flipped && data.placement === data.originalPlacement) {
  2572. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  2573. return data;
  2574. }
  2575. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  2576. var placement = data.placement.split('-')[0];
  2577. var placementOpposite = getOppositePlacement(placement);
  2578. var variation = data.placement.split('-')[1] || '';
  2579. var flipOrder = [];
  2580. switch (options.behavior) {
  2581. case BEHAVIORS.FLIP:
  2582. flipOrder = [placement, placementOpposite];
  2583. break;
  2584. case BEHAVIORS.CLOCKWISE:
  2585. flipOrder = clockwise(placement);
  2586. break;
  2587. case BEHAVIORS.COUNTERCLOCKWISE:
  2588. flipOrder = clockwise(placement, true);
  2589. break;
  2590. default:
  2591. flipOrder = options.behavior;
  2592. }
  2593. flipOrder.forEach(function (step, index) {
  2594. if (placement !== step || flipOrder.length === index + 1) {
  2595. return data;
  2596. }
  2597. placement = data.placement.split('-')[0];
  2598. placementOpposite = getOppositePlacement(placement);
  2599. var popperOffsets = data.offsets.popper;
  2600. var refOffsets = data.offsets.reference;
  2601. // using floor because the reference offsets may contain decimals we are not going to consider here
  2602. var floor = Math.floor;
  2603. var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
  2604. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  2605. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  2606. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  2607. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  2608. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  2609. // flip the variation if required
  2610. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  2611. var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  2612. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  2613. // this boolean to detect any flip loop
  2614. data.flipped = true;
  2615. if (overlapsRef || overflowsBoundaries) {
  2616. placement = flipOrder[index + 1];
  2617. }
  2618. if (flippedVariation) {
  2619. variation = getOppositeVariation(variation);
  2620. }
  2621. data.placement = placement + (variation ? '-' + variation : '');
  2622. // this object contains `position`, we want to preserve it along with
  2623. // any additional property we may add in the future
  2624. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  2625. data = runModifiers(data.instance.modifiers, data, 'flip');
  2626. }
  2627. });
  2628. return data;
  2629. }
  2630. /**
  2631. * @function
  2632. * @memberof Modifiers
  2633. * @argument {Object} data - The data object generated by update method
  2634. * @argument {Object} options - Modifiers configuration and options
  2635. * @returns {Object} The data object, properly modified
  2636. */
  2637. function keepTogether(data) {
  2638. var _data$offsets = data.offsets,
  2639. popper = _data$offsets.popper,
  2640. reference = _data$offsets.reference;
  2641. var placement = data.placement.split('-')[0];
  2642. var floor = Math.floor;
  2643. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  2644. var side = isVertical ? 'right' : 'bottom';
  2645. var opSide = isVertical ? 'left' : 'top';
  2646. var measurement = isVertical ? 'width' : 'height';
  2647. if (popper[side] < floor(reference[opSide])) {
  2648. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  2649. }
  2650. if (popper[opSide] > floor(reference[side])) {
  2651. data.offsets.popper[opSide] = floor(reference[side]);
  2652. }
  2653. return data;
  2654. }
  2655. /**
  2656. * Converts a string containing value + unit into a px value number
  2657. * @function
  2658. * @memberof {modifiers~offset}
  2659. * @private
  2660. * @argument {String} str - Value + unit string
  2661. * @argument {String} measurement - `height` or `width`
  2662. * @argument {Object} popperOffsets
  2663. * @argument {Object} referenceOffsets
  2664. * @returns {Number|String}
  2665. * Value in pixels, or original string if no values were extracted
  2666. */
  2667. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  2668. // separate value from unit
  2669. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  2670. var value = +split[1];
  2671. var unit = split[2];
  2672. // If it's not a number it's an operator, I guess
  2673. if (!value) {
  2674. return str;
  2675. }
  2676. if (unit.indexOf('%') === 0) {
  2677. var element = void 0;
  2678. switch (unit) {
  2679. case '%p':
  2680. element = popperOffsets;
  2681. break;
  2682. case '%':
  2683. case '%r':
  2684. default:
  2685. element = referenceOffsets;
  2686. }
  2687. var rect = getClientRect(element);
  2688. return rect[measurement] / 100 * value;
  2689. } else if (unit === 'vh' || unit === 'vw') {
  2690. // if is a vh or vw, we calculate the size based on the viewport
  2691. var size = void 0;
  2692. if (unit === 'vh') {
  2693. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  2694. } else {
  2695. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  2696. }
  2697. return size / 100 * value;
  2698. } else {
  2699. // if is an explicit pixel unit, we get rid of the unit and keep the value
  2700. // if is an implicit unit, it's px, and we return just the value
  2701. return value;
  2702. }
  2703. }
  2704. /**
  2705. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  2706. * @function
  2707. * @memberof {modifiers~offset}
  2708. * @private
  2709. * @argument {String} offset
  2710. * @argument {Object} popperOffsets
  2711. * @argument {Object} referenceOffsets
  2712. * @argument {String} basePlacement
  2713. * @returns {Array} a two cells array with x and y offsets in numbers
  2714. */
  2715. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  2716. var offsets = [0, 0];
  2717. // Use height if placement is left or right and index is 0 otherwise use width
  2718. // in this way the first offset will use an axis and the second one
  2719. // will use the other one
  2720. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  2721. // Split the offset string to obtain a list of values and operands
  2722. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  2723. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  2724. return frag.trim();
  2725. });
  2726. // Detect if the offset string contains a pair of values or a single one
  2727. // they could be separated by comma or space
  2728. var divider = fragments.indexOf(find(fragments, function (frag) {
  2729. return frag.search(/,|\s/) !== -1;
  2730. }));
  2731. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  2732. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  2733. }
  2734. // If divider is found, we divide the list of values and operands to divide
  2735. // them by ofset X and Y.
  2736. var splitRegex = /\s*,\s*|\s+/;
  2737. var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
  2738. // Convert the values with units to absolute pixels to allow our computations
  2739. ops = ops.map(function (op, index) {
  2740. // Most of the units rely on the orientation of the popper
  2741. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  2742. var mergeWithPrevious = false;
  2743. return op
  2744. // This aggregates any `+` or `-` sign that aren't considered operators
  2745. // e.g.: 10 + +5 => [10, +, +5]
  2746. .reduce(function (a, b) {
  2747. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  2748. a[a.length - 1] = b;
  2749. mergeWithPrevious = true;
  2750. return a;
  2751. } else if (mergeWithPrevious) {
  2752. a[a.length - 1] += b;
  2753. mergeWithPrevious = false;
  2754. return a;
  2755. } else {
  2756. return a.concat(b);
  2757. }
  2758. }, [])
  2759. // Here we convert the string values into number values (in px)
  2760. .map(function (str) {
  2761. return toValue(str, measurement, popperOffsets, referenceOffsets);
  2762. });
  2763. });
  2764. // Loop trough the offsets arrays and execute the operations
  2765. ops.forEach(function (op, index) {
  2766. op.forEach(function (frag, index2) {
  2767. if (isNumeric(frag)) {
  2768. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  2769. }
  2770. });
  2771. });
  2772. return offsets;
  2773. }
  2774. /**
  2775. * @function
  2776. * @memberof Modifiers
  2777. * @argument {Object} data - The data object generated by update method
  2778. * @argument {Object} options - Modifiers configuration and options
  2779. * @argument {Number|String} options.offset=0
  2780. * The offset value as described in the modifier description
  2781. * @returns {Object} The data object, properly modified
  2782. */
  2783. function offset(data, _ref) {
  2784. var offset = _ref.offset;
  2785. var placement = data.placement,
  2786. _data$offsets = data.offsets,
  2787. popper = _data$offsets.popper,
  2788. reference = _data$offsets.reference;
  2789. var basePlacement = placement.split('-')[0];
  2790. var offsets = void 0;
  2791. if (isNumeric(+offset)) {
  2792. offsets = [+offset, 0];
  2793. } else {
  2794. offsets = parseOffset(offset, popper, reference, basePlacement);
  2795. }
  2796. if (basePlacement === 'left') {
  2797. popper.top += offsets[0];
  2798. popper.left -= offsets[1];
  2799. } else if (basePlacement === 'right') {
  2800. popper.top += offsets[0];
  2801. popper.left += offsets[1];
  2802. } else if (basePlacement === 'top') {
  2803. popper.left += offsets[0];
  2804. popper.top -= offsets[1];
  2805. } else if (basePlacement === 'bottom') {
  2806. popper.left += offsets[0];
  2807. popper.top += offsets[1];
  2808. }
  2809. data.popper = popper;
  2810. return data;
  2811. }
  2812. /**
  2813. * @function
  2814. * @memberof Modifiers
  2815. * @argument {Object} data - The data object generated by `update` method
  2816. * @argument {Object} options - Modifiers configuration and options
  2817. * @returns {Object} The data object, properly modified
  2818. */
  2819. function preventOverflow(data, options) {
  2820. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  2821. // If offsetParent is the reference element, we really want to
  2822. // go one step up and use the next offsetParent as reference to
  2823. // avoid to make this modifier completely useless and look like broken
  2824. if (data.instance.reference === boundariesElement) {
  2825. boundariesElement = getOffsetParent(boundariesElement);
  2826. }
  2827. // NOTE: DOM access here
  2828. // resets the popper's position so that the document size can be calculated excluding
  2829. // the size of the popper element itself
  2830. var transformProp = getSupportedPropertyName('transform');
  2831. var popperStyles = data.instance.popper.style; // assignment to help minification
  2832. var top = popperStyles.top,
  2833. left = popperStyles.left,
  2834. transform = popperStyles[transformProp];
  2835. popperStyles.top = '';
  2836. popperStyles.left = '';
  2837. popperStyles[transformProp] = '';
  2838. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  2839. // NOTE: DOM access here
  2840. // restores the original style properties after the offsets have been computed
  2841. popperStyles.top = top;
  2842. popperStyles.left = left;
  2843. popperStyles[transformProp] = transform;
  2844. options.boundaries = boundaries;
  2845. var order = options.priority;
  2846. var popper = data.offsets.popper;
  2847. var check = {
  2848. primary: function primary(placement) {
  2849. var value = popper[placement];
  2850. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  2851. value = Math.max(popper[placement], boundaries[placement]);
  2852. }
  2853. return defineProperty({}, placement, value);
  2854. },
  2855. secondary: function secondary(placement) {
  2856. var mainSide = placement === 'right' ? 'left' : 'top';
  2857. var value = popper[mainSide];
  2858. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  2859. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  2860. }
  2861. return defineProperty({}, mainSide, value);
  2862. }
  2863. };
  2864. order.forEach(function (placement) {
  2865. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  2866. popper = _extends({}, popper, check[side](placement));
  2867. });
  2868. data.offsets.popper = popper;
  2869. return data;
  2870. }
  2871. /**
  2872. * @function
  2873. * @memberof Modifiers
  2874. * @argument {Object} data - The data object generated by `update` method
  2875. * @argument {Object} options - Modifiers configuration and options
  2876. * @returns {Object} The data object, properly modified
  2877. */
  2878. function shift(data) {
  2879. var placement = data.placement;
  2880. var basePlacement = placement.split('-')[0];
  2881. var shiftvariation = placement.split('-')[1];
  2882. // if shift shiftvariation is specified, run the modifier
  2883. if (shiftvariation) {
  2884. var _data$offsets = data.offsets,
  2885. reference = _data$offsets.reference,
  2886. popper = _data$offsets.popper;
  2887. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  2888. var side = isVertical ? 'left' : 'top';
  2889. var measurement = isVertical ? 'width' : 'height';
  2890. var shiftOffsets = {
  2891. start: defineProperty({}, side, reference[side]),
  2892. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  2893. };
  2894. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  2895. }
  2896. return data;
  2897. }
  2898. /**
  2899. * @function
  2900. * @memberof Modifiers
  2901. * @argument {Object} data - The data object generated by update method
  2902. * @argument {Object} options - Modifiers configuration and options
  2903. * @returns {Object} The data object, properly modified
  2904. */
  2905. function hide(data) {
  2906. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  2907. return data;
  2908. }
  2909. var refRect = data.offsets.reference;
  2910. var bound = find(data.instance.modifiers, function (modifier) {
  2911. return modifier.name === 'preventOverflow';
  2912. }).boundaries;
  2913. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  2914. // Avoid unnecessary DOM access if visibility hasn't changed
  2915. if (data.hide === true) {
  2916. return data;
  2917. }
  2918. data.hide = true;
  2919. data.attributes['x-out-of-boundaries'] = '';
  2920. } else {
  2921. // Avoid unnecessary DOM access if visibility hasn't changed
  2922. if (data.hide === false) {
  2923. return data;
  2924. }
  2925. data.hide = false;
  2926. data.attributes['x-out-of-boundaries'] = false;
  2927. }
  2928. return data;
  2929. }
  2930. /**
  2931. * @function
  2932. * @memberof Modifiers
  2933. * @argument {Object} data - The data object generated by `update` method
  2934. * @argument {Object} options - Modifiers configuration and options
  2935. * @returns {Object} The data object, properly modified
  2936. */
  2937. function inner(data) {
  2938. var placement = data.placement;
  2939. var basePlacement = placement.split('-')[0];
  2940. var _data$offsets = data.offsets,
  2941. popper = _data$offsets.popper,
  2942. reference = _data$offsets.reference;
  2943. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  2944. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  2945. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  2946. data.placement = getOppositePlacement(placement);
  2947. data.offsets.popper = getClientRect(popper);
  2948. return data;
  2949. }
  2950. /**
  2951. * Modifier function, each modifier can have a function of this type assigned
  2952. * to its `fn` property.<br />
  2953. * These functions will be called on each update, this means that you must
  2954. * make sure they are performant enough to avoid performance bottlenecks.
  2955. *
  2956. * @function ModifierFn
  2957. * @argument {dataObject} data - The data object generated by `update` method
  2958. * @argument {Object} options - Modifiers configuration and options
  2959. * @returns {dataObject} The data object, properly modified
  2960. */
  2961. /**
  2962. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  2963. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  2964. * needed by the library.
  2965. *
  2966. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  2967. * All the other properties are configurations that could be tweaked.
  2968. * @namespace modifiers
  2969. */
  2970. var modifiers = {
  2971. /**
  2972. * Modifier used to shift the popper on the start or end of its reference
  2973. * element.<br />
  2974. * It will read the variation of the `placement` property.<br />
  2975. * It can be one either `-end` or `-start`.
  2976. * @memberof modifiers
  2977. * @inner
  2978. */
  2979. shift: {
  2980. /** @prop {number} order=100 - Index used to define the order of execution */
  2981. order: 100,
  2982. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  2983. enabled: true,
  2984. /** @prop {ModifierFn} */
  2985. fn: shift
  2986. },
  2987. /**
  2988. * The `offset` modifier can shift your popper on both its axis.
  2989. *
  2990. * It accepts the following units:
  2991. * - `px` or unit-less, interpreted as pixels
  2992. * - `%` or `%r`, percentage relative to the length of the reference element
  2993. * - `%p`, percentage relative to the length of the popper element
  2994. * - `vw`, CSS viewport width unit
  2995. * - `vh`, CSS viewport height unit
  2996. *
  2997. * For length is intended the main axis relative to the placement of the popper.<br />
  2998. * This means that if the placement is `top` or `bottom`, the length will be the
  2999. * `width`. In case of `left` or `right`, it will be the `height`.
  3000. *
  3001. * You can provide a single value (as `Number` or `String`), or a pair of values
  3002. * as `String` divided by a comma or one (or more) white spaces.<br />
  3003. * The latter is a deprecated method because it leads to confusion and will be
  3004. * removed in v2.<br />
  3005. * Additionally, it accepts additions and subtractions between different units.
  3006. * Note that multiplications and divisions aren't supported.
  3007. *
  3008. * Valid examples are:
  3009. * ```
  3010. * 10
  3011. * '10%'
  3012. * '10, 10'
  3013. * '10%, 10'
  3014. * '10 + 10%'
  3015. * '10 - 5vh + 3%'
  3016. * '-10px + 5vh, 5px - 6%'
  3017. * ```
  3018. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  3019. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  3020. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  3021. *
  3022. * @memberof modifiers
  3023. * @inner
  3024. */
  3025. offset: {
  3026. /** @prop {number} order=200 - Index used to define the order of execution */
  3027. order: 200,
  3028. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3029. enabled: true,
  3030. /** @prop {ModifierFn} */
  3031. fn: offset,
  3032. /** @prop {Number|String} offset=0
  3033. * The offset value as described in the modifier description
  3034. */
  3035. offset: 0
  3036. },
  3037. /**
  3038. * Modifier used to prevent the popper from being positioned outside the boundary.
  3039. *
  3040. * A scenario exists where the reference itself is not within the boundaries.<br />
  3041. * We can say it has "escaped the boundaries" or just "escaped".<br />
  3042. * In this case we need to decide whether the popper should either:
  3043. *
  3044. * - detach from the reference and remain "trapped" in the boundaries, or
  3045. * - if it should ignore the boundary and "escape with its reference"
  3046. *
  3047. * When `escapeWithReference` is set to`true` and reference is completely
  3048. * outside its boundaries, the popper will overflow (or completely leave)
  3049. * the boundaries in order to remain attached to the edge of the reference.
  3050. *
  3051. * @memberof modifiers
  3052. * @inner
  3053. */
  3054. preventOverflow: {
  3055. /** @prop {number} order=300 - Index used to define the order of execution */
  3056. order: 300,
  3057. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3058. enabled: true,
  3059. /** @prop {ModifierFn} */
  3060. fn: preventOverflow,
  3061. /**
  3062. * @prop {Array} [priority=['left','right','top','bottom']]
  3063. * Popper will try to prevent overflow following these priorities by default,
  3064. * then, it could overflow on the left and on top of the `boundariesElement`
  3065. */
  3066. priority: ['left', 'right', 'top', 'bottom'],
  3067. /**
  3068. * @prop {number} padding=5
  3069. * Amount of pixel used to define a minimum distance between the boundaries
  3070. * and the popper. This makes sure the popper always has a little padding
  3071. * between the edges of its container
  3072. */
  3073. padding: 5,
  3074. /**
  3075. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  3076. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  3077. * `viewport` or any DOM element.
  3078. */
  3079. boundariesElement: 'scrollParent'
  3080. },
  3081. /**
  3082. * Modifier used to make sure the reference and its popper stay near each other
  3083. * without leaving any gap between the two. Especially useful when the arrow is
  3084. * enabled and you want to ensure that it points to its reference element.
  3085. * It cares only about the first axis. You can still have poppers with margin
  3086. * between the popper and its reference element.
  3087. * @memberof modifiers
  3088. * @inner
  3089. */
  3090. keepTogether: {
  3091. /** @prop {number} order=400 - Index used to define the order of execution */
  3092. order: 400,
  3093. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3094. enabled: true,
  3095. /** @prop {ModifierFn} */
  3096. fn: keepTogether
  3097. },
  3098. /**
  3099. * This modifier is used to move the `arrowElement` of the popper to make
  3100. * sure it is positioned between the reference element and its popper element.
  3101. * It will read the outer size of the `arrowElement` node to detect how many
  3102. * pixels of conjunction are needed.
  3103. *
  3104. * It has no effect if no `arrowElement` is provided.
  3105. * @memberof modifiers
  3106. * @inner
  3107. */
  3108. arrow: {
  3109. /** @prop {number} order=500 - Index used to define the order of execution */
  3110. order: 500,
  3111. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3112. enabled: true,
  3113. /** @prop {ModifierFn} */
  3114. fn: arrow,
  3115. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  3116. element: '[x-arrow]'
  3117. },
  3118. /**
  3119. * Modifier used to flip the popper's placement when it starts to overlap its
  3120. * reference element.
  3121. *
  3122. * Requires the `preventOverflow` modifier before it in order to work.
  3123. *
  3124. * **NOTE:** this modifier will interrupt the current update cycle and will
  3125. * restart it if it detects the need to flip the placement.
  3126. * @memberof modifiers
  3127. * @inner
  3128. */
  3129. flip: {
  3130. /** @prop {number} order=600 - Index used to define the order of execution */
  3131. order: 600,
  3132. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3133. enabled: true,
  3134. /** @prop {ModifierFn} */
  3135. fn: flip,
  3136. /**
  3137. * @prop {String|Array} behavior='flip'
  3138. * The behavior used to change the popper's placement. It can be one of
  3139. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  3140. * placements (with optional variations)
  3141. */
  3142. behavior: 'flip',
  3143. /**
  3144. * @prop {number} padding=5
  3145. * The popper will flip if it hits the edges of the `boundariesElement`
  3146. */
  3147. padding: 5,
  3148. /**
  3149. * @prop {String|HTMLElement} boundariesElement='viewport'
  3150. * The element which will define the boundaries of the popper position.
  3151. * The popper will never be placed outside of the defined boundaries
  3152. * (except if `keepTogether` is enabled)
  3153. */
  3154. boundariesElement: 'viewport'
  3155. },
  3156. /**
  3157. * Modifier used to make the popper flow toward the inner of the reference element.
  3158. * By default, when this modifier is disabled, the popper will be placed outside
  3159. * the reference element.
  3160. * @memberof modifiers
  3161. * @inner
  3162. */
  3163. inner: {
  3164. /** @prop {number} order=700 - Index used to define the order of execution */
  3165. order: 700,
  3166. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  3167. enabled: false,
  3168. /** @prop {ModifierFn} */
  3169. fn: inner
  3170. },
  3171. /**
  3172. * Modifier used to hide the popper when its reference element is outside of the
  3173. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  3174. * be used to hide with a CSS selector the popper when its reference is
  3175. * out of boundaries.
  3176. *
  3177. * Requires the `preventOverflow` modifier before it in order to work.
  3178. * @memberof modifiers
  3179. * @inner
  3180. */
  3181. hide: {
  3182. /** @prop {number} order=800 - Index used to define the order of execution */
  3183. order: 800,
  3184. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3185. enabled: true,
  3186. /** @prop {ModifierFn} */
  3187. fn: hide
  3188. },
  3189. /**
  3190. * Computes the style that will be applied to the popper element to gets
  3191. * properly positioned.
  3192. *
  3193. * Note that this modifier will not touch the DOM, it just prepares the styles
  3194. * so that `applyStyle` modifier can apply it. This separation is useful
  3195. * in case you need to replace `applyStyle` with a custom implementation.
  3196. *
  3197. * This modifier has `850` as `order` value to maintain backward compatibility
  3198. * with previous versions of Popper.js. Expect the modifiers ordering method
  3199. * to change in future major versions of the library.
  3200. *
  3201. * @memberof modifiers
  3202. * @inner
  3203. */
  3204. computeStyle: {
  3205. /** @prop {number} order=850 - Index used to define the order of execution */
  3206. order: 850,
  3207. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3208. enabled: true,
  3209. /** @prop {ModifierFn} */
  3210. fn: computeStyle,
  3211. /**
  3212. * @prop {Boolean} gpuAcceleration=true
  3213. * If true, it uses the CSS 3D transformation to position the popper.
  3214. * Otherwise, it will use the `top` and `left` properties
  3215. */
  3216. gpuAcceleration: true,
  3217. /**
  3218. * @prop {string} [x='bottom']
  3219. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  3220. * Change this if your popper should grow in a direction different from `bottom`
  3221. */
  3222. x: 'bottom',
  3223. /**
  3224. * @prop {string} [x='left']
  3225. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  3226. * Change this if your popper should grow in a direction different from `right`
  3227. */
  3228. y: 'right'
  3229. },
  3230. /**
  3231. * Applies the computed styles to the popper element.
  3232. *
  3233. * All the DOM manipulations are limited to this modifier. This is useful in case
  3234. * you want to integrate Popper.js inside a framework or view library and you
  3235. * want to delegate all the DOM manipulations to it.
  3236. *
  3237. * Note that if you disable this modifier, you must make sure the popper element
  3238. * has its position set to `absolute` before Popper.js can do its work!
  3239. *
  3240. * Just disable this modifier and define your own to achieve the desired effect.
  3241. *
  3242. * @memberof modifiers
  3243. * @inner
  3244. */
  3245. applyStyle: {
  3246. /** @prop {number} order=900 - Index used to define the order of execution */
  3247. order: 900,
  3248. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3249. enabled: true,
  3250. /** @prop {ModifierFn} */
  3251. fn: applyStyle,
  3252. /** @prop {Function} */
  3253. onLoad: applyStyleOnLoad,
  3254. /**
  3255. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  3256. * @prop {Boolean} gpuAcceleration=true
  3257. * If true, it uses the CSS 3D transformation to position the popper.
  3258. * Otherwise, it will use the `top` and `left` properties
  3259. */
  3260. gpuAcceleration: undefined
  3261. }
  3262. };
  3263. /**
  3264. * The `dataObject` is an object containing all the information used by Popper.js.
  3265. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  3266. * @name dataObject
  3267. * @property {Object} data.instance The Popper.js instance
  3268. * @property {String} data.placement Placement applied to popper
  3269. * @property {String} data.originalPlacement Placement originally defined on init
  3270. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  3271. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  3272. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  3273. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  3274. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  3275. * @property {Object} data.boundaries Offsets of the popper boundaries
  3276. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  3277. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  3278. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  3279. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  3280. */
  3281. /**
  3282. * Default options provided to Popper.js constructor.<br />
  3283. * These can be overridden using the `options` argument of Popper.js.<br />
  3284. * To override an option, simply pass an object with the same
  3285. * structure of the `options` object, as the 3rd argument. For example:
  3286. * ```
  3287. * new Popper(ref, pop, {
  3288. * modifiers: {
  3289. * preventOverflow: { enabled: false }
  3290. * }
  3291. * })
  3292. * ```
  3293. * @type {Object}
  3294. * @static
  3295. * @memberof Popper
  3296. */
  3297. var Defaults = {
  3298. /**
  3299. * Popper's placement.
  3300. * @prop {Popper.placements} placement='bottom'
  3301. */
  3302. placement: 'bottom',
  3303. /**
  3304. * Set this to true if you want popper to position it self in 'fixed' mode
  3305. * @prop {Boolean} positionFixed=false
  3306. */
  3307. positionFixed: false,
  3308. /**
  3309. * Whether events (resize, scroll) are initially enabled.
  3310. * @prop {Boolean} eventsEnabled=true
  3311. */
  3312. eventsEnabled: true,
  3313. /**
  3314. * Set to true if you want to automatically remove the popper when
  3315. * you call the `destroy` method.
  3316. * @prop {Boolean} removeOnDestroy=false
  3317. */
  3318. removeOnDestroy: false,
  3319. /**
  3320. * Callback called when the popper is created.<br />
  3321. * By default, it is set to no-op.<br />
  3322. * Access Popper.js instance with `data.instance`.
  3323. * @prop {onCreate}
  3324. */
  3325. onCreate: function onCreate() {},
  3326. /**
  3327. * Callback called when the popper is updated. This callback is not called
  3328. * on the initialization/creation of the popper, but only on subsequent
  3329. * updates.<br />
  3330. * By default, it is set to no-op.<br />
  3331. * Access Popper.js instance with `data.instance`.
  3332. * @prop {onUpdate}
  3333. */
  3334. onUpdate: function onUpdate() {},
  3335. /**
  3336. * List of modifiers used to modify the offsets before they are applied to the popper.
  3337. * They provide most of the functionalities of Popper.js.
  3338. * @prop {modifiers}
  3339. */
  3340. modifiers: modifiers
  3341. };
  3342. /**
  3343. * @callback onCreate
  3344. * @param {dataObject} data
  3345. */
  3346. /**
  3347. * @callback onUpdate
  3348. * @param {dataObject} data
  3349. */
  3350. // Utils
  3351. // Methods
  3352. var Popper = function () {
  3353. /**
  3354. * Creates a new Popper.js instance.
  3355. * @class Popper
  3356. * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper
  3357. * @param {HTMLElement} popper - The HTML element used as the popper
  3358. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  3359. * @return {Object} instance - The generated Popper.js instance
  3360. */
  3361. function Popper(reference, popper) {
  3362. var _this = this;
  3363. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3364. classCallCheck(this, Popper);
  3365. this.scheduleUpdate = function () {
  3366. return requestAnimationFrame(_this.update);
  3367. };
  3368. // make update() debounced, so that it only runs at most once-per-tick
  3369. this.update = debounce(this.update.bind(this));
  3370. // with {} we create a new object with the options inside it
  3371. this.options = _extends({}, Popper.Defaults, options);
  3372. // init state
  3373. this.state = {
  3374. isDestroyed: false,
  3375. isCreated: false,
  3376. scrollParents: []
  3377. };
  3378. // get reference and popper elements (allow jQuery wrappers)
  3379. this.reference = reference && reference.jquery ? reference[0] : reference;
  3380. this.popper = popper && popper.jquery ? popper[0] : popper;
  3381. // Deep merge modifiers options
  3382. this.options.modifiers = {};
  3383. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  3384. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  3385. });
  3386. // Refactoring modifiers' list (Object => Array)
  3387. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  3388. return _extends({
  3389. name: name
  3390. }, _this.options.modifiers[name]);
  3391. })
  3392. // sort the modifiers by order
  3393. .sort(function (a, b) {
  3394. return a.order - b.order;
  3395. });
  3396. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  3397. // such code is executed in the same order of its modifier
  3398. // they could add new properties to their options configuration
  3399. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  3400. this.modifiers.forEach(function (modifierOptions) {
  3401. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  3402. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  3403. }
  3404. });
  3405. // fire the first update to position the popper in the right place
  3406. this.update();
  3407. var eventsEnabled = this.options.eventsEnabled;
  3408. if (eventsEnabled) {
  3409. // setup event listeners, they will take care of update the position in specific situations
  3410. this.enableEventListeners();
  3411. }
  3412. this.state.eventsEnabled = eventsEnabled;
  3413. }
  3414. // We can't use class properties because they don't get listed in the
  3415. // class prototype and break stuff like Sinon stubs
  3416. createClass(Popper, [{
  3417. key: 'update',
  3418. value: function update$$1() {
  3419. return update.call(this);
  3420. }
  3421. }, {
  3422. key: 'destroy',
  3423. value: function destroy$$1() {
  3424. return destroy.call(this);
  3425. }
  3426. }, {
  3427. key: 'enableEventListeners',
  3428. value: function enableEventListeners$$1() {
  3429. return enableEventListeners.call(this);
  3430. }
  3431. }, {
  3432. key: 'disableEventListeners',
  3433. value: function disableEventListeners$$1() {
  3434. return disableEventListeners.call(this);
  3435. }
  3436. /**
  3437. * Schedules an update. It will run on the next UI update available.
  3438. * @method scheduleUpdate
  3439. * @memberof Popper
  3440. */
  3441. /**
  3442. * Collection of utilities useful when writing custom modifiers.
  3443. * Starting from version 1.7, this method is available only if you
  3444. * include `popper-utils.js` before `popper.js`.
  3445. *
  3446. * **DEPRECATION**: This way to access PopperUtils is deprecated
  3447. * and will be removed in v2! Use the PopperUtils module directly instead.
  3448. * Due to the high instability of the methods contained in Utils, we can't
  3449. * guarantee them to follow semver. Use them at your own risk!
  3450. * @static
  3451. * @private
  3452. * @type {Object}
  3453. * @deprecated since version 1.8
  3454. * @member Utils
  3455. * @memberof Popper
  3456. */
  3457. }]);
  3458. return Popper;
  3459. }();
  3460. /**
  3461. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  3462. * and lets you use it as replacement of a real DOM node.<br />
  3463. * You can use this method to position a popper relatively to a set of coordinates
  3464. * in case you don't have a DOM node to use as reference.
  3465. *
  3466. * ```
  3467. * new Popper(referenceObject, popperNode);
  3468. * ```
  3469. *
  3470. * NB: This feature isn't supported in Internet Explorer 10.
  3471. * @name referenceObject
  3472. * @property {Function} data.getBoundingClientRect
  3473. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  3474. * @property {number} data.clientWidth
  3475. * An ES6 getter that will return the width of the virtual reference element.
  3476. * @property {number} data.clientHeight
  3477. * An ES6 getter that will return the height of the virtual reference element.
  3478. */
  3479. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  3480. Popper.placements = placements;
  3481. Popper.Defaults = Defaults;
  3482. /**
  3483. * ------------------------------------------------------------------------
  3484. * Constants
  3485. * ------------------------------------------------------------------------
  3486. */
  3487. var NAME$4 = 'dropdown';
  3488. var VERSION$4 = '4.3.1';
  3489. var DATA_KEY$4 = 'bs.dropdown';
  3490. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3491. var DATA_API_KEY$4 = '.data-api';
  3492. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3493. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3494. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3495. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3496. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3497. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3498. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3499. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3500. var Event$4 = {
  3501. HIDE: "hide" + EVENT_KEY$4,
  3502. HIDDEN: "hidden" + EVENT_KEY$4,
  3503. SHOW: "show" + EVENT_KEY$4,
  3504. SHOWN: "shown" + EVENT_KEY$4,
  3505. CLICK: "click" + EVENT_KEY$4,
  3506. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3507. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3508. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3509. };
  3510. var ClassName$4 = {
  3511. DISABLED: 'disabled',
  3512. SHOW: 'show',
  3513. DROPUP: 'dropup',
  3514. DROPRIGHT: 'dropright',
  3515. DROPLEFT: 'dropleft',
  3516. MENURIGHT: 'dropdown-menu-right',
  3517. MENULEFT: 'dropdown-menu-left',
  3518. POSITION_STATIC: 'position-static'
  3519. };
  3520. var Selector$4 = {
  3521. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3522. FORM_CHILD: '.dropdown form',
  3523. MENU: '.dropdown-menu',
  3524. NAVBAR_NAV: '.navbar-nav',
  3525. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3526. };
  3527. var AttachmentMap = {
  3528. TOP: 'top-start',
  3529. TOPEND: 'top-end',
  3530. BOTTOM: 'bottom-start',
  3531. BOTTOMEND: 'bottom-end',
  3532. RIGHT: 'right-start',
  3533. RIGHTEND: 'right-end',
  3534. LEFT: 'left-start',
  3535. LEFTEND: 'left-end'
  3536. };
  3537. var Default$2 = {
  3538. offset: 0,
  3539. flip: true,
  3540. boundary: 'scrollParent',
  3541. reference: 'toggle',
  3542. display: 'dynamic'
  3543. };
  3544. var DefaultType$2 = {
  3545. offset: '(number|string|function)',
  3546. flip: 'boolean',
  3547. boundary: '(string|element)',
  3548. reference: '(string|element)',
  3549. display: 'string'
  3550. /**
  3551. * ------------------------------------------------------------------------
  3552. * Class Definition
  3553. * ------------------------------------------------------------------------
  3554. */
  3555. };
  3556. var Dropdown =
  3557. /*#__PURE__*/
  3558. function () {
  3559. function Dropdown(element, config) {
  3560. this._element = element;
  3561. this._popper = null;
  3562. this._config = this._getConfig(config);
  3563. this._menu = this._getMenuElement();
  3564. this._inNavbar = this._detectNavbar();
  3565. this._addEventListeners();
  3566. } // Getters
  3567. var _proto = Dropdown.prototype;
  3568. // Public
  3569. _proto.toggle = function toggle() {
  3570. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3571. return;
  3572. }
  3573. var parent = Dropdown._getParentFromElement(this._element);
  3574. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3575. Dropdown._clearMenus();
  3576. if (isActive) {
  3577. return;
  3578. }
  3579. var relatedTarget = {
  3580. relatedTarget: this._element
  3581. };
  3582. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3583. $(parent).trigger(showEvent);
  3584. if (showEvent.isDefaultPrevented()) {
  3585. return;
  3586. } // Disable totally Popper.js for Dropdown in Navbar
  3587. if (!this._inNavbar) {
  3588. /**
  3589. * Check for Popper dependency
  3590. * Popper - https://popper.js.org
  3591. */
  3592. if (typeof Popper === 'undefined') {
  3593. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3594. }
  3595. var referenceElement = this._element;
  3596. if (this._config.reference === 'parent') {
  3597. referenceElement = parent;
  3598. } else if (Util.isElement(this._config.reference)) {
  3599. referenceElement = this._config.reference; // Check if it's jQuery element
  3600. if (typeof this._config.reference.jquery !== 'undefined') {
  3601. referenceElement = this._config.reference[0];
  3602. }
  3603. } // If boundary is not `scrollParent`, then set position to `static`
  3604. // to allow the menu to "escape" the scroll parent's boundaries
  3605. // https://github.com/twbs/bootstrap/issues/24251
  3606. if (this._config.boundary !== 'scrollParent') {
  3607. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3608. }
  3609. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3610. } // If this is a touch-enabled device we add extra
  3611. // empty mouseover listeners to the body's immediate children;
  3612. // only needed because of broken event delegation on iOS
  3613. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3614. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3615. $(document.body).children().on('mouseover', null, $.noop);
  3616. }
  3617. this._element.focus();
  3618. this._element.setAttribute('aria-expanded', true);
  3619. $(this._menu).toggleClass(ClassName$4.SHOW);
  3620. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3621. };
  3622. _proto.show = function show() {
  3623. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3624. return;
  3625. }
  3626. var relatedTarget = {
  3627. relatedTarget: this._element
  3628. };
  3629. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3630. var parent = Dropdown._getParentFromElement(this._element);
  3631. $(parent).trigger(showEvent);
  3632. if (showEvent.isDefaultPrevented()) {
  3633. return;
  3634. }
  3635. $(this._menu).toggleClass(ClassName$4.SHOW);
  3636. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3637. };
  3638. _proto.hide = function hide() {
  3639. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3640. return;
  3641. }
  3642. var relatedTarget = {
  3643. relatedTarget: this._element
  3644. };
  3645. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3646. var parent = Dropdown._getParentFromElement(this._element);
  3647. $(parent).trigger(hideEvent);
  3648. if (hideEvent.isDefaultPrevented()) {
  3649. return;
  3650. }
  3651. $(this._menu).toggleClass(ClassName$4.SHOW);
  3652. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3653. };
  3654. _proto.dispose = function dispose() {
  3655. $.removeData(this._element, DATA_KEY$4);
  3656. $(this._element).off(EVENT_KEY$4);
  3657. this._element = null;
  3658. this._menu = null;
  3659. if (this._popper !== null) {
  3660. this._popper.destroy();
  3661. this._popper = null;
  3662. }
  3663. };
  3664. _proto.update = function update() {
  3665. this._inNavbar = this._detectNavbar();
  3666. if (this._popper !== null) {
  3667. this._popper.scheduleUpdate();
  3668. }
  3669. } // Private
  3670. ;
  3671. _proto._addEventListeners = function _addEventListeners() {
  3672. var _this = this;
  3673. $(this._element).on(Event$4.CLICK, function (event) {
  3674. event.preventDefault();
  3675. event.stopPropagation();
  3676. _this.toggle();
  3677. });
  3678. };
  3679. _proto._getConfig = function _getConfig(config) {
  3680. config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config);
  3681. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3682. return config;
  3683. };
  3684. _proto._getMenuElement = function _getMenuElement() {
  3685. if (!this._menu) {
  3686. var parent = Dropdown._getParentFromElement(this._element);
  3687. if (parent) {
  3688. this._menu = parent.querySelector(Selector$4.MENU);
  3689. }
  3690. }
  3691. return this._menu;
  3692. };
  3693. _proto._getPlacement = function _getPlacement() {
  3694. var $parentDropdown = $(this._element.parentNode);
  3695. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3696. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3697. placement = AttachmentMap.TOP;
  3698. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3699. placement = AttachmentMap.TOPEND;
  3700. }
  3701. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3702. placement = AttachmentMap.RIGHT;
  3703. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3704. placement = AttachmentMap.LEFT;
  3705. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3706. placement = AttachmentMap.BOTTOMEND;
  3707. }
  3708. return placement;
  3709. };
  3710. _proto._detectNavbar = function _detectNavbar() {
  3711. return $(this._element).closest('.navbar').length > 0;
  3712. };
  3713. _proto._getOffset = function _getOffset() {
  3714. var _this2 = this;
  3715. var offset = {};
  3716. if (typeof this._config.offset === 'function') {
  3717. offset.fn = function (data) {
  3718. data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
  3719. return data;
  3720. };
  3721. } else {
  3722. offset.offset = this._config.offset;
  3723. }
  3724. return offset;
  3725. };
  3726. _proto._getPopperConfig = function _getPopperConfig() {
  3727. var popperConfig = {
  3728. placement: this._getPlacement(),
  3729. modifiers: {
  3730. offset: this._getOffset(),
  3731. flip: {
  3732. enabled: this._config.flip
  3733. },
  3734. preventOverflow: {
  3735. boundariesElement: this._config.boundary
  3736. }
  3737. } // Disable Popper.js if we have a static display
  3738. };
  3739. if (this._config.display === 'static') {
  3740. popperConfig.modifiers.applyStyle = {
  3741. enabled: false
  3742. };
  3743. }
  3744. return popperConfig;
  3745. } // Static
  3746. ;
  3747. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3748. return this.each(function () {
  3749. var data = $(this).data(DATA_KEY$4);
  3750. var _config = typeof config === 'object' ? config : null;
  3751. if (!data) {
  3752. data = new Dropdown(this, _config);
  3753. $(this).data(DATA_KEY$4, data);
  3754. }
  3755. if (typeof config === 'string') {
  3756. if (typeof data[config] === 'undefined') {
  3757. throw new TypeError("No method named \"" + config + "\"");
  3758. }
  3759. data[config]();
  3760. }
  3761. });
  3762. };
  3763. Dropdown._clearMenus = function _clearMenus(event) {
  3764. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3765. return;
  3766. }
  3767. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3768. for (var i = 0, len = toggles.length; i < len; i++) {
  3769. var parent = Dropdown._getParentFromElement(toggles[i]);
  3770. var context = $(toggles[i]).data(DATA_KEY$4);
  3771. var relatedTarget = {
  3772. relatedTarget: toggles[i]
  3773. };
  3774. if (event && event.type === 'click') {
  3775. relatedTarget.clickEvent = event;
  3776. }
  3777. if (!context) {
  3778. continue;
  3779. }
  3780. var dropdownMenu = context._menu;
  3781. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3782. continue;
  3783. }
  3784. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3785. continue;
  3786. }
  3787. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3788. $(parent).trigger(hideEvent);
  3789. if (hideEvent.isDefaultPrevented()) {
  3790. continue;
  3791. } // If this is a touch-enabled device we remove the extra
  3792. // empty mouseover listeners we added for iOS support
  3793. if ('ontouchstart' in document.documentElement) {
  3794. $(document.body).children().off('mouseover', null, $.noop);
  3795. }
  3796. toggles[i].setAttribute('aria-expanded', 'false');
  3797. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3798. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3799. }
  3800. };
  3801. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3802. var parent;
  3803. var selector = Util.getSelectorFromElement(element);
  3804. if (selector) {
  3805. parent = document.querySelector(selector);
  3806. }
  3807. return parent || element.parentNode;
  3808. } // eslint-disable-next-line complexity
  3809. ;
  3810. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3811. // If not input/textarea:
  3812. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3813. // If input/textarea:
  3814. // - If space key => not a dropdown command
  3815. // - If key is other than escape
  3816. // - If key is not up or down => not a dropdown command
  3817. // - If trigger inside the menu => not a dropdown command
  3818. 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$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  3819. return;
  3820. }
  3821. event.preventDefault();
  3822. event.stopPropagation();
  3823. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3824. return;
  3825. }
  3826. var parent = Dropdown._getParentFromElement(this);
  3827. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3828. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3829. if (event.which === ESCAPE_KEYCODE) {
  3830. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3831. $(toggle).trigger('focus');
  3832. }
  3833. $(this).trigger('click');
  3834. return;
  3835. }
  3836. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS));
  3837. if (items.length === 0) {
  3838. return;
  3839. }
  3840. var index = items.indexOf(event.target);
  3841. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3842. // Up
  3843. index--;
  3844. }
  3845. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3846. // Down
  3847. index++;
  3848. }
  3849. if (index < 0) {
  3850. index = 0;
  3851. }
  3852. items[index].focus();
  3853. };
  3854. _createClass(Dropdown, null, [{
  3855. key: "VERSION",
  3856. get: function get() {
  3857. return VERSION$4;
  3858. }
  3859. }, {
  3860. key: "Default",
  3861. get: function get() {
  3862. return Default$2;
  3863. }
  3864. }, {
  3865. key: "DefaultType",
  3866. get: function get() {
  3867. return DefaultType$2;
  3868. }
  3869. }]);
  3870. return Dropdown;
  3871. }();
  3872. /**
  3873. * ------------------------------------------------------------------------
  3874. * Data Api implementation
  3875. * ------------------------------------------------------------------------
  3876. */
  3877. $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  3878. event.preventDefault();
  3879. event.stopPropagation();
  3880. Dropdown._jQueryInterface.call($(this), 'toggle');
  3881. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3882. e.stopPropagation();
  3883. });
  3884. /**
  3885. * ------------------------------------------------------------------------
  3886. * jQuery
  3887. * ------------------------------------------------------------------------
  3888. */
  3889. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3890. $.fn[NAME$4].Constructor = Dropdown;
  3891. $.fn[NAME$4].noConflict = function () {
  3892. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3893. return Dropdown._jQueryInterface;
  3894. };
  3895. /**
  3896. * ------------------------------------------------------------------------
  3897. * Constants
  3898. * ------------------------------------------------------------------------
  3899. */
  3900. var NAME$5 = 'modal';
  3901. var VERSION$5 = '4.3.1';
  3902. var DATA_KEY$5 = 'bs.modal';
  3903. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3904. var DATA_API_KEY$5 = '.data-api';
  3905. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3906. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3907. var Default$3 = {
  3908. backdrop: true,
  3909. keyboard: true,
  3910. focus: true,
  3911. show: true
  3912. };
  3913. var DefaultType$3 = {
  3914. backdrop: '(boolean|string)',
  3915. keyboard: 'boolean',
  3916. focus: 'boolean',
  3917. show: 'boolean'
  3918. };
  3919. var Event$5 = {
  3920. HIDE: "hide" + EVENT_KEY$5,
  3921. HIDDEN: "hidden" + EVENT_KEY$5,
  3922. SHOW: "show" + EVENT_KEY$5,
  3923. SHOWN: "shown" + EVENT_KEY$5,
  3924. FOCUSIN: "focusin" + EVENT_KEY$5,
  3925. RESIZE: "resize" + EVENT_KEY$5,
  3926. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3927. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3928. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3929. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3930. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3931. };
  3932. var ClassName$5 = {
  3933. SCROLLABLE: 'modal-dialog-scrollable',
  3934. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3935. BACKDROP: 'modal-backdrop',
  3936. OPEN: 'modal-open',
  3937. FADE: 'fade',
  3938. SHOW: 'show'
  3939. };
  3940. var Selector$5 = {
  3941. DIALOG: '.modal-dialog',
  3942. MODAL_BODY: '.modal-body',
  3943. DATA_TOGGLE: '[data-toggle="modal"]',
  3944. DATA_DISMISS: '[data-dismiss="modal"]',
  3945. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3946. STICKY_CONTENT: '.sticky-top'
  3947. /**
  3948. * ------------------------------------------------------------------------
  3949. * Class Definition
  3950. * ------------------------------------------------------------------------
  3951. */
  3952. };
  3953. var Modal =
  3954. /*#__PURE__*/
  3955. function () {
  3956. function Modal(element, config) {
  3957. this._config = this._getConfig(config);
  3958. this._element = element;
  3959. this._dialog = element.querySelector(Selector$5.DIALOG);
  3960. this._backdrop = null;
  3961. this._isShown = false;
  3962. this._isBodyOverflowing = false;
  3963. this._ignoreBackdropClick = false;
  3964. this._isTransitioning = false;
  3965. this._scrollbarWidth = 0;
  3966. } // Getters
  3967. var _proto = Modal.prototype;
  3968. // Public
  3969. _proto.toggle = function toggle(relatedTarget) {
  3970. return this._isShown ? this.hide() : this.show(relatedTarget);
  3971. };
  3972. _proto.show = function show(relatedTarget) {
  3973. var _this = this;
  3974. if (this._isShown || this._isTransitioning) {
  3975. return;
  3976. }
  3977. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3978. this._isTransitioning = true;
  3979. }
  3980. var showEvent = $.Event(Event$5.SHOW, {
  3981. relatedTarget: relatedTarget
  3982. });
  3983. $(this._element).trigger(showEvent);
  3984. if (this._isShown || showEvent.isDefaultPrevented()) {
  3985. return;
  3986. }
  3987. this._isShown = true;
  3988. this._checkScrollbar();
  3989. this._setScrollbar();
  3990. this._adjustDialog();
  3991. this._setEscapeEvent();
  3992. this._setResizeEvent();
  3993. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3994. return _this.hide(event);
  3995. });
  3996. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3997. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3998. if ($(event.target).is(_this._element)) {
  3999. _this._ignoreBackdropClick = true;
  4000. }
  4001. });
  4002. });
  4003. this._showBackdrop(function () {
  4004. return _this._showElement(relatedTarget);
  4005. });
  4006. };
  4007. _proto.hide = function hide(event) {
  4008. var _this2 = this;
  4009. if (event) {
  4010. event.preventDefault();
  4011. }
  4012. if (!this._isShown || this._isTransitioning) {
  4013. return;
  4014. }
  4015. var hideEvent = $.Event(Event$5.HIDE);
  4016. $(this._element).trigger(hideEvent);
  4017. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4018. return;
  4019. }
  4020. this._isShown = false;
  4021. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4022. if (transition) {
  4023. this._isTransitioning = true;
  4024. }
  4025. this._setEscapeEvent();
  4026. this._setResizeEvent();
  4027. $(document).off(Event$5.FOCUSIN);
  4028. $(this._element).removeClass(ClassName$5.SHOW);
  4029. $(this._element).off(Event$5.CLICK_DISMISS);
  4030. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4031. if (transition) {
  4032. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4033. $(this._element).one(Util.TRANSITION_END, function (event) {
  4034. return _this2._hideModal(event);
  4035. }).emulateTransitionEnd(transitionDuration);
  4036. } else {
  4037. this._hideModal();
  4038. }
  4039. };
  4040. _proto.dispose = function dispose() {
  4041. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4042. return $(htmlElement).off(EVENT_KEY$5);
  4043. });
  4044. /**
  4045. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4046. * Do not move `document` in `htmlElements` array
  4047. * It will remove `Event.CLICK_DATA_API` event that should remain
  4048. */
  4049. $(document).off(Event$5.FOCUSIN);
  4050. $.removeData(this._element, DATA_KEY$5);
  4051. this._config = null;
  4052. this._element = null;
  4053. this._dialog = null;
  4054. this._backdrop = null;
  4055. this._isShown = null;
  4056. this._isBodyOverflowing = null;
  4057. this._ignoreBackdropClick = null;
  4058. this._isTransitioning = null;
  4059. this._scrollbarWidth = null;
  4060. };
  4061. _proto.handleUpdate = function handleUpdate() {
  4062. this._adjustDialog();
  4063. } // Private
  4064. ;
  4065. _proto._getConfig = function _getConfig(config) {
  4066. config = _objectSpread({}, Default$3, config);
  4067. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4068. return config;
  4069. };
  4070. _proto._showElement = function _showElement(relatedTarget) {
  4071. var _this3 = this;
  4072. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4073. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4074. // Don't move modal's DOM position
  4075. document.body.appendChild(this._element);
  4076. }
  4077. this._element.style.display = 'block';
  4078. this._element.removeAttribute('aria-hidden');
  4079. this._element.setAttribute('aria-modal', true);
  4080. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) {
  4081. this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0;
  4082. } else {
  4083. this._element.scrollTop = 0;
  4084. }
  4085. if (transition) {
  4086. Util.reflow(this._element);
  4087. }
  4088. $(this._element).addClass(ClassName$5.SHOW);
  4089. if (this._config.focus) {
  4090. this._enforceFocus();
  4091. }
  4092. var shownEvent = $.Event(Event$5.SHOWN, {
  4093. relatedTarget: relatedTarget
  4094. });
  4095. var transitionComplete = function transitionComplete() {
  4096. if (_this3._config.focus) {
  4097. _this3._element.focus();
  4098. }
  4099. _this3._isTransitioning = false;
  4100. $(_this3._element).trigger(shownEvent);
  4101. };
  4102. if (transition) {
  4103. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4104. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4105. } else {
  4106. transitionComplete();
  4107. }
  4108. };
  4109. _proto._enforceFocus = function _enforceFocus() {
  4110. var _this4 = this;
  4111. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4112. .on(Event$5.FOCUSIN, function (event) {
  4113. if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) {
  4114. _this4._element.focus();
  4115. }
  4116. });
  4117. };
  4118. _proto._setEscapeEvent = function _setEscapeEvent() {
  4119. var _this5 = this;
  4120. if (this._isShown && this._config.keyboard) {
  4121. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4122. if (event.which === ESCAPE_KEYCODE$1) {
  4123. event.preventDefault();
  4124. _this5.hide();
  4125. }
  4126. });
  4127. } else if (!this._isShown) {
  4128. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4129. }
  4130. };
  4131. _proto._setResizeEvent = function _setResizeEvent() {
  4132. var _this6 = this;
  4133. if (this._isShown) {
  4134. $(window).on(Event$5.RESIZE, function (event) {
  4135. return _this6.handleUpdate(event);
  4136. });
  4137. } else {
  4138. $(window).off(Event$5.RESIZE);
  4139. }
  4140. };
  4141. _proto._hideModal = function _hideModal() {
  4142. var _this7 = this;
  4143. this._element.style.display = 'none';
  4144. this._element.setAttribute('aria-hidden', true);
  4145. this._element.removeAttribute('aria-modal');
  4146. this._isTransitioning = false;
  4147. this._showBackdrop(function () {
  4148. $(document.body).removeClass(ClassName$5.OPEN);
  4149. _this7._resetAdjustments();
  4150. _this7._resetScrollbar();
  4151. $(_this7._element).trigger(Event$5.HIDDEN);
  4152. });
  4153. };
  4154. _proto._removeBackdrop = function _removeBackdrop() {
  4155. if (this._backdrop) {
  4156. $(this._backdrop).remove();
  4157. this._backdrop = null;
  4158. }
  4159. };
  4160. _proto._showBackdrop = function _showBackdrop(callback) {
  4161. var _this8 = this;
  4162. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4163. if (this._isShown && this._config.backdrop) {
  4164. this._backdrop = document.createElement('div');
  4165. this._backdrop.className = ClassName$5.BACKDROP;
  4166. if (animate) {
  4167. this._backdrop.classList.add(animate);
  4168. }
  4169. $(this._backdrop).appendTo(document.body);
  4170. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4171. if (_this8._ignoreBackdropClick) {
  4172. _this8._ignoreBackdropClick = false;
  4173. return;
  4174. }
  4175. if (event.target !== event.currentTarget) {
  4176. return;
  4177. }
  4178. if (_this8._config.backdrop === 'static') {
  4179. _this8._element.focus();
  4180. } else {
  4181. _this8.hide();
  4182. }
  4183. });
  4184. if (animate) {
  4185. Util.reflow(this._backdrop);
  4186. }
  4187. $(this._backdrop).addClass(ClassName$5.SHOW);
  4188. if (!callback) {
  4189. return;
  4190. }
  4191. if (!animate) {
  4192. callback();
  4193. return;
  4194. }
  4195. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4196. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4197. } else if (!this._isShown && this._backdrop) {
  4198. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4199. var callbackRemove = function callbackRemove() {
  4200. _this8._removeBackdrop();
  4201. if (callback) {
  4202. callback();
  4203. }
  4204. };
  4205. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4206. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4207. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4208. } else {
  4209. callbackRemove();
  4210. }
  4211. } else if (callback) {
  4212. callback();
  4213. }
  4214. } // ----------------------------------------------------------------------
  4215. // the following methods are used to handle overflowing modals
  4216. // todo (fat): these should probably be refactored out of modal.js
  4217. // ----------------------------------------------------------------------
  4218. ;
  4219. _proto._adjustDialog = function _adjustDialog() {
  4220. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4221. if (!this._isBodyOverflowing && isModalOverflowing) {
  4222. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4223. }
  4224. if (this._isBodyOverflowing && !isModalOverflowing) {
  4225. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4226. }
  4227. };
  4228. _proto._resetAdjustments = function _resetAdjustments() {
  4229. this._element.style.paddingLeft = '';
  4230. this._element.style.paddingRight = '';
  4231. };
  4232. _proto._checkScrollbar = function _checkScrollbar() {
  4233. var rect = document.body.getBoundingClientRect();
  4234. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4235. this._scrollbarWidth = this._getScrollbarWidth();
  4236. };
  4237. _proto._setScrollbar = function _setScrollbar() {
  4238. var _this9 = this;
  4239. if (this._isBodyOverflowing) {
  4240. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4241. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4242. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4243. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4244. $(fixedContent).each(function (index, element) {
  4245. var actualPadding = element.style.paddingRight;
  4246. var calculatedPadding = $(element).css('padding-right');
  4247. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
  4248. }); // Adjust sticky content margin
  4249. $(stickyContent).each(function (index, element) {
  4250. var actualMargin = element.style.marginRight;
  4251. var calculatedMargin = $(element).css('margin-right');
  4252. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
  4253. }); // Adjust body padding
  4254. var actualPadding = document.body.style.paddingRight;
  4255. var calculatedPadding = $(document.body).css('padding-right');
  4256. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4257. }
  4258. $(document.body).addClass(ClassName$5.OPEN);
  4259. };
  4260. _proto._resetScrollbar = function _resetScrollbar() {
  4261. // Restore fixed content padding
  4262. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4263. $(fixedContent).each(function (index, element) {
  4264. var padding = $(element).data('padding-right');
  4265. $(element).removeData('padding-right');
  4266. element.style.paddingRight = padding ? padding : '';
  4267. }); // Restore sticky content
  4268. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4269. $(elements).each(function (index, element) {
  4270. var margin = $(element).data('margin-right');
  4271. if (typeof margin !== 'undefined') {
  4272. $(element).css('margin-right', margin).removeData('margin-right');
  4273. }
  4274. }); // Restore body padding
  4275. var padding = $(document.body).data('padding-right');
  4276. $(document.body).removeData('padding-right');
  4277. document.body.style.paddingRight = padding ? padding : '';
  4278. };
  4279. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4280. // thx d.walsh
  4281. var scrollDiv = document.createElement('div');
  4282. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4283. document.body.appendChild(scrollDiv);
  4284. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4285. document.body.removeChild(scrollDiv);
  4286. return scrollbarWidth;
  4287. } // Static
  4288. ;
  4289. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4290. return this.each(function () {
  4291. var data = $(this).data(DATA_KEY$5);
  4292. var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {});
  4293. if (!data) {
  4294. data = new Modal(this, _config);
  4295. $(this).data(DATA_KEY$5, data);
  4296. }
  4297. if (typeof config === 'string') {
  4298. if (typeof data[config] === 'undefined') {
  4299. throw new TypeError("No method named \"" + config + "\"");
  4300. }
  4301. data[config](relatedTarget);
  4302. } else if (_config.show) {
  4303. data.show(relatedTarget);
  4304. }
  4305. });
  4306. };
  4307. _createClass(Modal, null, [{
  4308. key: "VERSION",
  4309. get: function get() {
  4310. return VERSION$5;
  4311. }
  4312. }, {
  4313. key: "Default",
  4314. get: function get() {
  4315. return Default$3;
  4316. }
  4317. }]);
  4318. return Modal;
  4319. }();
  4320. /**
  4321. * ------------------------------------------------------------------------
  4322. * Data Api implementation
  4323. * ------------------------------------------------------------------------
  4324. */
  4325. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4326. var _this10 = this;
  4327. var target;
  4328. var selector = Util.getSelectorFromElement(this);
  4329. if (selector) {
  4330. target = document.querySelector(selector);
  4331. }
  4332. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data());
  4333. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4334. event.preventDefault();
  4335. }
  4336. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4337. if (showEvent.isDefaultPrevented()) {
  4338. // Only register focus restorer if modal will actually get shown
  4339. return;
  4340. }
  4341. $target.one(Event$5.HIDDEN, function () {
  4342. if ($(_this10).is(':visible')) {
  4343. _this10.focus();
  4344. }
  4345. });
  4346. });
  4347. Modal._jQueryInterface.call($(target), config, this);
  4348. });
  4349. /**
  4350. * ------------------------------------------------------------------------
  4351. * jQuery
  4352. * ------------------------------------------------------------------------
  4353. */
  4354. $.fn[NAME$5] = Modal._jQueryInterface;
  4355. $.fn[NAME$5].Constructor = Modal;
  4356. $.fn[NAME$5].noConflict = function () {
  4357. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4358. return Modal._jQueryInterface;
  4359. };
  4360. /**
  4361. * --------------------------------------------------------------------------
  4362. * Bootstrap (v4.3.1): tools/sanitizer.js
  4363. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4364. * --------------------------------------------------------------------------
  4365. */
  4366. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4367. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4368. var DefaultWhitelist = {
  4369. // Global attributes allowed on any supplied element below.
  4370. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4371. a: ['target', 'href', 'title', 'rel'],
  4372. area: [],
  4373. b: [],
  4374. br: [],
  4375. col: [],
  4376. code: [],
  4377. div: [],
  4378. em: [],
  4379. hr: [],
  4380. h1: [],
  4381. h2: [],
  4382. h3: [],
  4383. h4: [],
  4384. h5: [],
  4385. h6: [],
  4386. i: [],
  4387. img: ['src', 'alt', 'title', 'width', 'height'],
  4388. li: [],
  4389. ol: [],
  4390. p: [],
  4391. pre: [],
  4392. s: [],
  4393. small: [],
  4394. span: [],
  4395. sub: [],
  4396. sup: [],
  4397. strong: [],
  4398. u: [],
  4399. ul: []
  4400. /**
  4401. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4402. *
  4403. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4404. */
  4405. };
  4406. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4407. /**
  4408. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4409. *
  4410. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4411. */
  4412. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
  4413. function allowedAttribute(attr, allowedAttributeList) {
  4414. var attrName = attr.nodeName.toLowerCase();
  4415. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4416. if (uriAttrs.indexOf(attrName) !== -1) {
  4417. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4418. }
  4419. return true;
  4420. }
  4421. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4422. return attrRegex instanceof RegExp;
  4423. }); // Check if a regular expression validates the attribute.
  4424. for (var i = 0, l = regExp.length; i < l; i++) {
  4425. if (attrName.match(regExp[i])) {
  4426. return true;
  4427. }
  4428. }
  4429. return false;
  4430. }
  4431. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4432. if (unsafeHtml.length === 0) {
  4433. return unsafeHtml;
  4434. }
  4435. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4436. return sanitizeFn(unsafeHtml);
  4437. }
  4438. var domParser = new window.DOMParser();
  4439. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4440. var whitelistKeys = Object.keys(whiteList);
  4441. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4442. var _loop = function _loop(i, len) {
  4443. var el = elements[i];
  4444. var elName = el.nodeName.toLowerCase();
  4445. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4446. el.parentNode.removeChild(el);
  4447. return "continue";
  4448. }
  4449. var attributeList = [].slice.call(el.attributes);
  4450. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4451. attributeList.forEach(function (attr) {
  4452. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4453. el.removeAttribute(attr.nodeName);
  4454. }
  4455. });
  4456. };
  4457. for (var i = 0, len = elements.length; i < len; i++) {
  4458. var _ret = _loop(i, len);
  4459. if (_ret === "continue") continue;
  4460. }
  4461. return createdDocument.body.innerHTML;
  4462. }
  4463. /**
  4464. * ------------------------------------------------------------------------
  4465. * Constants
  4466. * ------------------------------------------------------------------------
  4467. */
  4468. var NAME$6 = 'tooltip';
  4469. var VERSION$6 = '4.3.1';
  4470. var DATA_KEY$6 = 'bs.tooltip';
  4471. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4472. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4473. var CLASS_PREFIX = 'bs-tooltip';
  4474. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4475. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4476. var DefaultType$4 = {
  4477. animation: 'boolean',
  4478. template: 'string',
  4479. title: '(string|element|function)',
  4480. trigger: 'string',
  4481. delay: '(number|object)',
  4482. html: 'boolean',
  4483. selector: '(string|boolean)',
  4484. placement: '(string|function)',
  4485. offset: '(number|string|function)',
  4486. container: '(string|element|boolean)',
  4487. fallbackPlacement: '(string|array)',
  4488. boundary: '(string|element)',
  4489. sanitize: 'boolean',
  4490. sanitizeFn: '(null|function)',
  4491. whiteList: 'object'
  4492. };
  4493. var AttachmentMap$1 = {
  4494. AUTO: 'auto',
  4495. TOP: 'top',
  4496. RIGHT: 'right',
  4497. BOTTOM: 'bottom',
  4498. LEFT: 'left'
  4499. };
  4500. var Default$4 = {
  4501. animation: true,
  4502. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4503. trigger: 'hover focus',
  4504. title: '',
  4505. delay: 0,
  4506. html: false,
  4507. selector: false,
  4508. placement: 'top',
  4509. offset: 0,
  4510. container: false,
  4511. fallbackPlacement: 'flip',
  4512. boundary: 'scrollParent',
  4513. sanitize: true,
  4514. sanitizeFn: null,
  4515. whiteList: DefaultWhitelist
  4516. };
  4517. var HoverState = {
  4518. SHOW: 'show',
  4519. OUT: 'out'
  4520. };
  4521. var Event$6 = {
  4522. HIDE: "hide" + EVENT_KEY$6,
  4523. HIDDEN: "hidden" + EVENT_KEY$6,
  4524. SHOW: "show" + EVENT_KEY$6,
  4525. SHOWN: "shown" + EVENT_KEY$6,
  4526. INSERTED: "inserted" + EVENT_KEY$6,
  4527. CLICK: "click" + EVENT_KEY$6,
  4528. FOCUSIN: "focusin" + EVENT_KEY$6,
  4529. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4530. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4531. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4532. };
  4533. var ClassName$6 = {
  4534. FADE: 'fade',
  4535. SHOW: 'show'
  4536. };
  4537. var Selector$6 = {
  4538. TOOLTIP: '.tooltip',
  4539. TOOLTIP_INNER: '.tooltip-inner',
  4540. ARROW: '.arrow'
  4541. };
  4542. var Trigger = {
  4543. HOVER: 'hover',
  4544. FOCUS: 'focus',
  4545. CLICK: 'click',
  4546. MANUAL: 'manual'
  4547. /**
  4548. * ------------------------------------------------------------------------
  4549. * Class Definition
  4550. * ------------------------------------------------------------------------
  4551. */
  4552. };
  4553. var Tooltip =
  4554. /*#__PURE__*/
  4555. function () {
  4556. function Tooltip(element, config) {
  4557. /**
  4558. * Check for Popper dependency
  4559. * Popper - https://popper.js.org
  4560. */
  4561. if (typeof Popper === 'undefined') {
  4562. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4563. } // private
  4564. this._isEnabled = true;
  4565. this._timeout = 0;
  4566. this._hoverState = '';
  4567. this._activeTrigger = {};
  4568. this._popper = null; // Protected
  4569. this.element = element;
  4570. this.config = this._getConfig(config);
  4571. this.tip = null;
  4572. this._setListeners();
  4573. } // Getters
  4574. var _proto = Tooltip.prototype;
  4575. // Public
  4576. _proto.enable = function enable() {
  4577. this._isEnabled = true;
  4578. };
  4579. _proto.disable = function disable() {
  4580. this._isEnabled = false;
  4581. };
  4582. _proto.toggleEnabled = function toggleEnabled() {
  4583. this._isEnabled = !this._isEnabled;
  4584. };
  4585. _proto.toggle = function toggle(event) {
  4586. if (!this._isEnabled) {
  4587. return;
  4588. }
  4589. if (event) {
  4590. var dataKey = this.constructor.DATA_KEY;
  4591. var context = $(event.currentTarget).data(dataKey);
  4592. if (!context) {
  4593. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4594. $(event.currentTarget).data(dataKey, context);
  4595. }
  4596. context._activeTrigger.click = !context._activeTrigger.click;
  4597. if (context._isWithActiveTrigger()) {
  4598. context._enter(null, context);
  4599. } else {
  4600. context._leave(null, context);
  4601. }
  4602. } else {
  4603. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4604. this._leave(null, this);
  4605. return;
  4606. }
  4607. this._enter(null, this);
  4608. }
  4609. };
  4610. _proto.dispose = function dispose() {
  4611. clearTimeout(this._timeout);
  4612. $.removeData(this.element, this.constructor.DATA_KEY);
  4613. $(this.element).off(this.constructor.EVENT_KEY);
  4614. $(this.element).closest('.modal').off('hide.bs.modal');
  4615. if (this.tip) {
  4616. $(this.tip).remove();
  4617. }
  4618. this._isEnabled = null;
  4619. this._timeout = null;
  4620. this._hoverState = null;
  4621. this._activeTrigger = null;
  4622. if (this._popper !== null) {
  4623. this._popper.destroy();
  4624. }
  4625. this._popper = null;
  4626. this.element = null;
  4627. this.config = null;
  4628. this.tip = null;
  4629. };
  4630. _proto.show = function show() {
  4631. var _this = this;
  4632. if ($(this.element).css('display') === 'none') {
  4633. throw new Error('Please use show on visible elements');
  4634. }
  4635. var showEvent = $.Event(this.constructor.Event.SHOW);
  4636. if (this.isWithContent() && this._isEnabled) {
  4637. $(this.element).trigger(showEvent);
  4638. var shadowRoot = Util.findShadowRoot(this.element);
  4639. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4640. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4641. return;
  4642. }
  4643. var tip = this.getTipElement();
  4644. var tipId = Util.getUID(this.constructor.NAME);
  4645. tip.setAttribute('id', tipId);
  4646. this.element.setAttribute('aria-describedby', tipId);
  4647. this.setContent();
  4648. if (this.config.animation) {
  4649. $(tip).addClass(ClassName$6.FADE);
  4650. }
  4651. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4652. var attachment = this._getAttachment(placement);
  4653. this.addAttachmentClass(attachment);
  4654. var container = this._getContainer();
  4655. $(tip).data(this.constructor.DATA_KEY, this);
  4656. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4657. $(tip).appendTo(container);
  4658. }
  4659. $(this.element).trigger(this.constructor.Event.INSERTED);
  4660. this._popper = new Popper(this.element, tip, {
  4661. placement: attachment,
  4662. modifiers: {
  4663. offset: this._getOffset(),
  4664. flip: {
  4665. behavior: this.config.fallbackPlacement
  4666. },
  4667. arrow: {
  4668. element: Selector$6.ARROW
  4669. },
  4670. preventOverflow: {
  4671. boundariesElement: this.config.boundary
  4672. }
  4673. },
  4674. onCreate: function onCreate(data) {
  4675. if (data.originalPlacement !== data.placement) {
  4676. _this._handlePopperPlacementChange(data);
  4677. }
  4678. },
  4679. onUpdate: function onUpdate(data) {
  4680. return _this._handlePopperPlacementChange(data);
  4681. }
  4682. });
  4683. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4684. // empty mouseover listeners to the body's immediate children;
  4685. // only needed because of broken event delegation on iOS
  4686. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4687. if ('ontouchstart' in document.documentElement) {
  4688. $(document.body).children().on('mouseover', null, $.noop);
  4689. }
  4690. var complete = function complete() {
  4691. if (_this.config.animation) {
  4692. _this._fixTransition();
  4693. }
  4694. var prevHoverState = _this._hoverState;
  4695. _this._hoverState = null;
  4696. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4697. if (prevHoverState === HoverState.OUT) {
  4698. _this._leave(null, _this);
  4699. }
  4700. };
  4701. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4702. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4703. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4704. } else {
  4705. complete();
  4706. }
  4707. }
  4708. };
  4709. _proto.hide = function hide(callback) {
  4710. var _this2 = this;
  4711. var tip = this.getTipElement();
  4712. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4713. var complete = function complete() {
  4714. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4715. tip.parentNode.removeChild(tip);
  4716. }
  4717. _this2._cleanTipClass();
  4718. _this2.element.removeAttribute('aria-describedby');
  4719. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4720. if (_this2._popper !== null) {
  4721. _this2._popper.destroy();
  4722. }
  4723. if (callback) {
  4724. callback();
  4725. }
  4726. };
  4727. $(this.element).trigger(hideEvent);
  4728. if (hideEvent.isDefaultPrevented()) {
  4729. return;
  4730. }
  4731. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4732. // empty mouseover listeners we added for iOS support
  4733. if ('ontouchstart' in document.documentElement) {
  4734. $(document.body).children().off('mouseover', null, $.noop);
  4735. }
  4736. this._activeTrigger[Trigger.CLICK] = false;
  4737. this._activeTrigger[Trigger.FOCUS] = false;
  4738. this._activeTrigger[Trigger.HOVER] = false;
  4739. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4740. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4741. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4742. } else {
  4743. complete();
  4744. }
  4745. this._hoverState = '';
  4746. };
  4747. _proto.update = function update() {
  4748. if (this._popper !== null) {
  4749. this._popper.scheduleUpdate();
  4750. }
  4751. } // Protected
  4752. ;
  4753. _proto.isWithContent = function isWithContent() {
  4754. return Boolean(this.getTitle());
  4755. };
  4756. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4757. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4758. };
  4759. _proto.getTipElement = function getTipElement() {
  4760. this.tip = this.tip || $(this.config.template)[0];
  4761. return this.tip;
  4762. };
  4763. _proto.setContent = function setContent() {
  4764. var tip = this.getTipElement();
  4765. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4766. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4767. };
  4768. _proto.setElementContent = function setElementContent($element, content) {
  4769. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4770. // Content is a DOM node or a jQuery
  4771. if (this.config.html) {
  4772. if (!$(content).parent().is($element)) {
  4773. $element.empty().append(content);
  4774. }
  4775. } else {
  4776. $element.text($(content).text());
  4777. }
  4778. return;
  4779. }
  4780. if (this.config.html) {
  4781. if (this.config.sanitize) {
  4782. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4783. }
  4784. $element.html(content);
  4785. } else {
  4786. $element.text(content);
  4787. }
  4788. };
  4789. _proto.getTitle = function getTitle() {
  4790. var title = this.element.getAttribute('data-original-title');
  4791. if (!title) {
  4792. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4793. }
  4794. return title;
  4795. } // Private
  4796. ;
  4797. _proto._getOffset = function _getOffset() {
  4798. var _this3 = this;
  4799. var offset = {};
  4800. if (typeof this.config.offset === 'function') {
  4801. offset.fn = function (data) {
  4802. data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {});
  4803. return data;
  4804. };
  4805. } else {
  4806. offset.offset = this.config.offset;
  4807. }
  4808. return offset;
  4809. };
  4810. _proto._getContainer = function _getContainer() {
  4811. if (this.config.container === false) {
  4812. return document.body;
  4813. }
  4814. if (Util.isElement(this.config.container)) {
  4815. return $(this.config.container);
  4816. }
  4817. return $(document).find(this.config.container);
  4818. };
  4819. _proto._getAttachment = function _getAttachment(placement) {
  4820. return AttachmentMap$1[placement.toUpperCase()];
  4821. };
  4822. _proto._setListeners = function _setListeners() {
  4823. var _this4 = this;
  4824. var triggers = this.config.trigger.split(' ');
  4825. triggers.forEach(function (trigger) {
  4826. if (trigger === 'click') {
  4827. $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) {
  4828. return _this4.toggle(event);
  4829. });
  4830. } else if (trigger !== Trigger.MANUAL) {
  4831. var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN;
  4832. var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT;
  4833. $(_this4.element).on(eventIn, _this4.config.selector, function (event) {
  4834. return _this4._enter(event);
  4835. }).on(eventOut, _this4.config.selector, function (event) {
  4836. return _this4._leave(event);
  4837. });
  4838. }
  4839. });
  4840. $(this.element).closest('.modal').on('hide.bs.modal', function () {
  4841. if (_this4.element) {
  4842. _this4.hide();
  4843. }
  4844. });
  4845. if (this.config.selector) {
  4846. this.config = _objectSpread({}, this.config, {
  4847. trigger: 'manual',
  4848. selector: ''
  4849. });
  4850. } else {
  4851. this._fixTitle();
  4852. }
  4853. };
  4854. _proto._fixTitle = function _fixTitle() {
  4855. var titleType = typeof this.element.getAttribute('data-original-title');
  4856. if (this.element.getAttribute('title') || titleType !== 'string') {
  4857. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4858. this.element.setAttribute('title', '');
  4859. }
  4860. };
  4861. _proto._enter = function _enter(event, context) {
  4862. var dataKey = this.constructor.DATA_KEY;
  4863. context = context || $(event.currentTarget).data(dataKey);
  4864. if (!context) {
  4865. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4866. $(event.currentTarget).data(dataKey, context);
  4867. }
  4868. if (event) {
  4869. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4870. }
  4871. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4872. context._hoverState = HoverState.SHOW;
  4873. return;
  4874. }
  4875. clearTimeout(context._timeout);
  4876. context._hoverState = HoverState.SHOW;
  4877. if (!context.config.delay || !context.config.delay.show) {
  4878. context.show();
  4879. return;
  4880. }
  4881. context._timeout = setTimeout(function () {
  4882. if (context._hoverState === HoverState.SHOW) {
  4883. context.show();
  4884. }
  4885. }, context.config.delay.show);
  4886. };
  4887. _proto._leave = function _leave(event, context) {
  4888. var dataKey = this.constructor.DATA_KEY;
  4889. context = context || $(event.currentTarget).data(dataKey);
  4890. if (!context) {
  4891. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4892. $(event.currentTarget).data(dataKey, context);
  4893. }
  4894. if (event) {
  4895. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4896. }
  4897. if (context._isWithActiveTrigger()) {
  4898. return;
  4899. }
  4900. clearTimeout(context._timeout);
  4901. context._hoverState = HoverState.OUT;
  4902. if (!context.config.delay || !context.config.delay.hide) {
  4903. context.hide();
  4904. return;
  4905. }
  4906. context._timeout = setTimeout(function () {
  4907. if (context._hoverState === HoverState.OUT) {
  4908. context.hide();
  4909. }
  4910. }, context.config.delay.hide);
  4911. };
  4912. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4913. for (var trigger in this._activeTrigger) {
  4914. if (this._activeTrigger[trigger]) {
  4915. return true;
  4916. }
  4917. }
  4918. return false;
  4919. };
  4920. _proto._getConfig = function _getConfig(config) {
  4921. var dataAttributes = $(this.element).data();
  4922. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4923. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4924. delete dataAttributes[dataAttr];
  4925. }
  4926. });
  4927. config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
  4928. if (typeof config.delay === 'number') {
  4929. config.delay = {
  4930. show: config.delay,
  4931. hide: config.delay
  4932. };
  4933. }
  4934. if (typeof config.title === 'number') {
  4935. config.title = config.title.toString();
  4936. }
  4937. if (typeof config.content === 'number') {
  4938. config.content = config.content.toString();
  4939. }
  4940. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4941. if (config.sanitize) {
  4942. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4943. }
  4944. return config;
  4945. };
  4946. _proto._getDelegateConfig = function _getDelegateConfig() {
  4947. var config = {};
  4948. if (this.config) {
  4949. for (var key in this.config) {
  4950. if (this.constructor.Default[key] !== this.config[key]) {
  4951. config[key] = this.config[key];
  4952. }
  4953. }
  4954. }
  4955. return config;
  4956. };
  4957. _proto._cleanTipClass = function _cleanTipClass() {
  4958. var $tip = $(this.getTipElement());
  4959. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4960. if (tabClass !== null && tabClass.length) {
  4961. $tip.removeClass(tabClass.join(''));
  4962. }
  4963. };
  4964. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4965. var popperInstance = popperData.instance;
  4966. this.tip = popperInstance.popper;
  4967. this._cleanTipClass();
  4968. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4969. };
  4970. _proto._fixTransition = function _fixTransition() {
  4971. var tip = this.getTipElement();
  4972. var initConfigAnimation = this.config.animation;
  4973. if (tip.getAttribute('x-placement') !== null) {
  4974. return;
  4975. }
  4976. $(tip).removeClass(ClassName$6.FADE);
  4977. this.config.animation = false;
  4978. this.hide();
  4979. this.show();
  4980. this.config.animation = initConfigAnimation;
  4981. } // Static
  4982. ;
  4983. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4984. return this.each(function () {
  4985. var data = $(this).data(DATA_KEY$6);
  4986. var _config = typeof config === 'object' && config;
  4987. if (!data && /dispose|hide/.test(config)) {
  4988. return;
  4989. }
  4990. if (!data) {
  4991. data = new Tooltip(this, _config);
  4992. $(this).data(DATA_KEY$6, data);
  4993. }
  4994. if (typeof config === 'string') {
  4995. if (typeof data[config] === 'undefined') {
  4996. throw new TypeError("No method named \"" + config + "\"");
  4997. }
  4998. data[config]();
  4999. }
  5000. });
  5001. };
  5002. _createClass(Tooltip, null, [{
  5003. key: "VERSION",
  5004. get: function get() {
  5005. return VERSION$6;
  5006. }
  5007. }, {
  5008. key: "Default",
  5009. get: function get() {
  5010. return Default$4;
  5011. }
  5012. }, {
  5013. key: "NAME",
  5014. get: function get() {
  5015. return NAME$6;
  5016. }
  5017. }, {
  5018. key: "DATA_KEY",
  5019. get: function get() {
  5020. return DATA_KEY$6;
  5021. }
  5022. }, {
  5023. key: "Event",
  5024. get: function get() {
  5025. return Event$6;
  5026. }
  5027. }, {
  5028. key: "EVENT_KEY",
  5029. get: function get() {
  5030. return EVENT_KEY$6;
  5031. }
  5032. }, {
  5033. key: "DefaultType",
  5034. get: function get() {
  5035. return DefaultType$4;
  5036. }
  5037. }]);
  5038. return Tooltip;
  5039. }();
  5040. /**
  5041. * ------------------------------------------------------------------------
  5042. * jQuery
  5043. * ------------------------------------------------------------------------
  5044. */
  5045. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5046. $.fn[NAME$6].Constructor = Tooltip;
  5047. $.fn[NAME$6].noConflict = function () {
  5048. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5049. return Tooltip._jQueryInterface;
  5050. };
  5051. /**
  5052. * ------------------------------------------------------------------------
  5053. * Constants
  5054. * ------------------------------------------------------------------------
  5055. */
  5056. var NAME$7 = 'popover';
  5057. var VERSION$7 = '4.3.1';
  5058. var DATA_KEY$7 = 'bs.popover';
  5059. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5060. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5061. var CLASS_PREFIX$1 = 'bs-popover';
  5062. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5063. var Default$5 = _objectSpread({}, Tooltip.Default, {
  5064. placement: 'right',
  5065. trigger: 'click',
  5066. content: '',
  5067. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5068. });
  5069. var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, {
  5070. content: '(string|element|function)'
  5071. });
  5072. var ClassName$7 = {
  5073. FADE: 'fade',
  5074. SHOW: 'show'
  5075. };
  5076. var Selector$7 = {
  5077. TITLE: '.popover-header',
  5078. CONTENT: '.popover-body'
  5079. };
  5080. var Event$7 = {
  5081. HIDE: "hide" + EVENT_KEY$7,
  5082. HIDDEN: "hidden" + EVENT_KEY$7,
  5083. SHOW: "show" + EVENT_KEY$7,
  5084. SHOWN: "shown" + EVENT_KEY$7,
  5085. INSERTED: "inserted" + EVENT_KEY$7,
  5086. CLICK: "click" + EVENT_KEY$7,
  5087. FOCUSIN: "focusin" + EVENT_KEY$7,
  5088. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5089. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5090. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5091. /**
  5092. * ------------------------------------------------------------------------
  5093. * Class Definition
  5094. * ------------------------------------------------------------------------
  5095. */
  5096. };
  5097. var Popover =
  5098. /*#__PURE__*/
  5099. function (_Tooltip) {
  5100. _inheritsLoose(Popover, _Tooltip);
  5101. function Popover() {
  5102. return _Tooltip.apply(this, arguments) || this;
  5103. }
  5104. var _proto = Popover.prototype;
  5105. // Overrides
  5106. _proto.isWithContent = function isWithContent() {
  5107. return this.getTitle() || this._getContent();
  5108. };
  5109. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5110. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5111. };
  5112. _proto.getTipElement = function getTipElement() {
  5113. this.tip = this.tip || $(this.config.template)[0];
  5114. return this.tip;
  5115. };
  5116. _proto.setContent = function setContent() {
  5117. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5118. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5119. var content = this._getContent();
  5120. if (typeof content === 'function') {
  5121. content = content.call(this.element);
  5122. }
  5123. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5124. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5125. } // Private
  5126. ;
  5127. _proto._getContent = function _getContent() {
  5128. return this.element.getAttribute('data-content') || this.config.content;
  5129. };
  5130. _proto._cleanTipClass = function _cleanTipClass() {
  5131. var $tip = $(this.getTipElement());
  5132. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5133. if (tabClass !== null && tabClass.length > 0) {
  5134. $tip.removeClass(tabClass.join(''));
  5135. }
  5136. } // Static
  5137. ;
  5138. Popover._jQueryInterface = function _jQueryInterface(config) {
  5139. return this.each(function () {
  5140. var data = $(this).data(DATA_KEY$7);
  5141. var _config = typeof config === 'object' ? config : null;
  5142. if (!data && /dispose|hide/.test(config)) {
  5143. return;
  5144. }
  5145. if (!data) {
  5146. data = new Popover(this, _config);
  5147. $(this).data(DATA_KEY$7, data);
  5148. }
  5149. if (typeof config === 'string') {
  5150. if (typeof data[config] === 'undefined') {
  5151. throw new TypeError("No method named \"" + config + "\"");
  5152. }
  5153. data[config]();
  5154. }
  5155. });
  5156. };
  5157. _createClass(Popover, null, [{
  5158. key: "VERSION",
  5159. // Getters
  5160. get: function get() {
  5161. return VERSION$7;
  5162. }
  5163. }, {
  5164. key: "Default",
  5165. get: function get() {
  5166. return Default$5;
  5167. }
  5168. }, {
  5169. key: "NAME",
  5170. get: function get() {
  5171. return NAME$7;
  5172. }
  5173. }, {
  5174. key: "DATA_KEY",
  5175. get: function get() {
  5176. return DATA_KEY$7;
  5177. }
  5178. }, {
  5179. key: "Event",
  5180. get: function get() {
  5181. return Event$7;
  5182. }
  5183. }, {
  5184. key: "EVENT_KEY",
  5185. get: function get() {
  5186. return EVENT_KEY$7;
  5187. }
  5188. }, {
  5189. key: "DefaultType",
  5190. get: function get() {
  5191. return DefaultType$5;
  5192. }
  5193. }]);
  5194. return Popover;
  5195. }(Tooltip);
  5196. /**
  5197. * ------------------------------------------------------------------------
  5198. * jQuery
  5199. * ------------------------------------------------------------------------
  5200. */
  5201. $.fn[NAME$7] = Popover._jQueryInterface;
  5202. $.fn[NAME$7].Constructor = Popover;
  5203. $.fn[NAME$7].noConflict = function () {
  5204. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5205. return Popover._jQueryInterface;
  5206. };
  5207. /**
  5208. * ------------------------------------------------------------------------
  5209. * Constants
  5210. * ------------------------------------------------------------------------
  5211. */
  5212. var NAME$8 = 'scrollspy';
  5213. var VERSION$8 = '4.3.1';
  5214. var DATA_KEY$8 = 'bs.scrollspy';
  5215. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5216. var DATA_API_KEY$6 = '.data-api';
  5217. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5218. var Default$6 = {
  5219. offset: 10,
  5220. method: 'auto',
  5221. target: ''
  5222. };
  5223. var DefaultType$6 = {
  5224. offset: 'number',
  5225. method: 'string',
  5226. target: '(string|element)'
  5227. };
  5228. var Event$8 = {
  5229. ACTIVATE: "activate" + EVENT_KEY$8,
  5230. SCROLL: "scroll" + EVENT_KEY$8,
  5231. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5232. };
  5233. var ClassName$8 = {
  5234. DROPDOWN_ITEM: 'dropdown-item',
  5235. DROPDOWN_MENU: 'dropdown-menu',
  5236. ACTIVE: 'active'
  5237. };
  5238. var Selector$8 = {
  5239. DATA_SPY: '[data-spy="scroll"]',
  5240. ACTIVE: '.active',
  5241. NAV_LIST_GROUP: '.nav, .list-group',
  5242. NAV_LINKS: '.nav-link',
  5243. NAV_ITEMS: '.nav-item',
  5244. LIST_ITEMS: '.list-group-item',
  5245. DROPDOWN: '.dropdown',
  5246. DROPDOWN_ITEMS: '.dropdown-item',
  5247. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5248. };
  5249. var OffsetMethod = {
  5250. OFFSET: 'offset',
  5251. POSITION: 'position'
  5252. /**
  5253. * ------------------------------------------------------------------------
  5254. * Class Definition
  5255. * ------------------------------------------------------------------------
  5256. */
  5257. };
  5258. var ScrollSpy =
  5259. /*#__PURE__*/
  5260. function () {
  5261. function ScrollSpy(element, config) {
  5262. var _this = this;
  5263. this._element = element;
  5264. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5265. this._config = this._getConfig(config);
  5266. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5267. this._offsets = [];
  5268. this._targets = [];
  5269. this._activeTarget = null;
  5270. this._scrollHeight = 0;
  5271. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5272. return _this._process(event);
  5273. });
  5274. this.refresh();
  5275. this._process();
  5276. } // Getters
  5277. var _proto = ScrollSpy.prototype;
  5278. // Public
  5279. _proto.refresh = function refresh() {
  5280. var _this2 = this;
  5281. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5282. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5283. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5284. this._offsets = [];
  5285. this._targets = [];
  5286. this._scrollHeight = this._getScrollHeight();
  5287. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5288. targets.map(function (element) {
  5289. var target;
  5290. var targetSelector = Util.getSelectorFromElement(element);
  5291. if (targetSelector) {
  5292. target = document.querySelector(targetSelector);
  5293. }
  5294. if (target) {
  5295. var targetBCR = target.getBoundingClientRect();
  5296. if (targetBCR.width || targetBCR.height) {
  5297. // TODO (fat): remove sketch reliance on jQuery position/offset
  5298. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5299. }
  5300. }
  5301. return null;
  5302. }).filter(function (item) {
  5303. return item;
  5304. }).sort(function (a, b) {
  5305. return a[0] - b[0];
  5306. }).forEach(function (item) {
  5307. _this2._offsets.push(item[0]);
  5308. _this2._targets.push(item[1]);
  5309. });
  5310. };
  5311. _proto.dispose = function dispose() {
  5312. $.removeData(this._element, DATA_KEY$8);
  5313. $(this._scrollElement).off(EVENT_KEY$8);
  5314. this._element = null;
  5315. this._scrollElement = null;
  5316. this._config = null;
  5317. this._selector = null;
  5318. this._offsets = null;
  5319. this._targets = null;
  5320. this._activeTarget = null;
  5321. this._scrollHeight = null;
  5322. } // Private
  5323. ;
  5324. _proto._getConfig = function _getConfig(config) {
  5325. config = _objectSpread({}, Default$6, typeof config === 'object' && config ? config : {});
  5326. if (typeof config.target !== 'string') {
  5327. var id = $(config.target).attr('id');
  5328. if (!id) {
  5329. id = Util.getUID(NAME$8);
  5330. $(config.target).attr('id', id);
  5331. }
  5332. config.target = "#" + id;
  5333. }
  5334. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5335. return config;
  5336. };
  5337. _proto._getScrollTop = function _getScrollTop() {
  5338. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5339. };
  5340. _proto._getScrollHeight = function _getScrollHeight() {
  5341. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5342. };
  5343. _proto._getOffsetHeight = function _getOffsetHeight() {
  5344. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5345. };
  5346. _proto._process = function _process() {
  5347. var scrollTop = this._getScrollTop() + this._config.offset;
  5348. var scrollHeight = this._getScrollHeight();
  5349. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5350. if (this._scrollHeight !== scrollHeight) {
  5351. this.refresh();
  5352. }
  5353. if (scrollTop >= maxScroll) {
  5354. var target = this._targets[this._targets.length - 1];
  5355. if (this._activeTarget !== target) {
  5356. this._activate(target);
  5357. }
  5358. return;
  5359. }
  5360. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5361. this._activeTarget = null;
  5362. this._clear();
  5363. return;
  5364. }
  5365. var offsetLength = this._offsets.length;
  5366. for (var i = offsetLength; i--;) {
  5367. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5368. if (isActiveTarget) {
  5369. this._activate(this._targets[i]);
  5370. }
  5371. }
  5372. };
  5373. _proto._activate = function _activate(target) {
  5374. this._activeTarget = target;
  5375. this._clear();
  5376. var queries = this._selector.split(',').map(function (selector) {
  5377. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5378. });
  5379. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5380. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5381. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5382. $link.addClass(ClassName$8.ACTIVE);
  5383. } else {
  5384. // Set triggered link as active
  5385. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5386. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5387. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
  5388. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5389. }
  5390. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5391. relatedTarget: target
  5392. });
  5393. };
  5394. _proto._clear = function _clear() {
  5395. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5396. return node.classList.contains(ClassName$8.ACTIVE);
  5397. }).forEach(function (node) {
  5398. return node.classList.remove(ClassName$8.ACTIVE);
  5399. });
  5400. } // Static
  5401. ;
  5402. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5403. return this.each(function () {
  5404. var data = $(this).data(DATA_KEY$8);
  5405. var _config = typeof config === 'object' && config;
  5406. if (!data) {
  5407. data = new ScrollSpy(this, _config);
  5408. $(this).data(DATA_KEY$8, data);
  5409. }
  5410. if (typeof config === 'string') {
  5411. if (typeof data[config] === 'undefined') {
  5412. throw new TypeError("No method named \"" + config + "\"");
  5413. }
  5414. data[config]();
  5415. }
  5416. });
  5417. };
  5418. _createClass(ScrollSpy, null, [{
  5419. key: "VERSION",
  5420. get: function get() {
  5421. return VERSION$8;
  5422. }
  5423. }, {
  5424. key: "Default",
  5425. get: function get() {
  5426. return Default$6;
  5427. }
  5428. }]);
  5429. return ScrollSpy;
  5430. }();
  5431. /**
  5432. * ------------------------------------------------------------------------
  5433. * Data Api implementation
  5434. * ------------------------------------------------------------------------
  5435. */
  5436. $(window).on(Event$8.LOAD_DATA_API, function () {
  5437. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5438. var scrollSpysLength = scrollSpys.length;
  5439. for (var i = scrollSpysLength; i--;) {
  5440. var $spy = $(scrollSpys[i]);
  5441. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5442. }
  5443. });
  5444. /**
  5445. * ------------------------------------------------------------------------
  5446. * jQuery
  5447. * ------------------------------------------------------------------------
  5448. */
  5449. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5450. $.fn[NAME$8].Constructor = ScrollSpy;
  5451. $.fn[NAME$8].noConflict = function () {
  5452. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5453. return ScrollSpy._jQueryInterface;
  5454. };
  5455. /**
  5456. * ------------------------------------------------------------------------
  5457. * Constants
  5458. * ------------------------------------------------------------------------
  5459. */
  5460. var NAME$9 = 'tab';
  5461. var VERSION$9 = '4.3.1';
  5462. var DATA_KEY$9 = 'bs.tab';
  5463. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5464. var DATA_API_KEY$7 = '.data-api';
  5465. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5466. var Event$9 = {
  5467. HIDE: "hide" + EVENT_KEY$9,
  5468. HIDDEN: "hidden" + EVENT_KEY$9,
  5469. SHOW: "show" + EVENT_KEY$9,
  5470. SHOWN: "shown" + EVENT_KEY$9,
  5471. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5472. };
  5473. var ClassName$9 = {
  5474. DROPDOWN_MENU: 'dropdown-menu',
  5475. ACTIVE: 'active',
  5476. DISABLED: 'disabled',
  5477. FADE: 'fade',
  5478. SHOW: 'show'
  5479. };
  5480. var Selector$9 = {
  5481. DROPDOWN: '.dropdown',
  5482. NAV_LIST_GROUP: '.nav, .list-group',
  5483. ACTIVE: '.active',
  5484. ACTIVE_UL: '> li > .active',
  5485. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5486. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5487. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5488. /**
  5489. * ------------------------------------------------------------------------
  5490. * Class Definition
  5491. * ------------------------------------------------------------------------
  5492. */
  5493. };
  5494. var Tab =
  5495. /*#__PURE__*/
  5496. function () {
  5497. function Tab(element) {
  5498. this._element = element;
  5499. } // Getters
  5500. var _proto = Tab.prototype;
  5501. // Public
  5502. _proto.show = function show() {
  5503. var _this = this;
  5504. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5505. return;
  5506. }
  5507. var target;
  5508. var previous;
  5509. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5510. var selector = Util.getSelectorFromElement(this._element);
  5511. if (listElement) {
  5512. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5513. previous = $.makeArray($(listElement).find(itemSelector));
  5514. previous = previous[previous.length - 1];
  5515. }
  5516. var hideEvent = $.Event(Event$9.HIDE, {
  5517. relatedTarget: this._element
  5518. });
  5519. var showEvent = $.Event(Event$9.SHOW, {
  5520. relatedTarget: previous
  5521. });
  5522. if (previous) {
  5523. $(previous).trigger(hideEvent);
  5524. }
  5525. $(this._element).trigger(showEvent);
  5526. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5527. return;
  5528. }
  5529. if (selector) {
  5530. target = document.querySelector(selector);
  5531. }
  5532. this._activate(this._element, listElement);
  5533. var complete = function complete() {
  5534. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5535. relatedTarget: _this._element
  5536. });
  5537. var shownEvent = $.Event(Event$9.SHOWN, {
  5538. relatedTarget: previous
  5539. });
  5540. $(previous).trigger(hiddenEvent);
  5541. $(_this._element).trigger(shownEvent);
  5542. };
  5543. if (target) {
  5544. this._activate(target, target.parentNode, complete);
  5545. } else {
  5546. complete();
  5547. }
  5548. };
  5549. _proto.dispose = function dispose() {
  5550. $.removeData(this._element, DATA_KEY$9);
  5551. this._element = null;
  5552. } // Private
  5553. ;
  5554. _proto._activate = function _activate(element, container, callback) {
  5555. var _this2 = this;
  5556. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5557. var active = activeElements[0];
  5558. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5559. var complete = function complete() {
  5560. return _this2._transitionComplete(element, active, callback);
  5561. };
  5562. if (active && isTransitioning) {
  5563. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5564. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5565. } else {
  5566. complete();
  5567. }
  5568. };
  5569. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5570. if (active) {
  5571. $(active).removeClass(ClassName$9.ACTIVE);
  5572. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5573. if (dropdownChild) {
  5574. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5575. }
  5576. if (active.getAttribute('role') === 'tab') {
  5577. active.setAttribute('aria-selected', false);
  5578. }
  5579. }
  5580. $(element).addClass(ClassName$9.ACTIVE);
  5581. if (element.getAttribute('role') === 'tab') {
  5582. element.setAttribute('aria-selected', true);
  5583. }
  5584. Util.reflow(element);
  5585. if (element.classList.contains(ClassName$9.FADE)) {
  5586. element.classList.add(ClassName$9.SHOW);
  5587. }
  5588. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5589. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5590. if (dropdownElement) {
  5591. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5592. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5593. }
  5594. element.setAttribute('aria-expanded', true);
  5595. }
  5596. if (callback) {
  5597. callback();
  5598. }
  5599. } // Static
  5600. ;
  5601. Tab._jQueryInterface = function _jQueryInterface(config) {
  5602. return this.each(function () {
  5603. var $this = $(this);
  5604. var data = $this.data(DATA_KEY$9);
  5605. if (!data) {
  5606. data = new Tab(this);
  5607. $this.data(DATA_KEY$9, data);
  5608. }
  5609. if (typeof config === 'string') {
  5610. if (typeof data[config] === 'undefined') {
  5611. throw new TypeError("No method named \"" + config + "\"");
  5612. }
  5613. data[config]();
  5614. }
  5615. });
  5616. };
  5617. _createClass(Tab, null, [{
  5618. key: "VERSION",
  5619. get: function get() {
  5620. return VERSION$9;
  5621. }
  5622. }]);
  5623. return Tab;
  5624. }();
  5625. /**
  5626. * ------------------------------------------------------------------------
  5627. * Data Api implementation
  5628. * ------------------------------------------------------------------------
  5629. */
  5630. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5631. event.preventDefault();
  5632. Tab._jQueryInterface.call($(this), 'show');
  5633. });
  5634. /**
  5635. * ------------------------------------------------------------------------
  5636. * jQuery
  5637. * ------------------------------------------------------------------------
  5638. */
  5639. $.fn[NAME$9] = Tab._jQueryInterface;
  5640. $.fn[NAME$9].Constructor = Tab;
  5641. $.fn[NAME$9].noConflict = function () {
  5642. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5643. return Tab._jQueryInterface;
  5644. };
  5645. /**
  5646. * ------------------------------------------------------------------------
  5647. * Constants
  5648. * ------------------------------------------------------------------------
  5649. */
  5650. var NAME$a = 'toast';
  5651. var VERSION$a = '4.3.1';
  5652. var DATA_KEY$a = 'bs.toast';
  5653. var EVENT_KEY$a = "." + DATA_KEY$a;
  5654. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5655. var Event$a = {
  5656. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5657. HIDE: "hide" + EVENT_KEY$a,
  5658. HIDDEN: "hidden" + EVENT_KEY$a,
  5659. SHOW: "show" + EVENT_KEY$a,
  5660. SHOWN: "shown" + EVENT_KEY$a
  5661. };
  5662. var ClassName$a = {
  5663. FADE: 'fade',
  5664. HIDE: 'hide',
  5665. SHOW: 'show',
  5666. SHOWING: 'showing'
  5667. };
  5668. var DefaultType$7 = {
  5669. animation: 'boolean',
  5670. autohide: 'boolean',
  5671. delay: 'number'
  5672. };
  5673. var Default$7 = {
  5674. animation: true,
  5675. autohide: true,
  5676. delay: 500
  5677. };
  5678. var Selector$a = {
  5679. DATA_DISMISS: '[data-dismiss="toast"]'
  5680. /**
  5681. * ------------------------------------------------------------------------
  5682. * Class Definition
  5683. * ------------------------------------------------------------------------
  5684. */
  5685. };
  5686. var Toast =
  5687. /*#__PURE__*/
  5688. function () {
  5689. function Toast(element, config) {
  5690. this._element = element;
  5691. this._config = this._getConfig(config);
  5692. this._timeout = null;
  5693. this._setListeners();
  5694. } // Getters
  5695. var _proto = Toast.prototype;
  5696. // Public
  5697. _proto.show = function show() {
  5698. var _this = this;
  5699. $(this._element).trigger(Event$a.SHOW);
  5700. if (this._config.animation) {
  5701. this._element.classList.add(ClassName$a.FADE);
  5702. }
  5703. var complete = function complete() {
  5704. _this._element.classList.remove(ClassName$a.SHOWING);
  5705. _this._element.classList.add(ClassName$a.SHOW);
  5706. $(_this._element).trigger(Event$a.SHOWN);
  5707. if (_this._config.autohide) {
  5708. _this.hide();
  5709. }
  5710. };
  5711. this._element.classList.remove(ClassName$a.HIDE);
  5712. this._element.classList.add(ClassName$a.SHOWING);
  5713. if (this._config.animation) {
  5714. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5715. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5716. } else {
  5717. complete();
  5718. }
  5719. };
  5720. _proto.hide = function hide(withoutTimeout) {
  5721. var _this2 = this;
  5722. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5723. return;
  5724. }
  5725. $(this._element).trigger(Event$a.HIDE);
  5726. if (withoutTimeout) {
  5727. this._close();
  5728. } else {
  5729. this._timeout = setTimeout(function () {
  5730. _this2._close();
  5731. }, this._config.delay);
  5732. }
  5733. };
  5734. _proto.dispose = function dispose() {
  5735. clearTimeout(this._timeout);
  5736. this._timeout = null;
  5737. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5738. this._element.classList.remove(ClassName$a.SHOW);
  5739. }
  5740. $(this._element).off(Event$a.CLICK_DISMISS);
  5741. $.removeData(this._element, DATA_KEY$a);
  5742. this._element = null;
  5743. this._config = null;
  5744. } // Private
  5745. ;
  5746. _proto._getConfig = function _getConfig(config) {
  5747. config = _objectSpread({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {});
  5748. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5749. return config;
  5750. };
  5751. _proto._setListeners = function _setListeners() {
  5752. var _this3 = this;
  5753. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5754. return _this3.hide(true);
  5755. });
  5756. };
  5757. _proto._close = function _close() {
  5758. var _this4 = this;
  5759. var complete = function complete() {
  5760. _this4._element.classList.add(ClassName$a.HIDE);
  5761. $(_this4._element).trigger(Event$a.HIDDEN);
  5762. };
  5763. this._element.classList.remove(ClassName$a.SHOW);
  5764. if (this._config.animation) {
  5765. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5766. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5767. } else {
  5768. complete();
  5769. }
  5770. } // Static
  5771. ;
  5772. Toast._jQueryInterface = function _jQueryInterface(config) {
  5773. return this.each(function () {
  5774. var $element = $(this);
  5775. var data = $element.data(DATA_KEY$a);
  5776. var _config = typeof config === 'object' && config;
  5777. if (!data) {
  5778. data = new Toast(this, _config);
  5779. $element.data(DATA_KEY$a, data);
  5780. }
  5781. if (typeof config === 'string') {
  5782. if (typeof data[config] === 'undefined') {
  5783. throw new TypeError("No method named \"" + config + "\"");
  5784. }
  5785. data[config](this);
  5786. }
  5787. });
  5788. };
  5789. _createClass(Toast, null, [{
  5790. key: "VERSION",
  5791. get: function get() {
  5792. return VERSION$a;
  5793. }
  5794. }, {
  5795. key: "DefaultType",
  5796. get: function get() {
  5797. return DefaultType$7;
  5798. }
  5799. }, {
  5800. key: "Default",
  5801. get: function get() {
  5802. return Default$7;
  5803. }
  5804. }]);
  5805. return Toast;
  5806. }();
  5807. /**
  5808. * ------------------------------------------------------------------------
  5809. * jQuery
  5810. * ------------------------------------------------------------------------
  5811. */
  5812. $.fn[NAME$a] = Toast._jQueryInterface;
  5813. $.fn[NAME$a].Constructor = Toast;
  5814. $.fn[NAME$a].noConflict = function () {
  5815. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5816. return Toast._jQueryInterface;
  5817. };
  5818. /**
  5819. * --------------------------------------------------------------------------
  5820. * Bootstrap (v4.3.1): index.js
  5821. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5822. * --------------------------------------------------------------------------
  5823. */
  5824. (function () {
  5825. if (typeof $ === 'undefined') {
  5826. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  5827. }
  5828. var version = $.fn.jquery.split(' ')[0].split('.');
  5829. var minMajor = 1;
  5830. var ltMajor = 2;
  5831. var minMinor = 9;
  5832. var minPatch = 1;
  5833. var maxMajor = 4;
  5834. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  5835. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  5836. }
  5837. })();
  5838. exports.Util = Util;
  5839. exports.Alert = Alert;
  5840. exports.Button = Button;
  5841. exports.Carousel = Carousel;
  5842. exports.Collapse = Collapse;
  5843. exports.Dropdown = Dropdown;
  5844. exports.Modal = Modal;
  5845. exports.Popover = Popover;
  5846. exports.Scrollspy = ScrollSpy;
  5847. exports.Tab = Tab;
  5848. exports.Toast = Toast;
  5849. exports.Tooltip = Tooltip;
  5850. Object.defineProperty(exports, '__esModule', { value: true });
  5851. }));
  5852. //# sourceMappingURL=bootstrap.bundle.js.map