PageRenderTime 99ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 2ms

/js/bootstrap.bundle.js

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