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