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