vendor: 5,591 bytes, lines 1-165
1"use strict"; 2 3/*! 4 * JavaScript Cookie v2.2.1 5 * https://github.com/js-cookie/js-cookie 6 * 7 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack 8 * Released under the MIT license 9 */ 10; 11(function (factory) { 12 var registeredInModuleLoader; 13 if (typeof define === 'function' && define.amd) { 14 define(factory); 15 registeredInModuleLoader = true; 16 } 17 if (typeof exports === 'object') { 18 module.exports = factory(); 19 registeredInModuleLoader = true; 20 } 21 if (!registeredInModuleLoader) { 22 var OldCookies = window.Cookies; 23 var api = window.Cookies = factory(); 24 api.noConflict = function () { 25 window.Cookies = OldCookies; 26 return api; 27 }; 28 } 29})(function () { 30 function extend() { 31 var i = 0; 32 var result = {}; 33 for (; i < arguments.length; i++) { 34 var attributes = arguments[i]; 35 for (var key in attributes) { 36 result[key] = attributes[key]; 37 } 38 } 39 return result; 40 } 41 function decode(s) { 42 return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); 43 } 44 function init(converter) { 45 function api() {} 46 function set(key, value, attributes) { 47 if (typeof document === 'undefined') { 48 return; 49 } 50 attributes = extend({ 51 path: '/' 52 }, api.defaults, attributes); 53 if (typeof attributes.expires === 'number') { 54 attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5); 55 } 56 57 // We're using "expires" because "max-age" is not supported by IE 58 attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; 59 try { 60 var result = JSON.stringify(value); 61 if (/^[\{\[]/.test(result)) { 62 value = result; 63 } 64 } catch (e) {} 65 value = converter.write ? converter.write(value, key) : encodeURIComponent(String(value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); 66 key = encodeURIComponent(String(key)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape); 67 var stringifiedAttributes = ''; 68 for (var attributeName in attributes) { 69 if (!attributes[attributeName]) { 70 continue; 71 } 72 stringifiedAttributes += '; ' + attributeName; 73 if (attributes[attributeName] === true) { 74 continue; 75 } 76 77 // Considers RFC 6265 section 5.2: 78 // ... 79 // 3. If the remaining unparsed-attributes contains a %x3B (";") 80 // character: 81 // Consume the characters of the unparsed-attributes up to, 82 // not including, the first %x3B (";") character. 83 // ... 84 stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; 85 } 86 return document.cookie = key + '=' + value + stringifiedAttributes; 87 } 88 function get(key, json) { 89 if (typeof document === 'undefined') { 90 return; 91 } 92 var jar = {}; 93 // To prevent the for loop in the first place assign an empty array 94 // in case there are no cookies at all. 95 var cookies = document.cookie ? document.cookie.split('; ') : []; 96 var i = 0; 97 for (; i < cookies.length; i++) { 98 var parts = cookies[i].split('='); 99 var cookie = parts.slice(1).join('='); 100 if (!json && cookie.charAt(0) === '"') { 101 cookie = cookie.slice(1, -1); 102 } 103 try { 104 var name = decode(parts[0]); 105 cookie = (converter.read || converter)(cookie, name) || decode(cookie); 106 if (json) { 107 try { 108 cookie = JSON.parse(cookie); 109 } catch (e) {} 110 } 111 jar[name] = cookie; 112 if (key === name) { 113 break; 114 } 115 } catch (e) {} 116 } 117 return key ? jar[key] : jar; 118 } 119 api.set = set; 120 api.get = function (key) { 121 return get(key, false /* read as raw */); 122 }; 123 api.getJSON = function (key) { 124 return get(key, true /* read as json */); 125 }; 126 api.remove = function (key, attributes) { 127 set(key, '', extend(attributes, { 128 expires: -1 129 })); 130 }; 131 api.defaults = {}; 132 api.withConverter = init; 133 return api; 134 } 135 return init(function () {}); 136}); 137 138/*! 139 * Bootstrap v4.6.2 (https://getbootstrap.com/) 140 * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 141 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 142 */ 143(function (global, factory) { 144 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) : typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.bootstrap = {}, global.jQuery)); 145})(void 0, function (exports, $) { 146 'use strict'; 147 148 function _interopDefaultLegacy(e) { 149 return e && typeof e === 'object' && 'default' in e ? e : { 150 'default': e 151 }; 152 } 153 var $__default = /*#__PURE__*/_interopDefaultLegacy($); 154 function _defineProperties(target, props) { 155 for (var i = 0; i < props.length; i++) { 156 var descriptor = props[i]; 157 descriptor.enumerable = descriptor.enumerable || false; 158 descriptor.configurable = true; 159 if ("value" in descriptor) descriptor.writable = true; 160 Object.defineProperty(target, descriptor.key, descriptor); 161 } 162 } 163 function _createClass(Constructor, protoProps, staticProps) { 164 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 165 if (staticProps) _defineProperties(Constructor, staticProps);
166 Object.defineProperty(Constructor, "prototype", { 167 writable: false 168 }); 169 return Constructor; 170 } 171 function _extends$1() { 172 _extends$1 = Object.assign ? Object.assign.bind() : function (target) { 173 for (var i = 1; i < arguments.length; i++) { 174 var source = arguments[i]; 175 for (var key in source) { 176 if (Object.prototype.hasOwnProperty.call(source, key)) { 177 target[key] = source[key]; 178 } 179 } 180 } 181 return target; 182 }; 183 return _extends$1.apply(this, arguments); 184 } 185 function _inheritsLoose(subClass, superClass) { 186 subClass.prototype = Object.create(superClass.prototype); 187 subClass.prototype.constructor = subClass; 188 _setPrototypeOf(subClass, superClass); 189 } 190 function _setPrototypeOf(o, p) { 191 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { 192 o.__proto__ = p; 193 return o; 194 }; 195 return _setPrototypeOf(o, p); 196 } 197 198 /** 199 * -------------------------------------------------------------------------- 200 * Bootstrap (v4.6.2): util.js 201 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 202 * -------------------------------------------------------------------------- 203 */ 204 /** 205 * Private TransitionEnd Helpers 206 */ 207 208 var TRANSITION_END = 'transitionend'; 209 var MAX_UID = 1000000; 210 var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 211 212 function toType(obj) { 213 if (obj === null || typeof obj === 'undefined') { 214 return "" + obj; 215 } 216 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 217 } 218 function getSpecialTransitionEndEvent() { 219 return { 220 bindType: TRANSITION_END, 221 delegateType: TRANSITION_END, 222 handle: function handle(event) { 223 if ($__default["default"](event.target).is(this)) { 224 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 225 } 226 return undefined; 227 } 228 }; 229 } 230 function transitionEndEmulator(duration) { 231 var _this = this; 232 var called = false; 233 $__default["default"](this).one(Util.TRANSITION_END, function () { 234 called = true; 235 }); 236 setTimeout(function () { 237 if (!called) { 238 Util.triggerTransitionEnd(_this); 239 } 240 }, duration); 241 return this; 242 } 243 function setTransitionEndSupport() { 244 $__default["default"].fn.emulateTransitionEnd = transitionEndEmulator; 245 $__default["default"].event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 246 } 247 /** 248 * Public Util API 249 */ 250 251 var Util = { 252 TRANSITION_END: 'bsTransitionEnd', 253 getUID: function getUID(prefix) { 254 do { 255 // eslint-disable-next-line no-bitwise 256 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 257 } while (document.getElementById(prefix)); 258 return prefix; 259 }, 260 getSelectorFromElement: function getSelectorFromElement(element) { 261 var selector = element.getAttribute('data-target'); 262 if (!selector || selector === '#') { 263 var hrefAttr = element.getAttribute('href'); 264 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; 265 } 266 try { 267 return document.querySelector(selector) ? selector : null; 268 } catch (_) { 269 return null; 270 } 271 }, 272 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 273 if (!element) { 274 return 0; 275 } // Get transition-duration of the element 276 277 var transitionDuration = $__default["default"](element).css('transition-duration'); 278 var transitionDelay = $__default["default"](element).css('transition-delay'); 279 var floatTransitionDuration = parseFloat(transitionDuration); 280 var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 281 282 if (!floatTransitionDuration && !floatTransitionDelay) { 283 return 0; 284 } // If multiple durations are defined, take the first 285 286 transitionDuration = transitionDuration.split(',')[0]; 287 transitionDelay = transitionDelay.split(',')[0]; 288 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 289 }, 290 reflow: function reflow(element) { 291 return element.offsetHeight; 292 }, 293 triggerTransitionEnd: function triggerTransitionEnd(element) { 294 $__default["default"](element).trigger(TRANSITION_END); 295 }, 296 supportsTransitionEnd: function supportsTransitionEnd() { 297 return Boolean(TRANSITION_END); 298 }, 299 isElement: function isElement(obj) { 300 return (obj[0] || obj).nodeType; 301 }, 302 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 303 for (var property in configTypes) { 304 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 305 var expectedTypes = configTypes[property]; 306 var value = config[property]; 307 var valueType = value && Util.isElement(value) ? 'element' : toType(value); 308 if (!new RegExp(expectedTypes).test(valueType)) { 309 throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); 310 } 311 } 312 } 313 }, 314 findShadowRoot: function findShadowRoot(element) { 315 if (!document.documentElement.attachShadow) { 316 return null; 317 } // Can find the shadow root otherwise it'll return the document 318 319 if (typeof element.getRootNode === 'function') { 320 var root = element.getRootNode(); 321 return root instanceof ShadowRoot ? root : null; 322 } 323 if (element instanceof ShadowRoot) { 324 return element; 325 } // when we don't find a shadow root 326 327 if (!element.parentNode) { 328 return null; 329 } 330 return Util.findShadowRoot(element.parentNode); 331 }, 332 jQueryDetection: function jQueryDetection() { 333 if (typeof $__default["default"] === 'undefined') { 334 throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); 335 } 336 var version = $__default["default"].fn.jquery.split(' ')[0].split('.'); 337 var minMajor = 1; 338 var ltMajor = 2; 339 var minMinor = 9; 340 var minPatch = 1; 341 var maxMajor = 4; 342 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >
342= maxMajor) { 343 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); 344 } 345 } 346 }; 347 Util.jQueryDetection(); 348 setTransitionEndSupport(); 349 350 /** 351 * Constants 352 */ 353 354 var NAME$a = 'alert'; 355 var VERSION$a = '4.6.2'; 356 var DATA_KEY$a = 'bs.alert'; 357 var EVENT_KEY$a = "." + DATA_KEY$a; 358 var DATA_API_KEY$7 = '.data-api'; 359 var JQUERY_NO_CONFLICT$a = $__default["default"].fn[NAME$a]; 360 var CLASS_NAME_ALERT = 'alert'; 361 var CLASS_NAME_FADE$5 = 'fade'; 362 var CLASS_NAME_SHOW$7 = 'show'; 363 var EVENT_CLOSE = "close" + EVENT_KEY$a; 364 var EVENT_CLOSED = "closed" + EVENT_KEY$a; 365 var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$a + DATA_API_KEY$7; 366 var SELECTOR_DISMISS = '[data-dismiss="alert"]'; 367 /** 368 * Class definition 369 */ 370 371 var Alert = /*#__PURE__*/function () { 372 function Alert(element) { 373 this._element = element; 374 } // Getters 375 376 var _proto = Alert.prototype; 377 378 // Public 379 _proto.close = function close(element) { 380 var rootElement = this._element; 381 if (element) { 382 rootElement = this._getRootElement(element); 383 } 384 var customEvent = this._triggerCloseEvent(rootElement); 385 if (customEvent.isDefaultPrevented()) { 386 return; 387 } 388 this._removeElement(rootElement); 389 }; 390 _proto.dispose = function dispose() { 391 $__default["default"].removeData(this._element, DATA_KEY$a); 392 this._element = null; 393 } // Private 394 ; 395 _proto._getRootElement = function _getRootElement(element) { 396 var selector = Util.getSelectorFromElement(element); 397 var parent = false; 398 if (selector) { 399 parent = document.querySelector(selector); 400 } 401 if (!parent) { 402 parent = $__default["default"](element).closest("." + CLASS_NAME_ALERT)[0]; 403 } 404 return parent; 405 }; 406 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 407 var closeEvent = $__default["default"].Event(EVENT_CLOSE); 408 $__default["default"](element).trigger(closeEvent); 409 return closeEvent; 410 }; 411 _proto._removeElement = function _removeElement(element) { 412 var _this = this; 413 $__default["default"](element).removeClass(CLASS_NAME_SHOW$7); 414 if (!$__default["default"](element).hasClass(CLASS_NAME_FADE$5)) { 415 this._destroyElement(element); 416 return; 417 } 418 var transitionDuration = Util.getTransitionDurationFromElement(element); 419 $__default["default"](element).one(Util.TRANSITION_END, function (event) { 420 return _this._destroyElement(element, event); 421 }).emulateTransitionEnd(transitionDuration); 422 }; 423 _proto._destroyElement = function _destroyElement(element) { 424 $__default["default"](element).detach().trigger(EVENT_CLOSED).remove(); 425 } // Static 426 ; 427 Alert._jQueryInterface = function _jQueryInterface(config) { 428 return this.each(function () { 429 var $element = $__default["default"](this); 430 var data = $element.data(DATA_KEY$a); 431 if (!data) { 432 data = new Alert(this); 433 $element.data(DATA_KEY$a, data); 434 } 435 if (config === 'close') { 436 data[config](this); 437 } 438 }); 439 }; 440 Alert._handleDismiss = function _handleDismiss(alertInstance) { 441 return function (event) { 442 if (event) { 443 event.preventDefault(); 444 } 445 alertInstance.close(this); 446 }; 447 }; 448 _createClass(Alert, null, [{ 449 key: "VERSION", 450 get: function get() { 451 return VERSION$a; 452 } 453 }]); 454 return Alert; 455 }(); 456 /** 457 * Data API implementation 458 */ 459 460 $__default["default"](document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DISMISS, Alert._handleDismiss(new Alert())); 461 /** 462 * jQuery 463 */ 464 465 $__default["default"].fn[NAME$a] = Alert._jQueryInterface; 466 $__default["default"].fn[NAME$a].Constructor = Alert; 467 $__default["default"].fn[NAME$a].noConflict = function () { 468 $__default["default"].fn[NAME$a] = JQUERY_NO_CONFLICT$a; 469 return Alert._jQueryInterface; 470 }; 471 472 /** 473 * Constants 474 */ 475 476 var NAME$9 = 'button'; 477 var VERSION$9 = '4.6.2'; 478 var DATA_KEY$9 = 'bs.button'; 479 var EVENT_KEY$9 = "." + DATA_KEY$9; 480 var DATA_API_KEY$6 = '.data-api'; 481 var JQUERY_NO_CONFLICT$9 = $__default["default"].fn[NAME$9]; 482 var CLASS_NAME_ACTIVE$3 = 'active'; 483 var CLASS_NAME_BUTTON = 'btn'; 484 var CLASS_NAME_FOCUS = 'focus'; 485 var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$9 + DATA_API_KEY$6; 486 var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$9 + DATA_API_KEY$6 + " " + ("blur" + EVENT_KEY$9 + DATA_API_KEY$6); 487 var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$9 + DATA_API_KEY$6; 488 var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]'; 489 var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]'; 490 var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="button"]'; 491 var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn'; 492 var SELECTOR_INPUT = 'input:not([type="hidden"])'; 493 var SELECTOR_ACTIVE$2 = '.active'; 494 var SELECTOR_BUTTON = '.btn'; 495 /** 496 * Class definition 497 */ 498 499 var Button = /*#__PURE__*/function () { 500 function Button(element) { 501 this._element = element; 502 this.shouldAvoidTriggerChange = false;
503 } // Getters 504 505 var _proto = Button.prototype; 506 507 // Public 508 _proto.toggle = function toggle() { 509 var triggerChangeEvent = true; 510 var addAriaPressed = true; 511 var rootElement = $__default["default"](this._element).closest(SELECTOR_DATA_TOGGLES)[0]; 512 if (rootElement) { 513 var input = this._element.querySelector(SELECTOR_INPUT); 514 if (input) { 515 if (input.type === 'radio') { 516 if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE$3)) { 517 triggerChangeEvent = false; 518 } else { 519 var activeElement = rootElement.querySelector(SELECTOR_ACTIVE$2); 520 if (activeElement) { 521 $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$3); 522 } 523 } 524 } 525 if (triggerChangeEvent) { 526 // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input 527 if (input.type === 'checkbox' || input.type === 'radio') { 528 input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE$3); 529 } 530 if (!this.shouldAvoidTriggerChange) { 531 $__default["default"](input).trigger('change'); 532 } 533 } 534 input.focus(); 535 addAriaPressed = false; 536 } 537 } 538 if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) { 539 if (addAriaPressed) { 540 this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE$3)); 541 } 542 if (triggerChangeEvent) { 543 $__default["default"](this._element).toggleClass(CLASS_NAME_ACTIVE$3); 544 } 545 } 546 }; 547 _proto.dispose = function dispose() { 548 $__default["default"].removeData(this._element, DATA_KEY$9); 549 this._element = null; 550 } // Static 551 ; 552 Button._jQueryInterface = function _jQueryInterface(config, avoidTriggerChange) { 553 return this.each(function () { 554 var $element = $__default["default"](this); 555 var data = $element.data(DATA_KEY$9); 556 if (!data) { 557 data = new Button(this); 558 $element.data(DATA_KEY$9, data); 559 } 560 data.shouldAvoidTriggerChange = avoidTriggerChange; 561 if (config === 'toggle') { 562 data[config](); 563 } 564 }); 565 }; 566 _createClass(Button, null, [{ 567 key: "VERSION", 568 get: function get() { 569 return VERSION$9; 570 } 571 }]); 572 return Button; 573 }(); 574 /** 575 * Data API implementation 576 */ 577 578 $__default["default"](document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE_CARROT, function (event) { 579 var button = event.target; 580 var initialButton = button; 581 if (!$__default["default"](button).hasClass(CLASS_NAME_BUTTON)) { 582 button = $__default["default"](button).closest(SELECTOR_BUTTON)[0]; 583 } 584 if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) { 585 event.preventDefault(); // work around Firefox bug #1540995 586 } else { 587 var inputBtn = button.querySelector(SELECTOR_INPUT); 588 if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) { 589 event.preventDefault(); // work around Firefox bug #1540995 590 591 return; 592 } 593 if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') { 594 Button._jQueryInterface.call($__default["default"](button), 'toggle', initialButton.tagName === 'INPUT'); 595 } 596 } 597 }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { 598 var button = $__default["default"](event.target).closest(SELECTOR_BUTTON)[0]; 599 $__default["default"](button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type)); 600 }); 601 $__default["default"](window).on(EVENT_LOAD_DATA_API$2, function () { 602 // ensure correct active class is set to match the controls' actual values/states 603 // find all checkboxes/readio buttons inside data-toggle groups 604 var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS)); 605 for (var i = 0, len = buttons.length; i < len; i++) { 606 var button = buttons[i]; 607 var input = button.querySelector(SELECTOR_INPUT); 608 if (input.checked || input.hasAttribute('checked')) { 609 button.classList.add(CLASS_NAME_ACTIVE$3); 610 } else { 611 button.classList.remove(CLASS_NAME_ACTIVE$3); 612 } 613 } // find all button toggles 614 615 buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$4)); 616 for (var _i = 0, _len = buttons.length; _i < _len; _i++) { 617 var _button = buttons[_i]; 618 if (_button.getAttribute('aria-pressed') === 'true') { 619 _button.classList.add(CLASS_NAME_ACTIVE$3); 620 } else { 621 _button.classList.remove(CLASS_NAME_ACTIVE$3); 622 } 623 } 624 }); 625 /** 626 * jQuery 627 */ 628 629 $__default["default"].fn[NAME$9] = Button._jQueryInterface; 630 $__default["default"].fn[NAME$9].Constructor = Button; 631 $__default["default"].fn[NAME$9].noConflict = function () { 632 $__default["default"].fn[NAME$9] = JQUERY_NO_CONFLICT$9; 633 return Button._jQueryInterface; 634 }; 635 636 /** 637 * Constants 638 */ 639 640 var NAME$8 = 'carousel'; 641 var VERSION$8 = '4.6.2'; 642 var DATA_KEY$8 = 'bs.carousel'; 643 var EVENT_KEY$8 = "." + DATA_KEY$8; 644 var DATA_API_KEY$5 = '.data-api'; 645 var JQUERY_NO_CONFLICT$8 = $__default["default"].fn[NAME$8]; 646 var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 647 648 var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 649 650 var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 651 652 var SWIPE_THRESHOLD = 40; 653 var CLASS_NAME_CAROUSEL = 'carousel'; 654 var CLASS_NAME_ACTIVE$2 = 'active'; 655 var CLASS_NAME_SLIDE = 'slide'; 656 var CLASS_NAME_RIGHT = 'carousel-item-right'; 657 var CLASS_NAME_LEFT = 'carousel-item-left'; 658 var CLASS_NAME_NEXT = 'carousel-item-next'; 659 var CLASS_NAME_PREV = 'carousel-item-prev'; 660 var CLASS_NAME_POINTER_EVENT = 'pointer-event'; 661 var DIRECTION_NEXT = 'next'; 662 var DIRECTION_PREV = 'prev'; 663 var DIRECTION_LEFT = 'left'; 664 var DIRECTION_RIGHT = 'right'; 665 var EVENT_SLIDE = "slide" + EVENT_KEY$8; 666 var EVENT_SLID = "slid" + EVENT_KEY$8; 667 var EVENT_KEYDOWN = "keydown" + EVENT_KEY$8; 668 var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$8; 669 var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$8; 670 var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$8; 671 var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$8; 672 var EVENT_TOUCHEND = "touchend" + EVENT_KEY$8; 673 var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$8; 674 var EVENT_POINTERUP = "pointerup" + EVENT_KEY$8; 675 var EVENT_DRAG_START = "dragstart" + EVENT_KEY$8; 676 var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$8 + DATA_API_KEY$5; 677 var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$8 + DATA_API_KEY$5; 678 var SELECTOR_ACTIVE$1 = '.active'; 679 var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
680 var SELECTOR_ITEM = '.carousel-item'; 681 var SELECTOR_ITEM_IMG = '.carousel-item img'; 682 var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; 683 var SELECTOR_INDICATORS = '.carousel-indicators'; 684 var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]'; 685 var SELECTOR_DATA_RIDE = '[data-ride="carousel"]'; 686 var Default$7 = { 687 interval: 5000, 688 keyboard: true, 689 slide: false, 690 pause: 'hover', 691 wrap: true, 692 touch: true 693 }; 694 var DefaultType$7 = { 695 interval: '(number|boolean)', 696 keyboard: 'boolean', 697 slide: '(boolean|string)', 698 pause: '(string|boolean)', 699 wrap: 'boolean', 700 touch: 'boolean' 701 }; 702 var PointerType = { 703 TOUCH: 'touch', 704 PEN: 'pen' 705 }; 706 /** 707 * Class definition 708 */ 709 710 var Carousel = /*#__PURE__*/function () { 711 function Carousel(element, config) { 712 this._items = null; 713 this._interval = null; 714 this._activeElement = null; 715 this._isPaused = false; 716 this._isSliding = false; 717 this.touchTimeout = null; 718 this.touchStartX = 0; 719 this.touchDeltaX = 0; 720 this._config = this._getConfig(config); 721 this._element = element; 722 this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS); 723 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 724 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); 725 this._addEventListeners(); 726 } // Getters 727 728 var _proto = Carousel.prototype; 729 730 // Public 731 _proto.next = function next() { 732 if (!this._isSliding) { 733 this._slide(DIRECTION_NEXT); 734 } 735 }; 736 _proto.nextWhenVisible = function nextWhenVisible() { 737 var $element = $__default["default"](this._element); // Don't call next when the page isn't visible 738 // or the carousel or its parent isn't visible 739 740 if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') { 741 this.next(); 742 } 743 }; 744 _proto.prev = function prev() { 745 if (!this._isSliding) { 746 this._slide(DIRECTION_PREV); 747 } 748 }; 749 _proto.pause = function pause(event) { 750 if (!event) { 751 this._isPaused = true; 752 } 753 if (this._element.querySelector(SELECTOR_NEXT_PREV)) { 754 Util.triggerTransitionEnd(this._element); 755 this.cycle(true); 756 } 757 clearInterval(this._interval); 758 this._interval = null; 759 }; 760 _proto.cycle = function cycle(event) { 761 if (!event) { 762 this._isPaused = false; 763 } 764 if (this._interval) { 765 clearInterval(this._interval); 766 this._interval = null; 767 } 768 if (this._config.interval && !this._isPaused) { 769 this._updateInterval(); 770 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 771 } 772 }; 773 _proto.to = function to(index) { 774 var _this = this; 775 this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); 776 var activeIndex = this._getItemIndex(this._activeElement); 777 if (index > this._items.length - 1 || index < 0) { 778 return; 779 } 780 if (this._isSliding) { 781 $__default["default"](this._element).one(EVENT_SLID, function () { 782 return _this.to(index); 783 }); 784 return; 785 } 786 if (activeIndex === index) { 787 this.pause(); 788 this.cycle(); 789 return; 790 } 791 var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV; 792 this._slide(direction, this._items[index]); 793 }; 794 _proto.dispose = function dispose() { 795 $__default["default"](this._element).off(EVENT_KEY$8); 796 $__default["default"].removeData(this._element, DATA_KEY$8); 797 this._items = null; 798 this._config = null; 799 this._element = null; 800 this._interval = null; 801 this._isPaused = null; 802 this._isSliding = null; 803 this._activeElement = null; 804 this._indicatorsElement = null; 805 } // Private 806 ; 807 _proto._getConfig = function _getConfig(config) { 808 config = _extends$1({}, Default$7, config); 809 Util.typeCheckConfig(NAME$8, config, DefaultType$7); 810 return config; 811 }; 812 _proto._handleSwipe = function _handleSwipe() { 813 var absDeltax = Math.abs(this.touchDeltaX); 814 if (absDeltax <= SWIPE_THRESHOLD) { 815 return; 816 } 817 var direction = absDeltax / this.touchDeltaX; 818 this.touchDeltaX = 0; // swipe left 819 820 if (direction > 0) { 821 this.prev(); 822 } // swipe right 823 824 if (direction < 0) { 825 this.next(); 826 } 827 }; 828 _proto._addEventListeners = function _addEventListeners() { 829 var _this2 = this; 830 if (this._config.keyboard) { 831 $__default["default"](this._element).on(EVENT_KEYDOWN, function (event) { 832 return _this2._keydown(event); 833 }); 834 } 835 if (this._config.pause === 'hover') { 836 $__default["default"](this._element).on(EVENT_MOUSEENTER, function (event) { 837 return _this2.pause(event); 838 }).on(EVENT_MOUSELEAVE, function (event) { 839 return _this2.cycle(event); 840 }); 841 } 842 if (this._config.touch) { 843 this._addTouchEventListeners(); 844 } 845 }; 846 _proto._addTouchEventListeners = function _addTouchEventListeners() { 847 var _this3 = this; 848 if (!this._touchSupported) { 849 return; 850 } 851 var start = function start(event) { 852 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 853 _this3.touchStartX = event.originalEvent.clientX; 854 } else if (!_this3._pointerEvent) { 855 _this3.touchStartX = event.originalEvent.touches[0].clientX; 856 } 857 }; 858 var move = function move(event) { 859 // ensure swiping with one touch and not pinching 860 _this3.touchDeltaX = event.originalEvent.touches && event.originalEvent.touches.length > 1 ? 0 : event.originalEvent.touches[0].clientX - _this3.touchStartX; 861 }; 862 var end = function end(event) { 863 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 864 _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; 865 } 866 _this3._handleSwipe(); 867 if (_this3._config.pause === 'hover') {
868 // If it's a touch-enabled device, mouseenter/leave are fired as 869 // part of the mouse compatibility events on first tap - the carousel 870 // would stop cycling until user tapped out of it; 871 // here, we listen for touchend, explicitly pause the carousel 872 // (as if it's the second time we tap on it, mouseenter compat event 873 // is NOT fired) and after a timeout (to allow for mouse compatibility 874 // events to fire) we explicitly restart cycling 875 _this3.pause(); 876 if (_this3.touchTimeout) { 877 clearTimeout(_this3.touchTimeout); 878 } 879 _this3.touchTimeout = setTimeout(function (event) { 880 return _this3.cycle(event); 881 }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); 882 } 883 }; 884 $__default["default"](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) { 885 return e.preventDefault(); 886 }); 887 if (this._pointerEvent) { 888 $__default["default"](this._element).on(EVENT_POINTERDOWN, function (event) { 889 return start(event); 890 }); 891 $__default["default"](this._element).on(EVENT_POINTERUP, function (event) { 892 return end(event); 893 }); 894 this._element.classList.add(CLASS_NAME_POINTER_EVENT); 895 } else { 896 $__default["default"](this._element).on(EVENT_TOUCHSTART, function (event) { 897 return start(event); 898 }); 899 $__default["default"](this._element).on(EVENT_TOUCHMOVE, function (event) { 900 return move(event); 901 }); 902 $__default["default"](this._element).on(EVENT_TOUCHEND, function (event) { 903 return end(event); 904 }); 905 } 906 }; 907 _proto._keydown = function _keydown(event) { 908 if (/input|textarea/i.test(event.target.tagName)) { 909 return; 910 } 911 switch (event.which) { 912 case ARROW_LEFT_KEYCODE: 913 event.preventDefault(); 914 this.prev(); 915 break; 916 case ARROW_RIGHT_KEYCODE: 917 event.preventDefault(); 918 this.next(); 919 break; 920 } 921 }; 922 _proto._getItemIndex = function _getItemIndex(element) { 923 this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : []; 924 return this._items.indexOf(element); 925 }; 926 _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { 927 var isNextDirection = direction === DIRECTION_NEXT; 928 var isPrevDirection = direction === DIRECTION_PREV; 929 var activeIndex = this._getItemIndex(activeElement); 930 var lastItemIndex = this._items.length - 1; 931 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 932 if (isGoingToWrap && !this._config.wrap) { 933 return activeElement; 934 } 935 var delta = direction === DIRECTION_PREV ? -1 : 1; 936 var itemIndex = (activeIndex + delta) % this._items.length; 937 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 938 }; 939 _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 940 var targetIndex = this._getItemIndex(relatedTarget); 941 var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM)); 942 var slideEvent = $__default["default"].Event(EVENT_SLIDE, { 943 relatedTarget: relatedTarget, 944 direction: eventDirectionName, 945 from: fromIndex, 946 to: targetIndex 947 }); 948 $__default["default"](this._element).trigger(slideEvent); 949 return slideEvent; 950 }; 951 _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 952 if (this._indicatorsElement) { 953 var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1)); 954 $__default["default"](indicators).removeClass(CLASS_NAME_ACTIVE$2); 955 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 956 if (nextIndicator) { 957 $__default["default"](nextIndicator).addClass(CLASS_NAME_ACTIVE$2); 958 } 959 } 960 }; 961 _proto._updateInterval = function _updateInterval() { 962 var element = this._activeElement || this._element.querySelector(SELECTOR_ACTIVE_ITEM); 963 if (!element) { 964 return; 965 } 966 var elementInterval = parseInt(element.getAttribute('data-interval'), 10); 967 if (elementInterval) { 968 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 969 this._config.interval = elementInterval; 970 } else { 971 this._config.interval = this._config.defaultInterval || this._config.interval; 972 } 973 }; 974 _proto._slide = function _slide(direction, element) { 975 var _this4 = this; 976 var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); 977 var activeElementIndex = this._getItemIndex(activeElement); 978 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 979 var nextElementIndex = this._getItemIndex(nextElement); 980 var isCycling = Boolean(this._interval); 981 var directionalClassName; 982 var orderClassName; 983 var eventDirectionName; 984 if (direction === DIRECTION_NEXT) { 985 directionalClassName = CLASS_NAME_LEFT; 986 orderClassName = CLASS_NAME_NEXT; 987 eventDirectionName = DIRECTION_LEFT; 988 } else { 989 directionalClassName = CLASS_NAME_RIGHT; 990 orderClassName = CLASS_NAME_PREV; 991 eventDirectionName = DIRECTION_RIGHT; 992 } 993 if (nextElement && $__default["default"](nextElement).hasClass(CLASS_NAME_ACTIVE$2)) { 994 this._isSliding = false;
995 return; 996 } 997 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 998 if (slideEvent.isDefaultPrevented()) { 999 return; 1000 } 1001 if (!activeElement || !nextElement) { 1002 // Some weirdness is happening, so we bail 1003 return; 1004 } 1005 this._isSliding = true; 1006 if (isCycling) { 1007 this.pause(); 1008 } 1009 this._setActiveIndicatorElement(nextElement); 1010 this._activeElement = nextElement; 1011 var slidEvent = $__default["default"].Event(EVENT_SLID, { 1012 relatedTarget: nextElement, 1013 direction: eventDirectionName, 1014 from: activeElementIndex, 1015 to: nextElementIndex 1016 }); 1017 if ($__default["default"](this._element).hasClass(CLASS_NAME_SLIDE)) { 1018 $__default["default"](nextElement).addClass(orderClassName); 1019 Util.reflow(nextElement); 1020 $__default["default"](activeElement).addClass(directionalClassName); 1021 $__default["default"](nextElement).addClass(directionalClassName); 1022 var transitionDuration = Util.getTransitionDurationFromElement(activeElement); 1023 $__default["default"](activeElement).one(Util.TRANSITION_END, function () { 1024 $__default["default"](nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$2); 1025 $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$2 + " " + orderClassName + " " + directionalClassName); 1026 _this4._isSliding = false; 1027 setTimeout(function () { 1028 return $__default["default"](_this4._element).trigger(slidEvent); 1029 }, 0); 1030 }).emulateTransitionEnd(transitionDuration); 1031 } else { 1032 $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$2); 1033 $__default["default"](nextElement).addClass(CLASS_NAME_ACTIVE$2); 1034 this._isSliding = false; 1035 $__default["default"](this._element).trigger(slidEvent); 1036 } 1037 if (isCycling) { 1038 this.cycle(); 1039 } 1040 } // Static 1041 ; 1042 Carousel._jQueryInterface = function _jQueryInterface(config) { 1043 return this.each(function () { 1044 var data = $__default["default"](this).data(DATA_KEY$8); 1045 var _config = _extends$1({}, Default$7, $__default["default"](this).data()); 1046 if (typeof config === 'object') { 1047 _config = _extends$1({}, _config, config); 1048 } 1049 var action = typeof config === 'string' ? config : _config.slide; 1050 if (!data) { 1051 data = new Carousel(this, _config); 1052 $__default["default"](this).data(DATA_KEY$8, data); 1053 } 1054 if (typeof config === 'number') { 1055 data.to(config); 1056 } else if (typeof action === 'string') { 1057 if (typeof data[action] === 'undefined') { 1058 throw new TypeError("No method named \"" + action + "\""); 1059 } 1060 data[action](); 1061 } else if (_config.interval && _config.ride) { 1062 data.pause(); 1063 data.cycle(); 1064 } 1065 }); 1066 }; 1067 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 1068 var selector = Util.getSelectorFromElement(this); 1069 if (!selector) { 1070 return; 1071 } 1072 var target = $__default["default"](selector)[0]; 1073 if (!target || !$__default["default"](target).hasClass(CLASS_NAME_CAROUSEL)) { 1074 return; 1075 } 1076 var config = _extends$1({}, $__default["default"](target).data(), $__default["default"](this).data()); 1077 var slideIndex = this.getAttribute('data-slide-to'); 1078 if (slideIndex) { 1079 config.interval = false; 1080 } 1081 Carousel._jQueryInterface.call($__default["default"](target), config); 1082 if (slideIndex) { 1083 $__default["default"](target).data(DATA_KEY$8).to(slideIndex); 1084 } 1085 event.preventDefault(); 1086 }; 1087 _createClass(Carousel, null, [{ 1088 key: "VERSION", 1089 get: function get() { 1090 return VERSION$8; 1091 } 1092 }, { 1093 key: "Default", 1094 get: function get() { 1095 return Default$7; 1096 } 1097 }]); 1098 return Carousel; 1099 }(); 1100 /** 1101 * Data API implementation 1102 */ 1103 1104 $__default["default"](document).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler); 1105 $__default["default"](window).on(EVENT_LOAD_DATA_API$1, function () { 1106 var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE)); 1107 for (var i = 0, len = carousels.length; i < len; i++) { 1108 var $carousel = $__default["default"](carousels[i]);
1109 Carousel._jQueryInterface.call($carousel, $carousel.data()); 1110 } 1111 }); 1112 /** 1113 * jQuery 1114 */ 1115 1116 $__default["default"].fn[NAME$8] = Carousel._jQueryInterface; 1117 $__default["default"].fn[NAME$8].Constructor = Carousel; 1118 $__default["default"].fn[NAME$8].noConflict = function () { 1119 $__default["default"].fn[NAME$8] = JQUERY_NO_CONFLICT$8; 1120 return Carousel._jQueryInterface; 1121 }; 1122 1123 /** 1124 * Constants 1125 */ 1126 1127 var NAME$7 = 'collapse'; 1128 var VERSION$7 = '4.6.2'; 1129 var DATA_KEY$7 = 'bs.collapse'; 1130 var EVENT_KEY$7 = "." + DATA_KEY$7; 1131 var DATA_API_KEY$4 = '.data-api'; 1132 var JQUERY_NO_CONFLICT$7 = $__default["default"].fn[NAME$7]; 1133 var CLASS_NAME_SHOW$6 = 'show'; 1134 var CLASS_NAME_COLLAPSE = 'collapse'; 1135 var CLASS_NAME_COLLAPSING = 'collapsing'; 1136 var CLASS_NAME_COLLAPSED = 'collapsed'; 1137 var DIMENSION_WIDTH = 'width'; 1138 var DIMENSION_HEIGHT = 'height'; 1139 var EVENT_SHOW$4 = "show" + EVENT_KEY$7; 1140 var EVENT_SHOWN$4 = "shown" + EVENT_KEY$7; 1141 var EVENT_HIDE$4 = "hide" + EVENT_KEY$7; 1142 var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$7; 1143 var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$7 + DATA_API_KEY$4; 1144 var SELECTOR_ACTIVES = '.show, .collapsing'; 1145 var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="collapse"]'; 1146 var Default$6 = { 1147 toggle: true, 1148 parent: '' 1149 }; 1150 var DefaultType$6 = { 1151 toggle: 'boolean', 1152 parent: '(string|element)' 1153 }; 1154 /** 1155 * Class definition 1156 */ 1157 1158 var Collapse = /*#__PURE__*/function () { 1159 function Collapse(element, config) { 1160 this._isTransitioning = false; 1161 this._element = element; 1162 this._config = this._getConfig(config); 1163 this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); 1164 var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$3)); 1165 for (var i = 0, len = toggleList.length; i < len; i++) { 1166 var elem = toggleList[i]; 1167 var selector = Util.getSelectorFromElement(elem); 1168 var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { 1169 return foundElem === element; 1170 }); 1171 if (selector !== null && filterElement.length > 0) { 1172 this._selector = selector; 1173 this._triggerArray.push(elem); 1174 } 1175 } 1176 this._parent = this._config.parent ? this._getParent() : null; 1177 if (!this._config.parent) { 1178 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 1179 } 1180 if (this._config.toggle) { 1181 this.toggle(); 1182 } 1183 } // Getters 1184 1185 var _proto = Collapse.prototype; 1186 1187 // Public 1188 _proto.toggle = function toggle() { 1189 if ($__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { 1190 this.hide(); 1191 } else { 1192 this.show(); 1193 } 1194 }; 1195 _proto.show = function show() { 1196 var _this = this; 1197 if (this._isTransitioning || $__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { 1198 return; 1199 } 1200 var actives; 1201 var activesData; 1202 if (this._parent) { 1203 actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) { 1204 if (typeof _this._config.parent === 'string') { 1205 return elem.getAttribute('data-parent') === _this._config.parent; 1206 } 1207 return elem.classList.contains(CLASS_NAME_COLLAPSE); 1208 }); 1209 if (actives.length === 0) { 1210 actives = null; 1211 } 1212 } 1213 if (actives) { 1214 activesData = $__default["default"](actives).not(this._selector).data(DATA_KEY$7); 1215 if (activesData && activesData._isTransitioning) { 1216 return; 1217 } 1218 } 1219 var startEvent = $__default["default"].Event(EVENT_SHOW$4); 1220 $__default["default"](this._element).trigger(startEvent); 1221 if (startEvent.isDefaultPrevented()) { 1222 return; 1223 } 1224 if (actives) { 1225 Collapse._jQueryInterface.call($__default["default"](actives).not(this._selector), 'hide'); 1226 if (!activesData) { 1227 $__default["default"](actives).data(DATA_KEY$7, null); 1228 } 1229 } 1230 var dimension = this._getDimension(); 1231 $__default["default"](this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING); 1232 this._element.style[dimension] = 0; 1233 if (this._triggerArray.length) { 1234 $__default["default"](this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true); 1235 } 1236 this.setTransitioning(true); 1237 var complete = function complete() { 1238 $__default["default"](_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$6); 1239 _this._element.style[dimension] = ''; 1240 _this.setTransitioning(false); 1241 $__default["default"](_this._element).trigger(EVENT_SHOWN$4); 1242 }; 1243 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 1244 var scrollSize = "scroll" + capitalizedDimension; 1245 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 1246 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 1247 this._element.style[dimension] = this._element[scrollSize] + "px"; 1248 }; 1249 _proto.hide = function hide() { 1250 var _this2 = this; 1251 if (this._isTransitioning || !$__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { 1252 return; 1253 } 1254 var startEvent = $__default["default"].Event(EVENT_HIDE$4); 1255 $__default["default"](this._element).trigger(startEvent); 1256 if (startEvent.isDefaultPrevented()) { 1257 return; 1258 } 1259 var dimension = this._getDimension(); 1260 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; 1261 Util.reflow(this._element); 1262 $__default["default"](this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$6); 1263 var triggerArrayLength = this._triggerArray.length; 1264 if (triggerArrayLength > 0) { 1265 for (var i = 0; i < triggerArrayLength; i++) { 1266 var trigger = this._triggerArray[i]; 1267 var selector = Util.getSelectorFromElement(trigger); 1268 if (selector !== null) { 1269 var $elem = $__default["default"]([].slice.call(document.querySelectorAll(selector))); 1270 if (!$elem.hasClass(CLASS_NAME_SHOW$6)) { 1271 $__default["default"](trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false); 1272 } 1273 } 1274 } 1275 } 1276 this.setTransitioning(true); 1277 var complete = function complete() { 1278 _this2.setTransitioning(false); 1279 $__default["default"](_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN$4); 1280 }; 1281 this._element.style[dimension] = ''; 1282 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 1283 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 1284 }; 1285 _proto.setTransitioning = function setTransitioning(isTransitioning) { 1286 this._isTransitioning = isTransitioning; 1287 }; 1288 _proto.dispose = function dispose() { 1289 $__default["default"].removeData(this._element, DATA_KEY$7); 1290 this._config = null; 1291 this._parent = null; 1292 this._element = null; 1293 this._triggerArray = null; 1294 this._isTransitioning = null; 1295 } // Private 1296 ; 1297 _proto._getConfig = function _getConfig(config) { 1298 config = _extends$1({}, Default$6, config); 1299 config.toggle = Boolean(config.toggle); // Coerce string values 1300 1301 Util.typeCheckConfig(NAME$7, config, DefaultType$6); 1302 return config; 1303 }; 1304 _proto._getDimension = function _getDimension() { 1305 var hasWidth = $__default["default"](this._element).hasClass(DIMENSION_WIDTH); 1306 return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT; 1307 }; 1308 _proto._getParent = function _getParent() { 1309 var _this3 = this; 1310 var parent; 1311 if (Util.isElement(this._config.parent)) { 1312 parent = this._config.parent; // It's a jQuery object 1313 1314 if (typeof this._config.parent.jquery !== 'undefined') { 1315 parent = this._config.parent[0]; 1316 } 1317 } else { 1318 parent = document.querySelector(this._config.parent); 1319 } 1320 var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; 1321 var children = [].slice.call(parent.querySelectorAll(selector)); 1322 $__default["default"](children).each(function (i, element) { 1323 _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); 1324 }); 1325 return parent; 1326 }; 1327 _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 1328 var isOpen = $__default["default"](element).hasClass(CLASS_NAME_SHOW$6); 1329 if (triggerArray.length) { 1330 $__default["default"](triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen); 1331 } 1332 } // Static 1333 ; 1334 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 1335 var selector = Util.getSelectorFromElement(element); 1336 return selector ? document.querySelector(selector) : null; 1337 }; 1338 Collapse._jQueryInterface = function _jQueryInterface(config) { 1339 return this.each(function () { 1340 var $element = $__default["default"](this); 1341 var data = $element.data(DATA_KEY$7); 1342 var _config = _extends$1({}, Default$6, $element.data(), typeof config === 'object' && config ? config : {}); 1343 if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { 1344 _config.toggle = false;
1345 } 1346 if (!data) { 1347 data = new Collapse(this, _config); 1348 $element.data(DATA_KEY$7, data); 1349 } 1350 if (typeof config === 'string') { 1351 if (typeof data[config] === 'undefined') { 1352 throw new TypeError("No method named \"" + config + "\""); 1353 } 1354 data[config](); 1355 } 1356 }); 1357 }; 1358 _createClass(Collapse, null, [{ 1359 key: "VERSION", 1360 get: function get() { 1361 return VERSION$7; 1362 } 1363 }, { 1364 key: "Default", 1365 get: function get() { 1366 return Default$6; 1367 } 1368 }]); 1369 return Collapse; 1370 }(); 1371 /** 1372 * Data API implementation 1373 */ 1374 1375 $__default["default"](document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { 1376 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 1377 if (event.currentTarget.tagName === 'A') { 1378 event.preventDefault(); 1379 } 1380 var $trigger = $__default["default"](this); 1381 var selector = Util.getSelectorFromElement(this); 1382 var selectors = [].slice.call(document.querySelectorAll(selector)); 1383 $__default["default"](selectors).each(function () { 1384 var $target = $__default["default"](this); 1385 var data = $target.data(DATA_KEY$7); 1386 var config = data ? 'toggle' : $trigger.data(); 1387 Collapse._jQueryInterface.call($target, config); 1388 }); 1389 }); 1390 /** 1391 * jQuery 1392 */ 1393 1394 $__default["default"].fn[NAME$7] = Collapse._jQueryInterface; 1395 $__default["default"].fn[NAME$7].Constructor = Collapse; 1396 $__default["default"].fn[NAME$7].noConflict = function () { 1397 $__default["default"].fn[NAME$7] = JQUERY_NO_CONFLICT$7; 1398 return Collapse._jQueryInterface; 1399 }; 1400 1401 /**! 1402 * @fileOverview Kickass library to create and place poppers near their reference elements. 1403 * @version 1.16.1 1404 * @license 1405 * Copyright (c) 2016 Federico Zivolo and contributors 1406 * 1407 * Permission is hereby granted, free of charge, to any person obtaining a copy 1408 * of this software and associated documentation files (the "Software"), to deal 1409 * in the Software without restriction, including without limitation the rights 1410 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1411 * copies of the Software, and to permit persons to whom the Software is 1412 * furnished to do so, subject to the following conditions: 1413 * 1414 * The above copyright notice and this permission notice shall be included in all 1415 * copies or substantial portions of the Software. 1416 * 1417 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1418 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1419 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1420 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1421 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1422 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 1423 * SOFTWARE. 1424 */ 1425 var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined'; 1426 var timeoutDuration = function () { 1427 var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 1428 for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 1429 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 1430 return 1; 1431 } 1432 } 1433 return 0; 1434 }(); 1435 function microtaskDebounce(fn) { 1436 var called = false; 1437 return function () { 1438 if (called) { 1439 return; 1440 } 1441 called = true; 1442 window.Promise.resolve().then(function () { 1443 called = false; 1444 fn(); 1445 }); 1446 }; 1447 } 1448 function taskDebounce(fn) { 1449 var scheduled = false; 1450 return function () { 1451 if (!scheduled) { 1452 scheduled = true; 1453 setTimeout(function () { 1454 scheduled = false; 1455 fn(); 1456 }, timeoutDuration); 1457 } 1458 }; 1459 } 1460 var supportsMicroTasks = isBrowser && window.Promise; 1461 1462 /** 1463 * Create a debounced version of a method, that's asynchronously deferred 1464 * but called in the minimum time possible. 1465 * 1466 * @method 1467 * @memberof Popper.Utils 1468 * @argument {Function} fn 1469 * @returns {Function} 1470 */ 1471 var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 1472 1473 /** 1474 * Check if the given variable is a function 1475 * @method 1476 * @memberof Popper.Utils 1477 * @argument {Any} functionToCheck - variable to check 1478 * @returns {Boolean} answer to: is a function? 1479 */ 1480 function isFunction(functionToCheck) { 1481 var getType = {}; 1482 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 1483 } 1484 1485 /** 1486 * Get CSS computed property of the given element 1487 * @method 1488 * @memberof Popper.Utils 1489 * @argument {Eement} element 1490 * @argument {String} property 1491 */ 1492 function getStyleComputedProperty(element, property) { 1493 if (element.nodeType !== 1) { 1494 return []; 1495 } 1496 // NOTE: 1 DOM access here 1497 var window = element.ownerDocument.defaultView; 1498 var css = window.getComputedStyle(element, null); 1499 return property ? css[property] : css; 1500 } 1501 1502 /** 1503 * Returns the parentNode or the host of the element 1504 * @method 1505 * @memberof Popper.Utils 1506 * @argument {Element} element 1507 * @returns {Element} parent 1508 */ 1509 function getParentNode(element) { 1510 if (element.nodeName === 'HTML') { 1511 return element; 1512 } 1513 return element.parentNode || element.host; 1514 } 1515 1516 /** 1517 * Returns the scrolling parent of the given element 1518 * @method 1519 * @memberof Popper.Utils 1520 * @argument {Element} element 1521 * @returns {Element} scroll parent 1522 */ 1523 function getScrollParent(element) { 1524 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 1525 if (!element) { 1526 return document.body; 1527 } 1528 switch (element.nodeName) { 1529 case 'HTML': 1530 case 'BODY': 1531 return element.ownerDocument.body; 1532 case '#document': 1533 return element.body; 1534 } 1535 1536 // Firefox want us to check `-x` and `-y` variations as well 1537 1538 var _getStyleComputedProp = getStyleComputedProperty(element), 1539 overflow = _getStyleComputedProp.overflow, 1540 overflowX = _getStyleComputedProp.overflowX, 1541 overflowY = _getStyleComputedProp.overflowY; 1542 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 1543 return element; 1544 } 1545 return getScrollParent(getParentNode(element)); 1546 } 1547 1548 /** 1549 * Returns the reference node of the reference object, or the reference object itself. 1550 * @method 1551 * @memberof Popper.Utils
vendor: 5,416 bytes, lines 1552-1704
1552 * @param {Element|Object} reference - the reference element (the popper will be relative to this) 1553 * @returns {Element} parent 1554 */ 1555 function getReferenceNode(reference) { 1556 return reference && reference.referenceNode ? reference.referenceNode : reference; 1557 } 1558 var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 1559 var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 1560 1561 /** 1562 * Determines if the browser is Internet Explorer 1563 * @method 1564 * @memberof Popper.Utils 1565 * @param {Number} version to check 1566 * @returns {Boolean} isIE 1567 */ 1568 function isIE(version) { 1569 if (version === 11) { 1570 return isIE11; 1571 } 1572 if (version === 10) { 1573 return isIE10; 1574 } 1575 return isIE11 || isIE10; 1576 } 1577 1578 /** 1579 * Returns the offset parent of the given element 1580 * @method 1581 * @memberof Popper.Utils 1582 * @argument {Element} element 1583 * @returns {Element} offset parent 1584 */ 1585 function getOffsetParent(element) { 1586 if (!element) { 1587 return document.documentElement; 1588 } 1589 var noOffsetParent = isIE(10) ? document.body : null; 1590 1591 // NOTE: 1 DOM access here 1592 var offsetParent = element.offsetParent || null; 1593 // Skip hidden elements which don't have an offsetParent 1594 while (offsetParent === noOffsetParent && element.nextElementSibling) { 1595 offsetParent = (element = element.nextElementSibling).offsetParent; 1596 } 1597 var nodeName = offsetParent && offsetParent.nodeName; 1598 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 1599 return element ? element.ownerDocument.documentElement : document.documentElement; 1600 } 1601 1602 // .offsetParent will return the closest TH, TD or TABLE in case 1603 // no offsetParent is present, I hate this job... 1604 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 1605 return getOffsetParent(offsetParent); 1606 } 1607 return offsetParent; 1608 } 1609 function isOffsetContainer(element) { 1610 var nodeName = element.nodeName; 1611 if (nodeName === 'BODY') { 1612 return false; 1613 } 1614 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 1615 } 1616 1617 /** 1618 * Finds the root node (document, shadowDOM root) of the given element 1619 * @method 1620 * @memberof Popper.Utils 1621 * @argument {Element} node 1622 * @returns {Element} root node 1623 */ 1624 function getRoot(node) { 1625 if (node.parentNode !== null) { 1626 return getRoot(node.parentNode); 1627 } 1628 return node; 1629 } 1630 1631 /** 1632 * Finds the offset parent common to the two provided nodes 1633 * @method 1634 * @memberof Popper.Utils 1635 * @argument {Element} element1 1636 * @argument {Element} element2 1637 * @returns {Element} common offset parent 1638 */ 1639 function findCommonOffsetParent(element1, element2) { 1640 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 1641 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 1642 return document.documentElement; 1643 } 1644 1645 // Here we make sure to give as "start" the element that comes first in the DOM 1646 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 1647 var start = order ? element1 : element2; 1648 var end = order ? element2 : element1; 1649 1650 // Get common ancestor container 1651 var range = document.createRange(); 1652 range.setStart(start, 0); 1653 range.setEnd(end, 0); 1654 var commonAncestorContainer = range.commonAncestorContainer; 1655 1656 // Both nodes are inside #document 1657 1658 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 1659 if (isOffsetContainer(commonAncestorContainer)) { 1660 return commonAncestorContainer; 1661 } 1662 return getOffsetParent(commonAncestorContainer); 1663 } 1664 1665 // one of the nodes is inside shadowDOM, find which one 1666 var element1root = getRoot(element1); 1667 if (element1root.host) { 1668 return findCommonOffsetParent(element1root.host, element2); 1669 } else { 1670 return findCommonOffsetParent(element1, getRoot(element2).host); 1671 } 1672 } 1673 1674 /** 1675 * Gets the scroll value of the given element in the given side (top and left) 1676 * @method 1677 * @memberof Popper.Utils 1678 * @argument {Element} element 1679 * @argument {String} side `top` or `left` 1680 * @returns {number} amount of scrolled pixels 1681 */ 1682 function getScroll(element) { 1683 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 1684 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 1685 var nodeName = element.nodeName; 1686 if (nodeName === 'BODY' || nodeName === 'HTML') { 1687 var html = element.ownerDocument.documentElement; 1688 var scrollingElement = element.ownerDocument.scrollingElement || html; 1689 return scrollingElement[upperSide]; 1690 } 1691 return element[upperSide]; 1692 } 1693 1694 /* 1695 * Sum or subtract the element scroll values (left and top) from a given rect object 1696 * @method 1697 * @memberof Popper.Utils 1698 * @param {Object} rect - Rect object you want to change 1699 * @param {HTMLElement} element - The element from the function reads the scroll values 1700 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 1701 * @return {Object} rect - The modifier rect object 1702 */ 1703 function includeScroll(rect, element) { 1704 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
vendor: 5,384 bytes, lines 1705-1854
1705 var scrollTop = getScroll(element, 'top'); 1706 var scrollLeft = getScroll(element, 'left'); 1707 var modifier = subtract ? -1 : 1; 1708 rect.top += scrollTop * modifier; 1709 rect.bottom += scrollTop * modifier; 1710 rect.left += scrollLeft * modifier; 1711 rect.right += scrollLeft * modifier; 1712 return rect; 1713 } 1714 1715 /* 1716 * Helper to detect borders of a given element 1717 * @method 1718 * @memberof Popper.Utils 1719 * @param {CSSStyleDeclaration} styles 1720 * Result of `getStyleComputedProperty` on the given element 1721 * @param {String} axis - `x` or `y` 1722 * @return {number} borders - The borders size of the given axis 1723 */ 1724 1725 function getBordersSize(styles, axis) { 1726 var sideA = axis === 'x' ? 'Left' : 'Top'; 1727 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 1728 return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']); 1729 } 1730 function getSize(axis, body, html, computedStyle) { 1731 return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0); 1732 } 1733 function getWindowSizes(document) { 1734 var body = document.body; 1735 var html = document.documentElement; 1736 var computedStyle = isIE(10) && getComputedStyle(html); 1737 return { 1738 height: getSize('Height', body, html, computedStyle), 1739 width: getSize('Width', body, html, computedStyle) 1740 }; 1741 } 1742 var classCallCheck = function (instance, Constructor) { 1743 if (!(instance instanceof Constructor)) { 1744 throw new TypeError("Cannot call a class as a function"); 1745 } 1746 }; 1747 var createClass = function () { 1748 function defineProperties(target, props) { 1749 for (var i = 0; i < props.length; i++) { 1750 var descriptor = props[i]; 1751 descriptor.enumerable = descriptor.enumerable || false; 1752 descriptor.configurable = true; 1753 if ("value" in descriptor) descriptor.writable = true; 1754 Object.defineProperty(target, descriptor.key, descriptor); 1755 } 1756 } 1757 return function (Constructor, protoProps, staticProps) { 1758 if (protoProps) defineProperties(Constructor.prototype, protoProps); 1759 if (staticProps) defineProperties(Constructor, staticProps); 1760 return Constructor; 1761 }; 1762 }(); 1763 var defineProperty = function (obj, key, value) { 1764 if (key in obj) { 1765 Object.defineProperty(obj, key, { 1766 value: value, 1767 enumerable: true, 1768 configurable: true, 1769 writable: true 1770 }); 1771 } else { 1772 obj[key] = value; 1773 } 1774 return obj; 1775 }; 1776 var _extends = Object.assign || function (target) { 1777 for (var i = 1; i < arguments.length; i++) { 1778 var source = arguments[i]; 1779 for (var key in source) { 1780 if (Object.prototype.hasOwnProperty.call(source, key)) { 1781 target[key] = source[key]; 1782 } 1783 } 1784 } 1785 return target; 1786 }; 1787 1788 /** 1789 * Given element offsets, generate an output similar to getBoundingClientRect 1790 * @method 1791 * @memberof Popper.Utils 1792 * @argument {Object} offsets 1793 * @returns {Object} ClientRect like output 1794 */ 1795 function getClientRect(offsets) { 1796 return _extends({}, offsets, { 1797 right: offsets.left + offsets.width, 1798 bottom: offsets.top + offsets.height 1799 }); 1800 } 1801 1802 /** 1803 * Get bounding client rect of given element 1804 * @method 1805 * @memberof Popper.Utils 1806 * @param {HTMLElement} element 1807 * @return {Object} client rect 1808 */ 1809 function getBoundingClientRect(element) { 1810 var rect = {}; 1811 1812 // IE10 10 FIX: Please, don't ask, the element isn't 1813 // considered in DOM in some circumstances... 1814 // This isn't reproducible in IE10 compatibility mode of IE11 1815 try { 1816 if (isIE(10)) { 1817 rect = element.getBoundingClientRect(); 1818 var scrollTop = getScroll(element, 'top'); 1819 var scrollLeft = getScroll(element, 'left'); 1820 rect.top += scrollTop; 1821 rect.left += scrollLeft; 1822 rect.bottom += scrollTop; 1823 rect.right += scrollLeft; 1824 } else { 1825 rect = element.getBoundingClientRect(); 1826 } 1827 } catch (e) {} 1828 var result = { 1829 left: rect.left, 1830 top: rect.top, 1831 width: rect.right - rect.left, 1832 height: rect.bottom - rect.top 1833 }; 1834 1835 // subtract scrollbar size from sizes 1836 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 1837 var width = sizes.width || element.clientWidth || result.width; 1838 var height = sizes.height || element.clientHeight || result.height; 1839 var horizScrollbar = element.offsetWidth - width; 1840 var vertScrollbar = element.offsetHeight - height; 1841 1842 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 1843 // we make this check conditional for performance reasons 1844 if (horizScrollbar || vertScrollbar) { 1845 var styles = getStyleComputedProperty(element); 1846 horizScrollbar -= getBordersSize(styles, 'x'); 1847 vertScrollbar -= getBordersSize(styles, 'y'); 1848 result.width -= horizScrollbar; 1849 result.height -= vertScrollbar; 1850 } 1851 return getClientRect(result); 1852 } 1853 function getOffsetRectRelativeToArbitraryNode(children, parent) { 1854 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
vendor: 13,650 bytes, lines 1855-2226
1855 var isIE10 = isIE(10); 1856 var isHTML = parent.nodeName === 'HTML'; 1857 var childrenRect = getBoundingClientRect(children); 1858 var parentRect = getBoundingClientRect(parent); 1859 var scrollParent = getScrollParent(children); 1860 var styles = getStyleComputedProperty(parent); 1861 var borderTopWidth = parseFloat(styles.borderTopWidth); 1862 var borderLeftWidth = parseFloat(styles.borderLeftWidth); 1863 1864 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 1865 if (fixedPosition && isHTML) { 1866 parentRect.top = Math.max(parentRect.top, 0); 1867 parentRect.left = Math.max(parentRect.left, 0); 1868 } 1869 var offsets = getClientRect({ 1870 top: childrenRect.top - parentRect.top - borderTopWidth, 1871 left: childrenRect.left - parentRect.left - borderLeftWidth, 1872 width: childrenRect.width, 1873 height: childrenRect.height 1874 }); 1875 offsets.marginTop = 0; 1876 offsets.marginLeft = 0; 1877 1878 // Subtract margins of documentElement in case it's being used as parent 1879 // we do this only on HTML because it's the only element that behaves 1880 // differently when margins are applied to it. The margins are included in 1881 // the box of the documentElement, in the other cases not. 1882 if (!isIE10 && isHTML) { 1883 var marginTop = parseFloat(styles.marginTop); 1884 var marginLeft = parseFloat(styles.marginLeft); 1885 offsets.top -= borderTopWidth - marginTop; 1886 offsets.bottom -= borderTopWidth - marginTop; 1887 offsets.left -= borderLeftWidth - marginLeft; 1888 offsets.right -= borderLeftWidth - marginLeft; 1889 1890 // Attach marginTop and marginLeft because in some circumstances we may need them 1891 offsets.marginTop = marginTop; 1892 offsets.marginLeft = marginLeft; 1893 } 1894 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 1895 offsets = includeScroll(offsets, parent); 1896 } 1897 return offsets; 1898 } 1899 function getViewportOffsetRectRelativeToArtbitraryNode(element) { 1900 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 1901 var html = element.ownerDocument.documentElement; 1902 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 1903 var width = Math.max(html.clientWidth, window.innerWidth || 0); 1904 var height = Math.max(html.clientHeight, window.innerHeight || 0); 1905 var scrollTop = !excludeScroll ? getScroll(html) : 0; 1906 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 1907 var offset = { 1908 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 1909 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 1910 width: width, 1911 height: height 1912 }; 1913 return getClientRect(offset); 1914 } 1915 1916 /** 1917 * Check if the given element is fixed or is inside a fixed parent 1918 * @method 1919 * @memberof Popper.Utils 1920 * @argument {Element} element 1921 * @argument {Element} customContainer 1922 * @returns {Boolean} answer to "isFixed?" 1923 */ 1924 function isFixed(element) { 1925 var nodeName = element.nodeName; 1926 if (nodeName === 'BODY' || nodeName === 'HTML') { 1927 return false; 1928 } 1929 if (getStyleComputedProperty(element, 'position') === 'fixed') { 1930 return true; 1931 } 1932 var parentNode = getParentNode(element); 1933 if (!parentNode) { 1934 return false; 1935 } 1936 return isFixed(parentNode); 1937 } 1938 1939 /** 1940 * Finds the first parent of an element that has a transformed property defined 1941 * @method 1942 * @memberof Popper.Utils 1943 * @argument {Element} element 1944 * @returns {Element} first transformed parent or documentElement 1945 */ 1946 1947 function getFixedPositionOffsetParent(element) { 1948 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 1949 if (!element || !element.parentElement || isIE()) { 1950 return document.documentElement; 1951 } 1952 var el = element.parentElement; 1953 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 1954 el = el.parentElement; 1955 } 1956 return el || document.documentElement; 1957 } 1958 1959 /** 1960 * Computed the boundaries limits and return them 1961 * @method 1962 * @memberof Popper.Utils 1963 * @param {HTMLElement} popper 1964 * @param {HTMLElement} reference 1965 * @param {number} padding 1966 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 1967 * @param {Boolean} fixedPosition - Is in fixed position mode 1968 * @returns {Object} Coordinates of the boundaries 1969 */ 1970 function getBoundaries(popper, reference, padding, boundariesElement) { 1971 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 1972 1973 // NOTE: 1 DOM access here 1974 1975 var boundaries = { 1976 top: 0, 1977 left: 0 1978 }; 1979 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 1980 1981 // Handle viewport case 1982 if (boundariesElement === 'viewport') { 1983 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 1984 } else { 1985 // Handle other cases based on DOM element used as boundaries 1986 var boundariesNode = void 0; 1987 if (boundariesElement === 'scrollParent') { 1988 boundariesNode = getScrollParent(getParentNode(reference)); 1989 if (boundariesNode.nodeName === 'BODY') { 1990 boundariesNode = popper.ownerDocument.documentElement; 1991 } 1992 } else if (boundariesElement === 'window') { 1993 boundariesNode = popper.ownerDocument.documentElement; 1994 } else { 1995 boundariesNode = boundariesElement; 1996 } 1997 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 1998 1999 // In case of HTML, we need a different computation 2000 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 2001 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 2002 height = _getWindowSizes.height, 2003 width = _getWindowSizes.width; 2004 boundaries.top += offsets.top - offsets.marginTop; 2005 boundaries.bottom = height + offsets.top; 2006 boundaries.left += offsets.left - offsets.marginLeft; 2007 boundaries.right = width + offsets.left; 2008 } else { 2009 // for all the other DOM elements, this one is good 2010 boundaries = offsets; 2011 } 2012 } 2013 2014 // Add paddings 2015 padding = padding || 0; 2016 var isPaddingNumber = typeof padding === 'number'; 2017 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 2018 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 2019 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 2020 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 2021 return boundaries; 2022 } 2023 function getArea(_ref) { 2024 var width = _ref.width, 2025 height = _ref.height; 2026 return width * height; 2027 } 2028 2029 /** 2030 * Utility used to transform the `auto` placement to the placement with more 2031 * available space. 2032 * @method 2033 * @memberof Popper.Utils 2034 * @argument {Object} data - The data object generated by update method 2035 * @argument {Object} options - Modifiers configuration and options 2036 * @returns {Object} The data object, properly modified 2037 */ 2038 function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 2039 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 2040 if (placement.indexOf('auto') === -1) { 2041 return placement; 2042 } 2043 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 2044 var rects = { 2045 top: { 2046 width: boundaries.width, 2047 height: refRect.top - boundaries.top 2048 }, 2049 right: { 2050 width: boundaries.right - refRect.right, 2051 height: boundaries.height 2052 }, 2053 bottom: { 2054 width: boundaries.width, 2055 height: boundaries.bottom - refRect.bottom 2056 }, 2057 left: { 2058 width: refRect.left - boundaries.left, 2059 height: boundaries.height 2060 } 2061 }; 2062 var sortedAreas = Object.keys(rects).map(function (key) { 2063 return _extends({ 2064 key: key 2065 }, rects[key], { 2066 area: getArea(rects[key]) 2067 }); 2068 }).sort(function (a, b) { 2069 return b.area - a.area; 2070 }); 2071 var filteredAreas = sortedAreas.filter(function (_ref2) { 2072 var width = _ref2.width, 2073 height = _ref2.height; 2074 return width >= popper.clientWidth && height >= popper.clientHeight; 2075 }); 2076 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 2077 var variation = placement.split('-')[1]; 2078 return computedPlacement + (variation ? '-' + variation : ''); 2079 } 2080 2081 /** 2082 * Get offsets to the reference element 2083 * @method 2084 * @memberof Popper.Utils 2085 * @param {Object} state 2086 * @param {Element} popper - the popper element 2087 * @param {Element} reference - the reference element (the popper will be relative to this) 2088 * @param {Element} fixedPosition - is in fixed position mode 2089 * @returns {Object} An object containing the offsets which will be applied to the popper 2090 */ 2091 function getReferenceOffsets(state, popper, reference) { 2092 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 2093 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 2094 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 2095 } 2096 2097 /** 2098 * Get the outer sizes of the given element (offset size + margins) 2099 * @method 2100 * @memberof Popper.Utils 2101 * @argument {Element} element 2102 * @returns {Object} object containing width and height properties 2103 */ 2104 function getOuterSizes(element) { 2105 var window = element.ownerDocument.defaultView; 2106 var styles = window.getComputedStyle(element); 2107 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 2108 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 2109 var result = { 2110 width: element.offsetWidth + y, 2111 height: element.offsetHeight + x 2112 }; 2113 return result; 2114 } 2115 2116 /** 2117 * Get the opposite placement of the given one 2118 * @method 2119 * @memberof Popper.Utils 2120 * @argument {String} placement 2121 * @returns {String} flipped placement 2122 */ 2123 function getOppositePlacement(placement) { 2124 var hash = { 2125 left: 'right', 2126 right: 'left', 2127 bottom: 'top', 2128 top: 'bottom' 2129 }; 2130 return placement.replace(/left|right|bottom|top/g, function (matched) { 2131 return hash[matched]; 2132 }); 2133 } 2134 2135 /** 2136 * Get offsets to the popper 2137 * @method 2138 * @memberof Popper.Utils 2139 * @param {Object} position - CSS position the Popper will get applied 2140 * @param {HTMLElement} popper - the popper element 2141 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 2142 * @param {String} placement - one of the valid placement options 2143 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 2144 */ 2145 function getPopperOffsets(popper, referenceOffsets, placement) { 2146 placement = placement.split('-')[0]; 2147 2148 // Get popper node sizes 2149 var popperRect = getOuterSizes(popper); 2150 2151 // Add position, width and height to our offsets object 2152 var popperOffsets = { 2153 width: popperRect.width, 2154 height: popperRect.height 2155 }; 2156 2157 // depending by the popper placement we have to compute its offsets slightly differently 2158 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 2159 var mainSide = isHoriz ? 'top' : 'left'; 2160 var secondarySide = isHoriz ? 'left' : 'top'; 2161 var measurement = isHoriz ? 'height' : 'width'; 2162 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 2163 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 2164 if (placement === secondarySide) { 2165 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 2166 } else { 2167 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 2168 } 2169 return popperOffsets; 2170 } 2171 2172 /** 2173 * Mimics the `find` method of Array 2174 * @method 2175 * @memberof Popper.Utils 2176 * @argument {Array} arr 2177 * @argument prop 2178 * @argument value 2179 * @returns index or -1 2180 */ 2181 function find(arr, check) { 2182 // use native find if supported 2183 if (Array.prototype.find) { 2184 return arr.find(check); 2185 } 2186 2187 // use `filter` to obtain the same behavior of `find` 2188 return arr.filter(check)[0]; 2189 } 2190 2191 /** 2192 * Return the index of the matching object 2193 * @method 2194 * @memberof Popper.Utils 2195 * @argument {Array} arr 2196 * @argument prop 2197 * @argument value 2198 * @returns index or -1 2199 */ 2200 function findIndex(arr, prop, value) { 2201 // use native findIndex if supported 2202 if (Array.prototype.findIndex) { 2203 return arr.findIndex(function (cur) { 2204 return cur[prop] === value; 2205 }); 2206 } 2207 2208 // use `find` + `indexOf` if `findIndex` isn't supported 2209 var match = find(arr, function (obj) { 2210 return obj[prop] === value; 2211 }); 2212 return arr.indexOf(match); 2213 } 2214 2215 /** 2216 * Loop trough the list of modifiers and run them in order, 2217 * each of them will then edit the data object. 2218 * @method 2219 * @memberof Popper.Utils 2220 * @param {dataObject} data 2221 * @param {Array} modifiers 2222 * @param {String} ends - Optional modifier name used as stopper 2223 * @returns {dataObject} 2224 */ 2225 function runModifiers(modifiers, data, ends) { 2226 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
vendor: 5,855 bytes, lines 2227-2396
2227 modifiersToRun.forEach(function (modifier) { 2228 if (modifier['function']) { 2229 // eslint-disable-line dot-notation 2230 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 2231 } 2232 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 2233 if (modifier.enabled && isFunction(fn)) { 2234 // Add properties to offsets to make them a complete clientRect object 2235 // we do this before each modifier to make sure the previous one doesn't 2236 // mess with these values 2237 data.offsets.popper = getClientRect(data.offsets.popper); 2238 data.offsets.reference = getClientRect(data.offsets.reference); 2239 data = fn(data, modifier); 2240 } 2241 }); 2242 return data; 2243 } 2244 2245 /** 2246 * Updates the position of the popper, computing the new offsets and applying 2247 * the new style.<br /> 2248 * Prefer `scheduleUpdate` over `update` because of performance reasons. 2249 * @method 2250 * @memberof Popper 2251 */ 2252 function update() { 2253 // if popper is destroyed, don't perform any further update 2254 if (this.state.isDestroyed) { 2255 return; 2256 } 2257 var data = { 2258 instance: this, 2259 styles: {}, 2260 arrowStyles: {}, 2261 attributes: {}, 2262 flipped: false, 2263 offsets: {} 2264 }; 2265 2266 // compute reference element offsets 2267 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 2268 2269 // compute auto placement, store placement inside the data object, 2270 // modifiers will be able to edit `placement` if needed 2271 // and refer to originalPlacement to know the original value 2272 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 2273 2274 // store the computed placement inside `originalPlacement` 2275 data.originalPlacement = data.placement; 2276 data.positionFixed = this.options.positionFixed; 2277 2278 // compute the popper offsets 2279 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 2280 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 2281 2282 // run the modifiers 2283 data = runModifiers(this.modifiers, data); 2284 2285 // the first `update` will call `onCreate` callback 2286 // the other ones will call `onUpdate` callback 2287 if (!this.state.isCreated) { 2288 this.state.isCreated = true; 2289 this.options.onCreate(data); 2290 } else { 2291 this.options.onUpdate(data); 2292 } 2293 } 2294 2295 /** 2296 * Helper used to know if the given modifier is enabled. 2297 * @method 2298 * @memberof Popper.Utils 2299 * @returns {Boolean} 2300 */ 2301 function isModifierEnabled(modifiers, modifierName) { 2302 return modifiers.some(function (_ref) { 2303 var name = _ref.name, 2304 enabled = _ref.enabled; 2305 return enabled && name === modifierName; 2306 }); 2307 } 2308 2309 /** 2310 * Get the prefixed supported property name 2311 * @method 2312 * @memberof Popper.Utils 2313 * @argument {String} property (camelCase) 2314 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 2315 */ 2316 function getSupportedPropertyName(property) { 2317 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 2318 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 2319 for (var i = 0; i < prefixes.length; i++) { 2320 var prefix = prefixes[i]; 2321 var toCheck = prefix ? '' + prefix + upperProp : property; 2322 if (typeof document.body.style[toCheck] !== 'undefined') { 2323 return toCheck; 2324 } 2325 } 2326 return null; 2327 } 2328 2329 /** 2330 * Destroys the popper. 2331 * @method 2332 * @memberof Popper 2333 */ 2334 function destroy() { 2335 this.state.isDestroyed = true; 2336 2337 // touch DOM only if `applyStyle` modifier is enabled 2338 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 2339 this.popper.removeAttribute('x-placement'); 2340 this.popper.style.position = ''; 2341 this.popper.style.top = ''; 2342 this.popper.style.left = ''; 2343 this.popper.style.right = ''; 2344 this.popper.style.bottom = ''; 2345 this.popper.style.willChange = ''; 2346 this.popper.style[getSupportedPropertyName('transform')] = ''; 2347 } 2348 this.disableEventListeners(); 2349 2350 // remove the popper if user explicitly asked for the deletion on destroy 2351 // do not use `remove` because IE11 doesn't support it 2352 if (this.options.removeOnDestroy) { 2353 this.popper.parentNode.removeChild(this.popper); 2354 } 2355 return this; 2356 } 2357 2358 /** 2359 * Get the window associated with the element 2360 * @argument {Element} element 2361 * @returns {Window} 2362 */ 2363 function getWindow(element) { 2364 var ownerDocument = element.ownerDocument; 2365 return ownerDocument ? ownerDocument.defaultView : window; 2366 } 2367 function attachToScrollParents(scrollParent, event, callback, scrollParents) { 2368 var isBody = scrollParent.nodeName === 'BODY'; 2369 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 2370 target.addEventListener(event, callback, { 2371 passive: true 2372 }); 2373 if (!isBody) { 2374 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 2375 } 2376 scrollParents.push(target); 2377 } 2378 2379 /** 2380 * Setup needed event listeners used to update the popper position 2381 * @method 2382 * @memberof Popper.Utils 2383 * @private 2384 */ 2385 function setupEventListeners(reference, options, state, updateBound) { 2386 // Resize event listener on window 2387 state.updateBound = updateBound; 2388 getWindow(reference).addEventListener('resize', state.updateBound, { 2389 passive: true 2390 }); 2391 2392 // Scroll event listener on scroll parents 2393 var scrollElement = getScrollParent(reference); 2394 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 2395 state.scrollElement = scrollElement; 2396 state.eventsEnabled = true;
vendor: 4,158 bytes, lines 2396-2521
2396 2397 return state; 2398 } 2399 2400 /** 2401 * It will add resize/scroll events and start recalculating 2402 * position of the popper element when they are triggered. 2403 * @method 2404 * @memberof Popper 2405 */ 2406 function enableEventListeners() { 2407 if (!this.state.eventsEnabled) { 2408 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 2409 } 2410 } 2411 2412 /** 2413 * Remove event listeners used to update the popper position 2414 * @method 2415 * @memberof Popper.Utils 2416 * @private 2417 */ 2418 function removeEventListeners(reference, state) { 2419 // Remove resize event listener on window 2420 getWindow(reference).removeEventListener('resize', state.updateBound); 2421 2422 // Remove scroll event listener on scroll parents 2423 state.scrollParents.forEach(function (target) { 2424 target.removeEventListener('scroll', state.updateBound); 2425 }); 2426 2427 // Reset state 2428 state.updateBound = null; 2429 state.scrollParents = []; 2430 state.scrollElement = null; 2431 state.eventsEnabled = false; 2432 return state; 2433 } 2434 2435 /** 2436 * It will remove resize/scroll events and won't recalculate popper position 2437 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 2438 * unless you call `update` method manually. 2439 * @method 2440 * @memberof Popper 2441 */ 2442 function disableEventListeners() { 2443 if (this.state.eventsEnabled) { 2444 cancelAnimationFrame(this.scheduleUpdate); 2445 this.state = removeEventListeners(this.reference, this.state); 2446 } 2447 } 2448 2449 /** 2450 * Tells if a given input is a number 2451 * @method 2452 * @memberof Popper.Utils 2453 * @param {*} input to check 2454 * @return {Boolean} 2455 */ 2456 function isNumeric(n) { 2457 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 2458 } 2459 2460 /** 2461 * Set the style to the given popper 2462 * @method 2463 * @memberof Popper.Utils 2464 * @argument {Element} element - Element to apply the style to 2465 * @argument {Object} styles 2466 * Object with a list of properties and values which will be applied to the element 2467 */ 2468 function setStyles(element, styles) { 2469 Object.keys(styles).forEach(function (prop) { 2470 var unit = ''; 2471 // add unit if the value is numeric and is one of the following 2472 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 2473 unit = 'px'; 2474 } 2475 element.style[prop] = styles[prop] + unit; 2476 }); 2477 } 2478 2479 /** 2480 * Set the attributes to the given popper 2481 * @method 2482 * @memberof Popper.Utils 2483 * @argument {Element} element - Element to apply the attributes to 2484 * @argument {Object} styles 2485 * Object with a list of properties and values which will be applied to the element 2486 */ 2487 function setAttributes(element, attributes) { 2488 Object.keys(attributes).forEach(function (prop) { 2489 var value = attributes[prop]; 2490 if (value !== false) { 2491 element.setAttribute(prop, attributes[prop]); 2492 } else { 2493 element.removeAttribute(prop); 2494 } 2495 }); 2496 } 2497 2498 /** 2499 * @function 2500 * @memberof Modifiers 2501 * @argument {Object} data - The data object generated by `update` method 2502 * @argument {Object} data.styles - List of style properties - values to apply to popper element 2503 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 2504 * @argument {Object} options - Modifiers configuration and options 2505 * @returns {Object} The same data object 2506 */ 2507 function applyStyle(data) { 2508 // any property present in `data.styles` will be applied to the popper, 2509 // in this way we can make the 3rd party modifiers add custom styles to it 2510 // Be aware, modifiers could override the properties defined in the previous 2511 // lines of this modifier! 2512 setStyles(data.instance.popper, data.styles); 2513 2514 // any property present in `data.attributes` will be applied to the popper, 2515 // they will be set as HTML attributes of the element 2516 setAttributes(data.instance.popper, data.attributes); 2517 2518 // if arrowElement is defined and arrowStyles has some properties 2519 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 2520 setStyles(data.arrowElement, data.arrowStyles); 2521 }
vendor: 33,459 bytes, lines 2522-3341
2522 return data; 2523 } 2524 2525 /** 2526 * Set the x-placement attribute before everything else because it could be used 2527 * to add margins to the popper margins needs to be calculated to get the 2528 * correct popper offsets. 2529 * @method 2530 * @memberof Popper.modifiers 2531 * @param {HTMLElement} reference - The reference element used to position the popper 2532 * @param {HTMLElement} popper - The HTML element used as popper 2533 * @param {Object} options - Popper.js options 2534 */ 2535 function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 2536 // compute reference element offsets 2537 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 2538 2539 // compute auto placement, store placement inside the data object, 2540 // modifiers will be able to edit `placement` if needed 2541 // and refer to originalPlacement to know the original value 2542 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 2543 popper.setAttribute('x-placement', placement); 2544 2545 // Apply `position` to popper before anything else because 2546 // without the position applied we can't guarantee correct computations 2547 setStyles(popper, { 2548 position: options.positionFixed ? 'fixed' : 'absolute' 2549 }); 2550 return options; 2551 } 2552 2553 /** 2554 * @function 2555 * @memberof Popper.Utils 2556 * @argument {Object} data - The data object generated by `update` method 2557 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 2558 * @returns {Object} The popper's position offsets rounded 2559 * 2560 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 2561 * good as it can be within reason. 2562 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 2563 * 2564 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 2565 * as well on High DPI screens). 2566 * 2567 * Firefox prefers no rounding for positioning and does not have blurriness on 2568 * high DPI screens. 2569 * 2570 * Only horizontal placement and left/right values need to be considered. 2571 */ 2572 function getRoundedOffsets(data, shouldRound) { 2573 var _data$offsets = data.offsets, 2574 popper = _data$offsets.popper, 2575 reference = _data$offsets.reference; 2576 var round = Math.round, 2577 floor = Math.floor; 2578 var noRound = function noRound(v) { 2579 return v; 2580 }; 2581 var referenceWidth = round(reference.width); 2582 var popperWidth = round(popper.width); 2583 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 2584 var isVariation = data.placement.indexOf('-') !== -1; 2585 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 2586 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 2587 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 2588 var verticalToInteger = !shouldRound ? noRound : round; 2589 return { 2590 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 2591 top: verticalToInteger(popper.top), 2592 bottom: verticalToInteger(popper.bottom), 2593 right: horizontalToInteger(popper.right) 2594 }; 2595 } 2596 var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 2597 2598 /** 2599 * @function 2600 * @memberof Modifiers 2601 * @argument {Object} data - The data object generated by `update` method 2602 * @argument {Object} options - Modifiers configuration and options 2603 * @returns {Object} The data object, properly modified 2604 */ 2605 function computeStyle(data, options) { 2606 var x = options.x, 2607 y = options.y; 2608 var popper = data.offsets.popper; 2609 2610 // Remove this legacy support in Popper.js v2 2611 2612 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 2613 return modifier.name === 'applyStyle'; 2614 }).gpuAcceleration; 2615 if (legacyGpuAccelerationOption !== undefined) { 2616 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 2617 } 2618 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 2619 var offsetParent = getOffsetParent(data.instance.popper); 2620 var offsetParentRect = getBoundingClientRect(offsetParent); 2621 2622 // Styles 2623 var styles = { 2624 position: popper.position 2625 }; 2626 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 2627 var sideA = x === 'bottom' ? 'top' : 'bottom'; 2628 var sideB = y === 'right' ? 'left' : 'right'; 2629 2630 // if gpuAcceleration is set to `true` and transform is supported, 2631 // we use `translate3d` to apply the position to the popper we 2632 // automatically use the supported prefixed version if needed 2633 var prefixedProperty = getSupportedPropertyName('transform'); 2634 2635 // now, let's make a step back and look at this code closely (wtf?) 2636 // If the content of the popper grows once it's been positioned, it 2637 // may happen that the popper gets misplaced because of the new content 2638 // overflowing its reference element 2639 // To avoid this problem, we provide two options (x and y), which allow 2640 // the consumer to define the offset origin. 2641 // If we position a popper on top of a reference element, we can set 2642 // `x` to `top` to make the popper grow towards its top instead of 2643 // its bottom. 2644 var left = void 0, 2645 top = void 0; 2646 if (sideA === 'bottom') { 2647 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 2648 // and not the bottom of the html element 2649 if (offsetParent.nodeName === 'HTML') { 2650 top = -offsetParent.clientHeight + offsets.bottom; 2651 } else { 2652 top = -offsetParentRect.height + offsets.bottom; 2653 } 2654 } else { 2655 top = offsets.top; 2656 } 2657 if (sideB === 'right') { 2658 if (offsetParent.nodeName === 'HTML') { 2659 left = -offsetParent.clientWidth + offsets.right; 2660 } else { 2661 left = -offsetParentRect.width + offsets.right; 2662 } 2663 } else { 2664 left = offsets.left; 2665 } 2666 if (gpuAcceleration && prefixedProperty) { 2667 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 2668 styles[sideA] = 0; 2669 styles[sideB] = 0; 2670 styles.willChange = 'transform'; 2671 } else { 2672 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 2673 var invertTop = sideA === 'bottom' ? -1 : 1; 2674 var invertLeft = sideB === 'right' ? -1 : 1; 2675 styles[sideA] = top * invertTop; 2676 styles[sideB] = left * invertLeft; 2677 styles.willChange = sideA + ', ' + sideB; 2678 } 2679 2680 // Attributes 2681 var attributes = { 2682 'x-placement': data.placement 2683 }; 2684 2685 // Update `data` attributes, styles and arrowStyles 2686 data.attributes = _extends({}, attributes, data.attributes); 2687 data.styles = _extends({}, styles, data.styles); 2688 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 2689 return data; 2690 } 2691 2692 /** 2693 * Helper used to know if the given modifier depends from another one.<br /> 2694 * It checks if the needed modifier is listed and enabled. 2695 * @method 2696 * @memberof Popper.Utils 2697 * @param {Array} modifiers - list of modifiers 2698 * @param {String} requestingName - name of requesting modifier 2699 * @param {String} requestedName - name of requested modifier 2700 * @returns {Boolean} 2701 */ 2702 function isModifierRequired(modifiers, requestingName, requestedName) { 2703 var requesting = find(modifiers, function (_ref) { 2704 var name = _ref.name; 2705 return name === requestingName; 2706 }); 2707 var isRequired = !!requesting && modifiers.some(function (modifier) { 2708 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 2709 }); 2710 if (!isRequired) { 2711 var _requesting = '`' + requestingName + '`'; 2712 var requested = '`' + requestedName + '`'; 2713 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 2714 } 2715 return isRequired; 2716 } 2717 2718 /** 2719 * @function 2720 * @memberof Modifiers 2721 * @argument {Object} data - The data object generated by update method 2722 * @argument {Object} options - Modifiers configuration and options 2723 * @returns {Object} The data object, properly modified 2724 */ 2725 function arrow(data, options) { 2726 var _data$offsets$arrow; 2727 2728 // arrow depends on keepTogether in order to work 2729 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 2730 return data; 2731 } 2732 var arrowElement = options.element; 2733 2734 // if arrowElement is a string, suppose it's a CSS selector 2735 if (typeof arrowElement === 'string') { 2736 arrowElement = data.instance.popper.querySelector(arrowElement); 2737 2738 // if arrowElement is not found, don't run the modifier 2739 if (!arrowElement) { 2740 return data; 2741 } 2742 } else { 2743 // if the arrowElement isn't a query selector we must check that the 2744 // provided DOM node is child of its popper node 2745 if (!data.instance.popper.contains(arrowElement)) { 2746 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 2747 return data; 2748 } 2749 } 2750 var placement = data.placement.split('-')[0]; 2751 var _data$offsets = data.offsets, 2752 popper = _data$offsets.popper, 2753 reference = _data$offsets.reference; 2754 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 2755 var len = isVertical ? 'height' : 'width'; 2756 var sideCapitalized = isVertical ? 'Top' : 'Left'; 2757 var side = sideCapitalized.toLowerCase(); 2758 var altSide = isVertical ? 'left' : 'top'; 2759 var opSide = isVertical ? 'bottom' : 'right'; 2760 var arrowElementSize = getOuterSizes(arrowElement)[len]; 2761 2762 // 2763 // extends keepTogether behavior making sure the popper and its 2764 // reference have enough pixels in conjunction 2765 // 2766 2767 // top/left side 2768 if (reference[opSide] - arrowElementSize < popper[side]) { 2769 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 2770 } 2771 // bottom/right side 2772 if (reference[side] + arrowElementSize > popper[opSide]) { 2773 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 2774 } 2775 data.offsets.popper = getClientRect(data.offsets.popper); 2776 2777 // compute center of the popper 2778 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 2779 2780 // Compute the sideValue using the updated popper offsets 2781 // take popper margin in account because we don't have this info available 2782 var css = getStyleComputedProperty(data.instance.popper); 2783 var popperMarginSide = parseFloat(css['margin' + sideCapitalized]); 2784 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']); 2785 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 2786 2787 // prevent arrowElement from being placed not contiguously to its popper 2788 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 2789 data.arrowElement = arrowElement; 2790 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 2791 return data; 2792 } 2793 2794 /** 2795 * Get the opposite placement variation of the given one 2796 * @method 2797 * @memberof Popper.Utils 2798 * @argument {String} placement variation 2799 * @returns {String} flipped placement variation 2800 */ 2801 function getOppositeVariation(variation) { 2802 if (variation === 'end') { 2803 return 'start'; 2804 } else if (variation === 'start') { 2805 return 'end'; 2806 } 2807 return variation; 2808 } 2809 2810 /** 2811 * List of accepted placements to use as values of the `placement` option.<br /> 2812 * Valid placements are: 2813 * - `auto` 2814 * - `top` 2815 * - `right` 2816 * - `bottom` 2817 * - `left` 2818 * 2819 * Each placement can have a variation from this list: 2820 * - `-start` 2821 * - `-end` 2822 * 2823 * Variations are interpreted easily if you think of them as the left to right 2824 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 2825 * is right.<br /> 2826 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 2827 * 2828 * Some valid examples are: 2829 * - `top-end` (on top of reference, right aligned) 2830 * - `right-start` (on right of reference, top aligned) 2831 * - `bottom` (on bottom, centered) 2832 * - `auto-end` (on the side with more space available, alignment depends by placement) 2833 * 2834 * @static 2835 * @type {Array} 2836 * @enum {String} 2837 * @readonly 2838 * @method placements 2839 * @memberof Popper 2840 */ 2841 var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; 2842 2843 // Get rid of `auto` `auto-start` and `auto-end` 2844 var validPlacements = placements.slice(3); 2845 2846 /** 2847 * Given an initial placement, returns all the subsequent placements 2848 * clockwise (or counter-clockwise). 2849 * 2850 * @method 2851 * @memberof Popper.Utils 2852 * @argument {String} placement - A valid placement (it accepts variations) 2853 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 2854 * @returns {Array} placements including their variations 2855 */ 2856 function clockwise(placement) { 2857 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 2858 var index = validPlacements.indexOf(placement); 2859 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 2860 return counter ? arr.reverse() : arr; 2861 } 2862 var BEHAVIORS = { 2863 FLIP: 'flip', 2864 CLOCKWISE: 'clockwise', 2865 COUNTERCLOCKWISE: 'counterclockwise' 2866 }; 2867 2868 /** 2869 * @function 2870 * @memberof Modifiers 2871 * @argument {Object} data - The data object generated by update method 2872 * @argument {Object} options - Modifiers configuration and options 2873 * @returns {Object} The data object, properly modified 2874 */ 2875 function flip(data, options) { 2876 // if `inner` modifier is enabled, we can't use the `flip` modifier 2877 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 2878 return data; 2879 } 2880 if (data.flipped && data.placement === data.originalPlacement) { 2881 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 2882 return data; 2883 } 2884 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 2885 var placement = data.placement.split('-')[0]; 2886 var placementOpposite = getOppositePlacement(placement); 2887 var variation = data.placement.split('-')[1] || ''; 2888 var flipOrder = []; 2889 switch (options.behavior) { 2890 case BEHAVIORS.FLIP: 2891 flipOrder = [placement, placementOpposite]; 2892 break; 2893 case BEHAVIORS.CLOCKWISE: 2894 flipOrder = clockwise(placement); 2895 break; 2896 case BEHAVIORS.COUNTERCLOCKWISE: 2897 flipOrder = clockwise(placement, true); 2898 break; 2899 default: 2900 flipOrder = options.behavior; 2901 } 2902 flipOrder.forEach(function (step, index) { 2903 if (placement !== step || flipOrder.length === index + 1) { 2904 return data; 2905 } 2906 placement = data.placement.split('-')[0]; 2907 placementOpposite = getOppositePlacement(placement); 2908 var popperOffsets = data.offsets.popper; 2909 var refOffsets = data.offsets.reference; 2910 2911 // using floor because the reference offsets may contain decimals we are not going to consider here 2912 var floor = Math.floor; 2913 var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom); 2914 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 2915 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 2916 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 2917 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 2918 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 2919 2920 // flip the variation if required 2921 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 2922 2923 // flips variation if reference element overflows boundaries 2924 var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); 2925 2926 // flips variation if popper content overflows boundaries 2927 var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop); 2928 var flippedVariation = flippedVariationByRef || flippedVariationByContent; 2929 if (overlapsRef || overflowsBoundaries || flippedVariation) { 2930 // this boolean to detect any flip loop 2931 data.flipped = true; 2932 if (overlapsRef || overflowsBoundaries) { 2933 placement = flipOrder[index + 1]; 2934 } 2935 if (flippedVariation) { 2936 variation = getOppositeVariation(variation); 2937 } 2938 data.placement = placement + (variation ? '-' + variation : ''); 2939 2940 // this object contains `position`, we want to preserve it along with 2941 // any additional property we may add in the future 2942 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 2943 data = runModifiers(data.instance.modifiers, data, 'flip'); 2944 } 2945 }); 2946 return data; 2947 } 2948 2949 /** 2950 * @function 2951 * @memberof Modifiers 2952 * @argument {Object} data - The data object generated by update method 2953 * @argument {Object} options - Modifiers configuration and options 2954 * @returns {Object} The data object, properly modified 2955 */ 2956 function keepTogether(data) { 2957 var _data$offsets = data.offsets, 2958 popper = _data$offsets.popper, 2959 reference = _data$offsets.reference; 2960 var placement = data.placement.split('-')[0]; 2961 var floor = Math.floor; 2962 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 2963 var side = isVertical ? 'right' : 'bottom'; 2964 var opSide = isVertical ? 'left' : 'top'; 2965 var measurement = isVertical ? 'width' : 'height'; 2966 if (popper[side] < floor(reference[opSide])) { 2967 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 2968 } 2969 if (popper[opSide] > floor(reference[side])) { 2970 data.offsets.popper[opSide] = floor(reference[side]); 2971 } 2972 return data; 2973 } 2974 2975 /** 2976 * Converts a string containing value + unit into a px value number 2977 * @function 2978 * @memberof {modifiers~offset} 2979 * @private 2980 * @argument {String} str - Value + unit string 2981 * @argument {String} measurement - `height` or `width` 2982 * @argument {Object} popperOffsets 2983 * @argument {Object} referenceOffsets 2984 * @returns {Number|String} 2985 * Value in pixels, or original string if no values were extracted 2986 */ 2987 function toValue(str, measurement, popperOffsets, referenceOffsets) { 2988 // separate value from unit 2989 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 2990 var value = +split[1]; 2991 var unit = split[2]; 2992 2993 // If it's not a number it's an operator, I guess 2994 if (!value) { 2995 return str; 2996 } 2997 if (unit.indexOf('%') === 0) { 2998 var element = void 0; 2999 switch (unit) { 3000 case '%p': 3001 element = popperOffsets; 3002 break; 3003 case '%': 3004 case '%r': 3005 default: 3006 element = referenceOffsets; 3007 } 3008 var rect = getClientRect(element); 3009 return rect[measurement] / 100 * value; 3010 } else if (unit === 'vh' || unit === 'vw') { 3011 // if is a vh or vw, we calculate the size based on the viewport 3012 var size = void 0; 3013 if (unit === 'vh') { 3014 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 3015 } else { 3016 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 3017 } 3018 return size / 100 * value; 3019 } else { 3020 // if is an explicit pixel unit, we get rid of the unit and keep the value 3021 // if is an implicit unit, it's px, and we return just the value 3022 return value; 3023 } 3024 } 3025 3026 /** 3027 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 3028 * @function 3029 * @memberof {modifiers~offset} 3030 * @private 3031 * @argument {String} offset 3032 * @argument {Object} popperOffsets 3033 * @argument {Object} referenceOffsets 3034 * @argument {String} basePlacement 3035 * @returns {Array} a two cells array with x and y offsets in numbers 3036 */ 3037 function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 3038 var offsets = [0, 0]; 3039 3040 // Use height if placement is left or right and index is 0 otherwise use width 3041 // in this way the first offset will use an axis and the second one 3042 // will use the other one 3043 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 3044 3045 // Split the offset string to obtain a list of values and operands 3046 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 3047 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 3048 return frag.trim(); 3049 }); 3050 3051 // Detect if the offset string contains a pair of values or a single one 3052 // they could be separated by comma or space 3053 var divider = fragments.indexOf(find(fragments, function (frag) { 3054 return frag.search(/,|\s/) !== -1; 3055 })); 3056 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 3057 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 3058 } 3059 3060 // If divider is found, we divide the list of values and operands to divide 3061 // them by ofset X and Y. 3062 var splitRegex = /\s*,\s*|\s+/; 3063 var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; 3064 3065 // Convert the values with units to absolute pixels to allow our computations 3066 ops = ops.map(function (op, index) { 3067 // Most of the units rely on the orientation of the popper 3068 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 3069 var mergeWithPrevious = false; 3070 return op 3071 // This aggregates any `+` or `-` sign that aren't considered operators 3072 // e.g.: 10 + +5 => [10, +, +5] 3073 .reduce(function (a, b) { 3074 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 3075 a[a.length - 1] = b; 3076 mergeWithPrevious = true; 3077 return a; 3078 } else if (mergeWithPrevious) { 3079 a[a.length - 1] += b; 3080 mergeWithPrevious = false; 3081 return a; 3082 } else { 3083 return a.concat(b); 3084 } 3085 }, []) 3086 // Here we convert the string values into number values (in px) 3087 .map(function (str) { 3088 return toValue(str, measurement, popperOffsets, referenceOffsets); 3089 }); 3090 }); 3091 3092 // Loop trough the offsets arrays and execute the operations 3093 ops.forEach(function (op, index) { 3094 op.forEach(function (frag, index2) { 3095 if (isNumeric(frag)) { 3096 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 3097 } 3098 }); 3099 }); 3100 return offsets; 3101 } 3102 3103 /** 3104 * @function 3105 * @memberof Modifiers 3106 * @argument {Object} data - The data object generated by update method 3107 * @argument {Object} options - Modifiers configuration and options 3108 * @argument {Number|String} options.offset=0 3109 * The offset value as described in the modifier description 3110 * @returns {Object} The data object, properly modified 3111 */ 3112 function offset(data, _ref) { 3113 var offset = _ref.offset; 3114 var placement = data.placement, 3115 _data$offsets = data.offsets, 3116 popper = _data$offsets.popper, 3117 reference = _data$offsets.reference; 3118 var basePlacement = placement.split('-')[0]; 3119 var offsets = void 0; 3120 if (isNumeric(+offset)) { 3121 offsets = [+offset, 0]; 3122 } else { 3123 offsets = parseOffset(offset, popper, reference, basePlacement); 3124 } 3125 if (basePlacement === 'left') { 3126 popper.top += offsets[0]; 3127 popper.left -= offsets[1]; 3128 } else if (basePlacement === 'right') { 3129 popper.top += offsets[0]; 3130 popper.left += offsets[1]; 3131 } else if (basePlacement === 'top') { 3132 popper.left += offsets[0]; 3133 popper.top -= offsets[1]; 3134 } else if (basePlacement === 'bottom') { 3135 popper.left += offsets[0]; 3136 popper.top += offsets[1]; 3137 } 3138 data.popper = popper; 3139 return data; 3140 } 3141 3142 /** 3143 * @function 3144 * @memberof Modifiers 3145 * @argument {Object} data - The data object generated by `update` method 3146 * @argument {Object} options - Modifiers configuration and options 3147 * @returns {Object} The data object, properly modified 3148 */ 3149 function preventOverflow(data, options) { 3150 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 3151 3152 // If offsetParent is the reference element, we really want to 3153 // go one step up and use the next offsetParent as reference to 3154 // avoid to make this modifier completely useless and look like broken 3155 if (data.instance.reference === boundariesElement) { 3156 boundariesElement = getOffsetParent(boundariesElement); 3157 } 3158 3159 // NOTE: DOM access here 3160 // resets the popper's position so that the document size can be calculated excluding 3161 // the size of the popper element itself 3162 var transformProp = getSupportedPropertyName('transform'); 3163 var popperStyles = data.instance.popper.style; // assignment to help minification 3164 var top = popperStyles.top, 3165 left = popperStyles.left, 3166 transform = popperStyles[transformProp]; 3167 popperStyles.top = ''; 3168 popperStyles.left = ''; 3169 popperStyles[transformProp] = ''; 3170 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 3171 3172 // NOTE: DOM access here 3173 // restores the original style properties after the offsets have been computed 3174 popperStyles.top = top; 3175 popperStyles.left = left; 3176 popperStyles[transformProp] = transform; 3177 options.boundaries = boundaries; 3178 var order = options.priority; 3179 var popper = data.offsets.popper; 3180 var check = { 3181 primary: function primary(placement) { 3182 var value = popper[placement]; 3183 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 3184 value = Math.max(popper[placement], boundaries[placement]); 3185 } 3186 return defineProperty({}, placement, value); 3187 }, 3188 secondary: function secondary(placement) { 3189 var mainSide = placement === 'right' ? 'left' : 'top'; 3190 var value = popper[mainSide]; 3191 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 3192 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 3193 } 3194 return defineProperty({}, mainSide, value); 3195 } 3196 }; 3197 order.forEach(function (placement) { 3198 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 3199 popper = _extends({}, popper, check[side](placement)); 3200 }); 3201 data.offsets.popper = popper; 3202 return data; 3203 } 3204 3205 /** 3206 * @function 3207 * @memberof Modifiers 3208 * @argument {Object} data - The data object generated by `update` method 3209 * @argument {Object} options - Modifiers configuration and options 3210 * @returns {Object} The data object, properly modified 3211 */ 3212 function shift(data) { 3213 var placement = data.placement; 3214 var basePlacement = placement.split('-')[0]; 3215 var shiftvariation = placement.split('-')[1]; 3216 3217 // if shift shiftvariation is specified, run the modifier 3218 if (shiftvariation) { 3219 var _data$offsets = data.offsets, 3220 reference = _data$offsets.reference, 3221 popper = _data$offsets.popper; 3222 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 3223 var side = isVertical ? 'left' : 'top'; 3224 var measurement = isVertical ? 'width' : 'height'; 3225 var shiftOffsets = { 3226 start: defineProperty({}, side, reference[side]), 3227 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 3228 }; 3229 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 3230 } 3231 return data; 3232 } 3233 3234 /** 3235 * @function 3236 * @memberof Modifiers 3237 * @argument {Object} data - The data object generated by update method 3238 * @argument {Object} options - Modifiers configuration and options 3239 * @returns {Object} The data object, properly modified 3240 */ 3241 function hide(data) { 3242 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 3243 return data; 3244 } 3245 var refRect = data.offsets.reference; 3246 var bound = find(data.instance.modifiers, function (modifier) { 3247 return modifier.name === 'preventOverflow'; 3248 }).boundaries; 3249 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 3250 // Avoid unnecessary DOM access if visibility hasn't changed 3251 if (data.hide === true) { 3252 return data; 3253 } 3254 data.hide = true; 3255 data.attributes['x-out-of-boundaries'] = ''; 3256 } else { 3257 // Avoid unnecessary DOM access if visibility hasn't changed 3258 if (data.hide === false) { 3259 return data; 3260 } 3261 data.hide = false; 3262 data.attributes['x-out-of-boundaries'] = false; 3263 } 3264 return data; 3265 } 3266 3267 /** 3268 * @function 3269 * @memberof Modifiers 3270 * @argument {Object} data - The data object generated by `update` method 3271 * @argument {Object} options - Modifiers configuration and options 3272 * @returns {Object} The data object, properly modified 3273 */ 3274 function inner(data) { 3275 var placement = data.placement; 3276 var basePlacement = placement.split('-')[0]; 3277 var _data$offsets = data.offsets, 3278 popper = _data$offsets.popper, 3279 reference = _data$offsets.reference; 3280 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 3281 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 3282 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 3283 data.placement = getOppositePlacement(placement); 3284 data.offsets.popper = getClientRect(popper); 3285 return data; 3286 } 3287 3288 /** 3289 * Modifier function, each modifier can have a function of this type assigned 3290 * to its `fn` property.<br /> 3291 * These functions will be called on each update, this means that you must 3292 * make sure they are performant enough to avoid performance bottlenecks. 3293 * 3294 * @function ModifierFn 3295 * @argument {dataObject} data - The data object generated by `update` method 3296 * @argument {Object} options - Modifiers configuration and options 3297 * @returns {dataObject} The data object, properly modified 3298 */ 3299 3300 /** 3301 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 3302 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 3303 * needed by the library. 3304 * 3305 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 3306 * All the other properties are configurations that could be tweaked. 3307 * @namespace modifiers 3308 */ 3309 var modifiers = { 3310 /** 3311 * Modifier used to shift the popper on the start or end of its reference 3312 * element.<br /> 3313 * It will read the variation of the `placement` property.<br /> 3314 * It can be one either `-end` or `-start`. 3315 * @memberof modifiers 3316 * @inner 3317 */ 3318 shift: { 3319 /** @prop {number} order=100 - Index used to define the order of execution */ 3320 order: 100, 3321 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 3322 enabled: true, 3323 /** @prop {ModifierFn} */ 3324 fn: shift 3325 }, 3326 /** 3327 * The `offset` modifier can shift your popper on both its axis. 3328 * 3329 * It accepts the following units: 3330 * - `px` or unit-less, interpreted as pixels 3331 * - `%` or `%r`, percentage relative to the length of the reference element 3332 * - `%p`, percentage relative to the length of the popper element 3333 * - `vw`, CSS viewport width unit 3334 * - `vh`, CSS viewport height unit 3335 * 3336 * For length is intended the main axis relative to the placement of the popper.<br /> 3337 * This means that if the placement is `top` or `bottom`, the length will be the 3338 * `width`. In case of `left` or `right`, it will be the `height`. 3339 * 3340 * You can provide a single value (as `Number` or `String`), or a pair of values 3341 * as `String` divided by a comma or one (or more) white space
3341s.<br /> 3342 * The latter is a deprecated method because it leads to confusion and will be 3343 * removed in v2.<br /> 3344 * Additionally, it accepts additions and subtractions between different units. 3345 * Note that multiplications and divisions aren't supported. 3346 * 3347 * Valid examples are: 3348 * ``` 3349 * 10 3350 * '10%' 3351 * '10, 10' 3352 * '10%, 10' 3353 * '10 + 10%' 3354 * '10 - 5vh + 3%' 3355 * '-10px + 5vh, 5px - 6%' 3356 * ``` 3357 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 3358 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 3359 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 3360 * 3361 * @memberof modifiers 3362 * @inner 3363 */ 3364 offset: { 3365 /** @prop {number} order=200 - Index used to define the order of execution */ 3366 order: 200, 3367 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 3368 enabled: true, 3369 /** @prop {ModifierFn} */ 3370 fn: offset, 3371 /** @prop {Number|String} offset=0 3372 * The offset value as described in the modifier description 3373 */ 3374 offset: 0 3375 }, 3376 /** 3377 * Modifier used to prevent the popper from being positioned outside the boundary. 3378 * 3379 * A scenario exists where the reference itself is not within the boundaries.<br /> 3380 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 3381 * In this case we need to decide whether the popper should either: 3382 * 3383 * - detach from the reference and remain "trapped" in the boundaries, or 3384 * - if it should ignore the boundary and "escape with its reference" 3385 * 3386 * When `escapeWithReference` is set to`true` and reference is completely 3387 * outside its boundaries, the popper will overflow (or completely leave) 3388 * the boundaries in order to remain attached to the edge of the reference. 3389 * 3390 * @memberof modifiers 3391 * @inner 3392 */ 3393 preventOverflow: { 3394 /** @prop {number} order=300 - Index used to define the order of execution */ 3395 order: 300, 3396 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 3397 enabled: true, 3398 /** @prop {ModifierFn} */ 3399 fn: preventOverflow, 3400 /** 3401 * @prop {Array} [priority=['left','right','top','bottom']] 3402 * Popper will try to prevent overflow following these priorities by default, 3403 * then, it could overflow on the left and on top of the `boundariesElement` 3404 */ 3405 priority: ['left', 'right', 'top', 'bottom'], 3406 /** 3407 * @prop {number} padding=5 3408 * Amount of pixel used to define a minimum distance between the boundaries 3409 * and the popper. This makes sure the popper always has a little padding 3410 * between the edges of its container 3411 */ 3412 padding: 5, 3413 /** 3414 * @prop {String|HTMLElement} boundariesElement='scrollParent' 3415 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 3416 * `viewport` or any DOM element. 3417 */ 3418 boundariesElement: 'scrollParent' 3419 }, 3420 /** 3421 * Modifier used to make sure the reference and its popper stay near each other 3422 * without leaving any gap between the two. Especially useful when the arrow is 3423 * enabled and you want to ensure that it points to its reference element. 3424 * It cares only about the first axis. You can still have poppers with margin 3425 * between the popper and its reference element. 3426 * @memberof modifiers 3427 * @inner 3428 */ 3429 keepTogether: { 3430 /** @prop {number} order=400 - Index used to define the order of execution */ 3431 order: 400, 3432 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 3433 enabled: true, 3434 /** @prop {ModifierFn} */ 3435 fn: keepTogether 3436 }, 3437 /** 3438 * This modifier is used to move the `arrowElement` of the popper to make 3439 * sure it is positioned between the reference element and its popper element. 3440 * It will read the outer size of the `arrowElement` node to detect how many 3441 * pixels of conjunction are needed. 3442 * 3443 * It has no effect if no `arrowElement` is provided. 3444 * @memberof modifiers 3445 * @inner 3446 */ 3447 arrow: { 3448 /** @prop {number} order=500 - Index used to define the order of execution */ 3449 order: 500, 3450 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 3451 enabled: true, 3452 /** @prop {ModifierFn} */ 3453 fn: arrow, 3454 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 3455 element: '[x-arrow]' 3456 }, 3457 /** 3458 * Modifier used to flip the popper's placement when it starts to overlap its 3459 * reference element. 3460 * 3461 * Requires the `preventOverflow` modifier before it in order to work. 3462 * 3463 * **NOTE:** this modifier will interrupt the current update cycle and will 3464 * restart it if it detects the need to flip the placement. 3465 * @memberof modifiers 3466 * @inner 3467 */ 3468 flip: { 3469 /** @prop {number} order=600 - Index used to define the order of execution */ 3470 order: 600, 3471 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 3472 enabled: true, 3473 /** @prop {ModifierFn} */ 3474 fn: flip, 3475 /** 3476 * @prop {String|Array} behavior='flip' 3477 * The behavior used to change the popper's placement. It can be one of 3478 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 3479 * placements (with optional variations) 3480 */ 3481 behavior: 'flip', 3482 /** 3483 * @prop {number} padding=5 3484 * The popper will flip if it hits the edges of the `boundariesElement` 3485 */ 3486 padding: 5, 3487 /** 3488 * @prop {String|HTMLElement} boundariesElement='viewport' 3489 * The element which will define the boundaries of the popper position. 3490 * The popper will never be placed outside of the defined boundaries 3491 * (except if `keepTogether` is enabled) 3492 */ 3493 boundariesElement: 'viewport', 3494 /** 3495 * @prop {Boolean} flipVariations=false 3496 * The popper will switch placement variation between `-start` and `-end` when 3497 * the reference element overlaps its boundaries. 3498 * 3499 * The original placement should have a set variation. 3500 */ 3501 flipVariations: false, 3502 /** 3503 * @prop {Boolean} flipVariationsByContent=false 3504 * The popper will switch placement variation between `-start` and `-end` when 3505 * the popper element overlaps its reference boundaries. 3506 * 3507 * The original placement should have a set variation. 3508 */ 3509 flipVariationsByContent: false 3510 }, 3511 /** 3512 * Modifier used to make the popper flow toward the inner of the reference element. 3513 * By default, when this modifier is disabled, the popper will be placed outside 3514 * the reference element. 3515 * @memberof modifiers 3516 * @inner 3517 */ 3518 inner: { 3519 /** @prop {number} order=700 - Index used to define the order of execution */ 3520 order: 700, 3521 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 3522 enabled: false, 3523 /** @prop {ModifierFn} */ 3524 fn: inner 3525 }, 3526 /** 3527 * Modifier used to hide the popper when its reference element is outside of the 3528 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 3529 * be used to hide with a CSS selector the popper when its reference is 3530 * out of boundaries. 3531 * 3532 * Requires the `preventOverflow` modifier before it in order to work. 3533 * @memberof modifiers 3534 * @inner 3535 */ 3536 hide: { 3537 /** @prop {number} order=800 - Index used to define the order of execution */ 3538 order: 800, 3539 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 3540 enabled: true, 3541 /** @prop {ModifierFn} */ 3542 fn: hide 3543 }, 3544 /** 3545 * Computes the style that will be applied to the popper element to gets 3546 * properly positioned. 3547 * 3548 * Note that this modifier will not touch the DOM, it just prepares the styles 3549 * so that `applyStyle` modifier can apply it. This separation is useful 3550 * in case you need to replace `applyStyle` with a custom implementation. 3551 * 3552 * This modifier has `850` as `order` value to maintain backward compatibility 3553 * with previous versions of Popper.js. Expect the modifiers ordering method 3554 * to change in future major versions of the library. 3555 * 3556 * @memberof modifiers 3557 * @inner 3558 */ 3559 computeStyle: { 3560 /** @prop {number} order=850 - Index used to define the order of execution */ 3561 order: 850, 3562 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 3563 enabled: true, 3564 /** @prop {ModifierFn} */ 3565 fn: computeStyle, 3566 /** 3567 * @prop {Boolean} gpuAcceleration=true 3568 * If true, it uses the CSS 3D transformation to position the popper. 3569 * Otherwise, it will use the `top` and `left` properties 3570 */ 3571 gpuAcceleration: true, 3572 /** 3573 * @prop {string} [x='bottom'] 3574 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 3575 * Change this if your popper should grow in a direction different from `bottom` 3576 */ 3577 x: 'bottom', 3578 /** 3579 * @prop {string} [x='left'] 3580 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 3581 * Change this if your popper should grow in a direction different from `right` 3582 */ 3583 y: 'right' 3584 }, 3585 /** 3586 * Applies the computed styles to the popper element. 3587 * 3588 * All the DOM manipulations are limited to this modifier. This is useful in case 3589 * you want to integrate Popper.js inside a framework or view library and you 3590 * want to delegate all the DOM manipulations to it. 3591 * 3592 * Note that if you disable this modifier, you must make sure the popper element 3593 * has its position set to `absolute` before Popper.js can do its work! 3594 * 3595 * Just disable this modifier and define your own to achieve the desired effect. 3596 * 3597 * @memberof modifiers 3598 * @inner 3599 */ 3600 applyStyle: { 3601 /** @prop {number} order=900 - Index used to define the order of execution */ 3602 order: 900, 3603 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 3604 enabled: true, 3605 /** @prop {ModifierFn} */
vendor: 5,066 bytes, lines 3606-3736
3606 fn: applyStyle, 3607 /** @prop {Function} */ 3608 onLoad: applyStyleOnLoad, 3609 /** 3610 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 3611 * @prop {Boolean} gpuAcceleration=true 3612 * If true, it uses the CSS 3D transformation to position the popper. 3613 * Otherwise, it will use the `top` and `left` properties 3614 */ 3615 gpuAcceleration: undefined 3616 } 3617 }; 3618 3619 /** 3620 * The `dataObject` is an object containing all the information used by Popper.js. 3621 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 3622 * @name dataObject 3623 * @property {Object} data.instance The Popper.js instance 3624 * @property {String} data.placement Placement applied to popper 3625 * @property {String} data.originalPlacement Placement originally defined on init 3626 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 3627 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 3628 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 3629 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 3630 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 3631 * @property {Object} data.boundaries Offsets of the popper boundaries 3632 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 3633 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 3634 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 3635 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 3636 */ 3637 3638 /** 3639 * Default options provided to Popper.js constructor.<br /> 3640 * These can be overridden using the `options` argument of Popper.js.<br /> 3641 * To override an option, simply pass an object with the same 3642 * structure of the `options` object, as the 3rd argument. For example: 3643 * ``` 3644 * new Popper(ref, pop, { 3645 * modifiers: { 3646 * preventOverflow: { enabled: false } 3647 * } 3648 * }) 3649 * ``` 3650 * @type {Object} 3651 * @static 3652 * @memberof Popper 3653 */ 3654 var Defaults = { 3655 /** 3656 * Popper's placement. 3657 * @prop {Popper.placements} placement='bottom' 3658 */ 3659 placement: 'bottom', 3660 /** 3661 * Set this to true if you want popper to position it self in 'fixed' mode 3662 * @prop {Boolean} positionFixed=false 3663 */ 3664 positionFixed: false, 3665 /** 3666 * Whether events (resize, scroll) are initially enabled. 3667 * @prop {Boolean} eventsEnabled=true 3668 */ 3669 eventsEnabled: true, 3670 /** 3671 * Set to true if you want to automatically remove the popper when 3672 * you call the `destroy` method. 3673 * @prop {Boolean} removeOnDestroy=false 3674 */ 3675 removeOnDestroy: false, 3676 /** 3677 * Callback called when the popper is created.<br /> 3678 * By default, it is set to no-op.<br /> 3679 * Access Popper.js instance with `data.instance`. 3680 * @prop {onCreate} 3681 */ 3682 onCreate: function onCreate() {}, 3683 /** 3684 * Callback called when the popper is updated. This callback is not called 3685 * on the initialization/creation of the popper, but only on subsequent 3686 * updates.<br /> 3687 * By default, it is set to no-op.<br /> 3688 * Access Popper.js instance with `data.instance`. 3689 * @prop {onUpdate} 3690 */ 3691 onUpdate: function onUpdate() {}, 3692 /** 3693 * List of modifiers used to modify the offsets before they are applied to the popper. 3694 * They provide most of the functionalities of Popper.js. 3695 * @prop {modifiers} 3696 */ 3697 modifiers: modifiers 3698 }; 3699 3700 /** 3701 * @callback onCreate 3702 * @param {dataObject} data 3703 */ 3704 3705 /** 3706 * @callback onUpdate 3707 * @param {dataObject} data 3708 */ 3709 3710 // Utils 3711 // Methods 3712 var Popper = function () { 3713 /** 3714 * Creates a new Popper.js instance. 3715 * @class Popper 3716 * @param {Element|referenceObject} reference - The reference element used to position the popper 3717 * @param {Element} popper - The HTML / XML element used as the popper 3718 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 3719 * @return {Object} instance - The generated Popper.js instance 3720 */ 3721 function Popper(reference, popper) { 3722 var _this = this; 3723 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 3724 classCallCheck(this, Popper); 3725 this.scheduleUpdate = function () { 3726 return requestAnimationFrame(_this.update); 3727 }; 3728 3729 // make update() debounced, so that it only runs at most once-per-tick 3730 this.update = debounce(this.update.bind(this)); 3731 3732 // with {} we create a new object with the options inside it 3733 this.options = _extends({}, Popper.Defaults, options); 3734 3735 // init state 3736 this.state = {
3737 isDestroyed: false, 3738 isCreated: false, 3739 scrollParents: [] 3740 }; 3741 3742 // get reference and popper elements (allow jQuery wrappers) 3743 this.reference = reference && reference.jquery ? reference[0] : reference; 3744 this.popper = popper && popper.jquery ? popper[0] : popper; 3745 3746 // Deep merge modifiers options 3747 this.options.modifiers = {}; 3748 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 3749 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 3750 }); 3751 3752 // Refactoring modifiers' list (Object => Array) 3753 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 3754 return _extends({ 3755 name: name 3756 }, _this.options.modifiers[name]); 3757 }) 3758 // sort the modifiers by order 3759 .sort(function (a, b) { 3760 return a.order - b.order; 3761 }); 3762 3763 // modifiers have the ability to execute arbitrary code when Popper.js get inited 3764 // such code is executed in the same order of its modifier 3765 // they could add new properties to their options configuration 3766 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 3767 this.modifiers.forEach(function (modifierOptions) { 3768 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 3769 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 3770 } 3771 }); 3772 3773 // fire the first update to position the popper in the right place 3774 this.update(); 3775 var eventsEnabled = this.options.eventsEnabled; 3776 if (eventsEnabled) { 3777 // setup event listeners, they will take care of update the position in specific situations 3778 this.enableEventListeners(); 3779 } 3780 this.state.eventsEnabled = eventsEnabled; 3781 } 3782 3783 // We can't use class properties because they don't get listed in the 3784 // class prototype and break stuff like Sinon stubs 3785 3786 createClass(Popper, [{ 3787 key: 'update', 3788 value: function update$$1() { 3789 return update.call(this); 3790 } 3791 }, { 3792 key: 'destroy', 3793 value: function destroy$$1() { 3794 return destroy.call(this); 3795 } 3796 }, { 3797 key: 'enableEventListeners', 3798 value: function enableEventListeners$$1() { 3799 return enableEventListeners.call(this); 3800 } 3801 }, { 3802 key: 'disableEventListeners', 3803 value: function disableEventListeners$$1() { 3804 return disableEventListeners.call(this); 3805 } 3806 3807 /** 3808 * Schedules an update. It will run on the next UI update available. 3809 * @method scheduleUpdate 3810 * @memberof Popper 3811 */ 3812 3813 /** 3814 * Collection of utilities useful when writing custom modifiers. 3815 * Starting from version 1.7, this method is available only if you 3816 * include `popper-utils.js` before `popper.js`. 3817 * 3818 * **DEPRECATION**: This way to access PopperUtils is deprecated 3819 * and will be removed in v2! Use the PopperUtils module directly instead. 3820 * Due to the high instability of the methods contained in Utils, we can't 3821 * guarantee them to follow semver. Use them at your own risk! 3822 * @static 3823 * @private 3824 * @type {Object} 3825 * @deprecated since version 1.8 3826 * @member Utils 3827 * @memberof Popper 3828 */ 3829 }]); 3830 return Popper; 3831 }(); 3832 3833 /** 3834 * The `referenceObject` is an object that provides an interface compatible with Popper.js 3835 * and lets you use it as replacement of a real DOM node.<br /> 3836 * You can use this method to position a popper relatively to a set of coordinates 3837 * in case you don't have a DOM node to use as reference. 3838 * 3839 * ``` 3840 * new Popper(referenceObject, popperNode); 3841 * ``` 3842 * 3843 * NB: This feature isn't supported in Internet Explorer 10. 3844 * @name referenceObject 3845 * @property {Function} data.getBoundingClientRect 3846 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 3847 * @property {number} data.clientWidth 3848 * An ES6 getter that will return the width of the virtual reference element. 3849 * @property {number} data.clientHeight 3850 * An ES6 getter that will return the height of the virtual reference element. 3851 */ 3852 3853 Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; 3854 Popper.placements = placements; 3855 Popper.Defaults = Defaults; 3856 var Popper$1 = Popper; 3857 3858 /** 3859 * Constants 3860 */ 3861 3862 var NAME$6 = 'dropdown'; 3863 var VERSION$6 = '4.6.2'; 3864 var DATA_KEY$6 = 'bs.dropdown'; 3865 var EVENT_KEY$6 = "." + DATA_KEY$6; 3866 var DATA_API_KEY$3 = '.data-api'; 3867 var JQUERY_NO_CONFLICT$6 = $__default["default"].fn[NAME$6]; 3868 var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key 3869 3870 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 3871 3872 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 3873 3874 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 3875 3876 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 3877 3878 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 3879 3880 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE$1); 3881 var CLASS_NAME_DISABLED$1 = 'disabled'; 3882 var CLASS_NAME_SHOW$5 = 'show'; 3883 var CLASS_NAME_DROPUP = 'dropup'; 3884 var CLASS_NAME_DROPRIGHT = 'dropright'; 3885 var CLASS_NAME_DROPLEFT = 'dropleft'; 3886 var CLASS_NAME_MENURIGHT = 'dropdown-menu-right'; 3887 var CLASS_NAME_POSITION_STATIC = 'position-static'; 3888 var EVENT_HIDE$3 = "hide" + EVENT_KEY$6; 3889 var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$6; 3890 var EVENT_SHOW$3 = "show" + EVENT_KEY$6; 3891 var EVENT_SHOWN$3 = "shown" + EVENT_KEY$6; 3892 var EVENT_CLICK = "click" + EVENT_KEY$6; 3893 var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$6 + DATA_API_KEY$3; 3894 var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$6 + DATA_API_KEY$3; 3895 var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$6 + DATA_API_KEY$3; 3896 var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]'; 3897 var SELECTOR_FORM_CHILD = '.dropdown form'; 3898 var SELECTOR_MENU = '.dropdown-menu'; 3899 var SELECTOR_NAVBAR_NAV = '.navbar-nav'; 3900 var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; 3901 var PLACEMENT_TOP = 'top-start'; 3902 var PLACEMENT_TOPEND = 'top-end'; 3903 var PLACEMENT_BOTTOM = 'bottom-start'; 3904 var PLACEMENT_BOTTOMEND = 'bottom-end'; 3905 var PLACEMENT_RIGHT = 'right-start'; 3906 var PLACEMENT_LEFT = 'left-start'; 3907 var Default$5 = { 3908 offset: 0, 3909 flip: true, 3910 boundary: 'scrollParent', 3911 reference: 'toggle', 3912 display: 'dynamic', 3913 popperConfig: null 3914 }; 3915 var DefaultType$5 = { 3916 offset: '(number|string|function)', 3917 flip: 'boolean', 3918 boundary: '(string|element)', 3919 reference: '(string|element)', 3920 display: 'string', 3921 popperConfig: '(null|object)' 3922 }; 3923 /** 3924 * Class definition 3925 */ 3926 3927 var Dropdown = /*#__PURE__*/function () { 3928 function Dropdown(element, config) { 3929 this._element = element; 3930 this._popper = null; 3931 this._config = this._getConfig(config); 3932 this._menu = this._getMenuElement(); 3933 this._inNavbar = this._detectNavbar(); 3934 this._addEventListeners(); 3935 } // Getters 3936 3937 var _proto = Dropdown.prototype; 3938 3939 // Public
3940 _proto.toggle = function toggle() { 3941 if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1)) { 3942 return; 3943 } 3944 var isActive = $__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5); 3945 Dropdown._clearMenus(); 3946 if (isActive) { 3947 return; 3948 } 3949 this.show(true); 3950 }; 3951 _proto.show = function show(usePopper) { 3952 if (usePopper === void 0) { 3953 usePopper = false; 3954 } 3955 if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1) || $__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5)) { 3956 return; 3957 } 3958 var relatedTarget = { 3959 relatedTarget: this._element 3960 }; 3961 var showEvent = $__default["default"].Event(EVENT_SHOW$3, relatedTarget); 3962 var parent = Dropdown._getParentFromElement(this._element); 3963 $__default["default"](parent).trigger(showEvent); 3964 if (showEvent.isDefaultPrevented()) { 3965 return; 3966 } // Totally disable Popper for Dropdowns in Navbar 3967 3968 if (!this._inNavbar && usePopper) { 3969 // Check for Popper dependency 3970 if (typeof Popper$1 === 'undefined') { 3971 throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); 3972 } 3973 var referenceElement = this._element; 3974 if (this._config.reference === 'parent') { 3975 referenceElement = parent; 3976 } else if (Util.isElement(this._config.reference)) { 3977 referenceElement = this._config.reference; // Check if it's jQuery element 3978 3979 if (typeof this._config.reference.jquery !== 'undefined') { 3980 referenceElement = this._config.reference[0]; 3981 } 3982 } // If boundary is not `scrollParent`, then set position to `static` 3983 // to allow the menu to "escape" the scroll parent's boundaries 3984 // https://github.com/twbs/bootstrap/issues/24251 3985 3986 if (this._config.boundary !== 'scrollParent') { 3987 $__default["default"](parent).addClass(CLASS_NAME_POSITION_STATIC); 3988 } 3989 this._popper = new Popper$1(referenceElement, this._menu, this._getPopperConfig()); 3990 } // If this is a touch-enabled device we add extra 3991 // empty mouseover listeners to the body's immediate children; 3992 // only needed because of broken event delegation on iOS 3993 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 3994 3995 if ('ontouchstart' in document.documentElement && $__default["default"](parent).closest(SELECTOR_NAVBAR_NAV).length === 0) { 3996 $__default["default"](document.body).children().on('mouseover', null, $__default["default"].noop); 3997 } 3998 this._element.focus(); 3999 this._element.setAttribute('aria-expanded', true); 4000 $__default["default"](this._menu).toggleClass(CLASS_NAME_SHOW$5); 4001 $__default["default"](parent).toggleClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_SHOWN$3, relatedTarget)); 4002 }; 4003 _proto.hide = function hide() { 4004 if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1) || !$__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5)) { 4005 return; 4006 } 4007 var relatedTarget = { 4008 relatedTarget: this._element 4009 }; 4010 var hideEvent = $__default["default"].Event(EVENT_HIDE$3, relatedTarget); 4011 var parent = Dropdown._getParentFromElement(this._element); 4012 $__default["default"](parent).trigger(hideEvent); 4013 if (hideEvent.isDefaultPrevented()) { 4014 return; 4015 } 4016 if (this._popper) { 4017 this._popper.destroy(); 4018 } 4019 $__default["default"](this._menu).toggleClass(CLASS_NAME_SHOW$5); 4020 $__default["default"](parent).toggleClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_HIDDEN$3, relatedTarget)); 4021 }; 4022 _proto.dispose = function dispose() { 4023 $__default["default"].removeData(this._element, DATA_KEY$6); 4024 $__default["default"](this._element).off(EVENT_KEY$6); 4025 this._element = null; 4026 this._menu = null; 4027 if (this._popper !== null) { 4028 this._popper.destroy(); 4029 this._popper = null; 4030 } 4031 };
4032 _proto.update = function update() { 4033 this._inNavbar = this._detectNavbar(); 4034 if (this._popper !== null) { 4035 this._popper.scheduleUpdate(); 4036 } 4037 } // Private 4038 ; 4039 _proto._addEventListeners = function _addEventListeners() { 4040 var _this = this; 4041 $__default["default"](this._element).on(EVENT_CLICK, function (event) { 4042 event.preventDefault(); 4043 event.stopPropagation(); 4044 _this.toggle(); 4045 }); 4046 }; 4047 _proto._getConfig = function _getConfig(config) { 4048 config = _extends$1({}, this.constructor.Default, $__default["default"](this._element).data(), config); 4049 Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); 4050 return config; 4051 }; 4052 _proto._getMenuElement = function _getMenuElement() { 4053 if (!this._menu) { 4054 var parent = Dropdown._getParentFromElement(this._element); 4055 if (parent) { 4056 this._menu = parent.querySelector(SELECTOR_MENU); 4057 } 4058 } 4059 return this._menu; 4060 }; 4061 _proto._getPlacement = function _getPlacement() { 4062 var $parentDropdown = $__default["default"](this._element.parentNode); 4063 var placement = PLACEMENT_BOTTOM; // Handle dropup 4064 4065 if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) { 4066 placement = $__default["default"](this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP; 4067 } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) { 4068 placement = PLACEMENT_RIGHT; 4069 } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) { 4070 placement = PLACEMENT_LEFT; 4071 } else if ($__default["default"](this._menu).hasClass(CLASS_NAME_MENURIGHT)) { 4072 placement = PLACEMENT_BOTTOMEND; 4073 } 4074 return placement; 4075 }; 4076 _proto._detectNavbar = function _detectNavbar() { 4077 return $__default["default"](this._element).closest('.navbar').length > 0; 4078 }; 4079 _proto._getOffset = function _getOffset() { 4080 var _this2 = this; 4081 var offset = {}; 4082 if (typeof this._config.offset === 'function') { 4083 offset.fn = function (data) { 4084 data.offsets = _extends$1({}, data.offsets, _this2._config.offset(data.offsets, _this2._element)); 4085 return data; 4086 }; 4087 } else { 4088 offset.offset = this._config.offset; 4089 } 4090 return offset; 4091 }; 4092 _proto._getPopperConfig = function _getPopperConfig() { 4093 var popperConfig = { 4094 placement: this._getPlacement(), 4095 modifiers: { 4096 offset: this._getOffset(), 4097 flip: { 4098 enabled: this._config.flip 4099 }, 4100 preventOverflow: { 4101 boundariesElement: this._config.boundary 4102 } 4103 } 4104 }; // Disable Popper if we have a static display 4105 4106 if (this._config.display === 'static') { 4107 popperConfig.modifiers.applyStyle = { 4108 enabled: false 4109 }; 4110 } 4111 return _extends$1({}, popperConfig, this._config.popperConfig); 4112 } // Static 4113 ; 4114 Dropdown._jQueryInterface = function _jQueryInterface(config) { 4115 return this.each(function () { 4116 var data = $__default["default"](this).data(DATA_KEY$6); 4117 var _config = typeof config === 'object' ? config : null; 4118 if (!data) { 4119 data = new Dropdown(this, _config); 4120 $__default["default"](this).data(DATA_KEY$6, data); 4121 } 4122 if (typeof config === 'string') { 4123 if (typeof data[config] === 'undefined') { 4124 throw new TypeError("No method named \"" + config + "\""); 4125 } 4126 data[config](); 4127 } 4128 }); 4129 }; 4130 Dropdown._clearMenus = function _clearMenus(event) { 4131 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 4132 return; 4133 } 4134 var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2)); 4135 for (var i = 0, len = toggles.length; i < len; i++) { 4136 var parent = Dropdown._getParentFromElement(toggles[i]); 4137 var context = $__default["default"](toggles[i]).data(DATA_KEY$6); 4138 var relatedTarget = { 4139 relatedTarget: toggles[i] 4140 }; 4141 if (event && event.type === 'click') { 4142 relatedTarget.clickEvent = event; 4143 } 4144 if (!context) { 4145 continue; 4146 } 4147 var dropdownMenu = context._menu; 4148 if (!$__default["default"](parent).hasClass(CLASS_NAME_SHOW$5)) { 4149 continue; 4150 } 4151 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $__default["default"].contains(parent, event.target)) { 4152 continue; 4153 } 4154 var hideEvent = $__default["default"].Event(EVENT_HIDE$3, relatedTarget); 4155 $__default["default"](parent).trigger(hideEvent); 4156 if (hideEvent.isDefaultPrevented()) { 4157 continue; 4158 } // If this is a touch-enabled device we remove the extra 4159 // empty mouseover listeners we added for iOS support 4160 4161 if ('ontouchstart' in document.documentElement) { 4162 $__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop); 4163 } 4164 toggles[i].setAttribute('aria-expanded', 'false'); 4165 if (context._popper) { 4166 context._popper.destroy(); 4167 } 4168 $__default["default"](dropdownMenu).removeClass(CLASS_NAME_SHOW$5); 4169 $__default["default"](parent).removeClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_HIDDEN$3, relatedTarget)); 4170 } 4171 }; 4172 Dropdown._getParentFromElement = function _getParentFromElement(element) { 4173 var parent; 4174 var selector = Util.getSelectorFromElement(element); 4175 if (selector) { 4176 parent = document.querySelector(selector); 4177 } 4178 return parent || element.parentNode; 4179 } // eslint-disable-next-line complexity 4180 ; 4181 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 4182 // If not input/textarea: 4183 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 4184 // If input/textarea: 4185 // - If space key => not a dropdown command 4186 // - If key is other than escape 4187 // - If key is not up or down => not a dropdown command 4188 // - If trigger inside the menu =>
4188 not a dropdown command 4189 if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE$1 && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $__default["default"](event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { 4190 return; 4191 } 4192 if (this.disabled || $__default["default"](this).hasClass(CLASS_NAME_DISABLED$1)) { 4193 return; 4194 } 4195 var parent = Dropdown._getParentFromElement(this); 4196 var isActive = $__default["default"](parent).hasClass(CLASS_NAME_SHOW$5); 4197 if (!isActive && event.which === ESCAPE_KEYCODE$1) { 4198 return; 4199 } 4200 event.preventDefault(); 4201 event.stopPropagation(); 4202 if (!isActive || event.which === ESCAPE_KEYCODE$1 || event.which === SPACE_KEYCODE) { 4203 if (event.which === ESCAPE_KEYCODE$1) { 4204 $__default["default"](parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus'); 4205 } 4206 $__default["default"](this).trigger('click'); 4207 return; 4208 } 4209 var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) { 4210 return $__default["default"](item).is(':visible'); 4211 }); 4212 if (items.length === 0) { 4213 return; 4214 } 4215 var index = items.indexOf(event.target); 4216 if (event.which === ARROW_UP_KEYCODE && index > 0) { 4217 // Up 4218 index--; 4219 } 4220 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 4221 // Down 4222 index++; 4223 } 4224 if (index < 0) { 4225 index = 0; 4226 } 4227 items[index].focus(); 4228 }; 4229 _createClass(Dropdown, null, [{ 4230 key: "VERSION", 4231 get: function get() { 4232 return VERSION$6; 4233 } 4234 }, { 4235 key: "Default", 4236 get: function get() { 4237 return Default$5; 4238 } 4239 }, { 4240 key: "DefaultType", 4241 get: function get() { 4242 return DefaultType$5; 4243 } 4244 }]); 4245 return Dropdown; 4246 }(); 4247 /** 4248 * Data API implementation 4249 */ 4250 4251 $__default["default"](document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$2 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { 4252 event.preventDefault(); 4253 event.stopPropagation(); 4254 Dropdown._jQueryInterface.call($__default["default"](this), 'toggle'); 4255 }).on(EVENT_CLICK_DATA_API$2, SELECTOR_FORM_CHILD, function (e) { 4256 e.stopPropagation(); 4257 }); 4258 /** 4259 * jQuery 4260 */ 4261 4262 $__default["default"].fn[NAME$6] = Dropdown._jQueryInterface; 4263 $__default["default"].fn[NAME$6].Constructor = Dropdown; 4264 $__default["default"].fn[NAME$6].noConflict = function () { 4265 $__default["default"].fn[NAME$6] = JQUERY_NO_CONFLICT$6; 4266 return Dropdown._jQueryInterface; 4267 }; 4268 4269 /** 4270 * Constants 4271 */ 4272 4273 var NAME$5 = 'modal'; 4274 var VERSION$5 = '4.6.2'; 4275 var DATA_KEY$5 = 'bs.modal'; 4276 var EVENT_KEY$5 = "." + DATA_KEY$5; 4277 var DATA_API_KEY$2 = '.data-api'; 4278 var JQUERY_NO_CONFLICT$5 = $__default["default"].fn[NAME$5]; 4279 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 4280 4281 var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable'; 4282 var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure'; 4283 var CLASS_NAME_BACKDROP = 'modal-backdrop'; 4284 var CLASS_NAME_OPEN = 'modal-open'; 4285 var CLASS_NAME_FADE$4 = 'fade'; 4286 var CLASS_NAME_SHOW$4 = 'show'; 4287 var CLASS_NAME_STATIC = 'modal-static'; 4288 var EVENT_HIDE$2 = "hide" + EVENT_KEY$5; 4289 var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5; 4290 var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5; 4291 var EVENT_SHOW$2 = "show" + EVENT_KEY$5; 4292 var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5; 4293 var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5; 4294 var EVENT_RESIZE = "resize" + EVENT_KEY$5; 4295 var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$5; 4296 var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5; 4297 var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5; 4298 var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5; 4299 var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$5 + DATA_API_KEY$2; 4300 var SELECTOR_DIALOG = '.modal-dialog'; 4301 var SELECTOR_MODAL_BODY = '.modal-body'; 4302 var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="modal"]'; 4303 var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="modal"]'; 4304 var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 4305 var SELECTOR_STICKY_CONTENT = '.sticky-top'; 4306 var Default$4 = { 4307 backdrop: true, 4308 keyboard: true, 4309 focus: true, 4310 show: true 4311 }; 4312 var DefaultType$4 = { 4313 backdrop: '(boolean|string)', 4314 keyboard: 'boolean', 4315 focus: 'boolean', 4316 show: 'boolean' 4317 }; 4318 /** 4319 * Class definition 4320 */ 4321 4322 var Modal = /*#__PURE__*/function () { 4323 function Modal(element, config) { 4324 this._config = this._getConfig(config); 4325 this._element = element; 4326 this._dialog = element.querySelector(SELECTOR_DIALOG); 4327 this._backdrop = null; 4328 this._isShown = false;
4329 this._isBodyOverflowing = false; 4330 this._ignoreBackdropClick = false; 4331 this._isTransitioning = false; 4332 this._scrollbarWidth = 0; 4333 } // Getters 4334 4335 var _proto = Modal.prototype; 4336 4337 // Public 4338 _proto.toggle = function toggle(relatedTarget) { 4339 return this._isShown ? this.hide() : this.show(relatedTarget); 4340 }; 4341 _proto.show = function show(relatedTarget) { 4342 var _this = this; 4343 if (this._isShown || this._isTransitioning) { 4344 return; 4345 } 4346 var showEvent = $__default["default"].Event(EVENT_SHOW$2, { 4347 relatedTarget: relatedTarget 4348 }); 4349 $__default["default"](this._element).trigger(showEvent); 4350 if (showEvent.isDefaultPrevented()) { 4351 return; 4352 } 4353 this._isShown = true; 4354 if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE$4)) { 4355 this._isTransitioning = true; 4356 } 4357 this._checkScrollbar(); 4358 this._setScrollbar(); 4359 this._adjustDialog(); 4360 this._setEscapeEvent(); 4361 this._setResizeEvent(); 4362 $__default["default"](this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function (event) { 4363 return _this.hide(event); 4364 }); 4365 $__default["default"](this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () { 4366 $__default["default"](_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) { 4367 if ($__default["default"](event.target).is(_this._element)) { 4368 _this._ignoreBackdropClick = true; 4369 } 4370 }); 4371 }); 4372 this._showBackdrop(function () { 4373 return _this._showElement(relatedTarget); 4374 }); 4375 }; 4376 _proto.hide = function hide(event) { 4377 var _this2 = this; 4378 if (event) { 4379 event.preventDefault(); 4380 } 4381 if (!this._isShown || this._isTransitioning) { 4382 return; 4383 } 4384 var hideEvent = $__default["default"].Event(EVENT_HIDE$2); 4385 $__default["default"](this._element).trigger(hideEvent); 4386 if (!this._isShown || hideEvent.isDefaultPrevented()) { 4387 return; 4388 } 4389 this._isShown = false; 4390 var transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4); 4391 if (transition) { 4392 this._isTransitioning = true; 4393 } 4394 this._setEscapeEvent(); 4395 this._setResizeEvent(); 4396 $__default["default"](document).off(EVENT_FOCUSIN); 4397 $__default["default"](this._element).removeClass(CLASS_NAME_SHOW$4); 4398 $__default["default"](this._element).off(EVENT_CLICK_DISMISS$1); 4399 $__default["default"](this._dialog).off(EVENT_MOUSEDOWN_DISMISS); 4400 if (transition) { 4401 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 4402 $__default["default"](this._element).one(Util.TRANSITION_END, function (event) { 4403 return _this2._hideModal(event); 4404 }).emulateTransitionEnd(transitionDuration); 4405 } else { 4406 this._hideModal(); 4407 } 4408 }; 4409 _proto.dispose = function dispose() { 4410 [window, this._element, this._dialog].forEach(function (htmlElement) { 4411 return $__default["default"](htmlElement).off(EVENT_KEY$5); 4412 }); 4413 /** 4414 * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` 4415 * Do not move `document` in `htmlElements` array 4416 * It will remove `EVENT_CLICK_DATA_API` event that should remain 4417 */ 4418 4419 $__default["default"](document).off(EVENT_FOCUSIN); 4420 $__default["default"].removeData(this._element, DATA_KEY$5); 4421 this._config = null; 4422 this._element = null; 4423 this._dialog = null; 4424 this._backdrop = null; 4425 this._isShown = null; 4426 this._isBodyOverflowing = null; 4427 this._ignoreBackdropClick = null; 4428 this._isTransitioning = null; 4429 this._scrollbarWidth = null; 4430 }; 4431 _proto.handleUpdate = function handleUpdate() { 4432 this._adjustDialog(); 4433 } // Private 4434 ; 4435 _proto._getConfig = function _getConfig(config) { 4436 config = _extends$1({}, Default$4, config); 4437 Util.typeCheckConfig(NAME$5, config, DefaultType$4); 4438 return config; 4439 }; 4440 _proto._triggerBackdropTransition = function _triggerBackdropTransition() { 4441 var _this3 = this; 4442 var hideEventPrevented = $__default["default"].Event(EVENT_HIDE_PREVENTED); 4443 $__default["default"](this._element).trigger(hideEventPrevented); 4444 if (hideEventPrevented.isDefaultPrevented()) { 4445 return; 4446 } 4447 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4448 if (!isModalOverflowing) { 4449 this._element.style.overflowY = 'hidden'; 4450 } 4451 this._element.classList.add(CLASS_NAME_STATIC); 4452 var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog); 4453 $__default["default"](this._element).off(Util.TRANSITION_END); 4454 $__default["default"](this._element).one(Util.TRANSITION_END, function () { 4455 _this3._element.classList.remove(CLASS_NAME_STATIC); 4456 if (!isModalOverflowing) { 4457 $__default["default"](_this3._element).one(Util.TRANSITION_END, function () { 4458 _this3._element.style.overflowY = ''; 4459 }).emulateTransitionEnd(_this3._element, modalTransitionDuration); 4460 } 4461 }).emulateTransitionEnd(modalTransitionDuration); 4462 this._element.focus(); 4463 }; 4464 _proto._showElement = function _showElement(relatedTarget) { 4465 var _this4 = this; 4466 var transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4); 4467 var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null; 4468 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 4469 // Don't move modal's DOM position 4470 document.body.appendChild(this._element); 4471 } 4472 this._element.style.display = 'block'; 4473 this._element.removeAttribute('aria-hidden'); 4474 this._element.setAttribute('aria-modal', true); 4475 this._element.setAttribute('role', 'dialog'); 4476 if ($__default["default"](this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) { 4477 modalBody.scrollTop = 0; 4478 } else { 4479 this._element.scrollTop = 0; 4480 } 4481 if (transition) { 4482 Util.reflow(this._element); 4483 } 4484 $__default["default"](this._element).addClass(CLASS_NAME_SHOW$4); 4485 if (this._config.focus) { 4486 this._enforceFocus(); 4487 } 4488 var shownEvent = $__default["default"].Event(EVENT_SHOWN$2, { 4489 relatedTarget: relatedTarget 4490 }); 4491 var transitionComplete = function transitionComplete() { 4492 if (_this4._config.focus) { 4493 _this4._element.focus(); 4494 } 4495 _this4._isTransitioning = false;
4496 $__default["default"](_this4._element).trigger(shownEvent); 4497 }; 4498 if (transition) { 4499 var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); 4500 $__default["default"](this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); 4501 } else { 4502 transitionComplete(); 4503 } 4504 }; 4505 _proto._enforceFocus = function _enforceFocus() { 4506 var _this5 = this; 4507 $__default["default"](document).off(EVENT_FOCUSIN) // Guard against infinite focus loop 4508 .on(EVENT_FOCUSIN, function (event) { 4509 if (document !== event.target && _this5._element !== event.target && $__default["default"](_this5._element).has(event.target).length === 0) { 4510 _this5._element.focus(); 4511 } 4512 }); 4513 }; 4514 _proto._setEscapeEvent = function _setEscapeEvent() { 4515 var _this6 = this; 4516 if (this._isShown) { 4517 $__default["default"](this._element).on(EVENT_KEYDOWN_DISMISS, function (event) { 4518 if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE) { 4519 event.preventDefault(); 4520 _this6.hide(); 4521 } else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE) { 4522 _this6._triggerBackdropTransition(); 4523 } 4524 }); 4525 } else if (!this._isShown) { 4526 $__default["default"](this._element).off(EVENT_KEYDOWN_DISMISS); 4527 } 4528 }; 4529 _proto._setResizeEvent = function _setResizeEvent() { 4530 var _this7 = this; 4531 if (this._isShown) { 4532 $__default["default"](window).on(EVENT_RESIZE, function (event) { 4533 return _this7.handleUpdate(event); 4534 }); 4535 } else { 4536 $__default["default"](window).off(EVENT_RESIZE); 4537 } 4538 }; 4539 _proto._hideModal = function _hideModal() { 4540 var _this8 = this; 4541 this._element.style.display = 'none'; 4542 this._element.setAttribute('aria-hidden', true); 4543 this._element.removeAttribute('aria-modal'); 4544 this._element.removeAttribute('role'); 4545 this._isTransitioning = false; 4546 this._showBackdrop(function () { 4547 $__default["default"](document.body).removeClass(CLASS_NAME_OPEN); 4548 _this8._resetAdjustments(); 4549 _this8._resetScrollbar(); 4550 $__default["default"](_this8._element).trigger(EVENT_HIDDEN$2); 4551 }); 4552 }; 4553 _proto._removeBackdrop = function _removeBackdrop() { 4554 if (this._backdrop) { 4555 $__default["default"](this._backdrop).remove(); 4556 this._backdrop = null; 4557 } 4558 }; 4559 _proto._showBackdrop = function _showBackdrop(callback) { 4560 var _this9 = this; 4561 var animate = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4) ? CLASS_NAME_FADE$4 : ''; 4562 if (this._isShown && this._config.backdrop) { 4563 this._backdrop = document.createElement('div'); 4564 this._backdrop.className = CLASS_NAME_BACKDROP; 4565 if (animate) { 4566 this._backdrop.classList.add(animate); 4567 } 4568 $__default["default"](this._backdrop).appendTo(document.body); 4569 $__default["default"](this._element).on(EVENT_CLICK_DISMISS$1, function (event) { 4570 if (_this9._ignoreBackdropClick) { 4571 _this9._ignoreBackdropClick = false; 4572 return; 4573 } 4574 if (event.target !== event.currentTarget) { 4575 return; 4576 } 4577 if (_this9._config.backdrop === 'static') { 4578 _this9._triggerBackdropTransition(); 4579 } else { 4580 _this9.hide(); 4581 } 4582 }); 4583 if (animate) { 4584 Util.reflow(this._backdrop); 4585 } 4586 $__default["default"](this._backdrop).addClass(CLASS_NAME_SHOW$4); 4587 if (!callback) { 4588 return; 4589 } 4590 if (!animate) { 4591 callback(); 4592 return; 4593 } 4594 var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 4595 $__default["default"](this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); 4596 } else if (!this._isShown && this._backdrop) { 4597 $__default["default"](this._backdrop).removeClass(CLASS_NAME_SHOW$4); 4598 var callbackRemove = function callbackRemove() { 4599 _this9._removeBackdrop(); 4600 if (callback) { 4601 callback(); 4602 } 4603 }; 4604 if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE$4)) { 4605 var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 4606 $__default["default"](this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); 4607 } else { 4608 callbackRemove(); 4609 } 4610 } else if (callback) { 4611 callback(); 4612 } 4613 } // ---------------------------------------------------------------------- 4614 // the following methods are used to handle overflowing modals 4615 // todo (fat): these should probably be refactored out of modal.js 4616 // ---------------------------------------------------------------------- 4617 ;
4618 _proto._adjustDialog = function _adjustDialog() { 4619 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4620 if (!this._isBodyOverflowing && isModalOverflowing) { 4621 this._element.style.paddingLeft = this._scrollbarWidth + "px"; 4622 } 4623 if (this._isBodyOverflowing && !isModalOverflowing) { 4624 this._element.style.paddingRight = this._scrollbarWidth + "px"; 4625 } 4626 }; 4627 _proto._resetAdjustments = function _resetAdjustments() { 4628 this._element.style.paddingLeft = ''; 4629 this._element.style.paddingRight = ''; 4630 }; 4631 _proto._checkScrollbar = function _checkScrollbar() { 4632 var rect = document.body.getBoundingClientRect(); 4633 this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth; 4634 this._scrollbarWidth = this._getScrollbarWidth(); 4635 }; 4636 _proto._setScrollbar = function _setScrollbar() { 4637 var _this10 = this; 4638 if (this._isBodyOverflowing) { 4639 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 4640 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 4641 var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); 4642 var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding 4643 4644 $__default["default"](fixedContent).each(function (index, element) { 4645 var actualPadding = element.style.paddingRight; 4646 var calculatedPadding = $__default["default"](element).css('padding-right'); 4647 $__default["default"](element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px"); 4648 }); // Adjust sticky content margin 4649 4650 $__default["default"](stickyContent).each(function (index, element) { 4651 var actualMargin = element.style.marginRight; 4652 var calculatedMargin = $__default["default"](element).css('margin-right'); 4653 $__default["default"](element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px"); 4654 }); // Adjust body padding 4655 4656 var actualPadding = document.body.style.paddingRight; 4657 var calculatedPadding = $__default["default"](document.body).css('padding-right'); 4658 $__default["default"](document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); 4659 } 4660 $__default["default"](document.body).addClass(CLASS_NAME_OPEN); 4661 }; 4662 _proto._resetScrollbar = function _resetScrollbar() { 4663 // Restore fixed content padding 4664 var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); 4665 $__default["default"](fixedContent).each(function (index, element) { 4666 var padding = $__default["default"](element).data('padding-right'); 4667 $__default["default"](element).removeData('padding-right'); 4668 element.style.paddingRight = padding ? padding : ''; 4669 }); // Restore sticky content 4670 4671 var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT)); 4672 $__default["default"](elements).each(function (index, element) { 4673 var margin = $__default["default"](element).data('margin-right'); 4674 if (typeof margin !== 'undefined') { 4675 $__default["default"](element).css('margin-right', margin).removeData('margin-right'); 4676 } 4677 }); // Restore body padding 4678 4679 var padding = $__default["default"](document.body).data('padding-right'); 4680 $__default["default"](document.body).removeData('padding-right'); 4681 document.body.style.paddingRight = padding ? padding : ''; 4682 }; 4683 _proto._getScrollbarWidth = function _getScrollbarWidth() { 4684 // thx d.walsh 4685 var scrollDiv = document.createElement('div'); 4686 scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER; 4687 document.body.appendChild(scrollDiv); 4688 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 4689 document.body.removeChild(scrollDiv); 4690 return scrollbarWidth; 4691 } // Static 4692 ; 4693 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 4694 return this.each(function () { 4695 var data = $__default["default"](this).data(DATA_KEY$5); 4696 var _config = _extends$1({}, Default$4, $__default["default"](this).data(), typeof config === 'object' && config ? config : {}); 4697 if (!data) { 4698 data = new Modal(this, _config); 4699 $__default["default"](this).data(DATA_KEY$5, data); 4700 } 4701 if (typeof config === 'string') { 4702 if (typeof data[config] === 'undefined') {
4703 throw new TypeError("No method named \"" + config + "\""); 4704 } 4705 data[config](relatedTarget); 4706 } else if (_config.show) { 4707 data.show(relatedTarget); 4708 } 4709 }); 4710 }; 4711 _createClass(Modal, null, [{ 4712 key: "VERSION", 4713 get: function get() { 4714 return VERSION$5; 4715 } 4716 }, { 4717 key: "Default", 4718 get: function get() { 4719 return Default$4; 4720 } 4721 }]); 4722 return Modal; 4723 }(); 4724 /** 4725 * Data API implementation 4726 */ 4727 4728 $__default["default"](document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { 4729 var _this11 = this; 4730 var target; 4731 var selector = Util.getSelectorFromElement(this); 4732 if (selector) { 4733 target = document.querySelector(selector); 4734 } 4735 var config = $__default["default"](target).data(DATA_KEY$5) ? 'toggle' : _extends$1({}, $__default["default"](target).data(), $__default["default"](this).data()); 4736 if (this.tagName === 'A' || this.tagName === 'AREA') { 4737 event.preventDefault(); 4738 } 4739 var $target = $__default["default"](target).one(EVENT_SHOW$2, function (showEvent) { 4740 if (showEvent.isDefaultPrevented()) { 4741 // Only register focus restorer if modal will actually get shown 4742 return; 4743 } 4744 $target.one(EVENT_HIDDEN$2, function () { 4745 if ($__default["default"](_this11).is(':visible')) { 4746 _this11.focus(); 4747 } 4748 }); 4749 }); 4750 Modal._jQueryInterface.call($__default["default"](target), config, this); 4751 }); 4752 /** 4753 * jQuery 4754 */ 4755 4756 $__default["default"].fn[NAME$5] = Modal._jQueryInterface; 4757 $__default["default"].fn[NAME$5].Constructor = Modal; 4758 $__default["default"].fn[NAME$5].noConflict = function () { 4759 $__default["default"].fn[NAME$5] = JQUERY_NO_CONFLICT$5; 4760 return Modal._jQueryInterface; 4761 }; 4762 4763 /** 4764 * -------------------------------------------------------------------------- 4765 * Bootstrap (v4.6.2): tools/sanitizer.js 4766 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4767 * -------------------------------------------------------------------------- 4768 */ 4769 var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; 4770 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 4771 var DefaultWhitelist = { 4772 // Global attributes allowed on any supplied element below. 4773 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 4774 a: ['target', 'href', 'title', 'rel'], 4775 area: [], 4776 b: [], 4777 br: [], 4778 col: [], 4779 code: [], 4780 div: [], 4781 em: [], 4782 hr: [], 4783 h1: [], 4784 h2: [], 4785 h3: [], 4786 h4: [], 4787 h5: [], 4788 h6: [], 4789 i: [], 4790 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 4791 li: [], 4792 ol: [], 4793 p: [], 4794 pre: [], 4795 s: [], 4796 small: [], 4797 span: [], 4798 sub: [], 4799 sup: [], 4800 strong: [], 4801 u: [], 4802 ul: [] 4803 }; 4804 /** 4805 * A pattern that recognizes a commonly useful subset of URLs that are safe. 4806 * 4807 * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 4808 */ 4809 4810 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; 4811 /** 4812 * A pattern that matches safe data URLs. Only matches image, video and audio types. 4813 * 4814 * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 4815 */ 4816 4817 var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; 4818 function allowedAttribute(attr, allowedAttributeList) { 4819 var attrName = attr.nodeName.toLowerCase(); 4820 if (allowedAttributeList.indexOf(attrName) !== -1) { 4821 if (uriAttrs.indexOf(attrName) !== -1) { 4822 return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)); 4823 } 4824 return true; 4825 } 4826 var regExp = allowedAttributeList.filter(function (attrRegex) { 4827 return attrRegex instanceof RegExp; 4828 }); // Check if a regular expression validates the attribute. 4829 4830 for (var i = 0, len = regExp.length; i < len; i++) { 4831 if (regExp[i].test(attrName)) { 4832 return true; 4833 } 4834 } 4835 return false;
4836 } 4837 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 4838 if (unsafeHtml.length === 0) { 4839 return unsafeHtml; 4840 } 4841 if (sanitizeFn && typeof sanitizeFn === 'function') { 4842 return sanitizeFn(unsafeHtml); 4843 } 4844 var domParser = new window.DOMParser(); 4845 var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 4846 var whitelistKeys = Object.keys(whiteList); 4847 var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); 4848 var _loop = function _loop(i, len) { 4849 var el = elements[i]; 4850 var elName = el.nodeName.toLowerCase(); 4851 if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { 4852 el.parentNode.removeChild(el); 4853 return "continue"; 4854 } 4855 var attributeList = [].slice.call(el.attributes); // eslint-disable-next-line unicorn/prefer-spread 4856 4857 var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); 4858 attributeList.forEach(function (attr) { 4859 if (!allowedAttribute(attr, whitelistedAttributes)) { 4860 el.removeAttribute(attr.nodeName); 4861 } 4862 }); 4863 }; 4864 for (var i = 0, len = elements.length; i < len; i++) { 4865 var _ret = _loop(i); 4866 if (_ret === "continue") continue; 4867 } 4868 return createdDocument.body.innerHTML; 4869 } 4870 4871 /** 4872 * Constants 4873 */ 4874 4875 var NAME$4 = 'tooltip'; 4876 var VERSION$4 = '4.6.2'; 4877 var DATA_KEY$4 = 'bs.tooltip'; 4878 var EVENT_KEY$4 = "." + DATA_KEY$4; 4879 var JQUERY_NO_CONFLICT$4 = $__default["default"].fn[NAME$4]; 4880 var CLASS_PREFIX$1 = 'bs-tooltip'; 4881 var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); 4882 var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; 4883 var CLASS_NAME_FADE$3 = 'fade'; 4884 var CLASS_NAME_SHOW$3 = 'show'; 4885 var HOVER_STATE_SHOW = 'show'; 4886 var HOVER_STATE_OUT = 'out'; 4887 var SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; 4888 var SELECTOR_ARROW = '.arrow'; 4889 var TRIGGER_HOVER = 'hover'; 4890 var TRIGGER_FOCUS = 'focus'; 4891 var TRIGGER_CLICK = 'click'; 4892 var TRIGGER_MANUAL = 'manual'; 4893 var AttachmentMap = { 4894 AUTO: 'auto', 4895 TOP: 'top', 4896 RIGHT: 'right', 4897 BOTTOM: 'bottom', 4898 LEFT: 'left' 4899 }; 4900 var Default$3 = { 4901 animation: true, 4902 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 4903 trigger: 'hover focus', 4904 title: '', 4905 delay: 0, 4906 html: false, 4907 selector: false, 4908 placement: 'top', 4909 offset: 0, 4910 container: false, 4911 fallbackPlacement: 'flip', 4912 boundary: 'scrollParent', 4913 customClass: '', 4914 sanitize: true, 4915 sanitizeFn: null, 4916 whiteList: DefaultWhitelist, 4917 popperConfig: null 4918 }; 4919 var DefaultType$3 = { 4920 animation: 'boolean', 4921 template: 'string', 4922 title: '(string|element|function)', 4923 trigger: 'string', 4924 delay: '(number|object)', 4925 html: 'boolean', 4926 selector: '(string|boolean)', 4927 placement: '(string|function)', 4928 offset: '(number|string|function)', 4929 container: '(string|element|boolean)', 4930 fallbackPlacement: '(string|array)', 4931 boundary: '(string|element)', 4932 customClass: '(string|function)', 4933 sanitize: 'boolean', 4934 sanitizeFn: '(null|function)', 4935 whiteList: 'object', 4936 popperConfig: '(null|object)' 4937 }; 4938 var Event$1 = { 4939 HIDE: "hide" + EVENT_KEY$4, 4940 HIDDEN: "hidden" + EVENT_KEY$4, 4941 SHOW: "show" + EVENT_KEY$4, 4942 SHOWN: "shown" + EVENT_KEY$4, 4943 INSERTED: "inserted" + EVENT_KEY$4, 4944 CLICK: "click" + EVENT_KEY$4, 4945 FOCUSIN: "focusin" + EVENT_KEY$4, 4946 FOCUSOUT: "focusout" + EVENT_KEY$4, 4947 MOUSEENTER: "mouseenter" + EVENT_KEY$4, 4948 MOUSELEAVE: "mouseleave" + EVENT_KEY$4 4949 }; 4950 /** 4951 * Class definition 4952 */ 4953 4954 var Tooltip = /*#__PURE__*/function () { 4955 function Tooltip(element, config) { 4956 if (typeof Popper$1 === 'undefined') { 4957 throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); 4958 } // Private 4959 4960 this._isEnabled = true; 4961 this._timeout = 0; 4962 this._hoverState = ''; 4963 this._activeTrigger = {}; 4964 this._popper = null; // Protected 4965 4966 this.element = element; 4967 this.config = this._getConfig(config); 4968 this.tip = null; 4969 this._setListeners(); 4970 } // Getters 4971 4972 var _proto = Tooltip.prototype; 4973 4974 // Public 4975 _proto.enable = function enable() { 4976 this._isEnabled = true; 4977 }; 4978 _proto.disable = function disable() { 4979 this._isEnabled = false;
4980 }; 4981 _proto.toggleEnabled = function toggleEnabled() { 4982 this._isEnabled = !this._isEnabled; 4983 }; 4984 _proto.toggle = function toggle(event) { 4985 if (!this._isEnabled) { 4986 return; 4987 } 4988 if (event) { 4989 var dataKey = this.constructor.DATA_KEY; 4990 var context = $__default["default"](event.currentTarget).data(dataKey); 4991 if (!context) { 4992 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 4993 $__default["default"](event.currentTarget).data(dataKey, context); 4994 } 4995 context._activeTrigger.click = !context._activeTrigger.click; 4996 if (context._isWithActiveTrigger()) { 4997 context._enter(null, context); 4998 } else { 4999 context._leave(null, context); 5000 } 5001 } else { 5002 if ($__default["default"](this.getTipElement()).hasClass(CLASS_NAME_SHOW$3)) { 5003 this._leave(null, this); 5004 return; 5005 } 5006 this._enter(null, this); 5007 } 5008 }; 5009 _proto.dispose = function dispose() { 5010 clearTimeout(this._timeout); 5011 $__default["default"].removeData(this.element, this.constructor.DATA_KEY); 5012 $__default["default"](this.element).off(this.constructor.EVENT_KEY); 5013 $__default["default"](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler); 5014 if (this.tip) { 5015 $__default["default"](this.tip).remove(); 5016 } 5017 this._isEnabled = null; 5018 this._timeout = null; 5019 this._hoverState = null; 5020 this._activeTrigger = null; 5021 if (this._popper) { 5022 this._popper.destroy(); 5023 } 5024 this._popper = null; 5025 this.element = null; 5026 this.config = null; 5027 this.tip = null; 5028 }; 5029 _proto.show = function show() { 5030 var _this = this; 5031 if ($__default["default"](this.element).css('display') === 'none') { 5032 throw new Error('Please use show on visible elements'); 5033 } 5034 var showEvent = $__default["default"].Event(this.constructor.Event.SHOW); 5035 if (this.isWithContent() && this._isEnabled) { 5036 $__default["default"](this.element).trigger(showEvent); 5037 var shadowRoot = Util.findShadowRoot(this.element); 5038 var isInTheDom = $__default["default"].contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); 5039 if (showEvent.isDefaultPrevented() || !isInTheDom) { 5040 return; 5041 } 5042 var tip = this.getTipElement(); 5043 var tipId = Util.getUID(this.constructor.NAME);
5044 tip.setAttribute('id', tipId); 5045 this.element.setAttribute('aria-describedby', tipId); 5046 this.setContent(); 5047 if (this.config.animation) { 5048 $__default["default"](tip).addClass(CLASS_NAME_FADE$3); 5049 } 5050 var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; 5051 var attachment = this._getAttachment(placement); 5052 this.addAttachmentClass(attachment); 5053 var container = this._getContainer(); 5054 $__default["default"](tip).data(this.constructor.DATA_KEY, this); 5055 if (!$__default["default"].contains(this.element.ownerDocument.documentElement, this.tip)) { 5056 $__default["default"](tip).appendTo(container); 5057 } 5058 $__default["default"](this.element).trigger(this.constructor.Event.INSERTED); 5059 this._popper = new Popper$1(this.element, tip, this._getPopperConfig(attachment)); 5060 $__default["default"](tip).addClass(CLASS_NAME_SHOW$3); 5061 $__default["default"](tip).addClass(this.config.customClass); // If this is a touch-enabled device we add extra 5062 // empty mouseover listeners to the body's immediate children; 5063 // only needed because of broken event delegation on iOS 5064 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 5065 5066 if ('ontouchstart' in document.documentElement) { 5067 $__default["default"](document.body).children().on('mouseover', null, $__default["default"].noop); 5068 } 5069 var complete = function complete() { 5070 if (_this.config.animation) { 5071 _this._fixTransition(); 5072 } 5073 var prevHoverState = _this._hoverState; 5074 _this._hoverState = null; 5075 $__default["default"](_this.element).trigger(_this.constructor.Event.SHOWN); 5076 if (prevHoverState === HOVER_STATE_OUT) { 5077 _this._leave(null, _this); 5078 } 5079 }; 5080 if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE$3)) { 5081 var transitionDuration = Util.getTransitionDurationFromElement(this.tip); 5082 $__default["default"](this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 5083 } else { 5084 complete(); 5085 } 5086 } 5087 }; 5088 _proto.hide = function hide(callback) { 5089 var _this2 = this; 5090 var tip = this.getTipElement(); 5091 var hideEvent = $__default["default"].Event(this.constructor.Event.HIDE); 5092 var complete = function complete() { 5093 if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { 5094 tip.parentNode.removeChild(tip); 5095 } 5096 _this2._cleanTipClass(); 5097 _this2.element.removeAttribute('aria-describedby'); 5098 $__default["default"](_this2.element).trigger(_this2.constructor.Event.HIDDEN); 5099 if (_this2._popper !== null) { 5100 _this2._popper.destroy(); 5101 } 5102 if (callback) { 5103 callback(); 5104 } 5105 }; 5106 $__default["default"](this.element).trigger(hideEvent); 5107 if (hideEvent.isDefaultPrevented()) { 5108 return; 5109 } 5110 $__default["default"](tip).removeClass(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra 5111 // empty mouseover listeners we added for iOS support 5112 5113 if ('ontouchstart' in document.documentElement) { 5114 $__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop); 5115 } 5116 this._activeTrigger[TRIGGER_CLICK] = false; 5117 this._activeTrigger[TRIGGER_FOCUS] = false; 5118 this._activeTrigger[TRIGGER_HOVER] = false; 5119 if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE$3)) { 5120 var transitionDuration = Util.getTransitionDurationFromElement(tip); 5121 $__default["default"](tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 5122 } else { 5123 complete(); 5124 } 5125 this._hoverState = ''; 5126 }; 5127 _proto.update = function update() { 5128 if (this._popper !== null) { 5129 this._popper.scheduleUpdate(); 5130 } 5131 } // Protected 5132 ; 5133 _proto.isWithContent = function isWithContent() { 5134 return Boolean(this.getTitle()); 5135 }; 5136 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 5137 $__default["default"](this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); 5138 }; 5139 _proto.getTipElement = function getTipElement() { 5140 this.tip = this.tip || $__default["default"](this.config.template)[0]; 5141 return this.tip; 5142 }; 5143 _proto.setContent = function setContent() { 5144 var tip = this.getTipElement(); 5145 this.setElementContent($__default["default"](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle()); 5146 $__default["default"](tip).removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$3); 5147 }; 5148 _proto.setElementContent = function setElementContent($element, content) { 5149 if (typeof content === 'object' && (content.nodeType || content.jquery)) { 5150 // Content is a DOM node or a jQuery 5151 if (this.config.html) { 5152 if (!$__default["default"](content).parent().is($element)) { 5153 $element.empty().append(content); 5154 } 5155 } else { 5156 $element.text($__default["default"](content).text()); 5157 } 5158 return; 5159 } 5160 if (this.config.html) { 5161 if (this.config.sanitize) { 5162 content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); 5163 } 5164 $element.html(content); 5165 } else { 5166 $element.text(content); 5167 } 5168 }; 5169 _proto.getTitle = function getTitle() { 5170 var title = this.element.getAttribute('data-original-title'); 5171 if (!title) { 5172 title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; 5173 } 5174 return title; 5175 } // Private 5176 ; 5177 _proto._getPopperConfig = function _getPopperConfig(attachment) { 5178 var _this3 = this; 5179 var defaultBsConfig = { 5180 placement: attachment, 5181 modifiers: { 5182 offset: this._getOffset(), 5183 flip: { 5184 behavior: this.config.fallbackPlacement 5185 }, 5186 arrow: { 5187 element: SELECTOR_ARROW 5188 }, 5189 preventOverflow: {
5190 boundariesElement: this.config.boundary 5191 } 5192 }, 5193 onCreate: function onCreate(data) { 5194 if (data.originalPlacement !== data.placement) { 5195 _this3._handlePopperPlacementChange(data); 5196 } 5197 }, 5198 onUpdate: function onUpdate(data) { 5199 return _this3._handlePopperPlacementChange(data); 5200 } 5201 }; 5202 return _extends$1({}, defaultBsConfig, this.config.popperConfig); 5203 }; 5204 _proto._getOffset = function _getOffset() { 5205 var _this4 = this; 5206 var offset = {}; 5207 if (typeof this.config.offset === 'function') { 5208 offset.fn = function (data) { 5209 data.offsets = _extends$1({}, data.offsets, _this4.config.offset(data.offsets, _this4.element)); 5210 return data; 5211 }; 5212 } else { 5213 offset.offset = this.config.offset; 5214 } 5215 return offset; 5216 }; 5217 _proto._getContainer = function _getContainer() { 5218 if (this.config.container === false) { 5219 return document.body; 5220 } 5221 if (Util.isElement(this.config.container)) { 5222 return $__default["default"](this.config.container); 5223 } 5224 return $__default["default"](document).find(this.config.container); 5225 }; 5226 _proto._getAttachment = function _getAttachment(placement) { 5227 return AttachmentMap[placement.toUpperCase()]; 5228 }; 5229 _proto._setListeners = function _setListeners() { 5230 var _this5 = this; 5231 var triggers = this.config.trigger.split(' '); 5232 triggers.forEach(function (trigger) { 5233 if (trigger === 'click') { 5234 $__default["default"](_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) { 5235 return _this5.toggle(event); 5236 }); 5237 } else if (trigger !== TRIGGER_MANUAL) { 5238 var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN; 5239 var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT; 5240 $__default["default"](_this5.element).on(eventIn, _this5.config.selector, function (event) { 5241 return _this5._enter(event); 5242 }).on(eventOut, _this5.config.selector, function (event) { 5243 return _this5._leave(event); 5244 }); 5245 } 5246 }); 5247 this._hideModalHandler = function () { 5248 if (_this5.element) { 5249 _this5.hide(); 5250 } 5251 }; 5252 $__default["default"](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); 5253 if (this.config.selector) { 5254 this.config = _extends$1({}, this.config, { 5255 trigger: 'manual', 5256 selector: '' 5257 }); 5258 } else { 5259 this._fixTitle(); 5260 } 5261 }; 5262 _proto._fixTitle = function _fixTitle() { 5263 var titleType = typeof this.element.getAttribute('data-original-title'); 5264 if (this.element.getAttribute('title') || titleType !== 'string') { 5265 this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); 5266 this.element.setAttribute('title', ''); 5267 } 5268 }; 5269 _proto._enter = function _enter(event, context) { 5270 var dataKey = this.constructor.DATA_KEY; 5271 context = context || $__default["default"](event.currentTarget).data(dataKey); 5272 if (!context) { 5273 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 5274 $__default["default"](event.currentTarget).data(dataKey, context); 5275 } 5276 if (event) { 5277 context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; 5278 } 5279 if ($__default["default"](context.getTipElement()).hasClass(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) { 5280 context._hoverState = HOVER_STATE_SHOW; 5281 return; 5282 } 5283 clearTimeout(context._timeout); 5284 context._hoverState = HOVER_STATE_SHOW; 5285 if (!context.config.delay || !context.config.delay.show) { 5286 context.show(); 5287 return; 5288 } 5289 context._timeout = setTimeout(function () { 5290 if (context._hoverState === HOVER_STATE_SHOW) { 5291 context.show(); 5292 } 5293 }, context.config.delay.show); 5294 }; 5295 _proto._leave = function _leave(event, context) { 5296 var dataKey = this.constructor.DATA_KEY; 5297 context = context || $__default["default"](event.currentTarget).data(dataKey); 5298 if (!context) { 5299 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 5300 $__default["default"](event.currentTarget).data(dataKey, context); 5301 } 5302 if (event) { 5303 context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
5304 } 5305 if (context._isWithActiveTrigger()) { 5306 return; 5307 } 5308 clearTimeout(context._timeout); 5309 context._hoverState = HOVER_STATE_OUT; 5310 if (!context.config.delay || !context.config.delay.hide) { 5311 context.hide(); 5312 return; 5313 } 5314 context._timeout = setTimeout(function () { 5315 if (context._hoverState === HOVER_STATE_OUT) { 5316 context.hide(); 5317 } 5318 }, context.config.delay.hide); 5319 }; 5320 _proto._isWithActiveTrigger = function _isWithActiveTrigger() { 5321 for (var trigger in this._activeTrigger) { 5322 if (this._activeTrigger[trigger]) { 5323 return true; 5324 } 5325 } 5326 return false; 5327 }; 5328 _proto._getConfig = function _getConfig(config) { 5329 var dataAttributes = $__default["default"](this.element).data(); 5330 Object.keys(dataAttributes).forEach(function (dataAttr) { 5331 if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { 5332 delete dataAttributes[dataAttr]; 5333 } 5334 }); 5335 config = _extends$1({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); 5336 if (typeof config.delay === 'number') { 5337 config.delay = { 5338 show: config.delay, 5339 hide: config.delay 5340 }; 5341 } 5342 if (typeof config.title === 'number') { 5343 config.title = config.title.toString(); 5344 } 5345 if (typeof config.content === 'number') { 5346 config.content = config.content.toString(); 5347 } 5348 Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 5349 if (config.sanitize) { 5350 config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); 5351 } 5352 return config; 5353 }; 5354 _proto._getDelegateConfig = function _getDelegateConfig() { 5355 var config = {}; 5356 if (this.config) { 5357 for (var key in this.config) { 5358 if (this.constructor.Default[key] !== this.config[key]) { 5359 config[key] = this.config[key]; 5360 } 5361 } 5362 } 5363 return config; 5364 }; 5365 _proto._cleanTipClass = function _cleanTipClass() { 5366 var $tip = $__default["default"](this.getTipElement()); 5367 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); 5368 if (tabClass !== null && tabClass.length) { 5369 $tip.removeClass(tabClass.join('')); 5370 } 5371 }; 5372 _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { 5373 this.tip = popperData.instance.popper; 5374 this._cleanTipClass(); 5375 this.addAttachmentClass(this._getAttachment(popperData.placement)); 5376 }; 5377 _proto._fixTransition = function _fixTransition() { 5378 var tip = this.getTipElement(); 5379 var initConfigAnimation = this.config.animation; 5380 if (tip.getAttribute('x-placement') !== null) { 5381 return; 5382 } 5383 $__default["default"](tip).removeClass(CLASS_NAME_FADE$3); 5384 this.config.animation = false; 5385 this.hide(); 5386 this.show(); 5387 this.config.animation = initConfigAnimation; 5388 } // Static 5389 ; 5390 Tooltip._jQueryInterface = function _jQueryInterface(config) { 5391 return this.each(function () { 5392 var $element = $__default["default"](this); 5393 var data = $element.data(DATA_KEY$4); 5394 var _config = typeof config === 'object' && config; 5395 if (!data && /dispose|hide/.test(config)) { 5396 return; 5397 } 5398 if (!data) { 5399 data = new Tooltip(this, _config); 5400 $element.data(DATA_KEY$4, data); 5401 } 5402 if (typeof config === 'string') { 5403 if (typeof data[config] === 'undefined') { 5404 throw new TypeError("No method named \"" + config + "\""); 5405 } 5406 data[config](); 5407 } 5408 }); 5409 }; 5410 _createClass(Tooltip, null, [{ 5411 key: "VERSION", 5412 get: function get() { 5413 return VERSION$4; 5414 } 5415 }, { 5416 key: "Default", 5417 get: function get() { 5418 return Default$3; 5419 } 5420 }, { 5421 key: "NAME", 5422 get: function get() { 5423 return NAME$4; 5424 } 5425 }, { 5426 key: "DATA_KEY", 5427 get: function get() { 5428 return DATA_KEY$4; 5429 } 5430 }, {
5431 key: "Event", 5432 get: function get() { 5433 return Event$1; 5434 } 5435 }, { 5436 key: "EVENT_KEY", 5437 get: function get() { 5438 return EVENT_KEY$4; 5439 } 5440 }, { 5441 key: "DefaultType", 5442 get: function get() { 5443 return DefaultType$3; 5444 } 5445 }]); 5446 return Tooltip; 5447 }(); 5448 /** 5449 * jQuery 5450 */ 5451 5452 $__default["default"].fn[NAME$4] = Tooltip._jQueryInterface; 5453 $__default["default"].fn[NAME$4].Constructor = Tooltip; 5454 $__default["default"].fn[NAME$4].noConflict = function () { 5455 $__default["default"].fn[NAME$4] = JQUERY_NO_CONFLICT$4; 5456 return Tooltip._jQueryInterface; 5457 }; 5458 5459 /** 5460 * Constants 5461 */ 5462 5463 var NAME$3 = 'popover'; 5464 var VERSION$3 = '4.6.2'; 5465 var DATA_KEY$3 = 'bs.popover'; 5466 var EVENT_KEY$3 = "." + DATA_KEY$3; 5467 var JQUERY_NO_CONFLICT$3 = $__default["default"].fn[NAME$3]; 5468 var CLASS_PREFIX = 'bs-popover'; 5469 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); 5470 var CLASS_NAME_FADE$2 = 'fade'; 5471 var CLASS_NAME_SHOW$2 = 'show'; 5472 var SELECTOR_TITLE = '.popover-header'; 5473 var SELECTOR_CONTENT = '.popover-body'; 5474 var Default$2 = _extends$1({}, Tooltip.Default, { 5475 placement: 'right', 5476 trigger: 'click', 5477 content: '', 5478 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 5479 }); 5480 var DefaultType$2 = _extends$1({}, Tooltip.DefaultType, { 5481 content: '(string|element|function)' 5482 }); 5483 var Event = { 5484 HIDE: "hide" + EVENT_KEY$3, 5485 HIDDEN: "hidden" + EVENT_KEY$3, 5486 SHOW: "show" + EVENT_KEY$3, 5487 SHOWN: "shown" + EVENT_KEY$3, 5488 INSERTED: "inserted" + EVENT_KEY$3, 5489 CLICK: "click" + EVENT_KEY$3, 5490 FOCUSIN: "focusin" + EVENT_KEY$3, 5491 FOCUSOUT: "focusout" + EVENT_KEY$3, 5492 MOUSEENTER: "mouseenter" + EVENT_KEY$3, 5493 MOUSELEAVE: "mouseleave" + EVENT_KEY$3 5494 }; 5495 /** 5496 * Class definition 5497 */ 5498 5499 var Popover = /*#__PURE__*/function (_Tooltip) { 5500 _inheritsLoose(Popover, _Tooltip); 5501 function Popover() { 5502 return _Tooltip.apply(this, arguments) || this; 5503 } 5504 var _proto = Popover.prototype; 5505 5506 // Overrides 5507 _proto.isWithContent = function isWithContent() { 5508 return this.getTitle() || this._getContent(); 5509 }; 5510 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 5511 $__default["default"](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 5512 }; 5513 _proto.getTipElement = function getTipElement() { 5514 this.tip = this.tip || $__default["default"](this.config.template)[0]; 5515 return this.tip; 5516 }; 5517 _proto.setContent = function setContent() { 5518 var $tip = $__default["default"](this.getTipElement()); // We use append for html objects to maintain js events 5519 5520 this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle()); 5521 var content = this._getContent(); 5522 if (typeof content === 'function') { 5523 content = content.call(this.element); 5524 } 5525 this.setElementContent($tip.find(SELECTOR_CONTENT), content); 5526 $tip.removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$2); 5527 } // Private 5528 ; 5529 _proto._getContent = function _getContent() { 5530 return this.element.getAttribute('data-content') || this.config.content; 5531 }; 5532 _proto._cleanTipClass = function _cleanTipClass() { 5533 var $tip = $__default["default"](this.getTipElement()); 5534 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 5535 if (tabClass !== null && tabClass.length > 0) { 5536 $tip.removeClass(tabClass.join('')); 5537 } 5538 } // Static 5539 ; 5540 Popover._jQueryInterface = function _jQueryInterface(config) { 5541 return this.each(function () { 5542 var data = $__default["default"](this).data(DATA_KEY$3); 5543 var _config = typeof config === 'object' ? config : null; 5544 if (!data && /dispose|hide/.test(config)) { 5545 return; 5546 } 5547 if (!data) { 5548 data = new Popover(this, _config); 5549 $__default["default"](this).data(DATA_KEY$3, data); 5550 } 5551 if (typeof config === 'string') { 5552 if (typeof data[config] === 'undefined') {
5553 throw new TypeError("No method named \"" + config + "\""); 5554 } 5555 data[config](); 5556 } 5557 }); 5558 }; 5559 _createClass(Popover, null, [{ 5560 key: "VERSION", 5561 get: 5562 // Getters 5563 function get() { 5564 return VERSION$3; 5565 } 5566 }, { 5567 key: "Default", 5568 get: function get() { 5569 return Default$2; 5570 } 5571 }, { 5572 key: "NAME", 5573 get: function get() { 5574 return NAME$3; 5575 } 5576 }, { 5577 key: "DATA_KEY", 5578 get: function get() { 5579 return DATA_KEY$3; 5580 } 5581 }, { 5582 key: "Event", 5583 get: function get() { 5584 return Event; 5585 } 5586 }, { 5587 key: "EVENT_KEY", 5588 get: function get() { 5589 return EVENT_KEY$3; 5590 } 5591 }, { 5592 key: "DefaultType", 5593 get: function get() { 5594 return DefaultType$2; 5595 } 5596 }]); 5597 return Popover; 5598 }(Tooltip); 5599 /** 5600 * jQuery 5601 */ 5602 5603 $__default["default"].fn[NAME$3] = Popover._jQueryInterface; 5604 $__default["default"].fn[NAME$3].Constructor = Popover; 5605 $__default["default"].fn[NAME$3].noConflict = function () { 5606 $__default["default"].fn[NAME$3] = JQUERY_NO_CONFLICT$3; 5607 return Popover._jQueryInterface; 5608 }; 5609 5610 /** 5611 * Constants 5612 */ 5613 5614 var NAME$2 = 'scrollspy'; 5615 var VERSION$2 = '4.6.2'; 5616 var DATA_KEY$2 = 'bs.scrollspy'; 5617 var EVENT_KEY$2 = "." + DATA_KEY$2; 5618 var DATA_API_KEY$1 = '.data-api'; 5619 var JQUERY_NO_CONFLICT$2 = $__default["default"].fn[NAME$2]; 5620 var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; 5621 var CLASS_NAME_ACTIVE$1 = 'active'; 5622 var EVENT_ACTIVATE = "activate" + EVENT_KEY$2; 5623 var EVENT_SCROLL = "scroll" + EVENT_KEY$2; 5624 var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$2 + DATA_API_KEY$1; 5625 var METHOD_OFFSET = 'offset'; 5626 var METHOD_POSITION = 'position'; 5627 var SELECTOR_DATA_SPY = '[data-spy="scroll"]'; 5628 var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; 5629 var SELECTOR_NAV_LINKS = '.nav-link'; 5630 var SELECTOR_NAV_ITEMS = '.nav-item'; 5631 var SELECTOR_LIST_ITEMS = '.list-group-item'; 5632 var SELECTOR_DROPDOWN$1 = '.dropdown'; 5633 var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item'; 5634 var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; 5635 var Default$1 = { 5636 offset: 10, 5637 method: 'auto', 5638 target: '' 5639 }; 5640 var DefaultType$1 = { 5641 offset: 'number', 5642 method: 'string', 5643 target: '(string|element)' 5644 }; 5645 /** 5646 * Class definition 5647 */ 5648 5649 var ScrollSpy = /*#__PURE__*/function () { 5650 function ScrollSpy(element, config) { 5651 var _this = this; 5652 this._element = element; 5653 this._scrollElement = element.tagName === 'BODY' ? window : element; 5654 this._config = this._getConfig(config); 5655 this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS); 5656 this._offsets = []; 5657 this._targets = []; 5658 this._activeTarget = null; 5659 this._scrollHeight = 0; 5660 $__default["default"](this._scrollElement).on(EVENT_SCROLL, function (event) { 5661 return _this._process(event); 5662 }); 5663 this.refresh(); 5664 this._process(); 5665 } // Getters 5666 5667 var _proto = ScrollSpy.prototype; 5668 5669 // Public 5670 _proto.refresh = function refresh() { 5671 var _this2 = this; 5672 var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION; 5673 var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 5674 var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0; 5675 this._offsets = []; 5676 this._targets = []; 5677 this._scrollHeight = this._getScrollHeight(); 5678 var targets = [].slice.call(document.querySelectorAll(this._selector)); 5679 targets.map(function (element) { 5680 var target; 5681 var targetSelector = Util.getSelectorFromElement(element); 5682 if (targetSelector) { 5683 target = document.querySelector(targetSelector); 5684 } 5685 if (target) { 5686 var targetBCR = target.getBoundingClientRect(); 5687 if (targetBCR.width || targetBCR.height) { 5688 // TODO (fat): remove sketch reliance on jQuery position/offset 5689 return [$__default["default"](target)[offsetMethod]().top + offsetBase, targetSelector]; 5690 } 5691 } 5692 return null; 5693 }
5693).filter(Boolean).sort(function (a, b) { 5694 return a[0] - b[0]; 5695 }).forEach(function (item) { 5696 _this2._offsets.push(item[0]); 5697 _this2._targets.push(item[1]); 5698 }); 5699 }; 5700 _proto.dispose = function dispose() { 5701 $__default["default"].removeData(this._element, DATA_KEY$2); 5702 $__default["default"](this._scrollElement).off(EVENT_KEY$2); 5703 this._element = null; 5704 this._scrollElement = null; 5705 this._config = null; 5706 this._selector = null; 5707 this._offsets = null; 5708 this._targets = null; 5709 this._activeTarget = null; 5710 this._scrollHeight = null; 5711 } // Private 5712 ; 5713 _proto._getConfig = function _getConfig(config) { 5714 config = _extends$1({}, Default$1, typeof config === 'object' && config ? config : {}); 5715 if (typeof config.target !== 'string' && Util.isElement(config.target)) { 5716 var id = $__default["default"](config.target).attr('id'); 5717 if (!id) { 5718 id = Util.getUID(NAME$2); 5719 $__default["default"](config.target).attr('id', id); 5720 } 5721 config.target = "#" + id; 5722 } 5723 Util.typeCheckConfig(NAME$2, config, DefaultType$1); 5724 return config; 5725 }; 5726 _proto._getScrollTop = function _getScrollTop() { 5727 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 5728 }; 5729 _proto._getScrollHeight = function _getScrollHeight() { 5730 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 5731 }; 5732 _proto._getOffsetHeight = function _getOffsetHeight() { 5733 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 5734 }; 5735 _proto._process = function _process() { 5736 var scrollTop = this._getScrollTop() + this._config.offset; 5737 var scrollHeight = this._getScrollHeight(); 5738 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 5739 if (this._scrollHeight !== scrollHeight) { 5740 this.refresh(); 5741 } 5742 if (scrollTop >= maxScroll) { 5743 var target = this._targets[this._targets.length - 1]; 5744 if (this._activeTarget !== target) { 5745 this._activate(target); 5746 } 5747 return; 5748 } 5749 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 5750 this._activeTarget = null; 5751 this._clear(); 5752 return; 5753 } 5754 for (var i = this._offsets.length; i--;) { 5755 var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 5756 if (isActiveTarget) { 5757 this._activate(this._targets[i]); 5758 } 5759 } 5760 }; 5761 _proto._activate = function _activate(target) { 5762 this._activeTarget = target; 5763 this._clear(); 5764 var queries = this._selector.split(',').map(function (selector) { 5765 return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; 5766 }); 5767 var $link = $__default["default"]([].slice.call(document.querySelectorAll(queries.join(',')))); 5768 if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) { 5769 $link.closest(SELECTOR_DROPDOWN$1).find(SELECTOR_DROPDOWN_TOGGLE$1).addClass(CLASS_NAME_ACTIVE$1); 5770 $link.addClass(CLASS_NAME_ACTIVE$1); 5771 } else { 5772 // Set triggered link as active 5773 $link.addClass(CLASS_NAME_ACTIVE$1); // Set triggered links parents as active 5774 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 5775 5776 $link.parents(SELECTOR_NAV_LIST_GROUP$1).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$1); // Handle special case when .nav-link is inside .nav-item 5777 5778 $link.parents(SELECTOR_NAV_LIST_GROUP$1).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$1); 5779 } 5780 $__default["default"](this._scrollElement).trigger(EVENT_ACTIVATE, { 5781 relatedTarget: target 5782 }); 5783 }; 5784 _proto._clear = function _clear() { 5785 [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) { 5786 return node.classList.contains(CLASS_NAME_ACTIVE$1); 5787 }
5787).forEach(function (node) { 5788 return node.classList.remove(CLASS_NAME_ACTIVE$1); 5789 }); 5790 } // Static 5791 ; 5792 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 5793 return this.each(function () { 5794 var data = $__default["default"](this).data(DATA_KEY$2); 5795 var _config = typeof config === 'object' && config; 5796 if (!data) { 5797 data = new ScrollSpy(this, _config); 5798 $__default["default"](this).data(DATA_KEY$2, data); 5799 } 5800 if (typeof config === 'string') { 5801 if (typeof data[config] === 'undefined') { 5802 throw new TypeError("No method named \"" + config + "\""); 5803 } 5804 data[config](); 5805 } 5806 }); 5807 }; 5808 _createClass(ScrollSpy, null, [{ 5809 key: "VERSION", 5810 get: function get() { 5811 return VERSION$2; 5812 } 5813 }, { 5814 key: "Default", 5815 get: function get() { 5816 return Default$1; 5817 } 5818 }]); 5819 return ScrollSpy; 5820 }(); 5821 /** 5822 * Data API implementation 5823 */ 5824 5825 $__default["default"](window).on(EVENT_LOAD_DATA_API, function () { 5826 var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY)); 5827 var scrollSpysLength = scrollSpys.length; 5828 for (var i = scrollSpysLength; i--;) { 5829 var $spy = $__default["default"](scrollSpys[i]); 5830 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 5831 } 5832 }); 5833 /** 5834 * jQuery 5835 */ 5836 5837 $__default["default"].fn[NAME$2] = ScrollSpy._jQueryInterface; 5838 $__default["default"].fn[NAME$2].Constructor = ScrollSpy; 5839 $__default["default"].fn[NAME$2].noConflict = function () { 5840 $__default["default"].fn[NAME$2] = JQUERY_NO_CONFLICT$2; 5841 return ScrollSpy._jQueryInterface; 5842 }; 5843 5844 /** 5845 * Constants 5846 */ 5847 5848 var NAME$1 = 'tab'; 5849 var VERSION$1 = '4.6.2'; 5850 var DATA_KEY$1 = 'bs.tab'; 5851 var EVENT_KEY$1 = "." + DATA_KEY$1; 5852 var DATA_API_KEY = '.data-api'; 5853 var JQUERY_NO_CONFLICT$1 = $__default["default"].fn[NAME$1]; 5854 var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; 5855 var CLASS_NAME_ACTIVE = 'active'; 5856 var CLASS_NAME_DISABLED = 'disabled'; 5857 var CLASS_NAME_FADE$1 = 'fade'; 5858 var CLASS_NAME_SHOW$1 = 'show'; 5859 var EVENT_HIDE$1 = "hide" + EVENT_KEY$1; 5860 var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$1; 5861 var EVENT_SHOW$1 = "show" + EVENT_KEY$1; 5862 var EVENT_SHOWN$1 = "shown" + EVENT_KEY$1; 5863 var EVENT_CLICK_DATA_API = "click" + EVENT_KEY$1 + DATA_API_KEY; 5864 var SELECTOR_DROPDOWN = '.dropdown'; 5865 var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; 5866 var SELECTOR_ACTIVE = '.active'; 5867 var SELECTOR_ACTIVE_UL = '> li > .active'; 5868 var SELECTOR_DATA_TOGGLE = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]'; 5869 var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; 5870 var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active'; 5871 /** 5872 * Class definition 5873 */ 5874 5875 var Tab = /*#__PURE__*/function () { 5876 function Tab(element) { 5877 this._element = element; 5878 } // Getters 5879 5880 var _proto = Tab.prototype; 5881 5882 // Public 5883 _proto.show = function show() { 5884 var _this = this; 5885 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $__default["default"](this._element).hasClass(CLASS_NAME_ACTIVE) || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED) || this._element.hasAttribute('disabled')) { 5886 return; 5887 } 5888 var target; 5889 var previous; 5890 var listElement = $__default["default"](this._element).closest(SELECTOR_NAV_LIST_GROUP)[0]; 5891 var selector = Util.getSelectorFromElement(this._element); 5892 if (listElement) { 5893 var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE; 5894 previous = $__default["default"].makeArray($__default["default"](listElement).find(itemSelector)); 5895 previous = previous[previous.length - 1]; 5896 } 5897 var hideEvent = $__default["default"].Event(EVENT_HIDE$1, { 5898 relatedTarget: this._element 5899 }); 5900 var showEvent = $__default["default"].Event(EVENT_SHOW$1, { 5901 relatedTarget: previous 5902 }); 5903 if (previous) { 5904 $__default["default"](previous).trigger(hideEvent); 5905 } 5906 $__default["default"](this._element).trigger(showEvent); 5907 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 5908 return; 5909 } 5910 if (selector) { 5911 target = document.querySelector(selector); 5912 } 5913 this._activate(this._element, listElement); 5914 var complete = function complete() { 5915 var hiddenEvent = $__default["default"].Event(EVENT_HIDDEN$1, { 5916 relatedTarget: _this._element 5917 }); 5918 var shownEvent = $__default["default"].Event(EVENT_SHOWN$1, { 5919 relatedTarget: previous 5920 }); 5921 $__default["default"](previous).trigger(hiddenEvent); 5922 $__default["default"](_this._element).trigger(shownEvent); 5923 }; 5924 if (target) { 5925 this._activate(target, target.parentNode, complete); 5926 } else { 5927 complete(); 5928 } 5929 }; 5930 _proto.dispose = function dispose() { 5931 $__default["default"].removeData(this._element, DATA_KEY$1); 5932 this._element = null; 5933 } // Private 5934 ; 5935 _proto._activate = function _activate(element, container, callback) { 5936 var _this2 = this; 5937 var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $__default["default"](container).find(SELECTOR_ACTIVE_UL) : $__default["default"](container).children(SELECTOR_ACTIVE); 5938 var active = activeElements[0]; 5939 var isTransitioning = callback && active && $__default["default"](active).hasClass(CLASS_NAME_FADE$1); 5940 var complete = function complete() { 5941 return _this2._transitionComplete(element, active, callback); 5942 }; 5943 if (active && isTransitioning) { 5944 var transitionDuration = Util.getTransitionDurationFromElement(active); 5945 $__default["default"](active).removeClass(CLASS_NAME_SHOW$1).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 5946 } else { 5947 complete(); 5948 } 5949 }; 5950 _proto._transitionComplete = function _transitionComplete(element, active, callback) { 5951 if (active) { 5952 $__default["default"](active).removeClass(CLASS_NAME_ACTIVE);
5953 var dropdownChild = $__default["default"](active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0]; 5954 if (dropdownChild) { 5955 $__default["default"](dropdownChild).removeClass(CLASS_NAME_ACTIVE); 5956 } 5957 if (active.getAttribute('role') === 'tab') { 5958 active.setAttribute('aria-selected', false); 5959 } 5960 } 5961 $__default["default"](element).addClass(CLASS_NAME_ACTIVE); 5962 if (element.getAttribute('role') === 'tab') { 5963 element.setAttribute('aria-selected', true); 5964 } 5965 Util.reflow(element); 5966 if (element.classList.contains(CLASS_NAME_FADE$1)) { 5967 element.classList.add(CLASS_NAME_SHOW$1); 5968 } 5969 var parent = element.parentNode; 5970 if (parent && parent.nodeName === 'LI') { 5971 parent = parent.parentNode; 5972 } 5973 if (parent && $__default["default"](parent).hasClass(CLASS_NAME_DROPDOWN_MENU)) { 5974 var dropdownElement = $__default["default"](element).closest(SELECTOR_DROPDOWN)[0]; 5975 if (dropdownElement) { 5976 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE)); 5977 $__default["default"](dropdownToggleList).addClass(CLASS_NAME_ACTIVE); 5978 } 5979 element.setAttribute('aria-expanded', true); 5980 } 5981 if (callback) { 5982 callback(); 5983 } 5984 } // Static 5985 ; 5986 Tab._jQueryInterface = function _jQueryInterface(config) { 5987 return this.each(function () { 5988 var $this = $__default["default"](this); 5989 var data = $this.data(DATA_KEY$1); 5990 if (!data) { 5991 data = new Tab(this); 5992 $this.data(DATA_KEY$1, data); 5993 } 5994 if (typeof config === 'string') { 5995 if (typeof data[config] === 'undefined') { 5996 throw new TypeError("No method named \"" + config + "\""); 5997 } 5998 data[config](); 5999 } 6000 }); 6001 }; 6002 _createClass(Tab, null, [{ 6003 key: "VERSION", 6004 get: function get() { 6005 return VERSION$1; 6006 } 6007 }]); 6008 return Tab; 6009 }(); 6010 /** 6011 * Data API implementation 6012 */ 6013 6014 $__default["default"](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { 6015 event.preventDefault(); 6016 Tab._jQueryInterface.call($__default["default"](this), 'show'); 6017 }); 6018 /** 6019 * jQuery 6020 */ 6021 6022 $__default["default"].fn[NAME$1] = Tab._jQueryInterface; 6023 $__default["default"].fn[NAME$1].Constructor = Tab; 6024 $__default["default"].fn[NAME$1].noConflict = function () { 6025 $__default["default"].fn[NAME$1] = JQUERY_NO_CONFLICT$1; 6026 return Tab._jQueryInterface; 6027 }; 6028 6029 /** 6030 * Constants 6031 */ 6032 6033 var NAME = 'toast'; 6034 var VERSION = '4.6.2'; 6035 var DATA_KEY = 'bs.toast'; 6036 var EVENT_KEY = "." + DATA_KEY; 6037 var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME]; 6038 var CLASS_NAME_FADE = 'fade'; 6039 var CLASS_NAME_HIDE = 'hide'; 6040 var CLASS_NAME_SHOW = 'show'; 6041 var CLASS_NAME_SHOWING = 'showing'; 6042 var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY; 6043 var EVENT_HIDE = "hide" + EVENT_KEY; 6044 var EVENT_HIDDEN = "hidden" + EVENT_KEY; 6045 var EVENT_SHOW = "show" + EVENT_KEY; 6046 var EVENT_SHOWN = "shown" + EVENT_KEY; 6047 var SELECTOR_DATA_DISMISS = '[data-dismiss="toast"]'; 6048 var Default = { 6049 animation: true, 6050 autohide: true, 6051 delay: 500 6052 }; 6053 var DefaultType = { 6054 animation: 'boolean', 6055 autohide: 'boolean', 6056 delay: 'number' 6057 }; 6058 /** 6059 * Class definition 6060 */ 6061 6062 var Toast = /*#__PURE__*/function () { 6063 function Toast(element, config) { 6064 this._element = element; 6065 this._config = this._getConfig(config); 6066 this._timeout = null; 6067 this._setListeners(); 6068 } // Getters 6069 6070 var _proto = Toast.prototype; 6071 6072 // Public 6073 _proto.show = function show() { 6074 var _this = this; 6075 var showEvent = $__default["default"].Event(EVENT_SHOW); 6076 $__default["default"](this._element).trigger(showEvent); 6077 if (showEvent.isDefaultPrevented()) { 6078 return; 6079 } 6080 this._clearTimeout(); 6081 if (this._config.animation) { 6082 this._element.classList.add(CLASS_NAME_FADE); 6083 } 6084 var complete = function complete() { 6085 _this._element.classList.remove(CLASS_NAME_SHOWING); 6086 _this._element.classList.add(CLASS_NAME_SHOW); 6087 $__default["default"](_this._element).trigger(EVENT_SHOWN); 6088 if (_this._config.autohide) { 6089 _this._timeout = setTimeout(function () { 6090 _this.hide(); 6091 }, _this._config.delay); 6092 } 6093 }; 6094 this._element.classList.remove(CLASS_NAME_HIDE); 6095 Util.reflow(this._element); 6096 this._element.classList.add(CLASS_NAME_SHOWING); 6097 if (this._config.animation) { 6098 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 6099 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6100 } else { 6101 complete(); 6102 } 6103 }; 6104 _proto.hide = function hide() { 6105 if (!this._element.classList.contains(CLASS_NAME_SHOW)) { 6106 return; 6107 } 6108 var hideEvent = $__default["default"].Event(EVENT_HIDE); 6109 $__default["default"](this._element).trigger(hideEvent); 6110 if (hideEvent.isDefaultPrevented()) { 6111 return; 6112 } 6113 this._close(); 6114 }; 6115 _proto.dispose = function dispose() { 6116 this._clearTimeout(); 6117 if (this._element.classList.contains(CLASS_NAME_SHOW)) { 6118 this._element.classList.remove(CLASS_NAME_SHOW); 6119 } 6120 $__default["default"](this._element).off(EVENT_CLICK_DISMISS); 6121 $__default["default"].removeData(this._element, DATA_KEY); 6122 this._element = null; 6123 this._config = null; 6124 } // Private 6125 ; 6126 _proto._getConfig = function _getConfig(config) { 6127 config = _extends$1({}, Default, $__default["default"](this._element).data(), typeof config === 'object' && config ? config : {}); 6128 Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); 6129 return config; 6130 }; 6131 _proto._setListeners = function _setListeners() { 6132 var _this2 = this; 6133 $__default["default"](this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () { 6134 return _this2.hide(); 6135 }); 6136 }; 6137 _proto._close = function _close() { 6138 var _this3 = this; 6139 var complete = function complete() { 6140 _this3._element.classList.add(CLASS_NAME_HIDE); 6141 $__default["default"](_this3._element).trigger(EVENT_HIDDEN); 6142 }; 6143 this._element.classList.remove(CLASS_NAME_SHOW); 6144 if (this._config.animation) { 6145 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 6146 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6147 } else { 6148 complete(); 6149 } 6150 }; 6151 _proto._clearTimeout = function _clearTimeout() { 6152 clearTimeout(this._timeout); 6153 this._timeout = null; 6154 } // Static 6155 ; 6156 Toast._jQueryInterface = function _jQueryInterface(config) { 6157 return this.each(function () { 6158 var $element = $__default["default"](this); 6159 var data = $element.data(DATA_KEY); 6160 var _config = typeof config === 'object' && config; 6161 if (!data) { 6162 data = new Toast(this, _config); 6163 $element.data(DATA_KEY, data); 6164 } 6165 if (typeof config === 'string') { 6166 if (typeof data[config] === 'undefined') {
6167 throw new TypeError("No method named \"" + config + "\""); 6168 } 6169 data[config](this); 6170 } 6171 }); 6172 }; 6173 _createClass(Toast, null, [{ 6174 key: "VERSION", 6175 get: function get() { 6176 return VERSION; 6177 } 6178 }, { 6179 key: "DefaultType", 6180 get: function get() { 6181 return DefaultType; 6182 } 6183 }, { 6184 key: "Default", 6185 get: function get() { 6186 return Default; 6187 } 6188 }]); 6189 return Toast; 6190 }(); 6191 /** 6192 * jQuery 6193 */ 6194 6195 $__default["default"].fn[NAME] = Toast._jQueryInterface; 6196 $__default["default"].fn[NAME].Constructor = Toast; 6197 $__default["default"].fn[NAME].noConflict = function () { 6198 $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT; 6199 return Toast._jQueryInterface; 6200 }; 6201 exports.Alert = Alert; 6202 exports.Button = Button; 6203 exports.Carousel = Carousel; 6204 exports.Collapse = Collapse; 6205 exports.Dropdown = Dropdown; 6206 exports.Modal = Modal; 6207 exports.Popover = Popover; 6208 exports.Scrollspy = ScrollSpy; 6209 exports.Tab = Tab; 6210 exports.Toast = Toast; 6211 exports.Tooltip = Tooltip; 6212 exports.Util = Util; 6213 Object.defineProperty(exports, '__esModule', { 6214 value: true 6215 }); 6216}); 6217 6218/* 6219 _ _ _ _ 6220 ___| (_) ___| | __ (_)___ 6221/ __| | |/ __| |/ / | / __| 6222\__ \ | | (__| < _ | \__ \ 6223|___/_|_|\___|_|\_(_)/ |___/ 6224 |__/ 6225 6226 Version: 1.8.1 6227 Author: Ken Wheeler 6228 Website: http://kenwheeler.github.io 6229 Docs: http://kenwheeler.github.io/slick 6230 Repo: http://github.com/kenwheeler/slick 6231 Issues: http://github.com/kenwheeler/slick/issues 6232 6233 */ 6234/* global window, document, define, jQuery, setInterval, clearInterval */ 6235; 6236(function (factory) { 6237 'use strict'; 6238 6239 if (typeof define === 'function' && define.amd) { 6240 define(['jquery'], factory); 6241 } else if (typeof exports !== 'undefined') { 6242 module.exports = factory(require('jquery')); 6243 } else { 6244 factory(jQuery); 6245 } 6246})(function ($) { 6247 'use strict'; 6248 6249 var Slick = window.Slick || {}; 6250 Slick = function () { 6251 var instanceUid = 0; 6252 function Slick(element, settings) { 6253 var _ = this, 6254 dataSettings; 6255 _.defaults = { 6256 accessibility: true, 6257 adaptiveHeight: false, 6258 appendArrows: $(element), 6259 appendDots: $(element), 6260 arrows: true, 6261 asNavFor: null, 6262 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 6263 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 6264 autoplay: false, 6265 autoplaySpeed: 3000, 6266 centerMode: false, 6267 centerPadding: '50px', 6268 cssEase: 'ease', 6269 customPaging: function (slider, i) { 6270 return $('<button type="button" />').text(i + 1); 6271 }, 6272 dots: false, 6273 dotsClass: 'slick-dots', 6274 draggable: true, 6275 easing: 'linear', 6276 edgeFriction: 0.35, 6277 fade: false, 6278 focusOnSelect: false, 6279 focusOnChange: false, 6280 infinite: true, 6281 initialSlide: 0, 6282 lazyLoad: 'ondemand', 6283 mobileFirst: false, 6284 pauseOnHover: true, 6285 pauseOnFocus: true, 6286 pauseOnDotsHover: false, 6287 respondTo: 'window', 6288 responsive: null, 6289 rows: 1, 6290 rtl: false, 6291 slide: '', 6292 slidesPerRow: 1, 6293 slidesToShow: 1, 6294 slidesToScroll: 1, 6295 speed: 500, 6296 swipe: true, 6297 swipeToSlide: false, 6298 touchMove: true, 6299 touchThreshold: 5, 6300 useCSS: true, 6301 useTransform: true, 6302 variableWidth: false, 6303 vertical: false, 6304 verticalSwiping: false, 6305 waitForAnimate: true, 6306 zIndex: 1000 6307 }; 6308 _.initials = { 6309 animating: false, 6310 dragging: false, 6311 autoPlayTimer: null, 6312 currentDirection: 0, 6313 currentLeft: null, 6314 currentSlide: 0, 6315 direction: 1, 6316 $dots: null, 6317 listWidth: null, 6318 listHeight: null, 6319 loadIndex: 0, 6320 $nextArrow: null, 6321 $prevArrow: null, 6322 scrolling: false, 6323 slideCount: null, 6324 slideWidth: null, 6325 $slideTrack: null, 6326 $slides: null, 6327 sliding: false, 6328 slideOffset: 0, 6329 swipeLeft: null, 6330 swiping: false, 6331 $list: null, 6332 touchObject: {}, 6333 transformsEnabled: false,
vendor: 5,074 bytes, lines 6334-6486
6334 unslicked: false 6335 }; 6336 $.extend(_, _.initials); 6337 _.activeBreakpoint = null; 6338 _.animType = null; 6339 _.animProp = null; 6340 _.breakpoints = []; 6341 _.breakpointSettings = []; 6342 _.cssTransitions = false; 6343 _.focussed = false; 6344 _.interrupted = false; 6345 _.hidden = 'hidden'; 6346 _.paused = true; 6347 _.positionProp = null; 6348 _.respondTo = null; 6349 _.rowCount = 1; 6350 _.shouldClick = true; 6351 _.$slider = $(element); 6352 _.$slidesCache = null; 6353 _.transformType = null; 6354 _.transitionType = null; 6355 _.visibilityChange = 'visibilitychange'; 6356 _.windowWidth = 0; 6357 _.windowTimer = null; 6358 dataSettings = $(element).data('slick') || {}; 6359 _.options = $.extend({}, _.defaults, settings, dataSettings); 6360 _.currentSlide = _.options.initialSlide; 6361 _.originalSettings = _.options; 6362 if (typeof document.mozHidden !== 'undefined') { 6363 _.hidden = 'mozHidden'; 6364 _.visibilityChange = 'mozvisibilitychange'; 6365 } else if (typeof document.webkitHidden !== 'undefined') { 6366 _.hidden = 'webkitHidden'; 6367 _.visibilityChange = 'webkitvisibilitychange'; 6368 } 6369 _.autoPlay = $.proxy(_.autoPlay, _); 6370 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 6371 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 6372 _.changeSlide = $.proxy(_.changeSlide, _); 6373 _.clickHandler = $.proxy(_.clickHandler, _); 6374 _.selectHandler = $.proxy(_.selectHandler, _); 6375 _.setPosition = $.proxy(_.setPosition, _); 6376 _.swipeHandler = $.proxy(_.swipeHandler, _); 6377 _.dragHandler = $.proxy(_.dragHandler, _); 6378 _.keyHandler = $.proxy(_.keyHandler, _); 6379 _.instanceUid = instanceUid++; 6380 6381 // A simple way to check for HTML strings 6382 // Strict HTML recognition (must start with <) 6383 // Extracted from jQuery v1.11 source 6384 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 6385 _.registerBreakpoints(); 6386 _.init(true); 6387 } 6388 return Slick; 6389 }(); 6390 Slick.prototype.activateADA = function () { 6391 var _ = this; 6392 _.$slideTrack.find('.slick-active').attr({ 6393 'aria-hidden': 'false' 6394 }).find('a, input, button, select').attr({ 6395 'tabindex': '0' 6396 }); 6397 }; 6398 Slick.prototype.addSlide = Slick.prototype.slickAdd = function (markup, index, addBefore) { 6399 var _ = this; 6400 if (typeof index === 'boolean') { 6401 addBefore = index; 6402 index = null; 6403 } else if (index < 0 || index >= _.slideCount) { 6404 return false; 6405 } 6406 _.unload(); 6407 if (typeof index === 'number') { 6408 if (index === 0 && _.$slides.length === 0) { 6409 $(markup).appendTo(_.$slideTrack); 6410 } else if (addBefore) { 6411 $(markup).insertBefore(_.$slides.eq(index)); 6412 } else { 6413 $(markup).insertAfter(_.$slides.eq(index)); 6414 } 6415 } else { 6416 if (addBefore === true) { 6417 $(markup).prependTo(_.$slideTrack); 6418 } else { 6419 $(markup).appendTo(_.$slideTrack); 6420 } 6421 } 6422 _.$slides = _.$slideTrack.children(this.options.slide); 6423 _.$slideTrack.children(this.options.slide).detach(); 6424 _.$slideTrack.append(_.$slides); 6425 _.$slides.each(function (index, element) { 6426 $(element).attr('data-slick-index', index); 6427 }); 6428 _.$slidesCache = _.$slides; 6429 _.reinit(); 6430 }; 6431 Slick.prototype.animateHeight = function () { 6432 var _ = this; 6433 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 6434 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 6435 _.$list.animate({ 6436 height: targetHeight 6437 }, _.options.speed); 6438 } 6439 }; 6440 Slick.prototype.animateSlide = function (targetLeft, callback) { 6441 var animProps = {}, 6442 _ = this; 6443 _.animateHeight(); 6444 if (_.options.rtl === true && _.options.vertical === false) { 6445 targetLeft = -targetLeft; 6446 } 6447 if (_.transformsEnabled === false) { 6448 if (_.options.vertical === false) { 6449 _.$slideTrack.animate({ 6450 left: targetLeft 6451 }, _.options.speed, _.options.easing, callback); 6452 } else { 6453 _.$slideTrack.animate({ 6454 top: targetLeft 6455 }, _.options.speed, _.options.easing, callback); 6456 } 6457 } else { 6458 if (_.cssTransitions === false) { 6459 if (_.options.rtl === true) { 6460 _.currentLeft = -_.currentLeft; 6461 } 6462 $({ 6463 animStart: _.currentLeft 6464 }).animate({ 6465 animStart: targetLeft 6466 }, { 6467 duration: _.options.speed, 6468 easing: _.options.easing, 6469 step: function (now) { 6470 now = Math.ceil(now); 6471 if (_.options.vertical === false) { 6472 animProps[_.animType] = 'translate(' + now + 'px, 0px)'; 6473 _.$slideTrack.css(animProps); 6474 } else { 6475 animProps[_.animType] = 'translate(0px,' + now + 'px)'; 6476 _.$slideTrack.css(animProps); 6477 } 6478 }, 6479 complete: function () { 6480 if (callback) { 6481 callback.call(); 6482 } 6483 } 6484 }); 6485 } else { 6486 _.applyTransition();
6487 targetLeft = Math.ceil(targetLeft); 6488 if (_.options.vertical === false) { 6489 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 6490 } else { 6491 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 6492 } 6493 _.$slideTrack.css(animProps); 6494 if (callback) { 6495 setTimeout(function () { 6496 _.disableTransition(); 6497 callback.call(); 6498 }, _.options.speed); 6499 } 6500 } 6501 } 6502 }; 6503 Slick.prototype.getNavTarget = function () { 6504 var _ = this, 6505 asNavFor = _.options.asNavFor; 6506 if (asNavFor && asNavFor !== null) { 6507 asNavFor = $(asNavFor).not(_.$slider); 6508 } 6509 return asNavFor; 6510 }; 6511 Slick.prototype.asNavFor = function (index) { 6512 var _ = this, 6513 asNavFor = _.getNavTarget(); 6514 if (asNavFor !== null && typeof asNavFor === 'object') { 6515 asNavFor.each(function () { 6516 var target = $(this).slick('getSlick'); 6517 if (!target.unslicked) { 6518 target.slideHandler(index, true); 6519 } 6520 }); 6521 } 6522 }; 6523 Slick.prototype.applyTransition = function (slide) { 6524 var _ = this, 6525 transition = {}; 6526 if (_.options.fade === false) { 6527 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 6528 } else { 6529 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 6530 } 6531 if (_.options.fade === false) { 6532 _.$slideTrack.css(transition); 6533 } else { 6534 _.$slides.eq(slide).css(transition); 6535 } 6536 }; 6537 Slick.prototype.autoPlay = function () { 6538 var _ = this; 6539 _.autoPlayClear(); 6540 if (_.slideCount > _.options.slidesToShow) { 6541 _.autoPlayTimer = setInterval(_.autoPlayIterator, _.options.autoplaySpeed); 6542 } 6543 }; 6544 Slick.prototype.autoPlayClear = function () { 6545 var _ = this; 6546 if (_.autoPlayTimer) { 6547 clearInterval(_.autoPlayTimer); 6548 } 6549 }; 6550 Slick.prototype.autoPlayIterator = function () { 6551 var _ = this, 6552 slideTo = _.currentSlide + _.options.slidesToScroll; 6553 if (!_.paused && !_.interrupted && !_.focussed) { 6554 if (_.options.infinite === false) { 6555 if (_.direction === 1 && _.currentSlide + 1 === _.slideCount - 1) { 6556 _.direction = 0; 6557 } else if (_.direction === 0) { 6558 slideTo = _.currentSlide - _.options.slidesToScroll; 6559 if (_.currentSlide - 1 === 0) { 6560 _.direction = 1; 6561 } 6562 } 6563 } 6564 _.slideHandler(slideTo); 6565 } 6566 }; 6567 Slick.prototype.buildArrows = function () { 6568 var _ = this; 6569 if (_.options.arrows === true) { 6570 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 6571 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 6572 if (_.slideCount > _.options.slidesToShow) { 6573 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 6574 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 6575 if (_.htmlExpr.test(_.options.prevArrow)) { 6576 _.$prevArrow.prependTo(_.options.appendArrows); 6577 } 6578 if (_.htmlExpr.test(_.options.nextArrow)) { 6579 _.$nextArrow.appendTo(_.options.appendArrows); 6580 } 6581 if (_.options.infinite !== true) { 6582 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 6583 } 6584 } else { 6585 _.$prevArrow.add(_.$nextArrow).addClass('slick-hidden').attr({ 6586 'aria-disabled': 'true', 6587 'tabindex': '-1' 6588 }); 6589 } 6590 } 6591 }; 6592 Slick.prototype.buildDots = function () { 6593 var _ = this, 6594 i, 6595 dot; 6596 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 6597 _.$slider.addClass('slick-dotted'); 6598 dot = $('<ul />').addClass(_.options.dotsClass); 6599 for (i = 0; i <= _.getDotCount(); i += 1) { 6600 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 6601 } 6602 _.$dots = dot.appendTo(_.options.appendDots); 6603 _.$dots.find('li').first().addClass('slick-active'); 6604 } 6605 }; 6606 Slick.prototype.buildOut = function () { 6607 var _ = this; 6608 _.$slides = _.$slider.children(_.options.slide + ':not(.slick-cloned)').addClass('slick-slide'); 6609 _.slideCount = _.$slides.length; 6610 _.$slides.each(function (index, element) { 6611 $(element).attr('data-slick-index', index).data('originalStyling', $(element).attr('style') || ''); 6612 }); 6613 _.$slider.addClass('slick-slider'); 6614 _.$slideTrack = _.slideCount === 0 ? $('<div class="slick-track"/>').appendTo(_.$slider) : _.$slides.wrapAll('<div class="slick-track"/>').parent(); 6615 _.$list = _.$slideTrack.wrap('<div class="slick-list"/>').parent(); 6616 _.$slideTrack.css('opacity', 0); 6617 if (_.options.centerMode === true || _.options.swipeToSlide === true) {
6618 _.options.slidesToScroll = 1; 6619 } 6620 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 6621 _.setupInfinite(); 6622 _.buildArrows(); 6623 _.buildDots(); 6624 _.updateDots(); 6625 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 6626 if (_.options.draggable === true) { 6627 _.$list.addClass('draggable'); 6628 } 6629 }; 6630 Slick.prototype.buildRows = function () { 6631 var _ = this, 6632 a, 6633 b, 6634 c, 6635 newSlides, 6636 numOfSlides, 6637 originalSlides, 6638 slidesPerSection; 6639 newSlides = document.createDocumentFragment(); 6640 originalSlides = _.$slider.children(); 6641 if (_.options.rows > 0) { 6642 slidesPerSection = _.options.slidesPerRow * _.options.rows; 6643 numOfSlides = Math.ceil(originalSlides.length / slidesPerSection); 6644 for (a = 0; a < numOfSlides; a++) { 6645 var slide = document.createElement('div'); 6646 for (b = 0; b < _.options.rows; b++) { 6647 var row = document.createElement('div'); 6648 for (c = 0; c < _.options.slidesPerRow; c++) { 6649 var target = a * slidesPerSection + (b * _.options.slidesPerRow + c); 6650 if (originalSlides.get(target)) { 6651 row.appendChild(originalSlides.get(target)); 6652 } 6653 } 6654 slide.appendChild(row); 6655 } 6656 newSlides.appendChild(slide); 6657 } 6658 _.$slider.empty().append(newSlides); 6659 _.$slider.children().children().children().css({ 6660 'width': 100 / _.options.slidesPerRow + '%', 6661 'display': 'inline-block' 6662 }); 6663 } 6664 }; 6665 Slick.prototype.checkResponsive = function (initial, forceUpdate) { 6666 var _ = this, 6667 breakpoint, 6668 targetBreakpoint, 6669 respondToWidth, 6670 triggerBreakpoint = false; 6671 var sliderWidth = _.$slider.width(); 6672 var windowWidth = window.innerWidth || $(window).width(); 6673 if (_.respondTo === 'window') { 6674 respondToWidth = windowWidth; 6675 } else if (_.respondTo === 'slider') { 6676 respondToWidth = sliderWidth; 6677 } else if (_.respondTo === 'min') { 6678 respondToWidth = Math.min(windowWidth, sliderWidth); 6679 } 6680 if (_.options.responsive && _.options.responsive.length && _.options.responsive !== null) { 6681 targetBreakpoint = null; 6682 for (breakpoint in _.breakpoints) { 6683 if (_.breakpoints.hasOwnProperty(breakpoint)) { 6684 if (_.originalSettings.mobileFirst === false) { 6685 if (respondToWidth < _.breakpoints[breakpoint]) { 6686 targetBreakpoint = _.breakpoints[breakpoint]; 6687 } 6688 } else { 6689 if (respondToWidth > _.breakpoints[breakpoint]) { 6690 targetBreakpoint = _.breakpoints[breakpoint]; 6691 } 6692 } 6693 } 6694 } 6695 if (targetBreakpoint !== null) { 6696 if (_.activeBreakpoint !== null) { 6697 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 6698 _.activeBreakpoint = targetBreakpoint; 6699 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 6700 _.unslick(targetBreakpoint); 6701 } else { 6702 _.options = $.extend({}, _.originalSettings, _.breakpointSettings[targetBreakpoint]); 6703 if (initial === true) { 6704 _.currentSlide = _.options.initialSlide; 6705 } 6706 _.refresh(initial); 6707 } 6708 triggerBreakpoint = targetBreakpoint; 6709 } 6710 } else { 6711 _.activeBreakpoint = targetBreakpoint; 6712 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 6713 _.unslick(targetBreakpoint); 6714 } else { 6715 _.options = $.extend({}, _.originalSettings, _.breakpointSettings[targetBreakpoint]); 6716 if (initial === true) { 6717 _.currentSlide = _.options.initialSlide; 6718 } 6719 _.refresh(initial); 6720 } 6721 triggerBreakpoint = targetBreakpoint; 6722 } 6723 } else { 6724 if (_.activeBreakpoint !== null) { 6725 _.activeBreakpoint = null; 6726 _.options = _.originalSettings; 6727 if (initial === true) { 6728 _.currentSlide = _.options.initialSlide; 6729 } 6730 _.refresh(initial);
6731 triggerBreakpoint = targetBreakpoint; 6732 } 6733 } 6734 6735 // only trigger breakpoints during an actual break. not on initialize. 6736 if (!initial && triggerBreakpoint !== false) { 6737 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 6738 } 6739 } 6740 }; 6741 Slick.prototype.changeSlide = function (event, dontAnimate) { 6742 var _ = this, 6743 $target = $(event.currentTarget), 6744 indexOffset, 6745 slideOffset, 6746 unevenOffset; 6747 6748 // If target is a link, prevent default action. 6749 if ($target.is('a')) { 6750 event.preventDefault(); 6751 } 6752 6753 // If target is not the <li> element (ie: a child), find the <li>. 6754 if (!$target.is('li')) { 6755 $target = $target.closest('li'); 6756 } 6757 unevenOffset = _.slideCount % _.options.slidesToScroll !== 0; 6758 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 6759 switch (event.data.message) { 6760 case 'previous': 6761 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 6762 if (_.slideCount > _.options.slidesToShow) { 6763 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 6764 } 6765 break; 6766 case 'next': 6767 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 6768 if (_.slideCount > _.options.slidesToShow) { 6769 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 6770 } 6771 break; 6772 case 'index': 6773 var index = event.data.index === 0 ? 0 : event.data.index || $target.index() * _.options.slidesToScroll; 6774 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 6775 $target.children().trigger('focus'); 6776 break; 6777 default: 6778 return; 6779 } 6780 }; 6781 Slick.prototype.checkNavigable = function (index) { 6782 var _ = this, 6783 navigables, 6784 prevNavigable; 6785 navigables = _.getNavigableIndexes(); 6786 prevNavigable = 0; 6787 if (index > navigables[navigables.length - 1]) { 6788 index = navigables[navigables.length - 1]; 6789 } else { 6790 for (var n in navigables) { 6791 if (index < navigables[n]) { 6792 index = prevNavigable; 6793 break; 6794 } 6795 prevNavigable = navigables[n]; 6796 } 6797 } 6798 return index; 6799 }; 6800 Slick.prototype.cleanUpEvents = function () { 6801 var _ = this; 6802 if (_.options.dots && _.$dots !== null) { 6803 $('li', _.$dots).off('click.slick', _.changeSlide).off('mouseenter.slick', $.proxy(_.interrupt, _, true)).off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 6804 if (_.options.accessibility === true) { 6805 _.$dots.off('keydown.slick', _.keyHandler); 6806 } 6807 } 6808 _.$slider.off('focus.slick blur.slick'); 6809 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 6810 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 6811 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 6812 if (_.options.accessibility === true) { 6813 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 6814 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 6815 } 6816 } 6817 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 6818 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 6819 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
6820 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 6821 _.$list.off('click.slick', _.clickHandler); 6822 $(document).off(_.visibilityChange, _.visibility); 6823 _.cleanUpSlideEvents(); 6824 if (_.options.accessibility === true) { 6825 _.$list.off('keydown.slick', _.keyHandler); 6826 } 6827 if (_.options.focusOnSelect === true) { 6828 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 6829 } 6830 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 6831 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 6832 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 6833 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 6834 }; 6835 Slick.prototype.cleanUpSlideEvents = function () { 6836 var _ = this; 6837 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 6838 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 6839 }; 6840 Slick.prototype.cleanUpRows = function () { 6841 var _ = this, 6842 originalSlides; 6843 if (_.options.rows > 0) { 6844 originalSlides = _.$slides.children().children(); 6845 originalSlides.removeAttr('style'); 6846 _.$slider.empty().append(originalSlides); 6847 } 6848 }; 6849 Slick.prototype.clickHandler = function (event) { 6850 var _ = this; 6851 if (_.shouldClick === false) { 6852 event.stopImmediatePropagation(); 6853 event.stopPropagation(); 6854 event.preventDefault(); 6855 } 6856 }; 6857 Slick.prototype.destroy = function (refresh) { 6858 var _ = this; 6859 _.autoPlayClear(); 6860 _.touchObject = {}; 6861 _.cleanUpEvents(); 6862 $('.slick-cloned', _.$slider).detach(); 6863 if (_.$dots) { 6864 _.$dots.remove(); 6865 } 6866 if (_.$prevArrow && _.$prevArrow.length) { 6867 _.$prevArrow.removeClass('slick-disabled slick-arrow slick-hidden').removeAttr('aria-hidden aria-disabled tabindex').css('display', ''); 6868 if (_.htmlExpr.test(_.options.prevArrow)) { 6869 _.$prevArrow.remove(); 6870 } 6871 } 6872 if (_.$nextArrow && _.$nextArrow.length) { 6873 _.$nextArrow.removeClass('slick-disabled slick-arrow slick-hidden').removeAttr('aria-hidden aria-disabled tabindex').css('display', ''); 6874 if (_.htmlExpr.test(_.options.nextArrow)) { 6875 _.$nextArrow.remove(); 6876 } 6877 } 6878 if (_.$slides) { 6879 _.$slides.removeClass('slick-slide slick-active slick-center slick-visible slick-current').removeAttr('aria-hidden').removeAttr('data-slick-index').each(function () { 6880 $(this).attr('style', $(this).data('originalStyling')); 6881 }); 6882 _.$slideTrack.children(this.options.slide).detach(); 6883 _.$slideTrack.detach(); 6884 _.$list.detach(); 6885 _.$slider.append(_.$slides); 6886 } 6887 _.cleanUpRows(); 6888 _.$slider.removeClass('slick-slider'); 6889 _.$slider.removeClass('slick-initialized'); 6890 _.$slider.removeClass('slick-dotted'); 6891 _.unslicked = true; 6892 if (!refresh) { 6893 _.$slider.trigger('destroy', [_]); 6894 } 6895 }; 6896 Slick.prototype.disableTransition = function (slide) { 6897 var _ = this, 6898 transition = {}; 6899 transition[_.transitionType] = ''; 6900 if (_.options.fade === false) { 6901 _.$slideTrack.css(transition); 6902 } else { 6903 _.$slides.eq(slide).css(transition); 6904 } 6905 }; 6906 Slick.prototype.fadeSlide = function (slideIndex, callback) { 6907 var _ = this; 6908 if (_.cssTransitions === false) { 6909 _.$slides.eq(slideIndex).css({ 6910 zIndex: _.options.zIndex 6911 }); 6912 _.$slides.eq(slideIndex).animate({ 6913 opacity: 1 6914 }, _.options.speed, _.options.easing, callback); 6915 } else { 6916 _.applyTransition(slideIndex); 6917 _.$slides.eq(slideIndex).css({ 6918 opacity: 1, 6919 zIndex: _.options.zIndex 6920 }); 6921 if (callback) { 6922 setTimeout(function () { 6923 _.disableTransition(slideIndex); 6924 callback.call(); 6925 }, _.options.speed); 6926 } 6927 } 6928 }; 6929 Slick.prototype.fadeSlideOut = function (slideIndex) { 6930 var _ = this; 6931 if (_.cssTransitions === false) { 6932 _.$slides.eq(slideIndex).animate({ 6933 opacity: 0, 6934 zIndex: _.options.zIndex - 2 6935 }, _.options.speed, _.options.easing); 6936 } else { 6937 _.applyTransition(slideIndex); 6938 _.$slides.eq(slideIndex).css({ 6939 opacity: 0, 6940 zIndex: _.options.zIndex - 2 6941 }); 6942 } 6943 };
6944 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function (filter) { 6945 var _ = this; 6946 if (filter !== null) { 6947 _.$slidesCache = _.$slides; 6948 _.unload(); 6949 _.$slideTrack.children(this.options.slide).detach(); 6950 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 6951 _.reinit(); 6952 } 6953 }; 6954 Slick.prototype.focusHandler = function () { 6955 var _ = this; 6956 _.$slider.off('focus.slick blur.slick').on('focus.slick blur.slick', '*', function (event) { 6957 event.stopImmediatePropagation(); 6958 var $sf = $(this); 6959 setTimeout(function () { 6960 if (_.options.pauseOnFocus) { 6961 _.focussed = $sf.is(':focus'); 6962 _.autoPlay(); 6963 } 6964 }, 0); 6965 }); 6966 }; 6967 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function () { 6968 var _ = this; 6969 return _.currentSlide; 6970 }; 6971 Slick.prototype.getDotCount = function () { 6972 var _ = this; 6973 var breakPoint = 0; 6974 var counter = 0; 6975 var pagerQty = 0; 6976 if (_.options.infinite === true) { 6977 if (_.slideCount <= _.options.slidesToShow) { 6978 ++pagerQty; 6979 } else { 6980 while (breakPoint < _.slideCount) { 6981 ++pagerQty; 6982 breakPoint = counter + _.options.slidesToScroll; 6983 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 6984 } 6985 } 6986 } else if (_.options.centerMode === true) { 6987 pagerQty = _.slideCount; 6988 } else if (!_.options.asNavFor) { 6989 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 6990 } else { 6991 while (breakPoint < _.slideCount) { 6992 ++pagerQty; 6993 breakPoint = counter + _.options.slidesToScroll; 6994 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 6995 } 6996 } 6997 return pagerQty - 1; 6998 }; 6999 Slick.prototype.getLeft = function (slideIndex) { 7000 var _ = this, 7001 targetLeft, 7002 verticalHeight, 7003 verticalOffset = 0, 7004 targetSlide, 7005 coef; 7006 _.slideOffset = 0; 7007 verticalHeight = _.$slides.first().outerHeight(true); 7008 if (_.options.infinite === true) { 7009 if (_.slideCount > _.options.slidesToShow) { 7010 _.slideOffset = _.slideWidth * _.options.slidesToShow * -1; 7011 coef = -1; 7012 if (_.options.vertical === true && _.options.centerMode === true) { 7013 if (_.options.slidesToShow === 2) { 7014 coef = -1.5; 7015 } else if (_.options.slidesToShow === 1) { 7016 coef = -2; 7017 } 7018 } 7019 verticalOffset = verticalHeight * _.options.slidesToShow * coef; 7020 } 7021 if (_.slideCount % _.options.slidesToScroll !== 0) { 7022 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 7023 if (slideIndex > _.slideCount) {
7024 _.slideOffset = (_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth * -1; 7025 verticalOffset = (_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight * -1; 7026 } else { 7027 _.slideOffset = _.slideCount % _.options.slidesToScroll * _.slideWidth * -1; 7028 verticalOffset = _.slideCount % _.options.slidesToScroll * verticalHeight * -1; 7029 } 7030 } 7031 } 7032 } else { 7033 if (slideIndex + _.options.slidesToShow > _.slideCount) { 7034 _.slideOffset = (slideIndex + _.options.slidesToShow - _.slideCount) * _.slideWidth; 7035 verticalOffset = (slideIndex + _.options.slidesToShow - _.slideCount) * verticalHeight; 7036 } 7037 } 7038 if (_.slideCount <= _.options.slidesToShow) { 7039 _.slideOffset = 0; 7040 verticalOffset = 0; 7041 } 7042 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 7043 _.slideOffset = _.slideWidth * Math.floor(_.options.slidesToShow) / 2 - _.slideWidth * _.slideCount / 2; 7044 } else if (_.options.centerMode === true && _.options.infinite === true) { 7045 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 7046 } else if (_.options.centerMode === true) { 7047 _.slideOffset = 0; 7048 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 7049 } 7050 if (_.options.vertical === false) { 7051 targetLeft = slideIndex * _.slideWidth * -1 + _.slideOffset; 7052 } else { 7053 targetLeft = slideIndex * verticalHeight * -1 + verticalOffset; 7054 } 7055 if (_.options.variableWidth === true) {
7056 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 7057 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 7058 } else { 7059 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 7060 } 7061 if (_.options.rtl === true) { 7062 if (targetSlide[0]) { 7063 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 7064 } else { 7065 targetLeft = 0; 7066 } 7067 } else { 7068 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 7069 } 7070 if (_.options.centerMode === true) { 7071 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 7072 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 7073 } else { 7074 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 7075 } 7076 if (_.options.rtl === true) { 7077 if (targetSlide[0]) { 7078 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 7079 } else { 7080 targetLeft = 0; 7081 } 7082 } else { 7083 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 7084 } 7085 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 7086 } 7087 } 7088 return targetLeft; 7089 }; 7090 Slick.prototype.getOption = Slick.prototype.slickGetOption = function (option) { 7091 var _ = this; 7092 return _.options[option]; 7093 }; 7094 Slick.prototype.getNavigableIndexes = function () { 7095 var _ = this, 7096 breakPoint = 0, 7097 counter = 0, 7098 indexes = [], 7099 max; 7100 if (_.options.infinite === false) { 7101 max = _.slideCount; 7102 } else { 7103 breakPoint = _.options.slidesToScroll * -1; 7104 counter = _.options.slidesToScroll * -1; 7105 max = _.slideCount * 2; 7106 } 7107 while (breakPoint < max) { 7108 indexes.push(breakPoint); 7109 breakPoint = counter + _.options.slidesToScroll; 7110 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 7111 } 7112 return indexes; 7113 }; 7114 Slick.prototype.getSlick = function () { 7115 return this; 7116 }; 7117 Slick.prototype.getSlideCount = function () { 7118 var _ = this, 7119 slidesTraversed, 7120 swipedSlide, 7121 centerOffset; 7122 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 7123 if (_.options.swipeToSlide === true) { 7124 _.$slideTrack.find('.slick-slide').each(function (index, slide) { 7125 if (slide.offsetLeft - centerOffset + $(slide).outerWidth() / 2 > _.swipeLeft * -1) { 7126 swipedSlide = slide; 7127 return false; 7128 } 7129 }); 7130 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 7131 return slidesTraversed; 7132 } else { 7133 return _.options.slidesToScroll; 7134 } 7135 }; 7136 Slick.prototype.goTo = Slick.prototype.slickGoTo = function (slide, dontAnimate) { 7137 var _ = this; 7138 _.changeSlide({ 7139 data: { 7140 message: 'index', 7141 index: parseInt(slide) 7142 } 7143 }, dontAnimate); 7144 }; 7145 Slick.prototype.init = function (creation) { 7146 var _ = this; 7147 if (!$(_.$slider).hasClass('slick-initialized')) { 7148 $(_.$slider).addClass('slick-initialized'); 7149 _.buildRows(); 7150 _.buildOut(); 7151 _.setProps(); 7152 _.startLoad(); 7153 _.loadSlider(); 7154 _.initializeEvents(); 7155 _.updateArrows(); 7156 _.updateDots(); 7157 _.checkResponsive(true); 7158 _.focusHandler(); 7159 } 7160 if (creation) { 7161 _.$slider.trigger('init', [_]); 7162 } 7163 if (_.options.accessibility === true) { 7164 _.initADA(); 7165 } 7166 if (_.options.autoplay) { 7167 _.paused = false; 7168 _.autoPlay(); 7169 } 7170 }; 7171 Slick.prototype.initADA = function () { 7172 var _ = this, 7173 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 7174 tabControlIndexes = _.getNavigableIndexes().filter(function (val) { 7175 return val >= 0 && val < _.slideCount; 7176 }); 7177 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 7178 'aria-hidden': 'true', 7179 'tabindex': '-1' 7180 }).find('a, input, button, select').attr({ 7181 'tabindex': '-1' 7182 }); 7183 if (_.$dots !== null) { 7184 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function (i) {
7185 var slideControlIndex = tabControlIndexes.indexOf(i); 7186 $(this).attr({ 7187 'role': 'tabpanel', 7188 'id': 'slick-slide' + _.instanceUid + i, 7189 'tabindex': -1 7190 }); 7191 if (slideControlIndex !== -1) { 7192 var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex; 7193 if ($('#' + ariaButtonControl).length) { 7194 $(this).attr({ 7195 'aria-describedby': ariaButtonControl 7196 }); 7197 } 7198 } 7199 }); 7200 _.$dots.attr('role', 'tablist').find('li').each(function (i) { 7201 var mappedSlideIndex = tabControlIndexes[i]; 7202 $(this).attr({ 7203 'role': 'presentation' 7204 }); 7205 $(this).find('button').first().attr({ 7206 'role': 'tab', 7207 'id': 'slick-slide-control' + _.instanceUid + i, 7208 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 7209 'aria-label': i + 1 + ' of ' + numDotGroups, 7210 'aria-selected': null, 7211 'tabindex': '-1' 7212 }); 7213 }).eq(_.currentSlide).find('button').attr({ 7214 'aria-selected': 'true', 7215 'tabindex': '0' 7216 }).end(); 7217 } 7218 for (var i = _.currentSlide, max = i + _.options.slidesToShow; i < max; i++) { 7219 if (_.options.focusOnChange) { 7220 _.$slides.eq(i).attr({ 7221 'tabindex': '0' 7222 }); 7223 } else { 7224 _.$slides.eq(i).removeAttr('tabindex'); 7225 } 7226 } 7227 _.activateADA(); 7228 }; 7229 Slick.prototype.initArrowEvents = function () { 7230 var _ = this; 7231 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 7232 _.$prevArrow.off('click.slick').on('click.slick', { 7233 message: 'previous' 7234 }, _.changeSlide); 7235 _.$nextArrow.off('click.slick').on('click.slick', { 7236 message: 'next' 7237 }, _.changeSlide); 7238 if (_.options.accessibility === true) { 7239 _.$prevArrow.on('keydown.slick', _.keyHandler); 7240 _.$nextArrow.on('keydown.slick', _.keyHandler); 7241 } 7242 } 7243 }; 7244 Slick.prototype.initDotEvents = function () { 7245 var _ = this; 7246 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 7247 $('li', _.$dots).on('click.slick', { 7248 message: 'index' 7249 }, _.changeSlide); 7250 if (_.options.accessibility === true) { 7251 _.$dots.on('keydown.slick', _.keyHandler); 7252 } 7253 } 7254 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) { 7255 $('li', _.$dots).on('mouseenter.slick', $.proxy(_.interrupt, _, true)).on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 7256 } 7257 }; 7258 Slick.prototype.initSlideEvents = function () { 7259 var _ = this; 7260 if (_.options.pauseOnHover) { 7261 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 7262 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 7263 } 7264 }; 7265 Slick.prototype.initializeEvents = function () { 7266 var _ = this; 7267 _.initArrowEvents(); 7268 _.initDotEvents(); 7269 _.initSlideEvents(); 7270 _.$list.on('touchstart.slick mousedown.slick', { 7271 action: 'start' 7272 }, _.swipeHandler); 7273 _.$list.on('touchmove.slick mousemove.slick', { 7274 action: 'move' 7275 }, _.swipeHandler); 7276 _.$list.on('touchend.slick mouseup.slick', { 7277 action: 'end' 7278 }, _.swipeHandler);
7279 _.$list.on('touchcancel.slick mouseleave.slick', { 7280 action: 'end' 7281 }, _.swipeHandler); 7282 _.$list.on('click.slick', _.clickHandler); 7283 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 7284 if (_.options.accessibility === true) { 7285 _.$list.on('keydown.slick', _.keyHandler); 7286 } 7287 if (_.options.focusOnSelect === true) { 7288 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 7289 } 7290 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 7291 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 7292 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 7293 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 7294 $(_.setPosition); 7295 }; 7296 Slick.prototype.initUI = function () { 7297 var _ = this; 7298 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 7299 _.$prevArrow.show(); 7300 _.$nextArrow.show(); 7301 } 7302 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 7303 _.$dots.show(); 7304 } 7305 }; 7306 Slick.prototype.keyHandler = function (event) { 7307 var _ = this; 7308 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 7309 if (!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 7310 if (event.keyCode === 37 && _.options.accessibility === true) { 7311 _.changeSlide({ 7312 data: { 7313 message: _.options.rtl === true ? 'next' : 'previous' 7314 } 7315 }); 7316 } else if (event.keyCode === 39 && _.options.accessibility === true) { 7317 _.changeSlide({ 7318 data: { 7319 message: _.options.rtl === true ? 'previous' : 'next' 7320 } 7321 }); 7322 } 7323 } 7324 }; 7325 Slick.prototype.lazyLoad = function () { 7326 var _ = this, 7327 loadRange, 7328 cloneRange, 7329 rangeStart, 7330 rangeEnd; 7331 function loadImages(imagesScope) { 7332 $('img[data-lazy]', imagesScope).each(function () { 7333 var image = $(this), 7334 imageSource = $(this).attr('data-lazy'), 7335 imageSrcSet = $(this).attr('data-srcset'), 7336 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 7337 imageToLoad = document.createElement('img'); 7338 imageToLoad.onload = function () { 7339 image.animate({ 7340 opacity: 0 7341 }, 100, function () { 7342 if (imageSrcSet) { 7343 image.attr('srcset', imageSrcSet); 7344 if (imageSizes) { 7345 image.attr('sizes', imageSizes); 7346 } 7347 } 7348 image.attr('src', imageSource).animate({ 7349 opacity: 1 7350 }, 200, function () { 7351 image.removeAttr('data-lazy data-srcset data-sizes').removeClass('slick-loading'); 7352 }); 7353 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 7354 }); 7355 }; 7356 imageToLoad.onerror = function () { 7357 image.removeAttr('data-lazy').removeClass('slick-loading').addClass('slick-lazyload-error'); 7358 _.$slider.trigger('lazyLoadError', [_, image, imageSource]); 7359 }; 7360 imageToLoad.src = imageSource; 7361 }); 7362 } 7363 if (_.options.centerMode === true) { 7364 if (_.options.infinite === true) { 7365 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 7366 rangeEnd = rangeStart + _.options.slidesToShow + 2; 7367 } else { 7368 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 7369 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 7370 } 7371 } else { 7372 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 7373 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 7374 if (_.options.fade === true) { 7375 if (rangeStart > 0) rangeStart--; 7376 if (rangeEnd <= _.slideCount) rangeEnd++; 7377 } 7378 } 7379 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 7380 if (_.options.lazyLoad === 'anticipated') { 7381 var prevSlide = rangeStart - 1, 7382 nextSlide = rangeEnd, 7383 $slides = _.$slider.find('.slick-slide'); 7384 for (var i = 0; i < _.options.slidesToScroll; i++) { 7385 if (prevSlide < 0) prevSlide = _.slideCount - 1; 7386 loadRange = loadRange.add($slides.eq(prevSlide)); 7387 loadRange = loadRange.add($slides.eq(nextSlide)); 7388 prevSlide--; 7389 nextSlide++; 7390 } 7391 } 7392 loadImages(loadRange); 7393 if (_.slideCount <= _.options.slidesToShow) { 7394 cloneRange = _.$slider.find('.slick-slide'); 7395 loadImages(cloneRange); 7396 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 7397 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 7398 loadImages(cloneRange); 7399 } else if (_.currentSlide === 0) { 7400 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 7401 loadImages(cloneRange); 7402 } 7403 }; 7404 Slick.prototype.loadSlider = function () { 7405 var _ = this; 7406 _.setPosition(); 7407 _.$slideTrack.css({ 7408 opacity: 1 7409 }); 7410 _.$slider.removeClass('slick-loading'); 7411 _.initUI(); 7412 if (_.options.lazyLoad === 'progressive') { 7413 _.progressiveLazyLoad(); 7414 } 7415 }; 7416 Slick.prototype.next = Slick.prototype.slickNext = function () { 7417 var _ = this; 7418 _.changeSlide({ 7419 data: { 7420 message: 'next' 7421 } 7422 }); 7423 }; 7424 Slick.prototype.orientationChange = function () { 7425 var _ = this; 7426 _.checkResponsive(); 7427 _.setPosition(); 7428 }; 7429 Slick.prototype.pause = Slick.prototype.slickPause = function () { 7430 var _ = this; 7431 _.autoPlayClear(); 7432 _.paused = true; 7433 }; 7434 Slick.prototype.play = Slick.prototype.slickPlay = function () { 7435 var _ = this; 7436 _.autoPlay(); 7437 _.options.autoplay = true; 7438 _.paused = false;
7439 _.focussed = false; 7440 _.interrupted = false; 7441 }; 7442 Slick.prototype.postSlide = function (index) { 7443 var _ = this; 7444 if (!_.unslicked) { 7445 _.$slider.trigger('afterChange', [_, index]); 7446 _.animating = false; 7447 if (_.slideCount > _.options.slidesToShow) { 7448 _.setPosition(); 7449 } 7450 _.swipeLeft = null; 7451 if (_.options.autoplay) { 7452 _.autoPlay(); 7453 } 7454 if (_.options.accessibility === true) { 7455 _.initADA(); 7456 if (_.options.focusOnChange) { 7457 var $currentSlide = $(_.$slides.get(_.currentSlide)); 7458 $currentSlide.attr('tabindex', 0).focus(); 7459 } 7460 } 7461 } 7462 }; 7463 Slick.prototype.prev = Slick.prototype.slickPrev = function () { 7464 var _ = this; 7465 _.changeSlide({ 7466 data: { 7467 message: 'previous' 7468 } 7469 }); 7470 }; 7471 Slick.prototype.preventDefault = function (event) { 7472 event.preventDefault(); 7473 }; 7474 Slick.prototype.progressiveLazyLoad = function (tryCount) { 7475 tryCount = tryCount || 1; 7476 var _ = this, 7477 $imgsToLoad = $('img[data-lazy]', _.$slider), 7478 image, 7479 imageSource, 7480 imageSrcSet, 7481 imageSizes, 7482 imageToLoad; 7483 if ($imgsToLoad.length) { 7484 image = $imgsToLoad.first(); 7485 imageSource = image.attr('data-lazy'); 7486 imageSrcSet = image.attr('data-srcset'); 7487 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 7488 imageToLoad = document.createElement('img'); 7489 imageToLoad.onload = function () { 7490 if (imageSrcSet) { 7491 image.attr('srcset', imageSrcSet); 7492 if (imageSizes) { 7493 image.attr('sizes', imageSizes); 7494 } 7495 } 7496 image.attr('src', imageSource).removeAttr('data-lazy data-srcset data-sizes').removeClass('slick-loading'); 7497 if (_.options.adaptiveHeight === true) { 7498 _.setPosition(); 7499 } 7500 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 7501 _.progressiveLazyLoad(); 7502 }; 7503 imageToLoad.onerror = function () { 7504 if (tryCount < 3) { 7505 /** 7506 * try to load the image 3 times, 7507 * leave a slight delay so we don't get 7508 * servers blocking the request. 7509 */ 7510 setTimeout(function () { 7511 _.progressiveLazyLoad(tryCount + 1); 7512 }, 500); 7513 } else { 7514 image.removeAttr('data-lazy').removeClass('slick-loading').addClass('slick-lazyload-error'); 7515 _.$slider.trigger('lazyLoadError', [_, image, imageSource]); 7516 _.progressiveLazyLoad(); 7517 } 7518 }; 7519 imageToLoad.src = imageSource; 7520 } else { 7521 _.$slider.trigger('allImagesLoaded', [_]); 7522 } 7523 }; 7524 Slick.prototype.refresh = function (initializing) { 7525 var _ = this, 7526 currentSlide, 7527 lastVisibleIndex; 7528 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 7529 7530 // in non-infinite sliders, we don't want to go past the 7531 // last visible index. 7532 if (!_.options.infinite && _.currentSlide > lastVisibleIndex) { 7533 _.currentSlide = lastVisibleIndex; 7534 } 7535 7536 // if less slides than to show, go to start. 7537 if (_.slideCount <= _.options.slidesToShow) { 7538 _.currentSlide = 0; 7539 } 7540 currentSlide = _.currentSlide; 7541 _.destroy(true); 7542 $.extend(_, _.initials, { 7543 currentSlide: currentSlide 7544 }); 7545 _.init(); 7546 if (!initializing) { 7547 _.changeSlide({ 7548 data: { 7549 message: 'index', 7550 index: currentSlide 7551 } 7552 }, false); 7553 } 7554 }; 7555 Slick.prototype.registerBreakpoints = function () { 7556 var _ = this, 7557 breakpoint, 7558 currentBreakpoint, 7559 l, 7560 responsiveSettings = _.options.responsive || null; 7561 if ($.type(responsiveSettings) === 'array' && responsiveSettings.length) { 7562 _.respondTo = _.options.respondTo || 'window'; 7563 for (breakpoint in responsiveSettings) { 7564 l = _.breakpoints.length - 1; 7565 if (responsiveSettings.hasOwnProperty(breakpoint)) { 7566 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 7567 7568 // loop through the breakpoints and cut out any existing 7569 // ones with the same breakpoint number, we don't want dupes. 7570 while (l >= 0) { 7571 if (_.breakpoints[l] && _.breakpoints[l] === currentBreakpoint) { 7572 _.breakpoints.splice(l, 1); 7573 } 7574 l--; 7575 } 7576 _.breakpoints.push(currentBreakpoint); 7577 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 7578 } 7579 } 7580 _.breakpoints.sort(function (a, b) { 7581 return _.options.mobileFirst ? a - b : b - a; 7582 }); 7583 } 7584 }; 7585 Slick.prototype.reinit = function () { 7586 var _ = this; 7587 _.$slides = _.$slideTrack.children(_.options.slide).addClass('slick-slide'); 7588 _.slideCount = _.$slides.length; 7589 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 7590 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 7591 } 7592 if (_.slideCount <= _.options.slidesToShow) { 7593 _.currentSlide = 0; 7594 } 7595 _.registerBreakpoints(); 7596 _.setProps(); 7597 _.setupInfinite(); 7598 _.buildArrows(); 7599 _.updateArrows(); 7600 _.initArrowEvents(); 7601 _.buildDots(); 7602 _.updateDots(); 7603 _.initDotEvents(); 7604 _.cleanUpSlideEvents(); 7605 _.initSlideEvents(); 7606 _.checkResponsive(false, true); 7607 if (_.options.focusOnSelect === true) { 7608 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 7609 } 7610 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 7611 _.setPosition(); 7612 _.focusHandler(); 7613 _.paused = !_.options.autoplay; 7614 _.autoPlay(); 7615 _.$slider.trigger('reInit', [_]); 7616 }; 7617 Slick.prototype.resize = function () { 7618 var _ = this; 7619 if ($(window).width() !== _.windowWidth) { 7620 clearTimeout(_.windowDelay); 7621 _.windowDelay = window.setTimeout(function () { 7622 _.windowWidth = $(window).width(); 7623 _.checkResponsive(); 7624 if (!_.unslicked) { 7625 _.setPosition(); 7626 } 7627 }, 50); 7628 } 7629 }; 7630 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function (index, removeBefore, removeAll) { 7631 var _ = this; 7632 if (typeof index === 'boolean') { 7633 removeBefore = index; 7634 index = removeBefore === true ? 0 : _.slideCount - 1; 7635 } else { 7636 index = removeBefore === true ? --index : index; 7637 } 7638 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 7639 return false;
7640 } 7641 _.unload(); 7642 if (removeAll === true) { 7643 _.$slideTrack.children().remove(); 7644 } else { 7645 _.$slideTrack.children(this.options.slide).eq(index).remove(); 7646 } 7647 _.$slides = _.$slideTrack.children(this.options.slide); 7648 _.$slideTrack.children(this.options.slide).detach(); 7649 _.$slideTrack.append(_.$slides); 7650 _.$slidesCache = _.$slides; 7651 _.reinit(); 7652 }; 7653 Slick.prototype.setCSS = function (position) { 7654 var _ = this, 7655 positionProps = {}, 7656 x, 7657 y; 7658 if (_.options.rtl === true) { 7659 position = -position; 7660 } 7661 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 7662 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 7663 positionProps[_.positionProp] = position; 7664 if (_.transformsEnabled === false) { 7665 _.$slideTrack.css(positionProps); 7666 } else { 7667 positionProps = {}; 7668 if (_.cssTransitions === false) { 7669 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 7670 _.$slideTrack.css(positionProps); 7671 } else { 7672 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 7673 _.$slideTrack.css(positionProps); 7674 } 7675 } 7676 }; 7677 Slick.prototype.setDimensions = function () { 7678 var _ = this; 7679 if (_.options.vertical === false) { 7680 if (_.options.centerMode === true) { 7681 _.$list.css({ 7682 padding: '0px ' + _.options.centerPadding 7683 }); 7684 } 7685 } else { 7686 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 7687 if (_.options.centerMode === true) { 7688 _.$list.css({ 7689 padding: _.options.centerPadding + ' 0px' 7690 }); 7691 } 7692 } 7693 _.listWidth = _.$list.width(); 7694 _.listHeight = _.$list.height(); 7695 if (_.options.vertical === false && _.options.variableWidth === false) { 7696 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 7697 _.$slideTrack.width(Math.ceil(_.slideWidth * _.$slideTrack.children('.slick-slide').length)); 7698 } else if (_.options.variableWidth === true) { 7699 _.$slideTrack.width(5000 * _.slideCount); 7700 } else { 7701 _.slideWidth = Math.ceil(_.listWidth); 7702 _.$slideTrack.height(Math.ceil(_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)); 7703 } 7704 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 7705 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 7706 }; 7707 Slick.prototype.setFade = function () { 7708 var _ = this, 7709 targetLeft; 7710 _.$slides.each(function (index, element) { 7711 targetLeft = _.slideWidth * index * -1; 7712 if (_.options.rtl === true) { 7713 $(element).css({ 7714 position: 'relative', 7715 right: targetLeft, 7716 top: 0, 7717 zIndex: _.options.zIndex - 2, 7718 opacity: 0 7719 }); 7720 } else { 7721 $(element).css({ 7722 position: 'relative', 7723 left: targetLeft, 7724 top: 0, 7725 zIndex: _.options.zIndex - 2, 7726 opacity: 0 7727 }); 7728 } 7729 }); 7730 _.$slides.eq(_.currentSlide).css({ 7731 zIndex: _.options.zIndex - 1, 7732 opacity: 1 7733 }); 7734 }; 7735 Slick.prototype.setHeight = function () { 7736 var _ = this; 7737 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 7738 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 7739 _.$list.css('height', targetHeight); 7740 } 7741 }; 7742 Slick.prototype.setOption = Slick.prototype.slickSetOption = function () { 7743 /** 7744 * accepts arguments in format of: 7745 * 7746 * - for changing a single option's value: 7747 * .slick("setOption", option, value, refresh ) 7748 * 7749 * - for changing a set of responsive options: 7750 * .slick("setOption", 'responsive', [{}, ...], refresh ) 7751 * 7752 * - for updating multiple values at once (not responsive) 7753 * .slick("setOption", { 'option': value, ... }, refresh ) 7754 */ 7755 7756 var _ = this, 7757 l, 7758 item, 7759 option, 7760 value, 7761 refresh = false, 7762 type; 7763 if ($.type(arguments[0]) === 'object') { 7764 option = arguments[0]; 7765 refresh = arguments[1]; 7766 type = 'multiple'; 7767 } else if ($.type(arguments[0]) === 'string') { 7768 option = arguments[0]; 7769 value = arguments[1]; 7770 refresh = arguments[2]; 7771 if (arguments[0] === 'responsive' && $.type(arguments[1]) === 'array') { 7772 type = 'responsive'; 7773 } else if (typeof arguments[1] !== 'undefined') { 7774 type = 'single'; 7775 } 7776 } 7777 if (type === 'single') {
7778 _.options[option] = value; 7779 } else if (type === 'multiple') { 7780 $.each(option, function (opt, val) { 7781 _.options[opt] = val; 7782 }); 7783 } else if (type === 'responsive') { 7784 for (item in value) { 7785 if ($.type(_.options.responsive) !== 'array') { 7786 _.options.responsive = [value[item]]; 7787 } else { 7788 l = _.options.responsive.length - 1; 7789 7790 // loop through the responsive object and splice out duplicates. 7791 while (l >= 0) { 7792 if (_.options.responsive[l].breakpoint === value[item].breakpoint) { 7793 _.options.responsive.splice(l, 1); 7794 } 7795 l--; 7796 } 7797 _.options.responsive.push(value[item]); 7798 } 7799 } 7800 } 7801 if (refresh) { 7802 _.unload(); 7803 _.reinit(); 7804 } 7805 }; 7806 Slick.prototype.setPosition = function () { 7807 var _ = this; 7808 _.setDimensions(); 7809 _.setHeight(); 7810 if (_.options.fade === false) { 7811 _.setCSS(_.getLeft(_.currentSlide)); 7812 } else { 7813 _.setFade(); 7814 } 7815 _.$slider.trigger('setPosition', [_]); 7816 }; 7817 Slick.prototype.setProps = function () { 7818 var _ = this, 7819 bodyStyle = document.body.style; 7820 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 7821 if (_.positionProp === 'top') { 7822 _.$slider.addClass('slick-vertical'); 7823 } else { 7824 _.$slider.removeClass('slick-vertical'); 7825 } 7826 if (bodyStyle.WebkitTransition !== undefined || bodyStyle.MozTransition !== undefined || bodyStyle.msTransition !== undefined) { 7827 if (_.options.useCSS === true) { 7828 _.cssTransitions = true; 7829 } 7830 } 7831 if (_.options.fade) { 7832 if (typeof _.options.zIndex === 'number') { 7833 if (_.options.zIndex < 3) { 7834 _.options.zIndex = 3; 7835 } 7836 } else { 7837 _.options.zIndex = _.defaults.zIndex; 7838 } 7839 } 7840 if (bodyStyle.OTransform !== undefined) { 7841 _.animType = 'OTransform'; 7842 _.transformType = '-o-transform'; 7843 _.transitionType = 'OTransition'; 7844 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
7845 } 7846 if (bodyStyle.MozTransform !== undefined) { 7847 _.animType = 'MozTransform'; 7848 _.transformType = '-moz-transform'; 7849 _.transitionType = 'MozTransition'; 7850 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 7851 } 7852 if (bodyStyle.webkitTransform !== undefined) { 7853 _.animType = 'webkitTransform'; 7854 _.transformType = '-webkit-transform'; 7855 _.transitionType = 'webkitTransition'; 7856 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 7857 } 7858 if (bodyStyle.msTransform !== undefined) { 7859 _.animType = 'msTransform'; 7860 _.transformType = '-ms-transform'; 7861 _.transitionType = 'msTransition'; 7862 if (bodyStyle.msTransform === undefined) _.animType = false; 7863 } 7864 if (bodyStyle.transform !== undefined && _.animType !== false) { 7865 _.animType = 'transform'; 7866 _.transformType = 'transform'; 7867 _.transitionType = 'transition'; 7868 } 7869 _.transformsEnabled = _.options.useTransform && _.animType !== null && _.animType !== false; 7870 }; 7871 Slick.prototype.setSlideClasses = function (index) { 7872 var _ = this, 7873 centerOffset, 7874 allSlides, 7875 indexOffset, 7876 remainder; 7877 allSlides = _.$slider.find('.slick-slide').removeClass('slick-active slick-center slick-current').attr('aria-hidden', 'true'); 7878 _.$slides.eq(index).addClass('slick-current'); 7879 if (_.options.centerMode === true) { 7880 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 7881 centerOffset = Math.floor(_.options.slidesToShow / 2); 7882 if (_.options.infinite === true) { 7883 if (index >= centerOffset && index <= _.slideCount - 1 - centerOffset) { 7884 _.$slides.slice(index - centerOffset + evenCoef, index + centerOffset + 1).addClass('slick-active').attr('aria-hidden', 'false'); 7885 } else { 7886 indexOffset = _.options.slidesToShow + index; 7887 allSlides.slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2).addClass('slick-active').attr('aria-hidden', 'false'); 7888 } 7889 if (index === 0) { 7890 allSlides.eq(allSlides.length - 1 - _.options.slidesToShow).addClass('slick-center'); 7891 } else if (index === _.slideCount - 1) { 7892 allSlides.eq(_.options.slidesToShow).addClass('slick-center'); 7893 } 7894 } 7895 _.$slides.eq(index).addClass('slick-center'); 7896 } else { 7897 if (index >= 0 && index <= _.slideCount - _.options.slidesToShow) { 7898 _.$slides.slice(index, index + _.options.slidesToShow).addClass('slick-active').attr('aria-hidden', 'false'); 7899 } else if (allSlides.length <= _.options.slidesToShow) { 7900 allSlides.addClass('slick-active').attr('aria-hidden', 'false'); 7901 } else { 7902 remainder = _.slideCount % _.options.slidesToShow; 7903 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 7904 if (_.options.slidesToShow == _.options.slidesToScroll && _.slideCount - index < _.options.slidesToShow) { 7905 allSlides.slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder).addClass('slick-active').attr('aria-hidden', 'false'); 7906 } else { 7907 allSlides.slice(indexOffset, indexOffset + _.options.slidesToShow).addClass('slick-active').attr('aria-hidden', 'false'); 7908 } 7909 } 7910 } 7911 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 7912 _.lazyLoad(); 7913 } 7914 }; 7915 Slick.prototype.setupInfinite = function () { 7916 var _ = this, 7917 i, 7918 slideIndex, 7919 infiniteCount; 7920 if (_.options.fade === true) { 7921 _.options.centerMode = false; 7922 } 7923 if (_.options.infinite === true && _.options.fade === false) { 7924 slideIndex = null; 7925 if (_.slideCount > _.options.slidesToShow) { 7926 if (_.options.centerMode === true) { 7927 infiniteCount = _.options.slidesToShow + 1; 7928 } else { 7929 infiniteCount = _.options.slidesToShow; 7930 } 7931 for (i = _.slideCount; i > _.slideCount - infiniteCount; i -= 1) { 7932 slideIndex = i - 1; 7933 $(_.$slides[slideIndex]).clone(true).attr('id', '').attr('data-slick-index', slideIndex - _.slideCount).prependTo(_.$slideTrack).addClass('slick-cloned'); 7934 } 7935 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 7936 slideIndex = i; 7937 $(_.$slides[slideIndex]).clone(true).attr('id', '').attr('data-slick-index', slideIndex + _.slideCount).appendTo(_.$slideTrack).addClass('slick-cloned'); 7938 } 7939 _.$slideTrack.find('.slick-cloned').find('[id]').each(function () { 7940 $(this).attr('id', ''); 7941 }); 7942 } 7943 } 7944 }; 7945 Slick.prototype.interrupt = function (toggle) { 7946 var _ = this; 7947 if (!toggle) { 7948 _.autoPlay(); 7949 } 7950 _.interrupted = toggle; 7951 }; 7952 Slick.prototype.selectHandler = function (event) { 7953 var _ = this; 7954 var targetElement = $(event.target).is('.slick-slide') ? $(event.target) : $(event.target).parents('.slick-slide'); 7955 var index = parseInt(targetElement.attr('data-slick-index')); 7956 if (!index) index = 0; 7957 if (_.slideCount <= _.options.slidesToShow) { 7958 _.slideHandler(index, false, true); 7959 return; 7960 } 7961 _.slideHandler(index); 7962 }; 7963 Slick.prototype.slideHandler = function (index, sync, dontAnimate) { 7964 var targetSlide, 7965 animSlide, 7966 oldSlide, 7967 slideLeft, 7968 targetLeft = null, 7969 _ = this, 7970 navTarget; 7971 sync = sync || false; 7972 if (_.animating === true && _.options.waitForAnimate === true) { 7973 return; 7974 } 7975 if (_.options.fade === true && _.currentSlide === index) { 7976 return; 7977 } 7978 if (sync === false) { 7979 _.asNavFor(index); 7980 } 7981 targetSlide = index; 7982 targetLeft = _.getLeft(targetSlide); 7983 slideLeft = _.getLeft(_.currentSlide); 7984 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 7985 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 7986 if (_.options.fade === false) { 7987 targetSlide = _.currentSlide; 7988 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 7989 _.animateSlide(slideLeft, function () { 7990 _.postSlide(targetSlide); 7991 }); 7992 } else { 7993 _.postSlide(targetSlide); 7994 } 7995 } 7996 return; 7997 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > _.slideCount - _.options.slidesToScroll)) { 7998 if (_.options.fade === false) { 7999 targetSlide = _.currentSlide; 8000 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 8001 _.animateSlide(slideLeft, function () { 8002 _.postSlide(targetSlide); 8003 }); 8004 } else { 8005 _.postSlide(targetSlide); 8006 } 8007 } 8008 return; 8009 } 8010 if (_.options.autoplay) { 8011 clearInterval(_.autoPlayTimer); 8012 }
8013 if (targetSlide < 0) { 8014 if (_.slideCount % _.options.slidesToScroll !== 0) { 8015 animSlide = _.slideCount - _.slideCount % _.options.slidesToScroll; 8016 } else { 8017 animSlide = _.slideCount + targetSlide; 8018 } 8019 } else if (targetSlide >= _.slideCount) { 8020 if (_.slideCount % _.options.slidesToScroll !== 0) { 8021 animSlide = 0; 8022 } else { 8023 animSlide = targetSlide - _.slideCount; 8024 } 8025 } else { 8026 animSlide = targetSlide; 8027 } 8028 _.animating = true; 8029 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 8030 oldSlide = _.currentSlide; 8031 _.currentSlide = animSlide; 8032 _.setSlideClasses(_.currentSlide); 8033 if (_.options.asNavFor) { 8034 navTarget = _.getNavTarget(); 8035 navTarget = navTarget.slick('getSlick'); 8036 if (navTarget.slideCount <= navTarget.options.slidesToShow) { 8037 navTarget.setSlideClasses(_.currentSlide); 8038 } 8039 } 8040 _.updateDots(); 8041 _.updateArrows(); 8042 if (_.options.fade === true) { 8043 if (dontAnimate !== true) { 8044 _.fadeSlideOut(oldSlide); 8045 _.fadeSlide(animSlide, function () { 8046 _.postSlide(animSlide); 8047 }); 8048 } else { 8049 _.postSlide(animSlide); 8050 } 8051 _.animateHeight(); 8052 return; 8053 } 8054 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 8055 _.animateSlide(targetLeft, function () { 8056 _.postSlide(animSlide); 8057 }); 8058 } else { 8059 _.postSlide(animSlide); 8060 } 8061 }; 8062 Slick.prototype.startLoad = function () { 8063 var _ = this; 8064 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 8065 _.$prevArrow.hide(); 8066 _.$nextArrow.hide(); 8067 } 8068 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 8069 _.$dots.hide(); 8070 } 8071 _.$slider.addClass('slick-loading'); 8072 }; 8073 Slick.prototype.swipeDirection = function () { 8074 var xDist, 8075 yDist, 8076 r, 8077 swipeAngle, 8078 _ = this; 8079 xDist = _.touchObject.startX - _.touchObject.curX; 8080 yDist = _.touchObject.startY - _.touchObject.curY; 8081 r = Math.atan2(yDist, xDist); 8082 swipeAngle = Math.round(r * 180 / Math.PI); 8083 if (swipeAngle < 0) { 8084 swipeAngle = 360 - Math.abs(swipeAngle); 8085 } 8086 if (swipeAngle <= 45 && swipeAngle >= 0) { 8087 return _.options.rtl === false ? 'left' : 'right'; 8088 } 8089 if (swipeAngle <= 360 && swipeAngle >= 315) { 8090 return _.options.rtl === false ? 'left' : 'right'; 8091 } 8092 if (swipeAngle >= 135 && swipeAngle <= 225) { 8093 return _.options.rtl === false ? 'right' : 'left'; 8094 } 8095 if (_.options.verticalSwiping === true) { 8096 if (swipeAngle >= 35 && swipeAngle <= 135) { 8097 return 'down'; 8098 } else { 8099 return 'up'; 8100 } 8101 } 8102 return 'vertical'; 8103 }; 8104 Slick.prototype.swipeEnd = function (event) { 8105 var _ = this, 8106 slideCount, 8107 direction; 8108 _.dragging = false; 8109 _.swiping = false; 8110 if (_.scrolling) { 8111 _.scrolling = false; 8112 return false; 8113 } 8114 _.interrupted = false; 8115 _.shouldClick = _.touchObject.swipeLength > 10 ? false : true; 8116 if (_.touchObject.curX === undefined) { 8117 return false; 8118 } 8119 if (_.touchObject.edgeHit === true) { 8120 _.$slider.trigger('edge', [_, _.swipeDirection()]); 8121 } 8122 if (_.touchObject.swipeLength >= _.touchObject.minSwipe) { 8123 direction = _.swipeDirection(); 8124 switch (direction) { 8125 case 'left': 8126 case 'down': 8127 slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide + _.getSlideCount()) : _.currentSlide + _.getSlideCount(); 8128 _.currentDirection = 0; 8129 break; 8130 case 'right': 8131 case 'up': 8132 slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide - _.getSlideCount()) : _.currentSlide - _.getSlideCount(); 8133 _.currentDirection = 1; 8134 break; 8135 default: 8136 } 8137 if (direction != 'vertical') { 8138 _.slideHandler(slideCount); 8139 _.touchObject = {}; 8140 _.$slider.trigger('swipe', [_, direction]); 8141 } 8142 } else { 8143 if (_.touchObject.startX !== _.touchObject.curX) { 8144 _.slideHandler(_.currentSlide); 8145 _.touchObject = {}; 8146 } 8147 } 8148 }; 8149 Slick.prototype.swipeHandler = function (event) { 8150 var _ = this; 8151 if (_.options.swipe === false || 'ontouchend' in document && _.options.swipe === false) { 8152 return; 8153 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 8154 return; 8155 } 8156 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? event.originalEvent.touches.length : 1; 8157 _.touchObject.minSwipe = _.listWidth / _.options.touchThreshold; 8158 if (_.options.verticalSwiping === true) { 8159 _.touchObject.minSwipe = _.listHeight / _.options.touchThreshold; 8160 } 8161 switch (event.data.action) { 8162 case 'start': 8163 _.swipeStart(event); 8164 break; 8165 case 'move': 8166 _.swipeMove(event); 8167 break; 8168 case 'end': 8169 _.swipeEnd(event); 8170 break; 8171 } 8172 }; 8173 Slick.prototype.swipeMove = function (event) { 8174 var _ = this, 8175 edgeWasHit = false, 8176 curLeft, 8177 swipeDirection, 8178 swipeLength, 8179 positionOffset, 8180 touches, 8181 verticalSwipeLength; 8182 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 8183 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 8184 return false;
8185 } 8186 curLeft = _.getLeft(_.currentSlide); 8187 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 8188 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 8189 _.touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 8190 verticalSwipeLength = Math.round(Math.sqrt(Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 8191 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 8192 _.scrolling = true; 8193 return false; 8194 } 8195 if (_.options.verticalSwiping === true) { 8196 _.touchObject.swipeLength = verticalSwipeLength; 8197 } 8198 swipeDirection = _.swipeDirection(); 8199 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 8200 _.swiping = true; 8201 event.preventDefault(); 8202 } 8203 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 8204 if (_.options.verticalSwiping === true) { 8205 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 8206 } 8207 swipeLength = _.touchObject.swipeLength; 8208 _.touchObject.edgeHit = false; 8209 if (_.options.infinite === false) { 8210 if (_.currentSlide === 0 && swipeDirection === 'right' || _.currentSlide >= _.getDotCount() && swipeDirection === 'left') { 8211 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 8212 _.touchObject.edgeHit = true; 8213 } 8214 } 8215 if (_.options.vertical === false) { 8216 _.swipeLeft = curLeft + swipeLength * positionOffset; 8217 } else { 8218 _.swipeLeft = curLeft + swipeLength * (_.$list.height() / _.listWidth) * positionOffset; 8219 } 8220 if (_.options.verticalSwiping === true) { 8221 _.swipeLeft = curLeft + swipeLength * positionOffset; 8222 } 8223 if (_.options.fade === true || _.options.touchMove === false) { 8224 return false; 8225 } 8226 if (_.animating === true) { 8227 _.swipeLeft = null; 8228 return false; 8229 } 8230 _.setCSS(_.swipeLeft); 8231 }; 8232 Slick.prototype.swipeStart = function (event) { 8233 var _ = this, 8234 touches; 8235 _.interrupted = true; 8236 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 8237 _.touchObject = {}; 8238 return false; 8239 } 8240 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 8241 touches = event.originalEvent.touches[0]; 8242 } 8243 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 8244 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 8245 _.dragging = true; 8246 }; 8247 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function () { 8248 var _ = this; 8249 if (_.$slidesCache !== null) { 8250 _.unload(); 8251 _.$slideTrack.children(this.options.slide).detach(); 8252 _.$slidesCache.appendTo(_.$slideTrack); 8253 _.reinit(); 8254 } 8255 }; 8256 Slick.prototype.unload = function () { 8257 var _ = this; 8258 $('.slick-cloned', _.$slider).remove(); 8259 if (_.$dots) { 8260 _.$dots.remove(); 8261 } 8262 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 8263 _.$prevArrow.remove(); 8264 } 8265 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 8266 _.$nextArrow.remove(); 8267 } 8268 _.$slides.removeClass('slick-slide slick-active slick-visible slick-current').attr('aria-hidden', 'true').css('width', ''); 8269 }; 8270 Slick.prototype.unslick = function (fromBreakpoint) { 8271 var _ = this; 8272 _.$slider.trigger('unslick', [_, fromBreakpoint]); 8273 _.destroy(); 8274 }; 8275 Slick.prototype.updateArrows = function () { 8276 var _ = this, 8277 centerOffset; 8278 centerOffset = Math.floor(_.options.slidesToShow / 2); 8279 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow && !_.options.infinite) { 8280 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 8281 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 8282 if (_.currentSlide === 0) { 8283 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 8284 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 8285 } else if (_.currentSlide >
8285= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 8286 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 8287 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 8288 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 8289 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 8290 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 8291 } 8292 } 8293 }; 8294 Slick.prototype.updateDots = function () { 8295 var _ = this; 8296 if (_.$dots !== null) { 8297 _.$dots.find('li').removeClass('slick-active').end(); 8298 _.$dots.find('li').eq(Math.floor(_.currentSlide / _.options.slidesToScroll)).addClass('slick-active'); 8299 } 8300 }; 8301 Slick.prototype.visibility = function () { 8302 var _ = this; 8303 if (_.options.autoplay) { 8304 if (document[_.hidden]) { 8305 _.interrupted = true; 8306 } else { 8307 _.interrupted = false; 8308 } 8309 } 8310 }; 8311 $.fn.slick = function () { 8312 var _ = this, 8313 opt = arguments[0], 8314 args = Array.prototype.slice.call(arguments, 1), 8315 l = _.length, 8316 i, 8317 ret; 8318 for (i = 0; i < l; i++) { 8319 if (typeof opt == 'object' || typeof opt == 'undefined') _[i].slick = new Slick(_[i], opt);else ret = _[i].slick[opt].apply(_[i].slick, args); 8320 if (typeof ret != 'undefined') return ret; 8321 } 8322 return _; 8323 }; 8324}); 8325 8326/* 8327 * @license jQuery Breakpoints | MIT | Jerry Low | https://www.github.com/jerrylow/breakpoints 8328 */ 8329 8330(function ($) { 8331 var Breakpoints = function (el, options) { 8332 var _ = this; 8333 _.n = "breakpoints"; 8334 _.settings = {}; 8335 _.currentBp = null; 8336 _.getBreakpoint = function () { 8337 var winW = _windowWidth(); 8338 var bps = _.settings.breakpoints; 8339 var bpName; 8340 bps.forEach(function (bp) { 8341 if (winW >= bp.width) { 8342 bpName = bp.name; 8343 } 8344 }); 8345 8346 // Fallback to largest breakpoint. 8347 if (!bpName) { 8348 bpName = bps[bps.length - 1].name; 8349 } 8350 return bpName; 8351 }; 8352 _.getBreakpointWidth = function (bpName) { 8353 var bps = _.settings.breakpoints; 8354 var bpWidth; 8355 bps.forEach(function (bp) { 8356 if (bpName == bp.name) { 8357 bpWidth = bp.width; 8358 } 8359 }); 8360 return bpWidth; 8361 }; 8362 _.compareCheck = function (check, checkBpName, callback) { 8363 var winW = _windowWidth(); 8364 var bps = _.settings.breakpoints;
vendor: 3,875 bytes, lines 8365-8497
8365 var bpWidth = _.getBreakpointWidth(checkBpName); 8366 var isBp = false; 8367 switch (check) { 8368 case "lessThan": 8369 isBp = winW < bpWidth; 8370 break; 8371 case "lessEqualTo": 8372 isBp = winW <= bpWidth; 8373 break; 8374 case "greaterThan": 8375 isBp = winW > bpWidth; 8376 break; 8377 case "greaterEqualTo": 8378 isBp = winW > bpWidth; 8379 break; 8380 case "inside": 8381 var bpIndex = bps.findIndex(function (bp) { 8382 return bp.name === checkBpName; 8383 }); 8384 if (bpIndex === bps.length - 1) { 8385 isBp = winW > bpWidth; 8386 } else { 8387 var nextBpWidth = _.getBreakpointWidth(bps[bpIndex + 1].name); 8388 isBp = winW >= bpWidth && winW < nextBpWidth; 8389 } 8390 break; 8391 } 8392 if (isBp) { 8393 callback(); 8394 } 8395 }; 8396 _.destroy = function () { 8397 $(window).unbind(_.n); 8398 }; 8399 var _compareTrigger = function () { 8400 var winW = _windowWidth(); 8401 var bps = _.settings.breakpoints; 8402 var currentBp = _.currentBp; 8403 bps.forEach(function (bp) { 8404 if (currentBp === bp.name) { 8405 if (!bp.inside) { 8406 $(window).trigger('inside-' + bp.name); 8407 bp.inside = true; 8408 } 8409 } else { 8410 bp.inside = false; 8411 } 8412 if (winW < bp.width) { 8413 if (!bp.less) { 8414 $(window).trigger('lessThan-' + bp.name); 8415 bp.less = true; 8416 bp.greater = false; 8417 bp.greaterEqual = false; 8418 } 8419 } 8420 if (winW >= bp.width) { 8421 if (!bp.greaterEqual) { 8422 $(window).trigger('greaterEqualTo-' + bp.name); 8423 bp.greaterEqual = true; 8424 bp.less = false; 8425 } 8426 if (winW > bp.width) { 8427 if (!bp.greater) { 8428 $(window).trigger('greaterThan-' + bp.name); 8429 bp.greater = true; 8430 bp.less = false; 8431 } 8432 } 8433 } 8434 }); 8435 }; 8436 var _windowWidth = function () { 8437 var win = $(window); 8438 if (_.outerWidth) { 8439 return win.outerWidth(); 8440 } 8441 return window.innerWidth ? window.innerWidth : win.width(); 8442 }; 8443 var _resizeCallback = function () { 8444 var newBp = _.getBreakpoint(); 8445 if (newBp !== _.currentBp) { 8446 $(window).trigger({ 8447 "type": "breakpoint-change", 8448 "from": _.currentBp, 8449 "to": newBp 8450 }); 8451 _.currentBp = newBp; 8452 } 8453 }; 8454 8455 // Initiate 8456 var settings = $.extend({}, $.fn.breakpoints.defaults, options); 8457 _.settings = { 8458 breakpoints: settings.breakpoints, 8459 buffer: settings.buffer, 8460 triggerOnInit: settings.triggerOnInit, 8461 outerWidth: settings.outerWidth 8462 }; 8463 el.data(_.n, this); 8464 _.currentBp = _.getBreakpoint(); 8465 var resizeThresholdTimerId = null; 8466 if ($.isFunction($(window).on)) { 8467 $(window).on("resize." + _.n, function (e) { 8468 if (resizeThresholdTimerId) { 8469 clearTimeout(resizeThresholdTimerId); 8470 } 8471 resizeThresholdTimerId = setTimeout(function (e) { 8472 _resizeCallback(); 8473 _compareTrigger(); 8474 }, _.settings.buffer); 8475 }); 8476 } 8477 if (_.settings.triggerOnInit) { 8478 setTimeout(function () { 8479 $(window).trigger({ 8480 "type": "breakpoint-change", 8481 "from": _.currentBp, 8482 "to": _.currentBp, 8483 "initialInit": true 8484 }); 8485 }, _.settings.buffer); 8486 } 8487 setTimeout(function () { 8488 _compareTrigger(); 8489 }, 0); 8490 }; 8491 $.fn.breakpoints = function (method, arg1, arg2) { 8492 if (this.data("breakpoints")) { 8493 var thisBp = this.data("breakpoints"); 8494 var compareMethods = ["lessThan", "lessEqualTo", "greaterThan", "greaterEqualTo", "inside"]; 8495 if (method === "getBreakpoint") { 8496 return thisBp.getBreakpoint(); 8497 }
vendor: 8,193 bytes, lines 8497-8745
8497 else if (method === "getBreakpointWidth") { 8498 return thisBp.getBreakpointWidth(arg1); 8499 } else if (compareMethods.indexOf(method) >= 0) { 8500 return thisBp.compareCheck(method, arg1, arg2); 8501 } else if (method === "destroy") { 8502 thisBp.destroy(); 8503 } 8504 return; 8505 } 8506 new Breakpoints(this, method); 8507 }; 8508 $.fn.breakpoints.defaults = { 8509 breakpoints: [{ 8510 "name": "xs", 8511 "width": 0 8512 }, { 8513 "name": "sm", 8514 "width": 768 8515 }, { 8516 "name": "md", 8517 "width": 992 8518 }, { 8519 "name": "lg", 8520 "width": 1200 8521 }], 8522 buffer: 300, 8523 triggerOnInit: false, 8524 outerWidth: false 8525 }; 8526})(jQuery); 8527 8528/*! 8529 * hoverIntent v1.10.2 // 2020.04.28 // jQuery v1.7.0+ 8530 * http://briancherne.github.io/jquery-hoverIntent/ 8531 * 8532 * You may use hoverIntent under the terms of the MIT license. Basically that 8533 * means you are free to use hoverIntent as long as this header is left intact. 8534 * Copyright 2007-2019 Brian Cherne 8535 */ 8536 8537/** 8538 * hoverIntent is similar to jQuery's built-in "hover" method except that 8539 * instead of firing the handlerIn function immediately, hoverIntent checks 8540 * to see if the user's mouse has slowed down (beneath the sensitivity 8541 * threshold) before firing the event. The handlerOut function is only 8542 * called after a matching handlerIn. 8543 * 8544 * // basic usage ... just like .hover() 8545 * .hoverIntent( handlerIn, handlerOut ) 8546 * .hoverIntent( handlerInOut ) 8547 * 8548 * // basic usage ... with event delegation! 8549 * .hoverIntent( handlerIn, handlerOut, selector ) 8550 * .hoverIntent( handlerInOut, selector ) 8551 * 8552 * // using a basic configuration object 8553 * .hoverIntent( config ) 8554 * 8555 * @param handlerIn function OR configuration object 8556 * @param handlerOut function OR selector for delegation OR undefined 8557 * @param selector selector OR undefined 8558 * @author Brian Cherne <brian(at)cherne(dot)net> 8559 */ 8560 8561; 8562(function (factory) { 8563 'use strict'; 8564 8565 if (typeof define === 'function' && define.amd) { 8566 define(['jquery'], factory); 8567 } else if (typeof module === 'object' && module.exports) { 8568 module.exports = factory(require('jquery')); 8569 } else if (jQuery && !jQuery.fn.hoverIntent) { 8570 factory(jQuery); 8571 } 8572})(function ($) { 8573 'use strict'; 8574 8575 // default configuration values 8576 var _cfg = { 8577 interval: 100, 8578 sensitivity: 6, 8579 timeout: 0 8580 }; 8581 8582 // counter used to generate an ID for each instance 8583 var INSTANCE_COUNT = 0; 8584 8585 // current X and Y position of mouse, updated during mousemove tracking (shared across instances) 8586 var cX, cY; 8587 8588 // saves the current pointer position coordinates based on the given mousemove event 8589 var track = function (ev) { 8590 cX = ev.pageX; 8591 cY = ev.pageY; 8592 }; 8593 8594 // compares current and previous mouse positions 8595 var compare = function (ev, $el, s, cfg) { 8596 // compare mouse positions to see if pointer has slowed enough to trigger `over` function 8597 if (Math.sqrt((s.pX - cX) * (s.pX - cX) + (s.pY - cY) * (s.pY - cY)) < cfg.sensitivity) { 8598 $el.off(s.event, track); 8599 delete s.timeoutId; 8600 // set hoverIntent state as active for this element (permits `out` handler to trigger) 8601 s.isActive = true; 8602 // overwrite old mouseenter event coordinates with most recent pointer position 8603 ev.pageX = cX; 8604 ev.pageY = cY; 8605 // clear coordinate data from state object 8606 delete s.pX; 8607 delete s.pY; 8608 return cfg.over.apply($el[0], [ev]); 8609 } else { 8610 // set previous coordinates for next comparison 8611 s.pX = cX; 8612 s.pY = cY; 8613 // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs) 8614 s.timeoutId = setTimeout(function () { 8615 compare(ev, $el, s, cfg); 8616 }, cfg.interval); 8617 } 8618 }; 8619 8620 // triggers given `out` function at configured `timeout` after a mouseleave and clears state 8621 var delay = function (ev, $el, s, out) { 8622 var data = $el.data('hoverIntent'); 8623 if (data) { 8624 delete data[s.id]; 8625 } 8626 return out.apply($el[0], [ev]); 8627 }; 8628 8629 // checks if `value` is a function 8630 var isFunction = function (value) { 8631 return typeof value === 'function'; 8632 }; 8633 $.fn.hoverIntent = function (handlerIn, handlerOut, selector) { 8634 // instance ID, used as a key to store and retrieve state information on an element 8635 var instanceId = INSTANCE_COUNT++; 8636 8637 // extend the default configuration and parse parameters 8638 var cfg = $.extend({}, _cfg); 8639 if ($.isPlainObject(handlerIn)) { 8640 cfg = $.extend(cfg, handlerIn); 8641 if (!isFunction(cfg.out)) { 8642 cfg.out = cfg.over; 8643 } 8644 } else if (isFunction(handlerOut)) { 8645 cfg = $.extend(cfg, { 8646 over: handlerIn, 8647 out: handlerOut, 8648 selector: selector 8649 }); 8650 } else { 8651 cfg = $.extend(cfg, { 8652 over: handlerIn, 8653 out: handlerIn, 8654 selector: handlerOut 8655 }); 8656 } 8657 8658 // A private function for handling mouse 'hovering' 8659 var handleHover = function (e) { 8660 // cloned event to pass to handlers (copy required for event object to be passed in IE) 8661 var ev = $.extend({}, e); 8662 8663 // the current target of the mouse event, wrapped in a jQuery object 8664 var $el = $(this); 8665 8666 // read hoverIntent data from element (or initialize if not present) 8667 var hoverIntentData = $el.data('hoverIntent'); 8668 if (!hoverIntentData) { 8669 $el.data('hoverIntent', hoverIntentData = {}); 8670 } 8671 8672 // read per-instance state from element (or initialize if not present) 8673 var state = hoverIntentData[instanceId]; 8674 if (!state) { 8675 hoverIntentData[instanceId] = state = { 8676 id: instanceId 8677 }; 8678 } 8679 8680 // state properties: 8681 // id = instance ID, used to clean up data 8682 // timeoutId = timeout ID, reused for tracking mouse position and delaying "out" handler 8683 // isActive = plugin state, true after `over` is called just until `out` is called 8684 // pX, pY = previously-measured pointer coordinates, updated at each polling interval 8685 // event = string representing the namespaced event used for mouse tracking 8686 8687 // clear any existing timeout 8688 if (state.timeoutId) { 8689 state.timeoutId = clearTimeout(state.timeoutId); 8690 } 8691 8692 // namespaced event used to register and unregister mousemove tracking 8693 var mousemove = state.event = 'mousemove.hoverIntent.hoverIntent' + instanceId; 8694 8695 // handle the event, based on its type 8696 if (e.type === 'mouseenter') { 8697 // do nothing if already active 8698 if (state.isActive) { 8699 return; 8700 } 8701 // set "previous" X and Y position based on initial entry point 8702 state.pX = ev.pageX; 8703 state.pY = ev.pageY; 8704 // update "current" X and Y position based on mousemove 8705 $el.off(mousemove, track).on(mousemove, track); 8706 // start polling interval (self-calling timeout) to compare mouse coordinates over time 8707 state.timeoutId = setTimeout(function () { 8708 compare(ev, $el, state, cfg); 8709 }, cfg.interval); 8710 } else { 8711 // "mouseleave" 8712 // do nothing if not already active 8713 if (!state.isActive) { 8714 return; 8715 } 8716 // unbind expensive mousemove event 8717 $el.off(mousemove, track); 8718 // if hoverIntent state is true, then call the mouseOut function after the specified delay 8719 state.timeoutId = setTimeout(function () { 8720 delay(ev, $el, state, cfg.out); 8721 }, cfg.timeout); 8722 } 8723 }; 8724 8725 // listen for mouseenter and mouseleave 8726 return this.on({ 8727 'mouseenter.hoverIntent': handleHover, 8728 'mouseleave.hoverIntent': handleHover 8729 }, cfg.selector); 8730 }; 8731}); 8732($ => { 8733 const cookieName = 'ie_upgrade_bar'; 8734 const ieVersionIsNotSupported = () => { 8735 let ua = window.navigator.userAgent; 8736 let msie = ua.indexOf('MSIE '); // IE 10 or older 8737 let trident = ua.indexOf('Trident/'); // IE 11 8738 8739 return msie > 0 || trident > 0; 8740 }; 8741 const showIEUpgradeBar = () => { 8742 if (ieVersionIsNotSupported() && !Cookies.get(cookieName)) { 8743 // No CMS controls for text 8744 const text = 'Your browser is out of date. Please upgrade for optimal experience.'; 8745 const buttons = '<div class="alert-bar__button-group">
8745<a href="https://www.microsoft.com/en-us/edge" class="btn btn-primary"><i class="fab fa-edge"></i>Upgrade to Edge</a><a href="https://www.google.com/chrome/" class="btn btn-primary"><i class="fab fa-chrome"></i>Try Chrome</a></div>'; 8746 let html = '<div class="alert-bar alert-bar--ie alert-bar--white-bg open">'; 8747 html += '<div class="alert-bar__content">'; 8748 html += '<div class="alert-bar__url">'; 8749 html += '<div class="alert-bar__copy"><p>' + text + '</p>' + buttons + '</div>'; 8750 html += '<button id="closeIEBar" class="alert-bar__close"></button>'; 8751 html += '</div>'; 8752 html += '</div>'; 8753 html += '</div>'; 8754 // insert before alert bar 8755 $(html).insertAfter('#main-header'); 8756 } 8757 }; 8758 $(document).ready(() => { 8759 showIEUpgradeBar(); 8760 $(document).on('click', '#closeIEBar', () => { 8761 // set cookie, do not display for session 8762 Cookies.set(cookieName, 1, { 8763 expires: 1 8764 }); 8765 // hide IE upgrade bar 8766 $('.alert-bar--ie').addClass('dismissed').removeClass('open'); 8767 }); 8768 }); 8769})(jQuery); 8770(function ($) { 8771 $(window).breakpoints({ 8772 breakpoints: [{ 8773 "name": "xs", 8774 "width": 0 8775 }, { 8776 "name": "sm", 8777 "width": 576 8778 }, { 8779 "name": "md", 8780 "width": 768 8781 }, { 8782 "name": "lg", 8783 "width": 992 8784 }, { 8785 "name": "xl", 8786 "width": 1390 8787 }] 8788 }); 8789})(jQuery); 8790(function ($) { 8791 $(document).ready(function () { 8792 var nextArrowCustom = '<button class="slick-arrow slick-next"><i class="fas fa-chevron-right"></i><span class="sr-only">Next</span></button>'; 8793 var prevArrowCustom = '<button class="slick-arrow slick-prev"><i class="fas fa-chevron-left"></i><span class="sr-only">Prev</span></button>'; 8794 8795 // Request for removal of carousel pagination counters 8796 // Leaving in for now incase this changes 8797 // $('.carousel').on('init reInit afterChange', function(event, slick, currentSlide, nextSlide){ 8798 // var slidesToShow = slick.options.slidesToShow; 8799 // var totalSlides = slick.slideCount; 8800 // var slidePages = Math.ceil(totalSlides / slidesToShow); 8801 // // currentSlide is undefined on init -- set it to 0 8802 // var i = (currentSlide ? currentSlide : 0) + 1; 8803 // var currentPage = Math.ceil(i / slidesToShow); 8804 8805 // $(this).next('.carousel-pagination').html('<span class="slideCountItem">' + currentPage + '</span> ' + ' of ' + ' <span class="slideCountAll">' + slidePages + '</span>'); 8806 // }); 8807 8808 var carousel = $(".carousel--homepage").slick({ 8809 slidesToShow: 1, 8810 slidesToScroll: 1, 8811 dots: true, 8812 nextArrow: nextArrowCustom, 8813 prevArrow: prevArrowCustom, 8814 pauseOnFocus: true, 8815 pauseOnHover: true, 8816 lazyLoad: true, 8817 infinite: true, 8818 responsive: false, 8819 autoplay: true, 8820 autoplaySpeed: 5000 8821 }); 8822 $('.carousel--homepage').on('init reInit', function (event, slick) { 8823 var $carousel = $(this); 8824 8825 // Check if wrapper already exists in page-hero__copy 8826 if ($('.page-hero--homepage .slick-navigation-wrapper').length === 0) { 8827 // Create wrapper 8828 var $wrapper = $('<div class="slick-navigation-wrapper"></div>'); 8829 8830 // Move elements to wrapper in correct order 8831 var $prevArrow = $carousel.find('.slick-prev').detach(); 8832 var $dots = $carousel.find('.slick-dots').detach(); 8833 var $nextArrow = $carousel.find('.slick-next').detach(); 8834 8835 // Append in order: prev, dots, next 8836 $wrapper.append($prevArrow); 8837 $wrapper.append($dots); 8838 $wrapper.append($nextArrow); 8839 8840 // Append wrapper to page-hero__copy 8841 $('.page-hero--homepage').append($wrapper); 8842 } 8843 }); 8844 // Set initial active dot state 8845 $('.carousel--homepage').on('init', function (event, slick) { 8846 setTimeout(function () { 8847 $('.slick-navigation-wrapper .slick-dots li').removeClass('slick-active'); 8848 $('.slick-navigation-wrapper .slick-dots li').eq(0).addClass('slick-active'); 8849 }, 100); 8850 }); 8851 $('.carousel--homepage').on('afterChange', function (event, slick, currentSlide) { 8852 // Update dot active states for the fixed navigation wrapper 8853 $('.slick-navigation-wrapper .slick-dots li').removeClass('slick-active'); 8854 $('.slick-navigation-wrapper .slick-dots li').eq(currentSlide).addClass('slick-active'); 8855 }); 8856 $(document).on('click', '.slide', function () { 8857 window.open($(this).data('url'), $(this).data('destination') || '_self'); 8858 }); 8859 // Handle manual dot clicks 8860 $(document).on('click', '.slick-navigation-wrapper .slick-dots li button', function (e) { 8861 e.preventDefault(); 8862 e.stopImmediatePropagation(); 8863 var slideIndex = $(this).parent().index(); 8864 $('.carousel--homepage').slick('slickGoTo', slideIndex); 8865 }); 8866 8867 // Trigger the reorganization for existing carousel
8868 if ($('.carousel--homepage').hasClass('slick-initialized')) { 8869 $('.carousel--homepage').trigger('reInit'); 8870 } 8871 // Handle arrow clicks to ensure dot states update 8872 $(document).on('click', '.slick-navigation-wrapper .slick-prev, .slick-navigation-wrapper .slick-next', function (e) { 8873 e.preventDefault(); 8874 const clickText = $(this).hasClass('slick-prev') ? 'prev' : 'next'; 8875 const dataLayerEvent = { 8876 event: "click_carousel", 8877 click_source: window.location.href, 8878 click_text: clickText, 8879 click_tracking: "hero-module:" + clickText, 8880 click_type: "internal", 8881 link_location: "hero", 8882 link_module: "hero", 8883 link_type: "internal" 8884 }; 8885 dataLayer.push(dataLayerEvent); 8886 e.stopImmediatePropagation(); 8887 if ($(this).hasClass('slick-prev')) { 8888 $('.carousel--homepage').slick('slickPrev'); 8889 } else { 8890 $('.carousel--homepage').slick('slickNext'); 8891 } 8892 }); 8893 var carousel = $(".carousel--1-col").slick({ 8894 slidesToShow: 1, 8895 slidesToScroll: 1, 8896 dots: false, 8897 nextArrow: nextArrowCustom, 8898 prevArrow: prevArrowCustom, 8899 pauseOnFocus: true, 8900 pauseOnHover: true, 8901 lazyLoad: true, 8902 infinite: true, 8903 responsive: false 8904 }); 8905 var carousel = $(".carousel--2-col").slick({ 8906 slidesToShow: 2, 8907 slidesToScroll: 2, 8908 dots: false, 8909 nextArrow: nextArrowCustom, 8910 prevArrow: prevArrowCustom, 8911 pauseOnFocus: true, 8912 pauseOnHover: true, 8913 lazyLoad: false, 8914 infinite: true, 8915 responsive: [{ 8916 breakpoint: $(window).breakpoints("getBreakpointWidth", "xl"), 8917 settings: { 8918 slidesToShow: 2, 8919 slidesToScroll: 2 8920 } 8921 }, { 8922 breakpoint: $(window).breakpoints("getBreakpointWidth", "lg"), 8923 settings: { 8924 slidesToShow: 1, 8925 slidesToScroll: 1 8926 } 8927 }] 8928 }); 8929 var carousel = $(".carousel--3-col").slick({ 8930 slidesToShow: 3, 8931 slidesToScroll: 3, 8932 dots: false, 8933 nextArrow: nextArrowCustom, 8934 prevArrow: prevArrowCustom, 8935 pauseOnFocus: true, 8936 pauseOnHover: true, 8937 lazyLoad: false, 8938 infinite: true, 8939 responsive: [{ 8940 breakpoint: $(window).breakpoints("getBreakpointWidth", "lg"), 8941 settings: { 8942 slidesToShow: 2, 8943 slidesToScroll: 2 8944 } 8945 }, { 8946 breakpoint: $(window).breakpoints("getBreakpointWidth", "md"), 8947 settings: { 8948 slidesToShow: 1, 8949 slidesToScroll: 1 8950 } 8951 }] 8952 }); 8953 8954 // Commenting out until homepage hero carousel move forward 8955 // var carousel = $(".carousel.carousel--hero").slick({ 8956 // slidesToShow: 1, 8957 // slidesToScroll: 1, 8958 // dots: false, 8959 // nextArrow: nextArrowCustom, 8960 // prevArrow: prevArrowCustom, 8961 // pauseOnFocus: true, 8962 // pauseOnHover: true, 8963 // lazyLoad: true, 8964 // // infinite: false, 8965 // }); 8966 8967 // Rebuild video slide after slide change to stop video in the case it may be playing 8968 $('.carousel').on('beforeChange', function (event, slick, currentSlide, nextSlide) { 8969 var current = $(slick.$slides[currentSlide]); 8970 if (current.html().indexOf('--video') >= 0) { 8971 current.html(current.html()); 8972 } 8973 }); 8974 8975 // $('.carousel').on('afterChange', function(event, slick, currentSlide, nextSlide){ 8976 // }); 8977 8978 $('.carousel').on('click', function () { 8979 carousel.slick('slickPause'); 8980 }); 8981 }); 8982})(jQuery); 8983($ => { 8984 const toggleMobileNav = action => { 8985 var action = action || 'toggle'; 8986 if (action == 'close') { 8987 $('body').removeClass('nav-open'); 8988 $('#menu-primary').removeClass('show'); 8989 } else { 8990 $('body').toggleClass('nav-open'); 8991 $('#menu-primary').toggleClass('show'); 8992 } 8993 }; 8994 $(document).ready(() => { 8995 $('.navbar-toggler').click(() => { 8996 toggleMobileNav(); 8997 }); 8998 $('#closeNavMenu').click(() => { 8999 toggleMobileNav('close'); 9000 }); 9001 9002 // Handles hover event for top level menu items (desktop) 9003 $('.menu-item-has-children').hover(e => { 9004 const $this = e.currentTarget; 9005 const otherMenus = $('.menu-item-has-children').not($this);
9006 $($this).addClass('sub-menu-open'); 9007 $($this).css('z-index', 101); 9008 otherMenus.children().first().addClass('no-highlight'); 9009 }, e => { 9010 const $this = e.currentTarget; 9011 $('.menu-item-has-children a').removeClass('no-highlight'); 9012 // Explaination of the madness below: 9013 // If navbar is fixed, all submenus should hide on hoverout, including those intended to be open by default 9014 // If navbar is not fixed and parent menu item's submenu is not intended to be open by default, hide it on hoverout 9015 if ($('body').is('.navbar-is-fixed') || !$('body').is('.navbar-is-fixed') && !$(e.currentTarget).is('.sub-menu-open-by-default')) { 9016 $($this).removeClass('sub-menu-open'); 9017 } 9018 $($this).css('z-index', 99); 9019 }); 9020 9021 // Removes active styles from current menu item in sub menu when hovering on another sub menu item 9022 var $highLightEls = $('.current_page_item, .current-menu-item'); 9023 $('.sub-menu li a').not('.sub-menu li.current-menu-item a').hover(() => { 9024 $('.sub-menu').find($highLightEls).addClass('no-highlight'); 9025 }, () => { 9026 $('.sub-menu').find($highLightEls).removeClass('no-highlight'); 9027 }); 9028 }); 9029 $(window).resize(() => { 9030 $(window).on('greaterThan-lg', () => { 9031 toggleMobileNav('close'); 9032 }); 9033 }); 9034 9035 // close the mobile nav if user click on any element outside of the menu, except for the language modal or clicks the nav toggler button 9036 $(document).bind('mouseup touchend', e => { 9037 if ($('body').is('.nav-open')) { 9038 var container = $('#site-header, #menu-primary, #languageModal, .navbar-toggler'); 9039 if (!container.is(e.target) && container.has(e.target).length === 0) { 9040 e.preventDefault(); // prevent accidental click on link 9041 toggleMobileNav('close'); 9042 } 9043 } 9044 }); 9045})(jQuery); 9046($ => { 9047 const NAV_BAR_EXPAND_MAX_WIDTH = 991; 9048 const $window = $(window); 9049 const $body = $('body'); 9050 const $mainHeader = $('#main-header'); 9051 const $mainSubnav = $('#main-subnav'); 9052 const $menuPrimary = $('#menu-primary'); 9053 const $menuPrimarySubMenu = $('#menu-primary ul.sub-menu'); 9054 const $navbar = $mainHeader.find('.navbar'); 9055 const stickyNavMobile = () => { 9056 const mainHeaderHeight = $mainHeader.outerHeight(); 9057 const st = $window.scrollTop(); 9058 if (st > lastScrollTop && st > mainHeaderHeight) { 9059 $mainHeader.css('top', -mainHeaderHeight); 9060 } else { 9061 $mainHeader.css('top', 0); 9062 } 9063 lastScrollTop = st; 9064 }; 9065 const stickyContactNav = () => { 9066 if ($mainSubnav.length > 0) { 9067 const scrollTop = $window.scrollTop(); 9068 const mainHeaderNavbarHeight = $navbar.outerHeight(); 9069 const offset = window.innerWidth > NAV_BAR_EXPAND_MAX_WIDTH ? mainHeaderNavbarHeight : 0; 9070 if (scrollTop > $('#main-subnav-container').offset().top) { 9071 $mainSubnav.addClass('fixed').css('top', offset); 9072 } else { 9073 $mainSubnav.removeClass('fixed').css('top', 'auto'); 9074 } 9075 } 9076 }; 9077 const stickyNavDesktop = () => { 9078 const st = $window.scrollTop(); 9079 if (st > $navbar.outerHeight()) { 9080 $navbar.addClass('is-fixed'); 9081 $('li.sub-menu-open-by-default').removeClass('sub-menu-open'); 9082 } else { 9083 $navbar.removeClass('is-fixed'); 9084 $('li.sub-menu-open-by-default').addClass('sub-menu-open'); 9085 } 9086 }; 9087 const headerOffsetPadding = () => { 9088 let headerHeight = 0; 9089 const offset = 1; // sometimes the calculations are off by 1px 9090 9091 if (window.innerWidth > NAV_BAR_EXPAND_MAX_WIDTH) { 9092 const subMenuHeight = $menuPrimarySubMenu.css('display') === 'block' ? $('ul.sub-menu').outerHeight() : 0; 9093 const metaNavHeight = $('.meta-nav').outerHeight(); 9094 headerHeight = metaNavHeight + $menuPrimary.outerHeight() + subMenuHeight; 9095 } else { 9096 headerHeight = $mainHeader.outerHeight(); 9097 } 9098 $body.css('padding-top', headerHeight - offset); 9099 }; 9100 let lastScrollTop = 0; 9101 $(document).ready(() => { 9102 headerOffsetPadding(); 9103 $window.scroll(() => { 9104 stickyContactNav(); 9105 $window.breakpoints('greaterThan', 'lg', stickyNavDesktop); 9106 $window.breakpoints('lessThan', 'lg', stickyNavMobile); 9107 }); 9108 $(document).trigger('scroll'); 9109 }); 9110 $window.resize(() => { 9111 $navbar.removeClass('is-fixed'); // reset desktop 9112 $mainHeader.css('top', ''); // reset mobile 9113 headerOffsetPadding(); 9114 $(document).trigger('scroll'); 9115 }); 9116})(jQuery); 9117(function ($) { 9118 $(document).ready(function () { 9119 // '.entry-content' 9120 $('body').scrollspy({ 9121 target: '#anchorNav', 9122 offset: 60 9123 }); 9124 }); 9125})(jQuery); 9126(function ($) { 9127 function stickyBgImg() { 9128 var $bgContainer = $('.entry-content'); 9129 var $window = $(window); 9130 var $bgOffset = $bgContainer.offset().top; 9131 if ($window.scrollTop() >= $bgOffset) { 9132 $bgContainer.addClass('bg-fixed'); 9133 } else { 9134 $bgContainer.removeClass('bg-fixed'); 9135 } 9136 } 9137 $(document).ready(function () { 9138 // stickyBgImg(); 9139 }); 9140 $(window).scroll(function () { 9141 // stickyBgImg(); 9142 }); 9143})(jQuery); 9144(function ($) { 9145 /* 9146 * new_map 9147 * 9148 * This function will render a Google Map onto the selected jQuery element 9149 * 9150 * @type function 9151 * @date 8/11/2013 9152 * @since 4.3.0 9153 * 9154 * @param $el (jQuery element) 9155 * @return n/a 9156 */ 9157 9158 function new_map($el) { 9159 // var 9160 var $markers = $el.find('.map__marker'); 9161 9162 // vars 9163 var args = { 9164 zoom: 16, 9165 center: new google.maps.LatLng(0, 0), 9166 mapTypeId: google.maps.MapTypeId.ROADMAP 9167 }; 9168 9169 // create map 9170 var map = new google.maps.Map($el[0], args); 9171 9172 // add a markers reference 9173 map.markers = []; 9174 9175 // add markers 9176 $markers.each(function () { 9177 add_marker($(this), map); 9178 }); 9179 9180 // center map 9181 center_map(map); 9182 9183 // return 9184 return map; 9185 } 9186 9187 /* 9188 * add_marker 9189 * 9190 * This function will add a marker to the selected Google Map 9191 * 9192 * @type function 9193 * @date 8/11/2013 9194 * @since 4.3.0 9195 * 9196 * @param $marker (jQuery element) 9197 * @param map (Google Map object) 9198 * @return n/a 9199 */ 9200 9201 function add_marker($marker, map) { 9202 // var 9203 var latlng = new google.maps.LatLng($marker.attr('data-lat'), $marker.attr('data-lng')); 9204 9205 // create marker 9206 var marker = new google.maps.Marker({ 9207 position: latlng, 9208 map: map 9209 }); 9210 9211 // add to array 9212 map.markers.push(marker); 9213 9214 // if marker contains HTML, add it to an infoWindow 9215 if ($marker.html()) {
9216 // create info window 9217 var infowindow = new google.maps.InfoWindow({ 9218 content: $marker.html() 9219 }); 9220 9221 // show info window when marker is clicked 9222 google.maps.event.addListener(marker, 'click', function () { 9223 infowindow.open(map, marker); 9224 }); 9225 } 9226 } 9227 9228 /* 9229 * center_map 9230 * 9231 * This function will center the map, showing all markers attached to this map 9232 * 9233 * @type function 9234 * @date 8/11/2013 9235 * @since 4.3.0 9236 * 9237 * @param map (Google Map object) 9238 * @return n/a 9239 */ 9240 9241 function center_map(map) { 9242 // vars 9243 var bounds = new google.maps.LatLngBounds(); 9244 9245 // loop through all markers and create bounds 9246 $.each(map.markers, function (i, marker) { 9247 var latlng = new google.maps.LatLng(marker.position.lat(), marker.position.lng()); 9248 bounds.extend(latlng); 9249 }); 9250 9251 // only 1 marker? 9252 if (map.markers.length == 1) { 9253 // set center of map 9254 map.setCenter(bounds.getCenter()); 9255 map.setZoom(16); 9256 } else { 9257 // fit to bounds 9258 map.fitBounds(bounds); 9259 } 9260 } 9261 9262 /* 9263 * document ready 9264 * 9265 * This function will render each map when the document is ready (page has loaded) 9266 * 9267 * @type function 9268 * @date 8/11/2013 9269 * @since 5.0.0 9270 * 9271 * @param n/a 9272 * @return n/a 9273 */ 9274 // global var
9275 var map = null; 9276 $(document).ready(function () { 9277 $('.map').each(function () { 9278 // create map 9279 map = new_map($(this)); 9280 }); 9281 }); 9282})(jQuery); 9283(function (d, s, id) { 9284 var js, 9285 fjs = d.getElementsByTagName(s)[0]; 9286 if (d.getElementById(id)) { 9287 return; 9288 } 9289 js = d.createElement(s); 9290 js.id = id; 9291 js.src = "//connect.facebook.net/en_US/all.js"; 9292 fjs.parentNode.insertBefore(js, fjs); 9293})(document, 'script', 'facebook-jssdk'); 9294(function ($) { 9295 function shareOnFacebook(ogUrl) { 9296 var width = 575, 9297 height = 400, 9298 left = ($(window).width() - width) / 2, 9299 top = ($(window).height() - height) / 2, 9300 url = ogUrl, 9301 opts = 'status=1' + ',width=' + width + ',height=' + height + ',top=' + top + ',left=' + left; 9302 window.open('https://www.facebook.com/sharer/sharer.php?u=' + url + '?cmp=osc_blog_shareback_fb', 'facebook-share-dialog', opts); 9303 } 9304 function shareOnX(url, desc) { 9305 const shareUrl = `https://x.com/intent/post?text=${desc}&url=${url}`; 9306 window.open(shareUrl, '_blank', 'width=600,height=400'); 9307 } 9308 $(document).ready(function () { 9309 $(document).on('click', '.social-share', function (e) { 9310 if ($(this).data('platform') == 'facebook') { 9311 const url = $('meta[property="og:url"]').attr('content'); 9312 shareOnFacebook(url); 9313 } else if ($(this).data('platform') == 'x') { 9314 const url = encodeURIComponent(window.location.href); 9315 const metaDesc = $('meta[name="description"]').attr('content'); 9316 const ogDesc = $('meta[name="og:description"]').attr('content'); 9317 const desc = ogDesc ? ogDesc : metaDesc; 9318 shareOnX(url, desc); 9319 } 9320 e.preventDefault(); 9321 }); 9322 }); 9323})(jQuery); 9324(function ($) { 9325 $(document).ready(function () { 9326 var button = $('#loadMorePosts'); 9327 var paginationContainer = $('.pagination'); 9328 var page = 2; 9329 var loading = false; 9330 var postType = button.attr('data-post-type'); 9331 var postTypeName = postType == 'photos' ? 'photo' : 'blog'; 9332 function loadMore() { 9333 if (!loading && !$('#end-of-posts').length) { 9334 loading = true; 9335 button.hide(); 9336 var data = { 9337 action: 'rox_ajax_load_more', 9338 page: page, 9339 query: false, 9340 postType: postType 9341 }; 9342 $.post(rox_data.ajax_url, data, function (res) { 9343 if (res.success) { 9344 if (res.data) { 9345 $(res.data).insertBefore(paginationContainer); 9346 page = page + 1; 9347 loading = false; 9348 button.show(); 9349 } else if (!$('#end-of-posts').length) { 9350 $('.pagination').html('<h4 id="end-of-posts">You have reached the end of ' + postTypeName + ' posts.</h4>'); 9351 } 9352 } else { 9353 // console.log(res); 9354 } 9355 }).fail(function (xhr, textStatus, e) { 9356 // console.log(xhr.responseText); 9357 }); 9358 } 9359 } 9360 $.fn.isInViewport = function () { 9361 var elementTop = $(this).offset().top; 9362 var elementBottom = elementTop + $(this).outerHeight(); 9363 var viewportTop = $(window).scrollTop(); 9364 var viewportBottom = viewportTop + $(window).height(); 9365 return elementBottom > viewportTop && elementTop < viewportBottom; 9366 }; 9367 $('#loadMorePosts').click(function () { 9368 loadMore(); 9369 }); 9370 $(window).on('resize scroll', function () { 9371 if (button.length && button.isInViewport()) { 9372 loadMore(); 9373 } 9374 }); 9375 }); 9376})(jQuery); 9377(function ($) { 9378 $(document).ready(function () { 9379 var $video = $('#hero-video'); 9380 if ($video.length) { 9381 var breakpoint = $(window).breakpoints("getBreakpointWidth", "sm"); 9382 loadVideo(); 9383 window.onpopstate = function () { 9384 if ($(document).width() > breakpoint) { 9385 $video[0].play(); 9386 } 9387 }; 9388 function loadVideo() { 9389 var video = document.getElementById('hero-video'); 9390 if (document.querySelectorAll("#hero-video > source").length < 1) { 9391 if ($(document).width() > breakpoint) { 9392 if ($(video).attr('data-src-lg')) { 9393 var source = document.createElement('source'); 9394 $(video).attr('poster', $(video).attr('data-poster-lg')); 9395 $(source).attr('src', $(video).attr('data-src-lg')); 9396 $(source).attr('type', 'video/mp4'); 9397 video.appendChild(source); 9398 } 9399 } else { 9400 if ($(video).attr('data-src-sm')) { 9401 var source = document.createElement('source'); 9402 $(source).attr('src', $(video).attr('data-src-sm')); 9403 $(source).attr('type', 'video/mp4'); 9404 video.appendChild(source); 9405 } 9406 } 9407 } 9408 video.load();
9409 var playPromise = video.play(); 9410 if (playPromise !== undefined) { 9411 playPromise.catch(function () {}); 9412 } 9413 } 9414 } 9415 }); 9416})(jQuery); 9417($ => { 9418 // Get the current environment 9419 const host = window.location.host; 9420 let environment = ""; 9421 if (host.includes("dev.")) { 9422 environment = "dev_"; 9423 } else if (host.includes("qa.")) { 9424 environment = "qa_"; 9425 } else if (host.includes("staging.")) { 9426 environment = "staging_"; 9427 } 9428 const cookieName = environment + 'promo_modal_'; 9429 const getWpRest = (endpoint, limit = 1, successCallback) => { 9430 $.ajax({ 9431 type: 'GET', 9432 url: `${rox_data.restUrlBase}modal?filter[posts_per_page]=${limit}`, 9433 beforeSend: xhr => { 9434 xhr.setRequestHeader('X-WP-Nonce', rox_data.restNonce); 9435 }, 9436 success: response => { 9437 if (response.length && successCallback) { 9438 const responseData = limit === 1 && response[0] ? response[0] : response; 9439 successCallback(responseData); 9440 } else { 9441 return false; 9442 } 9443 }, 9444 error: err => { 9445 $.ajax({ 9446 type: 'POST', 9447 url: rox_data.ajax_url, 9448 data: { 9449 action: 'rox_ajax_error_log', 9450 nonce: rox_data.nonce, 9451 error_message: err 9452 } 9453 }); 9454 } 9455 }); 9456 }; 9457 const setModalDismissCookie = modal => { 9458 const modalID = modal.attr('data-modal-id'); 9459 getWpRest(`modal?include[]=${modalID}`, 1, response => { 9460 const expirationTime = response.acf.modal_cookie_time ? new Date(new Date().getTime() + parseInt(response.acf.modal_cookie_time) * 3600000) : new Date(new Date().getTime() + 3600000); 9461 Cookies.set(cookieName + modalID, 1, { 9462 expires: expirationTime 9463 }); 9464 }); 9465 }; 9466 $(document).ready(() => { 9467 const modal = $('.opens-onload'); 9468 modal.on('hide.bs.modal', () => { 9469 setModalDismissCookie(modal); 9470 }); 9471 $('.fsCloseModal').click(() => { 9472 setModalDismissCookie(modal); 9473 }); 9474 modal.find('a').click(() => { 9475 modal.modal('hide'); 9476 setModalDismissCookie(modal); 9477 }); 9478 }); 9479})(jQuery); 9480(function (global, factory) { 9481 typeof exports === 'object' && typeof module !== 'undefined' ? factory() : typeof define === 'function' && define.amd ? define(factory) : factory(); 9482})(void 0, function () { 9483 'use strict'; 9484 9485 var _createClass = function () { 9486 function defineProperties(target, props) { 9487 for (var i = 0; i < props.length; i++) { 9488 var descriptor = props[i]; 9489 descriptor.enumerable = descriptor.enumerable || false; 9490 descriptor.configurable = true; 9491 if ("value" in descriptor) descriptor.writable = true; 9492 Object.defineProperty(target, descriptor.key, descriptor); 9493 } 9494 } 9495 return function (Constructor, protoProps, staticProps) { 9496 if (protoProps) defineProperties(Constructor.prototype, protoProps); 9497 if (staticProps) defineProperties(Constructor, staticProps); 9498 return Constructor; 9499 }; 9500 }(); 9501 function _classCallCheck(instance, Constructor) { 9502 if (!(instance instanceof Constructor)) { 9503 throw new TypeError("Cannot call a class as a function"); 9504 } 9505 } 9506 9507 /** 9508 * Sticky Sidebar JavaScript Plugin. 9509 * @version 3.3.1 9510 * @author Ahmed Bouhuolia <[email protected]> 9511 * @license The MIT License (MIT) 9512 */ 9513 var StickySidebar = function () { 9514 // --------------------------------- 9515 // # Define Constants 9516 // --------------------------------- 9517 // 9518 var EVENT_KEY = '.stickySidebar'; 9519 var DEFAULTS = { 9520 /** 9521 * Additional top spacing of the element when it becomes sticky. 9522 * @type {Numeric|Function} 9523 */ 9524 topSpacing: 0, 9525 /** 9526 * Additional bottom spacing of the element when it becomes sticky. 9527 * @type {Numeric|Function} 9528 */ 9529 bottomSpacing: 0, 9530 /** 9531 * Container sidebar selector to know what the beginning and end of sticky element. 9532 * @type {String|False} 9533 */ 9534 containerSelector: false, 9535 /** 9536 * Inner wrapper selector. 9537 * @type {String} 9538 */ 9539 innerWrapperSelector: '.inner-wrapper-sticky', 9540 /** 9541 * The name of CSS class to apply to elements when they have become stuck. 9542 * @type {String|False} 9543 */ 9544 stickyClass: 'is-affixed', 9545 /** 9546 * Detect when sidebar and its container change height so re-calculate their dimensions. 9547 * @type {Boolean} 9548 */ 9549 resizeSensor: true, 9550 /** 9551 * The sidebar returns to its normal position if its width below this value. 9552 * @type {Numeric} 9553 */ 9554 minWidth: false 9555 }; 9556 9557 // --------------------------------- 9558 // # Class Definition 9559 // --------------------------------- 9560 // 9561 /** 9562 * Sticky Sidebar Class. 9563 * @public 9564 */ 9565 9566 var StickySidebar = function () { 9567 /** 9568 * Sticky Sidebar Constructor. 9569 * @constructor 9570 * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector. 9571 * @param {Object}
vendor: 1,741 bytes, lines 9571-9622
9571 options - The options of sticky sidebar. 9572 */ 9573 function StickySidebar(sidebar) { 9574 var _this = this; 9575 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 9576 _classCallCheck(this, StickySidebar); 9577 this.options = StickySidebar.extend(DEFAULTS, options); 9578 9579 // Sidebar element query if there's no one, throw error. 9580 this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar; 9581 if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element."); 9582 this.sidebarInner = false; 9583 this.container = this.sidebar.parentElement; 9584 9585 // Current Affix Type of sidebar element. 9586 this.affixedType = 'STATIC'; 9587 this.direction = 'down'; 9588 this.support = { 9589 transform: false, 9590 transform3d: false 9591 }; 9592 this._initialized = false; 9593 this._reStyle = false; 9594 this._breakpoint = false; 9595 this._resizeListeners = []; 9596 9597 // Dimensions of sidebar, container and screen viewport. 9598 this.dimensions = { 9599 translateY: 0, 9600 topSpacing: 0, 9601 lastTopSpacing: 0, 9602 bottomSpacing: 0, 9603 lastBottomSpacing: 0, 9604 sidebarHeight: 0, 9605 sidebarWidth: 0, 9606 containerTop: 0, 9607 containerHeight: 0, 9608 viewportHeight: 0, 9609 viewportTop: 0, 9610 lastViewportTop: 0 9611 }; 9612 9613 // Bind event handlers for referencability. 9614 ['handleEvent'].forEach(function (method) { 9615 _this[method] = _this[method].bind(_this); 9616 }); 9617 9618 // Initialize sticky sidebar for first time. 9619 this.initialize(); 9620 } 9621 9622 /**
9623 * Initializes the sticky sidebar by adding inner wrapper, define its container, 9624 * min-width breakpoint, calculating dimensions, adding helper classes and inline style. 9625 * @private 9626 */ 9627 9628 _createClass(StickySidebar, [{ 9629 key: 'initialize', 9630 value: function initialize() { 9631 var _this2 = this; 9632 this._setSupportFeatures(); 9633 9634 // Get sticky sidebar inner wrapper, if not found, will create one. 9635 if (this.options.innerWrapperSelector) { 9636 this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector); 9637 if (null === this.sidebarInner) this.sidebarInner = false; 9638 } 9639 if (!this.sidebarInner) { 9640 var wrapper = document.createElement('div'); 9641 wrapper.setAttribute('class', 'inner-wrapper-sticky'); 9642 this.sidebar.appendChild(wrapper); 9643 while (this.sidebar.firstChild != wrapper) { 9644 wrapper.appendChild(this.sidebar.firstChild); 9645 } 9646 this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky'); 9647 } 9648 9649 // Container wrapper of the sidebar. 9650 if (this.options.containerSelector) { 9651 var containers = document.querySelectorAll(this.options.containerSelector);
9652 containers = Array.prototype.slice.call(containers); 9653 containers.forEach(function (container, item) { 9654 if (!container.contains(_this2.sidebar)) return; 9655 _this2.container = container; 9656 }); 9657 if (!containers.length) throw new Error("The container does not contains on the sidebar."); 9658 } 9659 9660 // If top/bottom spacing is not function parse value to integer. 9661 if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0; 9662 if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0; 9663 9664 // Breakdown sticky sidebar if screen width below `options.minWidth`. 9665 this._widthBreakpoint(); 9666 9667 // Calculate dimensions of sidebar, container and viewport. 9668 this.calcDimensions(); 9669 9670 // Affix sidebar in proper position. 9671 this.stickyPosition(); 9672 9673 // Bind all events. 9674 this.bindEvents(); 9675
vendor: 21,254 bytes, lines 9676-10237
9676 // Inform other properties the sticky sidebar is initialized. 9677 this._initialized = true; 9678 } 9679 9680 /** 9681 * Bind all events of sticky sidebar plugin. 9682 * @protected 9683 */ 9684 }, { 9685 key: 'bindEvents', 9686 value: function bindEvents() { 9687 window.addEventListener('resize', this, { 9688 passive: true, 9689 capture: false 9690 }); 9691 window.addEventListener('scroll', this, { 9692 passive: true, 9693 capture: false 9694 }); 9695 this.sidebar.addEventListener('update' + EVENT_KEY, this); 9696 if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) { 9697 new ResizeSensor(this.sidebarInner, this.handleEvent); 9698 new ResizeSensor(this.container, this.handleEvent); 9699 } 9700 } 9701 9702 /** 9703 * Handles all events of the plugin. 9704 * @param {Object} event - Event object passed from listener. 9705 */ 9706 }, { 9707 key: 'handleEvent', 9708 value: function handleEvent(event) { 9709 this.updateSticky(event); 9710 } 9711 9712 /** 9713 * Calculates dimensions of sidebar, container and screen viewpoint 9714 * @public 9715 */ 9716 }, { 9717 key: 'calcDimensions', 9718 value: function calcDimensions() { 9719 if (this._breakpoint) return; 9720 var dims = this.dimensions; 9721 9722 // Container of sticky sidebar dimensions. 9723 dims.containerTop = StickySidebar.offsetRelative(this.container).top; 9724 dims.containerHeight = this.container.clientHeight; 9725 dims.containerBottom = dims.containerTop + dims.containerHeight; 9726 9727 // Sidebar dimensions. 9728 dims.sidebarHeight = this.sidebarInner.offsetHeight; 9729 dims.sidebarWidth = this.sidebar.offsetWidth; 9730 9731 // Screen viewport dimensions. 9732 dims.viewportHeight = window.innerHeight; 9733 this._calcDimensionsWithScroll(); 9734 } 9735 9736 /** 9737 * Some dimensions values need to be up-to-date when scrolling the page. 9738 * @private 9739 */ 9740 }, { 9741 key: '_calcDimensionsWithScroll', 9742 value: function _calcDimensionsWithScroll() { 9743 var dims = this.dimensions; 9744 dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left; 9745 dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop; 9746 dims.viewportBottom = dims.viewportTop + dims.viewportHeight; 9747 dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft; 9748 dims.topSpacing = this.options.topSpacing; 9749 dims.bottomSpacing = this.options.bottomSpacing; 9750 if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0; 9751 if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0; 9752 if ('VIEWPORT-TOP' === this.affixedType) { 9753 // Adjust translate Y in the case decrease top spacing value. 9754 if (dims.topSpacing < dims.lastTopSpacing) { 9755 dims.translateY += dims.lastTopSpacing - dims.topSpacing; 9756 this._reStyle = true; 9757 } 9758 } else if ('VIEWPORT-BOTTOM' === this.affixedType) { 9759 // Adjust translate Y in the case decrease bottom spacing value. 9760 if (dims.bottomSpacing < dims.lastBottomSpacing) { 9761 dims.translateY += dims.lastBottomSpacing - dims.bottomSpacing; 9762 this._reStyle = true; 9763 } 9764 } 9765 dims.lastTopSpacing = dims.topSpacing; 9766 dims.lastBottomSpacing = dims.bottomSpacing; 9767 } 9768 9769 /** 9770 * Determine whether the sidebar is bigger than viewport. 9771 * @public 9772 * @return {Boolean} 9773 */ 9774 }, { 9775 key: 'isSidebarFitsViewport', 9776 value: function isSidebarFitsViewport() { 9777 return this.dimensions.sidebarHeight < this.dimensions.viewportHeight; 9778 } 9779 9780 /** 9781 * Observe browser scrolling direction top and down. 9782 */ 9783 }, { 9784 key: 'observeScrollDir', 9785 value: function observeScrollDir() { 9786 var dims = this.dimensions; 9787 if (dims.lastViewportTop === dims.viewportTop) return; 9788 var furthest = 'down' === this.direction ? Math.min : Math.max; 9789 9790 // If the browser is scrolling not in the same direction. 9791 if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down'; 9792 } 9793 9794 /** 9795 * Gets affix type of sidebar according to current scrollTop and scrollLeft. 9796 * Holds all logical affix of the sidebar when scrolling up and down and when sidebar 9797 * is bigger than viewport and vice versa. 9798 * @public 9799 * @return {String|False} - Proper affix type. 9800 */ 9801 }, { 9802 key: 'getAffixType', 9803 value: function getAffixType() { 9804 var dims = this.dimensions, 9805 affixType = false; 9806 this._calcDimensionsWithScroll(); 9807 var sidebarBottom = dims.sidebarHeight + dims.containerTop; 9808 var colliderTop = dims.viewportTop + dims.topSpacing; 9809 var colliderBottom = dims.viewportBottom - dims.bottomSpacing; 9810 9811 // When browser is scrolling top. 9812 if ('up' === this.direction) { 9813 if (colliderTop <= dims.containerTop) { 9814 dims.translateY = 0; 9815 affixType = 'STATIC'; 9816 } else if (colliderTop <= dims.translateY + dims.containerTop) { 9817 dims.translateY = colliderTop - dims.containerTop; 9818 affixType = 'VIEWPORT-TOP'; 9819 } else if (!this.isSidebarFitsViewport() && dims.containerTop <= colliderTop) { 9820 affixType = 'VIEWPORT-UNBOTTOM'; 9821 } 9822 // When browser is scrolling up. 9823 } else { 9824 // When sidebar element is not bigger than screen viewport. 9825 if (this.isSidebarFitsViewport()) { 9826 if (dims.sidebarHeight + colliderTop >= dims.containerBottom) { 9827 dims.translateY = dims.containerBottom - sidebarBottom; 9828 affixType = 'CONTAINER-BOTTOM'; 9829 } else if (colliderTop >= dims.containerTop) { 9830 dims.translateY = colliderTop - dims.containerTop; 9831 affixType = 'VIEWPORT-TOP'; 9832 } 9833 // When sidebar element is bigger than screen viewport. 9834 } else { 9835 if (dims.containerBottom <= colliderBottom) { 9836 dims.translateY = dims.containerBottom - sidebarBottom; 9837 affixType = 'CONTAINER-BOTTOM'; 9838 } else if (sidebarBottom + dims.translateY <= colliderBottom) { 9839 dims.translateY = colliderBottom - sidebarBottom; 9840 affixType = 'VIEWPORT-BOTTOM'; 9841 } else if (dims.containerTop + dims.translateY <= colliderTop) { 9842 affixType = 'VIEWPORT-UNBOTTOM'; 9843 } 9844 } 9845 } 9846 9847 // Make sure the translate Y is not bigger than container height. 9848 dims.translateY = Math.max(0, dims.translateY); 9849 dims.translateY = Math.min(dims.containerHeight, dims.translateY); 9850 dims.lastViewportTop = dims.viewportTop; 9851 return affixType; 9852 } 9853 9854 /** 9855 * Gets inline style of sticky sidebar wrapper and inner wrapper according 9856 * to its affix type. 9857 * @private 9858 * @param {String} affixType - Affix type of sticky sidebar. 9859 * @return {Object} 9860 */ 9861 }, { 9862 key: '_getStyle', 9863 value: function _getStyle(affixType) { 9864 if ('undefined' === typeof affixType) return; 9865 var style = { 9866 inner: {}, 9867 outer: {} 9868 }; 9869 var dims = this.dimensions; 9870 switch (affixType) { 9871 case 'VIEWPORT-TOP': 9872 style.inner = { 9873 position: 'fixed', 9874 top: dims.topSpacing, 9875 left: dims.sidebarLeft - dims.viewportLeft, 9876 width: dims.sidebarWidth 9877 }; 9878 break; 9879 case 'VIEWPORT-BOTTOM': 9880 style.inner = { 9881 position: 'fixed', 9882 top: 'auto', 9883 left: dims.sidebarLeft, 9884 bottom: dims.bottomSpacing, 9885 width: dims.sidebarWidth 9886 }; 9887 break; 9888 case 'CONTAINER-BOTTOM': 9889 case 'VIEWPORT-UNBOTTOM': 9890 var translate = this._getTranslate(0, dims.translateY + 'px'); 9891 if (translate) style.inner = { 9892 transform: translate 9893 };else style.inner = { 9894 position: 'absolute', 9895 top: dims.translateY, 9896 width: dims.sidebarWidth 9897 }; 9898 break; 9899 } 9900 switch (affixType) { 9901 case 'VIEWPORT-TOP': 9902 case 'VIEWPORT-BOTTOM': 9903 case 'VIEWPORT-UNBOTTOM': 9904 case 'CONTAINER-BOTTOM': 9905 style.outer = { 9906 height: dims.sidebarHeight, 9907 position: 'relative' 9908 }; 9909 break; 9910 } 9911 style.outer = StickySidebar.extend({ 9912 height: '', 9913 position: '' 9914 }, style.outer); 9915 style.inner = StickySidebar.extend({ 9916 position: 'relative', 9917 top: '', 9918 left: '', 9919 bottom: '', 9920 width: '', 9921 transform: this._getTranslate() 9922 }, style.inner); 9923 return style; 9924 } 9925 9926 /** 9927 * Cause the sidebar to be sticky according to affix type by adding inline 9928 * style, adding helper class and trigger events. 9929 * @function 9930 * @protected 9931 * @param {string} force - Update sticky sidebar position by force. 9932 */ 9933 }, { 9934 key: 'stickyPosition', 9935 value: function stickyPosition(force) { 9936 if (this._breakpoint) return; 9937 force = this._reStyle || force || false; 9938 var affixType = this.getAffixType(); 9939 var style = this._getStyle(affixType); 9940 if ((this.affixedType != affixType || force) && affixType) { 9941 var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY; 9942 StickySidebar.eventTrigger(this.sidebar, affixEvent); 9943 if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass); 9944 for (var key in style.outer) { 9945 this.sidebar.style[key] = style.outer[key]; 9946 } 9947 for (var _key in style.inner) { 9948 var _unit2 = 'number' === typeof style.inner[_key] ? 'px' : ''; 9949 this.sidebarInner.style[_key] = style.inner[_key] + _unit2; 9950 } 9951 var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY; 9952 StickySidebar.eventTrigger(this.sidebar, affixedEvent); 9953 } else { 9954 if (this._initialized) this.sidebarInner.style.left = style.inner.left; 9955 } 9956 this.affixedType = affixType; 9957 } 9958 9959 /** 9960 * Breakdown sticky sidebar when window width is below `options.minWidth` value. 9961 * @protected 9962 */ 9963 }, { 9964 key: '_widthBreakpoint', 9965 value: function _widthBreakpoint() { 9966 if (window.innerWidth <= this.options.minWidth) { 9967 this._breakpoint = true; 9968 this.affixedType = 'STATIC'; 9969 this.sidebar.removeAttribute('style'); 9970 StickySidebar.removeClass(this.sidebar, this.options.stickyClass); 9971 this.sidebarInner.removeAttribute('style'); 9972 } else { 9973 this._breakpoint = false; 9974 } 9975 } 9976 9977 /** 9978 * Switches between functions stack for each event type, if there's no 9979 * event, it will re-initialize sticky sidebar. 9980 * @public 9981 */ 9982 }, { 9983 key: 'updateSticky', 9984 value: function updateSticky() { 9985 var _this3 = this; 9986 var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 9987 if (this._running) return; 9988 this._running = true; 9989 (function (eventType) { 9990 requestAnimationFrame(function () { 9991 switch (eventType) { 9992 // When browser is scrolling and re-calculate just dimensions 9993 // within scroll. 9994 case 'scroll': 9995 _this3._calcDimensionsWithScroll(); 9996 _this3.observeScrollDir(); 9997 _this3.stickyPosition(); 9998 break; 9999 10000 // When browser is resizing or there's no event, observe width 10001 // breakpoint and re-calculate dimensions. 10002 case 'resize': 10003 default: 10004 _this3._widthBreakpoint(); 10005 _this3.calcDimensions(); 10006 _this3.stickyPosition(true); 10007 break; 10008 } 10009 _this3._running = false; 10010 }); 10011 })(event.type); 10012 } 10013 10014 /** 10015 * Set browser support features to the public property. 10016 * @private 10017 */ 10018 }, { 10019 key: '_setSupportFeatures', 10020 value: function _setSupportFeatures() { 10021 var support = this.support; 10022 support.transform = StickySidebar.supportTransform(); 10023 support.transform3d = StickySidebar.supportTransform(true); 10024 } 10025 10026 /** 10027 * Get translate value, if the browser supports transfrom3d, it will adopt it. 10028 * and the same with translate. if browser doesn't support both return false. 10029 * @param {Number} y - Value of Y-axis. 10030 * @param {Number} x - Value of X-axis. 10031 * @param {Number} z - Value of Z-axis. 10032 * @return {String|False} 10033 */ 10034 }, { 10035 key: '_getTranslate', 10036 value: function _getTranslate() { 10037 var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 10038 var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 10039 var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; 10040 if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false; 10041 } 10042 10043 /** 10044 * Destroy sticky sidebar plugin. 10045 * @public 10046 */ 10047 }, { 10048 key: 'destroy', 10049 value: function destroy() { 10050 window.removeEventListener('resize', this, { 10051 caption: false 10052 }); 10053 window.removeEventListener('scroll', this, { 10054 caption: false 10055 }); 10056 this.sidebar.classList.remove(this.options.stickyClass); 10057 this.sidebar.style.minHeight = ''; 10058 this.sidebar.removeEventListener('update' + EVENT_KEY, this); 10059 var styleReset = { 10060 inner: {}, 10061 outer: {} 10062 }; 10063 styleReset.inner = { 10064 position: '', 10065 top: '', 10066 left: '', 10067 bottom: '', 10068 width: '', 10069 transform: '' 10070 }; 10071 styleReset.outer = { 10072 height: '', 10073 position: '' 10074 }; 10075 for (var key in styleReset.outer) { 10076 this.sidebar.style[key] = styleReset.outer[key]; 10077 } 10078 for (var _key2 in styleReset.inner) { 10079 this.sidebarInner.style[_key2] = styleReset.inner[_key2]; 10080 } 10081 if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) { 10082 ResizeSensor.detach(this.sidebarInner, this.handleEvent); 10083 ResizeSensor.detach(this.container, this.handleEvent); 10084 } 10085 } 10086 10087 /** 10088 * Determine if the browser supports CSS transform feature. 10089 * @function 10090 * @static 10091 * @param {Boolean} transform3d - Detect transform with translate3d. 10092 * @return {String} 10093 */ 10094 }], [{ 10095 key: 'supportTransform', 10096 value: function supportTransform(transform3d) { 10097 var result = false, 10098 property = transform3d ? 'perspective' : 'transform', 10099 upper = property.charAt(0).toUpperCase() + property.slice(1), 10100 prefixes = ['Webkit', 'Moz', 'O', 'ms'], 10101 support = document.createElement('support'), 10102 style = support.style; 10103 (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) { 10104 if (style[property] !== undefined) { 10105 result = property; 10106 return false; 10107 } 10108 }); 10109 return result; 10110 } 10111 10112 /** 10113 * Trigger custom event. 10114 * @static 10115 * @param {DOMObject} element - Target element on the DOM. 10116 * @param {String} eventName - Event name. 10117 * @param {Object} data - 10118 */ 10119 }, { 10120 key: 'eventTrigger', 10121 value: function eventTrigger(element, eventName, data) { 10122 try { 10123 var event = new CustomEvent(eventName, { 10124 detail: data 10125 }); 10126 } catch (e) { 10127 var event = document.createEvent('CustomEvent'); 10128 event.initCustomEvent(eventName, true, true, data); 10129 } 10130 element.dispatchEvent(event); 10131 } 10132 10133 /** 10134 * Extend options object with defaults. 10135 * @function 10136 * @static 10137 */ 10138 }, { 10139 key: 'extend', 10140 value: function extend(defaults, options) { 10141 var results = {}; 10142 for (var key in defaults) { 10143 if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key]; 10144 } 10145 return results; 10146 } 10147 10148 /** 10149 * Get current coordinates left and top of specific element. 10150 * @static 10151 */ 10152 }, { 10153 key: 'offsetRelative', 10154 value: function offsetRelative(element) { 10155 var result = { 10156 left: 0, 10157 top: 0 10158 }; 10159 do { 10160 var offsetTop = element.offsetTop; 10161 var offsetLeft = element.offsetLeft; 10162 if (!isNaN(offsetTop)) result.top += offsetTop; 10163 if (!isNaN(offsetLeft)) result.left += offsetLeft; 10164 element = 'BODY' === element.tagName ? element.parentElement : element.offsetParent; 10165 } while (element); 10166 return result; 10167 } 10168 10169 /** 10170 * Add specific class name to specific element. 10171 * @static 10172 * @param {ObjectDOM} element 10173 * @param {String} className 10174 */ 10175 }, { 10176 key: 'addClass', 10177 value: function addClass(element, className) { 10178 if (!StickySidebar.hasClass(element, className)) { 10179 if (element.classList) element.classList.add(className);else element.className += ' ' + className; 10180 } 10181 } 10182 10183 /** 10184 * Remove specific class name to specific element 10185 * @static 10186 * @param {ObjectDOM} element 10187 * @param {String} className 10188 */ 10189 }, { 10190 key: 'removeClass', 10191 value: function removeClass(element, className) { 10192 if (StickySidebar.hasClass(element, className)) { 10193 if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' '); 10194 } 10195 } 10196 10197 /** 10198 * Determine weather the element has specific class name. 10199 * @static 10200 * @param {ObjectDOM} element 10201 * @param {String} className 10202 */ 10203 }, { 10204 key: 'hasClass', 10205 value: function hasClass(element, className) { 10206 if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className); 10207 } 10208 }]); 10209 return StickySidebar; 10210 }(); 10211 return StickySidebar; 10212 }(); 10213 10214 // Global 10215 // ------------------------- 10216 window.StickySidebar = StickySidebar; 10217 (function () { 10218 if ('undefined' === typeof window) return; 10219 var plugin = window.$ || window.jQuery || window.Zepto; 10220 var DATA_NAMESPACE = 'stickySidebar'; 10221 10222 // Make sure the site has jquery or zepto plugin. 10223 if (plugin) { 10224 /** 10225 * Sticky Sidebar Plugin Defintion. 10226 * @param {Object|String} - config 10227 */ 10228 var _jQueryPlugin = function (config) { 10229 return this.each(function () { 10230 var $this = plugin(this), 10231 data = plugin(this).data(DATA_NAMESPACE); 10232 if (!data) { 10233 data = new StickySidebar(this, typeof config == 'object' && config); 10234 $this.data(DATA_NAMESPACE, data); 10235 } 10236 if ('string' === typeof config) { 10237 if (data[config] === undefined && ['destroy', 'updateSticky'].indexOf(config) === -1) throw new Error('No method n
10237amed "' + config + '"'); 10238 data[config](); 10239 } 10240 }); 10241 }; 10242 plugin.fn.stickySidebar = _jQueryPlugin; 10243 plugin.fn.stickySidebar.Constructor = StickySidebar; 10244 var old = plugin.fn.stickySidebar; 10245 10246 /** 10247 * Sticky Sidebar No Conflict. 10248 */ 10249 plugin.fn.stickySidebar.noConflict = function () { 10250 plugin.fn.stickySidebar = old; 10251 return this; 10252 }; 10253 } 10254 })(); 10255}); 10256(function ($) { 10257 var breakpointMd = $(window).breakpoints("getBreakpointWidth", "md"); 10258 $(window).load(function () { 10259 var sidebarContent = $('.has-sticky-sidebar .column__wrapper:last-child .column__inner'); 10260 $(sidebarContent).stickySidebar({ 10261 containerSelector: '.has-sticky-sidebar .wp-block-columns', 10262 innerWrapperSelector: '.has-sticky-sidebar .column__wrapper:last-child .wp-block-column', 10263 topSpacing: 75, 10264 bottomSpacing: 30 10265 }); 10266 $(window).resize(function () { 10267 // Recalculate on resize 10268 $(sidebarContent).stickySidebar('updateSticky'); 10269 }); 10270 }); 10271})(jQuery); 10272($ => { 10273 /** 10274 * Code to extend GTranslate plugin functionality 10275 * We must determine the active language via the cookie that is set upon language switch 10276 */ 10277 const gtranslateGetCookie = () => { 10278 var cookie_name = 'googtrans'; 10279 var name = cookie_name + "="; 10280 var decodedCookie = decodeURIComponent(document.cookie); 10281 var ca = decodedCookie.split(';'); 10282 for (var i = 0; i < ca.length; i++) { 10283 var c = ca[i]; 10284 while (c.charAt(0) == ' ') { 10285 c = c.substring(1); 10286 } 10287 if (c.indexOf(name) == 0) { 10288 return c.substring(name.length, c.length).split('/').pop(); 10289 } 10290 } 10291 return ''; 10292 }; 10293 const gtranslateSetActiveLanguage = () => { 10294 var currentLanguage = gtranslateGetCookie(); 10295 $('.glink').removeClass('active'); 10296 if (currentLanguage) { 10297 // only way to distinguish the language code from menu links generated by plugin is to parse the onclick attr 10298 $('.glink').each((index, link) => { 10299 var onclickAtt = $(link).attr('onclick'); 10300 var langCode = onclickAtt.substring(onclickAtt.lastIndexOf("|") + 1, onclickAtt.lastIndexOf("'")); 10301 if (currentLanguage === langCode) { 10302 $(link).addClass('active'); 10303 $('.gtranslateActiveLanguage').text($(link).text()); 10304 } 10305 return; 10306 }); 10307 } else { 10308 // Default to English if no language has been selected 10309 $('.glink:contains("English")').addClass('active'); 10310 $('.gtranslateActiveLanguage').text('English'); 10311 } 10312 }; 10313 $(document).ready(() => { 10314 // Do not translate admin bar, no server side filter available. 10315 $('#wpadminbar').addClass('notranslate'); 10316 gtranslateSetActiveLanguage(); 10317 var $languageModal = $('#languageModal'); 10318 $('.gtranslateModalTrigger').click(() => { 10319 $($languageModal).modal('show'); 10320 }); 10321 10322 // setTimeout necessary to give time for new cookie to be set 10323 $('.glink').click(() => { 10324 $($languageModal).modal('hide'); 10325 setTimeout(() => { 10326 gtranslateSetActiveLanguage(); 10327 }, 100); 10328 }); 10329 }); 10330})(jQuery); 10331function roxFormstack(endpoint, formId, formEl, submitButtonText = 'Submit Form', analyticsFormName = '', saleForceEndpoint = null, saleForceFormId = null) { 10332 const props = { 10333 className: 'form-group', 10334 endpoint: endpoint, 10335 fieldEnhancements: { 10336 select: { 10337 useSelect2Ui: true 10338 }, 10339 phone: { 10340 validationUi: true, 10341 validationMessage: "Please enter a valid 10-digit, U.S. phone number.", 10342 smsConsentValidationMessage: 'Please agree to SMS terms to sign up with a mobile number.' 10343 }, 10344 email: { 10345 validationUi: true, 10346 validationMessage: "Please enter a valid email address." 10347 } 10348 }, 10349 id: formId, 10350 onAfterSubmit: (data, props) => { 10351 const form = document.getElementById(`${formEl}-container`); 10352 const successMsg = document.getElementById(`${formEl}-success`); 10353 const modalParent = jQuery(form).closest('.modal-dialog'); 10354 const columnParent = jQuery(form).closest('.wp-block-column'); 10355 10356 // Toggle form and success message visibility 10357 form.style.display = 'none'; 10358 successMsg.style.display = 'block'; 10359 10360 // Adjust modal and column styles if applicable 10361 if (modalParent.length) { 10362 modalParent.removeClass('modal-lg').addClass('modal-md'); 10363 } 10364 if (columnParent.length) { 10365 jQuery('.wp-block-column').not(columnParent).remove(); 10366 columnParent.addClass('wp-block-column--has-form-success'); 10367 } 10368 10369 // do not anchor the page to success message if this form is inside an open modal 10370 if (!jQuery('.modal').is('.show')) { 10371 jQuery([document.documentElement, document.body]).animate({ 10372 scrollTop: jQuery('#' + formEl + '-success').offset().top - 150 10373 }, 500); 10374 } 10375 if (typeof gtmEventTracking !== 'undefined' && jQuery.isFunction(gtmEventTracking)) { 10376 // @TODO: get form name from `props` to send 10377 const modalFormName = jQuery('.modal.show').find('.block--heading:eq(0)').text(); 10378 const formName = gtmSanitizeText(modalFormName ? modalFormName : analyticsFormName); 10379 const details = { 10380 form_name: formName 10381 }; 10382 gtmEventTracking('form-success', details); 10383 } 10384 }, 10385 onLoadError: error => { 10386 jQuery.ajax({ 10387 type: 'POST', 10388 url: rox_data.ajax_url, 10389 data: { 10390 action: 'rox_ajax_error_log', 10391 nonce: rox_data.nonce, 10392 error_message: error 10393 } 10394 }); 10395 }, 10396 onSubmitError: error => { 10397 const form = document.getElementById(`${formEl}-container`); 10398 const ErrorMsg = document.getElementById(`${formEl}-error`); 10399 const modalParent = jQuery(form).closest('.modal-dialog'); 10400 const columnParent = jQuery(form).closest('.wp-block-column'); 10401 10402 // Toggle form and success message visibility 10403 form.style.display = 'none'; 10404 ErrorMsg.style.display = 'block'; 10405 10406 // Adjust modal and column styles if applicable 10407 if (modalParent.length) { 10408 modalParent.removeClass('modal-lg').addClass('modal-md'); 10409 } 10410 if (columnParent.length) { 10411 jQuery('.wp-block-column').not(columnParent).remove(); 10412 columnParent.addClass('wp-block-column--has-form-success'); 10413 } 10414 10415 // do not anchor the page to success message if this form is inside an open modal 10416 if (!jQuery('.modal').is('.show')) { 10417 jQuery([document.documentElement, document.body]).animate({ 10418 scrollTop: jQuery('#' + formEl + '-success').offset().top - 150 10419 }, 500); 10420 } 10421 jQuery.ajax({ 10422 type: 'POST', 10423 url: rox_data.ajax_url, 10424 data: { 10425 action: 'rox_ajax_error_log', 10426 nonce: rox_data.nonce, 10427 error_message: error 10428 } 10429 }); 10430 }, 10431 onValidationError: (error, props) => { 10432 if (typeof gtmEventTracking !== 'undefined' && jQuery.isFunction(gtmEventTracking)) { 10433 let eventDetails = { 10434 form_data: { 10435 form_name: gtmSanitizeText(props.name), 10436 form_error: gtmSanitizeText(error.target.getAttribute('aria-label')) 10437 } 10438 }; 10439 gtmEventTracking('form-error', eventDetails); 10440 } 10441 }, 10442 resetButtonText: '', 10443 salesForce: { 10444 endpoint: saleForceEndpoint, 10445 formId: saleForceFormId 10446 }, 10447 shouldResetOnSubmit: true, 10448 submitButtonText: submitButtonText 10449 }; 10450 ReactDOM.render(React.createElement(ReactFormstack, props), document.getElementById(formEl)); 10451}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.