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