1/******************************************************************************* 2 * Copyright 2019 Adobe 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 ******************************************************************************/ 16 17/** 18 * Element.matches() 19 * https://developer.mozilla.org/enUS/docs/Web/API/Element/matches#Polyfill 20 */ 21if (!Element.prototype.matches) { 22 Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 23} 24 25// eslint-disable-next-line valid-jsdoc 26/** 27 * Element.closest() 28 * https://developer.mozilla.org/enUS/docs/Web/API/Element/closest#Polyfill 29 */ 30if (!Element.prototype.closest) { 31 Element.prototype.closest = function(s) { 32 "use strict"; 33 var el = this; 34 if (!document.documentElement.contains(el)) { 35 return null; 36 } 37 do { 38 if (el.matches(s)) { 39 return el; 40 } 41 el = el.parentElement || el.parentNode; 42 } while (el !== null && el.nodeType === 1); 43 return null; 44 }; 45} 46 47/******************************************************************************* 48 * Copyright 2019 Adobe 49 * 50 * Licensed under the Apache License, Version 2.0 (the "License"); 51 * you may not use this file except in compliance with the License. 52 * You may obtain a copy of the License at 53 * 54 * http://www.apache.org/licenses/LICENSE-2.0 55 * 56 * Unless required by applicable law or agreed to in writing, software 57 * distributed under the License is distributed on an "AS IS" BASIS, 58 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 59 * See the License for the specific language governing permissions and 60 * limitations under the License. 61 ******************************************************************************/ 62(function() { 63 "use strict"; 64 65 var containerUtils = window.CQ && window.CQ.CoreComponents && window.CQ.CoreComponents.container && window.CQ.CoreComponents.container.utils ? window.CQ.CoreComponents.container.utils : undefined; 66 if (!containerUtils) { 67 // eslint-disable-next-line no-console 68 console.warn("Accordion: container utilities at window.CQ.CoreComponents.container.utils are not available. This can lead to missing features. Ensure the core.wcm.components.commons.site.container client library is included on the page."); 69 } 70 var dataLayerEnabled; 71 var dataLayer; 72 var dataLayerName; 73 var delay = 100; 74 75 var NS = "cmp"; 76 var IS = "accordion"; 77 78 var keyCodes = { 79 ENTER: 13, 80 SPACE: 32, 81 END: 35, 82 HOME: 36, 83 ARROW_LEFT: 37, 84 ARROW_UP: 38, 85 ARROW_RIGHT: 39, 86 ARROW_DOWN: 40 87 }; 88 89 var selectors = { 90 self: "[data-" + NS + '-is="' + IS + '"]' 91 }; 92
93 var cssClasses = { 94 button: { 95 disabled: "cmp-accordion__button--disabled", 96 expanded: "cmp-accordion__button--expanded" 97 }, 98 panel: { 99 hidden: "cmp-accordion__panel--hidden", 100 expanded: "cmp-accordion__panel--expanded" 101 } 102 }; 103 104 var dataAttributes = { 105 item: { 106 expanded: "data-cmp-expanded" 107 } 108 }; 109 110 var properties = { 111 /** 112 * Determines whether a single accordion item is forced to be expanded at a time. 113 * Expanding one item will collapse all others. 114 * 115 * @memberof Accordion 116 * @type {Boolean} 117 * @default false 118 */ 119 "singleExpansion": { 120 "default": false, 121 "transform": function(value) { 122 return !(value === null || typeof value === "undefined"); 123 } 124 } 125 }; 126 127 /** 128 * Accordion Configuration. 129 * 130 * @typedef {Object} AccordionConfig Represents an Accordion configuration 131 * @property {HTMLElement} element The HTMLElement representing the Accordion 132 * @property {Object} options The Accordion options 133 */ 134 135 /** 136 * Accordion. 137 * 138 * @class Accordion 139 * @classdesc An interactive Accordion component for toggling panels of related content 140 * @param {AccordionConfig} config The Accordion configuration 141 */ 142 function Accordion(config) { 143 var that = this; 144 145 if (config && config.element) { 146 init(config); 147 } 148 149 /** 150 * Initializes the Accordion. 151 * 152 * @private 153 * @param {AccordionConfig} config The Accordion configuration 154 */ 155 function init(config) { 156 that._config = config; 157 158 // prevents multiple initialization 159 config.element.removeAttribute("data-" + NS + "-is"); 160 161 setupProperties(config.options); 162 cacheElements(config.element); 163 164 if (that._elements["item"]) { 165 // ensures multiple element types are arrays. 166 that._elements["item"] = Array.isArray(that._elements["item"]) ? that._elements["item"] : [that._elements["item"]]; 167 that._elements["button"] = Array.isArray(that._elements["button"]) ? that._elements["button"] : [that._elements["button"]]; 168 that._elements["panel"] = Array.isArray(that._elements["panel"]) ? that._elements["panel"] : [that._elements["panel"]]; 169 170 if (that._properties.singleExpansion) { 171 var expandedItems = getExpandedItems(); 172 // multiple expanded items annotated, display the last item open. 173 if (expandedItems.length > 1) { 174 toggle(expandedItems.length - 1); 175 } 176 } 177 178 refreshItems(); 179 bindEvents(); 180 scrollToDeepLinkIdInAccordion(); 181 } 182 if (window.Granite && window.Granite.author && window.Granite.author.MessageChannel) { 183 /* 184 * Editor message handling: 185 * - subscribe to "cmp.panelcontainer" message requests sent by the editor frame 186 * - check that the message data panel container type is correct and that the id (path) matches this specific Accordion component 187 * - if so, route the "navigate" operation to enact a navigation of the Accordion based on index data 188 */ 189 window.CQ.CoreComponents.MESSAGE_CHANNEL = window.CQ.CoreComponents.MESSAGE_CHANNEL || new window.Granite.author.MessageChannel("cqauthor", window); 190 window.CQ.CoreComponents.MESSAGE_CHANNEL.subscribeRequestMessage("cmp.panelcontainer", function(message) { 191 if (message.data && message.data.type === "cmp-accordion" && message.data.id === that._elements.self.dataset["cmpPanelcontainerId"]) { 192 if (message.data.operation === "navigate") { 193 // switch to single expansion mode when navigating in edit mode. 194 var singleExpansion = that._properties.singleExpansion; 195 that._properties.singleExpansion = true; 196 toggle(message.data.index); 197 198 // revert to the configured state. 199 that._properties.singleExpansion = singleExpansion; 200 } 201 } 202 }); 203 } 204 } 205 206 /**
207 * Displays the panel containing the element that corresponds to the deep link in the URI fragment 208 * and scrolls the browser to this element. 209 */ 210 function scrollToDeepLinkIdInAccordion() { 211 if (containerUtils) { 212 var deepLinkItemIdx = containerUtils.getDeepLinkItemIdx(that, "item", "item"); 213 if (deepLinkItemIdx > -1) { 214 var deepLinkItem = that._elements["item"][deepLinkItemIdx]; 215 if (deepLinkItem && !deepLinkItem.hasAttribute(dataAttributes.item.expanded)) { 216 // if single expansion: close all accordion items 217 if (that._properties.singleExpansion) { 218 for (var j = 0; j < that._elements["item"].length; j++) { 219 if (that._elements["item"][j].hasAttribute(dataAttributes.item.expanded)) { 220 setItemExpanded(that._elements["item"][j], false, true); 221 } 222 } 223 } 224 // expand the accordion item containing the deep link 225 setItemExpanded(deepLinkItem, true, true); 226 } 227 var hashId = window.location.hash.substring(1); 228 if (hashId) { 229 var hashItem = document.querySelector("[id='" + hashId + "']"); 230 if (hashItem) { 231 hashItem.scrollIntoView(); 232 } 233 } 234 } 235 } 236 } 237 238 /** 239 * Caches the Accordion elements as defined via the {@code data-accordion-hook="ELEMENT_NAME"} markup API. 240 * 241 * @private 242 * @param {HTMLElement} wrapper The Accordion wrapper element 243 */ 244 function cacheElements(wrapper) { 245 that._elements = {}; 246 that._elements.self = wrapper; 247 var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); 248 249 for (var i = 0; i < hooks.length; i++) { 250 var hook = hooks[i]; 251 if (hook.closest("." + NS + "-" + IS) === that._elements.self) { // only process own accordion elements 252 var capitalized = IS; 253 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 254 var key = hook.dataset[NS + "Hook" + capitalized]; 255 if (that._elements[key]) { 256 if (!Array.isArray(that._elements[key])) { 257 var tmp = that._elements[key]; 258 that._elements[key] = [tmp]; 259 } 260 that._elements[key].push(hook); 261 } else { 262 that._elements[key] = hook; 263 } 264 } 265 } 266 } 267 268 /** 269 * Sets up properties for the Accordion based on the passed options. 270 * 271 * @private 272 * @param {Object} options The Accordion options 273 */ 274 function setupProperties(options) { 275 that._properties = {}; 276 277 for (var key in properties) { 278 if (Object.prototype.hasOwnProperty.call(properties, key)) { 279 var property = properties[key]; 280 var value = null; 281 282 if (options && options[key] != null) { 283 value = options[key]; 284 285 // transform the provided option 286 if (property && typeof property.transform === "function") { 287 value = property.transform(value); 288 } 289 } 290 291 if (value === null) { 292 // value still null, take the property default 293 value = properties[key]["default"]; 294 } 295 296 that._properties[key] = value; 297 } 298 } 299 } 300 301 /** 302 * Binds Accordion event handling. 303 * 304 * @private 305 */ 306 function bindEvents() { 307 window.addEventListener("hashchange", scrollToDeepLinkIdInAccordion, false); 308 var buttons = that._elements["button"]; 309 if (buttons) { 310 for (var i = 0; i < buttons.length; i++) { 311 (function(index) { 312 buttons[i].addEventListener("click", function(event) { 313 toggle(index); 314 focusButton(index); 315 }); 316 buttons[i].addEventListener("keydown", function(event) { 317 onButtonKeyDown(event, index); 318 }); 319 })(i); 320 } 321 } 322 } 323 324 /** 325 * Handles button keydown events. 326 * 327 * @private 328 * @param {Object} event The keydown event 329 * @param {Number} index The index of the button triggering the event 330 */ 331 function onButtonKeyDown(event, index) { 332 var lastIndex = that._elements["button"].length - 1; 333 334 switch (event.keyCode) { 335 case keyCodes.ARROW_LEFT: 336 case keyCodes.ARROW_UP: 337 event.preventDefault(); 338 if (index > 0) { 339 focusButton(index - 1); 340 } 341 break; 342 case keyCodes.ARROW_RIGHT: 343 case keyCodes.ARROW_DOWN: 344 event.preventDefault(); 345 if (index < lastIndex) { 346 focusButton(index + 1); 347 } 348 break; 349 case keyCodes.HOME: 350 event.preventDefault(); 351 focusButton(0); 352 break; 353 case keyCodes.END: 354 event.preventDefault(); 355 focusButton(lastIndex); 356 break;
357 case keyCodes.ENTER: 358 case keyCodes.SPACE: 359 event.preventDefault(); 360 toggle(index); 361 focusButton(index); 362 break; 363 default: 364 return; 365 } 366 } 367 368 /** 369 * General handler for toggle of an item. 370 * 371 * @private 372 * @param {Number} index The index of the item to toggle 373 */ 374 function toggle(index) { 375 var item = that._elements["item"][index]; 376 if (item) { 377 if (that._properties.singleExpansion) { 378 // ensure only a single item is expanded if single expansion is enabled. 379 for (var i = 0; i < that._elements["item"].length; i++) { 380 if (that._elements["item"][i] !== item) { 381 var expanded = getItemExpanded(that._elements["item"][i]); 382 if (expanded) { 383 setItemExpanded(that._elements["item"][i], false); 384 } 385 } 386 } 387 } 388 setItemExpanded(item, !getItemExpanded(item)); 389 390 if (dataLayerEnabled) { 391 var accordionId = that._elements.self.id; 392 var expandedItems = getExpandedItems() 393 .map(function(item) { 394 return getDataLayerId(item); 395 }); 396 397 var uploadPayload = { component: {} }; 398 uploadPayload.component[accordionId] = { shownItems: expandedItems }; 399 400 var removePayload = { component: {} }; 401 removePayload.component[accordionId] = { shownItems: undefined }; 402 403 dataLayer.push(removePayload); 404 dataLayer.push(uploadPayload); 405 } 406 } 407 } 408 409 /** 410 * Sets an item's expanded state based on the provided flag and refreshes its internals. 411 * 412 * @private 413 * @param {HTMLElement} item The item to mark as expanded, or not expanded 414 * @param {Boolean} expanded true to mark the item expanded, false otherwise 415 * @param {Boolean} keepHash true to keep the hash in the URL, false to update it 416 */ 417 function setItemExpanded(item, expanded, keepHash) { 418 if (expanded) { 419 item.setAttribute(dataAttributes.item.expanded, ""); 420 var index = that._elements["item"].indexOf(item); 421 if (!keepHash && containerUtils) { 422 containerUtils.updateUrlHash(that, "item", index); 423 } 424 if (dataLayerEnabled) { 425 dataLayer.push({ 426 event: "cmp:show", 427 eventInfo: { 428 path: "component." + getDataLayerId(item) 429 } 430 }); 431 } 432 433 } else { 434 item.removeAttribute(dataAttributes.item.expanded); 435 if (!keepHash && containerUtils) { 436 containerUtils.removeUrlHash(); 437 } 438 if (dataLayerEnabled) { 439 dataLayer.push({ 440 event: "cmp:hide", 441 eventInfo: { 442 path: "component." + getDataLayerId(item) 443 } 444 }); 445 } 446 } 447 refreshItem(item); 448 } 449 450 /** 451 * Gets an item's expanded state. 452 * 453 * @private 454 * @param {HTMLElement} item The item for checking its expanded state 455 * @returns {Boolean} true if the item is expanded, false otherwise 456 */ 457 function getItemExpanded(item) { 458 return item && item.dataset && item.dataset["cmpExpanded"] !== undefined; 459 } 460 461 /** 462 * Refreshes an item based on its expanded state. 463 * 464 * @private 465 * @param {HTMLElement} item The item to refresh 466 */ 467 function refreshItem(item) { 468 var expanded = getItemExpanded(item); 469 if (expanded) { 470 expandItem(item); 471 } else { 472 collapseItem(item); 473 } 474 } 475 476 /** 477 * Refreshes all items based on their expanded state. 478 * 479 * @private 480 */ 481 function refreshItems() { 482 for (var i = 0; i < that._elements["item"].length; i++) { 483 refreshItem(that._elements["item"][i]); 484 } 485 } 486 487 /** 488 * Returns all expanded items. 489 * 490 * @private 491 * @returns {HTMLElement[]} The expanded items 492 */ 493 function getExpandedItems() { 494 var expandedItems = []; 495 496 for (var i = 0; i < that._elements["item"].length; i++) { 497 var item = that._elements["item"][i]; 498 var expanded = getItemExpanded(item); 499 if (expanded) { 500 expandedItems.push(item); 501 } 502 } 503 504 return expandedItems; 505 } 506 507 /** 508 * Annotates the item and its internals with 509 * the necessary style and accessibility attributes to indicate it is expanded. 510 * 511 * @private 512 * @param {HTMLElement} item The item to annotate as expanded 513 */ 514 function expandItem(item) { 515 var index = that._elements["item"].indexOf(item); 516 if (index > -1) { 517 var button = that._elements["button"][index]; 518 var panel = that._elements["panel"][index];
519 button.classList.add(cssClasses.button.expanded); 520 // used to fix some known screen readers issues in reading the correct state of the 'aria-expanded' attribute 521 // e.g. https://bugs.webkit.org/show_bug.cgi?id=210934 522 setTimeout(function() { 523 button.setAttribute("aria-expanded", true); 524 }, delay); 525 panel.classList.add(cssClasses.panel.expanded); 526 panel.classList.remove(cssClasses.panel.hidden); 527 panel.setAttribute("aria-hidden", false); 528 } 529 } 530 531 /** 532 * Annotates the item and its internals with 533 * the necessary style and accessibility attributes to indicate it is not expanded. 534 * 535 * @private 536 * @param {HTMLElement} item The item to annotate as not expanded 537 */ 538 function collapseItem(item) { 539 var index = that._elements["item"].indexOf(item); 540 if (index > -1) { 541 var button = that._elements["button"][index]; 542 var panel = that._elements["panel"][index]; 543 button.classList.remove(cssClasses.button.expanded); 544 // used to fix some known screen readers issues in reading the correct state of the 'aria-expanded' attribute 545 // e.g. https://bugs.webkit.org/show_bug.cgi?id=210934 546 setTimeout(function() { 547 button.setAttribute("aria-expanded", false); 548 }, delay); 549 panel.classList.add(cssClasses.panel.hidden); 550 panel.classList.remove(cssClasses.panel.expanded); 551 panel.setAttribute("aria-hidden", true); 552 } 553 } 554 555 /** 556 * Focuses the button at the provided index. 557 * 558 * @private 559 * @param {Number} index The index of the button to focus 560 */ 561 function focusButton(index) { 562 var button = that._elements["button"][index]; 563 button.focus(); 564 } 565 } 566 567 /** 568 * Reads options data from the Accordion wrapper element, defined via {@code data-cmp-*} data attributes. 569 * 570 * @private 571 * @param {HTMLElement} element The Accordion element to read options data from 572 * @returns {Object} The options read from the component data attributes 573 */ 574 function readData(element) { 575 var data = element.dataset; 576 var options = []; 577 var capitalized = IS; 578 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 579 var reserved = ["is", "hook" + capitalized]; 580 581 for (var key in data) { 582 if (Object.prototype.hasOwnProperty.call(data, key)) { 583 var value = data[key]; 584 585 if (key.indexOf(NS) === 0) { 586 key = key.slice(NS.length); 587 key = key.charAt(0).toLowerCase() + key.substring(1); 588 589 if (reserved.indexOf(key) === -1) { 590 options[key] = value; 591 } 592 } 593 } 594 } 595 596 return options; 597 } 598 599 /** 600 * Parses the dataLayer string and returns the ID 601 * 602 * @private 603 * @param {HTMLElement} item the accordion item 604 * @returns {String} dataLayerId or undefined 605 */ 606 function getDataLayerId(item) { 607 if (item) { 608 if (item.dataset.cmpDataLayer) { 609 return Object.keys(JSON.parse(item.dataset.cmpDataLayer))[0]; 610 } else { 611 return item.id; 612 } 613 } 614 return null; 615 } 616 617 /** 618 * Document ready handler and DOM mutation observers. Initializes Accordion components as necessary. 619 * 620 * @private 621 */ 622 function onDocumentReady() { 623 dataLayerEnabled = document.body.hasAttribute("data-cmp-data-layer-enabled"); 624 if (dataLayerEnabled) { 625 dataLayerName = document.body.getAttribute("data-cmp-data-layer-name") || "adobeDataLayer"; 626 dataLayer = window[dataLayerName] = window[dataLayerName] || []; 627 } 628 629 var elements = document.querySelectorAll(selectors.self); 630 for (var i = 0; i < elements.length; i++) { 631 new Accordion({ element: elements[i], options: readData(elements[i]) }); 632 } 633 634 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 635 var body = document.querySelector("body"); 636 var observer = new MutationObserver(function(mutations) { 637 mutations.forEach(function(mutation) { 638 // needed for IE 639 var nodesArray = [].slice.call(mutation.addedNodes); 640 if (nodesArray.length > 0) { 641 nodesArray.forEach(function(addedNode) { 642 if (addedNode.querySelectorAll) { 643 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 644 elementsArray.forEach(function(element) { 645 new Accordion({ element: element, options: readData(element) }); 646 }); 647 } 648 }); 649 } 650 }); 651 }); 652 653 observer.observe(body, { 654 subtree: true, 655 childList: true, 656 characterData: true 657 }); 658 } 659 660 if (document.readyState !== "loading") { 661 onDocumentReady(); 662 } else { 663 document.addEventListener("DOMContentLoaded", onDocumentReady); 664 } 665 666 if (containerUtils) { 667 window.addEventListener("load", containerUtils.scrollToAnchor, false); 668 } 669 670}()); 671 672 673/******************************************************************************* 674 * Copyright 2019 Adobe 675 * 676 * Licensed under the Apache License, Version 2.0 (the "License");
677 * you may not use this file except in compliance with the License. 678 * You may obtain a copy of the License at 679 * 680 * http://www.apache.org/licenses/LICENSE2.0 681 * 682 * Unless required by applicable law or agreed to in writing, software 683 * distributed under the License is distributed on an "AS IS" BASIS, 684 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 685 * See the License for the specific language governing permissions and 686 * limitations under the License. 687 ******************************************************************************/ 688 689/** 690 * Element.matches() 691 * https://developer.mozilla.org/enUS/docs/Web/API/Element/matches#Polyfill 692 */ 693if (!Element.prototype.matches) { 694 Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 695} 696 697// eslint-disable-next-line valid-jsdoc 698/** 699 * Element.closest() 700 * https://developer.mozilla.org/enUS/docs/Web/API/Element/closest#Polyfill 701 */ 702if (!Element.prototype.closest) { 703 Element.prototype.closest = function(s) { 704 "use strict"; 705 var el = this; 706 if (!document.documentElement.contains(el)) { 707 return null; 708 } 709 do { 710 if (el.matches(s)) { 711 return el; 712 } 713 el = el.parentElement || el.parentNode; 714 } while (el !== null && el.nodeType === 1); 715 return null; 716 }; 717} 718 719/******************************************************************************* 720 * Copyright 2018 Adobe 721 * 722 * Licensed under the Apache License, Version 2.0 (the "License"); 723 * you may not use this file except in compliance with the License. 724 * You may obtain a copy of the License at 725 * 726 * http://www.apache.org/licenses/LICENSE2.0 727 * 728 * Unless required by applicable law or agreed to in writing, software 729 * distributed under the License is distributed on an "AS IS" BASIS, 730 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 731 * See the License for the specific language governing permissions and 732 * limitations under the License. 733 ******************************************************************************/ 734 735/** 736 * Element.matches() 737 * https://developer.mozilla.org/enUS/docs/Web/API/Element/matches#Polyfill 738 */ 739if (!Element.prototype.matches) { 740 Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 741} 742 743// eslint-disable-next-line valid-jsdoc 744/** 745 * Element.closest() 746 * https://developer.mozilla.org/enUS/docs/Web/API/Element/closest#Polyfill 747 */ 748if (!Element.prototype.closest) { 749 Element.prototype.closest = function(s) { 750 "use strict"; 751 var el = this; 752 if (!document.documentElement.contains(el)) { 753 return null; 754 } 755 do { 756 if (el.matches(s)) { 757 return el; 758 } 759 el = el.parentElement || el.parentNode; 760 } while (el !== null && el.nodeType === 1); 761 return null; 762 }; 763} 764 765/******************************************************************************* 766 * Copyright 2018 Adobe 767 * 768 * Licensed under the Apache License, Version 2.0 (the "License"); 769 * you may not use this file except in compliance with the License. 770 * You may obtain a copy of the License at 771 * 772 * http://www.apache.org/licenses/LICENSE-2.0 773 * 774 * Unless required by applicable law or agreed to in writing, software 775 * distributed under the License is distributed on an "AS IS" BASIS, 776 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 777 * See the License for the specific language governing permissions and 778 * limitations under the License. 779 ******************************************************************************/ 780/* global 781 CQ 782 */ 783(function() { 784 "use strict"; 785 786 var containerUtils = window.CQ && window.CQ.CoreComponents && window.CQ.CoreComponents.container && window.CQ.CoreComponents.container.utils ? window.CQ.CoreComponents.container.utils : undefined; 787 if (!containerUtils) { 788 // eslint-disable-next-line no-console 789 console.warn("Tabs: container utilities at window.CQ.CoreComponents.c
789ontainer.utils are not available. This can lead to missing features. Ensure the core.wcm.components.commons.site.container client library is included on the page."); 790 } 791 var dataLayerEnabled; 792 var dataLayer; 793 var dataLayerName; 794 795 var NS = "cmp"; 796 var IS = "tabs"; 797 798 var keyCodes = { 799 END: 35, 800 HOME: 36, 801 ARROW_LEFT: 37, 802 ARROW_UP: 38, 803 ARROW_RIGHT: 39, 804 ARROW_DOWN: 40 805 }; 806 807 var selectors = { 808 self: "[data-" + NS + '-is="' + IS + '"]', 809 active: { 810 tab: "cmp-tabs__tab--active", 811 tabpanel: "cmp-tabs__tabpanel--active" 812 } 813 }; 814 815 /** 816 * Tabs Configuration 817 * 818 * @typedef {Object} TabsConfig Represents a Tabs configuration 819 * @property {HTMLElement} element The HTMLElement representing the Tabs 820 * @property {Object} options The Tabs options 821 */ 822 823 /** 824 * Tabs 825 * 826 * @class Tabs 827 * @classdesc An interactive Tabs component for navigating a list of tabs 828 * @param {TabsConfig} config The Tabs configuration 829 */ 830 function Tabs(config) { 831 var that = this; 832 833 if (config && config.element) { 834 init(config); 835 } 836 837 /** 838 * Initializes the Tabs 839 * 840 * @private 841 * @param {TabsConfig} config The Tabs configuration 842 */ 843 function init(config) { 844 that._config = config; 845 846 // prevents multiple initialization 847 config.element.removeAttribute("data-" + NS + "-is"); 848 849 cacheElements(config.element); 850 that._active = getActiveIndex(that._elements["tab"]); 851 852 if (that._elements.tabpanel) { 853 refreshActive(); 854 bindEvents(); 855 scrollToDeepLinkIdInTabs(); 856 } 857 858 if (window.Granite && window.Granite.author && window.Granite.author.MessageChannel) { 859 /* 860 * Editor message handling: 861 * - subscribe to "cmp.panelcontainer" message requests sent by the editor frame 862 * - check that the message data panel container type is correct and that the id (path) matches this specific Tabs component 863 * - if so, route the "navigate" operation to enact a navigation of the Tabs based on index data 864 */ 865 CQ.CoreComponents.MESSAGE_CHANNEL = CQ.CoreComponents.MESSAGE_CHANNEL || new window.Granite.author.MessageChannel("cqauthor", window); 866 CQ.CoreComponents.MESSAGE_CHANNEL.subscribeRequestMessage("cmp.panelcontainer", function(message) { 867 if (message.data && message.data.type === "cmp-tabs" && message.data.id === that._elements.self.dataset["cmpPanelcontainerId"]) { 868 if (message.data.operation === "navigate") { 869 navigate(message.data.index); 870 } 871 } 872 }); 873 } 874 } 875 876 /** 877 * Displays the panel containing the element that corresponds to the deep link in the URI fragment 878 * and scrolls the browser to this element. 879 */ 880 function scrollToDeepLinkIdInTabs() { 881 if (containerUtils) { 882 var deepLinkItemIdx = containerUtils.getDeepLinkItemIdx(that, "tab", "tabpanel"); 883 if (deepLinkItemIdx > -1) { 884 var deepLinkItem = that._elements["tab"][deepLinkItemIdx]; 885 if (deepLinkItem && that._elements["tab"][that._active].id !== deepLinkItem.id) { 886 navigateAndFocusTab(deepLinkItemIdx, true); 887 } 888 var hashId = window.location.hash.substring(1); 889 if (hashId) { 890 var hashItem = document.querySelector("[id='" + hashId + "']"); 891 if (hashItem) { 892 hashItem.scrollIntoView(); 893 } 894 } 895 } 896 } 897 } 898 899 /** 900 * Returns the index of the active tab, if no tab is active returns 0 901 * 902 * @param {Array} tabs Tab elements 903 * @returns {Number} Index of the active tab, 0 if none is active 904 */ 905 function getActiveIndex(tabs) { 906 if (tabs) { 907 for (var i = 0; i < tabs.length; i++) { 908 if (tabs[i].classList.contains(selectors.active.tab)) { 909 return i; 910 } 911 } 912 } 913 return 0; 914 } 915 916 /** 917 * Caches the Tabs elements as defined via the {@code data-tabs-hook="ELEMENT_NAME"} markup API 918 * 919 * @private 920 * @param {HTMLElement} wrapper The Tabs wrapper element 921 */ 922 function cacheElements(wrapper) { 923 that._elements = {}; 924 that._elements.self = wrapper; 925 var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); 926 927 for (var i = 0; i < hooks.length; i++) { 928 var hook = hooks[i]; 929 if (hook.closest("." + NS + "-" + IS) === that._elements.self) { // only process own tab elements 930 var capitalized = IS; 931 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 932 var key = hook.dataset[NS + "Hook" + capitalized]; 933 if (that._elements[key]) { 934 if (!Array.isArray(that._elements[key])) { 935 var tmp = that._elements[key]; 936 that._elements[key] = [tmp]; 937 } 938 that._elements[key].push(hook); 939 } else { 940 that._elements[key] = hook; 941 } 942 } 943 } 944 } 945 946 /** 947 * Binds Tabs event handling 948 * 949 * @private 950 */ 951 function bindEvents() { 952 window.addEventListener("hashchange", scrollToDeepLinkIdInTabs, false); 953 var tabs = that._elements["tab"]; 954 if (tabs) { 955 for (var i = 0; i < tabs.length; i++) { 956 (function(index) { 957 tabs[i].addEventListener("click", function(event) { 958 navigateAndFocusTab(index); 959 }); 960 tabs[i].addEventListener("keydown", function(event) { 961 onKeyDown(event); 962 }); 963 })(i); 964 } 965 } 966 } 967 968 /** 969 * Handles tab keydown events 970 * 971 * @private 972 * @param {Object} event The keydown event 973 */ 974 function onKeyDown(event) { 975 var index = that._active; 976 var lastIndex = that._elements["tab"].length - 1; 977 978 switch (event.keyCode) { 979 case keyCodes.ARROW_LEFT: 980 case keyCodes.ARROW_UP: 981 event.preventDefault(); 982 if (index > 0) { 983 navigateAndFocusTab(index - 1); 984 } 985 break; 986 case keyCodes.ARROW_RIGHT: 987 case keyCodes.ARROW_DOWN: 988 event.preventDefault(); 989 if (index < lastIndex) { 990 navigateAndFocusTab(index + 1); 991 } 992 break; 993 case keyCodes.HOME: 994 event.preventDefault(); 995 navigateAndFocusTab(0); 996 break; 997 case keyCodes.END: 998 event.preventDefault(); 999 navigateAndFocusTab(lastIndex); 1000 break; 1001 default: 1002 return; 1003 } 1004 } 1005 1006 /** 1007 * Refreshes the tab markup based on the current {@code Tabs#_active} index 1008 * 1009 * @private 1010 */ 1011 function refreshActive() { 1012 var tabpanels = that._elements["tabpanel"]; 1013 var tabs = that._elements["tab"]; 1014 1015 if (tabpanels) { 1016 if (Array.isArray(tabpanels)) { 1017 for (var i = 0; i < tabpanels.length; i++) { 1018 if (i === parseInt(that._active)) { 1019 tabpanels[i].classList.add(selectors.active.tabpanel); 1020 tabpanels[i].removeAttribute("aria-hidden"); 1021 tabs[i].classList.add(selectors.active.tab); 1022 tabs[i].setAttribute("aria-selected", true); 1023 tabs[i].setAttribute("tabindex", "0"); 1024 } else { 1025 tabpanels[i].classList.remove(selectors.active.tabpanel); 1026 tabpanels[i].setAttribute("aria-hidden", true); 1027 tabs[i].classList.remove(selectors.active.tab); 1028 tabs[i].setAttribute("aria-selected", false); 1029 tabs[i].setAttribute("tabindex", "-1"); 1030 } 1031 } 1032 } else { 1033 // only one tab 1034 tabpanels.classList.add(selectors.active.tabpanel); 1035 tabs.classList.add(selectors.active.tab); 1036 } 1037 } 1038 } 1039 1040 /** 1041 * Focuses the element and prevents scrolling the element into view 1042 * 1043 * @param {HTMLElement} element Element to focus 1044 */ 1045 function focusWithoutScroll(element) { 1046 var x = window.scrollX || window.pageXOffset; 1047 var y = window.scrollY || window.pageYOffset; 1048 element.focus(); 1049 window.scrollTo(x, y); 1050 } 1051 1052 /** 1053 * Navigates to the tab at the provided index 1054 * 1055 * @private 1056 * @param {Number} index The index of the tab to navigate to 1057 */ 1058 function navigate(index) { 1059 that._active = index; 1060 refreshActive(); 1061 } 1062 1063 /** 1064 * Navigates to the item at the provided index and ensures the active tab gains focus 1065 * 1066 * @private 1067 * @param {Number} index The index of the item to navigate to 1068 * @param {Boolean} keepHash true to keep the hash in the URL, false to update it 1069 */ 1070 function navigateAndFocusTab(index, keepHash) { 1071 var exActive = that._active; 1072 if (!keepHash && containerUtils) { 1073 containerUtils.updateUrlHash(that, "tab", index); 1074 } 1075 navigate(index); 1076 focusWithoutScroll(that._elements["tab"][index]); 1077 1078 if (dataLayerEnabled) { 1079 1080 var activeItem = getDataLayerId(that._elements.tabpanel[index]); 1081 var exActiveItem = getDataLayerId(that._elements.tabpanel[exActive]); 1082 1083 dataLayer.push({ 1084 event: "cmp:show", 1085 eventInfo: { 1086 path: "component." + activeItem 1087 } 1088 }); 1089 1090 dataLayer.push({ 1091 event: "cmp:hide", 1092 eventInfo: { 1093 path: "component." + exActiveItem 1094 } 1095 }); 1096 1097 var tabsId = that._elements.self.id; 1098 var uploadPayload = { component: {} }; 1099 uploadPayload.component[tabsId] = { shownItems: [activeItem] }; 1100 1101 var removePayload = { component: {} }; 1102 removePayload.component[tabsId] = { shownItems: undefined }; 1103 1104 dataLayer.push(removePayload); 1105 dataLayer.push(uploadPayload); 1106 } 1107 } 1108 } 1109 1110 /**
1111 * Reads options data from the Tabs wrapper element, defined via {@code data-cmp-*} data attributes 1112 * 1113 * @private 1114 * @param {HTMLElement} element The Tabs element to read options data from 1115 * @returns {Object} The options read from the component data attributes 1116 */ 1117 function readData(element) { 1118 var data = element.dataset; 1119 var options = []; 1120 var capitalized = IS; 1121 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 1122 var reserved = ["is", "hook" + capitalized]; 1123 1124 for (var key in data) { 1125 if (Object.prototype.hasOwnProperty.call(data, key)) { 1126 var value = data[key]; 1127 1128 if (key.indexOf(NS) === 0) { 1129 key = key.slice(NS.length); 1130 key = key.charAt(0).toLowerCase() + key.substring(1); 1131 1132 if (reserved.indexOf(key) === -1) { 1133 options[key] = value; 1134 } 1135 } 1136 } 1137 } 1138 1139 return options; 1140 } 1141 1142 /** 1143 * Parses the dataLayer string and returns the ID 1144 * 1145 * @private 1146 * @param {HTMLElement} item the accordion item 1147 * @returns {String} dataLayerId or undefined 1148 */ 1149 function getDataLayerId(item) { 1150 if (item) { 1151 if (item.dataset.cmpDataLayer) { 1152 return Object.keys(JSON.parse(item.dataset.cmpDataLayer))[0]; 1153 } else { 1154 return item.id; 1155 } 1156 } 1157 return null; 1158 } 1159 1160 /** 1161 * Document ready handler and DOM mutation observers. Initializes Tabs components as necessary. 1162 * 1163 * @private 1164 */ 1165 function onDocumentReady() { 1166 dataLayerEnabled = document.body.hasAttribute("data-cmp-data-layer-enabled"); 1167 if (dataLayerEnabled) { 1168 dataLayerName = document.body.getAttribute("data-cmp-data-layer-name") || "adobeDataLayer"; 1169 dataLayer = window[dataLayerName] = window[dataLayerName] || []; 1170 } 1171 1172 var elements = document.querySelectorAll(selectors.self); 1173 for (var i = 0; i < elements.length; i++) { 1174 new Tabs({ element: elements[i], options: readData(elements[i]) }); 1175 } 1176 1177 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 1178 var body = document.querySelector("body"); 1179 var observer = new MutationObserver(function(mutations) { 1180 mutations.forEach(function(mutation) { 1181 // needed for IE 1182 var nodesArray = [].slice.call(mutation.addedNodes); 1183 if (nodesArray.length > 0) { 1184 nodesArray.forEach(function(addedNode) { 1185 if (addedNode.querySelectorAll) { 1186 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 1187 elementsArray.forEach(function(element) { 1188 new Tabs({ element: element, options: readData(element) }); 1189 }); 1190 } 1191 }); 1192 } 1193 }); 1194 }); 1195 1196 observer.observe(body, { 1197 subtree: true, 1198 childList: true, 1199 characterData: true 1200 }); 1201 } 1202 1203 if (document.readyState !== "loading") { 1204 onDocumentReady(); 1205 } else { 1206 document.addEventListener("DOMContentLoaded", onDocumentReady); 1207 } 1208 1209 if (containerUtils) { 1210 window.addEventListener("load", containerUtils.scrollToAnchor, false); 1211 } 1212 1213}()); 1214 1215 1216/******************************************************************************* 1217 * Copyright 2018 Adobe 1218 * 1219 * Licensed under the Apache License, Version 2.0 (the "License"); 1220 * you may not use this file except in compliance with the License. 1221 * You may obtain a copy of the License at 1222 * 1223 * http://www.apache.org/licenses/LICENSE2.0 1224 * 1225 * Unless required by applicable law or agreed to in writing, software 1226 * distributed under the License is distributed on an "AS IS" BASIS, 1227 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1228 * See the License for the specific language governing permissions and 1229 * limitations under the License. 1230 ******************************************************************************/ 1231 1232/** 1233 * Element.matches() 1234 * https://developer.mozilla.org/enUS/docs/Web/API/Element/matches#Polyfill 1235 */ 1236if (!Element.prototype.matches) { 1237 Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 1238} 1239 1240// eslint-disable-next-line valid-jsdoc 1241/** 1242 * Element.closest() 1243 * https://developer.mozilla.org/enUS/docs/Web/API/Element/closest#Polyfill 1244 */ 1245if (!Element.prototype.closest) { 1246 Element.prototype.closest = function(s) { 1247 "use strict"; 1248 var el = this; 1249 if (!document.documentElement.contains(el)) { 1250 return null; 1251 } 1252 do { 1253 if (el.matches(s)) { 1254 return el; 1255 } 1256 el = el.parentElement || el.parentNode; 1257 } while (el !== null && el.nodeType === 1); 1258 return null; 1259 }; 1260} 1261 1262/******************************************************************************* 1263 * Copyright 2018 Adobe 1264 * 1265 * Licensed under the Apache License, Version 2.0 (the "License");
1266 * you may not use this file except in compliance with the License. 1267 * You may obtain a copy of the License at 1268 * 1269 * http://www.apache.org/licenses/LICENSE-2.0 1270 * 1271 * Unless required by applicable law or agreed to in writing, software 1272 * distributed under the License is distributed on an "AS IS" BASIS, 1273 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1274 * See the License for the specific language governing permissions and 1275 * limitations under the License. 1276 ******************************************************************************/ 1277/* global 1278 CQ 1279 */ 1280(function() { 1281 "use strict"; 1282 1283 var containerUtils = window.CQ && window.CQ.CoreComponents && window.CQ.CoreComponents.container && window.CQ.CoreComponents.container.utils ? window.CQ.CoreComponents.container.utils : undefined; 1284 if (!containerUtils) { 1285 // eslint-disable-next-line no-console 1286 console.warn("Tabs: container utilities at window.CQ.CoreComponents.container.utils are not available. This can lead to missing features. Ensure the core.wcm.components.commons.site.container client library is included on the page."); 1287 } 1288 var dataLayerEnabled; 1289 var dataLayer; 1290 1291 var NS = "cmp"; 1292 var IS = "tabs"; 1293 1294 var keyCodes = { 1295 END: 35, 1296 HOME: 36, 1297 ARROW_LEFT: 37, 1298 ARROW_UP: 38, 1299 ARROW_RIGHT: 39, 1300 ARROW_DOWN: 40 1301 }; 1302 1303 var selectors = { 1304 self: "[data-" + NS + '-is="' + IS + '"]', 1305 active: { 1306 tab: "cmp-tabs__tab--active", 1307 tabpanel: "cmp-tabs__tabpanel--active" 1308 } 1309 }; 1310 1311 /** 1312 * Tabs Configuration 1313 * 1314 * @typedef {Object} TabsConfig Represents a Tabs configuration 1315 * @property {HTMLElement} element The HTMLElement representing the Tabs 1316 * @property {Object} options The Tabs options 1317 */ 1318 1319 /** 1320 * Tabs 1321 * 1322 * @class Tabs 1323 * @classdesc An interactive Tabs component for navigating a list of tabs 1324 * @param {TabsConfig} config The Tabs configuration 1325 */ 1326 function Tabs(config) { 1327 var that = this; 1328 1329 if (config && config.element) { 1330 init(config); 1331 } 1332 1333 /** 1334 * Initializes the Tabs 1335 * 1336 * @private 1337 * @param {TabsConfig} config The Tabs configuration 1338 */ 1339 function init(config) { 1340 that._config = config; 1341 1342 // prevents multiple initialization 1343 config.element.removeAttribute("data-" + NS + "-is"); 1344 1345 cacheElements(config.element); 1346 that._active = getActiveIndex(that._elements["tab"]); 1347 1348 if (that._elements.tabpanel) { 1349 refreshActive(); 1350 bindEvents(); 1351 scrollToDeepLinkIdInTabs(); 1352 } 1353 1354 if (window.Granite && window.Granite.author && window.Granite.author.MessageChannel) { 1355 /* 1356 * Editor message handling: 1357 * - subscribe to "cmp.panelcontainer" message requests sent by the editor frame 1358 * - check that the message data panel container type is correct and that the id (path) matches this specific Tabs component 1359 * - if so, route the "navigate" operation to enact a navigation of the Tabs based on index data 1360 */ 1361 CQ.CoreComponents.MESSAGE_CHANNEL = CQ.CoreComponents.MESSAGE_CHANNEL || new window.Granite.author.MessageChannel("cqauthor", window); 1362 CQ.CoreComponents.MESSAGE_CHANNEL.subscribeRequestMessage("cmp.panelcontainer", function(message) { 1363 if (message.data && message.data.type === "cmp-tabs" && message.data.id === that._elements.self.dataset["cmpPanelcontainerId"]) { 1364 if (message.data.operation === "navigate") { 1365 navigate(message.data.index); 1366 } 1367 } 1368 }); 1369 } 1370 } 1371 1372 /** 1373 * Displays the panel containing the element that corresponds to the deep link in the URI fragment 1374 * and scrolls the browser to this element. 1375 */ 1376 function scrollToDeepLinkIdInTabs() { 1377 if (containerUtils) { 1378 var deepLinkItemIdx = containerUtils.getDeepLinkItemIdx(that, "tab", "tabpanel"); 1379 if (deepLinkItemIdx > -1) { 1380 var deepLinkItem = that._elements["tab"][deepLinkItemIdx]; 1381 if (deepLinkItem && that._elements["tab"][that._active].id !== deepLinkItem.id) { 1382 navigateAndFocusTab(deepLinkItemIdx, true); 1383 } 1384 var hashId = window.location.hash.substring(1); 1385 if (hashId) { 1386 var hashItem = document.querySelector("[id='" + hashId + "']"); 1387 if (hashItem) { 1388 hashItem.scrollIntoView(); 1389 } 1390 } 1391 } 1392 } 1393 } 1394 1395 /** 1396 * Returns the index of the active tab, if no tab is active returns 0 1397 * 1398 * @param {Array} tabs Tab elements 1399 * @returns {Number} Index of the active tab, 0 if none is active 1400 */ 1401 function getActiveIndex(tabs) { 1402 if (tabs) { 1403 for (var i = 0; i < tabs.length; i++) { 1404 if (tabs[i].classList.contains(selectors.active.tab)) { 1405 return i; 1406 } 1407 } 1408 } 1409 return 0; 1410 } 1411 1412 /** 1413 * Caches the Tabs elements as defined via the {@code data-tabs-hook="ELEMENT_NAME"} markup API 1414 * 1415 * @private 1416 * @param {HTMLElement} wrapper The Tabs wrapper element 1417 */ 1418 function cacheElements(wrapper) { 1419 that._elements = {}; 1420 that._elements.self = wrapper; 1421 var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); 1422 1423 for (var i = 0; i < hooks.length; i++) { 1424 var hook = hooks[i]; 1425 if (hook.closest("." + NS + "-" + IS) === that._elements.self) { // only process own tab elements 1426 var capitalized = IS; 1427 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 1428 var key = hook.dataset[NS + "Hook" + capitalized]; 1429 if (that._elements[key]) { 1430 if (!Array.isArray(that._elements[key])) { 1431 var tmp = that._elements[key]; 1432 that._elements[key] = [tmp]; 1433 } 1434 that._elements[key].push(hook); 1435 } else { 1436 that._elements[key] = hook; 1437 } 1438 } 1439 } 1440 } 1441 1442 /** 1443 * Binds Tabs event handling 1444 * 1445 * @private 1446 */ 1447 function bindEvents() { 1448 window.addEventListener("hashchange", scrollToDeepLinkIdInTabs, false); 1449 var tabs = that._elements["tab"]; 1450 if (tabs) { 1451 for (var i = 0; i < tabs.length; i++) { 1452 (function(index) { 1453 tabs[i].addEventListener("click", function(event) { 1454 navigateAndFocusTab(index); 1455 }); 1456 tabs[i].addEventListener("keydown", function(event) { 1457 onKeyDown(event); 1458 }); 1459 })(i); 1460 } 1461 } 1462 } 1463 1464 /** 1465 * Handles tab keydown events 1466 * 1467 * @private 1468 * @param {Object} event The keydown event 1469 */ 1470 function onKeyDown(event) { 1471 var index = that._active; 1472 var lastIndex = that._elements["tab"].length - 1; 1473 1474 switch (event.keyCode) { 1475 case keyCodes.ARROW_LEFT: 1476 case keyCodes.ARROW_UP: 1477 event.preventDefault(); 1478 if (index > 0) { 1479 navigateAndFocusTab(index - 1); 1480 } 1481 break; 1482 case keyCodes.ARROW_RIGHT: 1483 case keyCodes.ARROW_DOWN: 1484 event.preventDefault(); 1485 if (index < lastIndex) { 1486 navigateAndFocusTab(index + 1); 1487 } 1488 break; 1489 case keyCodes.HOME: 1490 event.preventDefault(); 1491 navigateAndFocusTab(0); 1492 break; 1493 case keyCodes.END: 1494 event.preventDefault(); 1495 navigateAndFocusTab(lastIndex); 1496 break; 1497 default: 1498 return; 1499 } 1500 } 1501 1502 /** 1503 * Refreshes the tab markup based on the current {@code Tabs#_active} index 1504 * 1505 * @private 1506 */ 1507 function refreshActive() { 1508 var tabpanels = that._elements["tabpanel"]; 1509 var tabs = that._elements["tab"]; 1510 1511 if (tabpanels) { 1512 if (Array.isArray(tabpanels)) { 1513 for (var i = 0; i < tabpanels.length; i++) { 1514 if (i === parseInt(that._active)) { 1515 tabpanels[i].classList.add(selectors.active.tabpanel); 1516 tabpanels[i].removeAttribute("aria-hidden"); 1517 tabs[i].classList.add(selectors.active.tab); 1518 tabs[i].setAttribute("aria-selected", true); 1519 tabs[i].setAttribute("tabindex", "0"); 1520 } else { 1521 tabpanels[i].classList.remove(selectors.active.tabpanel); 1522 tabpanels[i].setAttribute("aria-hidden", true); 1523 tabs[i].classList.remove(selectors.active.tab); 1524 tabs[i].setAttribute("aria-selected", false); 1525 tabs[i].setAttribute("tabindex", "-1"); 1526 } 1527 } 1528 } else { 1529 // only one tab 1530 tabpanels.classList.add(selectors.active.tabpanel); 1531 tabs.classList.add(selectors.active.tab); 1532 } 1533 } 1534 } 1535 1536 /** 1537 * Focuses the element and prevents scrolling the element into view 1538 * 1539 * @param {HTMLElement} element Element to focus 1540 */ 1541 function focusWithoutScroll(element) { 1542 var x = window.scrollX || window.pageXOffset; 1543 var y = window.scrollY || window.pageYOffset; 1544 element.focus(); 1545 window.scrollTo(x, y); 1546 } 1547 1548 /** 1549 * Navigates to the tab at the provided index 1550 * 1551 * @private 1552 * @param {Number} index The index of the tab to navigate to 1553 */ 1554 function navigate(index) { 1555 that._active = index; 1556 refreshActive(); 1557 } 1558 1559 /** 1560 * Navigates to the item at the provided index and ensures the active tab gains focus 1561 * 1562 * @private 1563 * @param {Number} index The index of the item to navigate to 1564 * @param {Boolean} keepHash true to keep the hash in the URL, false to update it 1565 */ 1566 function navigateAndFocusTab(index, keepHash) { 1567 var exActive = that._active; 1568 if (!keepHash && containerUtils) { 1569 containerUtils.updateUrlHash(that, "tab", index); 1570 } 1571 navigate(index); 1572 focusWithoutScroll(that._elements["tab"][index]); 1573 1574 if (dataLayerEnabled) { 1575 1576 var activeItem = getDataLayerId(that._elements.tabpanel[index]); 1577 var exActiveItem = getDataLayerId(that._elements.tabpanel[exActive]); 1578 1579 dataLayer.push({ 1580 event: "cmp:show", 1581 eventInfo: { 1582 path: "component." + activeItem 1583 } 1584 }); 1585 1586 dataLayer.push({ 1587 event: "cmp:hide", 1588 eventInfo: { 1589 path: "component." + exActiveItem 1590 } 1591 }); 1592 1593 var tabsId = that._elements.self.id; 1594 var uploadPayload = { component: {} }; 1595 uploadPayload.component[tabsId] = { shownItems: [activeItem] }; 1596 1597 var removePayload = { component: {} }; 1598 removePayload.component[tabsId] = { shownItems: undefined }; 1599 1600 dataLayer.push(removePayload); 1601 dataLayer.push(uploadPayload); 1602 } 1603 } 1604 } 1605 1606 /**
1607 * Reads options data from the Tabs wrapper element, defined via {@code data-cmp-*} data attributes 1608 * 1609 * @private 1610 * @param {HTMLElement} element The Tabs element to read options data from 1611 * @returns {Object} The options read from the component data attributes 1612 */ 1613 function readData(element) { 1614 var data = element.dataset; 1615 var options = []; 1616 var capitalized = IS; 1617 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 1618 var reserved = ["is", "hook" + capitalized]; 1619 1620 for (var key in data) { 1621 if (Object.prototype.hasOwnProperty.call(data, key)) { 1622 var value = data[key]; 1623 1624 if (key.indexOf(NS) === 0) { 1625 key = key.slice(NS.length); 1626 key = key.charAt(0).toLowerCase() + key.substring(1); 1627 1628 if (reserved.indexOf(key) === -1) { 1629 options[key] = value; 1630 } 1631 } 1632 } 1633 } 1634 1635 return options; 1636 } 1637 1638 /** 1639 * Parses the dataLayer string and returns the ID 1640 * 1641 * @private 1642 * @param {HTMLElement} item the accordion item 1643 * @returns {String} dataLayerId or undefined 1644 */ 1645 function getDataLayerId(item) { 1646 if (item) { 1647 if (item.dataset.cmpDataLayer) { 1648 return Object.keys(JSON.parse(item.dataset.cmpDataLayer))[0]; 1649 } else { 1650 return item.id; 1651 } 1652 } 1653 return null; 1654 } 1655 1656 /** 1657 * Document ready handler and DOM mutation observers. Initializes Tabs components as necessary. 1658 * 1659 * @private 1660 */ 1661 function onDocumentReady() { 1662 dataLayerEnabled = document.body.hasAttribute("data-cmp-data-layer-enabled"); 1663 dataLayer = (dataLayerEnabled) ? window.adobeDataLayer = window.adobeDataLayer || [] : undefined; 1664 1665 var elements = document.querySelectorAll(selectors.self); 1666 for (var i = 0; i < elements.length; i++) { 1667 new Tabs({ element: elements[i], options: readData(elements[i]) }); 1668 } 1669 1670 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 1671 var body = document.querySelector("body"); 1672 var observer = new MutationObserver(function(mutations) { 1673 mutations.forEach(function(mutation) { 1674 // needed for IE 1675 var nodesArray = [].slice.call(mutation.addedNodes); 1676 if (nodesArray.length > 0) { 1677 nodesArray.forEach(function(addedNode) { 1678 if (addedNode.querySelectorAll) { 1679 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 1680 elementsArray.forEach(function(element) { 1681 new Tabs({ element: element, options: readData(element) }); 1682 }); 1683 } 1684 }); 1685 } 1686 }); 1687 }); 1688 1689 observer.observe(body, { 1690 subtree: true, 1691 childList: true, 1692 characterData: true 1693 }); 1694 } 1695 1696 if (document.readyState !== "loading") { 1697 onDocumentReady(); 1698 } else { 1699 document.addEventListener("DOMContentLoaded", onDocumentReady); 1700 } 1701 1702 if (containerUtils) { 1703 window.addEventListener("load", containerUtils.scrollToAnchor, false); 1704 } 1705 1706}()); 1707 1708/******************************************************************************* 1709 * Copyright 2022 Adobe 1710 * 1711 * Licensed under the Apache License, Version 2.0 (the "License"); 1712 * you may not use this file except in compliance with the License. 1713 * You may obtain a copy of the License at 1714 * 1715 * http://www.apache.org/licenses/LICENSE-2.0 1716 * 1717 * Unless required by applicable law or agreed to in writing, software 1718 * distributed under the License is distributed on an "AS IS" BASIS, 1719 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1720 * See the License for the specific language governing permissions and 1721 * limitations under the License. 1722 ******************************************************************************/ 1723(function(document) { 1724 "use strict"; 1725 1726 window.CMP = window.CMP || {}; 1727 window.CMP.utils = (function() { 1728 var NS = "cmp"; 1729 1730 /**
1731 * Reads options data from the Component wrapper element, defined via {@code data-cmp-*} data attributes 1732 * 1733 * @param {HTMLElement} element The component element to read options data from 1734 * @param {String} is The component identifier 1735 * @returns {String[]} The options read from the component data attributes 1736 */ 1737 var readData = function(element, is) { 1738 var data = element.dataset; 1739 var options = []; 1740 var capitalized = is; 1741 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 1742 var reserved = ["is", "hook" + capitalized]; 1743 1744 for (var key in data) { 1745 if (Object.prototype.hasOwnProperty.call(data, key)) { 1746 var value = data[key]; 1747 1748 if (key.indexOf(NS) === 0) { 1749 key = key.slice(NS.length); 1750 key = key.charAt(0).toLowerCase() + key.substring(1); 1751 1752 if (reserved.indexOf(key) === -1) { 1753 options[key] = value; 1754 } 1755 } 1756 } 1757 } 1758 return options; 1759 }; 1760 1761 /** 1762 * Set up the final properties of a component by evaluating the transform function or fall back to the default value on demand 1763 * @param {String[]} options the options to transform 1764 * @param {Object} properties object of properties of property functions 1765 * @returns {Object} transformed properties 1766 */ 1767 var setupProperties = function(options, properties) { 1768 var transformedProperties = {}; 1769 1770 for (var key in properties) { 1771 if (Object.prototype.hasOwnProperty.call(properties, key)) { 1772 var property = properties[key]; 1773 if (options && options[key] != null) { 1774 if (property && typeof property.transform === "function") { 1775 transformedProperties[key] = property.transform(options[key]); 1776 } else { 1777 transformedProperties[key] = options[key]; 1778 } 1779 } else { 1780 transformedProperties[key] = properties[key]["default"]; 1781 } 1782 } 1783 } 1784 return transformedProperties; 1785 }; 1786 1787 1788 return { 1789 readData: readData, 1790 setupProperties: setupProperties 1791 }; 1792 }()); 1793}(window.document)); 1794 1795/******************************************************************************* 1796 * Copyright 2018 Adobe 1797 * 1798 * Licensed under the Apache License, Version 2.0 (the "License"); 1799 * you may not use this file except in compliance with the License. 1800 * You may obtain a copy of the License at 1801 * 1802 * http://www.apache.org/licenses/LICENSE-2.0 1803 * 1804 * Unless required by applicable law or agreed to in writing, software 1805 * distributed under the License is distributed on an "AS IS" BASIS, 1806 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1807 * See the License for the specific language governing permissions and 1808 * limitations under the License. 1809 ******************************************************************************/ 1810(function() { 1811 "use strict"; 1812 1813 var containerUtils = window.CQ && window.CQ.CoreComponents && window.CQ.CoreComponents.container && window.CQ.CoreComponents.container.utils ? window.CQ.CoreComponents.container.utils : undefined; 1814 if (!containerUtils) { 1815 // eslint-disable-next-line no-console 1816 console.warn("Tabs: container utilities at window.CQ.CoreComponents.container.utils are not available. This can lead to missing features. Ensure the core.wcm.components.commons.site.container client library is included on the page."); 1817 } 1818 var dataLayerEnabled; 1819 var dataLayer; 1820 var dataLayerName; 1821 1822 var NS = "cmp"; 1823 var IS = "carousel"; 1824 1825 var keyCodes = { 1826 SPACE: 32, 1827 END: 35, 1828 HOME: 36, 1829 ARROW_LEFT: 37, 1830 ARROW_UP: 38, 1831 ARROW_RIGHT: 39, 1832 ARROW_DOWN: 40 1833 }; 1834 1835 var selectors = { 1836 self: "[data-" + NS + '-is="' + IS + '"]' 1837 }; 1838 1839 var properties = { 1840 /** 1841 * Determines whether the Carousel will automatically transition between slides 1842 * 1843 * @memberof Carousel
1844 * @type {Boolean} 1845 * @default false 1846 */ 1847 "autoplay": { 1848 "default": false, 1849 "transform": function(value) { 1850 return !(value === null || typeof value === "undefined"); 1851 } 1852 }, 1853 /** 1854 * Duration (in milliseconds) before automatically transitioning to the next slide 1855 * 1856 * @memberof Carousel 1857 * @type {Number} 1858 * @default 5000 1859 */ 1860 "delay": { 1861 "default": 5000, 1862 "transform": function(value) { 1863 value = parseFloat(value); 1864 return !isNaN(value) ? value : null; 1865 } 1866 }, 1867 /** 1868 * Determines whether automatic pause on hovering the carousel is disabled 1869 * 1870 * @memberof Carousel 1871 * @type {Boolean} 1872 * @default false 1873 */ 1874 "autopauseDisabled": { 1875 "default": false, 1876 "transform": function(value) { 1877 return !(value === null || typeof value === "undefined"); 1878 } 1879 } 1880 }; 1881 1882 /** 1883 * Carousel Configuration 1884 * 1885 * @typedef {Object} CarouselConfig Represents a Carousel configuration 1886 * @property {HTMLElement} element The HTMLElement representing the Carousel 1887 * @property {*[]} options The Carousel options 1888 */ 1889 1890 /** 1891 * Carousel 1892 * 1893 * @class Carousel 1894 * @classdesc An interactive Carousel component for navigating a list of generic items 1895 * @param {CarouselConfig} config The Carousel configuration 1896 */ 1897 function Carousel(config) { 1898 var that = this; 1899 1900 if (config && config.element) { 1901 init(config); 1902 } 1903 1904 /** 1905 * Initializes the Carousel 1906 * 1907 * @private 1908 * @param {CarouselConfig} config The Carousel configuration 1909 */ 1910 function init(config) { 1911 that._config = config; 1912 1913 // prevents multiple initialization 1914 config.element.removeAttribute("data-" + NS + "-is"); 1915 1916 setupProperties(config.options); 1917 cacheElements(config.element); 1918 1919 that._active = 0; 1920 that._paused = false; 1921 1922 if (that._elements.item) { 1923 initializeActive(); 1924 bindEvents(); 1925 resetAutoplayInterval(); 1926 refreshPlayPauseActions(); 1927 scrollToDeepLinkIdInCarousel(); 1928 } 1929 1930 // TODO: This section is only relevant in edit mode and should move to the editor clientLib 1931 if (window.Granite && window.Granite.author && window.Granite.author.MessageChannel) { 1932 /* 1933 * Editor message handling: 1934 * - subscribe to "cmp.panelcontainer" message requests sent by the editor frame 1935 * - check that the message data panel container type is correct and that the id (path) matches this specific Carousel component 1936 * - if so, route the "navigate" operation to enact a navigation of the Carousel based on index data 1937 */ 1938 window.CQ = window.CQ || {}; 1939 window.CQ.CoreComponents = window.CQ.CoreComponents || {}; 1940 window.CQ.CoreComponents.MESSAGE_CHANNEL = window.CQ.CoreComponents.MESSAGE_CHANNEL || new window.Granite.author.MessageChannel("cqauthor", window); 1941 window.CQ.CoreComponents.MESSAGE_CHANNEL.subscribeRequestMessage("cmp.panelcontainer", function(message) { 1942 if (message.data && message.data.type === "cmp-carousel" && message.data.id === that._elements.self.dataset["cmpPanelcontainerId"]) { 1943 if (message.data.operation === "navigate") { 1944 navigate(message.data.index); 1945 } 1946 } 1947 }); 1948 } 1949 } 1950 1951 /** 1952 * Displays the slide containing the element that corresponds to the deep link in the URI fragment 1953 * and scrolls the browser to this element. 1954 */ 1955 function scrollToDeepLinkIdInCarousel() { 1956 if (containerUtils) { 1957 var deepLinkItemIdx = containerUtils.getDeepLinkItemIdx(that, "item", "item"); 1958 if (deepLinkItemIdx > -1) { 1959 var deepLinkItem = that._elements["item"][deepLinkItemIdx]; 1960 if (deepLinkItem && that._elements["item"][that._active].id !== deepLinkItem.id) { 1961 navigateAndFocusIndicator(deepLinkItemIdx, true); 1962 // pause the carousel auto-rotation 1963 pause(); 1964 } 1965 var hashId = window.location.hash.substring(1); 1966 if (hashId) { 1967 var hashItem = document.querySelector("[id='" + hashId + "']"); 1968 if (hashItem) { 1969 hashItem.scrollIntoView(); 1970 } 1971 } 1972 } 1973 } 1974 } 1975 1976 /** 1977 * Caches the Carousel elements as defined via the {@code data-carousel-hook="ELEMENT_NAME"} markup API 1978 * 1979 * @private 1980 * @param {HTMLElement} wrapper The Carousel wrapper element 1981 */ 1982 function cacheElements(wrapper) { 1983 that._elements = {}; 1984 that._elements.self = wrapper; 1985 var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); 1986 1987 for (var i = 0; i < hooks.length; i++) { 1988 var hook = hooks[i]; 1989 var capitalized = IS; 1990 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 1991 var key = hook.dataset[NS + "Hook" + capitalized]; 1992 if (that._elements[key]) { 1993 if (!Array.isArray(that._elements[key])) { 1994 var tmp = that._elements[key]; 1995 that._elements[key] = [tmp]; 1996 } 1997 that._elements[key].push(hook); 1998 } else { 1999 that._elements[key] = hook; 2000 } 2001 } 2002 } 2003 2004 /** 2005 * Sets up properties for the Carousel based on the passed options. 2006 * 2007 * @private 2008 * @param {Object} options The Carousel options 2009 */ 2010 function setupProperties(options) { 2011 that._properties = {}; 2012 2013 for (var key in properties) { 2014 if (Object.prototype.hasOwnProperty.call(properties, key)) { 2015 var property = properties[key]; 2016 var value = null; 2017 2018 if (options && options[key] != null) { 2019 value = options[key]; 2020 2021 // transform the provided option 2022 if (property && typeof property.transform === "function") { 2023 value = property.transform(value); 2024 } 2025 } 2026 2027 if (value === null) { 2028 // value still null, take the property default 2029 value = properties[key]["default"]; 2030 } 2031 2032 that._properties[key] = value; 2033 } 2034 } 2035 } 2036 2037 /** 2038 * Binds Carousel event handling 2039 * 2040 * @private 2041 */ 2042 function bindEvents() { 2043 window.addEventListener("hashchange", scrollToDeepLinkIdInCarousel, false); 2044 if (that._elements["previous"]) { 2045 that._elements["previous"].addEventListener("click", function() { 2046 var index = getPreviousIndex(); 2047 navigate(index); 2048 if (dataLayerEnabled) { 2049 dataLayer.push({ 2050 event: "cmp:show", 2051 eventInfo: { 2052 path: "component." + getDataLayerId(that._elements.item[index]) 2053 } 2054 }); 2055 } 2056 }); 2057 } 2058 2059 if (that._elements["next"]) { 2060 that._elements["next"].addEventListener("click", function() { 2061 var index = getNextIndex(); 2062 navigate(index); 2063 if (dataLayerEnabled) { 2064 dataLayer.push({ 2065 event: "cmp:show", 2066 eventInfo: { 2067 path: "component." + getDataLayerId(that._elements.item[index]) 2068 } 2069 }); 2070 } 2071 }); 2072 } 2073 2074 var indicators = that._elements["indicator"]; 2075 if (indicators) { 2076 for (var i = 0; i < indicators.length; i++) { 2077 (function(index) { 2078 indicators[i].addEventListener("click", function(event) { 2079 navigateAndFocusIndicator(index); 2080 // pause the carousel auto-rotation 2081 pause(); 2082 }); 2083 })(i); 2084 } 2085 } 2086 2087 if (that._elements["pause"]) { 2088 if (that._properties.autoplay) { 2089 that._elements["pause"].addEventListener("click", onPauseClick); 2090 } 2091 } 2092 2093 if (that._elements["play"]) { 2094 if (that._properties.autoplay) { 2095 that._elements["play"].addEventListener("click", onPlayClick); 2096 } 2097 } 2098 2099 that._elements.self.addEventListener("keydown", onKeyDown); 2100 2101 if (!that._properties.autopauseDisabled) { 2102 that._elements.self.addEventListener("mouseenter", onMouseEnter); 2103 that._elements.self.addEventListener("mouseleave", onMouseLeave); 2104 } 2105 2106 // for accessibility we pause animation when a element get focused 2107 var items = that._elements["item"]; 2108 if (items) { 2109 for (var j = 0; j < items.length; j++) { 2110 items[j].addEventListener("focusin", onMouseEnter); 2111 items[j].addEventListener("focusout", onMouseLeave); 2112 } 2113 } 2114 } 2115 2116 /**
2117 * Handles carousel keydown events 2118 * 2119 * @private 2120 * @param {Object} event The keydown event 2121 */ 2122 function onKeyDown(event) { 2123 var index = that._active; 2124 var lastIndex = that._elements["indicator"].length - 1; 2125 2126 switch (event.keyCode) { 2127 case keyCodes.ARROW_LEFT: 2128 case keyCodes.ARROW_UP: 2129 event.preventDefault(); 2130 if (index > 0) { 2131 navigateAndFocusIndicator(index - 1); 2132 } 2133 break; 2134 case keyCodes.ARROW_RIGHT: 2135 case keyCodes.ARROW_DOWN: 2136 event.preventDefault(); 2137 if (index < lastIndex) { 2138 navigateAndFocusIndicator(index + 1); 2139 } 2140 break; 2141 case keyCodes.HOME: 2142 event.preventDefault(); 2143 navigateAndFocusIndicator(0); 2144 break; 2145 case keyCodes.END: 2146 event.preventDefault(); 2147 navigateAndFocusIndicator(lastIndex); 2148 break; 2149 case keyCodes.SPACE: 2150 if (that._properties.autoplay && (event.target !== that._elements["previous"] && event.target !== that._elements["next"])) { 2151 event.preventDefault(); 2152 if (!that._paused) { 2153 pause(); 2154 } else { 2155 play(); 2156 } 2157 } 2158 if (event.target === that._elements["pause"]) { 2159 that._elements["play"].focus(); 2160 } 2161 if (event.target === that._elements["play"]) { 2162 that._elements["pause"].focus(); 2163 } 2164 break; 2165 default: 2166 return; 2167 } 2168 } 2169 2170 /** 2171 * Handles carousel mouseenter events 2172 * 2173 * @private 2174 * @param {Object} event The mouseenter event 2175 */ 2176 function onMouseEnter(event) { 2177 clearAutoplayInterval(); 2178 } 2179 2180 /** 2181 * Handles carousel mouseleave events 2182 * 2183 * @private 2184 * @param {Object} event The mouseleave event 2185 */ 2186 function onMouseLeave(event) { 2187 resetAutoplayInterval(); 2188 } 2189 2190 /** 2191 * Handles pause element click events 2192 * 2193 * @private 2194 * @param {Object} event The click event 2195 */ 2196 function onPauseClick(event) { 2197 pause(); 2198 that._elements["play"].focus(); 2199 } 2200 2201 /** 2202 * Handles play element click events 2203 * 2204 * @private 2205 * @param {Object} event The click event 2206 */ 2207 function onPlayClick() { 2208 play(); 2209 that._elements["pause"].focus(); 2210 } 2211 2212 /** 2213 * Pauses the playing of the Carousel. Sets {@code Carousel#_paused} marker. 2214 * Only relevant when autoplay is enabled 2215 * 2216 * @private 2217 */ 2218 function pause() { 2219 that._paused = true; 2220 clearAutoplayInterval(); 2221 refreshPlayPauseActions(); 2222 } 2223 2224 /** 2225 * Enables the playing of the Carousel. Sets {@code Carousel#_paused} marker. 2226 * Only relevant when autoplay is enabled 2227 * 2228 * @private 2229 */ 2230 function play() { 2231 that._paused = false; 2232 2233 // If the Carousel is hovered, don't begin auto transitioning until the next mouse leave event 2234 var hovered = false; 2235 if (that._elements.self.parentElement) { 2236 hovered = that._elements.self.parentElement.querySelector(":hover") === that._elements.self; 2237 } 2238 if (that._properties.autopauseDisabled || !hovered) { 2239 resetAutoplayInterval(); 2240 } 2241 2242 refreshPlayPauseActions(); 2243 } 2244 2245 /** 2246 * Refreshes the play/pause action markup based on the {@code Carousel#_paused} state 2247 * 2248 * @private 2249 */ 2250 function refreshPlayPauseActions() {
2251 setActionDisabled(that._elements["pause"], that._paused); 2252 setActionDisabled(that._elements["play"], !that._paused); 2253 } 2254 2255 /** 2256 * Initialize {@code Carousel#_active} based on the active item of the carousel. 2257 */ 2258 function initializeActive() { 2259 var items = that._elements["item"]; 2260 if (items && Array.isArray(items)) { 2261 for (var i = 0; i < items.length; i++) { 2262 if (items[i].classList.contains("cmp-carousel__item--active")) { 2263 that._active = i; 2264 break; 2265 } 2266 } 2267 } 2268 } 2269 2270 /** 2271 * Refreshes the item markup based on the current {@code Carousel#_active} index 2272 * 2273 * @private 2274 */ 2275 function refreshActive() { 2276 var items = that._elements["item"]; 2277 var indicators = that._elements["indicator"]; 2278 2279 if (items) { 2280 if (Array.isArray(items)) { 2281 for (var i = 0; i < items.length; i++) { 2282 if (i === parseInt(that._active)) { 2283 items[i].classList.add("cmp-carousel__item--active"); 2284 items[i].removeAttribute("aria-hidden"); 2285 indicators[i].classList.add("cmp-carousel__indicator--active"); 2286 indicators[i].setAttribute("aria-selected", true); 2287 indicators[i].setAttribute("tabindex", "0"); 2288 } else { 2289 items[i].classList.remove("cmp-carousel__item--active"); 2290 items[i].setAttribute("aria-hidden", true); 2291 indicators[i].classList.remove("cmp-carousel__indicator--active"); 2292 indicators[i].setAttribute("aria-selected", false); 2293 indicators[i].setAttribute("tabindex", "-1"); 2294 } 2295 } 2296 } else { 2297 // only one item 2298 items.classList.add("cmp-carousel__item--active"); 2299 indicators.classList.add("cmp-carousel__indicator--active"); 2300 } 2301 } 2302 } 2303 2304 /** 2305 * Focuses the element and prevents scrolling the element into view 2306 * 2307 * @param {HTMLElement} element Element to focus 2308 */ 2309 function focusWithoutScroll(element) { 2310 var x = window.scrollX || window.pageXOffset; 2311 var y = window.scrollY || window.pageYOffset; 2312 element.focus(); 2313 window.scrollTo(x, y); 2314 } 2315 2316 /** 2317 * Retrieves the next active index, with looping 2318 * 2319 * @private 2320 * @returns {Number} Index of the next carousel item 2321 */ 2322 function getNextIndex() { 2323 return that._active === (that._elements["item"].length - 1) ? 0 : that._active + 1; 2324 } 2325 2326 /** 2327 * Retrieves the previous active index, with looping 2328 * 2329 * @private 2330 * @returns {Number} Index of the previous carousel item 2331 */ 2332 function getPreviousIndex() { 2333 return that._active === 0 ? (that._elements["item"].length - 1) : that._active - 1; 2334 } 2335 2336 /** 2337 * Navigates to the item at the provided index 2338 * 2339 * @private 2340 * @param {Number} index The index of the item to navigate to 2341 * @param {Boolean} keepHash true to keep the hash in the URL, false to update it 2342 */ 2343 function navigate(index, keepHash) { 2344 if (index < 0 || index > (that._elements["item"].length - 1)) { 2345 return; 2346 } 2347 2348 that._active = index; 2349 refreshActive(); 2350 2351 if (!keepHash && containerUtils) { 2352 containerUtils.updateUrlHash(that, "item", index); 2353 } 2354 2355 if (dataLayerEnabled) { 2356 var carouselId = that._elements.self.id; 2357 var activeItem = getDataLayerId(that._elements.item[index]); 2358 var updatePayload = { component: {} }; 2359 updatePayload.component[carouselId] = { shownItems: [activeItem] }; 2360 2361 var removePayload = { component: {} }; 2362 removePayload.component[carouselId] = { shownItems: undefined }; 2363 2364 dataLayer.push(removePayload); 2365 dataLayer.push(updatePayload); 2366 } 2367 2368 // reset the autoplay transition interval following navigation, if not already hovering the carousel
2369 if (that._elements.self.parentElement) { 2370 if (that._elements.self.parentElement.querySelector(":hover") !== that._elements.self) { 2371 resetAutoplayInterval(); 2372 } 2373 } 2374 } 2375 2376 /** 2377 * Navigates to the item at the provided index and ensures the active indicator gains focus 2378 * 2379 * @private 2380 * @param {Number} index The index of the item to navigate to 2381 * @param {Boolean} keepHash true to keep the hash in the URL, false to update it 2382 */ 2383 function navigateAndFocusIndicator(index, keepHash) { 2384 navigate(index, keepHash); 2385 focusWithoutScroll(that._elements["indicator"][index]); 2386 2387 if (dataLayerEnabled) { 2388 dataLayer.push({ 2389 event: "cmp:show", 2390 eventInfo: { 2391 path: "component." + getDataLayerId(that._elements.item[index]) 2392 } 2393 }); 2394 } 2395 } 2396 2397 /** 2398 * Starts/resets automatic slide transition interval 2399 * 2400 * @private 2401 */ 2402 function resetAutoplayInterval() { 2403 if (that._paused || !that._properties.autoplay) { 2404 return; 2405 } 2406 clearAutoplayInterval(); 2407 that._autoplayIntervalId = window.setInterval(function() { 2408 if (document.visibilityState && document.hidden) { 2409 return; 2410 } 2411 var indicators = that._elements["indicators"]; 2412 if (indicators !== document.activeElement && indicators.contains(document.activeElement)) { 2413 // if an indicator has focus, ensure we switch focus following navigation 2414 navigateAndFocusIndicator(getNextIndex(), true); 2415 } else { 2416 navigate(getNextIndex(), true); 2417 } 2418 }, that._properties.delay); 2419 } 2420 2421 /** 2422 * Clears/pauses automatic slide transition interval 2423 * 2424 * @private 2425 */ 2426 function clearAutoplayInterval() { 2427 window.clearInterval(that._autoplayIntervalId); 2428 that._autoplayIntervalId = null; 2429 } 2430 2431 /** 2432 * Sets the disabled state for an action and toggles the appropriate CSS classes 2433 * 2434 * @private 2435 * @param {HTMLElement} action Action to disable 2436 * @param {Boolean} [disable] {@code true} to disable, {@code false} to enable 2437 */ 2438 function setActionDisabled(action, disable) { 2439 if (!action) { 2440 return; 2441 } 2442 if (disable !== false) { 2443 action.disabled = true; 2444 action.classList.add("cmp-carousel__action--disabled"); 2445 } else { 2446 action.disabled = false; 2447 action.classList.remove("cmp-carousel__action--disabled"); 2448 } 2449 } 2450 } 2451 2452 /** 2453 * Parses the dataLayer string and returns the ID 2454 * 2455 * @private 2456 * @param {HTMLElement} item the accordion item 2457 * @returns {String} dataLayerId or undefined 2458 */ 2459 function getDataLayerId(item) { 2460 if (item) { 2461 if (item.dataset.cmpDataLayer) { 2462 return Object.keys(JSON.parse(item.dataset.cmpDataLayer))[0]; 2463 } else { 2464 return item.id; 2465 } 2466 } 2467 return null; 2468 } 2469 2470 /** 2471 * Document ready handler and DOM mutation observers. Initializes Carousel components as necessary. 2472 * 2473 * @private 2474 */ 2475 function onDocumentReady() { 2476 dataLayerEnabled = document.body.hasAttribute("data-cmp-data-layer-enabled"); 2477 if (dataLayerEnabled) { 2478 dataLayerName = document.body.getAttribute("data-cmp-data-layer-name") || "adobeDataLayer"; 2479 dataLayer = window[dataLayerName] = window[dataLayerName] || []; 2480 } 2481 2482 var elements = document.querySelectorAll(selectors.self); 2483 for (var i = 0; i < elements.length; i++) { 2484 new Carousel({ element: elements[i], options: CMP.utils.readData(elements[i], IS) }); 2485 } 2486 2487 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 2488 var body = document.querySelector("body"); 2489 var observer = new MutationObserver(function(mutations) { 2490 mutations.forEach(function(mutation) { 2491 // needed for IE 2492 var nodesArray = [].slice.call(mutation.addedNodes); 2493 if (nodesArray.length > 0) { 2494 nodesArray.forEach(function(addedNode) { 2495 if (addedNode.querySelectorAll) { 2496 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 2497 elementsArray.forEach(function(element) { 2498 new Carousel({ element: element, options: CMP.utils.readData(element, IS) }); 2499 }); 2500 } 2501 }); 2502 } 2503 }); 2504 }); 2505 2506 observer.observe(body, { 2507 subtree: true, 2508 childList: true, 2509 characterData: true 2510 }); 2511 } 2512 2513 var documentReady = document.readyState !== "loading" ? Promise.resolve() : new Promise(function(resolve) { 2514 document.addEventListener("DOMContentLoaded", resolve); 2515 }); 2516 Promise.all([documentReady]).then(onDocumentReady); 2517 2518 if (containerUtils) { 2519 window.addEventListener("load", containerUtils.scrollToAnchor, false); 2520 } 2521 2522}()); 2523 2524 2525/******************************************************************************* 2526 * Copyright 2022 Adobe 2527 * 2528 * Licensed under the Apache License, Version 2.0 (the "License");
2529 * you may not use this file except in compliance with the License. 2530 * You may obtain a copy of the License at 2531 * 2532 * http://www.apache.org/licenses/LICENSE-2.0 2533 * 2534 * Unless required by applicable law or agreed to in writing, software 2535 * distributed under the License is distributed on an "AS IS" BASIS, 2536 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2537 * See the License for the specific language governing permissions and 2538 * limitations under the License. 2539 ******************************************************************************/ 2540(function(document) { 2541 "use strict"; 2542 2543 window.CMP = window.CMP || {}; 2544 window.CMP.utils = (function() { 2545 var NS = "cmp"; 2546 2547 /** 2548 * Reads options data from the Component wrapper element, defined via {@code data-cmp-*} data attributes 2549 * 2550 * @param {HTMLElement} element The component element to read options data from 2551 * @param {String} is The component identifier 2552 * @returns {String[]} The options read from the component data attributes 2553 */ 2554 var readData = function(element, is) { 2555 var data = element.dataset; 2556 var options = []; 2557 var capitalized = is; 2558 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 2559 var reserved = ["is", "hook" + capitalized]; 2560 2561 for (var key in data) { 2562 if (Object.prototype.hasOwnProperty.call(data, key)) { 2563 var value = data[key]; 2564 2565 if (key.indexOf(NS) === 0) { 2566 key = key.slice(NS.length); 2567 key = key.charAt(0).toLowerCase() + key.substring(1); 2568 2569 if (reserved.indexOf(key) === -1) { 2570 options[key] = value; 2571 } 2572 } 2573 } 2574 } 2575 return options; 2576 }; 2577 2578 /** 2579 * Set up the final properties of a component by evaluating the transform function or fall back to the default value on demand 2580 * @param {String[]} options the options to transform 2581 * @param {Object} properties object of properties of property functions 2582 * @returns {Object} transformed properties 2583 */ 2584 var setupProperties = function(options, properties) { 2585 var transformedProperties = {}; 2586 2587 for (var key in properties) { 2588 if (Object.prototype.hasOwnProperty.call(properties, key)) { 2589 var property = properties[key]; 2590 if (options && options[key] != null) { 2591 if (property && typeof property.transform === "function") { 2592 transformedProperties[key] = property.transform(options[key]); 2593 } else { 2594 transformedProperties[key] = options[key]; 2595 } 2596 } else { 2597 transformedProperties[key] = properties[key]["default"]; 2598 } 2599 } 2600 } 2601 return transformedProperties; 2602 }; 2603 2604 2605 return { 2606 readData: readData, 2607 setupProperties: setupProperties 2608 }; 2609 }()); 2610}(window.document)); 2611 2612/******************************************************************************* 2613 * Copyright 2022 Adobe 2614 * 2615 * Licensed under the Apache License, Version 2.0 (the "License"); 2616 * you may not use this file except in compliance with the License. 2617 * You may obtain a copy of the License at 2618 * 2619 * http://www.apache.org/licenses/LICENSE-2.0 2620 * 2621 * Unless required by applicable law or agreed to in writing, software 2622 * distributed under the License is distributed on an "AS IS" BASIS, 2623 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2624 * See the License for the specific language governing permissions and 2625 * limitations under the License. 2626 ******************************************************************************/ 2627(function(document) { 2628 "use strict"; 2629 2630 window.CMP = window.CMP || {}; 2631 window.CMP.image = window.CMP.image || {}; 2632 window.CMP.image.dynamicMedia = (function() { 2633 var autoSmartCrops = {}; 2634 var SRC_URI_TEMPLATE_WIDTH_VAR = "{.width}"; 2635 var SRC_URI_TEMPLATE_DPR_VAR = "{dpr}";
2636 var SRC_URI_DPR_OFF = "dpr=off"; 2637 var SRC_URI_DPR_ON = "dpr=on,{dpr}"; 2638 var dpr = window.devicePixelRatio || 1; 2639 var config = { 2640 minWidth: 20 2641 }; 2642 2643 /** 2644 * get auto smart crops from dm 2645 * @param {String} src the src uri 2646 * @returns {{}} the smart crop json object 2647 */ 2648 var getAutoSmartCrops = function(src) { 2649 var request = new XMLHttpRequest(); 2650 var url = src.split(SRC_URI_TEMPLATE_WIDTH_VAR)[0] + "?req=set,json"; 2651 request.open("GET", url, false); 2652 request.onload = function() { 2653 if (request.status >= 200 && request.status < 400) { 2654 // success status 2655 var responseText = request.responseText; 2656 var rePayload = new RegExp(/^(?:\/\*jsonp\*\/)?\s*([^()]+)\(([\s\S]+),\s*"[0-9]*"\);?$/gmi); 2657 var rePayloadJSON = new RegExp(/^{[\s\S]*}$/gmi); 2658 var resPayload = rePayload.exec(responseText); 2659 var payload; 2660 if (resPayload) { 2661 var payloadStr = resPayload[2]; 2662 if (rePayloadJSON.test(payloadStr)) { 2663 payload = JSON.parse(payloadStr); 2664 } 2665 2666 } 2667 // check "relation" - only in case of smartcrop preset 2668 if (payload && payload.set.relation && payload.set.relation.length > 0) { 2669 for (var i = 0; i < payload.set.relation.length; i++) { 2670 autoSmartCrops[parseInt(payload.set.relation[i].userdata.SmartCropWidth)] = 2671 ":" + payload.set.relation[i].userdata.SmartCropDef; 2672 } 2673 } 2674 } else { 2675 // error status 2676 } 2677 }; 2678 request.send(); 2679 return autoSmartCrops; 2680 }; 2681 2682 /** 2683 * Build and return the srcset value based on the available auto smart crops 2684 * @param {String} src the src uri 2685 * @param {Object} smartCrops the smart crops object 2686 * @returns {String} the srcset 2687 */ 2688 var getSrcSet = function(src, smartCrops) { 2689 var srcset; 2690 var keys = Object.keys(smartCrops); 2691 if (keys.length > 0) { 2692 srcset = []; 2693 for (var key in autoSmartCrops) { 2694 srcset.push(src.replace(SRC_URI_TEMPLATE_WIDTH_VAR, smartCrops[key]) + " " + key + "w"); 2695 } 2696 } 2697 return srcset.join(","); 2698 }; 2699 2700 /** 2701 * Get the optimal width based on the available sizes 2702 * @param {[Number]} sizes the available sizes 2703 * @param {Number} width the element width 2704 * @returns {String} the optimal width 2705 */ 2706 function getOptimalWidth(sizes, width) { 2707 var len = sizes.length; 2708 var key = 0; 2709 2710 while ((key < len - 1) && (sizes[key] < width)) { 2711 key++; 2712 } 2713 2714 return sizes[key] !== undefined ? sizes[key].toString() : width; 2715 } 2716 2717 /** 2718 * Get the width of an element or parent element if the width is smaller than the minimum width 2719 * @param {HTMLElement} component the image component 2720 * @param {HTMLElement | Node} parent the parent element 2721 * @returns {Number} the width of the element 2722 */ 2723 var getWidth = function(component, parent) { 2724 var width = component.offsetWidth; 2725 while (width < config.minWidth && parent && !component._autoWidth) { 2726 width = parent.offsetWidth; 2727 parent = parent.parentNode; 2728 } 2729 return width; 2730 }; 2731 2732 /** 2733 * Set the src and srcset attribute for a Dynamic Media Image which auto smart crops enabled. 2734 * @param {HTMLElement} component the image component 2735 * @param {{}} properties the component properties 2736 */ 2737 var setDMAttributes = function(component, properties) { 2738 // for v3 we first have to turn the dpr on
2739 var src = properties.src.replace(SRC_URI_DPR_OFF, SRC_URI_DPR_ON); 2740 src = src.replace(SRC_URI_TEMPLATE_DPR_VAR, dpr); 2741 var smartCrops = {}; 2742 var width; 2743 if (properties["smartcroprendition"] === "SmartCrop:Auto") { 2744 smartCrops = getAutoSmartCrops(src); 2745 } 2746 var hasWidths = (properties.widths && properties.widths.length > 0) || Object.keys(smartCrops).length > 0; 2747 if (hasWidths) { 2748 var image = component.querySelector("img"); 2749 var elemWidth = getWidth(component, component.parentNode); 2750 if (properties["smartcroprendition"] === "SmartCrop:Auto") { 2751 image.setAttribute("srcset", CMP.image.dynamicMedia.getSrcSet(src, smartCrops)); 2752 width = getOptimalWidth(Object.keys(smartCrops, elemWidth)); 2753 image.setAttribute("src", CMP.image.dynamicMedia.getSrc(src, smartCrops[width])); 2754 } else { 2755 width = getOptimalWidth(properties.widths, elemWidth); 2756 image.setAttribute("src", CMP.image.dynamicMedia.getSrc(src, width)); 2757 } 2758 } 2759 }; 2760 2761 /** 2762 * Get the src attribute based on the optimal width 2763 * @param {String} src the src uri 2764 * @param {String} width the element width 2765 * @returns {String} the final src attribute 2766 */ 2767 var getSrc = function(src, width) { 2768 if (src.indexOf(SRC_URI_TEMPLATE_WIDTH_VAR) > -1) { 2769 src = src.replace(SRC_URI_TEMPLATE_WIDTH_VAR, width); 2770 } 2771 return src; 2772 }; 2773 2774 2775 return { 2776 getAutoSmartCrops: getAutoSmartCrops, 2777 getSrcSet: getSrcSet, 2778 getSrc: getSrc, 2779 setDMAttributes: setDMAttributes, 2780 getWidth: getWidth 2781 }; 2782 }()); 2783 document.dispatchEvent(new CustomEvent("core.wcm.components.commons.site.image.dynamic-media.loaded")); 2784}(window.document)); 2785 2786/******************************************************************************* 2787 * Copyright 2022 Adobe 2788 * 2789 * Licensed under the Apache License, Version 2.0 (the "License"); 2790 * you may not use this file except in compliance with the License. 2791 * You may obtain a copy of the License at 2792 * 2793 * http://www.apache.org/licenses/LICENSE-2.0 2794 * 2795 * Unless required by applicable law or agreed to in writing, software 2796 * distributed under the License is distributed on an "AS IS" BASIS, 2797 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2798 * See the License for the specific language governing permissions and 2799 * limitations under the License. 2800 ******************************************************************************/ 2801(function(document) { 2802 2803 "use strict"; 2804 2805 window.CMP = window.CMP || {}; 2806 window.CMP.image = window.CMP.image || {}; 2807 window.CMP.image.v3 = (function() { 2808 var IS = "image"; 2809 2810 var selectors = { 2811 self: "[data-cmp-hook-image='imageV3']" 2812 }; 2813 2814 var properties = { 2815 "widths": { 2816 "default": [], 2817 "transform": function(value) { 2818 var widths = []; 2819 value.split(",").forEach(function(item) { 2820 item = parseFloat(item); 2821 if (!isNaN(item)) { 2822 widths.push(item); 2823 } 2824 }); 2825 return widths; 2826 } 2827 }, 2828 "dmimage": { 2829 "default": false, 2830 "transform": function(value) { 2831 return !(value === null || typeof value === "undefined"); 2832 } 2833 }, 2834 "src": { 2835 "transform": function(value) { 2836 return decodeURIComponent(value); 2837 } 2838 }, 2839 "smartcroprendition": "" 2840 }; 2841 2842 function Image(config) { 2843 var that = this; 2844 /** 2845 * Init the image if the image is from dynamic media 2846 * @param {HTMLElement} component the image component 2847 */ 2848 that.initImage = function(component) { 2849 var options = CMP.utils.readData(component, IS); 2850 that._properties = CMP.utils.setupProperties(options, properties); 2851 if (that._properties.dmimage) { 2852 // use encoded src for dynamic media 2853 that._properties.src = options["src"]; 2854 CMP.image.dynamicMedia.setDMAttributes(component, that._properties); 2855 } 2856 }; 2857 that.initImage(config.element); 2858 } 2859 2860 return { 2861 init: function() { 2862 var elements = document.querySelectorAll(selectors.self); 2863 for (var i = 0; i < elements.length; i++) { 2864 new Image({ element: elements[i], options: CMP.utils.readData(elements[i], IS) }); 2865 } 2866 2867 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 2868 var body = document.querySelector("body"); 2869 var observer = new MutationObserver(function(mutations) { 2870 mutations.forEach(function(mutation) { 2871 // needed for IE 2872 var nodesArray = [].slice.call(mutation.addedNodes); 2873 if (nodesArray.length > 0) { 2874 nodesArray.forEach(function(addedNode) { 2875 if (addedNode.querySelectorAll) { 2876 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 2877 elementsArray.forEach(function(element) { 2878 new Image({ element: element, options: CMP.utils.readData(element, IS) }); 2879 }); 2880 } 2881 }); 2882 } 2883 }); 2884 }); 2885 2886 observer.observe(body, { 2887 subtree: true, 2888 childList: true, 2889 characterData: true 2890 }); 2891 } 2892 }; 2893 }()); 2894 2895 var documentReady = document.readyState !== "loading" ? Promise.resolve() : new Promise(function(resolve) { 2896 document.addEventListener("DOMContentLoaded", resolve); 2897 }); 2898 Promise.all([documentReady]).then(window.CMP.image.v3.init); 2899}(window.document)); 2900 2901 2902/******************************************************************************* 2903 * Copyright 2022 Adobe 2904 * 2905 * Licensed under the Apache License, Version 2.0 (the "License");
2906 * you may not use this file except in compliance with the License. 2907 * You may obtain a copy of the License at 2908 * 2909 * http://www.apache.org/licenses/LICENSE-2.0 2910 * 2911 * Unless required by applicable law or agreed to in writing, software 2912 * distributed under the License is distributed on an "AS IS" BASIS, 2913 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2914 * See the License for the specific language governing permissions and 2915 * limitations under the License. 2916 ******************************************************************************/ 2917(function() { 2918 "use strict"; 2919 2920 var NS = "cmp"; 2921 var IS = "search"; 2922 2923 var DELAY = 300; // time before fetching new results when the user is typing a search string 2924 var LOADING_DISPLAY_DELAY = 300; // minimum time during which the loading indicator is displayed 2925 var PARAM_RESULTS_OFFSET = "resultsOffset"; 2926 2927 var keyCodes = { 2928 TAB: 9, 2929 ENTER: 13, 2930 ESCAPE: 27, 2931 ARROW_UP: 38, 2932 ARROW_DOWN: 40 2933 }; 2934 2935 var selectors = { 2936 self: "[data-" + NS + '-is="' + IS + '"]', 2937 item: { 2938 self: "[data-" + NS + "-hook-" + IS + '="item"]', 2939 title: "[data-" + NS + "-hook-" + IS + '="itemTitle"]', 2940 focused: "." + NS + "-search__item--is-focused" 2941 } 2942 }; 2943 2944 var properties = { 2945 /** 2946 * The minimum required length of the search term before results are fetched. 2947 * 2948 * @memberof Search 2949 * @type {Number} 2950 * @default 3 2951 */ 2952 minLength: { 2953 "default": 3, 2954 transform: function(value) { 2955 value = parseFloat(value); 2956 return isNaN(value) ? null : value; 2957 } 2958 }, 2959 /** 2960 * The maximal number of results fetched by a search request. 2961 * 2962 * @memberof Search 2963 * @type {Number} 2964 * @default 10 2965 */ 2966 resultsSize: { 2967 "default": 10, 2968 transform: function(value) { 2969 value = parseFloat(value); 2970 return isNaN(value) ? null : value; 2971 } 2972 } 2973 }; 2974 2975 var idCount = 0; 2976 2977 function readData(element) { 2978 var data = element.dataset; 2979 var options = []; 2980 var capitalized = IS; 2981 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 2982 var reserved = ["is", "hook" + capitalized]; 2983 2984 for (var key in data) { 2985 if (Object.prototype.hasOwnProperty.call(data, key)) { 2986 var value = data[key]; 2987 2988 if (key.indexOf(NS) === 0) { 2989 key = key.slice(NS.length); 2990 key = key.charAt(0).toLowerCase() + key.substring(1); 2991 2992 if (reserved.indexOf(key) === -1) { 2993 options[key] = value; 2994 } 2995 } 2996 } 2997 } 2998 2999 return options; 3000 } 3001 3002 function toggleShow(element, show) { 3003 if (element) { 3004 if (show !== false) { 3005 element.style.display = "block"; 3006 element.setAttribute("aria-hidden", false); 3007 } else { 3008 element.style.display = "none"; 3009 element.setAttribute("aria-hidden", true); 3010 } 3011 } 3012 } 3013 3014 function serialize(form) { 3015 var query = []; 3016 if (form && form.elements) { 3017 for (var i = 0; i < form.elements.length; i++) { 3018 var node = form.elements[i]; 3019 if (!node.disabled && node.name) { 3020 var param = [node.name, encodeURIComponent(node.value)]; 3021 query.push(param.join("=")); 3022 } 3023 } 3024 } 3025 return query.join("&"); 3026 } 3027 3028 function mark(node, regex) { 3029 if (!node || !regex) { 3030 return; 3031 } 3032 3033 // text nodes 3034 if (node.nodeType === 3) { 3035 var nodeValue = node.nodeValue; 3036 var match = regex.exec(nodeValue); 3037 3038 if (nodeValue && match) { 3039 var element = document.createElement("mark"); 3040 element.className = NS + "-search__item-mark"; 3041 element.appendChild(document.createTextNode(match[0])); 3042 3043 var after = node.splitText(match.index); 3044 after.nodeValue = after.nodeValue.substring(match[0].length); 3045 node.parentNode.insertBefore(element, after); 3046 } 3047 } else if (node.hasChildNodes()) { 3048 for (var i = 0; i < node.childNodes.length; i++) { 3049 // recurse 3050 mark(node.childNodes[i], regex); 3051 } 3052 } 3053 } 3054 3055 function localizeMessage(searchElementId, message, values = []) { 3056 const i18nMessages = JSON.parse(document.querySelector("#" + searchElementId).getAttribute("data-i18n-messages")); 3057 let translation = i18nMessages[message]; 3058 // Insert values 3059 if (values.length > 0) { 3060 translation = translation.replace(/{(\d+)}/g, function(match, index) { 3061 return typeof values[index] !== "undefined" ? values[index] : match; 3062 }); 3063 } 3064 return translation; 3065 } 3066 3067 // useful for Accessibility, helping users with low vision and users with cognitive disabilities to identify the change in results 3068 function updateSearchResultsStatusMessageElement(searchElementId, totalResults) { 3069 var searchResultsStatusMessage = document.querySelector("#" + searchElementId + "> .cmp_search__info"); 3070 searchResultsStatusMessage.style.visibility = "visible"; 3071 var searchResultsFoundMessage = localizeMessage(searchElementId, totalResults === 1 ? "{0} result" : "{0} results", [totalResults]); 3072 var searchResultsNotFoundMessage = localizeMessage(searchElementId, "No results"); 3073 searchResultsStatusMessage.innerText = totalResults > 0 ? searchResultsFoundMessage : searchResultsNotFoundMessage; 3074 } 3075 3076 function Search(config) { 3077 if (config.element) { 3078 // prevents multiple initialization 3079 config.element.removeAttribute("data-" + NS + "-is"); 3080 } 3081 3082 this._cacheElements(config.element); 3083 this._setupProperties(config.options); 3084 3085 this._action = this._elements.form.getAttribute("action"); 3086 this._resultsOffset = 0; 3087 this._hasMoreResults = true; 3088 3089 this._elements.input.addEventListener("input", this._onInput.bind(this)); 3090 this._elements.input.addEventListener("focus", this._onInput.bind(this)); 3091 this._elements.input.addEventListener("keydown", this._onKeydown.bind(this)); 3092 this._elements.clear.addEventListener("click", this._onClearClick.bind(this)); 3093 document.addEventListener("click", this._onDocumentClick.bind(this)); 3094 this._elements.results.addEventListener("scroll", this._onScroll.bind(this)); 3095 3096 this._makeAccessible(); 3097 } 3098 3099 Search.prototype._displayResults = function() { 3100 if (this._elements.input.value.length === 0) { 3101 toggleShow(this._elements.clear, false); 3102 this._cancelResults(); 3103 } else if (this._elements.input.value.length < this._properties.minLength) { 3104 toggleShow(this._elements.clear, true); 3105 } else { 3106 this._updateResults(); 3107 toggleShow(this._elements.clear, true); 3108 } 3109 }; 3110 3111 Search.prototype._onScroll = function(event) { 3112 // fetch new results when the results to be scrolled down are less than the visible results 3113 if (this._elements.results.scrollTop + 2 * this._elements.results.clientHeight >= this._elements.results.scrollHeight) { 3114 this._resultsOffset += this._properties.resultsSize; 3115 this._displayResults(); 3116 } 3117 }; 3118 3119 Search.prototype._onInput = function(event) { 3120 var self = this; 3121 self._cancelResults(); 3122 // start searching when the search term reaches the minimum length 3123 this._timeout = setTimeout(function() { 3124 self._displayResults(); 3125 }, DELAY); 3126 }; 3127 3128 Search.prototype._onKeydown = function(event) { 3129 var self = this; 3130 3131 switch (event.keyCode) { 3132 case keyCodes.TAB: 3133 if (self._resultsOpen()) { 3134 toggleShow(self._elements.results, false); 3135 self._elements.input.setAttribute("aria-expanded", "false"); 3136 this._hideSearchResultsStatusMessage(); 3137 } 3138 break;
3139 case keyCodes.ENTER: 3140 event.preventDefault(); 3141 if (self._resultsOpen()) { 3142 var focused = self._elements.results.querySelector(selectors.item.focused); 3143 if (focused) { 3144 focused.click(); 3145 } 3146 } 3147 break; 3148 case keyCodes.ESCAPE: 3149 self._cancelResults(); 3150 break; 3151 case keyCodes.ARROW_UP: 3152 if (self._resultsOpen()) { 3153 event.preventDefault(); 3154 self._stepResultFocus(true); 3155 } 3156 break; 3157 case keyCodes.ARROW_DOWN: 3158 if (self._resultsOpen()) { 3159 event.preventDefault(); 3160 self._stepResultFocus(); 3161 } else { 3162 // test the input and if necessary fetch and display the results 3163 self._onInput(); 3164 } 3165 break; 3166 default: 3167 return; 3168 } 3169 }; 3170 3171 Search.prototype._onClearClick = function(event) { 3172 event.preventDefault(); 3173 this._elements.input.value = ""; 3174 toggleShow(this._elements.clear, false); 3175 toggleShow(this._elements.results, false); 3176 this._elements.input.setAttribute("aria-expanded", "false"); 3177 this._hideSearchResultsStatusMessage(); 3178 }; 3179 3180 Search.prototype._onDocumentClick = function(event) { 3181 var inputContainsTarget = this._elements.input.contains(event.target); 3182 var resultsContainTarget = this._elements.results.contains(event.target); 3183 3184 if (!(inputContainsTarget || resultsContainTarget)) { 3185 toggleShow(this._elements.results, false); 3186 this._elements.input.setAttribute("aria-expanded", "false"); 3187 this._hideSearchResultsStatusMessage(); 3188 } 3189 }; 3190 3191 Search.prototype._resultsOpen = function() { 3192 return this._elements.results.style.display !== "none"; 3193 }; 3194 3195 Search.prototype._makeAccessible = function() { 3196 var id = NS + "-search-results-" + idCount; 3197 this._elements.input.setAttribute("aria-owns", id); 3198 this._elements.results.id = id; 3199 idCount++; 3200 }; 3201 3202 Search.prototype._generateItems = function(data, results) { 3203 var self = this; 3204 3205 data.forEach(function(item) { 3206 var el = document.createElement("span"); 3207 el.innerHTML = self._elements.itemTemplate.innerHTML; 3208 el.querySelectorAll(selectors.item.title)[0].appendChild(document.createTextNode(item.title)); 3209 el.querySelectorAll(selectors.item.self)[0].setAttribute("href", self._safeHref(item.url)); 3210 results.innerHTML += el.innerHTML; 3211 }); 3212 }; 3213 3214 Search.prototype._safeHref = function(href) { 3215 var a = document.createElement("a"); 3216 a.href = href; 3217 return a.pathname; 3218 }; 3219 3220 Search.prototype._markResults = function() { 3221 var nodeList = this._elements.results.querySelectorAll(selectors.item.self); 3222 var escapedTerm = this._elements.input.value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); 3223 var regex = new RegExp("(" + escapedTerm + ")", "gi"); 3224 3225 for (var i = this._resultsOffset - 1; i < nodeList.length; ++i) { 3226 var result = nodeList[i]; 3227 mark(result, regex); 3228 } 3229 }; 3230 3231 Search.prototype._stepResultFocus = function(reverse) { 3232 var results = this._elements.results.querySelectorAll(selectors.item.self); 3233 var focused = this._elements.results.querySelector(selectors.item.focused); 3234 var newFocused; 3235 var index = Array.prototype.indexOf.call(results, focused); 3236 var focusedCssClass = NS + "-search__item--is-focused"; 3237 3238 if (results.length > 0) { 3239 3240 if (!reverse) { 3241 // highlight the next result 3242 if (index < 0) { 3243 results[0].classList.add(focusedCssClass); 3244 results[0].setAttribute("aria-selected", "true"); 3245 } else if (index + 1 < results.length) { 3246 results[index].classList.remove(focusedCssClass); 3247 results[index].setAttribute("aria-selected", "false"); 3248 results[index + 1].classList.add(focusedCssClass); 3249 results[index + 1].setAttribute("aria-selected", "true"); 3250 } 3251 3252 // if the last visible result is partially hidden, scroll up until it's completely visible 3253 newFocused = this._elements.results.querySelector(selectors.item.focused); 3254 if (newFocused) { 3255 var bottomHiddenHeight = newFocused.offsetTop + newFocused.offsetHeight - this._elements.results.scrollTop - this._elements.results.clientHeight; 3256 if (bottomHiddenHeight > 0) { 3257 this._elements.results.scrollTop += bottomHiddenHeight; 3258 } else { 3259 this._onScroll(); 3260 } 3261 } 3262 3263 } else { 3264 // highlight the previous result 3265 if (index >= 1) { 3266 results[index].classList.remove(focusedCssClass); 3267 results[index].setAttribute("aria-selected", "false"); 3268 results[index - 1].classList.add(focusedCssClass); 3269 results[index - 1].setAttribute("aria-selected", "true"); 3270 } 3271 3272 // if the first visible result is partially hidden, scroll down until it's completely visible 3273 newFocused = this._elements.results.querySelector(selectors.item.focused); 3274 if (newFocused) { 3275 var topHiddenHeight = this._elements.results.scrollTop - newFocused.offsetTop; 3276 if (topHiddenHeight > 0) { 3277 this._elements.results.scrollTop -= topHiddenHeight; 3278 } 3279 } 3280 } 3281 } 3282 }; 3283 3284 Search.prototype._updateResults = function() { 3285 var self = this; 3286 if (self._hasMoreResults) { 3287 var request = new XMLHttpRequest(); 3288 var url = self._action + "?" + serialize(self._elements.form) + "&" + PARAM_RESULTS_OFFSET + "=" + self._resultsOffset; 3289 3290 request.open("GET", url, true); 3291 request.onload = function() { 3292 // when the results are loaded: hide the loading indicator and display the search icon after a minimum period 3293 setTimeout(function() { 3294 toggleShow(self._elements.loadingIndicator, false); 3295 toggleShow(self._elements.icon, true); 3296 }, LOADING_DISPLAY_DELAY); 3297 if (request.status >= 200 && request.status < 400) { 3298 // success status 3299 var data = JSON.parse(request.responseText); 3300 updateSearchResultsStatusMessageElement(self._elements.self.id, data.length); 3301 if (data.length > 0) { 3302 self._generateItems(data, self._elements.results); 3303 self._markResults(); 3304 toggleShow(self._elements.results, true); 3305 self._elements.input.setAttribute("aria-expanded", "true"); 3306 } else { 3307 self._hasMoreResults = false;
3308 } 3309 // the total number of results is not a multiple of the fetched results: 3310 // -> we reached the end of the query 3311 if (self._elements.results.querySelectorAll(selectors.item.self).length % self._properties.resultsSize > 0) { 3312 self._hasMoreResults = false; 3313 } 3314 } else { 3315 // error status 3316 } 3317 }; 3318 // when the results are loading: display the loading indicator and hide the search icon 3319 toggleShow(self._elements.loadingIndicator, true); 3320 toggleShow(self._elements.icon, false); 3321 request.send(); 3322 } 3323 }; 3324 3325 Search.prototype._cancelResults = function() { 3326 clearTimeout(this._timeout); 3327 this._elements.results.scrollTop = 0; 3328 this._resultsOffset = 0; 3329 this._hasMoreResults = true; 3330 this._elements.results.innerHTML = ""; 3331 this._elements.input.setAttribute("aria-expanded", "false"); 3332 this._hideSearchResultsStatusMessage(); 3333 }; 3334 3335 Search.prototype._hideSearchResultsStatusMessage = function() { 3336 var searchResultsStatusMessage = document.querySelector("#" + this._elements.self.id + "> .cmp_search__info"); 3337 searchResultsStatusMessage.style.visibility = "hidden"; 3338 }; 3339 3340 Search.prototype._cacheElements = function(wrapper) { 3341 this._elements = {}; 3342 this._elements.self = wrapper; 3343 var hooks = this._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]"); 3344 3345 for (var i = 0; i < hooks.length; i++) { 3346 var hook = hooks[i]; 3347 var capitalized = IS; 3348 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 3349 var key = hook.dataset[NS + "Hook" + capitalized]; 3350 this._elements[key] = hook; 3351 } 3352 }; 3353 3354 Search.prototype._setupProperties = function(options) { 3355 this._properties = {}; 3356 3357 for (var key in properties) { 3358 if (Object.prototype.hasOwnProperty.call(properties, key)) { 3359 var property = properties[key]; 3360 if (options && options[key] != null) { 3361 if (property && typeof property.transform === "function") { 3362 this._properties[key] = property.transform(options[key]); 3363 } else { 3364 this._properties[key] = options[key]; 3365 } 3366 } else { 3367 this._properties[key] = properties[key]["default"]; 3368 } 3369 } 3370 } 3371 }; 3372 3373 function onDocumentReady() { 3374 var elements = document.querySelectorAll(selectors.self); 3375 for (var i = 0; i < elements.length; i++) { 3376 new Search({ element: elements[i], options: readData(elements[i]) }); 3377 } 3378 3379 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 3380 var body = document.querySelector("body"); 3381 var observer = new MutationObserver(function(mutations) { 3382 mutations.forEach(function(mutation) { 3383 // needed for IE 3384 var nodesArray = [].slice.call(mutation.addedNodes); 3385 if (nodesArray.length > 0) { 3386 nodesArray.forEach(function(addedNode) { 3387 if (addedNode.querySelectorAll) { 3388 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 3389 elementsArray.forEach(function(element) { 3390 new Search({ element: element, options: readData(element) }); 3391 }); 3392 } 3393 }); 3394 } 3395 }); 3396 }); 3397 3398 observer.observe(body, { 3399 subtree: true, 3400 childList: true, 3401 characterData: true 3402 }); 3403 } 3404 3405 if (document.readyState !== "loading") { 3406 onDocumentReady(); 3407 } else { 3408 document.addEventListener("DOMContentLoaded", onDocumentReady); 3409 } 3410 3411})(); 3412 3413 3414/******************************************************************************* 3415 * Copyright 2016 Adobe 3416 * 3417 * Licensed under the Apache License, Version 2.0 (the "License");
3418 * you may not use this file except in compliance with the License. 3419 * You may obtain a copy of the License at 3420 * 3421 * http://www.apache.org/licenses/LICENSE-2.0 3422 * 3423 * Unless required by applicable law or agreed to in writing, software 3424 * distributed under the License is distributed on an "AS IS" BASIS, 3425 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3426 * See the License for the specific language governing permissions and 3427 * limitations under the License. 3428 ******************************************************************************/ 3429(function() { 3430 "use strict"; 3431 3432 var NS = "cmp"; 3433 var IS = "formText"; 3434 var IS_DASH = "form-text"; 3435 var SELF_SELECTOR = "[data-" + NS + '-is="' + IS + '"]'; 3436 3437 var selectors = { 3438 self: SELF_SELECTOR, 3439 validationMessage: SELF_SELECTOR + " .cmp-form-text__validation-message" 3440 }; 3441 3442 var displayValidationMessage = false; 3443 3444 var properties = { 3445 /** 3446 * A validation message to display if there is a type mismatch between the user input and expected input. 3447 * 3448 * @type {String} 3449 */ 3450 constraintMessage: "", 3451 /** 3452 * A validation message to display if no input is supplied, but input is expected for the field. 3453 * 3454 * @type {String} 3455 */ 3456 requiredMessage: "" 3457 }; 3458 3459 function readData(element) { 3460 var data = element.dataset; 3461 var options = []; 3462 var capitalized = IS; 3463 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 3464 var reserved = ["is", "hook" + capitalized]; 3465 3466 for (var key in data) { 3467 if (Object.prototype.hasOwnProperty.call(data, key)) { 3468 var value = data[key]; 3469 3470 if (key.indexOf(NS) === 0) { 3471 key = key.slice(NS.length); 3472 key = key.charAt(0).toLowerCase() + key.substring(1); 3473 3474 if (reserved.indexOf(key) === -1) { 3475 options[key] = value; 3476 } 3477 } 3478 } 3479 } 3480 3481 return options; 3482 } 3483 3484 function FormText(config) { 3485 if (config.element) { 3486 // prevents multiple initialization 3487 config.element.removeAttribute("data-" + NS + "-is"); 3488 } 3489 3490 this._cacheElements(config.element); 3491 this._setupProperties(config.options); 3492 3493 this._elements.input.addEventListener("invalid", this._onInvalid.bind(this)); 3494 this._elements.input.addEventListener("input", this._onInput.bind(this)); 3495 if (displayValidationMessage) { 3496 this._elements.input.checkValidity(); 3497 } 3498 } 3499 3500 FormText.prototype._onInvalid = function(event) { 3501 event.target.setCustomValidity(""); 3502 if (event.target.validity.typeMismatch) { 3503 if (this._properties.constraintMessage) { 3504 event.target.setCustomValidity(this._properties.constraintMessage); 3505 } 3506 } else if (event.target.validity.valueMissing) { 3507 if (this._properties.requiredMessage) { 3508 event.target.setCustomValidity(this._properties.requiredMessage); 3509 } 3510 } 3511 if (displayValidationMessage) { 3512 var validationMessage = event.target.parentElement.querySelector(".cmp-form-text__validation-message"); 3513 if (validationMessage) { 3514 validationMessage.innerText = event.target.validationMessage; 3515 } 3516 } 3517 }; 3518 3519 FormText.prototype._onInput = function(event) { 3520 event.target.setCustomValidity(""); 3521 if (displayValidationMessage) { 3522 event.target.checkValidity(); 3523 } 3524 }; 3525 3526 FormText.prototype._cacheElements = function(wrapper) { 3527 this._elements = {}; 3528 this._elements.self = wrapper; 3529 var hooks = this._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS_DASH + "]"); 3530 for (var i = 0; i < hooks.length; i++) { 3531 var hook = hooks[i]; 3532 var capitalized = IS; 3533 capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1); 3534 var key = hook.dataset[NS + "Hook" + capitalized]; 3535 this._elements[key] = hook; 3536 } 3537 }; 3538 3539 FormText.prototype._setupProperties = function(options) { 3540 this._properties = {}; 3541 3542 for (var key in properties) { 3543 if (Object.prototype.hasOwnProperty.call(properties, key)) { 3544 var property = properties[key]; 3545 if (options && options[key] != null) { 3546 if (property && typeof property.transform === "function") { 3547 this._properties[key] = property.transform(options[key]); 3548 } else { 3549 this._properties[key] = options[key]; 3550 } 3551 } else { 3552 this._properties[key] = properties[key]["default"]; 3553 } 3554 } 3555 } 3556 }; 3557 3558 function onDocumentReady() {
3559 var validationMessages = document.querySelectorAll(selectors.validationMessage); 3560 if (validationMessages && validationMessages.length > 0) { 3561 displayValidationMessage = true; 3562 } 3563 3564 var elements = document.querySelectorAll(selectors.self); 3565 for (var i = 0; i < elements.length; i++) { 3566 new FormText({ element: elements[i], options: readData(elements[i]) }); 3567 } 3568 3569 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 3570 var body = document.querySelector("body"); 3571 var observer = new MutationObserver(function(mutations) { 3572 mutations.forEach(function(mutation) { 3573 // needed for IE 3574 var nodesArray = [].slice.call(mutation.addedNodes); 3575 if (nodesArray.length > 0) { 3576 nodesArray.forEach(function(addedNode) { 3577 if (addedNode.querySelectorAll) { 3578 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 3579 elementsArray.forEach(function(element) { 3580 new FormText({ element: element, options: readData(element) }); 3581 }); 3582 } 3583 }); 3584 } 3585 }); 3586 }); 3587 3588 observer.observe(body, { 3589 subtree: true, 3590 childList: true, 3591 characterData: true 3592 }); 3593 } 3594 3595 if (document.readyState !== "loading") { 3596 onDocumentReady(); 3597 } else { 3598 document.addEventListener("DOMContentLoaded", onDocumentReady); 3599 } 3600 3601})(); 3602 3603 3604/******************************************************************************* 3605 * Copyright 2020 Adobe 3606 * 3607 * Licensed under the Apache License, Version 2.0 (the "License"); 3608 * you may not use this file except in compliance with the License. 3609 * You may obtain a copy of the License at 3610 * 3611 * http://www.apache.org/licenses/LICENSE-2.0 3612 * 3613 * Unless required by applicable law or agreed to in writing, software 3614 * distributed under the License is distributed on an "AS IS" BASIS, 3615 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3616 * See the License for the specific language governing permissions and 3617 * limitations under the License. 3618 ******************************************************************************/ 3619(function() { 3620 "use strict"; 3621 3622 var NS = "cmp"; 3623 var IS = "pdfviewer"; 3624 var SDK_URL = "https://acrobatservices.adobe.com/view-sdk/viewer.js"; 3625 var SDK_READY_EVENT = "adobe_dc_view_sdk.ready"; 3626 3627 var selectors = { 3628 self: "[data-" + NS + '-is="' + IS + '"]', 3629 sdkScript: 'script[src="' + SDK_URL + '"]' 3630 }; 3631 3632 function initSDK() { 3633 var sdkIncluded = document.querySelectorAll(selectors.sdkScript).length > 0; 3634 if (!window.adobe_dc_view_sdk && !sdkIncluded) { 3635 var dcv = document.createElement("script"); 3636 dcv.type = "text/javascript"; 3637 dcv.src = SDK_URL; 3638 document.body.appendChild(dcv); 3639 } 3640 } 3641 3642 function previewPdf(component) { 3643 // prevents multiple initialization 3644 component.removeAttribute("data-" + NS + "-is"); 3645 3646 // add the view sdk to the page 3647 initSDK(); 3648 3649 // manage the preview 3650 if (component.dataset && component.id) { 3651 if (window.AdobeDC && window.AdobeDC.View) { 3652 dcView(component); 3653 } else { 3654 document.addEventListener(SDK_READY_EVENT, function() { 3655 dcView(component); 3656 }); 3657 } 3658 } 3659 } 3660 3661 function dcView(component) { 3662 var adobeDCView = new window.AdobeDC.View({ 3663 clientId: component.dataset.cmpClientId, 3664 divId: component.id + "-content", 3665 reportSuiteId: component.dataset.cmpReportSuiteId, 3666 locale: typeof Granite !== "undefined" && Granite && Granite.I18n ? Granite.I18n.getLocale() : navigator.language || navigator.userLanguage 3667 }); 3668 adobeDCView.previewFile({ 3669 content: { location: { url: component.dataset.cmpDocumentPath } }, 3670 metaData: { fileName: component.dataset.cmpDocumentFileName } 3671 }, JSON.parse(component.dataset.cmpViewerConfigJson)); 3672 } 3673 3674 /** 3675 * Document ready handler and DOM mutation observers. Initializes Accordion components as necessary. 3676 * 3677 * @private 3678 */ 3679 function onDocumentReady() { 3680 var elements = document.querySelectorAll(selectors.self); 3681 for (var i = 0; i < elements.length; i++) { 3682 previewPdf(elements[i]); 3683 } 3684 3685 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 3686 var body = document.querySelector("body"); 3687 var observer = new MutationObserver(function(mutations) { 3688 mutations.forEach(function(mutation) { 3689 // needed for IE 3690 var nodesArray = [].slice.call(mutation.addedNodes); 3691 if (nodesArray.length > 0) { 3692 nodesArray.forEach(function(addedNode) { 3693 if (addedNode.querySelectorAll) { 3694 var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self)); 3695 elementsArray.forEach(function(element) { 3696 previewPdf(element); 3697 }); 3698 } 3699 }); 3700 } 3701 }); 3702 }); 3703 3704 observer.observe(body, { 3705 subtree: true, 3706 childList: true, 3707 characterData: true 3708 }); 3709 3710 } 3711 3712 if (document.readyState !== "loading") { 3713 onDocumentReady(); 3714 } else { 3715 document.addEventListener("DOMContentLoaded", onDocumentReady); 3716 } 3717}()); 3718 3719 3720 3721/******************************************************************************* 3722 * Copyright 2022 Adobe 3723 * 3724 * Licensed under the Apache License, Version 2.0 (the "License");
3725 * you may not use this file except in compliance with the License. 3726 * You may obtain a copy of the License at 3727 * 3728 * http://www.apache.org/licenses/LICENSE-2.0 3729 * 3730 * Unless required by applicable law or agreed to in writing, software 3731 * distributed under the License is distributed on an "AS IS" BASIS, 3732 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3733 * See the License for the specific language governing permissions and 3734 * limitations under the License. 3735 ******************************************************************************/ 3736(function() { 3737 "use strict"; 3738 3739 var dataLayerEnabled; 3740 var dataLayer; 3741 var dataLayerName; 3742 3743 /** 3744 * Adds Click Event Listener to the main <div> of the Text Components 3745 */ 3746 function addClickEventListenerToTextComponents() { 3747 var componentMainDivs = document.getElementsByClassName("cmp-text"); 3748 3749 for (var i = 0; i < componentMainDivs.length; i++) { 3750 componentMainDivs[i].addEventListener("click", addClickedLinkToDataLayer); 3751 } 3752 } 3753 3754 /** 3755 * Adds clicked link contained by the Text Component to Data Layer 3756 * 3757 * @private 3758 * @param {Object} event The Click event 3759 */ 3760 function addClickedLinkToDataLayer(event) { 3761 var element = event.currentTarget; 3762 var componentId = getDataLayerId(element); 3763 3764 if (event.target.tagName === "A") { 3765 dataLayer.push({ 3766 event: "cmp:click", 3767 eventInfo: { 3768 path: "component." + componentId, 3769 link: event.target.getAttribute("href") 3770 } 3771 }); 3772 } 3773 } 3774 3775 /** 3776 * Parses the dataLayer string and returns the ID 3777 * 3778 * @private 3779 * @param {HTMLElement} item, the Text item 3780 * @returns {String} dataLayerId or undefined 3781 */ 3782 function getDataLayerId(item) { 3783 if (item) { 3784 if (item.dataset.cmpDataLayer) { 3785 return Object.keys(JSON.parse(item.dataset.cmpDataLayer))[0]; 3786 } else { 3787 return item.id; 3788 } 3789 } 3790 return null; 3791 } 3792 3793 function onDocumentReady() { 3794 dataLayerEnabled = document.body.hasAttribute("data-cmp-data-layer-enabled"); 3795 if (dataLayerEnabled) { 3796 dataLayerName = document.body.getAttribute("data-cmp-data-layer-name") || "adobeDataLayer"; 3797 dataLayer = window[dataLayerName] = window[dataLayerName] || []; 3798 3799 addClickEventListenerToTextComponents(); 3800 } 3801 } 3802 3803 if (document.readyState !== "loading") { 3804 onDocumentReady(); 3805 } else { 3806 document.addEventListener("DOMContentLoaded", onDocumentReady); 3807 } 3808})(); 3809 3810 3811/** 3812 * Function to show secondary paragraph and hide read more button 3813 * 3814 */ 3815function showContent() { 3816 const readMoreElement = document.querySelectorAll('.readmore'); 3817 const readMoreParent=document.querySelectorAll('ol'); 3818 if (readMoreElement) { 3819 readMoreElement.forEach(function (ele) { 3820 ele.style.display = 'block'; 3821 3822 }) 3823 const readMorebtn = document.querySelectorAll('.read-btn'); 3824 readMorebtn.forEach(function (ele) { 3825 ele.style.display = 'none'; 3826 }); 3827 } 3828 if(readMoreParent){ 3829 console.log(readMoreParent); 3830 readMoreParent.forEach(function (ele) { 3831 ele.style.display = 'block'; 3832 3833 }) 3834 3835const readMorebtn = document.querySelectorAll('.read-btn'); 3836 readMorebtn.forEach(function (ele) { 3837 ele.style.display = 'none'; 3838 }); 3839 } 3840} 3841 3842// Script to add Read More button above the first secondary paragraph 3843document.addEventListener('DOMContentLoaded',function () { 3844 3845 const secondaryParaElements = document.querySelectorAll('p .readmore'); 3846 3847 if(secondaryParaElements.length > 0) { 3848 3849 const readMoreBtnElement = document.createElement('div'); 3850 3851 readMoreBtnElement.classList.add('read-btn'); 3852 3853 3854 3855 readMoreBtnElement.innerHTML = '<a id="readLink" class="readBtn" onclick="showContent()">READ MORE</a>'; 3856 3857 3858 3859 const firstElement = secondaryParaElements[0]; 3860 3861 firstElement.parentNode.insertBefore(readMoreBtnElement,firstElement); 3862 3863 } 3864 3865}); 3866/******************************************************************************* 3867 * Copyright 2022 Adobe 3868 * 3869 * Licensed under the Apache License, Version 2.0 (the "License");
3870 * you may not use this file except in compliance with the License. 3871 * You may obtain a copy of the License at 3872 * 3873 * http://www.apache.org/licenses/LICENSE-2.0 3874 * 3875 * Unless required by applicable law or agreed to in writing, software 3876 * distributed under the License is distributed on an "AS IS" BASIS, 3877 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3878 * See the License for the specific language governing permissions and 3879 * limitations under the License. 3880 ******************************************************************************/ 3881(function() { 3882 "use strict"; 3883 3884 var linkAccessibilityClass = "cmp-link__screen-reader-only"; 3885 var selectors = { 3886 linkAccessibility: "." + linkAccessibilityClass, 3887 linkAccessibilityEnabled: "[data-cmp-link-accessibility-enabled]", 3888 linkAccessibilityText: "[data-cmp-link-accessibility-text]" 3889 }; 3890 3891 function getLinkAccessibilityText() { 3892 var linkAccessibilityEnabled = document.querySelectorAll(selectors.linkAccessibilityEnabled); 3893 if (!linkAccessibilityEnabled[0]) { 3894 return; 3895 } 3896 var linkAccessibilityTextElements = document.querySelectorAll(selectors.linkAccessibilityText); 3897 if (!linkAccessibilityTextElements[0]) { 3898 return; 3899 } 3900 return linkAccessibilityTextElements[0].dataset.cmpLinkAccessibilityText; 3901 } 3902 3903 function onDocumentReady() { 3904 var linkAccessibilityText = getLinkAccessibilityText(); 3905 if (linkAccessibilityText) { 3906 document.querySelectorAll("a[target='_blank']").forEach(function(link) { 3907 if (!link.querySelector(selectors.linkAccessibility)) { 3908 var linkAccessibilityElement = document.createElement("span"); 3909 linkAccessibilityElement.classList.add(linkAccessibilityClass); 3910 linkAccessibilityElement.innerText = linkAccessibilityText; 3911 link.insertAdjacentElement("beforeend", linkAccessibilityElement); 3912 } 3913 }); 3914 } 3915 } 3916 3917 if (document.readyState !== "loading") { 3918 onDocumentReady(); 3919 } else { 3920 document.addEventListener("DOMContentLoaded", onDocumentReady); 3921 } 3922 3923}()); 3924 3925 3926/*! 3927 * jQuery JavaScript Library v3.7.0 3928 * https://jquery.com/ 3929 * 3930 * Copyright OpenJS Foundation and other contributors 3931 * Released under the MIT license 3932 * https://jquery.org/license 3933 * 3934 * Date: 2023-05-11T18:29Z 3935 */ 3936( function( global, factory ) { 3937 3938 "use strict"; 3939 3940 if ( typeof module === "object" && typeof module.exports === "object" ) { 3941 3942 // For CommonJS and CommonJS-like environments where a proper `window` 3943 // is present, execute the factory and get jQuery. 3944 // For environments that do not have a `window` with a `document` 3945 // (such as Node.js), expose a factory as module.exports. 3946 // This accentuates the need for the creation of a real `window`. 3947 // e.g. var jQuery = require("jquery")(window); 3948 // See ticket trac-14549 for more info. 3949 module.exports = global.document ? 3950 factory( global, true ) : 3951 function( w ) { 3952 if ( !w.document ) { 3953 throw new Error( "jQuery requires a window with a document" ); 3954 } 3955 return factory( w ); 3956 }; 3957 } else { 3958 factory( global ); 3959 } 3960 3961// Pass this if window is not defined yet 3962} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 3963 3964// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 3965// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 3966// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 3967// enough that all such attempts are guarded in a try block. 3968"use strict"; 3969 3970var arr = []; 3971 3972var getProto = Object.getPrototypeOf; 3973 3974var slice = arr.slice; 3975 3976var flat = arr.flat ? function( array ) { 3977 return arr.flat.call( array ); 3978} : function( array ) { 3979 return arr.concat.apply( [], array ); 3980}; 3981 3982 3983var push = arr.push; 3984 3985var indexOf = arr.indexOf; 3986 3987var class2type = {}; 3988 3989var toString = class2type.toString; 3990 3991var hasOwn = class2type.hasOwnProperty; 3992 3993var fnToString = hasOwn.toString; 3994 3995var ObjectFunctionString = fnToString.call( Object ); 3996 3997var support = {}; 3998 3999var isFunction = function isFunction( obj ) { 4000
vendor: 8,382 bytes, lines 4001-4341
4001 // Support: Chrome <=57, Firefox <=52 4002 // In some browsers, typeof returns "function" for HTML <object> elements 4003 // (i.e., `typeof document.createElement( "object" ) === "function"`). 4004 // We don't want to classify *any* DOM node as a function. 4005 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 4006 // Plus for old WebKit, typeof returns "function" for HTML collections 4007 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 4008 return typeof obj === "function" && typeof obj.nodeType !== "number" && 4009 typeof obj.item !== "function"; 4010 }; 4011 4012 4013var isWindow = function isWindow( obj ) { 4014 return obj != null && obj === obj.window; 4015 }; 4016 4017 4018var document = window.document; 4019 4020 4021 4022 var preservedScriptAttributes = { 4023 type: true, 4024 src: true, 4025 nonce: true, 4026 noModule: true 4027 }; 4028 4029 function DOMEval( code, node, doc ) { 4030 doc = doc || document; 4031 4032 var i, val, 4033 script = doc.createElement( "script" ); 4034 4035 script.text = code; 4036 if ( node ) { 4037 for ( i in preservedScriptAttributes ) { 4038 4039 // Support: Firefox 64+, Edge 18+ 4040 // Some browsers don't support the "nonce" property on scripts. 4041 // On the other hand, just using `getAttribute` is not enough as 4042 // the `nonce` attribute is reset to an empty string whenever it 4043 // becomes browsing-context connected. 4044 // See https://github.com/whatwg/html/issues/2369 4045 // See https://html.spec.whatwg.org/#nonce-attributes 4046 // The `node.getAttribute` check was added for the sake of 4047 // `jQuery.globalEval` so that it can fake a nonce-containing node 4048 // via an object. 4049 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 4050 if ( val ) { 4051 script.setAttribute( i, val ); 4052 } 4053 } 4054 } 4055 doc.head.appendChild( script ).parentNode.removeChild( script ); 4056 } 4057 4058 4059function toType( obj ) { 4060 if ( obj == null ) { 4061 return obj + ""; 4062 } 4063 4064 // Support: Android <=2.3 only (functionish RegExp) 4065 return typeof obj === "object" || typeof obj === "function" ? 4066 class2type[ toString.call( obj ) ] || "object" : 4067 typeof obj; 4068} 4069/* global Symbol */ 4070// Defining this global in .eslintrc.json would create a danger of using the global 4071// unguarded in another place, it seems safer to define global only for this module 4072 4073 4074 4075var version = "3.7.0", 4076 4077 rhtmlSuffix = /HTML$/i, 4078 4079 // Define a local copy of jQuery 4080 jQuery = function( selector, context ) { 4081 4082 // The jQuery object is actually just the init constructor 'enhanced' 4083 // Need init if jQuery is called (just allow error to be thrown if not included) 4084 return new jQuery.fn.init( selector, context ); 4085 }; 4086 4087jQuery.fn = jQuery.prototype = { 4088 4089 // The current version of jQuery being used 4090 jquery: version, 4091 4092 constructor: jQuery, 4093 4094 // The default length of a jQuery object is 0 4095 length: 0, 4096 4097 toArray: function() { 4098 return slice.call( this ); 4099 }, 4100 4101 // Get the Nth element in the matched element set OR 4102 // Get the whole matched element set as a clean array 4103 get: function( num ) { 4104 4105 // Return all the elements in a clean array 4106 if ( num == null ) { 4107 return slice.call( this ); 4108 } 4109 4110 // Return just the one element from the set 4111 return num < 0 ? this[ num + this.length ] : this[ num ]; 4112 }, 4113 4114 // Take an array of elements and push it onto the stack 4115 // (returning the new matched element set) 4116 pushStack: function( elems ) { 4117 4118 // Build a new jQuery matched element set 4119 var ret = jQuery.merge( this.constructor(), elems ); 4120 4121 // Add the old object onto the stack (as a reference) 4122 ret.prevObject = this; 4123 4124 // Return the newly-formed element set 4125 return ret; 4126 }, 4127 4128 // Execute a callback for every element in the matched set. 4129 each: function( callback ) { 4130 return jQuery.each( this, callback ); 4131 }, 4132 4133 map: function( callback ) { 4134 return this.pushStack( jQuery.map( this, function( elem, i ) { 4135 return callback.call( elem, i, elem ); 4136 } ) ); 4137 }, 4138 4139 slice: function() { 4140 return this.pushStack( slice.apply( this, arguments ) ); 4141 }, 4142 4143 first: function() { 4144 return this.eq( 0 ); 4145 }, 4146 4147 last: function() { 4148 return this.eq( -1 ); 4149 }, 4150 4151 even: function() { 4152 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 4153 return ( i + 1 ) % 2; 4154 } ) ); 4155 }, 4156 4157 odd: function() { 4158 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 4159 return i % 2; 4160 } ) ); 4161 }, 4162 4163 eq: function( i ) { 4164 var len = this.length, 4165 j = +i + ( i < 0 ? len : 0 ); 4166 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 4167 }, 4168 4169 end: function() { 4170 return this.prevObject || this.constructor(); 4171 }, 4172 4173 // For internal use only. 4174 // Behaves like an Array's method, not like a jQuery method. 4175 push: push, 4176 sort: arr.sort, 4177 splice: arr.splice 4178}; 4179 4180jQuery.extend = jQuery.fn.extend = function() { 4181 var options, name, src, copy, copyIsArray, clone, 4182 target = arguments[ 0 ] || {}, 4183 i = 1, 4184 length = arguments.length, 4185 deep = false; 4186 4187 // Handle a deep copy situation 4188 if ( typeof target === "boolean" ) { 4189 deep = target; 4190 4191 // Skip the boolean and the target 4192 target = arguments[ i ] || {}; 4193 i++; 4194 } 4195 4196 // Handle case when target is a string or something (possible in deep copy) 4197 if ( typeof target !== "object" && !isFunction( target ) ) { 4198 target = {}; 4199 } 4200 4201 // Extend jQuery itself if only one argument is passed 4202 if ( i === length ) { 4203 target = this; 4204 i--; 4205 } 4206 4207 for ( ; i < length; i++ ) { 4208 4209 // Only deal with non-null/undefined values 4210 if ( ( options = arguments[ i ] ) != null ) { 4211 4212 // Extend the base object 4213 for ( name in options ) { 4214 copy = options[ name ]; 4215 4216 // Prevent Object.prototype pollution 4217 // Prevent never-ending loop 4218 if ( name === "__proto__" || target === copy ) { 4219 continue; 4220 } 4221 4222 // Recurse if we're merging plain objects or arrays 4223 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 4224 ( copyIsArray = Array.isArray( copy ) ) ) ) { 4225 src = target[ name ]; 4226 4227 // Ensure proper type for the source value 4228 if ( copyIsArray && !Array.isArray( src ) ) { 4229 clone = []; 4230 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 4231 clone = {}; 4232 } else { 4233 clone = src; 4234 } 4235 copyIsArray = false; 4236 4237 // Never move original objects, clone them 4238 target[ name ] = jQuery.extend( deep, clone, copy ); 4239 4240 // Don't bring in undefined values 4241 } else if ( copy !== undefined ) { 4242 target[ name ] = copy; 4243 } 4244 } 4245 } 4246 } 4247 4248 // Return the modified object 4249 return target; 4250}; 4251 4252jQuery.extend( { 4253 4254 // Unique for each copy of jQuery on the page 4255 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 4256 4257 // Assume jQuery is ready without the ready module 4258 isReady: true, 4259 4260 error: function( msg ) { 4261 throw new Error( msg ); 4262 }, 4263 4264 noop: function() {}, 4265 4266 isPlainObject: function( obj ) { 4267 var proto, Ctor; 4268 4269 // Detect obvious negatives 4270 // Use toString instead of jQuery.type to catch host objects 4271 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 4272 return false; 4273 } 4274 4275 proto = getProto( obj ); 4276 4277 // Objects with no prototype (e.g., `Object.create( null )`) are plain 4278 if ( !proto ) { 4279 return true; 4280 } 4281 4282 // Objects with prototype are plain iff they were constructed by a global Object function 4283 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 4284 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 4285 }, 4286 4287 isEmptyObject: function( obj ) { 4288 var name; 4289 4290 for ( name in obj ) { 4291 return false; 4292 } 4293 return true; 4294 }, 4295 4296 // Evaluates a script in a provided context; falls back to the global one 4297 // if not specified. 4298 globalEval: function( code, options, doc ) { 4299 DOMEval( code, { nonce: options && options.nonce }, doc ); 4300 }, 4301 4302 each: function( obj, callback ) { 4303 var length, i = 0; 4304 4305 if ( isArrayLike( obj ) ) { 4306 length = obj.length; 4307 for ( ; i < length; i++ ) { 4308 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 4309 break; 4310 } 4311 } 4312 } else { 4313 for ( i in obj ) { 4314 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 4315 break; 4316 } 4317 } 4318 } 4319 4320 return obj; 4321 }, 4322 4323 4324 // Retrieve the text value of an array of DOM nodes 4325 text: function( elem ) { 4326 var node, 4327 ret = "", 4328 i = 0, 4329 nodeType = elem.nodeType; 4330 4331 if ( !nodeType ) { 4332 4333 // If no nodeType, this is expected to be an array 4334 while ( ( node = elem[ i++ ] ) ) { 4335 4336 // Do not traverse comment nodes 4337 ret += jQuery.text( node ); 4338 } 4339 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 4340 return elem.textContent; 4341 } else
vendor: 19,662 bytes, lines 4341-5054
4341if ( nodeType === 3 || nodeType === 4 ) { 4342 return elem.nodeValue; 4343 } 4344 4345 // Do not include comment or processing instruction nodes 4346 4347 return ret; 4348 }, 4349 4350 // results is for internal usage only 4351 makeArray: function( arr, results ) { 4352 var ret = results || []; 4353 4354 if ( arr != null ) { 4355 if ( isArrayLike( Object( arr ) ) ) { 4356 jQuery.merge( ret, 4357 typeof arr === "string" ? 4358 [ arr ] : arr 4359 ); 4360 } else { 4361 push.call( ret, arr ); 4362 } 4363 } 4364 4365 return ret; 4366 }, 4367 4368 inArray: function( elem, arr, i ) { 4369 return arr == null ? -1 : indexOf.call( arr, elem, i ); 4370 }, 4371 4372 isXMLDoc: function( elem ) { 4373 var namespace = elem && elem.namespaceURI, 4374 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 4375 4376 // Assume HTML when documentElement doesn't yet exist, such as inside 4377 // document fragments. 4378 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); 4379 }, 4380 4381 // Support: Android <=4.0 only, PhantomJS 1 only 4382 // push.apply(_, arraylike) throws on ancient WebKit 4383 merge: function( first, second ) { 4384 var len = +second.length, 4385 j = 0, 4386 i = first.length; 4387 4388 for ( ; j < len; j++ ) { 4389 first[ i++ ] = second[ j ]; 4390 } 4391 4392 first.length = i; 4393 4394 return first; 4395 }, 4396 4397 grep: function( elems, callback, invert ) { 4398 var callbackInverse, 4399 matches = [], 4400 i = 0, 4401 length = elems.length, 4402 callbackExpect = !invert; 4403 4404 // Go through the array, only saving the items 4405 // that pass the validator function 4406 for ( ; i < length; i++ ) { 4407 callbackInverse = !callback( elems[ i ], i ); 4408 if ( callbackInverse !== callbackExpect ) { 4409 matches.push( elems[ i ] ); 4410 } 4411 } 4412 4413 return matches; 4414 }, 4415 4416 // arg is for internal usage only 4417 map: function( elems, callback, arg ) { 4418 var length, value, 4419 i = 0, 4420 ret = []; 4421 4422 // Go through the array, translating each of the items to their new values 4423 if ( isArrayLike( elems ) ) { 4424 length = elems.length; 4425 for ( ; i < length; i++ ) { 4426 value = callback( elems[ i ], i, arg ); 4427 4428 if ( value != null ) { 4429 ret.push( value ); 4430 } 4431 } 4432 4433 // Go through every key on the object, 4434 } else { 4435 for ( i in elems ) { 4436 value = callback( elems[ i ], i, arg ); 4437 4438 if ( value != null ) { 4439 ret.push( value ); 4440 } 4441 } 4442 } 4443 4444 // Flatten any nested arrays 4445 return flat( ret ); 4446 }, 4447 4448 // A global GUID counter for objects 4449 guid: 1, 4450 4451 // jQuery.support is not used in Core but other projects attach their 4452 // properties to it so it needs to exist. 4453 support: support 4454} ); 4455 4456if ( typeof Symbol === "function" ) { 4457 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 4458} 4459 4460// Populate the class2type map 4461jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 4462 function( _i, name ) { 4463 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 4464 } ); 4465 4466function isArrayLike( obj ) { 4467 4468 // Support: real iOS 8.2 only (not reproducible in simulator) 4469 // `in` check used to prevent JIT error (gh-2145) 4470 // hasOwn isn't used here due to false negatives 4471 // regarding Nodelist length in IE 4472 var length = !!obj && "length" in obj && obj.length, 4473 type = toType( obj ); 4474 4475 if ( isFunction( obj ) || isWindow( obj ) ) { 4476 return false; 4477 } 4478 4479 return type === "array" || length === 0 || 4480 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 4481} 4482 4483 4484function nodeName( elem, name ) { 4485 4486 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 4487 4488} 4489var pop = arr.pop; 4490 4491 4492var sort = arr.sort; 4493 4494 4495var splice = arr.splice; 4496 4497 4498var whitespace = "[\\x20\\t\\r\\n\\f]"; 4499 4500 4501var rtrimCSS = new RegExp( 4502 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 4503 "g" 4504); 4505 4506 4507 4508 4509// Note: an element does not contain itself 4510jQuery.contains = function( a, b ) { 4511 var bup = b && b.parentNode; 4512 4513 return a === bup || !!( bup && bup.nodeType === 1 && ( 4514 4515 // Support: IE 9 - 11+ 4516 // IE doesn't have `contains` on SVG. 4517 a.contains ? 4518 a.contains( bup ) : 4519 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 4520 ) ); 4521}; 4522 4523 4524 4525 4526// CSS string/identifier serialization 4527// https://drafts.csswg.org/cssom/#common-serializing-idioms 4528var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 4529 4530function fcssescape( ch, asCodePoint ) { 4531 if ( asCodePoint ) { 4532 4533 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 4534 if ( ch === "\0" ) { 4535 return "\uFFFD"; 4536 } 4537 4538 // Control characters and (dependent upon position) numbers get escaped as code points 4539 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 4540 } 4541 4542 // Other potentially-special ASCII characters get backslash-escaped 4543 return "\\" + ch; 4544} 4545 4546jQuery.escapeSelector = function( sel ) { 4547 return ( sel + "" ).replace( rcssescape, fcssescape ); 4548}; 4549 4550 4551 4552 4553var preferredDoc = document, 4554 pushNative = push; 4555 4556( function() { 4557 4558var i, 4559 Expr, 4560 outermostContext, 4561 sortInput, 4562 hasDuplicate, 4563 push = pushNative, 4564 4565 // Local document vars 4566 document, 4567 documentElement, 4568 documentIsHTML, 4569 rbuggyQSA, 4570 matches, 4571 4572 // Instance-specific data 4573 expando = jQuery.expando, 4574 dirruns = 0, 4575 done = 0, 4576 classCache = createCache(), 4577 tokenCache = createCache(), 4578 compilerCache = createCache(), 4579 nonnativeSelectorCache = createCache(), 4580 sortOrder = function( a, b ) { 4581 if ( a === b ) { 4582 hasDuplicate = true; 4583 } 4584 return 0; 4585 }, 4586 4587 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + 4588 "loop|multiple|open|readonly|required|scoped", 4589 4590 // Regular expressions 4591 4592 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 4593 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 4594 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 4595 4596 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors 4597 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 4598 4599 // Operator (capture 2) 4600 "*([*^$|!~]?=)" + whitespace + 4601 4602 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 4603 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 4604 whitespace + "*\\]", 4605 4606 pseudos = ":(" + identifier + ")(?:\\((" + 4607 4608 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 4609 // 1. quoted (capture 3; capture 4 or capture 5) 4610 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 4611 4612 // 2. simple (capture 6) 4613 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 4614 4615 // 3. anything else (capture 2) 4616 ".*" + 4617 ")\\)|)", 4618 4619 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 4620 rwhitespace = new RegExp( whitespace + "+", "g" ), 4621 4622 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 4623 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + 4624 whitespace + "*" ), 4625 rdescend = new RegExp( whitespace + "|>" ), 4626 4627 rpseudo = new RegExp( pseudos ), 4628 ridentifier = new RegExp( "^" + identifier + "$" ), 4629 4630 matchExpr = { 4631 ID: new RegExp( "^#(" + identifier + ")" ), 4632 CLASS: new RegExp( "^\\.(" + identifier + ")" ), 4633 TAG: new RegExp( "^(" + identifier + "|[*])" ), 4634 ATTR: new RegExp( "^" + attributes ), 4635 PSEUDO: new RegExp( "^" + pseudos ), 4636 CHILD: new RegExp( 4637 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 4638 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 4639 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 4640 bool: new RegExp( "^(?:" + booleans + ")$", "i" ), 4641 4642 // For use in libraries implementing .is() 4643 // We use this for POS matching in `select` 4644 needsContext: new RegExp( "^" + whitespace + 4645 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 4646 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 4647 }, 4648 4649 rinputs = /^(?:input|select|textarea|button)$/i, 4650 rheader = /^h\d$/i, 4651 4652 // Easily-parseable/retrievable ID or TAG or CLASS selectors 4653 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 4654 4655 rsibling = /[+~]/, 4656 4657 // CSS escapes 4658 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters 4659 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + 4660 "?|\\\\([^\\r\\n\\f])", "g" ), 4661 funescape = function( escape, nonHex ) { 4662 var high = "0x" + escape.slice( 1 ) - 0x10000; 4663 4664 if ( nonHex ) { 4665 4666 // Strip the backslash prefix from a non-hex escape sequence 4667 return nonHex; 4668 } 4669 4670 // Replace a hexadecimal escape sequence with the encoded Unicode code point 4671 // Support: IE <=11+ 4672 // For values outside the Basic Multilingual Plane (BMP), manually construct a 4673 // surrogate pair 4674 return high < 0 ? 4675 String.fromCharCode( high + 0x10000 ) : 4676 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 4677 }, 4678 4679 // Used for iframes; see `setDocument`. 4680 // Support: IE 9 - 11+, Edge 12 - 18+ 4681 // Removing the function wrapper causes a "Permission Denied" 4682 // error in IE/Edge. 4683 unloadHandler = function() { 4684 setDocument(); 4685 }, 4686 4687 inDisabledFieldset = addCombinator( 4688 function( elem ) { 4689 return elem.disabled === true && nodeName( elem, "fieldset" ); 4690 }, 4691 { dir: "parentNode", next: "legend" } 4692 ); 4693 4694// Support: IE <=9 only 4695// Accessing document.activeElement can throw unexpectedly 4696// https://bugs.jquery.com/ticket/13393 4697function safeActiveElement() { 4698 try { 4699 return document.activeElement; 4700 } catch ( err ) { } 4701} 4702 4703// Optimize for push.apply( _, NodeList ) 4704try { 4705 push.apply( 4706 ( arr = slice.call( preferredDoc.childNodes ) ), 4707 preferredDoc.childNodes 4708 ); 4709 4710 // Support: Android <=4.0 4711 // Detect silently failing push.apply 4712 // eslint-disable-next-line no-unused-expressions 4713 arr[ preferredDoc.childNodes.length ].nodeType; 4714} catch ( e ) { 4715 push = { 4716 apply: function( target, els ) { 4717 pushNative.apply( target, slice.call( els ) ); 4718 }, 4719 call: function( target ) { 4720 pushNative.apply( target, slice.call( arguments, 1 ) ); 4721 } 4722 }; 4723} 4724 4725function find( selector, context, results, seed ) { 4726 var m, i, elem, nid, match, groups, newSelector, 4727 newContext = context && context.ownerDocument, 4728 4729 // nodeType defaults to 9, since context defaults to document 4730 nodeType = context ? context.nodeType : 9; 4731 4732 results = results || []; 4733 4734 // Return early from calls with invalid selector or context 4735 if ( typeof selector !== "string" || !selector || 4736 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 4737 4738 return results; 4739 } 4740 4741 // Try to shortcut find operations (as opposed to filters) in HTML documents 4742 if ( !seed ) { 4743 setDocument( context ); 4744 context = context || document; 4745 4746 if ( documentIsHTML ) { 4747 4748 // If the selector is sufficiently simple, try using a "get*By*" DOM method 4749 // (excepting DocumentFragment context, where the methods don't exist) 4750 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 4751 4752 // ID selector 4753 if ( ( m = match[ 1 ] ) ) { 4754 4755 // Document context 4756 if ( nodeType === 9 ) { 4757 if ( ( elem = context.getElementById( m ) ) ) { 4758 4759 // Support: IE 9 only 4760 // getElementById can match elements by name instead of ID 4761 if ( elem.id === m ) { 4762 push.call( results, elem ); 4763 return results; 4764 } 4765 } else { 4766 return results; 4767 } 4768 4769 // Element context 4770 } else { 4771 4772 // Support: IE 9 only 4773 // getElementById can match elements by name instead of ID 4774 if ( newContext && ( elem = newContext.getElementById( m ) ) && 4775 find.contains( context, elem ) && 4776 elem.id === m ) { 4777 4778 push.call( results, elem ); 4779 return results; 4780 } 4781 } 4782 4783 // Type selector 4784 } else if ( match[ 2 ] ) { 4785 push.apply( results, context.getElementsByTagName( selector ) ); 4786 return results; 4787 4788 // Class selector 4789 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { 4790 push.apply( results, context.getElementsByClassName( m ) ); 4791 return results; 4792 } 4793 } 4794 4795 // Take advantage of querySelectorAll 4796 if ( !nonnativeSelectorCache[ selector + " " ] && 4797 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { 4798 4799 newSelector = selector; 4800 newContext = context; 4801 4802 // qSA considers elements outside a scoping root when evaluating child or 4803 // descendant combinators, which is not what we want. 4804 // In such cases, we work around the behavior by prefixing every selector in the 4805 // list with an ID selector referencing the scope context. 4806 // The technique has to be used as well when a leading combinator is used 4807 // as such selectors are not recognized by querySelectorAll. 4808 // Thanks to Andrew Dupont for this technique. 4809 if ( nodeType === 1 && 4810 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { 4811 4812 // Expand context for sibling selectors 4813 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 4814 context; 4815 4816 // We can use :scope instead of the ID hack if the browser 4817 // supports it & if we're not changing the context. 4818 // Support: IE 11+, Edge 17 - 18+ 4819 // IE/Edge sometimes throw a "Permission denied" error when 4820 // strict-comparing two documents; shallow comparisons work. 4821 // eslint-disable-next-line eqeqeq 4822 if ( newContext != context || !support.scope ) { 4823 4824 // Capture the context ID, setting it first if necessary 4825 if ( ( nid = context.getAttribute( "id" ) ) ) { 4826 nid = jQuery.escapeSelector( nid ); 4827 } else { 4828 context.setAttribute( "id", ( nid = expando ) ); 4829 } 4830 } 4831 4832 // Prefix every selector in the list 4833 groups = tokenize( selector ); 4834 i = groups.length; 4835 while ( i-- ) { 4836 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 4837 toSelector( groups[ i ] ); 4838 } 4839 newSelector = groups.join( "," ); 4840 } 4841 4842 try { 4843 push.apply( results, 4844 newContext.querySelectorAll( newSelector ) 4845 ); 4846 return results; 4847 } catch ( qsaError ) { 4848 nonnativeSelectorCache( selector, true ); 4849 } finally { 4850 if ( nid === expando ) { 4851 context.removeAttribute( "id" ); 4852 } 4853 } 4854 } 4855 } 4856 } 4857 4858 // All others 4859 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); 4860} 4861 4862/** 4863 * Create key-value caches of limited size 4864 * @returns {function(string, object)} Returns the Object data after storing it on itself with 4865 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 4866 * deleting the oldest entry 4867 */ 4868function createCache() { 4869 var keys = []; 4870 4871 function cache( key, value ) { 4872 4873 // Use (key + " ") to avoid collision with native prototype properties 4874 // (see https://github.com/jquery/sizzle/issues/157) 4875 if ( keys.push( key + " " ) > Expr.cacheLength ) { 4876 4877 // Only keep the most recent entries 4878 delete cache[ keys.shift() ]; 4879 } 4880 return ( cache[ key + " " ] = value ); 4881 } 4882 return cache; 4883} 4884 4885/** 4886 * Mark a function for special use by jQuery selector module 4887 * @param {Function} fn The function to mark 4888 */ 4889function markFunction( fn ) { 4890 fn[ expando ] = true; 4891 return fn; 4892} 4893 4894/** 4895 * Support testing using an element 4896 * @param {Function} fn Passed the created element and returns a boolean result 4897 */ 4898function assert( fn ) { 4899 var el = document.createElement( "fieldset" ); 4900 4901 try { 4902 return !!fn( el ); 4903 } catch ( e ) { 4904 return false; 4905 } finally { 4906 4907 // Remove from its parent by default 4908 if ( el.parentNode ) { 4909 el.parentNode.removeChild( el ); 4910 } 4911 4912 // release memory in IE 4913 el = null; 4914 } 4915} 4916 4917/** 4918 * Returns a function to use in pseudos for input types 4919 * @param {String} type 4920 */ 4921function createInputPseudo( type ) { 4922 return function( elem ) { 4923 return nodeName( elem, "input" ) && elem.type === type; 4924 }; 4925} 4926 4927/** 4928 * Returns a function to use in pseudos for buttons 4929 * @param {String} type 4930 */ 4931function createButtonPseudo( type ) { 4932 return function( elem ) { 4933 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && 4934 elem.type === type; 4935 }; 4936} 4937 4938/** 4939 * Returns a function to use in pseudos for :enabled/:disabled 4940 * @param {Boolean} disabled true for :disabled; false for :enabled 4941 */ 4942function createDisabledPseudo( disabled ) { 4943 4944 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 4945 return function( elem ) { 4946 4947 // Only certain elements can match :enabled or :disabled 4948 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 4949 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 4950 if ( "form" in elem ) { 4951 4952 // Check for inherited disabledness on relevant non-disabled elements: 4953 // * listed form-associated elements in a disabled fieldset 4954 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 4955 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 4956 // * option elements in a disabled optgroup 4957 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 4958 // All such elements have a "form" property. 4959 if ( elem.parentNode && elem.disabled === false ) { 4960 4961 // Option elements defer to a parent optgroup if present 4962 if ( "label" in elem ) { 4963 if ( "label" in elem.parentNode ) { 4964 return elem.parentNode.disabled === disabled; 4965 } else { 4966 return elem.disabled === disabled; 4967 } 4968 } 4969 4970 // Support: IE 6 - 11+ 4971 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 4972 return elem.isDisabled === disabled || 4973 4974 // Where there is no isDisabled, check manually 4975 elem.isDisabled !== !disabled && 4976 inDisabledFieldset( elem ) === disabled; 4977 } 4978 4979 return elem.disabled === disabled; 4980 4981 // Try to winnow out elements that can't be disabled before trusting the disabled property. 4982 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 4983 // even exist on them, let alone have a boolean value. 4984 } else if ( "label" in elem ) { 4985 return elem.disabled === disabled; 4986 } 4987 4988 // Remaining elements are neither :enabled nor :disabled 4989 return false; 4990 }; 4991} 4992 4993/** 4994 * Returns a function to use in pseudos for positionals 4995 * @param {Function} fn 4996 */ 4997function createPositionalPseudo( fn ) { 4998 return markFunction( function( argument ) { 4999 argument = +argument; 5000 return markFunction( function( seed, matches ) { 5001 var j, 5002 matchIndexes = fn( [], seed.length, argument ), 5003 i = matchIndexes.length; 5004 5005 // Match elements found at the specified indexes 5006 while ( i-- ) { 5007 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 5008 seed[ j ] = !( matches[ j ] = seed[ j ] ); 5009 } 5010 } 5011 } ); 5012 } ); 5013} 5014 5015/** 5016 * Checks a node for validity as a jQuery selector context 5017 * @param {Element|Object=} context 5018 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 5019 */ 5020function testContext( context ) { 5021 return context && typeof context.getElementsByTagName !== "undefined" && context; 5022} 5023 5024/** 5025 * Sets document-related variables once based on the current document 5026 * @param {Element|Object} [node] An element or document object to use to set the document 5027 * @returns {Object} Returns the current document 5028 */ 5029function setDocument( node ) { 5030 var subWindow, 5031 doc = node ? node.ownerDocument || node : preferredDoc; 5032 5033 // Return early if doc is invalid or already selected 5034 // Support: IE 11+, Edge 17 - 18+ 5035 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5036 // two documents; shallow comparisons work. 5037 // eslint-disable-next-line eqeqeq 5038 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 5039 return document; 5040 } 5041 5042 // Update global variables 5043 document = doc; 5044 documentElement = document.documentElement; 5045 documentIsHTML = !jQuery.isXMLDoc( document ); 5046 5047 // Support: iOS 7 only, IE 9 - 11+ 5048 // Older browsers didn't support unprefixed `matches`. 5049 matches = documentElement.matches || 5050 documentElement.webkitMatchesSelector || 5051 documentElement.msMatchesSelector; 5052 5053 // Support: IE 9 - 11+, Edge 12 - 18+ 5054 // Accessing iframe documents after unload throws "permission denied" errors
5054 (see trac-13936) 5055 // Support: IE 11+, Edge 17 - 18+ 5056 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5057 // two documents; shallow comparisons work. 5058 // eslint-disable-next-line eqeqeq 5059 if (
vendor: 44,049 bytes, lines 5059-6622
5059preferredDoc != document && 5060 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 5061 5062 // Support: IE 9 - 11+, Edge 12 - 18+ 5063 subWindow.addEventListener( "unload", unloadHandler ); 5064 } 5065 5066 // Support: IE <10 5067 // Check if getElementById returns elements by name 5068 // The broken getElementById methods don't pick up programmatically-set names, 5069 // so use a roundabout getElementsByName test 5070 support.getById = assert( function( el ) { 5071 documentElement.appendChild( el ).id = jQuery.expando; 5072 return !document.getElementsByName || 5073 !document.getElementsByName( jQuery.expando ).length; 5074 } ); 5075 5076 // Support: IE 9 only 5077 // Check to see if it's possible to do matchesSelector 5078 // on a disconnected node. 5079 support.disconnectedMatch = assert( function( el ) { 5080 return matches.call( el, "*" ); 5081 } ); 5082 5083 // Support: IE 9 - 11+, Edge 12 - 18+ 5084 // IE/Edge don't support the :scope pseudo-class. 5085 support.scope = assert( function() { 5086 return document.querySelectorAll( ":scope" ); 5087 } ); 5088 5089 // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only 5090 // Make sure the `:has()` argument is parsed unforgivingly. 5091 // We include `*` in the test to detect buggy implementations that are 5092 // _selectively_ forgiving (specifically when the list includes at least 5093 // one valid selector). 5094 // Note that we treat complete lack of support for `:has()` as if it were 5095 // spec-compliant support, which is fine because use of `:has()` in such 5096 // environments will fail in the qSA path and fall back to jQuery traversal 5097 // anyway. 5098 support.cssHas = assert( function() { 5099 try { 5100 document.querySelector( ":has(*,:jqfake)" ); 5101 return false; 5102 } catch ( e ) { 5103 return true; 5104 } 5105 } ); 5106 5107 // ID filter and find 5108 if ( support.getById ) { 5109 Expr.filter.ID = function( id ) { 5110 var attrId = id.replace( runescape, funescape ); 5111 return function( elem ) { 5112 return elem.getAttribute( "id" ) === attrId; 5113 }; 5114 }; 5115 Expr.find.ID = function( id, context ) { 5116 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 5117 var elem = context.getElementById( id ); 5118 return elem ? [ elem ] : []; 5119 } 5120 }; 5121 } else { 5122 Expr.filter.ID = function( id ) { 5123 var attrId = id.replace( runescape, funescape ); 5124 return function( elem ) { 5125 var node = typeof elem.getAttributeNode !== "undefined" && 5126 elem.getAttributeNode( "id" ); 5127 return node && node.value === attrId; 5128 }; 5129 }; 5130 5131 // Support: IE 6 - 7 only 5132 // getElementById is not reliable as a find shortcut 5133 Expr.find.ID = function( id, context ) { 5134 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 5135 var node, i, elems, 5136 elem = context.getElementById( id ); 5137 5138 if ( elem ) { 5139 5140 // Verify the id attribute 5141 node = elem.getAttributeNode( "id" ); 5142 if ( node && node.value === id ) { 5143 return [ elem ]; 5144 } 5145 5146 // Fall back on getElementsByName 5147 elems = context.getElementsByName( id ); 5148 i = 0; 5149 while ( ( elem = elems[ i++ ] ) ) { 5150 node = elem.getAttributeNode( "id" ); 5151 if ( node && node.value === id ) { 5152 return [ elem ]; 5153 } 5154 } 5155 } 5156 5157 return []; 5158 } 5159 }; 5160 } 5161 5162 // Tag 5163 Expr.find.TAG = function( tag, context ) { 5164 if ( typeof context.getElementsByTagName !== "undefined" ) { 5165 return context.getElementsByTagName( tag ); 5166 5167 // DocumentFragment nodes don't have gEBTN 5168 } else { 5169 return context.querySelectorAll( tag ); 5170 } 5171 }; 5172 5173 // Class 5174 Expr.find.CLASS = function( className, context ) { 5175 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 5176 return context.getElementsByClassName( className ); 5177 } 5178 }; 5179 5180 /* QSA/matchesSelector 5181 ---------------------------------------------------------------------- */ 5182 5183 // QSA and matchesSelector support 5184 5185 rbuggyQSA = []; 5186 5187 // Build QSA regex 5188 // Regex strategy adopted from Diego Perini 5189 assert( function( el ) { 5190 5191 var input; 5192 5193 documentElement.appendChild( el ).innerHTML = 5194 "<a id='" + expando + "' href='' disabled='disabled'></a>" + 5195 "<select id='" + expando + "-\r\\' disabled='disabled'>" + 5196 "<option selected=''></option></select>"; 5197 5198 // Support: iOS <=7 - 8 only 5199 // Boolean attributes and "value" are not treated correctly in some XML documents 5200 if ( !el.querySelectorAll( "[selected]" ).length ) { 5201 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 5202 } 5203 5204 // Support: iOS <=7 - 8 only 5205 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 5206 rbuggyQSA.push( "~=" ); 5207 } 5208 5209 // Support: iOS 8 only 5210 // https://bugs.webkit.org/show_bug.cgi?id=136851 5211 // In-page `selector#id sibling-combinator selector` fails 5212 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 5213 rbuggyQSA.push( ".#.+[+~]" ); 5214 } 5215 5216 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 5217 // In some of the document kinds, these selectors wouldn't work natively. 5218 // This is probably OK but for backwards compatibility we want to maintain 5219 // handling them through jQuery traversal in jQuery 3.x. 5220 if ( !el.querySelectorAll( ":checked" ).length ) { 5221 rbuggyQSA.push( ":checked" ); 5222 } 5223 5224 // Support: Windows 8 Native Apps 5225 // The type and name attributes are restricted during .innerHTML assignment 5226 input = document.createElement( "input" ); 5227 input.setAttribute( "type", "hidden" ); 5228 el.appendChild( input ).setAttribute( "name", "D" ); 5229 5230 // Support: IE 9 - 11+ 5231 // IE's :disabled selector does not pick up the children of disabled fieldsets 5232 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 5233 // In some of the document kinds, these selectors wouldn't work natively. 5234 // This is probably OK but for backwards compatibility we want to maintain 5235 // handling them through jQuery traversal in jQuery 3.x. 5236 documentElement.appendChild( el ).disabled = true; 5237 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 5238 rbuggyQSA.push( ":enabled", ":disabled" ); 5239 } 5240 5241 // Support: IE 11+, Edge 15 - 18+ 5242 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 5243 // Adding a temporary attribute to the document before the selection works 5244 // around the issue. 5245 // Interestingly, IE 10 & older don't seem to have the issue. 5246 input = document.createElement( "input" ); 5247 input.setAttribute( "name", "" ); 5248 el.appendChild( input ); 5249 if ( !el.querySelectorAll( "[name='']" ).length ) { 5250 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 5251 whitespace + "*(?:''|\"\")" ); 5252 } 5253 } ); 5254 5255 if ( !support.cssHas ) { 5256 5257 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 5258 // Our regular `try-catch` mechanism fails to detect natively-unsupported 5259 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) 5260 // in browsers that parse the `:has()` argument as a forgiving selector list. 5261 // https://drafts.csswg.org/selectors/#relational now requires the argument 5262 // to be parsed unforgivingly, but browsers have not yet fully adjusted. 5263 rbuggyQSA.push( ":has" ); 5264 } 5265 5266 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 5267 5268 /* Sorting 5269 ---------------------------------------------------------------------- */ 5270 5271 // Document order sorting 5272 sortOrder = function( a, b ) { 5273 5274 // Flag for duplicate removal 5275 if ( a === b ) { 5276 hasDuplicate = true; 5277 return 0; 5278 } 5279 5280 // Sort on method existence if only one input has compareDocumentPosition 5281 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 5282 if ( compare ) { 5283 return compare; 5284 } 5285 5286 // Calculate position if both inputs belong to the same document 5287 // Support: IE 11+, Edge 17 - 18+ 5288 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5289 // two documents; shallow comparisons work. 5290 // eslint-disable-next-line eqeqeq 5291 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 5292 a.compareDocumentPosition( b ) : 5293 5294 // Otherwise we know they are disconnected 5295 1; 5296 5297 // Disconnected nodes 5298 if ( compare & 1 || 5299 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 5300 5301 // Choose the first element that is related to our preferred document 5302 // Support: IE 11+, Edge 17 - 18+ 5303 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5304 // two documents; shallow comparisons work. 5305 // eslint-disable-next-line eqeqeq 5306 if ( a === document || a.ownerDocument == preferredDoc && 5307 find.contains( preferredDoc, a ) ) { 5308 return -1; 5309 } 5310 5311 // Support: IE 11+, Edge 17 - 18+ 5312 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5313 // two documents; shallow comparisons work. 5314 // eslint-disable-next-line eqeqeq 5315 if ( b === document || b.ownerDocument == preferredDoc && 5316 find.contains( preferredDoc, b ) ) { 5317 return 1; 5318 } 5319 5320 // Maintain original order 5321 return sortInput ? 5322 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 5323 0; 5324 } 5325 5326 return compare & 4 ? -1 : 1; 5327 }; 5328 5329 return document; 5330} 5331 5332find.matches = function( expr, elements ) { 5333 return find( expr, null, null, elements ); 5334}; 5335 5336find.matchesSelector = function( elem, expr ) { 5337 setDocument( elem ); 5338 5339 if ( documentIsHTML && 5340 !nonnativeSelectorCache[ expr + " " ] && 5341 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 5342 5343 try { 5344 var ret = matches.call( elem, expr ); 5345 5346 // IE 9's matchesSelector returns false on disconnected nodes 5347 if ( ret || support.disconnectedMatch || 5348 5349 // As well, disconnected nodes are said to be in a document 5350 // fragment in IE 9 5351 elem.document && elem.document.nodeType !== 11 ) { 5352 return ret; 5353 } 5354 } catch ( e ) { 5355 nonnativeSelectorCache( expr, true ); 5356 } 5357 } 5358 5359 return find( expr, document, null, [ elem ] ).length > 0; 5360}; 5361 5362find.contains = function( context, elem ) { 5363 5364 // Set document vars if needed 5365 // Support: IE 11+, Edge 17 - 18+ 5366 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5367 // two documents; shallow comparisons work. 5368 // eslint-disable-next-line eqeqeq 5369 if ( ( context.ownerDocument || context ) != document ) { 5370 setDocument( context ); 5371 } 5372 return jQuery.contains( context, elem ); 5373}; 5374 5375 5376find.attr = function( elem, name ) { 5377 5378 // Set document vars if needed 5379 // Support: IE 11+, Edge 17 - 18+ 5380 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5381 // two documents; shallow comparisons work. 5382 // eslint-disable-next-line eqeqeq 5383 if ( ( elem.ownerDocument || elem ) != document ) { 5384 setDocument( elem ); 5385 } 5386 5387 var fn = Expr.attrHandle[ name.toLowerCase() ], 5388 5389 // Don't get fooled by Object.prototype properties (see trac-13807) 5390 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 5391 fn( elem, name, !documentIsHTML ) : 5392 undefined; 5393 5394 if ( val !== undefined ) { 5395 return val; 5396 } 5397 5398 return elem.getAttribute( name ); 5399}; 5400 5401find.error = function( msg ) { 5402 throw new Error( "Syntax error, unrecognized expression: " + msg ); 5403}; 5404 5405/** 5406 * Document sorting and removing duplicates 5407 * @param {ArrayLike} results 5408 */ 5409jQuery.uniqueSort = function( results ) { 5410 var elem, 5411 duplicates = [], 5412 j = 0, 5413 i = 0; 5414 5415 // Unless we *know* we can detect duplicates, assume their presence 5416 // 5417 // Support: Android <=4.0+ 5418 // Testing for detecting duplicates is unpredictable so instead assume we can't 5419 // depend on duplicate detection in all browsers without a stable sort. 5420 hasDuplicate = !support.sortStable; 5421 sortInput = !support.sortStable && slice.call( results, 0 ); 5422 sort.call( results, sortOrder ); 5423 5424 if ( hasDuplicate ) { 5425 while ( ( elem = results[ i++ ] ) ) { 5426 if ( elem === results[ i ] ) { 5427 j = duplicates.push( i ); 5428 } 5429 } 5430 while ( j-- ) { 5431 splice.call( results, duplicates[ j ], 1 ); 5432 } 5433 } 5434 5435 // Clear input after sorting to release objects 5436 // See https://github.com/jquery/sizzle/pull/225 5437 sortInput = null; 5438 5439 return results; 5440}; 5441 5442jQuery.fn.uniqueSort = function() { 5443 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); 5444}; 5445 5446Expr = jQuery.expr = { 5447 5448 // Can be adjusted by the user 5449 cacheLength: 50, 5450 5451 createPseudo: markFunction, 5452 5453 match: matchExpr, 5454 5455 attrHandle: {}, 5456 5457 find: {}, 5458 5459 relative: { 5460 ">": { dir: "parentNode", first: true }, 5461 " ": { dir: "parentNode" }, 5462 "+": { dir: "previousSibling", first: true }, 5463 "~": { dir: "previousSibling" } 5464 }, 5465 5466 preFilter: { 5467 ATTR: function( match ) { 5468 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 5469 5470 // Move the given value to match[3] whether quoted or unquoted 5471 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) 5472 .replace( runescape, funescape ); 5473 5474 if ( match[ 2 ] === "~=" ) { 5475 match[ 3 ] = " " + match[ 3 ] + " "; 5476 } 5477 5478 return match.slice( 0, 4 ); 5479 }, 5480 5481 CHILD: function( match ) { 5482 5483 /* matches from matchExpr["CHILD"] 5484 1 type (only|nth|...) 5485 2 what (child|of-type) 5486 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 5487 4 xn-component of xn+y argument ([+-]?\d*n|) 5488 5 sign of xn-component 5489 6 x of xn-component 5490 7 sign of y-component 5491 8 y of y-component 5492 */ 5493 match[ 1 ] = match[ 1 ].toLowerCase(); 5494 5495 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 5496 5497 // nth-* requires argument 5498 if ( !match[ 3 ] ) { 5499 find.error( match[ 0 ] ); 5500 } 5501 5502 // numeric x and y parameters for Expr.filter.CHILD 5503 // remember that false/true cast respectively to 0/1 5504 match[ 4 ] = +( match[ 4 ] ? 5505 match[ 5 ] + ( match[ 6 ] || 1 ) : 5506 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) 5507 ); 5508 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 5509 5510 // other types prohibit arguments 5511 } else if ( match[ 3 ] ) { 5512 find.error( match[ 0 ] ); 5513 } 5514 5515 return match; 5516 }, 5517 5518 PSEUDO: function( match ) { 5519 var excess, 5520 unquoted = !match[ 6 ] && match[ 2 ]; 5521 5522 if ( matchExpr.CHILD.test( match[ 0 ] ) ) { 5523 return null; 5524 } 5525 5526 // Accept quoted arguments as-is 5527 if ( match[ 3 ] ) { 5528 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 5529 5530 // Strip excess characters from unquoted arguments 5531 } else if ( unquoted && rpseudo.test( unquoted ) && 5532 5533 // Get excess from tokenize (recursively) 5534 ( excess = tokenize( unquoted, true ) ) && 5535 5536 // advance to the next closing parenthesis 5537 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 5538 5539 // excess is a negative index 5540 match[ 0 ] = match[ 0 ].slice( 0, excess ); 5541 match[ 2 ] = unquoted.slice( 0, excess ); 5542 } 5543 5544 // Return only captures needed by the pseudo filter method (type and argument) 5545 return match.slice( 0, 3 ); 5546 } 5547 }, 5548 5549 filter: { 5550 5551 TAG: function( nodeNameSelector ) { 5552 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 5553 return nodeNameSelector === "*" ? 5554 function() { 5555 return true; 5556 } : 5557 function( elem ) { 5558 return nodeName( elem, expectedNodeName ); 5559 }; 5560 }, 5561 5562 CLASS: function( className ) { 5563 var pattern = classCache[ className + " " ]; 5564 5565 return pattern || 5566 ( pattern = new RegExp( "(^|" + whitespace + ")" + className + 5567 "(" + whitespace + "|$)" ) ) && 5568 classCache( className, function( elem ) { 5569 return pattern.test( 5570 typeof elem.className === "string" && elem.className || 5571 typeof elem.getAttribute !== "undefined" && 5572 elem.getAttribute( "class" ) || 5573 "" 5574 ); 5575 } ); 5576 }, 5577 5578 ATTR: function( name, operator, check ) { 5579 return function( elem ) { 5580 var result = find.attr( elem, name ); 5581 5582 if ( result == null ) { 5583 return operator === "!="; 5584 } 5585 if ( !operator ) { 5586 return true; 5587 } 5588 5589 result += ""; 5590 5591 if ( operator === "=" ) { 5592 return result === check; 5593 } 5594 if ( operator === "!=" ) { 5595 return result !== check; 5596 } 5597 if ( operator === "^=" ) { 5598 return check && result.indexOf( check ) === 0; 5599 } 5600 if ( operator === "*=" ) { 5601 return check && result.indexOf( check ) > -1; 5602 } 5603 if ( operator === "$=" ) { 5604 return check && result.slice( -check.length ) === check; 5605 } 5606 if ( operator === "~=" ) { 5607 return ( " " + result.replace( rwhitespace, " " ) + " " ) 5608 .indexOf( check ) > -1; 5609 } 5610 if ( operator === "|=" ) { 5611 return result === check || result.slice( 0, check.length + 1 ) === check + "-"; 5612 } 5613 5614 return false; 5615 }; 5616 }, 5617 5618 CHILD: function( type, what, _argument, first, last ) { 5619 var simple = type.slice( 0, 3 ) !== "nth", 5620 forward = type.slice( -4 ) !== "last", 5621 ofType = what === "of-type"; 5622 5623 return first === 1 && last === 0 ? 5624 5625 // Shortcut for :nth-*(n) 5626 function( elem ) { 5627 return !!elem.parentNode; 5628 } : 5629 5630 function( elem, _context, xml ) { 5631 var cache, outerCache, node, nodeIndex, start, 5632 dir = simple !== forward ? "nextSibling" : "previousSibling", 5633 parent = elem.parentNode, 5634 name = ofType && elem.nodeName.toLowerCase(), 5635 useCache = !xml && !ofType, 5636 diff = false; 5637 5638 if ( parent ) { 5639 5640 // :(first|last|only)-(child|of-type) 5641 if ( simple ) { 5642 while ( dir ) { 5643 node = elem; 5644 while ( ( node = node[ dir ] ) ) { 5645 if ( ofType ? 5646 nodeName( node, name ) : 5647 node.nodeType === 1 ) { 5648 5649 return false; 5650 } 5651 } 5652 5653 // Reverse direction for :only-* (if we haven't yet done so) 5654 start = dir = type === "only" && !start && "nextSibling"; 5655 } 5656 return true; 5657 } 5658 5659 start = [ forward ? parent.firstChild : parent.lastChild ]; 5660 5661 // non-xml :nth-child(...) stores cache data on `parent` 5662 if ( forward && useCache ) { 5663 5664 // Seek `elem` from a previously-cached index 5665 outerCache = parent[ expando ] || ( parent[ expando ] = {} ); 5666 cache = outerCache[ type ] || []; 5667 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 5668 diff = nodeIndex && cache[ 2 ]; 5669 node = nodeIndex && parent.childNodes[ nodeIndex ]; 5670 5671 while ( ( node = ++nodeIndex && node && node[ dir ] || 5672 5673 // Fallback to seeking `elem` from the start 5674 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 5675 5676 // When found, cache indexes on `parent` and break 5677 if ( node.nodeType === 1 && ++diff && node === elem ) { 5678 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; 5679 break; 5680 } 5681 } 5682 5683 } else { 5684 5685 // Use previously-cached element index if available 5686 if ( useCache ) { 5687 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 5688 cache = outerCache[ type ] || []; 5689 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 5690 diff = nodeIndex; 5691 } 5692 5693 // xml :nth-child(...) 5694 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 5695 if ( diff === false ) { 5696 5697 // Use the same loop as above to seek `elem` from the start 5698 while ( ( node = ++nodeIndex && node && node[ dir ] || 5699 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 5700 5701 if ( ( ofType ? 5702 nodeName( node, name ) : 5703 node.nodeType === 1 ) && 5704 ++diff ) { 5705 5706 // Cache the index of each encountered element 5707 if ( useCache ) { 5708 outerCache = node[ expando ] || 5709 ( node[ expando ] = {} ); 5710 outerCache[ type ] = [ dirruns, diff ]; 5711 } 5712 5713 if ( node === elem ) { 5714 break; 5715 } 5716 } 5717 } 5718 } 5719 } 5720 5721 // Incorporate the offset, then check against cycle size 5722 diff -= last; 5723 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 5724 } 5725 }; 5726 }, 5727 5728 PSEUDO: function( pseudo, argument ) { 5729 5730 // pseudo-class names are case-insensitive 5731 // https://www.w3.org/TR/selectors/#pseudo-classes 5732 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 5733 // Remember that setFilters inherits from pseudos 5734 var args, 5735 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 5736 find.error( "unsupported pseudo: " + pseudo ); 5737 5738 // The user may use createPseudo to indicate that 5739 // arguments are needed to create the filter function 5740 // just as jQuery does 5741 if ( fn[ expando ] ) { 5742 return fn( argument ); 5743 } 5744 5745 // But maintain support for old signatures 5746 if ( fn.length > 1 ) { 5747 args = [ pseudo, pseudo, "", argument ]; 5748 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 5749 markFunction( function( seed, matches ) { 5750 var idx, 5751 matched = fn( seed, argument ), 5752 i = matched.length; 5753 while ( i-- ) { 5754 idx = indexOf.call( seed, matched[ i ] ); 5755 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 5756 } 5757 } ) : 5758 function( elem ) { 5759 return fn( elem, 0, args ); 5760 }; 5761 } 5762 5763 return fn; 5764 } 5765 }, 5766 5767 pseudos: { 5768 5769 // Potentially complex pseudos 5770 not: markFunction( function( selector ) { 5771 5772 // Trim the selector passed to compile 5773 // to avoid treating leading and trailing 5774 // spaces as combinators 5775 var input = [], 5776 results = [], 5777 matcher = compile( selector.replace( rtrimCSS, "$1" ) ); 5778 5779 return matcher[ expando ] ? 5780 markFunction( function( seed, matches, _context, xml ) { 5781 var elem, 5782 unmatched = matcher( seed, null, xml, [] ), 5783 i = seed.length; 5784 5785 // Match elements unmatched by `matcher` 5786 while ( i-- ) { 5787 if ( ( elem = unmatched[ i ] ) ) { 5788 seed[ i ] = !( matches[ i ] = elem ); 5789 } 5790 } 5791 } ) : 5792 function( elem, _context, xml ) { 5793 input[ 0 ] = elem; 5794 matcher( input, null, xml, results ); 5795 5796 // Don't keep the element 5797 // (see https://github.com/jquery/sizzle/issues/299) 5798 input[ 0 ] = null; 5799 return !results.pop(); 5800 }; 5801 } ), 5802 5803 has: markFunction( function( selector ) { 5804 return function( elem ) { 5805 return find( selector, elem ).length > 0; 5806 }; 5807 } ), 5808 5809 contains: markFunction( function( text ) { 5810 text = text.replace( runescape, funescape ); 5811 return function( elem ) { 5812 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; 5813 }; 5814 } ), 5815 5816 // "Whether an element is represented by a :lang() selector 5817 // is based solely on the element's language value 5818 // being equal to the identifier C, 5819 // or beginning with the identifier C immediately followed by "-". 5820 // The matching of C against the element's language value is performed case-insensitively. 5821 // The identifier C does not have to be a valid language name." 5822 // https://www.w3.org/TR/selectors/#lang-pseudo 5823 lang: markFunction( function( lang ) { 5824 5825 // lang value must be a valid identifier 5826 if ( !ridentifier.test( lang || "" ) ) { 5827 find.error( "unsupported lang: " + lang ); 5828 } 5829 lang = lang.replace( runescape, funescape ).toLowerCase(); 5830 return function( elem ) { 5831 var elemLang; 5832 do { 5833 if ( ( elemLang = documentIsHTML ? 5834 elem.lang : 5835 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 5836 5837 elemLang = elemLang.toLowerCase(); 5838 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 5839 } 5840 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 5841 return false; 5842 }; 5843 } ), 5844 5845 // Miscellaneous 5846 target: function( elem ) { 5847 var hash = window.location && window.location.hash; 5848 return hash && hash.slice( 1 ) === elem.id; 5849 }, 5850 5851 root: function( elem ) { 5852 return elem === documentElement; 5853 }, 5854 5855 focus: function( elem ) { 5856 return elem === safeActiveElement() && 5857 document.hasFocus() && 5858 !!( elem.type || elem.href || ~elem.tabIndex ); 5859 }, 5860 5861 // Boolean properties 5862 enabled: createDisabledPseudo( false ), 5863 disabled: createDisabledPseudo( true ), 5864 5865 checked: function( elem ) { 5866 5867 // In CSS3, :checked should return both checked and selected elements 5868 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 5869 return ( nodeName( elem, "input" ) && !!elem.checked ) || 5870 ( nodeName( elem, "option" ) && !!elem.selected ); 5871 }, 5872 5873 selected: function( elem ) { 5874 5875 // Support: IE <=11+ 5876 // Accessing the selectedIndex property 5877 // forces the browser to treat the default option as 5878 // selected when in an optgroup. 5879 if ( elem.parentNode ) { 5880 // eslint-disable-next-line no-unused-expressions 5881 elem.parentNode.selectedIndex; 5882 } 5883 5884 return elem.selected === true; 5885 }, 5886 5887 // Contents 5888 empty: function( elem ) { 5889 5890 // https://www.w3.org/TR/selectors/#empty-pseudo 5891 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 5892 // but not by others (comment: 8; processing instruction: 7; etc.) 5893 // nodeType < 6 works because attributes (2) do not appear as children 5894 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 5895 if ( elem.nodeType < 6 ) { 5896 return false; 5897 } 5898 } 5899 return true; 5900 }, 5901 5902 parent: function( elem ) { 5903 return !Expr.pseudos.empty( elem ); 5904 }, 5905 5906 // Element/input types 5907 header: function( elem ) { 5908 return rheader.test( elem.nodeName ); 5909 }, 5910 5911 input: function( elem ) { 5912 return rinputs.test( elem.nodeName ); 5913 }, 5914 5915 button: function( elem ) { 5916 return nodeName( elem, "input" ) && elem.type === "button" || 5917 nodeName( elem, "button" ); 5918 }, 5919 5920 text: function( elem ) { 5921 var attr; 5922 return nodeName( elem, "input" ) && elem.type === "text" && 5923 5924 // Support: IE <10 only 5925 // New HTML5 attribute values (e.g., "search") appear 5926 // with elem.type === "text" 5927 ( ( attr = elem.getAttribute( "type" ) ) == null || 5928 attr.toLowerCase() === "text" ); 5929 }, 5930 5931 // Position-in-collection 5932 first: createPositionalPseudo( function() { 5933 return [ 0 ]; 5934 } ), 5935 5936 last: createPositionalPseudo( function( _matchIndexes, length ) { 5937 return [ length - 1 ]; 5938 } ), 5939 5940 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { 5941 return [ argument < 0 ? argument + length : argument ]; 5942 } ), 5943 5944 even: createPositionalPseudo( function( matchIndexes, length ) { 5945 var i = 0; 5946 for ( ; i < length; i += 2 ) { 5947 matchIndexes.push( i ); 5948 } 5949 return matchIndexes; 5950 } ), 5951 5952 odd: createPositionalPseudo( function( matchIndexes, length ) { 5953 var i = 1; 5954 for ( ; i < length; i += 2 ) { 5955 matchIndexes.push( i ); 5956 } 5957 return matchIndexes; 5958 } ), 5959 5960 lt: createPositionalPseudo( function( matchIndexes, length, argument ) { 5961 var i; 5962 5963 if ( argument < 0 ) { 5964 i = argument + length; 5965 } else if ( argument > length ) { 5966 i = length; 5967 } else { 5968 i = argument; 5969 } 5970 5971 for ( ; --i >= 0; ) { 5972 matchIndexes.push( i ); 5973 } 5974 return matchIndexes; 5975 } ), 5976 5977 gt: createPositionalPseudo( function( matchIndexes, length, argument ) { 5978 var i = argument < 0 ? argument + length : argument; 5979 for ( ; ++i < length; ) { 5980 matchIndexes.push( i ); 5981 } 5982 return matchIndexes; 5983 } ) 5984 } 5985}; 5986 5987Expr.pseudos.nth = Expr.pseudos.eq; 5988 5989// Add button/input type pseudos 5990for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 5991 Expr.pseudos[ i ] = createInputPseudo( i ); 5992} 5993for ( i in { submit: true, reset: true } ) { 5994 Expr.pseudos[ i ] = createButtonPseudo( i ); 5995} 5996 5997// Easy API for creating new setFilters 5998function setFilters() {} 5999setFilters.prototype = Expr.filters = Expr.pseudos; 6000Expr.setFilters = new setFilters(); 6001 6002function tokenize( selector, parseOnly ) { 6003 var matched, match, tokens, type, 6004 soFar, groups, preFilters, 6005 cached = tokenCache[ selector + " " ]; 6006 6007 if ( cached ) { 6008 return parseOnly ? 0 : cached.slice( 0 ); 6009 } 6010 6011 soFar = selector; 6012 groups = []; 6013 preFilters = Expr.preFilter; 6014 6015 while ( soFar ) { 6016 6017 // Comma and first run 6018 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 6019 if ( match ) { 6020 6021 // Don't consume trailing commas as valid 6022 soFar = soFar.slice( match[ 0 ].length ) || soFar; 6023 } 6024 groups.push( ( tokens = [] ) ); 6025 } 6026 6027 matched = false; 6028 6029 // Combinators 6030 if ( ( match = rleadingCombinator.exec( soFar ) ) ) { 6031 matched = match.shift(); 6032 tokens.push( { 6033 value: matched, 6034 6035 // Cast descendant combinators to space 6036 type: match[ 0 ].replace( rtrimCSS, " " ) 6037 } ); 6038 soFar = soFar.slice( matched.length ); 6039 } 6040 6041 // Filters 6042 for ( type in Expr.filter ) { 6043 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 6044 ( match = preFilters[ type ]( match ) ) ) ) { 6045 matched = match.shift(); 6046 tokens.push( { 6047 value: matched, 6048 type: type, 6049 matches: match 6050 } ); 6051 soFar = soFar.slice( matched.length ); 6052 } 6053 } 6054 6055 if ( !matched ) { 6056 break; 6057 } 6058 } 6059 6060 // Return the length of the invalid excess 6061 // if we're just parsing 6062 // Otherwise, throw an error or return tokens 6063 if ( parseOnly ) { 6064 return soFar.length; 6065 } 6066 6067 return soFar ? 6068 find.error( selector ) : 6069 6070 // Cache the tokens 6071 tokenCache( selector, groups ).slice( 0 ); 6072} 6073 6074function toSelector( tokens ) { 6075 var i = 0, 6076 len = tokens.length, 6077 selector = ""; 6078 for ( ; i < len; i++ ) { 6079 selector += tokens[ i ].value; 6080 } 6081 return selector; 6082} 6083 6084function addCombinator( matcher, combinator, base ) { 6085 var dir = combinator.dir, 6086 skip = combinator.next, 6087 key = skip || dir, 6088 checkNonElements = base && key === "parentNode", 6089 doneName = done++; 6090 6091 return combinator.first ? 6092 6093 // Check against closest ancestor/preceding element 6094 function( elem, context, xml ) { 6095 while ( ( elem = elem[ dir ] ) ) { 6096 if ( elem.nodeType === 1 || checkNonElements ) { 6097 return matcher( elem, context, xml ); 6098 } 6099 } 6100 return false; 6101 } : 6102 6103 // Check against all ancestor/preceding elements 6104 function( elem, context, xml ) { 6105 var oldCache, outerCache, 6106 newCache = [ dirruns, doneName ]; 6107 6108 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 6109 if ( xml ) { 6110 while ( ( elem = elem[ dir ] ) ) { 6111 if ( elem.nodeType === 1 || checkNonElements ) { 6112 if ( matcher( elem, context, xml ) ) { 6113 return true; 6114 } 6115 } 6116 } 6117 } else { 6118 while ( ( elem = elem[ dir ] ) ) { 6119 if ( elem.nodeType === 1 || checkNonElements ) { 6120 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 6121 6122 if ( skip && nodeName( elem, skip ) ) { 6123 elem = elem[ dir ] || elem; 6124 } else if ( ( oldCache = outerCache[ key ] ) && 6125 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 6126 6127 // Assign to newCache so results back-propagate to previous elements 6128 return ( newCache[ 2 ] = oldCache[ 2 ] ); 6129 } else { 6130 6131 // Reuse newcache so results back-propagate to previous elements 6132 outerCache[ key ] = newCache; 6133 6134 // A match means we're done; a fail means we have to keep checking 6135 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 6136 return true; 6137 } 6138 } 6139 } 6140 } 6141 } 6142 return false; 6143 }; 6144} 6145 6146function elementMatcher( matchers ) { 6147 return matchers.length > 1 ? 6148 function( elem, context, xml ) { 6149 var i = matchers.length; 6150 while ( i-- ) { 6151 if ( !matchers[ i ]( elem, context, xml ) ) { 6152 return false; 6153 } 6154 } 6155 return true; 6156 } : 6157 matchers[ 0 ]; 6158} 6159 6160function multipleContexts( selector, contexts, results ) { 6161 var i = 0, 6162 len = contexts.length; 6163 for ( ; i < len; i++ ) { 6164 find( selector, contexts[ i ], results ); 6165 } 6166 return results; 6167} 6168 6169function condense( unmatched, map, filter, context, xml ) { 6170 var elem, 6171 newUnmatched = [], 6172 i = 0, 6173 len = unmatched.length, 6174 mapped = map != null; 6175 6176 for ( ; i < len; i++ ) { 6177 if ( ( elem = unmatched[ i ] ) ) { 6178 if ( !filter || filter( elem, context, xml ) ) { 6179 newUnmatched.push( elem ); 6180 if ( mapped ) { 6181 map.push( i ); 6182 } 6183 } 6184 } 6185 } 6186 6187 return newUnmatched; 6188} 6189 6190function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 6191 if ( postFilter && !postFilter[ expando ] ) { 6192 postFilter = setMatcher( postFilter ); 6193 } 6194 if ( postFinder && !postFinder[ expando ] ) { 6195 postFinder = setMatcher( postFinder, postSelector ); 6196 } 6197 return markFunction( function( seed, results, context, xml ) { 6198 var temp, i, elem, matcherOut, 6199 preMap = [], 6200 postMap = [], 6201 preexisting = results.length, 6202 6203 // Get initial elements from seed or context 6204 elems = seed || 6205 multipleContexts( selector || "*", 6206 context.nodeType ? [ context ] : context, [] ), 6207 6208 // Prefilter to get matcher input, preserving a map for seed-results synchronization 6209 matcherIn = preFilter && ( seed || !selector ) ? 6210 condense( elems, preMap, preFilter, context, xml ) : 6211 elems; 6212 6213 if ( matcher ) { 6214 6215 // If we have a postFinder, or filtered seed, or non-seed postFilter 6216 // or preexisting results, 6217 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 6218 6219 // ...intermediate processing is necessary 6220 [] : 6221 6222 // ...otherwise use results directly 6223 results; 6224 6225 // Find primary matches 6226 matcher( matcherIn, matcherOut, context, xml ); 6227 } else { 6228 matcherOut = matcherIn; 6229 } 6230 6231 // Apply postFilter 6232 if ( postFilter ) { 6233 temp = condense( matcherOut, postMap ); 6234 postFilter( temp, [], context, xml ); 6235 6236 // Un-match failing elements by moving them back to matcherIn 6237 i = temp.length; 6238 while ( i-- ) { 6239 if ( ( elem = temp[ i ] ) ) { 6240 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 6241 } 6242 } 6243 } 6244 6245 if ( seed ) { 6246 if ( postFinder || preFilter ) { 6247 if ( postFinder ) { 6248 6249 // Get the final matcherOut by condensing this intermediate into postFinder contexts 6250 temp = []; 6251 i = matcherOut.length; 6252 while ( i-- ) { 6253 if ( ( elem = matcherOut[ i ] ) ) { 6254 6255 // Restore matcherIn since elem is not yet a final match 6256 temp.push( ( matcherIn[ i ] = elem ) ); 6257 } 6258 } 6259 postFinder( null, ( matcherOut = [] ), temp, xml ); 6260 } 6261 6262 // Move matched elements from seed to results to keep them synchronized 6263 i = matcherOut.length; 6264 while ( i-- ) { 6265 if ( ( elem = matcherOut[ i ] ) && 6266 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { 6267 6268 seed[ temp ] = !( results[ temp ] = elem ); 6269 } 6270 } 6271 } 6272 6273 // Add elements to results, through postFinder if defined 6274 } else { 6275 matcherOut = condense( 6276 matcherOut === results ? 6277 matcherOut.splice( preexisting, matcherOut.length ) : 6278 matcherOut 6279 ); 6280 if ( postFinder ) { 6281 postFinder( null, results, matcherOut, xml ); 6282 } else { 6283 push.apply( results, matcherOut ); 6284 } 6285 } 6286 } ); 6287} 6288 6289function matcherFromTokens( tokens ) { 6290 var checkContext, matcher, j, 6291 len = tokens.length, 6292 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 6293 implicitRelative = leadingRelative || Expr.relative[ " " ], 6294 i = leadingRelative ? 1 : 0, 6295 6296 // The foundational matcher ensures that elements are reachable from top-level context(s) 6297 matchContext = addCombinator( function( elem ) { 6298 return elem === checkContext; 6299 }, implicitRelative, true ), 6300 matchAnyContext = addCombinator( function( elem ) { 6301 return indexOf.call( checkContext, elem ) > -1; 6302 }, implicitRelative, true ), 6303 matchers = [ function( elem, context, xml ) { 6304 6305 // Support: IE 11+, Edge 17 - 18+ 6306 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 6307 // two documents; shallow comparisons work. 6308 // eslint-disable-next-line eqeqeq 6309 var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( 6310 ( checkContext = context ).nodeType ? 6311 matchContext( elem, context, xml ) : 6312 matchAnyContext( elem, context, xml ) ); 6313 6314 // Avoid hanging onto element 6315 // (see https://github.com/jquery/sizzle/issues/299) 6316 checkContext = null; 6317 return ret; 6318 } ]; 6319 6320 for ( ; i < len; i++ ) { 6321 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 6322 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 6323 } else { 6324 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 6325 6326 // Return special upon seeing a positional matcher 6327 if ( matcher[ expando ] ) { 6328 6329 // Find the next relative operator (if any) for proper handling 6330 j = ++i; 6331 for ( ; j < len; j++ ) { 6332 if ( Expr.relative[ tokens[ j ].type ] ) { 6333 break; 6334 } 6335 } 6336 return setMatcher( 6337 i > 1 && elementMatcher( matchers ), 6338 i > 1 && toSelector( 6339 6340 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 6341 tokens.slice( 0, i - 1 ) 6342 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 6343 ).replace( rtrimCSS, "$1" ), 6344 matcher, 6345 i < j && matcherFromTokens( tokens.slice( i, j ) ), 6346 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 6347 j < len && toSelector( tokens ) 6348 ); 6349 } 6350 matchers.push( matcher ); 6351 } 6352 } 6353 6354 return elementMatcher( matchers ); 6355} 6356 6357function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 6358 var bySet = setMatchers.length > 0, 6359 byElement = elementMatchers.length > 0, 6360 superMatcher = function( seed, context, xml, results, outermost ) { 6361 var elem, j, matcher, 6362 matchedCount = 0, 6363 i = "0", 6364 unmatched = seed && [], 6365 setMatched = [], 6366 contextBackup = outermostContext, 6367 6368 // We must always have either seed elements or outermost context 6369 elems = seed || byElement && Expr.find.TAG( "*", outermost ), 6370 6371 // Use integer dirruns iff this is the outermost matcher 6372 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 6373 len = elems.length; 6374 6375 if ( outermost ) { 6376 6377 // Support: IE 11+, Edge 17 - 18+ 6378 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 6379 // two documents; shallow comparisons work. 6380 // eslint-disable-next-line eqeqeq 6381 outermostContext = context == document || context || outermost; 6382 } 6383 6384 // Add elements passing elementMatchers directly to results 6385 // Support: iOS <=7 - 9 only 6386 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching 6387 // elements by id. (see trac-14142) 6388 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 6389 if ( byElement && elem ) { 6390 j = 0; 6391 6392 // Support: IE 11+, Edge 17 - 18+ 6393 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 6394 // two documents; shallow comparisons work. 6395 // eslint-disable-next-line eqeqeq 6396 if ( !context && elem.ownerDocument != document ) { 6397 setDocument( elem ); 6398 xml = !documentIsHTML; 6399 } 6400 while ( ( matcher = elementMatchers[ j++ ] ) ) { 6401 if ( matcher( elem, context || document, xml ) ) { 6402 push.call( results, elem ); 6403 break; 6404 } 6405 } 6406 if ( outermost ) { 6407 dirruns = dirrunsUnique; 6408 } 6409 } 6410 6411 // Track unmatched elements for set filters 6412 if ( bySet ) { 6413 6414 // They will have gone through all possible matchers 6415 if ( ( elem = !matcher && elem ) ) { 6416 matchedCount--; 6417 } 6418 6419 // Lengthen the array for every element, matched or not 6420 if ( seed ) { 6421 unmatched.push( elem ); 6422 } 6423 } 6424 } 6425 6426 // `i` is now the count of elements visited above, and adding it to `matchedCount` 6427 // makes the latter nonnegative. 6428 matchedCount += i; 6429 6430 // Apply set filters to unmatched elements 6431 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 6432 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 6433 // no element matchers and no seed. 6434 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 6435 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 6436 // numerically zero. 6437 if ( bySet && i !== matchedCount ) { 6438 j = 0; 6439 while ( ( matcher = setMatchers[ j++ ] ) ) { 6440 matcher( unmatched, setMatched, context, xml ); 6441 } 6442 6443 if ( seed ) { 6444 6445 // Reintegrate element matches to eliminate the need for sorting 6446 if ( matchedCount > 0 ) { 6447 while ( i-- ) { 6448 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 6449 setMatched[ i ] = pop.call( results ); 6450 } 6451 } 6452 } 6453 6454 // Discard index placeholder values to get only actual matches 6455 setMatched = condense( setMatched ); 6456 } 6457 6458 // Add matches to results 6459 push.apply( results, setMatched ); 6460 6461 // Seedless set matches succeeding multiple successful matchers stipulate sorting 6462 if ( outermost && !seed && setMatched.length > 0 && 6463 ( matchedCount + setMatchers.length ) > 1 ) { 6464 6465 jQuery.uniqueSort( results ); 6466 } 6467 } 6468 6469 // Override manipulation of globals by nested matchers 6470 if ( outermost ) { 6471 dirruns = dirrunsUnique; 6472 outermostContext = contextBackup; 6473 } 6474 6475 return unmatched; 6476 }; 6477 6478 return bySet ? 6479 markFunction( superMatcher ) : 6480 superMatcher; 6481} 6482 6483function compile( selector, match /* Internal Use Only */ ) { 6484 var i, 6485 setMatchers = [], 6486 elementMatchers = [], 6487 cached = compilerCache[ selector + " " ]; 6488 6489 if ( !cached ) { 6490 6491 // Generate a function of recursive functions that can be used to check each element 6492 if ( !match ) { 6493 match = tokenize( selector ); 6494 } 6495 i = match.length; 6496 while ( i-- ) { 6497 cached = matcherFromTokens( match[ i ] ); 6498 if ( cached[ expando ] ) { 6499 setMatchers.push( cached ); 6500 } else { 6501 elementMatchers.push( cached ); 6502 } 6503 } 6504 6505 // Cache the compiled function 6506 cached = compilerCache( selector, 6507 matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 6508 6509 // Save selector and tokenization 6510 cached.selector = selector; 6511 } 6512 return cached; 6513} 6514 6515/** 6516 * A low-level selection function that works with jQuery's compiled 6517 * selector functions 6518 * @param {String|Function} selector A selector or a pre-compiled 6519 * selector function built with jQuery selector compile 6520 * @param {Element} context 6521 * @param {Array} [results] 6522 * @param {Array} [seed] A set of elements to match against 6523 */ 6524function select( selector, context, results, seed ) { 6525 var i, tokens, token, type, find, 6526 compiled = typeof selector === "function" && selector, 6527 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 6528 6529 results = results || []; 6530 6531 // Try to minimize operations if there is only one selector in the list and no seed 6532 // (the latter of which guarantees us context) 6533 if ( match.length === 1 ) { 6534 6535 // Reduce context if the leading compound selector is an ID 6536 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 6537 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 6538 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 6539 6540 context = ( Expr.find.ID( 6541 token.matches[ 0 ].replace( runescape, funescape ), 6542 context 6543 ) || [] )[ 0 ]; 6544 if ( !context ) { 6545 return results; 6546 6547 // Precompiled matchers will still verify ancestry, so step up a level 6548 } else if ( compiled ) { 6549 context = context.parentNode; 6550 } 6551 6552 selector = selector.slice( tokens.shift().value.length ); 6553 } 6554 6555 // Fetch a seed set for right-to-left matching 6556 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; 6557 while ( i-- ) { 6558 token = tokens[ i ]; 6559 6560 // Abort if we hit a combinator 6561 if ( Expr.relative[ ( type = token.type ) ] ) { 6562 break; 6563 } 6564 if ( ( find = Expr.find[ type ] ) ) { 6565 6566 // Search, expanding context for leading sibling combinators 6567 if ( ( seed = find( 6568 token.matches[ 0 ].replace( runescape, funescape ), 6569 rsibling.test( tokens[ 0 ].type ) && 6570 testContext( context.parentNode ) || context 6571 ) ) ) { 6572 6573 // If seed is empty or no tokens remain, we can return early 6574 tokens.splice( i, 1 ); 6575 selector = seed.length && toSelector( tokens ); 6576 if ( !selector ) { 6577 push.apply( results, seed ); 6578 return results; 6579 } 6580 6581 break; 6582 } 6583 } 6584 } 6585 } 6586 6587 // Compile and execute a filtering function if one is not provided 6588 // Provide `match` to avoid retokenization if we modified the selector above 6589 ( compiled || compile( selector, match ) )( 6590 seed, 6591 context, 6592 !documentIsHTML, 6593 results, 6594 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 6595 ); 6596 return results; 6597} 6598 6599// One-time assignments 6600 6601// Support: Android <=4.0 - 4.1+ 6602// Sort stability 6603support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 6604 6605// Initialize against the default document 6606setDocument(); 6607 6608// Support: Android <=4.0 - 4.1+ 6609// Detached nodes confoundingly follow *each other* 6610support.sortDetached = assert( function( el ) { 6611 6612 // Should return 1, but returns 4 (following) 6613 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 6614} ); 6615 6616jQuery.find = find; 6617 6618// Deprecated 6619jQuery.expr[ ":" ] = jQuery.expr.pseudos; 6620jQuery.unique = jQuery.uniqueSort; 6621 6622// These have always been private, but they used to be documented
6622 6623// as part of Sizzle so let's maintain them in the 3.x line 6624// for backwards compatibility purposes. 6625find.compile = compile; 6626find.select = select; 6627find.setDocument = setDocument
vendor: 12,898 bytes, lines 6627-7143
6627; 6628 6629find.escape = jQuery.escapeSelector; 6630find.getText = jQuery.text; 6631find.isXML = jQuery.isXMLDoc; 6632find.selectors = jQuery.expr; 6633find.support = jQuery.support; 6634find.uniqueSort = jQuery.uniqueSort; 6635 6636 /* eslint-enable */ 6637 6638} )(); 6639 6640 6641var dir = function( elem, dir, until ) { 6642 var matched = [], 6643 truncate = until !== undefined; 6644 6645 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 6646 if ( elem.nodeType === 1 ) { 6647 if ( truncate && jQuery( elem ).is( until ) ) { 6648 break; 6649 } 6650 matched.push( elem ); 6651 } 6652 } 6653 return matched; 6654}; 6655 6656 6657var siblings = function( n, elem ) { 6658 var matched = []; 6659 6660 for ( ; n; n = n.nextSibling ) { 6661 if ( n.nodeType === 1 && n !== elem ) { 6662 matched.push( n ); 6663 } 6664 } 6665 6666 return matched; 6667}; 6668 6669 6670var rneedsContext = jQuery.expr.match.needsContext; 6671 6672var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 6673 6674 6675 6676// Implement the identical functionality for filter and not 6677function winnow( elements, qualifier, not ) { 6678 if ( isFunction( qualifier ) ) { 6679 return jQuery.grep( elements, function( elem, i ) { 6680 return !!qualifier.call( elem, i, elem ) !== not; 6681 } ); 6682 } 6683 6684 // Single element 6685 if ( qualifier.nodeType ) { 6686 return jQuery.grep( elements, function( elem ) { 6687 return ( elem === qualifier ) !== not; 6688 } ); 6689 } 6690 6691 // Arraylike of elements (jQuery, arguments, Array) 6692 if ( typeof qualifier !== "string" ) { 6693 return jQuery.grep( elements, function( elem ) { 6694 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 6695 } ); 6696 } 6697 6698 // Filtered directly for both simple and complex selectors 6699 return jQuery.filter( qualifier, elements, not ); 6700} 6701 6702jQuery.filter = function( expr, elems, not ) { 6703 var elem = elems[ 0 ]; 6704 6705 if ( not ) { 6706 expr = ":not(" + expr + ")"; 6707 } 6708 6709 if ( elems.length === 1 && elem.nodeType === 1 ) { 6710 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 6711 } 6712 6713 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 6714 return elem.nodeType === 1; 6715 } ) ); 6716}; 6717 6718jQuery.fn.extend( { 6719 find: function( selector ) { 6720 var i, ret, 6721 len = this.length, 6722 self = this; 6723 6724 if ( typeof selector !== "string" ) { 6725 return this.pushStack( jQuery( selector ).filter( function() { 6726 for ( i = 0; i < len; i++ ) { 6727 if ( jQuery.contains( self[ i ], this ) ) { 6728 return true; 6729 } 6730 } 6731 } ) ); 6732 } 6733 6734 ret = this.pushStack( [] ); 6735 6736 for ( i = 0; i < len; i++ ) { 6737 jQuery.find( selector, self[ i ], ret ); 6738 } 6739 6740 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 6741 }, 6742 filter: function( selector ) { 6743 return this.pushStack( winnow( this, selector || [], false ) ); 6744 }, 6745 not: function( selector ) { 6746 return this.pushStack( winnow( this, selector || [], true ) ); 6747 }, 6748 is: function( selector ) { 6749 return !!winnow( 6750 this, 6751 6752 // If this is a positional/relative selector, check membership in the returned set 6753 // so $("p:first").is("p:last") won't return true for a doc with two "p". 6754 typeof selector === "string" && rneedsContext.test( selector ) ? 6755 jQuery( selector ) : 6756 selector || [], 6757 false 6758 ).length; 6759 } 6760} ); 6761 6762 6763// Initialize a jQuery object 6764 6765 6766// A central reference to the root jQuery(document) 6767var rootjQuery, 6768 6769 // A simple way to check for HTML strings 6770 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) 6771 // Strict HTML recognition (trac-11290: must start with <) 6772 // Shortcut simple #id case for speed 6773 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 6774 6775 init = jQuery.fn.init = function( selector, context, root ) { 6776 var match, elem; 6777 6778 // HANDLE: $(""), $(null), $(undefined), $(false) 6779 if ( !selector ) { 6780 return this; 6781 } 6782 6783 // Method init() accepts an alternate rootjQuery 6784 // so migrate can support jQuery.sub (gh-2101) 6785 root = root || rootjQuery; 6786 6787 // Handle HTML strings 6788 if ( typeof selector === "string" ) { 6789 if ( selector[ 0 ] === "<" && 6790 selector[ selector.length - 1 ] === ">" && 6791 selector.length >= 3 ) { 6792 6793 // Assume that strings that start and end with <> are HTML and skip the regex check 6794 match = [ null, selector, null ]; 6795 6796 } else { 6797 match = rquickExpr.exec( selector ); 6798 } 6799 6800 // Match html or make sure no context is specified for #id 6801 if ( match && ( match[ 1 ] || !context ) ) { 6802 6803 // HANDLE: $(html) -> $(array) 6804 if ( match[ 1 ] ) { 6805 context = context instanceof jQuery ? context[ 0 ] : context; 6806 6807 // Option to run scripts is true for back-compat 6808 // Intentionally let the error be thrown if parseHTML is not present 6809 jQuery.merge( this, jQuery.parseHTML( 6810 match[ 1 ], 6811 context && context.nodeType ? context.ownerDocument || context : document, 6812 true 6813 ) ); 6814 6815 // HANDLE: $(html, props) 6816 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 6817 for ( match in context ) { 6818 6819 // Properties of context are called as methods if possible 6820 if ( isFunction( this[ match ] ) ) { 6821 this[ match ]( context[ match ] ); 6822 6823 // ...and otherwise set as attributes 6824 } else { 6825 this.attr( match, context[ match ] ); 6826 } 6827 } 6828 } 6829 6830 return this; 6831 6832 // HANDLE: $(#id) 6833 } else { 6834 elem = document.getElementById( match[ 2 ] ); 6835 6836 if ( elem ) { 6837 6838 // Inject the element directly into the jQuery object 6839 this[ 0 ] = elem; 6840 this.length = 1; 6841 } 6842 return this; 6843 } 6844 6845 // HANDLE: $(expr, $(...)) 6846 } else if ( !context || context.jquery ) { 6847 return ( context || root ).find( selector ); 6848 6849 // HANDLE: $(expr, context) 6850 // (which is just equivalent to: $(context).find(expr) 6851 } else { 6852 return this.constructor( context ).find( selector ); 6853 } 6854 6855 // HANDLE: $(DOMElement) 6856 } else if ( selector.nodeType ) { 6857 this[ 0 ] = selector; 6858 this.length = 1; 6859 return this; 6860 6861 // HANDLE: $(function) 6862 // Shortcut for document ready 6863 } else if ( isFunction( selector ) ) { 6864 return root.ready !== undefined ? 6865 root.ready( selector ) : 6866 6867 // Execute immediately if ready is not present 6868 selector( jQuery ); 6869 } 6870 6871 return jQuery.makeArray( selector, this ); 6872 }; 6873 6874// Give the init function the jQuery prototype for later instantiation 6875init.prototype = jQuery.fn; 6876 6877// Initialize central reference 6878rootjQuery = jQuery( document ); 6879 6880 6881var rparentsprev = /^(?:parents|prev(?:Until|All))/, 6882 6883 // Methods guaranteed to produce a unique set when starting from a unique set 6884 guaranteedUnique = { 6885 children: true, 6886 contents: true, 6887 next: true, 6888 prev: true 6889 }; 6890 6891jQuery.fn.extend( { 6892 has: function( target ) { 6893 var targets = jQuery( target, this ), 6894 l = targets.length; 6895 6896 return this.filter( function() { 6897 var i = 0; 6898 for ( ; i < l; i++ ) { 6899 if ( jQuery.contains( this, targets[ i ] ) ) { 6900 return true; 6901 } 6902 } 6903 } ); 6904 }, 6905 6906 closest: function( selectors, context ) { 6907 var cur, 6908 i = 0, 6909 l = this.length, 6910 matched = [], 6911 targets = typeof selectors !== "string" && jQuery( selectors ); 6912 6913 // Positional selectors never match, since there's no _selection_ context 6914 if ( !rneedsContext.test( selectors ) ) { 6915 for ( ; i < l; i++ ) { 6916 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 6917 6918 // Always skip document fragments 6919 if ( cur.nodeType < 11 && ( targets ? 6920 targets.index( cur ) > -1 : 6921 6922 // Don't pass non-elements to jQuery#find 6923 cur.nodeType === 1 && 6924 jQuery.find.matchesSelector( cur, selectors ) ) ) { 6925 6926 matched.push( cur ); 6927 break; 6928 } 6929 } 6930 } 6931 } 6932 6933 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 6934 }, 6935 6936 // Determine the position of an element within the set 6937 index: function( elem ) { 6938 6939 // No argument, return index in parent 6940 if ( !elem ) { 6941 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 6942 } 6943 6944 // Index in selector 6945 if ( typeof elem === "string" ) { 6946 return indexOf.call( jQuery( elem ), this[ 0 ] ); 6947 } 6948 6949 // Locate the position of the desired element 6950 return indexOf.call( this, 6951 6952 // If it receives a jQuery object, the first element is used 6953 elem.jquery ? elem[ 0 ] : elem 6954 ); 6955 }, 6956 6957 add: function( selector, context ) { 6958 return this.pushStack( 6959 jQuery.uniqueSort( 6960 jQuery.merge( this.get(), jQuery( selector, context ) ) 6961 ) 6962 ); 6963 }, 6964 6965 addBack: function( selector ) { 6966 return this.add( selector == null ? 6967 this.prevObject : this.prevObject.filter( selector ) 6968 ); 6969 } 6970} ); 6971 6972function sibling( cur, dir ) { 6973 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 6974 return cur; 6975} 6976 6977jQuery.each( { 6978 parent: function( elem ) { 6979 var parent = elem.parentNode; 6980 return parent && parent.nodeType !== 11 ? parent : null; 6981 }, 6982 parents: function( elem ) { 6983 return dir( elem, "parentNode" ); 6984 }, 6985 parentsUntil: function( elem, _i, until ) { 6986 return dir( elem, "parentNode", until ); 6987 }, 6988 next: function( elem ) { 6989 return sibling( elem, "nextSibling" ); 6990 }, 6991 prev: function( elem ) { 6992 return sibling( elem, "previousSibling" ); 6993 }, 6994 nextAll: function( elem ) { 6995 return dir( elem, "nextSibling" ); 6996 }, 6997 prevAll: function( elem ) { 6998 return dir( elem, "previousSibling" ); 6999 }, 7000 nextUntil: function( elem, _i, until ) { 7001 return dir( elem, "nextSibling", until ); 7002 }, 7003 prevUntil: function( elem, _i, until ) { 7004 return dir( elem, "previousSibling", until ); 7005 }, 7006 siblings: function( elem ) { 7007 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 7008 }, 7009 children: function( elem ) { 7010 return siblings( elem.firstChild ); 7011 }, 7012 contents: function( elem ) { 7013 if ( elem.contentDocument != null && 7014 7015 // Support: IE 11+ 7016 // <object> elements with no `data` attribute has an object 7017 // `contentDocument` with a `null` prototype. 7018 getProto( elem.contentDocument ) ) { 7019 7020 return elem.contentDocument; 7021 } 7022 7023 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 7024 // Treat the template element as a regular one in browsers that 7025 // don't support it. 7026 if ( nodeName( elem, "template" ) ) { 7027 elem = elem.content || elem; 7028 } 7029 7030 return jQuery.merge( [], elem.childNodes ); 7031 } 7032}, function( name, fn ) { 7033 jQuery.fn[ name ] = function( until, selector ) { 7034 var matched = jQuery.map( this, fn, until ); 7035 7036 if ( name.slice( -5 ) !== "Until" ) { 7037 selector = until; 7038 } 7039 7040 if ( selector && typeof selector === "string" ) { 7041 matched = jQuery.filter( selector, matched ); 7042 } 7043 7044 if ( this.length > 1 ) { 7045 7046 // Remove duplicates 7047 if ( !guaranteedUnique[ name ] ) { 7048 jQuery.uniqueSort( matched ); 7049 } 7050 7051 // Reverse order for parents* and prev-derivatives 7052 if ( rparentsprev.test( name ) ) { 7053 matched.reverse(); 7054 } 7055 } 7056 7057 return this.pushStack( matched ); 7058 }; 7059} ); 7060var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 7061 7062 7063 7064// Convert String-formatted options into Object-formatted ones 7065function createOptions( options ) { 7066 var object = {}; 7067 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 7068 object[ flag ] = true; 7069 } ); 7070 return object; 7071} 7072 7073/* 7074 * Create a callback list using the following parameters: 7075 * 7076 * options: an optional list of space-separated options that will change how 7077 * the callback list behaves or a more traditional option object 7078 * 7079 * By default a callback list will act like an event callback list and can be 7080 * "fired" multiple times. 7081 * 7082 * Possible options: 7083 * 7084 * once: will ensure the callback list can only be fired once (like a Deferred) 7085 * 7086 * memory: will keep track of previous values and will call any callback added 7087 * after the list has been fired right away with the latest "memorized" 7088 * values (like a Deferred) 7089 * 7090 * unique: will ensure a callback can only be added once (no duplicate in the list) 7091 * 7092 * stopOnFalse: interrupt callings when a callback returns false 7093 * 7094 */ 7095jQuery.Callbacks = function( options ) { 7096 7097 // Convert options from String-formatted to Object-formatted if needed 7098 // (we check in cache first) 7099 options = typeof options === "string" ? 7100 createOptions( options ) : 7101 jQuery.extend( {}, options ); 7102 7103 var // Flag to know if list is currently firing 7104 firing, 7105 7106 // Last fire value for non-forgettable lists 7107 memory, 7108 7109 // Flag to know if list was already fired 7110 fired, 7111 7112 // Flag to prevent firing 7113 locked, 7114 7115 // Actual callback list 7116 list = [], 7117 7118 // Queue of execution data for repeatable lists 7119 queue = [], 7120 7121 // Index of currently firing callback (modified by add/remove as needed) 7122 firingIndex = -1, 7123 7124 // Fire callbacks 7125 fire = function() { 7126 7127 // Enforce single-firing 7128 locked = locked || options.once; 7129 7130 // Execute callbacks for all pending executions, 7131 // respecting firingIndex overrides and runtime changes 7132 fired = firing = true; 7133 for ( ; queue.length; firingIndex = -1 ) { 7134 memory = queue.shift(); 7135 while ( ++firingIndex < list.length ) { 7136 7137 // Run callback and check for early termination 7138 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 7139 options.stopOnFalse ) { 7140 7141 // Jump to end and forget the data so .add doesn't re-fire 7142 firingIndex = list.length; 7143 memory = false;
vendor: 4,918 bytes, lines 7144-7353
7144 } 7145 } 7146 } 7147 7148 // Forget the data if we're done with it 7149 if ( !options.memory ) { 7150 memory = false; 7151 } 7152 7153 firing = false; 7154 7155 // Clean up if we're done firing for good 7156 if ( locked ) { 7157 7158 // Keep an empty list if we have data for future add calls 7159 if ( memory ) { 7160 list = []; 7161 7162 // Otherwise, this object is spent 7163 } else { 7164 list = ""; 7165 } 7166 } 7167 }, 7168 7169 // Actual Callbacks object 7170 self = { 7171 7172 // Add a callback or a collection of callbacks to the list 7173 add: function() { 7174 if ( list ) { 7175 7176 // If we have memory from a past run, we should fire after adding 7177 if ( memory && !firing ) { 7178 firingIndex = list.length - 1; 7179 queue.push( memory ); 7180 } 7181 7182 ( function add( args ) { 7183 jQuery.each( args, function( _, arg ) { 7184 if ( isFunction( arg ) ) { 7185 if ( !options.unique || !self.has( arg ) ) { 7186 list.push( arg ); 7187 } 7188 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 7189 7190 // Inspect recursively 7191 add( arg ); 7192 } 7193 } ); 7194 } )( arguments ); 7195 7196 if ( memory && !firing ) { 7197 fire(); 7198 } 7199 } 7200 return this; 7201 }, 7202 7203 // Remove a callback from the list 7204 remove: function() { 7205 jQuery.each( arguments, function( _, arg ) { 7206 var index; 7207 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 7208 list.splice( index, 1 ); 7209 7210 // Handle firing indexes 7211 if ( index <= firingIndex ) { 7212 firingIndex--; 7213 } 7214 } 7215 } ); 7216 return this; 7217 }, 7218 7219 // Check if a given callback is in the list. 7220 // If no argument is given, return whether or not list has callbacks attached. 7221 has: function( fn ) { 7222 return fn ? 7223 jQuery.inArray( fn, list ) > -1 : 7224 list.length > 0; 7225 }, 7226 7227 // Remove all callbacks from the list 7228 empty: function() { 7229 if ( list ) { 7230 list = []; 7231 } 7232 return this; 7233 }, 7234 7235 // Disable .fire and .add 7236 // Abort any current/pending executions 7237 // Clear all callbacks and values 7238 disable: function() { 7239 locked = queue = []; 7240 list = memory = ""; 7241 return this; 7242 }, 7243 disabled: function() { 7244 return !list; 7245 }, 7246 7247 // Disable .fire 7248 // Also disable .add unless we have memory (since it would have no effect) 7249 // Abort any pending executions 7250 lock: function() { 7251 locked = queue = []; 7252 if ( !memory && !firing ) { 7253 list = memory = ""; 7254 } 7255 return this; 7256 }, 7257 locked: function() { 7258 return !!locked; 7259 }, 7260 7261 // Call all callbacks with the given context and arguments 7262 fireWith: function( context, args ) { 7263 if ( !locked ) { 7264 args = args || []; 7265 args = [ context, args.slice ? args.slice() : args ]; 7266 queue.push( args ); 7267 if ( !firing ) { 7268 fire(); 7269 } 7270 } 7271 return this; 7272 }, 7273 7274 // Call all the callbacks with the given arguments 7275 fire: function() { 7276 self.fireWith( this, arguments ); 7277 return this; 7278 }, 7279 7280 // To know if the callbacks have already been called at least once 7281 fired: function() { 7282 return !!fired; 7283 } 7284 }; 7285 7286 return self; 7287}; 7288 7289 7290function Identity( v ) { 7291 return v; 7292} 7293function Thrower( ex ) { 7294 throw ex; 7295} 7296 7297function adoptValue( value, resolve, reject, noValue ) { 7298 var method; 7299 7300 try { 7301 7302 // Check for promise aspect first to privilege synchronous behavior 7303 if ( value && isFunction( ( method = value.promise ) ) ) { 7304 method.call( value ).done( resolve ).fail( reject ); 7305 7306 // Other thenables 7307 } else if ( value && isFunction( ( method = value.then ) ) ) { 7308 method.call( value, resolve, reject ); 7309 7310 // Other non-thenables 7311 } else { 7312 7313 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 7314 // * false: [ value ].slice( 0 ) => resolve( value ) 7315 // * true: [ value ].slice( 1 ) => resolve() 7316 resolve.apply( undefined, [ value ].slice( noValue ) ); 7317 } 7318 7319 // For Promises/A+, convert exceptions into rejections 7320 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 7321 // Deferred#then to conditionally suppress rejection. 7322 } catch ( value ) { 7323 7324 // Support: Android 4.0 only 7325 // Strict mode functions invoked without .call/.apply get global-object context 7326 reject.apply( undefined, [ value ] ); 7327 } 7328} 7329 7330jQuery.extend( { 7331 7332 Deferred: function( func ) { 7333 var tuples = [ 7334 7335 // action, add listener, callbacks, 7336 // ... .then handlers, argument index, [final state] 7337 [ "notify", "progress", jQuery.Callbacks( "memory" ), 7338 jQuery.Callbacks( "memory" ), 2 ], 7339 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 7340 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 7341 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 7342 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 7343 ], 7344 state = "pending", 7345 promise = { 7346 state: function() { 7347 return state; 7348 }, 7349 always: function() { 7350 deferred.done( arguments ).fail( arguments ); 7351 return this; 7352 }, 7353 "catch": function( fn ) {
vendor: 67,037 bytes, lines 7354-9841
7354 return promise.then( null, fn ); 7355 }, 7356 7357 // Keep pipe for back-compat 7358 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 7359 var fns = arguments; 7360 7361 return jQuery.Deferred( function( newDefer ) { 7362 jQuery.each( tuples, function( _i, tuple ) { 7363 7364 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 7365 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 7366 7367 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 7368 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 7369 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 7370 deferred[ tuple[ 1 ] ]( function() { 7371 var returned = fn && fn.apply( this, arguments ); 7372 if ( returned && isFunction( returned.promise ) ) { 7373 returned.promise() 7374 .progress( newDefer.notify ) 7375 .done( newDefer.resolve ) 7376 .fail( newDefer.reject ); 7377 } else { 7378 newDefer[ tuple[ 0 ] + "With" ]( 7379 this, 7380 fn ? [ returned ] : arguments 7381 ); 7382 } 7383 } ); 7384 } ); 7385 fns = null; 7386 } ).promise(); 7387 }, 7388 then: function( onFulfilled, onRejected, onProgress ) { 7389 var maxDepth = 0; 7390 function resolve( depth, deferred, handler, special ) { 7391 return function() { 7392 var that = this, 7393 args = arguments, 7394 mightThrow = function() { 7395 var returned, then; 7396 7397 // Support: Promises/A+ section 2.3.3.3.3 7398 // https://promisesaplus.com/#point-59 7399 // Ignore double-resolution attempts 7400 if ( depth < maxDepth ) { 7401 return; 7402 } 7403 7404 returned = handler.apply( that, args ); 7405 7406 // Support: Promises/A+ section 2.3.1 7407 // https://promisesaplus.com/#point-48 7408 if ( returned === deferred.promise() ) { 7409 throw new TypeError( "Thenable self-resolution" ); 7410 } 7411 7412 // Support: Promises/A+ sections 2.3.3.1, 3.5 7413 // https://promisesaplus.com/#point-54 7414 // https://promisesaplus.com/#point-75 7415 // Retrieve `then` only once 7416 then = returned && 7417 7418 // Support: Promises/A+ section 2.3.4 7419 // https://promisesaplus.com/#point-64 7420 // Only check objects and functions for thenability 7421 ( typeof returned === "object" || 7422 typeof returned === "function" ) && 7423 returned.then; 7424 7425 // Handle a returned thenable 7426 if ( isFunction( then ) ) { 7427 7428 // Special processors (notify) just wait for resolution 7429 if ( special ) { 7430 then.call( 7431 returned, 7432 resolve( maxDepth, deferred, Identity, special ), 7433 resolve( maxDepth, deferred, Thrower, special ) 7434 ); 7435 7436 // Normal processors (resolve) also hook into progress 7437 } else { 7438 7439 // ...and disregard older resolution values 7440 maxDepth++; 7441 7442 then.call( 7443 returned, 7444 resolve( maxDepth, deferred, Identity, special ), 7445 resolve( maxDepth, deferred, Thrower, special ), 7446 resolve( maxDepth, deferred, Identity, 7447 deferred.notifyWith ) 7448 ); 7449 } 7450 7451 // Handle all other returned values 7452 } else { 7453 7454 // Only substitute handlers pass on context 7455 // and multiple values (non-spec behavior) 7456 if ( handler !== Identity ) { 7457 that = undefined; 7458 args = [ returned ]; 7459 } 7460 7461 // Process the value(s) 7462 // Default process is resolve 7463 ( special || deferred.resolveWith )( that, args ); 7464 } 7465 }, 7466 7467 // Only normal processors (resolve) catch and reject exceptions 7468 process = special ? 7469 mightThrow : 7470 function() { 7471 try { 7472 mightThrow(); 7473 } catch ( e ) { 7474 7475 if ( jQuery.Deferred.exceptionHook ) { 7476 jQuery.Deferred.exceptionHook( e, 7477 process.error ); 7478 } 7479 7480 // Support: Promises/A+ section 2.3.3.3.4.1 7481 // https://promisesaplus.com/#point-61 7482 // Ignore post-resolution exceptions 7483 if ( depth + 1 >= maxDepth ) { 7484 7485 // Only substitute handlers pass on context 7486 // and multiple values (non-spec behavior) 7487 if ( handler !== Thrower ) { 7488 that = undefined; 7489 args = [ e ]; 7490 } 7491 7492 deferred.rejectWith( that, args ); 7493 } 7494 } 7495 }; 7496 7497 // Support: Promises/A+ section 2.3.3.3.1 7498 // https://promisesaplus.com/#point-57 7499 // Re-resolve promises immediately to dodge false rejection from 7500 // subsequent errors 7501 if ( depth ) { 7502 process(); 7503 } else { 7504 7505 // Call an optional hook to record the error, in case of exception 7506 // since it's otherwise lost when execution goes async 7507 if ( jQuery.Deferred.getErrorHook ) { 7508 process.error = jQuery.Deferred.getErrorHook(); 7509 7510 // The deprecated alias of the above. While the name suggests 7511 // returning the stack, not an error instance, jQuery just passes 7512 // it directly to `console.warn` so both will work; an instance 7513 // just better cooperates with source maps. 7514 } else if ( jQuery.Deferred.getStackHook ) { 7515 process.error = jQuery.Deferred.getStackHook(); 7516 } 7517 window.setTimeout( process ); 7518 } 7519 }; 7520 } 7521 7522 return jQuery.Deferred( function( newDefer ) { 7523 7524 // progress_handlers.add( ... ) 7525 tuples[ 0 ][ 3 ].add( 7526 resolve( 7527 0, 7528 newDefer, 7529 isFunction( onProgress ) ? 7530 onProgress : 7531 Identity, 7532 newDefer.notifyWith 7533 ) 7534 ); 7535 7536 // fulfilled_handlers.add( ... ) 7537 tuples[ 1 ][ 3 ].add( 7538 resolve( 7539 0, 7540 newDefer, 7541 isFunction( onFulfilled ) ? 7542 onFulfilled : 7543 Identity 7544 ) 7545 ); 7546 7547 // rejected_handlers.add( ... ) 7548 tuples[ 2 ][ 3 ].add( 7549 resolve( 7550 0, 7551 newDefer, 7552 isFunction( onRejected ) ? 7553 onRejected : 7554 Thrower 7555 ) 7556 ); 7557 } ).promise(); 7558 }, 7559 7560 // Get a promise for this deferred 7561 // If obj is provided, the promise aspect is added to the object 7562 promise: function( obj ) { 7563 return obj != null ? jQuery.extend( obj, promise ) : promise; 7564 } 7565 }, 7566 deferred = {}; 7567 7568 // Add list-specific methods 7569 jQuery.each( tuples, function( i, tuple ) { 7570 var list = tuple[ 2 ], 7571 stateString = tuple[ 5 ]; 7572 7573 // promise.progress = list.add 7574 // promise.done = list.add 7575 // promise.fail = list.add 7576 promise[ tuple[ 1 ] ] = list.add; 7577 7578 // Handle state 7579 if ( stateString ) { 7580 list.add( 7581 function() { 7582 7583 // state = "resolved" (i.e., fulfilled) 7584 // state = "rejected" 7585 state = stateString; 7586 }, 7587 7588 // rejected_callbacks.disable 7589 // fulfilled_callbacks.disable 7590 tuples[ 3 - i ][ 2 ].disable, 7591 7592 // rejected_handlers.disable 7593 // fulfilled_handlers.disable 7594 tuples[ 3 - i ][ 3 ].disable, 7595 7596 // progress_callbacks.lock 7597 tuples[ 0 ][ 2 ].lock, 7598 7599 // progress_handlers.lock 7600 tuples[ 0 ][ 3 ].lock 7601 ); 7602 } 7603 7604 // progress_handlers.fire 7605 // fulfilled_handlers.fire 7606 // rejected_handlers.fire 7607 list.add( tuple[ 3 ].fire ); 7608 7609 // deferred.notify = function() { deferred.notifyWith(...) } 7610 // deferred.resolve = function() { deferred.resolveWith(...) } 7611 // deferred.reject = function() { deferred.rejectWith(...) } 7612 deferred[ tuple[ 0 ] ] = function() { 7613 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 7614 return this; 7615 }; 7616 7617 // deferred.notifyWith = list.fireWith 7618 // deferred.resolveWith = list.fireWith 7619 // deferred.rejectWith = list.fireWith 7620 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 7621 } ); 7622 7623 // Make the deferred a promise 7624 promise.promise( deferred ); 7625 7626 // Call given func if any 7627 if ( func ) { 7628 func.call( deferred, deferred ); 7629 } 7630 7631 // All done! 7632 return deferred; 7633 }, 7634 7635 // Deferred helper 7636 when: function( singleValue ) { 7637 var 7638 7639 // count of uncompleted subordinates 7640 remaining = arguments.length, 7641 7642 // count of unprocessed arguments 7643 i = remaining, 7644 7645 // subordinate fulfillment data 7646 resolveContexts = Array( i ), 7647 resolveValues = slice.call( arguments ), 7648 7649 // the primary Deferred 7650 primary = jQuery.Deferred(), 7651 7652 // subordinate callback factory 7653 updateFunc = function( i ) { 7654 return function( value ) { 7655 resolveContexts[ i ] = this; 7656 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 7657 if ( !( --remaining ) ) { 7658 primary.resolveWith( resolveContexts, resolveValues ); 7659 } 7660 }; 7661 }; 7662 7663 // Single- and empty arguments are adopted like Promise.resolve 7664 if ( remaining <= 1 ) { 7665 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 7666 !remaining ); 7667 7668 // Use .then() to unwrap secondary thenables (cf. gh-3000) 7669 if ( primary.state() === "pending" || 7670 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 7671 7672 return primary.then(); 7673 } 7674 } 7675 7676 // Multiple arguments are aggregated like Promise.all array elements 7677 while ( i-- ) { 7678 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 7679 } 7680 7681 return primary.promise(); 7682 } 7683} ); 7684 7685 7686// These usually indicate a programmer mistake during development, 7687// warn about them ASAP rather than swallowing them by default. 7688var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 7689 7690// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error 7691// captured before the async barrier to get the original error cause 7692// which may otherwise be hidden. 7693jQuery.Deferred.exceptionHook = function( error, asyncError ) { 7694 7695 // Support: IE 8 - 9 only 7696 // Console exists when dev tools are open, which can happen at any time 7697 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 7698 window.console.warn( "jQuery.Deferred exception: " + error.message, 7699 error.stack, asyncError ); 7700 } 7701}; 7702 7703 7704 7705 7706jQuery.readyException = function( error ) { 7707 window.setTimeout( function() { 7708 throw error; 7709 } ); 7710}; 7711 7712 7713 7714 7715// The deferred used on DOM ready 7716var readyList = jQuery.Deferred(); 7717 7718jQuery.fn.ready = function( fn ) { 7719 7720 readyList 7721 .then( fn ) 7722 7723 // Wrap jQuery.readyException in a function so that the lookup 7724 // happens at the time of error handling instead of callback 7725 // registration. 7726 .catch( function( error ) { 7727 jQuery.readyException( error ); 7728 } ); 7729 7730 return this; 7731}; 7732 7733jQuery.extend( { 7734 7735 // Is the DOM ready to be used? Set to true once it occurs. 7736 isReady: false, 7737 7738 // A counter to track how many items to wait for before 7739 // the ready event fires. See trac-6781 7740 readyWait: 1, 7741 7742 // Handle when the DOM is ready 7743 ready: function( wait ) { 7744 7745 // Abort if there are pending holds or we're already ready 7746 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 7747 return; 7748 } 7749 7750 // Remember that the DOM is ready 7751 jQuery.isReady = true; 7752 7753 // If a normal DOM Ready event fired, decrement, and wait if need be 7754 if ( wait !== true && --jQuery.readyWait > 0 ) { 7755 return; 7756 } 7757 7758 // If there are functions bound, to execute 7759 readyList.resolveWith( document, [ jQuery ] ); 7760 } 7761} ); 7762 7763jQuery.ready.then = readyList.then; 7764 7765// The ready event handler and self cleanup method 7766function completed() { 7767 document.removeEventListener( "DOMContentLoaded", completed ); 7768 window.removeEventListener( "load", completed ); 7769 jQuery.ready(); 7770} 7771 7772// Catch cases where $(document).ready() is called 7773// after the browser event has already occurred. 7774// Support: IE <=9 - 10 only 7775// Older IE sometimes signals "interactive" too soon 7776if ( document.readyState === "complete" || 7777 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 7778 7779 // Handle it asynchronously to allow scripts the opportunity to delay ready 7780 window.setTimeout( jQuery.ready ); 7781 7782} else { 7783 7784 // Use the handy event callback 7785 document.addEventListener( "DOMContentLoaded", completed ); 7786 7787 // A fallback to window.onload, that will always work 7788 window.addEventListener( "load", completed ); 7789} 7790 7791 7792 7793 7794// Multifunctional method to get and set values of a collection 7795// The value/s can optionally be executed if it's a function 7796var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 7797 var i = 0, 7798 len = elems.length, 7799 bulk = key == null; 7800 7801 // Sets many values 7802 if ( toType( key ) === "object" ) { 7803 chainable = true; 7804 for ( i in key ) { 7805 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 7806 } 7807 7808 // Sets one value 7809 } else if ( value !== undefined ) { 7810 chainable = true; 7811 7812 if ( !isFunction( value ) ) { 7813 raw = true; 7814 } 7815 7816 if ( bulk ) { 7817 7818 // Bulk operations run against the entire set 7819 if ( raw ) { 7820 fn.call( elems, value ); 7821 fn = null; 7822 7823 // ...except when executing function values 7824 } else { 7825 bulk = fn; 7826 fn = function( elem, _key, value ) { 7827 return bulk.call( jQuery( elem ), value ); 7828 }; 7829 } 7830 } 7831 7832 if ( fn ) { 7833 for ( ; i < len; i++ ) { 7834 fn( 7835 elems[ i ], key, raw ? 7836 value : 7837 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 7838 ); 7839 } 7840 } 7841 } 7842 7843 if ( chainable ) { 7844 return elems; 7845 } 7846 7847 // Gets 7848 if ( bulk ) { 7849 return fn.call( elems ); 7850 } 7851 7852 return len ? fn( elems[ 0 ], key ) : emptyGet; 7853}; 7854 7855 7856// Matches dashed string for camelizing 7857var rmsPrefix = /^-ms-/, 7858 rdashAlpha = /-([a-z])/g; 7859 7860// Used by camelCase as callback to replace() 7861function fcamelCase( _all, letter ) { 7862 return letter.toUpperCase(); 7863} 7864 7865// Convert dashed to camelCase; used by the css and data modules 7866// Support: IE <=9 - 11, Edge 12 - 15 7867// Microsoft forgot to hump their vendor prefix (trac-9572) 7868function camelCase( string ) { 7869 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 7870} 7871var acceptData = function( owner ) { 7872 7873 // Accepts only: 7874 // - Node 7875 // - Node.ELEMENT_NODE 7876 // - Node.DOCUMENT_NODE 7877 // - Object 7878 // - Any 7879 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 7880}; 7881 7882 7883 7884 7885function Data() { 7886 this.expando = jQuery.expando + Data.uid++; 7887} 7888 7889Data.uid = 1; 7890 7891Data.prototype = { 7892 7893 cache: function( owner ) { 7894 7895 // Check if the owner object already has a cache 7896 var value = owner[ this.expando ]; 7897 7898 // If not, create one 7899 if ( !value ) { 7900 value = {}; 7901 7902 // We can accept data for non-element nodes in modern browsers, 7903 // but we should not, see trac-8335. 7904 // Always return an empty object. 7905 if ( acceptData( owner ) ) { 7906 7907 // If it is a node unlikely to be stringify-ed or looped over 7908 // use plain assignment 7909 if ( owner.nodeType ) { 7910 owner[ this.expando ] = value; 7911 7912 // Otherwise secure it in a non-enumerable property 7913 // configurable must be true to allow the property to be 7914 // deleted when data is removed 7915 } else { 7916 Object.defineProperty( owner, this.expando, { 7917 value: value, 7918 configurable: true 7919 } ); 7920 } 7921 } 7922 } 7923 7924 return value; 7925 }, 7926 set: function( owner, data, value ) { 7927 var prop, 7928 cache = this.cache( owner ); 7929 7930 // Handle: [ owner, key, value ] args 7931 // Always use camelCase key (gh-2257) 7932 if ( typeof data === "string" ) { 7933 cache[ camelCase( data ) ] = value; 7934 7935 // Handle: [ owner, { properties } ] args 7936 } else { 7937 7938 // Copy the properties one-by-one to the cache object 7939 for ( prop in data ) { 7940 cache[ camelCase( prop ) ] = data[ prop ]; 7941 } 7942 } 7943 return cache; 7944 }, 7945 get: function( owner, key ) { 7946 return key === undefined ? 7947 this.cache( owner ) : 7948 7949 // Always use camelCase key (gh-2257) 7950 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 7951 }, 7952 access: function( owner, key, value ) { 7953 7954 // In cases where either: 7955 // 7956 // 1. No key was specified 7957 // 2. A string key was specified, but no value provided 7958 // 7959 // Take the "read" path and allow the get method to determine 7960 // which value to return, respectively either: 7961 // 7962 // 1. The entire cache object 7963 // 2. The data stored at the key 7964 // 7965 if ( key === undefined || 7966 ( ( key && typeof key === "string" ) && value === undefined ) ) { 7967 7968 return this.get( owner, key ); 7969 } 7970 7971 // When the key is not a string, or both a key and value 7972 // are specified, set or extend (existing objects) with either: 7973 // 7974 // 1. An object of properties 7975 // 2. A key and value 7976 // 7977 this.set( owner, key, value ); 7978 7979 // Since the "set" path can have two possible entry points 7980 // return the expected data based on which path was taken[*] 7981 return value !== undefined ? value : key; 7982 }, 7983 remove: function( owner, key ) { 7984 var i, 7985 cache = owner[ this.expando ]; 7986 7987 if ( cache === undefined ) { 7988 return; 7989 } 7990 7991 if ( key !== undefined ) { 7992 7993 // Support array or space separated string of keys 7994 if ( Array.isArray( key ) ) { 7995 7996 // If key is an array of keys... 7997 // We always set camelCase keys, so remove that. 7998 key = key.map( camelCase ); 7999 } else { 8000 key = camelCase( key ); 8001 8002 // If a key with the spaces exists, use it. 8003 // Otherwise, create an array by matching non-whitespace 8004 key = key in cache ? 8005 [ key ] : 8006 ( key.match( rnothtmlwhite ) || [] ); 8007 } 8008 8009 i = key.length; 8010 8011 while ( i-- ) { 8012 delete cache[ key[ i ] ]; 8013 } 8014 } 8015 8016 // Remove the expando if there's no more data 8017 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 8018 8019 // Support: Chrome <=35 - 45 8020 // Webkit & Blink performance suffers when deleting properties 8021 // from DOM nodes, so set to undefined instead 8022 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 8023 if ( owner.nodeType ) { 8024 owner[ this.expando ] = undefined; 8025 } else { 8026 delete owner[ this.expando ]; 8027 } 8028 } 8029 }, 8030 hasData: function( owner ) { 8031 var cache = owner[ this.expando ]; 8032 return cache !== undefined && !jQuery.isEmptyObject( cache ); 8033 } 8034}; 8035var dataPriv = new Data(); 8036 8037var dataUser = new Data(); 8038 8039 8040 8041// Implementation Summary 8042// 8043// 1. Enforce API surface and semantic compatibility with 1.9.x branch 8044// 2. Improve the module's maintainability by reducing the storage 8045// paths to a single mechanism. 8046// 3. Use the same single mechanism to support "private" and "user" data. 8047// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 8048// 5. Avoid exposing implementation details on user objects (eg. expando properties) 8049// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 8050 8051var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 8052 rmultiDash = /[A-Z]/g; 8053 8054function getData( data ) { 8055 if ( data === "true" ) { 8056 return true; 8057 } 8058 8059 if ( data === "false" ) { 8060 return false; 8061 } 8062 8063 if ( data === "null" ) { 8064 return null; 8065 } 8066 8067 // Only convert to a number if it doesn't change the string 8068 if ( data === +data + "" ) { 8069 return +data; 8070 } 8071 8072 if ( rbrace.test( data ) ) { 8073 return JSON.parse( data ); 8074 } 8075 8076 return data; 8077} 8078 8079function dataAttr( elem, key, data ) { 8080 var name; 8081 8082 // If nothing was found internally, try to fetch any 8083 // data from the HTML5 data-* attribute 8084 if ( data === undefined && elem.nodeType === 1 ) { 8085 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 8086 data = elem.getAttribute( name ); 8087 8088 if ( typeof data === "string" ) { 8089 try { 8090 data = getData( data ); 8091 } catch ( e ) {} 8092 8093 // Make sure we set the data so it isn't changed later 8094 dataUser.set( elem, key, data ); 8095 } else { 8096 data = undefined; 8097 } 8098 } 8099 return data; 8100} 8101 8102jQuery.extend( { 8103 hasData: function( elem ) { 8104 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 8105 }, 8106 8107 data: function( elem, name, data ) { 8108 return dataUser.access( elem, name, data ); 8109 }, 8110 8111 removeData: function( elem, name ) { 8112 dataUser.remove( elem, name ); 8113 }, 8114 8115 // TODO: Now that all calls to _data and _removeData have been replaced 8116 // with direct calls to dataPriv methods, these can be deprecated. 8117 _data: function( elem, name, data ) { 8118 return dataPriv.access( elem, name, data ); 8119 }, 8120 8121 _removeData: function( elem, name ) { 8122 dataPriv.remove( elem, name ); 8123 } 8124} ); 8125 8126jQuery.fn.extend( { 8127 data: function( key, value ) { 8128 var i, name, data, 8129 elem = this[ 0 ], 8130 attrs = elem && elem.attributes; 8131 8132 // Gets all values 8133 if ( key === undefined ) { 8134 if ( this.length ) { 8135 data = dataUser.get( elem ); 8136 8137 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 8138 i = attrs.length; 8139 while ( i-- ) { 8140 8141 // Support: IE 11 only 8142 // The attrs elements can be null (trac-14894) 8143 if ( attrs[ i ] ) { 8144 name = attrs[ i ].name; 8145 if ( name.indexOf( "data-" ) === 0 ) { 8146 name = camelCase( name.slice( 5 ) ); 8147 dataAttr( elem, name, data[ name ] ); 8148 } 8149 } 8150 } 8151 dataPriv.set( elem, "hasDataAttrs", true ); 8152 } 8153 } 8154 8155 return data; 8156 } 8157 8158 // Sets multiple values 8159 if ( typeof key === "object" ) { 8160 return this.each( function() { 8161 dataUser.set( this, key ); 8162 } ); 8163 } 8164 8165 return access( this, function( value ) { 8166 var data; 8167 8168 // The calling jQuery object (element matches) is not empty 8169 // (and therefore has an element appears at this[ 0 ]) and the 8170 // `value` parameter was not undefined. An empty jQuery object 8171 // will result in `undefined` for elem = this[ 0 ] which will 8172 // throw an exception if an attempt to read a data cache is made. 8173 if ( elem && value === undefined ) { 8174 8175 // Attempt to get data from the cache 8176 // The key will always be camelCased in Data 8177 data = dataUser.get( elem, key ); 8178 if ( data !== undefined ) { 8179 return data; 8180 } 8181 8182 // Attempt to "discover" the data in 8183 // HTML5 custom data-* attrs 8184 data = dataAttr( elem, key ); 8185 if ( data !== undefined ) { 8186 return data; 8187 } 8188 8189 // We tried really hard, but the data doesn't exist. 8190 return; 8191 } 8192 8193 // Set the data... 8194 this.each( function() { 8195 8196 // We always store the camelCased key 8197 dataUser.set( this, key, value ); 8198 } ); 8199 }, null, value, arguments.length > 1, null, true ); 8200 }, 8201 8202 removeData: function( key ) { 8203 return this.each( function() { 8204 dataUser.remove( this, key ); 8205 } ); 8206 } 8207} ); 8208 8209 8210jQuery.extend( { 8211 queue: function( elem, type, data ) { 8212 var queue; 8213 8214 if ( elem ) { 8215 type = ( type || "fx" ) + "queue"; 8216 queue = dataPriv.get( elem, type ); 8217 8218 // Speed up dequeue by getting out quickly if this is just a lookup 8219 if ( data ) { 8220 if ( !queue || Array.isArray( data ) ) { 8221 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 8222 } else { 8223 queue.push( data ); 8224 } 8225 } 8226 return queue || []; 8227 } 8228 }, 8229 8230 dequeue: function( elem, type ) { 8231 type = type || "fx"; 8232 8233 var queue = jQuery.queue( elem, type ), 8234 startLength = queue.length, 8235 fn = queue.shift(), 8236 hooks = jQuery._queueHooks( elem, type ), 8237 next = function() { 8238 jQuery.dequeue( elem, type ); 8239 }; 8240 8241 // If the fx queue is dequeued, always remove the progress sentinel 8242 if ( fn === "inprogress" ) { 8243 fn = queue.shift(); 8244 startLength--; 8245 } 8246 8247 if ( fn ) { 8248 8249 // Add a progress sentinel to prevent the fx queue from being 8250 // automatically dequeued 8251 if ( type === "fx" ) { 8252 queue.unshift( "inprogress" ); 8253 } 8254 8255 // Clear up the last queue stop function 8256 delete hooks.stop; 8257 fn.call( elem, next, hooks ); 8258 } 8259 8260 if ( !startLength && hooks ) { 8261 hooks.empty.fire(); 8262 } 8263 }, 8264 8265 // Not public - generate a queueHooks object, or return the current one 8266 _queueHooks: function( elem, type ) { 8267 var key = type + "queueHooks"; 8268 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 8269 empty: jQuery.Callbacks( "once memory" ).add( function() { 8270 dataPriv.remove( elem, [ type + "queue", key ] ); 8271 } ) 8272 } ); 8273 } 8274} ); 8275 8276jQuery.fn.extend( { 8277 queue: function( type, data ) { 8278 var setter = 2; 8279 8280 if ( typeof type !== "string" ) { 8281 data = type; 8282 type = "fx"; 8283 setter--; 8284 } 8285 8286 if ( arguments.length < setter ) { 8287 return jQuery.queue( this[ 0 ], type ); 8288 } 8289 8290 return data === undefined ? 8291 this : 8292 this.each( function() { 8293 var queue = jQuery.queue( this, type, data ); 8294 8295 // Ensure a hooks for this queue 8296 jQuery._queueHooks( this, type ); 8297 8298 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 8299 jQuery.dequeue( this, type ); 8300 } 8301 } ); 8302 }, 8303 dequeue: function( type ) { 8304 return this.each( function() { 8305 jQuery.dequeue( this, type ); 8306 } ); 8307 }, 8308 clearQueue: function( type ) { 8309 return this.queue( type || "fx", [] ); 8310 }, 8311 8312 // Get a promise resolved when queues of a certain type 8313 // are emptied (fx is the type by default) 8314 promise: function( type, obj ) { 8315 var tmp, 8316 count = 1, 8317 defer = jQuery.Deferred(), 8318 elements = this, 8319 i = this.length, 8320 resolve = function() { 8321 if ( !( --count ) ) { 8322 defer.resolveWith( elements, [ elements ] ); 8323 } 8324 }; 8325 8326 if ( typeof type !== "string" ) { 8327 obj = type; 8328 type = undefined; 8329 } 8330 type = type || "fx"; 8331 8332 while ( i-- ) { 8333 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 8334 if ( tmp && tmp.empty ) { 8335 count++; 8336 tmp.empty.add( resolve ); 8337 } 8338 } 8339 resolve(); 8340 return defer.promise( obj ); 8341 } 8342} ); 8343var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 8344 8345var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 8346 8347 8348var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 8349 8350var documentElement = document.documentElement; 8351 8352 8353 8354 var isAttached = function( elem ) { 8355 return jQuery.contains( elem.ownerDocument, elem ); 8356 }, 8357 composed = { composed: true }; 8358 8359 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 8360 // Check attachment across shadow DOM boundaries when possible (gh-3504) 8361 // Support: iOS 10.0-10.2 only 8362 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 8363 // leading to errors. We need to check for `getRootNode`. 8364 if ( documentElement.getRootNode ) { 8365 isAttached = function( elem ) { 8366 return jQuery.contains( elem.ownerDocument, elem ) || 8367 elem.getRootNode( composed ) === elem.ownerDocument; 8368 }; 8369 } 8370var isHiddenWithinTree = function( elem, el ) { 8371 8372 // isHiddenWithinTree might be called from jQuery#filter function; 8373 // in that case, element will be second argument 8374 elem = el || elem; 8375 8376 // Inline style trumps all 8377 return elem.style.display === "none" || 8378 elem.style.display === "" && 8379 8380 // Otherwise, check computed style 8381 // Support: Firefox <=43 - 45 8382 // Disconnected elements can have computed display: none, so first confirm that elem is 8383 // in the document. 8384 isAttached( elem ) && 8385 8386 jQuery.css( elem, "display" ) === "none"; 8387 }; 8388 8389 8390 8391function adjustCSS( elem, prop, valueParts, tween ) { 8392 var adjusted, scale, 8393 maxIterations = 20, 8394 currentValue = tween ? 8395 function() { 8396 return tween.cur(); 8397 } : 8398 function() { 8399 return jQuery.css( elem, prop, "" ); 8400 }, 8401 initial = currentValue(), 8402 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 8403 8404 // Starting value computation is required for potential unit mismatches 8405 initialInUnit = elem.nodeType && 8406 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 8407 rcssNum.exec( jQuery.css( elem, prop ) ); 8408 8409 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 8410 8411 // Support: Firefox <=54 8412 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 8413 initial = initial / 2; 8414 8415 // Trust units reported by jQuery.css 8416 unit = unit || initialInUnit[ 3 ]; 8417 8418 // Iteratively approximate from a nonzero starting point 8419 initialInUnit = +initial || 1; 8420 8421 while ( maxIterations-- ) { 8422 8423 // Evaluate and update our best guess (doubling guesses that zero out). 8424 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 8425 jQuery.style( elem, prop, initialInUnit + unit ); 8426 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 8427 maxIterations = 0; 8428 } 8429 initialInUnit = initialInUnit / scale; 8430 8431 } 8432 8433 initialInUnit = initialInUnit * 2; 8434 jQuery.style( elem, prop, initialInUnit + unit ); 8435 8436 // Make sure we update the tween properties later on 8437 valueParts = valueParts || []; 8438 } 8439 8440 if ( valueParts ) { 8441 initialInUnit = +initialInUnit || +initial || 0; 8442 8443 // Apply relative offset (+=/-=) if specified 8444 adjusted = valueParts[ 1 ] ? 8445 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 8446 +valueParts[ 2 ]; 8447 if ( tween ) { 8448 tween.unit = unit; 8449 tween.start = initialInUnit; 8450 tween.end = adjusted; 8451 } 8452 } 8453 return adjusted; 8454} 8455 8456 8457var defaultDisplayMap = {}; 8458 8459function getDefaultDisplay( elem ) { 8460 var temp, 8461 doc = elem.ownerDocument, 8462 nodeName = elem.nodeName, 8463 display = defaultDisplayMap[ nodeName ]; 8464 8465 if ( display ) { 8466 return display; 8467 } 8468 8469 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 8470 display = jQuery.css( temp, "display" ); 8471 8472 temp.parentNode.removeChild( temp ); 8473 8474 if ( display === "none" ) { 8475 display = "block"; 8476 } 8477 defaultDisplayMap[ nodeName ] = display; 8478 8479 return display; 8480} 8481 8482function showHide( elements, show ) { 8483 var display, elem, 8484 values = [], 8485 index = 0, 8486 length = elements.length; 8487 8488 // Determine new display value for elements that need to change 8489 for ( ; index < length; index++ ) { 8490 elem = elements[ index ]; 8491 if ( !elem.style ) { 8492 continue; 8493 } 8494 8495 display = elem.style.display; 8496 if ( show ) { 8497 8498 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 8499 // check is required in this first loop unless we have a nonempty display value (either 8500 // inline or about-to-be-restored) 8501 if ( display === "none" ) { 8502 values[ index ] = dataPriv.get( elem, "display" ) || null; 8503 if ( !values[ index ] ) { 8504 elem.style.display = ""; 8505 } 8506 } 8507 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 8508 values[ index ] = getDefaultDisplay( elem ); 8509 } 8510 } else { 8511 if ( display !== "none" ) { 8512 values[ index ] = "none"; 8513 8514 // Remember what we're overwriting 8515 dataPriv.set( elem, "display", display ); 8516 } 8517 } 8518 } 8519 8520 // Set the display of the elements in a second loop to avoid constant reflow 8521 for ( index = 0; index < length; index++ ) { 8522 if ( values[ index ] != null ) { 8523 elements[ index ].style.display = values[ index ]; 8524 } 8525 } 8526 8527 return elements; 8528} 8529 8530jQuery.fn.extend( { 8531 show: function() { 8532 return showHide( this, true ); 8533 }, 8534 hide: function() { 8535 return showHide( this ); 8536 }, 8537 toggle: function( state ) { 8538 if ( typeof state === "boolean" ) { 8539 return state ? this.show() : this.hide(); 8540 } 8541 8542 return this.each( function() { 8543 if ( isHiddenWithinTree( this ) ) { 8544 jQuery( this ).show(); 8545 } else { 8546 jQuery( this ).hide(); 8547 } 8548 } ); 8549 } 8550} ); 8551var rcheckableType = ( /^(?:checkbox|radio)$/i ); 8552 8553var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 8554 8555var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 8556 8557 8558 8559( function() { 8560 var fragment = document.createDocumentFragment(), 8561 div = fragment.appendChild( document.createElement( "div" ) ), 8562 input = document.createElement( "input" ); 8563 8564 // Support: Android 4.0 - 4.3 only 8565 // Check state lost if the name is set (trac-11217) 8566 // Support: Windows Web Apps (WWA) 8567 // `name` and `type` must use .setAttribute for WWA (trac-14901) 8568 input.setAttribute( "type", "radio" ); 8569 input.setAttribute( "checked", "checked" ); 8570 input.setAttribute( "name", "t" ); 8571 8572 div.appendChild( input ); 8573 8574 // Support: Android <=4.1 only 8575 // Older WebKit doesn't clone checked state correctly in fragments 8576 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 8577 8578 // Support: IE <=11 only 8579 // Make sure textarea (and checkbox) defaultValue is properly cloned 8580 div.innerHTML = "<textarea>x</textarea>"; 8581 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 8582 8583 // Support: IE <=9 only 8584 // IE <=9 replaces <option> tags with their contents when inserted outside of 8585 // the select element. 8586 div.innerHTML = "<option></option>"; 8587 support.option = !!div.lastChild; 8588} )(); 8589 8590 8591// We have to close these tags to support XHTML (trac-13200) 8592var wrapMap = { 8593 8594 // XHTML parsers do not magically insert elements in the 8595 // same way that tag soup parsers do. So we cannot shorten 8596 // this by omitting <tbody> or other required elements. 8597 thead: [ 1, "<table>", "</table>" ], 8598 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 8599 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 8600 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 8601 8602 _default: [ 0, "", "" ] 8603}; 8604 8605wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 8606wrapMap.th = wrapMap.td; 8607 8608// Support: IE <=9 only 8609if ( !support.option ) { 8610 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 8611} 8612 8613 8614function getAll( context, tag ) { 8615 8616 // Support: IE <=9 - 11 only 8617 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 8618 var ret; 8619 8620 if ( typeof context.getElementsByTagName !== "undefined" ) { 8621 ret = context.getElementsByTagName( tag || "*" ); 8622 8623 } else if ( typeof context.querySelectorAll !== "undefined" ) { 8624 ret = context.querySelectorAll( tag || "*" ); 8625 8626 } else { 8627 ret = []; 8628 } 8629 8630 if ( tag === undefined || tag && nodeName( context, tag ) ) { 8631 return jQuery.merge( [ context ], ret ); 8632 } 8633 8634 return ret; 8635} 8636 8637 8638// Mark scripts as having already been evaluated 8639function setGlobalEval( elems, refElements ) { 8640 var i = 0, 8641 l = elems.length; 8642 8643 for ( ; i < l; i++ ) { 8644 dataPriv.set( 8645 elems[ i ], 8646 "globalEval", 8647 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 8648 ); 8649 } 8650} 8651 8652 8653var rhtml = /<|&#?\w+;/; 8654 8655function buildFragment( elems, context, scripts, selection, ignored ) { 8656 var elem, tmp, tag, wrap, attached, j, 8657 fragment = context.createDocumentFragment(), 8658 nodes = [], 8659 i = 0, 8660 l = elems.length; 8661 8662 for ( ; i < l; i++ ) { 8663 elem = elems[ i ]; 8664 8665 if ( elem || elem === 0 ) { 8666 8667 // Add nodes directly 8668 if ( toType( elem ) === "object" ) { 8669 8670 // Support: Android <=4.0 only, PhantomJS 1 only 8671 // push.apply(_, arraylike) throws on ancient WebKit 8672 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 8673 8674 // Convert non-html into a text node 8675 } else if ( !rhtml.test( elem ) ) { 8676 nodes.push( context.createTextNode( elem ) ); 8677 8678 // Convert html into DOM nodes 8679 } else { 8680 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 8681 8682 // Deserialize a standard representation 8683 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 8684 wrap = wrapMap[ tag ] || wrapMap._default; 8685 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 8686 8687 // Descend through wrappers to the right content 8688 j = wrap[ 0 ]; 8689 while ( j-- ) { 8690 tmp = tmp.lastChild; 8691 } 8692 8693 // Support: Android <=4.0 only, PhantomJS 1 only 8694 // push.apply(_, arraylike) throws on ancient WebKit 8695 jQuery.merge( nodes, tmp.childNodes ); 8696 8697 // Remember the top-level container 8698 tmp = fragment.firstChild; 8699 8700 // Ensure the created nodes are orphaned (trac-12392) 8701 tmp.textContent = ""; 8702 } 8703 } 8704 } 8705 8706 // Remove wrapper from fragment 8707 fragment.textContent = ""; 8708 8709 i = 0; 8710 while ( ( elem = nodes[ i++ ] ) ) { 8711 8712 // Skip elements already in the context collection (trac-4087) 8713 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 8714 if ( ignored ) { 8715 ignored.push( elem ); 8716 } 8717 continue; 8718 } 8719 8720 attached = isAttached( elem ); 8721 8722 // Append to fragment 8723 tmp = getAll( fragment.appendChild( elem ), "script" ); 8724 8725 // Preserve script evaluation history 8726 if ( attached ) { 8727 setGlobalEval( tmp ); 8728 } 8729 8730 // Capture executables 8731 if ( scripts ) { 8732 j = 0; 8733 while ( ( elem = tmp[ j++ ] ) ) { 8734 if ( rscriptType.test( elem.type || "" ) ) { 8735 scripts.push( elem ); 8736 } 8737 } 8738 } 8739 } 8740 8741 return fragment; 8742} 8743 8744 8745var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 8746 8747function returnTrue() { 8748 return true; 8749} 8750 8751function returnFalse() { 8752 return false; 8753} 8754 8755function on( elem, types, selector, data, fn, one ) { 8756 var origFn, type; 8757 8758 // Types can be a map of types/handlers 8759 if ( typeof types === "object" ) { 8760 8761 // ( types-Object, selector, data ) 8762 if ( typeof selector !== "string" ) { 8763 8764 // ( types-Object, data ) 8765 data = data || selector; 8766 selector = undefined; 8767 } 8768 for ( type in types ) { 8769 on( elem, type, selector, data, types[ type ], one ); 8770 } 8771 return elem; 8772 } 8773 8774 if ( data == null && fn == null ) { 8775 8776 // ( types, fn ) 8777 fn = selector; 8778 data = selector = undefined; 8779 } else if ( fn == null ) { 8780 if ( typeof selector === "string" ) { 8781 8782 // ( types, selector, fn ) 8783 fn = data; 8784 data = undefined; 8785 } else { 8786 8787 // ( types, data, fn ) 8788 fn = data; 8789 data = selector; 8790 selector = undefined; 8791 } 8792 } 8793 if ( fn === false ) { 8794 fn = returnFalse; 8795 } else if ( !fn ) { 8796 return elem; 8797 } 8798 8799 if ( one === 1 ) { 8800 origFn = fn; 8801 fn = function( event ) { 8802 8803 // Can use an empty set, since event contains the info 8804 jQuery().off( event ); 8805 return origFn.apply( this, arguments ); 8806 }; 8807 8808 // Use same guid so caller can remove using origFn 8809 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 8810 } 8811 return elem.each( function() { 8812 jQuery.event.add( this, types, fn, data, selector ); 8813 } ); 8814} 8815 8816/* 8817 * Helper functions for managing events -- not part of the public interface. 8818 * Props to Dean Edwards' addEvent library for many of the ideas. 8819 */ 8820jQuery.event = { 8821 8822 global: {}, 8823 8824 add: function( elem, types, handler, data, selector ) { 8825 8826 var handleObjIn, eventHandle, tmp, 8827 events, t, handleObj, 8828 special, handlers, type, namespaces, origType, 8829 elemData = dataPriv.get( elem ); 8830 8831 // Only attach events to objects that accept data 8832 if ( !acceptData( elem ) ) { 8833 return; 8834 } 8835 8836 // Caller can pass in an object of custom data in lieu of the handler 8837 if ( handler.handler ) { 8838 handleObjIn = handler; 8839 handler = handleObjIn.handler; 8840 selector = handleObjIn.selector; 8841 } 8842 8843 // Ensure that invalid selectors throw exceptions at attach time 8844 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 8845 if ( selector ) { 8846 jQuery.find.matchesSelector( documentElement, selector ); 8847 } 8848 8849 // Make sure that the handler has a unique ID, used to find/remove it later 8850 if ( !handler.guid ) { 8851 handler.guid = jQuery.guid++; 8852 } 8853 8854 // Init the element's event structure and main handler, if this is the first 8855 if ( !( events = elemData.events ) ) { 8856 events = elemData.events = Object.create( null ); 8857 } 8858 if ( !( eventHandle = elemData.handle ) ) { 8859 eventHandle = elemData.handle = function( e ) { 8860 8861 // Discard the second event of a jQuery.event.trigger() and 8862 // when an event is called after a page has unloaded 8863 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 8864 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 8865 }; 8866 } 8867 8868 // Handle multiple events separated by a space 8869 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 8870 t = types.length; 8871 while ( t-- ) { 8872 tmp = rtypenamespace.exec( types[ t ] ) || []; 8873 type = origType = tmp[ 1 ]; 8874 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 8875 8876 // There *must* be a type, no attaching namespace-only handlers 8877 if ( !type ) { 8878 continue; 8879 } 8880 8881 // If event changes its type, use the special event handlers for the changed type 8882 special = jQuery.event.special[ type ] || {}; 8883 8884 // If selector defined, determine special event api type, otherwise given type 8885 type = ( selector ? special.delegateType : special.bindType ) || type; 8886 8887 // Update special based on newly reset type 8888 special = jQuery.event.special[ type ] || {}; 8889 8890 // handleObj is passed to all event handlers 8891 handleObj = jQuery.extend( { 8892 type: type, 8893 origType: origType, 8894 data: data, 8895 handler: handler, 8896 guid: handler.guid, 8897 selector: selector, 8898 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 8899 namespace: namespaces.join( "." ) 8900 }, handleObjIn ); 8901 8902 // Init the event handler queue if we're the first 8903 if ( !( handlers = events[ type ] ) ) { 8904 handlers = events[ type ] = []; 8905 handlers.delegateCount = 0; 8906 8907 // Only use addEventListener if the special events handler returns false 8908 if ( !special.setup || 8909 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 8910 8911 if ( elem.addEventListener ) { 8912 elem.addEventListener( type, eventHandle ); 8913 } 8914 } 8915 } 8916 8917 if ( special.add ) { 8918 special.add.call( elem, handleObj ); 8919 8920 if ( !handleObj.handler.guid ) { 8921 handleObj.handler.guid = handler.guid; 8922 } 8923 } 8924 8925 // Add to the element's handler list, delegates in front 8926 if ( selector ) { 8927 handlers.splice( handlers.delegateCount++, 0, handleObj ); 8928 } else { 8929 handlers.push( handleObj ); 8930 } 8931 8932 // Keep track of which events have ever been used, for event optimization 8933 jQuery.event.global[ type ] = true; 8934 } 8935 8936 }, 8937 8938 // Detach an event or set of events from an element 8939 remove: function( elem, types, handler, selector, mappedTypes ) { 8940 8941 var j, origCount, tmp, 8942 events, t, handleObj, 8943 special, handlers, type, namespaces, origType, 8944 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 8945 8946 if ( !elemData || !( events = elemData.events ) ) { 8947 return; 8948 } 8949 8950 // Once for each type.namespace in types; type may be omitted 8951 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 8952 t = types.length; 8953 while ( t-- ) { 8954 tmp = rtypenamespace.exec( types[ t ] ) || []; 8955 type = origType = tmp[ 1 ]; 8956 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 8957 8958 // Unbind all events (on this namespace, if provided) for the element 8959 if ( !type ) { 8960 for ( type in events ) { 8961 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 8962 } 8963 continue; 8964 } 8965 8966 special = jQuery.event.special[ type ] || {}; 8967 type = ( selector ? special.delegateType : special.bindType ) || type; 8968 handlers = events[ type ] || []; 8969 tmp = tmp[ 2 ] && 8970 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 8971 8972 // Remove matching events 8973 origCount = j = handlers.length; 8974 while ( j-- ) { 8975 handleObj = handlers[ j ]; 8976 8977 if ( ( mappedTypes || origType === handleObj.origType ) && 8978 ( !handler || handler.guid === handleObj.guid ) && 8979 ( !tmp || tmp.test( handleObj.namespace ) ) && 8980 ( !selector || selector === handleObj.selector || 8981 selector === "**" && handleObj.selector ) ) { 8982 handlers.splice( j, 1 ); 8983 8984 if ( handleObj.selector ) { 8985 handlers.delegateCount--; 8986 } 8987 if ( special.remove ) { 8988 special.remove.call( elem, handleObj ); 8989 } 8990 } 8991 } 8992 8993 // Remove generic event handler if we removed something and no more handlers exist 8994 // (avoids potential for endless recursion during removal of special event handlers) 8995 if ( origCount && !handlers.length ) { 8996 if ( !special.teardown || 8997 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 8998 8999 jQuery.removeEvent( elem, type, elemData.handle ); 9000 } 9001 9002 delete events[ type ]; 9003 } 9004 } 9005 9006 // Remove data and the expando if it's no longer used 9007 if ( jQuery.isEmptyObject( events ) ) { 9008 dataPriv.remove( elem, "handle events" ); 9009 } 9010 }, 9011 9012 dispatch: function( nativeEvent ) { 9013 9014 var i, j, ret, matched, handleObj, handlerQueue, 9015 args = new Array( arguments.length ), 9016 9017 // Make a writable jQuery.Event from the native event object 9018 event = jQuery.event.fix( nativeEvent ), 9019 9020 handlers = ( 9021 dataPriv.get( this, "events" ) || Object.create( null ) 9022 )[ event.type ] || [], 9023 special = jQuery.event.special[ event.type ] || {}; 9024 9025 // Use the fix-ed jQuery.Event rather than the (read-only) native event 9026 args[ 0 ] = event; 9027 9028 for ( i = 1; i < arguments.length; i++ ) { 9029 args[ i ] = arguments[ i ]; 9030 } 9031 9032 event.delegateTarget = this; 9033 9034 // Call the preDispatch hook for the mapped type, and let it bail if desired 9035 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 9036 return; 9037 } 9038 9039 // Determine handlers 9040 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 9041 9042 // Run delegates first; they may want to stop propagation beneath us 9043 i = 0; 9044 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 9045 event.currentTarget = matched.elem; 9046 9047 j = 0; 9048 while ( ( handleObj = matched.handlers[ j++ ] ) && 9049 !event.isImmediatePropagationStopped() ) { 9050 9051 // If the event is namespaced, then each handler is only invoked if it is 9052 // specially universal or its namespaces are a superset of the event's. 9053 if ( !event.rnamespace || handleObj.namespace === false || 9054 event.rnamespace.test( handleObj.namespace ) ) { 9055 9056 event.handleObj = handleObj; 9057 event.data = handleObj.data; 9058 9059 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 9060 handleObj.handler ).apply( matched.elem, args ); 9061 9062 if ( ret !== undefined ) { 9063 if ( ( event.result = ret ) === false ) { 9064 event.preventDefault(); 9065 event.stopPropagation(); 9066 } 9067 } 9068 } 9069 } 9070 } 9071 9072 // Call the postDispatch hook for the mapped type 9073 if ( special.postDispatch ) { 9074 special.postDispatch.call( this, event ); 9075 } 9076 9077 return event.result; 9078 }, 9079 9080 handlers: function( event, handlers ) { 9081 var i, handleObj, sel, matchedHandlers, matchedSelectors, 9082 handlerQueue = [], 9083 delegateCount = handlers.delegateCount, 9084 cur = event.target; 9085 9086 // Find delegate handlers 9087 if ( delegateCount && 9088 9089 // Support: IE <=9 9090 // Black-hole SVG <use> instance trees (trac-13180) 9091 cur.nodeType && 9092 9093 // Support: Firefox <=42 9094 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 9095 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 9096 // Support: IE 11 only 9097 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 9098 !( event.type === "click" && event.button >= 1 ) ) { 9099 9100 for ( ; cur !== this; cur = cur.parentNode || this ) { 9101 9102 // Don't check non-elements (trac-13208) 9103 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 9104 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 9105 matchedHandlers = []; 9106 matchedSelectors = {}; 9107 for ( i = 0; i < delegateCount; i++ ) { 9108 handleObj = handlers[ i ]; 9109 9110 // Don't conflict with Object.prototype properties (trac-13203) 9111 sel = handleObj.selector + " "; 9112 9113 if ( matchedSelectors[ sel ] === undefined ) { 9114 matchedSelectors[ sel ] = handleObj.needsContext ? 9115 jQuery( sel, this ).index( cur ) > -1 : 9116 jQuery.find( sel, this, null, [ cur ] ).length; 9117 } 9118 if ( matchedSelectors[ sel ] ) { 9119 matchedHandlers.push( handleObj ); 9120 } 9121 } 9122 if ( matchedHandlers.length ) { 9123 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 9124 } 9125 } 9126 } 9127 } 9128 9129 // Add the remaining (directly-bound) handlers 9130 cur = this; 9131 if ( delegateCount < handlers.length ) { 9132 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 9133 } 9134 9135 return handlerQueue; 9136 }, 9137 9138 addProp: function( name, hook ) { 9139 Object.defineProperty( jQuery.Event.prototype, name, { 9140 enumerable: true, 9141 configurable: true, 9142 9143 get: isFunction( hook ) ? 9144 function() { 9145 if ( this.originalEvent ) { 9146 return hook( this.originalEvent ); 9147 } 9148 } : 9149 function() { 9150 if ( this.originalEvent ) { 9151 return this.originalEvent[ name ]; 9152 } 9153 }, 9154 9155 set: function( value ) { 9156 Object.defineProperty( this, name, { 9157 enumerable: true, 9158 configurable: true, 9159 writable: true, 9160 value: value 9161 } ); 9162 } 9163 } ); 9164 }, 9165 9166 fix: function( originalEvent ) { 9167 return originalEvent[ jQuery.expando ] ? 9168 originalEvent : 9169 new jQuery.Event( originalEvent ); 9170 }, 9171 9172 special: { 9173 load: { 9174 9175 // Prevent triggered image.load events from bubbling to window.load 9176 noBubble: true 9177 }, 9178 click: { 9179 9180 // Utilize native event to ensure correct state for checkable inputs 9181 setup: function( data ) { 9182 9183 // For mutual compressibility with _default, replace `this` access with a local var. 9184 // `|| data` is dead code meant only to preserve the variable through minification. 9185 var el = this || data; 9186 9187 // Claim the first handler 9188 if ( rcheckableType.test( el.type ) && 9189 el.click && nodeName( el, "input" ) ) { 9190 9191 // dataPriv.set( el, "click", ... ) 9192 leverageNative( el, "click", true ); 9193 } 9194 9195 // Return false to allow normal processing in the caller 9196 return false; 9197 }, 9198 trigger: function( data ) { 9199 9200 // For mutual compressibility with _default, replace `this` access with a local var. 9201 // `|| data` is dead code meant only to preserve the variable through minification. 9202 var el = this || data; 9203 9204 // Force setup before triggering a click 9205 if ( rcheckableType.test( el.type ) && 9206 el.click && nodeName( el, "input" ) ) { 9207 9208 leverageNative( el, "click" ); 9209 } 9210 9211 // Return non-false to allow normal event-path propagation 9212 return true; 9213 }, 9214 9215 // For cross-browser consistency, suppress native .click() on links 9216 // Also prevent it if we're currently inside a leveraged native-event stack 9217 _default: function( event ) { 9218 var target = event.target; 9219 return rcheckableType.test( target.type ) && 9220 target.click && nodeName( target, "input" ) && 9221 dataPriv.get( target, "click" ) || 9222 nodeName( target, "a" ); 9223 } 9224 }, 9225 9226 beforeunload: { 9227 postDispatch: function( event ) { 9228 9229 // Support: Firefox 20+ 9230 // Firefox doesn't alert if the returnValue field is not set. 9231 if ( event.result !== undefined && event.originalEvent ) { 9232 event.originalEvent.returnValue = event.result; 9233 } 9234 } 9235 } 9236 } 9237}; 9238 9239// Ensure the presence of an event listener that handles manually-triggered 9240// synthetic events by interrupting progress until reinvoked in response to 9241// *native* events that it fires directly, ensuring that state changes have 9242// already occurred before other listeners are invoked. 9243function leverageNative( el, type, isSetup ) { 9244 9245 // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add 9246 if ( !isSetup ) { 9247 if ( dataPriv.get( el, type ) === undefined ) { 9248 jQuery.event.add( el, type, returnTrue ); 9249 } 9250 return; 9251 } 9252 9253 // Register the controller as a special universal handler for all event namespaces 9254 dataPriv.set( el, type, false ); 9255 jQuery.event.add( el, type, { 9256 namespace: false, 9257 handler: function( event ) { 9258 var result, 9259 saved = dataPriv.get( this, type ); 9260 9261 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 9262 9263 // Interrupt processing of the outer synthetic .trigger()ed event 9264 if ( !saved ) { 9265 9266 // Store arguments for use when handling the inner native event 9267 // There will always be at least one argument (an event object), so this array 9268 // will not be confused with a leftover capture object. 9269 saved = slice.call( arguments ); 9270 dataPriv.set( this, type, saved ); 9271 9272 // Trigger the native event and capture its result 9273 this[ type ](); 9274 result = dataPriv.get( this, type ); 9275 dataPriv.set( this, type, false ); 9276 9277 if ( saved !== result ) { 9278 9279 // Cancel the outer synthetic event 9280 event.stopImmediatePropagation(); 9281 event.preventDefault(); 9282 9283 return result; 9284 } 9285 9286 // If this is an inner synthetic event for an event with a bubbling surrogate 9287 // (focus or blur), assume that the surrogate already propagated from triggering 9288 // the native event and prevent that from happening again here. 9289 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 9290 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 9291 // less bad than duplication. 9292 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 9293 event.stopPropagation(); 9294 } 9295 9296 // If this is a native event triggered above, everything is now in order 9297 // Fire an inner synthetic event with the original arguments 9298 } else if ( saved ) { 9299 9300 // ...and capture the result 9301 dataPriv.set( this, type, jQuery.event.trigger( 9302 saved[ 0 ], 9303 saved.slice( 1 ), 9304 this 9305 ) ); 9306 9307 // Abort handling of the native event by all jQuery handlers while allowing 9308 // native handlers on the same element to run. On target, this is achieved 9309 // by stopping immediate propagation just on the jQuery event. However, 9310 // the native event is re-wrapped by a jQuery one on each level of the 9311 // propagation so the only way to stop it for jQuery is to stop it for 9312 // everyone via native `stopPropagation()`. This is not a problem for 9313 // focus/blur which don't bubble, but it does also stop click on checkboxes 9314 // and radios. We accept this limitation. 9315 event.stopPropagation(); 9316 event.isImmediatePropagationStopped = returnTrue; 9317 } 9318 } 9319 } ); 9320} 9321 9322jQuery.removeEvent = function( elem, type, handle ) { 9323 9324 // This "if" is needed for plain objects 9325 if ( elem.removeEventListener ) { 9326 elem.removeEventListener( type, handle ); 9327 } 9328}; 9329 9330jQuery.Event = function( src, props ) { 9331 9332 // Allow instantiation without the 'new' keyword 9333 if ( !( this instanceof jQuery.Event ) ) { 9334 return new jQuery.Event( src, props ); 9335 } 9336 9337 // Event object 9338 if ( src && src.type ) { 9339 this.originalEvent = src; 9340 this.type = src.type; 9341 9342 // Events bubbling up the document may have been marked as prevented 9343 // by a handler lower down the tree; reflect the correct value. 9344 this.isDefaultPrevented = src.defaultPrevented || 9345 src.defaultPrevented === undefined && 9346 9347 // Support: Android <=2.3 only 9348 src.returnValue === false ? 9349 returnTrue : 9350 returnFalse; 9351 9352 // Create target properties 9353 // Support: Safari <=6 - 7 only 9354 // Target should not be a text node (trac-504, trac-13143) 9355 this.target = ( src.target && src.target.nodeType === 3 ) ? 9356 src.target.parentNode : 9357 src.target; 9358 9359 this.currentTarget = src.currentTarget; 9360 this.relatedTarget = src.relatedTarget; 9361 9362 // Event type 9363 } else { 9364 this.type = src; 9365 } 9366 9367 // Put explicitly provided properties onto the event object 9368 if ( props ) { 9369 jQuery.extend( this, props ); 9370 } 9371 9372 // Create a timestamp if incoming event doesn't have one 9373 this.timeStamp = src && src.timeStamp || Date.now(); 9374 9375 // Mark it as fixed 9376 this[ jQuery.expando ] = true; 9377}; 9378 9379// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 9380// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 9381jQuery.Event.prototype = { 9382 constructor: jQuery.Event, 9383 isDefaultPrevented: returnFalse, 9384 isPropagationStopped: returnFalse, 9385 isImmediatePropagationStopped: returnFalse, 9386 isSimulated: false, 9387 9388 preventDefault: function() { 9389 var e = this.originalEvent; 9390 9391 this.isDefaultPrevented = returnTrue; 9392 9393 if ( e && !this.isSimulated ) { 9394 e.preventDefault(); 9395 } 9396 }, 9397 stopPropagation: function() { 9398 var e = this.originalEvent; 9399 9400 this.isPropagationStopped = returnTrue; 9401 9402 if ( e && !this.isSimulated ) { 9403 e.stopPropagation(); 9404 } 9405 }, 9406 stopImmediatePropagation: function() { 9407 var e = this.originalEvent; 9408 9409 this.isImmediatePropagationStopped = returnTrue; 9410 9411 if ( e && !this.isSimulated ) { 9412 e.stopImmediatePropagation(); 9413 } 9414 9415 this.stopPropagation(); 9416 } 9417}; 9418 9419// Includes all common event props including KeyEvent and MouseEvent specific props 9420jQuery.each( { 9421 altKey: true, 9422 bubbles: true, 9423 cancelable: true, 9424 changedTouches: true, 9425 ctrlKey: true, 9426 detail: true, 9427 eventPhase: true, 9428 metaKey: true, 9429 pageX: true, 9430 pageY: true, 9431 shiftKey: true, 9432 view: true, 9433 "char": true, 9434 code: true, 9435 charCode: true, 9436 key: true, 9437 keyCode: true, 9438 button: true, 9439 buttons: true, 9440 clientX: true, 9441 clientY: true, 9442 offsetX: true, 9443 offsetY: true, 9444 pointerId: true, 9445 pointerType: true, 9446 screenX: true, 9447 screenY: true, 9448 targetTouches: true, 9449 toElement: true, 9450 touches: true, 9451 which: true 9452}, jQuery.event.addProp ); 9453 9454jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 9455 9456 function focusMappedHandler( nativeEvent ) { 9457 if ( document.documentMode ) { 9458 9459 // Support: IE 11+ 9460 // Attach a single focusin/focusout handler on the document while someone wants 9461 // focus/blur. This is because the former are synchronous in IE while the latter 9462 // are async. In other browsers, all those handlers are invoked synchronously. 9463 9464 // `handle` from private data would already wrap the event, but we need 9465 // to change the `type` here. 9466 var handle = dataPriv.get( this, "handle" ), 9467 event = jQuery.event.fix( nativeEvent ); 9468 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 9469 event.isSimulated = true; 9470 9471 // First, handle focusin/focusout 9472 handle( nativeEvent ); 9473 9474 // ...then, handle focus/blur 9475 // 9476 // focus/blur don't bubble while focusin/focusout do; simulate the former by only 9477 // invoking the handler at the lower level. 9478 if ( event.target === event.currentTarget ) { 9479 9480 // The setup part calls `leverageNative`, which, in turn, calls 9481 // `jQuery.event.add`, so event handle will already have been set 9482 // by this point. 9483 handle( event ); 9484 } 9485 } else { 9486 9487 // For non-IE browsers, attach a single capturing handler on the document 9488 // while someone wants focusin/focusout. 9489 jQuery.event.simulate( delegateType, nativeEvent.target, 9490 jQuery.event.fix( nativeEvent ) ); 9491 } 9492 } 9493 9494 jQuery.event.special[ type ] = { 9495 9496 // Utilize native event if possible so blur/focus sequence is correct 9497 setup: function() { 9498 9499 var attaches; 9500 9501 // Claim the first handler 9502 // dataPriv.set( this, "focus", ... ) 9503 // dataPriv.set( this, "blur", ... ) 9504 leverageNative( this, type, true ); 9505 9506 if ( document.documentMode ) { 9507 9508 // Support: IE 9 - 11+ 9509 // We use the same native handler for focusin & focus (and focusout & blur) 9510 // so we need to coordinate setup & teardown parts between those events. 9511 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 9512 attaches = dataPriv.get( this, delegateType ); 9513 if ( !attaches ) { 9514 this.addEventListener( delegateType, focusMappedHandler ); 9515 } 9516 dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); 9517 } else { 9518 9519 // Return false to allow normal processing in the caller 9520 return false; 9521 } 9522 }, 9523 trigger: function() { 9524 9525 // Force setup before trigger 9526 leverageNative( this, type ); 9527 9528 // Return non-false to allow normal event-path propagation 9529 return true; 9530 }, 9531 9532 teardown: function() { 9533 var attaches; 9534 9535 if ( document.documentMode ) { 9536 attaches = dataPriv.get( this, delegateType ) - 1; 9537 if ( !attaches ) { 9538 this.removeEventListener( delegateType, focusMappedHandler ); 9539 dataPriv.remove( this, delegateType ); 9540 } else { 9541 dataPriv.set( this, delegateType, attaches ); 9542 } 9543 } else { 9544 9545 // Return false to indicate standard teardown should be applied 9546 return false; 9547 } 9548 }, 9549 9550 // Suppress native focus or blur if we're currently inside 9551 // a leveraged native-event stack 9552 _default: function( event ) { 9553 return dataPriv.get( event.target, type ); 9554 }, 9555 9556 delegateType: delegateType 9557 }; 9558 9559 // Support: Firefox <=44 9560 // Firefox doesn't have focus(in | out) events 9561 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 9562 // 9563 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 9564 // focus(in | out) events fire after focus & blur events, 9565 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 9566 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 9567 // 9568 // Support: IE 9 - 11+ 9569 // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, 9570 // attach a single handler for both events in IE. 9571 jQuery.event.special[ delegateType ] = { 9572 setup: function() { 9573 9574 // Handle: regular nodes (via `this.ownerDocument`), window 9575 // (via `this.document`) & document (via `this`). 9576 var doc = this.ownerDocument || this.document || this, 9577 dataHolder = document.documentMode ? this : doc, 9578 attaches = dataPriv.get( dataHolder, delegateType ); 9579 9580 // Support: IE 9 - 11+ 9581 // We use the same native handler for focusin & focus (and focusout & blur) 9582 // so we need to coordinate setup & teardown parts between those events. 9583 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 9584 if ( !attaches ) { 9585 if ( document.documentMode ) { 9586 this.addEventListener( delegateType, focusMappedHandler ); 9587 } else { 9588 doc.addEventListener( type, focusMappedHandler, true ); 9589 } 9590 } 9591 dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); 9592 }, 9593 teardown: function() { 9594 var doc = this.ownerDocument || this.document || this, 9595 dataHolder = document.documentMode ? this : doc, 9596 attaches = dataPriv.get( dataHolder, delegateType ) - 1; 9597 9598 if ( !attaches ) { 9599 if ( document.documentMode ) { 9600 this.removeEventListener( delegateType, focusMappedHandler ); 9601 } else { 9602 doc.removeEventListener( type, focusMappedHandler, true ); 9603 } 9604 dataPriv.remove( dataHolder, delegateType ); 9605 } else { 9606 dataPriv.set( dataHolder, delegateType, attaches ); 9607 } 9608 } 9609 }; 9610} ); 9611 9612// Create mouseenter/leave events using mouseover/out and event-time checks 9613// so that event delegation works in jQuery. 9614// Do the same for pointerenter/pointerleave and pointerover/pointerout 9615// 9616// Support: Safari 7 only 9617// Safari sends mouseenter too often; see: 9618// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 9619// for the description of the bug (it existed in older Chrome versions as well). 9620jQuery.each( { 9621 mouseenter: "mouseover", 9622 mouseleave: "mouseout", 9623 pointerenter: "pointerover", 9624 pointerleave: "pointerout" 9625}, function( orig, fix ) { 9626 jQuery.event.special[ orig ] = { 9627 delegateType: fix, 9628 bindType: fix, 9629 9630 handle: function( event ) { 9631 var ret, 9632 target = this, 9633 related = event.relatedTarget, 9634 handleObj = event.handleObj; 9635 9636 // For mouseenter/leave call the handler if related is outside the target. 9637 // NB: No relatedTarget if the mouse left/entered the browser window 9638 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 9639 event.type = handleObj.origType; 9640 ret = handleObj.handler.apply( this, arguments ); 9641 event.type = fix; 9642 } 9643 return ret; 9644 } 9645 }; 9646} ); 9647 9648jQuery.fn.extend( { 9649 9650 on: function( types, selector, data, fn ) { 9651 return on( this, types, selector, data, fn ); 9652 }, 9653 one: function( types, selector, data, fn ) { 9654 return on( this, types, selector, data, fn, 1 ); 9655 }, 9656 off: function( types, selector, fn ) { 9657 var handleObj, type; 9658 if ( types && types.preventDefault && types.handleObj ) { 9659 9660 // ( event ) dispatched jQuery.Event 9661 handleObj = types.handleObj; 9662 jQuery( types.delegateTarget ).off( 9663 handleObj.namespace ? 9664 handleObj.origType + "." + handleObj.namespace : 9665 handleObj.origType, 9666 handleObj.selector, 9667 handleObj.handler 9668 ); 9669 return this; 9670 } 9671 if ( typeof types === "object" ) { 9672 9673 // ( types-object [, selector] ) 9674 for ( type in types ) { 9675 this.off( type, selector, types[ type ] ); 9676 } 9677 return this; 9678 } 9679 if ( selector === false || typeof selector === "function" ) { 9680 9681 // ( types [, fn] ) 9682 fn = selector; 9683 selector = undefined; 9684 } 9685 if ( fn === false ) { 9686 fn = returnFalse; 9687 } 9688 return this.each( function() { 9689 jQuery.event.remove( this, types, fn, selector ); 9690 } ); 9691 } 9692} ); 9693 9694 9695var 9696 9697 // Support: IE <=10 - 11, Edge 12 - 13 only 9698 // In IE/Edge using regex groups here causes severe slowdowns. 9699 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 9700 rnoInnerhtml = /<script|<style|<link/i, 9701 9702 // checked="checked" or checked 9703 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 9704 9705 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 9706 9707// Prefer a tbody over its parent table for containing new rows 9708function manipulationTarget( elem, content ) { 9709 if ( nodeName( elem, "table" ) && 9710 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 9711 9712 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 9713 } 9714 9715 return elem; 9716} 9717 9718// Replace/restore the type attribute of script elements for safe DOM manipulation 9719function disableScript( elem ) { 9720 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 9721 return elem; 9722} 9723function restoreScript( elem ) { 9724 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 9725 elem.type = elem.type.slice( 5 ); 9726 } else { 9727 elem.removeAttribute( "type" ); 9728 } 9729 9730 return elem; 9731} 9732 9733function cloneCopyEvent( src, dest ) { 9734 var i, l, type, pdataOld, udataOld, udataCur, events; 9735 9736 if ( dest.nodeType !== 1 ) { 9737 return; 9738 } 9739 9740 // 1. Copy private data: events, handlers, etc. 9741 if ( dataPriv.hasData( src ) ) { 9742 pdataOld = dataPriv.get( src ); 9743 events = pdataOld.events; 9744 9745 if ( events ) { 9746 dataPriv.remove( dest, "handle events" ); 9747 9748 for ( type in events ) { 9749 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 9750 jQuery.event.add( dest, type, events[ type ][ i ] ); 9751 } 9752 } 9753 } 9754 } 9755 9756 // 2. Copy user data 9757 if ( dataUser.hasData( src ) ) { 9758 udataOld = dataUser.access( src ); 9759 udataCur = jQuery.extend( {}, udataOld ); 9760 9761 dataUser.set( dest, udataCur ); 9762 } 9763} 9764 9765// Fix IE bugs, see support tests 9766function fixInput( src, dest ) { 9767 var nodeName = dest.nodeName.toLowerCase(); 9768 9769 // Fails to persist the checked state of a cloned checkbox or radio button. 9770 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 9771 dest.checked = src.checked; 9772 9773 // Fails to return the selected option to the default selected state when cloning options 9774 } else if ( nodeName === "input" || nodeName === "textarea" ) { 9775 dest.defaultValue = src.defaultValue; 9776 } 9777} 9778 9779function domManip( collection, args, callback, ignored ) { 9780 9781 // Flatten any nested arrays 9782 args = flat( args ); 9783 9784 var fragment, first, scripts, hasScripts, node, doc, 9785 i = 0, 9786 l = collection.length, 9787 iNoClone = l - 1, 9788 value = args[ 0 ], 9789 valueIsFunction = isFunction( value ); 9790 9791 // We can't cloneNode fragments that contain checked, in WebKit 9792 if ( valueIsFunction || 9793 ( l > 1 && typeof value === "string" && 9794 !support.checkClone && rchecked.test( value ) ) ) { 9795 return collection.each( function( index ) { 9796 var self = collection.eq( index ); 9797 if ( valueIsFunction ) { 9798 args[ 0 ] = value.call( this, index, self.html() ); 9799 } 9800 domManip( self, args, callback, ignored ); 9801 } ); 9802 } 9803 9804 if ( l ) { 9805 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 9806 first = fragment.firstChild; 9807 9808 if ( fragment.childNodes.length === 1 ) { 9809 fragment = first; 9810 } 9811 9812 // Require either new content or an interest in ignored elements to invoke the callback 9813 if ( first || ignored ) { 9814 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 9815 hasScripts = scripts.length; 9816 9817 // Use the original fragment for the last item 9818 // instead of the first because it can end up 9819 // being emptied incorrectly in certain situations (trac-8070). 9820 for ( ; i < l; i++ ) { 9821 node = fragment; 9822 9823 if ( i !== iNoClone ) { 9824 node = jQuery.clone( node, true, true ); 9825 9826 // Keep references to cloned scripts for later restoration 9827 if ( hasScripts ) { 9828 9829 // Support: Android <=4.0 only, PhantomJS 1 only 9830 // push.apply(_, arraylike) throws on ancient WebKit 9831 jQuery.merge( scripts, getAll( node, "script" ) ); 9832 } 9833 } 9834 9835 callback.call( collection[ i ], node, i ); 9836 } 9837 9838 if ( hasScripts ) { 9839 doc = scripts[ scripts.length - 1 ].ownerDocument; 9840 9841 // Re
vendor: 2,059 bytes, lines 9841-9913
9841enable scripts 9842 jQuery.map( scripts, restoreScript ); 9843 9844 // Evaluate executable scripts on first document insertion 9845 for ( i = 0; i < hasScripts; i++ ) { 9846 node = scripts[ i ]; 9847 if ( rscriptType.test( node.type || "" ) && 9848 !dataPriv.access( node, "globalEval" ) && 9849 jQuery.contains( doc, node ) ) { 9850 9851 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 9852 9853 // Optional AJAX dependency, but won't run scripts if not present 9854 if ( jQuery._evalUrl && !node.noModule ) { 9855 jQuery._evalUrl( node.src, { 9856 nonce: node.nonce || node.getAttribute( "nonce" ) 9857 }, doc ); 9858 } 9859 } else { 9860 9861 // Unwrap a CDATA section containing script contents. This shouldn't be 9862 // needed as in XML documents they're already not visible when 9863 // inspecting element contents and in HTML documents they have no 9864 // meaning but we're preserving that logic for backwards compatibility. 9865 // This will be removed completely in 4.0. See gh-4904. 9866 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 9867 } 9868 } 9869 } 9870 } 9871 } 9872 } 9873 9874 return collection; 9875} 9876 9877function remove( elem, selector, keepData ) { 9878 var node, 9879 nodes = selector ? jQuery.filter( selector, elem ) : elem, 9880 i = 0; 9881 9882 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 9883 if ( !keepData && node.nodeType === 1 ) { 9884 jQuery.cleanData( getAll( node ) ); 9885 } 9886 9887 if ( node.parentNode ) { 9888 if ( keepData && isAttached( node ) ) { 9889 setGlobalEval( getAll( node, "script" ) ); 9890 } 9891 node.parentNode.removeChild( node ); 9892 } 9893 } 9894 9895 return elem; 9896} 9897 9898jQuery.extend( { 9899 htmlPrefilter: function( html ) { 9900 return html; 9901 }, 9902 9903 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 9904 var i, l, srcElements, destElements, 9905 clone = elem.cloneNode( true ), 9906 inPage = isAttached( elem ); 9907 9908 // Fix IE cloning issues 9909 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 9910 !jQuery.isXMLDoc( elem ) ) { 9911 9912 // We eschew jQuery#find here for performance reasons: 9913 //
vendor: 2,516 bytes, lines 9913-10010
9913 https://jsperf.com/getall-vs-sizzle/2 9914 destElements = getAll( clone ); 9915 srcElements = getAll( elem ); 9916 9917 for ( i = 0, l = srcElements.length; i < l; i++ ) { 9918 fixInput( srcElements[ i ], destElements[ i ] ); 9919 } 9920 } 9921 9922 // Copy the events from the original to the clone 9923 if ( dataAndEvents ) { 9924 if ( deepDataAndEvents ) { 9925 srcElements = srcElements || getAll( elem ); 9926 destElements = destElements || getAll( clone ); 9927 9928 for ( i = 0, l = srcElements.length; i < l; i++ ) { 9929 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 9930 } 9931 } else { 9932 cloneCopyEvent( elem, clone ); 9933 } 9934 } 9935 9936 // Preserve script evaluation history 9937 destElements = getAll( clone, "script" ); 9938 if ( destElements.length > 0 ) { 9939 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 9940 } 9941 9942 // Return the cloned set 9943 return clone; 9944 }, 9945 9946 cleanData: function( elems ) { 9947 var data, elem, type, 9948 special = jQuery.event.special, 9949 i = 0; 9950 9951 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 9952 if ( acceptData( elem ) ) { 9953 if ( ( data = elem[ dataPriv.expando ] ) ) { 9954 if ( data.events ) { 9955 for ( type in data.events ) { 9956 if ( special[ type ] ) { 9957 jQuery.event.remove( elem, type ); 9958 9959 // This is a shortcut to avoid jQuery.event.remove's overhead 9960 } else { 9961 jQuery.removeEvent( elem, type, data.handle ); 9962 } 9963 } 9964 } 9965 9966 // Support: Chrome <=35 - 45+ 9967 // Assign undefined instead of using delete, see Data#remove 9968 elem[ dataPriv.expando ] = undefined; 9969 } 9970 if ( elem[ dataUser.expando ] ) { 9971 9972 // Support: Chrome <=35 - 45+ 9973 // Assign undefined instead of using delete, see Data#remove 9974 elem[ dataUser.expando ] = undefined; 9975 } 9976 } 9977 } 9978 } 9979} ); 9980 9981jQuery.fn.extend( { 9982 detach: function( selector ) { 9983 return remove( this, selector, true ); 9984 }, 9985 9986 remove: function( selector ) { 9987 return remove( this, selector ); 9988 }, 9989 9990 text: function( value ) { 9991 return access( this, function( value ) { 9992 return value === undefined ? 9993 jQuery.text( this ) : 9994 this.empty().each( function() { 9995 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 9996 this.textContent = value; 9997 } 9998 } ); 9999 }, null, value, arguments.length ); 10000 }, 10001 10002 append: function() { 10003 return domManip( this, arguments, function( elem ) { 10004 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 10005 var target = manipulationTarget( this, elem ); 10006 target.appendChild( elem ); 10007 } 10008 } ); 10009 }, 10010
vendor: 7,872 bytes, lines 10011-10298
10011 prepend: function() { 10012 return domManip( this, arguments, function( elem ) { 10013 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 10014 var target = manipulationTarget( this, elem ); 10015 target.insertBefore( elem, target.firstChild ); 10016 } 10017 } ); 10018 }, 10019 10020 before: function() { 10021 return domManip( this, arguments, function( elem ) { 10022 if ( this.parentNode ) { 10023 this.parentNode.insertBefore( elem, this ); 10024 } 10025 } ); 10026 }, 10027 10028 after: function() { 10029 return domManip( this, arguments, function( elem ) { 10030 if ( this.parentNode ) { 10031 this.parentNode.insertBefore( elem, this.nextSibling ); 10032 } 10033 } ); 10034 }, 10035 10036 empty: function() { 10037 var elem, 10038 i = 0; 10039 10040 for ( ; ( elem = this[ i ] ) != null; i++ ) { 10041 if ( elem.nodeType === 1 ) { 10042 10043 // Prevent memory leaks 10044 jQuery.cleanData( getAll( elem, false ) ); 10045 10046 // Remove any remaining nodes 10047 elem.textContent = ""; 10048 } 10049 } 10050 10051 return this; 10052 }, 10053 10054 clone: function( dataAndEvents, deepDataAndEvents ) { 10055 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 10056 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 10057 10058 return this.map( function() { 10059 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 10060 } ); 10061 }, 10062 10063 html: function( value ) { 10064 return access( this, function( value ) { 10065 var elem = this[ 0 ] || {}, 10066 i = 0, 10067 l = this.length; 10068 10069 if ( value === undefined && elem.nodeType === 1 ) { 10070 return elem.innerHTML; 10071 } 10072 10073 // See if we can take a shortcut and just use innerHTML 10074 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 10075 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 10076 10077 value = jQuery.htmlPrefilter( value ); 10078 10079 try { 10080 for ( ; i < l; i++ ) { 10081 elem = this[ i ] || {}; 10082 10083 // Remove element nodes and prevent memory leaks 10084 if ( elem.nodeType === 1 ) { 10085 jQuery.cleanData( getAll( elem, false ) ); 10086 elem.innerHTML = value; 10087 } 10088 } 10089 10090 elem = 0; 10091 10092 // If using innerHTML throws an exception, use the fallback method 10093 } catch ( e ) {} 10094 } 10095 10096 if ( elem ) { 10097 this.empty().append( value ); 10098 } 10099 }, null, value, arguments.length ); 10100 }, 10101 10102 replaceWith: function() { 10103 var ignored = []; 10104 10105 // Make the changes, replacing each non-ignored context element with the new content 10106 return domManip( this, arguments, function( elem ) { 10107 var parent = this.parentNode; 10108 10109 if ( jQuery.inArray( this, ignored ) < 0 ) { 10110 jQuery.cleanData( getAll( this ) ); 10111 if ( parent ) { 10112 parent.replaceChild( elem, this ); 10113 } 10114 } 10115 10116 // Force callback invocation 10117 }, ignored ); 10118 } 10119} ); 10120 10121jQuery.each( { 10122 appendTo: "append", 10123 prependTo: "prepend", 10124 insertBefore: "before", 10125 insertAfter: "after", 10126 replaceAll: "replaceWith" 10127}, function( name, original ) { 10128 jQuery.fn[ name ] = function( selector ) { 10129 var elems, 10130 ret = [], 10131 insert = jQuery( selector ), 10132 last = insert.length - 1, 10133 i = 0; 10134 10135 for ( ; i <= last; i++ ) { 10136 elems = i === last ? this : this.clone( true ); 10137 jQuery( insert[ i ] )[ original ]( elems ); 10138 10139 // Support: Android <=4.0 only, PhantomJS 1 only 10140 // .get() because push.apply(_, arraylike) throws on ancient WebKit 10141 push.apply( ret, elems.get() ); 10142 } 10143 10144 return this.pushStack( ret ); 10145 }; 10146} ); 10147var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 10148 10149var rcustomProp = /^--/; 10150 10151 10152var getStyles = function( elem ) { 10153 10154 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 10155 // IE throws on elements created in popups 10156 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 10157 var view = elem.ownerDocument.defaultView; 10158 10159 if ( !view || !view.opener ) { 10160 view = window; 10161 } 10162 10163 return view.getComputedStyle( elem ); 10164 }; 10165 10166var swap = function( elem, options, callback ) { 10167 var ret, name, 10168 old = {}; 10169 10170 // Remember the old values, and insert the new ones 10171 for ( name in options ) { 10172 old[ name ] = elem.style[ name ]; 10173 elem.style[ name ] = options[ name ]; 10174 } 10175 10176 ret = callback.call( elem ); 10177 10178 // Revert the old values 10179 for ( name in options ) { 10180 elem.style[ name ] = old[ name ]; 10181 } 10182 10183 return ret; 10184}; 10185 10186 10187var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 10188 10189 10190 10191( function() { 10192 10193 // Executing both pixelPosition & boxSizingReliable tests require only one layout 10194 // so they're executed at the same time to save the second computation. 10195 function computeStyleTests() { 10196 10197 // This is a singleton, we need to execute it only once 10198 if ( !div ) { 10199 return; 10200 } 10201 10202 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 10203 "margin-top:1px;padding:0;border:0"; 10204 div.style.cssText = 10205 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 10206 "margin:auto;border:1px;padding:1px;" + 10207 "width:60%;top:1%"; 10208 documentElement.appendChild( container ).appendChild( div ); 10209 10210 var divStyle = window.getComputedStyle( div ); 10211 pixelPositionVal = divStyle.top !== "1%"; 10212 10213 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 10214 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 10215 10216 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 10217 // Some styles come back with percentage values, even though they shouldn't 10218 div.style.right = "60%"; 10219 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 10220 10221 // Support: IE 9 - 11 only 10222 // Detect misreporting of content dimensions for box-sizing:border-box elements 10223 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 10224 10225 // Support: IE 9 only 10226 // Detect overflow:scroll screwiness (gh-3699) 10227 // Support: Chrome <=64 10228 // Don't get tricked when zoom affects offsetWidth (gh-4029) 10229 div.style.position = "absolute"; 10230 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 10231 10232 documentElement.removeChild( container ); 10233 10234 // Nullify the div so it wouldn't be stored in the memory and 10235 // it will also be a sign that checks already performed 10236 div = null; 10237 } 10238 10239 function roundPixelMeasures( measure ) { 10240 return Math.round( parseFloat( measure ) ); 10241 } 10242 10243 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 10244 reliableTrDimensionsVal, reliableMarginLeftVal, 10245 container = document.createElement( "div" ), 10246 div = document.createElement( "div" ); 10247 10248 // Finish early in limited (non-browser) environments 10249 if ( !div.style ) { 10250 return; 10251 } 10252 10253 // Support: IE <=9 - 11 only 10254 // Style of cloned element affects source element cloned (trac-8908) 10255 div.style.backgroundClip = "content-box"; 10256 div.cloneNode( true ).style.backgroundClip = ""; 10257 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 10258 10259 jQuery.extend( support, { 10260 boxSizingReliable: function() { 10261 computeStyleTests(); 10262 return boxSizingReliableVal; 10263 }, 10264 pixelBoxStyles: function() { 10265 computeStyleTests(); 10266 return pixelBoxStylesVal; 10267 }, 10268 pixelPosition: function() { 10269 computeStyleTests(); 10270 return pixelPositionVal; 10271 }, 10272 reliableMarginLeft: function() { 10273 computeStyleTests(); 10274 return reliableMarginLeftVal; 10275 }, 10276 scrollboxSize: function() { 10277 computeStyleTests(); 10278 return scrollboxSizeVal; 10279 }, 10280 10281 // Support: IE 9 - 11+, Edge 15 - 18+ 10282 // IE/Edge misreport `getComputedStyle` of table rows with width/height 10283 // set in CSS while `offset*` properties report correct values. 10284 // Behavior in IE 9 is more subtle than in newer versions & it passes 10285 // some versions of this test; make sure not to make it pass there! 10286 // 10287 // Support: Firefox 70+ 10288 // Only Firefox includes border widths 10289 // in computed dimensions. (gh-4529) 10290 reliableTrDimensions: function() { 10291 var table, tr, trChild, trStyle; 10292 if ( reliableTrDimensionsVal == null ) { 10293 table = document.createElement( "table" ); 10294 tr = document.createElement( "tr" ); 10295 trChild = document.createElement( "div" ); 10296 10297 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 10298 tr.style.cssText = "bo
10298rder:1px solid"; 10299 10300 // Support: Chrome 86+ 10301 // Height set through cssText does not get applied. 10302 // Computed height then comes back as 0. 10303 tr.style.height = "1px"; 10304 trChild.style.height = "9px"; 10305 10306 // Support: Android 8 Chrome 86+ 10307 // In our bodyBackground.html iframe, 10308 // display for all div elements is set to "inline", 10309 // which causes a problem only in Android 8 Chrome 86. 10310 // Ensuring the div is display: block
vendor: 50,104 bytes, lines 10310-12225
10310 10311 // gets around this issue. 10312 trChild.style.display = "block"; 10313 10314 documentElement 10315 .appendChild( table ) 10316 .appendChild( tr ) 10317 .appendChild( trChild ); 10318 10319 trStyle = window.getComputedStyle( tr ); 10320 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 10321 parseInt( trStyle.borderTopWidth, 10 ) + 10322 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 10323 10324 documentElement.removeChild( table ); 10325 } 10326 return reliableTrDimensionsVal; 10327 } 10328 } ); 10329} )(); 10330 10331 10332function curCSS( elem, name, computed ) { 10333 var width, minWidth, maxWidth, ret, 10334 isCustomProp = rcustomProp.test( name ), 10335 10336 // Support: Firefox 51+ 10337 // Retrieving style before computed somehow 10338 // fixes an issue with getting wrong values 10339 // on detached elements 10340 style = elem.style; 10341 10342 computed = computed || getStyles( elem ); 10343 10344 // getPropertyValue is needed for: 10345 // .css('filter') (IE 9 only, trac-12537) 10346 // .css('--customProperty) (gh-3144) 10347 if ( computed ) { 10348 10349 // Support: IE <=9 - 11+ 10350 // IE only supports `"float"` in `getPropertyValue`; in computed styles 10351 // it's only available as `"cssFloat"`. We no longer modify properties 10352 // sent to `.css()` apart from camelCasing, so we need to check both. 10353 // Normally, this would create difference in behavior: if 10354 // `getPropertyValue` returns an empty string, the value returned 10355 // by `.css()` would be `undefined`. This is usually the case for 10356 // disconnected elements. However, in IE even disconnected elements 10357 // with no styles return `"none"` for `getPropertyValue( "float" )` 10358 ret = computed.getPropertyValue( name ) || computed[ name ]; 10359 10360 if ( isCustomProp && ret ) { 10361 10362 // Support: Firefox 105+, Chrome <=105+ 10363 // Spec requires trimming whitespace for custom properties (gh-4926). 10364 // Firefox only trims leading whitespace. Chrome just collapses 10365 // both leading & trailing whitespace to a single space. 10366 // 10367 // Fall back to `undefined` if empty string returned. 10368 // This collapses a missing definition with property defined 10369 // and set to an empty string but there's no standard API 10370 // allowing us to differentiate them without a performance penalty 10371 // and returning `undefined` aligns with older jQuery. 10372 // 10373 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED 10374 // as whitespace while CSS does not, but this is not a problem 10375 // because CSS preprocessing replaces them with U+000A LINE FEED 10376 // (which *is* CSS whitespace) 10377 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 10378 ret = ret.replace( rtrimCSS, "$1" ) || undefined; 10379 } 10380 10381 if ( ret === "" && !isAttached( elem ) ) { 10382 ret = jQuery.style( elem, name ); 10383 } 10384 10385 // A tribute to the "awesome hack by Dean Edwards" 10386 // Android Browser returns percentage for some values, 10387 // but width seems to be reliably pixels. 10388 // This is against the CSSOM draft spec: 10389 // https://drafts.csswg.org/cssom/#resolved-values 10390 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 10391 10392 // Remember the original values 10393 width = style.width; 10394 minWidth = style.minWidth; 10395 maxWidth = style.maxWidth; 10396 10397 // Put in the new values to get a computed value out 10398 style.minWidth = style.maxWidth = style.width = ret; 10399 ret = computed.width; 10400 10401 // Revert the changed values 10402 style.width = width; 10403 style.minWidth = minWidth; 10404 style.maxWidth = maxWidth; 10405 } 10406 } 10407 10408 return ret !== undefined ? 10409 10410 // Support: IE <=9 - 11 only 10411 // IE returns zIndex value as an integer. 10412 ret + "" : 10413 ret; 10414} 10415 10416 10417function addGetHookIf( conditionFn, hookFn ) { 10418 10419 // Define the hook, we'll check on the first run if it's really needed. 10420 return { 10421 get: function() { 10422 if ( conditionFn() ) { 10423 10424 // Hook not needed (or it's not possible to use it due 10425 // to missing dependency), remove it. 10426 delete this.get; 10427 return; 10428 } 10429 10430 // Hook needed; redefine it so that the support test is not executed again. 10431 return ( this.get = hookFn ).apply( this, arguments ); 10432 } 10433 }; 10434} 10435 10436 10437var cssPrefixes = [ "Webkit", "Moz", "ms" ], 10438 emptyStyle = document.createElement( "div" ).style, 10439 vendorProps = {}; 10440 10441// Return a vendor-prefixed property or undefined 10442function vendorPropName( name ) { 10443 10444 // Check for vendor prefixed names 10445 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 10446 i = cssPrefixes.length; 10447 10448 while ( i-- ) { 10449 name = cssPrefixes[ i ] + capName; 10450 if ( name in emptyStyle ) { 10451 return name; 10452 } 10453 } 10454} 10455 10456// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 10457function finalPropName( name ) { 10458 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 10459 10460 if ( final ) { 10461 return final; 10462 } 10463 if ( name in emptyStyle ) { 10464 return name; 10465 } 10466 return vendorProps[ name ] = vendorPropName( name ) || name; 10467} 10468 10469 10470var 10471 10472 // Swappable if display is none or starts with table 10473 // except "table", "table-cell", or "table-caption" 10474 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 10475 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 10476 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 10477 cssNormalTransform = { 10478 letterSpacing: "0", 10479 fontWeight: "400" 10480 }; 10481 10482function setPositiveNumber( _elem, value, subtract ) { 10483 10484 // Any relative (+/-) values have already been 10485 // normalized at this point 10486 var matches = rcssNum.exec( value ); 10487 return matches ? 10488 10489 // Guard against undefined "subtract", e.g., when used as in cssHooks 10490 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 10491 value; 10492} 10493 10494function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 10495 var i = dimension === "width" ? 1 : 0, 10496 extra = 0, 10497 delta = 0, 10498 marginDelta = 0; 10499 10500 // Adjustment may not be necessary 10501 if ( box === ( isBorderBox ? "border" : "content" ) ) { 10502 return 0; 10503 } 10504 10505 for ( ; i < 4; i += 2 ) { 10506 10507 // Both box models exclude margin 10508 // Count margin delta separately to only add it after scroll gutter adjustment. 10509 // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). 10510 if ( box === "margin" ) { 10511 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 10512 } 10513 10514 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 10515 if ( !isBorderBox ) { 10516 10517 // Add padding 10518 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 10519 10520 // For "border" or "margin", add border 10521 if ( box !== "padding" ) { 10522 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 10523 10524 // But still keep track of it otherwise 10525 } else { 10526 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 10527 } 10528 10529 // If we get here with a border-box (content + padding + border), we're seeking "content" or 10530 // "padding" or "margin" 10531 } else { 10532 10533 // For "content", subtract padding 10534 if ( box === "content" ) { 10535 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 10536 } 10537 10538 // For "content" or "padding", subtract border 10539 if ( box !== "margin" ) { 10540 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 10541 } 10542 } 10543 } 10544 10545 // Account for positive content-box scroll gutter when requested by providing computedVal 10546 if ( !isBorderBox && computedVal >= 0 ) { 10547 10548 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 10549 // Assuming integer scroll gutter, subtract the rest and round down 10550 delta += Math.max( 0, Math.ceil( 10551 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 10552 computedVal - 10553 delta - 10554 extra - 10555 0.5 10556 10557 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 10558 // Use an explicit zero to avoid NaN (gh-3964) 10559 ) ) || 0; 10560 } 10561 10562 return delta + marginDelta; 10563} 10564 10565function getWidthOrHeight( elem, dimension, extra ) { 10566 10567 // Start with computed style 10568 var styles = getStyles( elem ), 10569 10570 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 10571 // Fake content-box until we know it's needed to know the true value. 10572 boxSizingNeeded = !support.boxSizingReliable() || extra, 10573 isBorderBox = boxSizingNeeded && 10574 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 10575 valueIsBorderBox = isBorderBox, 10576 10577 val = curCSS( elem, dimension, styles ), 10578 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 10579 10580 // Support: Firefox <=54 10581 // Return a confounding non-pixel value or feign ignorance, as appropriate. 10582 if ( rnumnonpx.test( val ) ) { 10583 if ( !extra ) { 10584 return val; 10585 } 10586 val = "auto"; 10587 } 10588 10589 10590 // Support: IE 9 - 11 only 10591 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 10592 // In those cases, the computed value can be trusted to be border-box. 10593 if ( ( !support.boxSizingReliable() && isBorderBox || 10594 10595 // Support: IE 10 - 11+, Edge 15 - 18+ 10596 // IE/Edge misreport `getComputedStyle` of table rows with width/height 10597 // set in CSS while `offset*` properties report correct values. 10598 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 10599 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 10600 10601 // Fall back to offsetWidth/offsetHeight when value is "auto" 10602 // This happens for inline elements with no explicit setting (gh-3571) 10603 val === "auto" || 10604 10605 // Support: Android <=4.1 - 4.3 only 10606 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 10607 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 10608 10609 // Make sure the element is visible & connected 10610 elem.getClientRects().length ) { 10611 10612 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 10613 10614 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 10615 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 10616 // retrieved value as a content box dimension. 10617 valueIsBorderBox = offsetProp in elem; 10618 if ( valueIsBorderBox ) { 10619 val = elem[ offsetProp ]; 10620 } 10621 } 10622 10623 // Normalize "" and auto 10624 val = parseFloat( val ) || 0; 10625 10626 // Adjust for the element's box model 10627 return ( val + 10628 boxModelAdjustment( 10629 elem, 10630 dimension, 10631 extra || ( isBorderBox ? "border" : "content" ), 10632 valueIsBorderBox, 10633 styles, 10634 10635 // Provide the current computed size to request scroll gutter calculation (gh-3589) 10636 val 10637 ) 10638 ) + "px"; 10639} 10640 10641jQuery.extend( { 10642 10643 // Add in style property hooks for overriding the default 10644 // behavior of getting and setting a style property 10645 cssHooks: { 10646 opacity: { 10647 get: function( elem, computed ) { 10648 if ( computed ) { 10649 10650 // We should always get a number back from opacity 10651 var ret = curCSS( elem, "opacity" ); 10652 return ret === "" ? "1" : ret; 10653 } 10654 } 10655 } 10656 }, 10657 10658 // Don't automatically add "px" to these possibly-unitless properties 10659 cssNumber: { 10660 animationIterationCount: true, 10661 aspectRatio: true, 10662 borderImageSlice: true, 10663 columnCount: true, 10664 flexGrow: true, 10665 flexShrink: true, 10666 fontWeight: true, 10667 gridArea: true, 10668 gridColumn: true, 10669 gridColumnEnd: true, 10670 gridColumnStart: true, 10671 gridRow: true, 10672 gridRowEnd: true, 10673 gridRowStart: true, 10674 lineHeight: true, 10675 opacity: true, 10676 order: true, 10677 orphans: true, 10678 scale: true, 10679 widows: true, 10680 zIndex: true, 10681 zoom: true, 10682 10683 // SVG-related 10684 fillOpacity: true, 10685 floodOpacity: true, 10686 stopOpacity: true, 10687 strokeMiterlimit: true, 10688 strokeOpacity: true 10689 }, 10690 10691 // Add in properties whose names you wish to fix before 10692 // setting or getting the value 10693 cssProps: {}, 10694 10695 // Get and set the style property on a DOM Node 10696 style: function( elem, name, value, extra ) { 10697 10698 // Don't set styles on text and comment nodes 10699 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 10700 return; 10701 } 10702 10703 // Make sure that we're working with the right name 10704 var ret, type, hooks, 10705 origName = camelCase( name ), 10706 isCustomProp = rcustomProp.test( name ), 10707 style = elem.style; 10708 10709 // Make sure that we're working with the right name. We don't 10710 // want to query the value if it is a CSS custom property 10711 // since they are user-defined. 10712 if ( !isCustomProp ) { 10713 name = finalPropName( origName ); 10714 } 10715 10716 // Gets hook for the prefixed version, then unprefixed version 10717 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 10718 10719 // Check if we're setting a value 10720 if ( value !== undefined ) { 10721 type = typeof value; 10722 10723 // Convert "+=" or "-=" to relative numbers (trac-7345) 10724 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 10725 value = adjustCSS( elem, name, ret ); 10726 10727 // Fixes bug trac-9237 10728 type = "number"; 10729 } 10730 10731 // Make sure that null and NaN values aren't set (trac-7116) 10732 if ( value == null || value !== value ) { 10733 return; 10734 } 10735 10736 // If a number was passed in, add the unit (except for certain CSS properties) 10737 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 10738 // "px" to a few hardcoded values. 10739 if ( type === "number" && !isCustomProp ) { 10740 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 10741 } 10742 10743 // background-* props affect original clone's values 10744 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 10745 style[ name ] = "inherit"; 10746 } 10747 10748 // If a hook was provided, use that value, otherwise just set the specified value 10749 if ( !hooks || !( "set" in hooks ) || 10750 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 10751 10752 if ( isCustomProp ) { 10753 style.setProperty( name, value ); 10754 } else { 10755 style[ name ] = value; 10756 } 10757 } 10758 10759 } else { 10760 10761 // If a hook was provided get the non-computed value from there 10762 if ( hooks && "get" in hooks && 10763 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 10764 10765 return ret; 10766 } 10767 10768 // Otherwise just get the value from the style object 10769 return style[ name ]; 10770 } 10771 }, 10772 10773 css: function( elem, name, extra, styles ) { 10774 var val, num, hooks, 10775 origName = camelCase( name ), 10776 isCustomProp = rcustomProp.test( name ); 10777 10778 // Make sure that we're working with the right name. We don't 10779 // want to modify the value if it is a CSS custom property 10780 // since they are user-defined. 10781 if ( !isCustomProp ) { 10782 name = finalPropName( origName ); 10783 } 10784 10785 // Try prefixed name followed by the unprefixed name 10786 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 10787 10788 // If a hook was provided get the computed value from there 10789 if ( hooks && "get" in hooks ) { 10790 val = hooks.get( elem, true, extra ); 10791 } 10792 10793 // Otherwise, if a way to get the computed value exists, use that 10794 if ( val === undefined ) { 10795 val = curCSS( elem, name, styles ); 10796 } 10797 10798 // Convert "normal" to computed value 10799 if ( val === "normal" && name in cssNormalTransform ) { 10800 val = cssNormalTransform[ name ]; 10801 } 10802 10803 // Make numeric if forced or a qualifier was provided and val looks numeric 10804 if ( extra === "" || extra ) { 10805 num = parseFloat( val ); 10806 return extra === true || isFinite( num ) ? num || 0 : val; 10807 } 10808 10809 return val; 10810 } 10811} ); 10812 10813jQuery.each( [ "height", "width" ], function( _i, dimension ) { 10814 jQuery.cssHooks[ dimension ] = { 10815 get: function( elem, computed, extra ) { 10816 if ( computed ) { 10817 10818 // Certain elements can have dimension info if we invisibly show them 10819 // but it must have a current display style that would benefit 10820 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 10821 10822 // Support: Safari 8+ 10823 // Table columns in Safari have non-zero offsetWidth & zero 10824 // getBoundingClientRect().width unless display is changed. 10825 // Support: IE <=11 only 10826 // Running getBoundingClientRect on a disconnected node 10827 // in IE throws an error. 10828 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 10829 swap( elem, cssShow, function() { 10830 return getWidthOrHeight( elem, dimension, extra ); 10831 } ) : 10832 getWidthOrHeight( elem, dimension, extra ); 10833 } 10834 }, 10835 10836 set: function( elem, value, extra ) { 10837 var matches, 10838 styles = getStyles( elem ), 10839 10840 // Only read styles.position if the test has a chance to fail 10841 // to avoid forcing a reflow. 10842 scrollboxSizeBuggy = !support.scrollboxSize() && 10843 styles.position === "absolute", 10844 10845 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 10846 boxSizingNeeded = scrollboxSizeBuggy || extra, 10847 isBorderBox = boxSizingNeeded && 10848 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 10849 subtract = extra ? 10850 boxModelAdjustment( 10851 elem, 10852 dimension, 10853 extra, 10854 isBorderBox, 10855 styles 10856 ) : 10857 0; 10858 10859 // Account for unreliable border-box dimensions by comparing offset* to computed and 10860 // faking a content-box to get border and padding (gh-3699) 10861 if ( isBorderBox && scrollboxSizeBuggy ) { 10862 subtract -= Math.ceil( 10863 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 10864 parseFloat( styles[ dimension ] ) - 10865 boxModelAdjustment( elem, dimension, "border", false, styles ) - 10866 0.5 10867 ); 10868 } 10869 10870 // Convert to pixels if value adjustment is needed 10871 if ( subtract && ( matches = rcssNum.exec( value ) ) && 10872 ( matches[ 3 ] || "px" ) !== "px" ) { 10873 10874 elem.style[ dimension ] = value; 10875 value = jQuery.css( elem, dimension ); 10876 } 10877 10878 return setPositiveNumber( elem, value, subtract ); 10879 } 10880 }; 10881} ); 10882 10883jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 10884 function( elem, computed ) { 10885 if ( computed ) { 10886 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 10887 elem.getBoundingClientRect().left - 10888 swap( elem, { marginLeft: 0 }, function() { 10889 return elem.getBoundingClientRect().left; 10890 } ) 10891 ) + "px"; 10892 } 10893 } 10894); 10895 10896// These hooks are used by animate to expand properties 10897jQuery.each( { 10898 margin: "", 10899 padding: "", 10900 border: "Width" 10901}, function( prefix, suffix ) { 10902 jQuery.cssHooks[ prefix + suffix ] = { 10903 expand: function( value ) { 10904 var i = 0, 10905 expanded = {}, 10906 10907 // Assumes a single number if not a string 10908 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 10909 10910 for ( ; i < 4; i++ ) { 10911 expanded[ prefix + cssExpand[ i ] + suffix ] = 10912 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 10913 } 10914 10915 return expanded; 10916 } 10917 }; 10918 10919 if ( prefix !== "margin" ) { 10920 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 10921 } 10922} ); 10923 10924jQuery.fn.extend( { 10925 css: function( name, value ) { 10926 return access( this, function( elem, name, value ) { 10927 var styles, len, 10928 map = {}, 10929 i = 0; 10930 10931 if ( Array.isArray( name ) ) { 10932 styles = getStyles( elem ); 10933 len = name.length; 10934 10935 for ( ; i < len; i++ ) { 10936 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 10937 } 10938 10939 return map; 10940 } 10941 10942 return value !== undefined ? 10943 jQuery.style( elem, name, value ) : 10944 jQuery.css( elem, name ); 10945 }, name, value, arguments.length > 1 ); 10946 } 10947} ); 10948 10949 10950function Tween( elem, options, prop, end, easing ) { 10951 return new Tween.prototype.init( elem, options, prop, end, easing ); 10952} 10953jQuery.Tween = Tween; 10954 10955Tween.prototype = { 10956 constructor: Tween, 10957 init: function( elem, options, prop, end, easing, unit ) { 10958 this.elem = elem; 10959 this.prop = prop; 10960 this.easing = easing || jQuery.easing._default; 10961 this.options = options; 10962 this.start = this.now = this.cur(); 10963 this.end = end; 10964 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 10965 }, 10966 cur: function() { 10967 var hooks = Tween.propHooks[ this.prop ]; 10968 10969 return hooks && hooks.get ? 10970 hooks.get( this ) : 10971 Tween.propHooks._default.get( this ); 10972 }, 10973 run: function( percent ) { 10974 var eased, 10975 hooks = Tween.propHooks[ this.prop ]; 10976 10977 if ( this.options.duration ) { 10978 this.pos = eased = jQuery.easing[ this.easing ]( 10979 percent, this.options.duration * percent, 0, 1, this.options.duration 10980 ); 10981 } else { 10982 this.pos = eased = percent; 10983 } 10984 this.now = ( this.end - this.start ) * eased + this.start; 10985 10986 if ( this.options.step ) { 10987 this.options.step.call( this.elem, this.now, this ); 10988 } 10989 10990 if ( hooks && hooks.set ) { 10991 hooks.set( this ); 10992 } else { 10993 Tween.propHooks._default.set( this ); 10994 } 10995 return this; 10996 } 10997}; 10998 10999Tween.prototype.init.prototype = Tween.prototype; 11000 11001Tween.propHooks = { 11002 _default: { 11003 get: function( tween ) { 11004 var result; 11005 11006 // Use a property on the element directly when it is not a DOM element, 11007 // or when there is no matching style property that exists. 11008 if ( tween.elem.nodeType !== 1 || 11009 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 11010 return tween.elem[ tween.prop ]; 11011 } 11012 11013 // Passing an empty string as a 3rd parameter to .css will automatically 11014 // attempt a parseFloat and fallback to a string if the parse fails. 11015 // Simple values such as "10px" are parsed to Float; 11016 // complex values such as "rotate(1rad)" are returned as-is. 11017 result = jQuery.css( tween.elem, tween.prop, "" ); 11018 11019 // Empty strings, null, undefined and "auto" are converted to 0. 11020 return !result || result === "auto" ? 0 : result; 11021 }, 11022 set: function( tween ) { 11023 11024 // Use step hook for back compat. 11025 // Use cssHook if its there. 11026 // Use .style if available and use plain properties where available. 11027 if ( jQuery.fx.step[ tween.prop ] ) { 11028 jQuery.fx.step[ tween.prop ]( tween ); 11029 } else if ( tween.elem.nodeType === 1 && ( 11030 jQuery.cssHooks[ tween.prop ] || 11031 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 11032 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 11033 } else { 11034 tween.elem[ tween.prop ] = tween.now; 11035 } 11036 } 11037 } 11038}; 11039 11040// Support: IE <=9 only 11041// Panic based approach to setting things on disconnected nodes 11042Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 11043 set: function( tween ) { 11044 if ( tween.elem.nodeType && tween.elem.parentNode ) { 11045 tween.elem[ tween.prop ] = tween.now; 11046 } 11047 } 11048}; 11049 11050jQuery.easing = { 11051 linear: function( p ) { 11052 return p; 11053 }, 11054 swing: function( p ) { 11055 return 0.5 - Math.cos( p * Math.PI ) / 2; 11056 }, 11057 _default: "swing" 11058}; 11059 11060jQuery.fx = Tween.prototype.init; 11061 11062// Back compat <1.8 extension point 11063jQuery.fx.step = {}; 11064 11065 11066 11067 11068var 11069 fxNow, inProgress, 11070 rfxtypes = /^(?:toggle|show|hide)$/, 11071 rrun = /queueHooks$/; 11072 11073function schedule() { 11074 if ( inProgress ) { 11075 if ( document.hidden === false && window.requestAnimationFrame ) { 11076 window.requestAnimationFrame( schedule ); 11077 } else { 11078 window.setTimeout( schedule, jQuery.fx.interval ); 11079 } 11080 11081 jQuery.fx.tick(); 11082 } 11083} 11084 11085// Animations created synchronously will run synchronously 11086function createFxNow() { 11087 window.setTimeout( function() { 11088 fxNow = undefined; 11089 } ); 11090 return ( fxNow = Date.now() ); 11091} 11092 11093// Generate parameters to create a standard animation 11094function genFx( type, includeWidth ) { 11095 var which, 11096 i = 0, 11097 attrs = { height: type }; 11098 11099 // If we include width, step value is 1 to do all cssExpand values, 11100 // otherwise step value is 2 to skip over Left and Right 11101 includeWidth = includeWidth ? 1 : 0; 11102 for ( ; i < 4; i += 2 - includeWidth ) { 11103 which = cssExpand[ i ]; 11104 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 11105 } 11106 11107 if ( includeWidth ) { 11108 attrs.opacity = attrs.width = type; 11109 } 11110 11111 return attrs; 11112} 11113 11114function createTween( value, prop, animation ) { 11115 var tween, 11116 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 11117 index = 0, 11118 length = collection.length; 11119 for ( ; index < length; index++ ) { 11120 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 11121 11122 // We're done with this property 11123 return tween; 11124 } 11125 } 11126} 11127 11128function defaultPrefilter( elem, props, opts ) { 11129 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 11130 isBox = "width" in props || "height" in props, 11131 anim = this, 11132 orig = {}, 11133 style = elem.style, 11134 hidden = elem.nodeType && isHiddenWithinTree( elem ), 11135 dataShow = dataPriv.get( elem, "fxshow" ); 11136 11137 // Queue-skipping animations hijack the fx hooks 11138 if ( !opts.queue ) { 11139 hooks = jQuery._queueHooks( elem, "fx" ); 11140 if ( hooks.unqueued == null ) { 11141 hooks.unqueued = 0; 11142 oldfire = hooks.empty.fire; 11143 hooks.empty.fire = function() { 11144 if ( !hooks.unqueued ) { 11145 oldfire(); 11146 } 11147 }; 11148 } 11149 hooks.unqueued++; 11150 11151 anim.always( function() { 11152 11153 // Ensure the complete handler is called before this completes 11154 anim.always( function() { 11155 hooks.unqueued--; 11156 if ( !jQuery.queue( elem, "fx" ).length ) { 11157 hooks.empty.fire(); 11158 } 11159 } ); 11160 } ); 11161 } 11162 11163 // Detect show/hide animations 11164 for ( prop in props ) { 11165 value = props[ prop ]; 11166 if ( rfxtypes.test( value ) ) { 11167 delete props[ prop ]; 11168 toggle = toggle || value === "toggle"; 11169 if ( value === ( hidden ? "hide" : "show" ) ) { 11170 11171 // Pretend to be hidden if this is a "show" and 11172 // there is still data from a stopped show/hide 11173 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 11174 hidden = true; 11175 11176 // Ignore all other no-op show/hide data 11177 } else { 11178 continue; 11179 } 11180 } 11181 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 11182 } 11183 } 11184 11185 // Bail out if this is a no-op like .hide().hide() 11186 propTween = !jQuery.isEmptyObject( props ); 11187 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 11188 return; 11189 } 11190 11191 // Restrict "overflow" and "display" styles during box animations 11192 if ( isBox && elem.nodeType === 1 ) { 11193 11194 // Support: IE <=9 - 11, Edge 12 - 15 11195 // Record all 3 overflow attributes because IE does not infer the shorthand 11196 // from identically-valued overflowX and overflowY and Edge just mirrors 11197 // the overflowX value there. 11198 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 11199 11200 // Identify a display type, preferring old show/hide data over the CSS cascade 11201 restoreDisplay = dataShow && dataShow.display; 11202 if ( restoreDisplay == null ) { 11203 restoreDisplay = dataPriv.get( elem, "display" ); 11204 } 11205 display = jQuery.css( elem, "display" ); 11206 if ( display === "none" ) { 11207 if ( restoreDisplay ) { 11208 display = restoreDisplay; 11209 } else { 11210 11211 // Get nonempty value(s) by temporarily forcing visibility 11212 showHide( [ elem ], true ); 11213 restoreDisplay = elem.style.display || restoreDisplay; 11214 display = jQuery.css( elem, "display" ); 11215 showHide( [ elem ] ); 11216 } 11217 } 11218 11219 // Animate inline elements as inline-block 11220 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 11221 if ( jQuery.css( elem, "float" ) === "none" ) { 11222 11223 // Restore the original display value at the end of pure show/hide animations 11224 if ( !propTween ) { 11225 anim.done( function() { 11226 style.display = restoreDisplay; 11227 } ); 11228 if ( restoreDisplay == null ) { 11229 display = style.display; 11230 restoreDisplay = display === "none" ? "" : display; 11231 } 11232 } 11233 style.display = "inline-block"; 11234 } 11235 } 11236 } 11237 11238 if ( opts.overflow ) { 11239 style.overflow = "hidden"; 11240 anim.always( function() { 11241 style.overflow = opts.overflow[ 0 ]; 11242 style.overflowX = opts.overflow[ 1 ]; 11243 style.overflowY = opts.overflow[ 2 ]; 11244 } ); 11245 } 11246 11247 // Implement show/hide animations 11248 propTween = false; 11249 for ( prop in orig ) { 11250 11251 // General show/hide setup for this element animation 11252 if ( !propTween ) { 11253 if ( dataShow ) { 11254 if ( "hidden" in dataShow ) { 11255 hidden = dataShow.hidden; 11256 } 11257 } else { 11258 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 11259 } 11260 11261 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 11262 if ( toggle ) { 11263 dataShow.hidden = !hidden; 11264 } 11265 11266 // Show elements before animating them 11267 if ( hidden ) { 11268 showHide( [ elem ], true ); 11269 } 11270 11271 /* eslint-disable no-loop-func */ 11272 11273 anim.done( function() { 11274 11275 /* eslint-enable no-loop-func */ 11276 11277 // The final step of a "hide" animation is actually hiding the element 11278 if ( !hidden ) { 11279 showHide( [ elem ] ); 11280 } 11281 dataPriv.remove( elem, "fxshow" ); 11282 for ( prop in orig ) { 11283 jQuery.style( elem, prop, orig[ prop ] ); 11284 } 11285 } ); 11286 } 11287 11288 // Per-property setup 11289 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 11290 if ( !( prop in dataShow ) ) { 11291 dataShow[ prop ] = propTween.start; 11292 if ( hidden ) { 11293 propTween.end = propTween.start; 11294 propTween.start = 0; 11295 } 11296 } 11297 } 11298} 11299 11300function propFilter( props, specialEasing ) { 11301 var index, name, easing, value, hooks; 11302 11303 // camelCase, specialEasing and expand cssHook pass 11304 for ( index in props ) { 11305 name = camelCase( index ); 11306 easing = specialEasing[ name ]; 11307 value = props[ index ]; 11308 if ( Array.isArray( value ) ) { 11309 easing = value[ 1 ]; 11310 value = props[ index ] = value[ 0 ]; 11311 } 11312 11313 if ( index !== name ) { 11314 props[ name ] = value; 11315 delete props[ index ]; 11316 } 11317 11318 hooks = jQuery.cssHooks[ name ]; 11319 if ( hooks && "expand" in hooks ) { 11320 value = hooks.expand( value ); 11321 delete props[ name ]; 11322 11323 // Not quite $.extend, this won't overwrite existing keys. 11324 // Reusing 'index' because we have the correct "name" 11325 for ( index in value ) { 11326 if ( !( index in props ) ) { 11327 props[ index ] = value[ index ]; 11328 specialEasing[ index ] = easing; 11329 } 11330 } 11331 } else { 11332 specialEasing[ name ] = easing; 11333 } 11334 } 11335} 11336 11337function Animation( elem, properties, options ) { 11338 var result, 11339 stopped, 11340 index = 0, 11341 length = Animation.prefilters.length, 11342 deferred = jQuery.Deferred().always( function() { 11343 11344 // Don't match elem in the :animated selector 11345 delete tick.elem; 11346 } ), 11347 tick = function() { 11348 if ( stopped ) { 11349 return false; 11350 } 11351 var currentTime = fxNow || createFxNow(), 11352 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 11353 11354 // Support: Android 2.3 only 11355 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 11356 temp = remaining / animation.duration || 0, 11357 percent = 1 - temp, 11358 index = 0, 11359 length = animation.tweens.length; 11360 11361 for ( ; index < length; index++ ) { 11362 animation.tweens[ index ].run( percent ); 11363 } 11364 11365 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 11366 11367 // If there's more to do, yield 11368 if ( percent < 1 && length ) { 11369 return remaining; 11370 } 11371 11372 // If this was an empty animation, synthesize a final progress notification 11373 if ( !length ) { 11374 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 11375 } 11376 11377 // Resolve the animation and report its conclusion 11378 deferred.resolveWith( elem, [ animation ] ); 11379 return false; 11380 }, 11381 animation = deferred.promise( { 11382 elem: elem, 11383 props: jQuery.extend( {}, properties ), 11384 opts: jQuery.extend( true, { 11385 specialEasing: {}, 11386 easing: jQuery.easing._default 11387 }, options ), 11388 originalProperties: properties, 11389 originalOptions: options, 11390 startTime: fxNow || createFxNow(), 11391 duration: options.duration, 11392 tweens: [], 11393 createTween: function( prop, end ) { 11394 var tween = jQuery.Tween( elem, animation.opts, prop, end, 11395 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 11396 animation.tweens.push( tween ); 11397 return tween; 11398 }, 11399 stop: function( gotoEnd ) { 11400 var index = 0, 11401 11402 // If we are going to the end, we want to run all the tweens 11403 // otherwise we skip this part 11404 length = gotoEnd ? animation.tweens.length : 0; 11405 if ( stopped ) { 11406 return this; 11407 } 11408 stopped = true; 11409 for ( ; index < length; index++ ) { 11410 animation.tweens[ index ].run( 1 ); 11411 } 11412 11413 // Resolve when we played the last frame; otherwise, reject 11414 if ( gotoEnd ) { 11415 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 11416 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 11417 } else { 11418 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 11419 } 11420 return this; 11421 } 11422 } ), 11423 props = animation.props; 11424 11425 propFilter( props, animation.opts.specialEasing ); 11426 11427 for ( ; index < length; index++ ) { 11428 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 11429 if ( result ) { 11430 if ( isFunction( result.stop ) ) { 11431 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 11432 result.stop.bind( result ); 11433 } 11434 return result; 11435 } 11436 } 11437 11438 jQuery.map( props, createTween, animation ); 11439 11440 if ( isFunction( animation.opts.start ) ) { 11441 animation.opts.start.call( elem, animation ); 11442 } 11443 11444 // Attach callbacks from options 11445 animation 11446 .progress( animation.opts.progress ) 11447 .done( animation.opts.done, animation.opts.complete ) 11448 .fail( animation.opts.fail ) 11449 .always( animation.opts.always ); 11450 11451 jQuery.fx.timer( 11452 jQuery.extend( tick, { 11453 elem: elem, 11454 anim: animation, 11455 queue: animation.opts.queue 11456 } ) 11457 ); 11458 11459 return animation; 11460} 11461 11462jQuery.Animation = jQuery.extend( Animation, { 11463 11464 tweeners: { 11465 "*": [ function( prop, value ) { 11466 var tween = this.createTween( prop, value ); 11467 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 11468 return tween; 11469 } ] 11470 }, 11471 11472 tweener: function( props, callback ) { 11473 if ( isFunction( props ) ) { 11474 callback = props; 11475 props = [ "*" ]; 11476 } else { 11477 props = props.match( rnothtmlwhite ); 11478 } 11479 11480 var prop, 11481 index = 0, 11482 length = props.length; 11483 11484 for ( ; index < length; index++ ) { 11485 prop = props[ index ]; 11486 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 11487 Animation.tweeners[ prop ].unshift( callback ); 11488 } 11489 }, 11490 11491 prefilters: [ defaultPrefilter ], 11492 11493 prefilter: function( callback, prepend ) { 11494 if ( prepend ) { 11495 Animation.prefilters.unshift( callback ); 11496 } else { 11497 Animation.prefilters.push( callback ); 11498 } 11499 } 11500} ); 11501 11502jQuery.speed = function( speed, easing, fn ) { 11503 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 11504 complete: fn || !fn && easing || 11505 isFunction( speed ) && speed, 11506 duration: speed, 11507 easing: fn && easing || easing && !isFunction( easing ) && easing 11508 }; 11509 11510 // Go to the end state if fx are off 11511 if ( jQuery.fx.off ) { 11512 opt.duration = 0; 11513 11514 } else { 11515 if ( typeof opt.duration !== "number" ) { 11516 if ( opt.duration in jQuery.fx.speeds ) { 11517 opt.duration = jQuery.fx.speeds[ opt.duration ]; 11518 11519 } else { 11520 opt.duration = jQuery.fx.speeds._default; 11521 } 11522 } 11523 } 11524 11525 // Normalize opt.queue - true/undefined/null -> "fx" 11526 if ( opt.queue == null || opt.queue === true ) { 11527 opt.queue = "fx"; 11528 } 11529 11530 // Queueing 11531 opt.old = opt.complete; 11532 11533 opt.complete = function() { 11534 if ( isFunction( opt.old ) ) { 11535 opt.old.call( this ); 11536 } 11537 11538 if ( opt.queue ) { 11539 jQuery.dequeue( this, opt.queue ); 11540 } 11541 }; 11542 11543 return opt; 11544}; 11545 11546jQuery.fn.extend( { 11547 fadeTo: function( speed, to, easing, callback ) { 11548 11549 // Show any hidden elements after setting opacity to 0 11550 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 11551 11552 // Animate to the value specified 11553 .end().animate( { opacity: to }, speed, easing, callback ); 11554 }, 11555 animate: function( prop, speed, easing, callback ) { 11556 var empty = jQuery.isEmptyObject( prop ), 11557 optall = jQuery.speed( speed, easing, callback ), 11558 doAnimation = function() { 11559 11560 // Operate on a copy of prop so per-property easing won't be lost 11561 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 11562 11563 // Empty animations, or finishing resolves immediately 11564 if ( empty || dataPriv.get( this, "finish" ) ) { 11565 anim.stop( true ); 11566 } 11567 }; 11568 11569 doAnimation.finish = doAnimation; 11570 11571 return empty || optall.queue === false ? 11572 this.each( doAnimation ) : 11573 this.queue( optall.queue, doAnimation ); 11574 }, 11575 stop: function( type, clearQueue, gotoEnd ) { 11576 var stopQueue = function( hooks ) { 11577 var stop = hooks.stop; 11578 delete hooks.stop; 11579 stop( gotoEnd ); 11580 }; 11581 11582 if ( typeof type !== "string" ) { 11583 gotoEnd = clearQueue; 11584 clearQueue = type; 11585 type = undefined; 11586 } 11587 if ( clearQueue ) { 11588 this.queue( type || "fx", [] ); 11589 } 11590 11591 return this.each( function() { 11592 var dequeue = true, 11593 index = type != null && type + "queueHooks", 11594 timers = jQuery.timers, 11595 data = dataPriv.get( this ); 11596 11597 if ( index ) { 11598 if ( data[ index ] && data[ index ].stop ) { 11599 stopQueue( data[ index ] ); 11600 } 11601 } else { 11602 for ( index in data ) { 11603 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 11604 stopQueue( data[ index ] ); 11605 } 11606 } 11607 } 11608 11609 for ( index = timers.length; index--; ) { 11610 if ( timers[ index ].elem === this && 11611 ( type == null || timers[ index ].queue === type ) ) { 11612 11613 timers[ index ].anim.stop( gotoEnd ); 11614 dequeue = false; 11615 timers.splice( index, 1 ); 11616 } 11617 } 11618 11619 // Start the next in the queue if the last step wasn't forced. 11620 // Timers currently will call their complete callbacks, which 11621 // will dequeue but only if they were gotoEnd. 11622 if ( dequeue || !gotoEnd ) { 11623 jQuery.dequeue( this, type ); 11624 } 11625 } ); 11626 }, 11627 finish: function( type ) { 11628 if ( type !== false ) { 11629 type = type || "fx"; 11630 } 11631 return this.each( function() { 11632 var index, 11633 data = dataPriv.get( this ), 11634 queue = data[ type + "queue" ], 11635 hooks = data[ type + "queueHooks" ], 11636 timers = jQuery.timers, 11637 length = queue ? queue.length : 0; 11638 11639 // Enable finishing flag on private data 11640 data.finish = true; 11641 11642 // Empty the queue first 11643 jQuery.queue( this, type, [] ); 11644 11645 if ( hooks && hooks.stop ) { 11646 hooks.stop.call( this, true ); 11647 } 11648 11649 // Look for any active animations, and finish them 11650 for ( index = timers.length; index--; ) { 11651 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 11652 timers[ index ].anim.stop( true ); 11653 timers.splice( index, 1 ); 11654 } 11655 } 11656 11657 // Look for any animations in the old queue and finish them 11658 for ( index = 0; index < length; index++ ) { 11659 if ( queue[ index ] && queue[ index ].finish ) { 11660 queue[ index ].finish.call( this ); 11661 } 11662 } 11663 11664 // Turn off finishing flag 11665 delete data.finish; 11666 } ); 11667 } 11668} ); 11669 11670jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 11671 var cssFn = jQuery.fn[ name ]; 11672 jQuery.fn[ name ] = function( speed, easing, callback ) { 11673 return speed == null || typeof speed === "boolean" ? 11674 cssFn.apply( this, arguments ) : 11675 this.animate( genFx( name, true ), speed, easing, callback ); 11676 }; 11677} ); 11678 11679// Generate shortcuts for custom animations 11680jQuery.each( { 11681 slideDown: genFx( "show" ), 11682 slideUp: genFx( "hide" ), 11683 slideToggle: genFx( "toggle" ), 11684 fadeIn: { opacity: "show" }, 11685 fadeOut: { opacity: "hide" }, 11686 fadeToggle: { opacity: "toggle" } 11687}, function( name, props ) { 11688 jQuery.fn[ name ] = function( speed, easing, callback ) { 11689 return this.animate( props, speed, easing, callback ); 11690 }; 11691} ); 11692 11693jQuery.timers = []; 11694jQuery.fx.tick = function() { 11695 var timer, 11696 i = 0, 11697 timers = jQuery.timers; 11698 11699 fxNow = Date.now(); 11700 11701 for ( ; i < timers.length; i++ ) { 11702 timer = timers[ i ]; 11703 11704 // Run the timer and safely remove it when done (allowing for external removal) 11705 if ( !timer() && timers[ i ] === timer ) { 11706 timers.splice( i--, 1 ); 11707 } 11708 } 11709 11710 if ( !timers.length ) { 11711 jQuery.fx.stop(); 11712 } 11713 fxNow = undefined; 11714}; 11715 11716jQuery.fx.timer = function( timer ) { 11717 jQuery.timers.push( timer ); 11718 jQuery.fx.start(); 11719}; 11720 11721jQuery.fx.interval = 13; 11722jQuery.fx.start = function() { 11723 if ( inProgress ) { 11724 return; 11725 } 11726 11727 inProgress = true; 11728 schedule(); 11729}; 11730 11731jQuery.fx.stop = function() { 11732 inProgress = null; 11733}; 11734 11735jQuery.fx.speeds = { 11736 slow: 600, 11737 fast: 200, 11738 11739 // Default speed 11740 _default: 400 11741}; 11742 11743 11744// Based off of the plugin by Clint Helfers, with permission. 11745jQuery.fn.delay = function( time, type ) { 11746 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 11747 type = type || "fx"; 11748 11749 return this.queue( type, function( next, hooks ) { 11750 var timeout = window.setTimeout( next, time ); 11751 hooks.stop = function() { 11752 window.clearTimeout( timeout ); 11753 }; 11754 } ); 11755}; 11756 11757 11758( function() { 11759 var input = document.createElement( "input" ), 11760 select = document.createElement( "select" ), 11761 opt = select.appendChild( document.createElement( "option" ) ); 11762 11763 input.type = "checkbox"; 11764 11765 // Support: Android <=4.3 only 11766 // Default value for a checkbox should be "on" 11767 support.checkOn = input.value !== ""; 11768 11769 // Support: IE <=11 only 11770 // Must access selectedIndex to make default options select 11771 support.optSelected = opt.selected; 11772 11773 // Support: IE <=11 only 11774 // An input loses its value after becoming a radio 11775 input = document.createElement( "input" ); 11776 input.value = "t"; 11777 input.type = "radio"; 11778 support.radioValue = input.value === "t"; 11779} )(); 11780 11781 11782var boolHook, 11783 attrHandle = jQuery.expr.attrHandle; 11784 11785jQuery.fn.extend( { 11786 attr: function( name, value ) { 11787 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 11788 }, 11789 11790 removeAttr: function( name ) { 11791 return this.each( function() { 11792 jQuery.removeAttr( this, name ); 11793 } ); 11794 } 11795} ); 11796 11797jQuery.extend( { 11798 attr: function( elem, name, value ) { 11799 var ret, hooks, 11800 nType = elem.nodeType; 11801 11802 // Don't get/set attributes on text, comment and attribute nodes 11803 if ( nType === 3 || nType === 8 || nType === 2 ) { 11804 return; 11805 } 11806 11807 // Fallback to prop when attributes are not supported 11808 if ( typeof elem.getAttribute === "undefined" ) { 11809 return jQuery.prop( elem, name, value ); 11810 } 11811 11812 // Attribute hooks are determined by the lowercase version 11813 // Grab necessary hook if one is defined 11814 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 11815 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 11816 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 11817 } 11818 11819 if ( value !== undefined ) { 11820 if ( value === null ) { 11821 jQuery.removeAttr( elem, name ); 11822 return; 11823 } 11824 11825 if ( hooks && "set" in hooks && 11826 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 11827 return ret; 11828 } 11829 11830 elem.setAttribute( name, value + "" ); 11831 return value; 11832 } 11833 11834 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 11835 return ret; 11836 } 11837 11838 ret = jQuery.find.attr( elem, name ); 11839 11840 // Non-existent attributes return null, we normalize to undefined 11841 return ret == null ? undefined : ret; 11842 }, 11843 11844 attrHooks: { 11845 type: { 11846 set: function( elem, value ) { 11847 if ( !support.radioValue && value === "radio" && 11848 nodeName( elem, "input" ) ) { 11849 var val = elem.value; 11850 elem.setAttribute( "type", value ); 11851 if ( val ) { 11852 elem.value = val; 11853 } 11854 return value; 11855 } 11856 } 11857 } 11858 }, 11859 11860 removeAttr: function( elem, value ) { 11861 var name, 11862 i = 0, 11863 11864 // Attribute names can contain non-HTML whitespace characters 11865 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 11866 attrNames = value && value.match( rnothtmlwhite ); 11867 11868 if ( attrNames && elem.nodeType === 1 ) { 11869 while ( ( name = attrNames[ i++ ] ) ) { 11870 elem.removeAttribute( name ); 11871 } 11872 } 11873 } 11874} ); 11875 11876// Hooks for boolean attributes 11877boolHook = { 11878 set: function( elem, value, name ) { 11879 if ( value === false ) { 11880 11881 // Remove boolean attributes when set to false 11882 jQuery.removeAttr( elem, name ); 11883 } else { 11884 elem.setAttribute( name, name ); 11885 } 11886 return name; 11887 } 11888}; 11889 11890jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 11891 var getter = attrHandle[ name ] || jQuery.find.attr; 11892 11893 attrHandle[ name ] = function( elem, name, isXML ) { 11894 var ret, handle, 11895 lowercaseName = name.toLowerCase(); 11896 11897 if ( !isXML ) { 11898 11899 // Avoid an infinite loop by temporarily removing this function from the getter 11900 handle = attrHandle[ lowercaseName ]; 11901 attrHandle[ lowercaseName ] = ret; 11902 ret = getter( elem, name, isXML ) != null ? 11903 lowercaseName : 11904 null; 11905 attrHandle[ lowercaseName ] = handle; 11906 } 11907 return ret; 11908 }; 11909} ); 11910 11911 11912 11913 11914var rfocusable = /^(?:input|select|textarea|button)$/i, 11915 rclickable = /^(?:a|area)$/i; 11916 11917jQuery.fn.extend( { 11918 prop: function( name, value ) { 11919 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 11920 }, 11921 11922 removeProp: function( name ) { 11923 return this.each( function() { 11924 delete this[ jQuery.propFix[ name ] || name ]; 11925 } ); 11926 } 11927} ); 11928 11929jQuery.extend( { 11930 prop: function( elem, name, value ) { 11931 var ret, hooks, 11932 nType = elem.nodeType; 11933 11934 // Don't get/set properties on text, comment and attribute nodes 11935 if ( nType === 3 || nType === 8 || nType === 2 ) { 11936 return; 11937 } 11938 11939 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 11940 11941 // Fix name and attach hooks 11942 name = jQuery.propFix[ name ] || name; 11943 hooks = jQuery.propHooks[ name ]; 11944 } 11945 11946 if ( value !== undefined ) { 11947 if ( hooks && "set" in hooks && 11948 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 11949 return ret; 11950 } 11951 11952 return ( elem[ name ] = value ); 11953 } 11954 11955 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 11956 return ret; 11957 } 11958 11959 return elem[ name ]; 11960 }, 11961 11962 propHooks: { 11963 tabIndex: { 11964 get: function( elem ) { 11965 11966 // Support: IE <=9 - 11 only 11967 // elem.tabIndex doesn't always return the 11968 // correct value when it hasn't been explicitly set 11969 // Use proper attribute retrieval (trac-12072) 11970 var tabindex = jQuery.find.attr( elem, "tabindex" ); 11971 11972 if ( tabindex ) { 11973 return parseInt( tabindex, 10 ); 11974 } 11975 11976 if ( 11977 rfocusable.test( elem.nodeName ) || 11978 rclickable.test( elem.nodeName ) && 11979 elem.href 11980 ) { 11981 return 0; 11982 } 11983 11984 return -1; 11985 } 11986 } 11987 }, 11988 11989 propFix: { 11990 "for": "htmlFor", 11991 "class": "className" 11992 } 11993} ); 11994 11995// Support: IE <=11 only 11996// Accessing the selectedIndex property 11997// forces the browser to respect setting selected 11998// on the option 11999// The getter ensures a default option is selected 12000// when in an optgroup 12001// eslint rule "no-unused-expressions" is disabled for this code 12002// since it considers such accessions noop 12003if ( !support.optSelected ) { 12004 jQuery.propHooks.selected = { 12005 get: function( elem ) { 12006 12007 /* eslint no-unused-expressions: "off" */ 12008 12009 var parent = elem.parentNode; 12010 if ( parent && parent.parentNode ) { 12011 parent.parentNode.selectedIndex; 12012 } 12013 return null; 12014 }, 12015 set: function( elem ) { 12016 12017 /* eslint no-unused-expressions: "off" */ 12018 12019 var parent = elem.parentNode; 12020 if ( parent ) { 12021 parent.selectedIndex; 12022 12023 if ( parent.parentNode ) { 12024 parent.parentNode.selectedIndex; 12025 } 12026 } 12027 } 12028 }; 12029} 12030 12031jQuery.each( [ 12032 "tabIndex", 12033 "readOnly", 12034 "maxLength", 12035 "cellSpacing", 12036 "cellPadding", 12037 "rowSpan", 12038 "colSpan", 12039 "useMap", 12040 "frameBorder", 12041 "contentEditable" 12042], function() { 12043 jQuery.propFix[ this.toLowerCase() ] = this; 12044} ); 12045 12046 12047 12048 12049 // Strip and collapse whitespace according to HTML spec 12050 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 12051 function stripAndCollapse( value ) { 12052 var tokens = value.match( rnothtmlwhite ) || []; 12053 return tokens.join( " " ); 12054 } 12055 12056 12057function getClass( elem ) { 12058 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 12059} 12060 12061function classesToArray( value ) { 12062 if ( Array.isArray( value ) ) { 12063 return value; 12064 } 12065 if ( typeof value === "string" ) { 12066 return value.match( rnothtmlwhite ) || []; 12067 } 12068 return []; 12069} 12070 12071jQuery.fn.extend( { 12072 addClass: function( value ) { 12073 var classNames, cur, curValue, className, i, finalValue; 12074 12075 if ( isFunction( value ) ) { 12076 return this.each( function( j ) { 12077 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 12078 } ); 12079 } 12080 12081 classNames = classesToArray( value ); 12082 12083 if ( classNames.length ) { 12084 return this.each( function() { 12085 curValue = getClass( this ); 12086 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 12087 12088 if ( cur ) { 12089 for ( i = 0; i < classNames.length; i++ ) { 12090 className = classNames[ i ]; 12091 if ( cur.indexOf( " " + className + " " ) < 0 ) { 12092 cur += className + " "; 12093 } 12094 } 12095 12096 // Only assign if different to avoid unneeded rendering. 12097 finalValue = stripAndCollapse( cur ); 12098 if ( curValue !== finalValue ) { 12099 this.setAttribute( "class", finalValue ); 12100 } 12101 } 12102 } ); 12103 } 12104 12105 return this; 12106 }, 12107 12108 removeClass: function( value ) { 12109 var classNames, cur, curValue, className, i, finalValue; 12110 12111 if ( isFunction( value ) ) { 12112 return this.each( function( j ) { 12113 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 12114 } ); 12115 } 12116 12117 if ( !arguments.length ) { 12118 return this.attr( "class", "" ); 12119 } 12120 12121 classNames = classesToArray( value ); 12122 12123 if ( classNames.length ) { 12124 return this.each( function() { 12125 curValue = getClass( this ); 12126 12127 // This expression is here for better compressibility (see addClass) 12128 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 12129 12130 if ( cur ) { 12131 for ( i = 0; i < classNames.length; i++ ) { 12132 className = classNames[ i ]; 12133 12134 // Remove *all* instances 12135 while ( cur.indexOf( " " + className + " " ) > -1 ) { 12136 cur = cur.replace( " " + className + " ", " " ); 12137 } 12138 } 12139 12140 // Only assign if different to avoid unneeded rendering. 12141 finalValue = stripAndCollapse( cur ); 12142 if ( curValue !== finalValue ) { 12143 this.setAttribute( "class", finalValue ); 12144 } 12145 } 12146 } ); 12147 } 12148 12149 return this; 12150 }, 12151 12152 toggleClass: function( value, stateVal ) { 12153 var classNames, className, i, self, 12154 type = typeof value, 12155 isValidValue = type === "string" || Array.isArray( value ); 12156 12157 if ( isFunction( value ) ) { 12158 return this.each( function( i ) { 12159 jQuery( this ).toggleClass( 12160 value.call( this, i, getClass( this ), stateVal ), 12161 stateVal 12162 ); 12163 } ); 12164 } 12165 12166 if ( typeof stateVal === "boolean" && isValidValue ) { 12167 return stateVal ? this.addClass( value ) : this.removeClass( value ); 12168 } 12169 12170 classNames = classesToArray( value ); 12171 12172 return this.each( function() { 12173 if ( isValidValue ) { 12174 12175 // Toggle individual class names 12176 self = jQuery( this ); 12177 12178 for ( i = 0; i < classNames.length; i++ ) { 12179 className = classNames[ i ]; 12180 12181 // Check each className given, space separated list 12182 if ( self.hasClass( className ) ) { 12183 self.removeClass( className ); 12184 } else { 12185 self.addClass( className ); 12186 } 12187 } 12188 12189 // Toggle whole class name 12190 } else if ( value === undefined || type === "boolean" ) { 12191 className = getClass( this ); 12192 if ( className ) { 12193 12194 // Store className if set 12195 dataPriv.set( this, "__className__", className ); 12196 } 12197 12198 // If the element has a class name or if we're passed `false`, 12199 // then remove the whole classname (if there was one, the above saved it). 12200 // Otherwise bring back whatever was previously saved (if anything), 12201 // falling back to the empty string if nothing was stored. 12202 if ( this.setAttribute ) { 12203 this.setAttribute( "class", 12204 className || value === false ? 12205 "" : 12206 dataPriv.get( this, "__className__" ) || "" 12207 ); 12208 } 12209 } 12210 } ); 12211 }, 12212 12213 hasClass: function( selector ) { 12214 var className, elem, 12215 i = 0; 12216 12217 className = " " + selector + " "; 12218 while ( ( elem = this[ i++ ] ) ) { 12219 if ( elem.nodeType === 1 && 12220 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 12221 return true; 12222 } 12223 } 12224 12225 return false;
vendor: 1,385 bytes, lines 12226-12295
12226 } 12227} ); 12228 12229 12230 12231 12232var rreturn = /\r/g; 12233 12234jQuery.fn.extend( { 12235 val: function( value ) { 12236 var hooks, ret, valueIsFunction, 12237 elem = this[ 0 ]; 12238 12239 if ( !arguments.length ) { 12240 if ( elem ) { 12241 hooks = jQuery.valHooks[ elem.type ] || 12242 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 12243 12244 if ( hooks && 12245 "get" in hooks && 12246 ( ret = hooks.get( elem, "value" ) ) !== undefined 12247 ) { 12248 return ret; 12249 } 12250 12251 ret = elem.value; 12252 12253 // Handle most common string cases 12254 if ( typeof ret === "string" ) { 12255 return ret.replace( rreturn, "" ); 12256 } 12257 12258 // Handle cases where value is null/undef or number 12259 return ret == null ? "" : ret; 12260 } 12261 12262 return; 12263 } 12264 12265 valueIsFunction = isFunction( value ); 12266 12267 return this.each( function( i ) { 12268 var val; 12269 12270 if ( this.nodeType !== 1 ) { 12271 return; 12272 } 12273 12274 if ( valueIsFunction ) { 12275 val = value.call( this, i, jQuery( this ).val() ); 12276 } else { 12277 val = value; 12278 } 12279 12280 // Treat null/undefined as ""; convert numbers to string 12281 if ( val == null ) { 12282 val = ""; 12283 12284 } else if ( typeof val === "number" ) { 12285 val += ""; 12286 12287 } else if ( Array.isArray( val ) ) { 12288 val = jQuery.map( val, function( value ) { 12289 return value == null ? "" : value + ""; 12290 } ); 12291 } 12292 12293 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 12294 12295 // If set returns undefined, fall back to normal setting
vendor: 43,419 bytes, lines 12296-13985
12296 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 12297 this.value = val; 12298 } 12299 } ); 12300 } 12301} ); 12302 12303jQuery.extend( { 12304 valHooks: { 12305 option: { 12306 get: function( elem ) { 12307 12308 var val = jQuery.find.attr( elem, "value" ); 12309 return val != null ? 12310 val : 12311 12312 // Support: IE <=10 - 11 only 12313 // option.text throws exceptions (trac-14686, trac-14858) 12314 // Strip and collapse whitespace 12315 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 12316 stripAndCollapse( jQuery.text( elem ) ); 12317 } 12318 }, 12319 select: { 12320 get: function( elem ) { 12321 var value, option, i, 12322 options = elem.options, 12323 index = elem.selectedIndex, 12324 one = elem.type === "select-one", 12325 values = one ? null : [], 12326 max = one ? index + 1 : options.length; 12327 12328 if ( index < 0 ) { 12329 i = max; 12330 12331 } else { 12332 i = one ? index : 0; 12333 } 12334 12335 // Loop through all the selected options 12336 for ( ; i < max; i++ ) { 12337 option = options[ i ]; 12338 12339 // Support: IE <=9 only 12340 // IE8-9 doesn't update selected after form reset (trac-2551) 12341 if ( ( option.selected || i === index ) && 12342 12343 // Don't return options that are disabled or in a disabled optgroup 12344 !option.disabled && 12345 ( !option.parentNode.disabled || 12346 !nodeName( option.parentNode, "optgroup" ) ) ) { 12347 12348 // Get the specific value for the option 12349 value = jQuery( option ).val(); 12350 12351 // We don't need an array for one selects 12352 if ( one ) { 12353 return value; 12354 } 12355 12356 // Multi-Selects return an array 12357 values.push( value ); 12358 } 12359 } 12360 12361 return values; 12362 }, 12363 12364 set: function( elem, value ) { 12365 var optionSet, option, 12366 options = elem.options, 12367 values = jQuery.makeArray( value ), 12368 i = options.length; 12369 12370 while ( i-- ) { 12371 option = options[ i ]; 12372 12373 /* eslint-disable no-cond-assign */ 12374 12375 if ( option.selected = 12376 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 12377 ) { 12378 optionSet = true; 12379 } 12380 12381 /* eslint-enable no-cond-assign */ 12382 } 12383 12384 // Force browsers to behave consistently when non-matching value is set 12385 if ( !optionSet ) { 12386 elem.selectedIndex = -1; 12387 } 12388 return values; 12389 } 12390 } 12391 } 12392} ); 12393 12394// Radios and checkboxes getter/setter 12395jQuery.each( [ "radio", "checkbox" ], function() { 12396 jQuery.valHooks[ this ] = { 12397 set: function( elem, value ) { 12398 if ( Array.isArray( value ) ) { 12399 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 12400 } 12401 } 12402 }; 12403 if ( !support.checkOn ) { 12404 jQuery.valHooks[ this ].get = function( elem ) { 12405 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 12406 }; 12407 } 12408} ); 12409 12410 12411 12412 12413// Return jQuery for attributes-only inclusion 12414var location = window.location; 12415 12416var nonce = { guid: Date.now() }; 12417 12418var rquery = ( /\?/ ); 12419 12420 12421 12422// Cross-browser xml parsing 12423jQuery.parseXML = function( data ) { 12424 var xml, parserErrorElem; 12425 if ( !data || typeof data !== "string" ) { 12426 return null; 12427 } 12428 12429 // Support: IE 9 - 11 only 12430 // IE throws on parseFromString with invalid input. 12431 try { 12432 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 12433 } catch ( e ) {} 12434 12435 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 12436 if ( !xml || parserErrorElem ) { 12437 jQuery.error( "Invalid XML: " + ( 12438 parserErrorElem ? 12439 jQuery.map( parserErrorElem.childNodes, function( el ) { 12440 return el.textContent; 12441 } ).join( "\n" ) : 12442 data 12443 ) ); 12444 } 12445 return xml; 12446}; 12447 12448 12449var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 12450 stopPropagationCallback = function( e ) { 12451 e.stopPropagation(); 12452 }; 12453 12454jQuery.extend( jQuery.event, { 12455 12456 trigger: function( event, data, elem, onlyHandlers ) { 12457 12458 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 12459 eventPath = [ elem || document ], 12460 type = hasOwn.call( event, "type" ) ? event.type : event, 12461 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 12462 12463 cur = lastElement = tmp = elem = elem || document; 12464 12465 // Don't do events on text and comment nodes 12466 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 12467 return; 12468 } 12469 12470 // focus/blur morphs to focusin/out; ensure we're not firing them right now 12471 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 12472 return; 12473 } 12474 12475 if ( type.indexOf( "." ) > -1 ) { 12476 12477 // Namespaced trigger; create a regexp to match event type in handle() 12478 namespaces = type.split( "." ); 12479 type = namespaces.shift(); 12480 namespaces.sort(); 12481 } 12482 ontype = type.indexOf( ":" ) < 0 && "on" + type; 12483 12484 // Caller can pass in a jQuery.Event object, Object, or just an event type string 12485 event = event[ jQuery.expando ] ? 12486 event : 12487 new jQuery.Event( type, typeof event === "object" && event ); 12488 12489 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 12490 event.isTrigger = onlyHandlers ? 2 : 3; 12491 event.namespace = namespaces.join( "." ); 12492 event.rnamespace = event.namespace ? 12493 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 12494 null; 12495 12496 // Clean up the event in case it is being reused 12497 event.result = undefined; 12498 if ( !event.target ) { 12499 event.target = elem; 12500 } 12501 12502 // Clone any incoming data and prepend the event, creating the handler arg list 12503 data = data == null ? 12504 [ event ] : 12505 jQuery.makeArray( data, [ event ] ); 12506 12507 // Allow special events to draw outside the lines 12508 special = jQuery.event.special[ type ] || {}; 12509 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 12510 return; 12511 } 12512 12513 // Determine event propagation path in advance, per W3C events spec (trac-9951) 12514 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 12515 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 12516 12517 bubbleType = special.delegateType || type; 12518 if ( !rfocusMorph.test( bubbleType + type ) ) { 12519 cur = cur.parentNode; 12520 } 12521 for ( ; cur; cur = cur.parentNode ) { 12522 eventPath.push( cur ); 12523 tmp = cur; 12524 } 12525 12526 // Only add window if we got to document (e.g., not plain obj or detached DOM) 12527 if ( tmp === ( elem.ownerDocument || document ) ) { 12528 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 12529 } 12530 } 12531 12532 // Fire handlers on the event path 12533 i = 0; 12534 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 12535 lastElement = cur; 12536 event.type = i > 1 ? 12537 bubbleType : 12538 special.bindType || type; 12539 12540 // jQuery handler 12541 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 12542 dataPriv.get( cur, "handle" ); 12543 if ( handle ) { 12544 handle.apply( cur, data ); 12545 } 12546 12547 // Native handler 12548 handle = ontype && cur[ ontype ]; 12549 if ( handle && handle.apply && acceptData( cur ) ) { 12550 event.result = handle.apply( cur, data ); 12551 if ( event.result === false ) { 12552 event.preventDefault(); 12553 } 12554 } 12555 } 12556 event.type = type; 12557 12558 // If nobody prevented the default action, do it now 12559 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 12560 12561 if ( ( !special._default || 12562 special._default.apply( eventPath.pop(), data ) === false ) && 12563 acceptData( elem ) ) { 12564 12565 // Call a native DOM method on the target with the same name as the event. 12566 // Don't do default actions on window, that's where global variables be (trac-6170) 12567 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 12568 12569 // Don't re-trigger an onFOO event when we call its FOO() method 12570 tmp = elem[ ontype ]; 12571 12572 if ( tmp ) { 12573 elem[ ontype ] = null; 12574 } 12575 12576 // Prevent re-triggering of the same event, since we already bubbled it above 12577 jQuery.event.triggered = type; 12578 12579 if ( event.isPropagationStopped() ) { 12580 lastElement.addEventListener( type, stopPropagationCallback ); 12581 } 12582 12583 elem[ type ](); 12584 12585 if ( event.isPropagationStopped() ) { 12586 lastElement.removeEventListener( type, stopPropagationCallback ); 12587 } 12588 12589 jQuery.event.triggered = undefined; 12590 12591 if ( tmp ) { 12592 elem[ ontype ] = tmp; 12593 } 12594 } 12595 } 12596 } 12597 12598 return event.result; 12599 }, 12600 12601 // Piggyback on a donor event to simulate a different one 12602 // Used only for `focus(in | out)` events 12603 simulate: function( type, elem, event ) { 12604 var e = jQuery.extend( 12605 new jQuery.Event(), 12606 event, 12607 { 12608 type: type, 12609 isSimulated: true 12610 } 12611 ); 12612 12613 jQuery.event.trigger( e, null, elem ); 12614 } 12615 12616} ); 12617 12618jQuery.fn.extend( { 12619 12620 trigger: function( type, data ) { 12621 return this.each( function() { 12622 jQuery.event.trigger( type, data, this ); 12623 } ); 12624 }, 12625 triggerHandler: function( type, data ) { 12626 var elem = this[ 0 ]; 12627 if ( elem ) { 12628 return jQuery.event.trigger( type, data, elem, true ); 12629 } 12630 } 12631} ); 12632 12633 12634var 12635 rbracket = /\[\]$/, 12636 rCRLF = /\r?\n/g, 12637 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 12638 rsubmittable = /^(?:input|select|textarea|keygen)/i; 12639 12640function buildParams( prefix, obj, traditional, add ) { 12641 var name; 12642 12643 if ( Array.isArray( obj ) ) { 12644 12645 // Serialize array item. 12646 jQuery.each( obj, function( i, v ) { 12647 if ( traditional || rbracket.test( prefix ) ) { 12648 12649 // Treat each array item as a scalar. 12650 add( prefix, v ); 12651 12652 } else { 12653 12654 // Item is non-scalar (array or object), encode its numeric index. 12655 buildParams( 12656 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 12657 v, 12658 traditional, 12659 add 12660 ); 12661 } 12662 } ); 12663 12664 } else if ( !traditional && toType( obj ) === "object" ) { 12665 12666 // Serialize object item. 12667 for ( name in obj ) { 12668 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 12669 } 12670 12671 } else { 12672 12673 // Serialize scalar item. 12674 add( prefix, obj ); 12675 } 12676} 12677 12678// Serialize an array of form elements or a set of 12679// key/values into a query string 12680jQuery.param = function( a, traditional ) { 12681 var prefix, 12682 s = [], 12683 add = function( key, valueOrFunction ) { 12684 12685 // If value is a function, invoke it and use its return value 12686 var value = isFunction( valueOrFunction ) ? 12687 valueOrFunction() : 12688 valueOrFunction; 12689 12690 s[ s.length ] = encodeURIComponent( key ) + "=" + 12691 encodeURIComponent( value == null ? "" : value ); 12692 }; 12693 12694 if ( a == null ) { 12695 return ""; 12696 } 12697 12698 // If an array was passed in, assume that it is an array of form elements. 12699 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 12700 12701 // Serialize the form elements 12702 jQuery.each( a, function() { 12703 add( this.name, this.value ); 12704 } ); 12705 12706 } else { 12707 12708 // If traditional, encode the "old" way (the way 1.3.2 or older 12709 // did it), otherwise encode params recursively. 12710 for ( prefix in a ) { 12711 buildParams( prefix, a[ prefix ], traditional, add ); 12712 } 12713 } 12714 12715 // Return the resulting serialization 12716 return s.join( "&" ); 12717}; 12718 12719jQuery.fn.extend( { 12720 serialize: function() { 12721 return jQuery.param( this.serializeArray() ); 12722 }, 12723 serializeArray: function() { 12724 return this.map( function() { 12725 12726 // Can add propHook for "elements" to filter or add form elements 12727 var elements = jQuery.prop( this, "elements" ); 12728 return elements ? jQuery.makeArray( elements ) : this; 12729 } ).filter( function() { 12730 var type = this.type; 12731 12732 // Use .is( ":disabled" ) so that fieldset[disabled] works 12733 return this.name && !jQuery( this ).is( ":disabled" ) && 12734 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 12735 ( this.checked || !rcheckableType.test( type ) ); 12736 } ).map( function( _i, elem ) { 12737 var val = jQuery( this ).val(); 12738 12739 if ( val == null ) { 12740 return null; 12741 } 12742 12743 if ( Array.isArray( val ) ) { 12744 return jQuery.map( val, function( val ) { 12745 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 12746 } ); 12747 } 12748 12749 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 12750 } ).get(); 12751 } 12752} ); 12753 12754 12755var 12756 r20 = /%20/g, 12757 rhash = /#.*$/, 12758 rantiCache = /([?&])_=[^&]*/, 12759 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 12760 12761 // trac-7653, trac-8125, trac-8152: local protocol detection 12762 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 12763 rnoContent = /^(?:GET|HEAD)$/, 12764 rprotocol = /^\/\//, 12765 12766 /* Prefilters 12767 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 12768 * 2) These are called: 12769 * - BEFORE asking for a transport 12770 * - AFTER param serialization (s.data is a string if s.processData is true) 12771 * 3) key is the dataType 12772 * 4) the catchall symbol "*" can be used 12773 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 12774 */ 12775 prefilters = {}, 12776 12777 /* Transports bindings 12778 * 1) key is the dataType 12779 * 2) the catchall symbol "*" can be used 12780 * 3) selection will start with transport dataType and THEN go to "*" if needed 12781 */ 12782 transports = {}, 12783 12784 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 12785 allTypes = "*/".concat( "*" ), 12786 12787 // Anchor tag for parsing the document origin 12788 originAnchor = document.createElement( "a" ); 12789 12790originAnchor.href = location.href; 12791 12792// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 12793function addToPrefiltersOrTransports( structure ) { 12794 12795 // dataTypeExpression is optional and defaults to "*" 12796 return function( dataTypeExpression, func ) { 12797 12798 if ( typeof dataTypeExpression !== "string" ) { 12799 func = dataTypeExpression; 12800 dataTypeExpression = "*"; 12801 } 12802 12803 var dataType, 12804 i = 0, 12805 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 12806 12807 if ( isFunction( func ) ) { 12808 12809 // For each dataType in the dataTypeExpression 12810 while ( ( dataType = dataTypes[ i++ ] ) ) { 12811 12812 // Prepend if requested 12813 if ( dataType[ 0 ] === "+" ) { 12814 dataType = dataType.slice( 1 ) || "*"; 12815 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 12816 12817 // Otherwise append 12818 } else { 12819 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 12820 } 12821 } 12822 } 12823 }; 12824} 12825 12826// Base inspection function for prefilters and transports 12827function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 12828 12829 var inspected = {}, 12830 seekingTransport = ( structure === transports ); 12831 12832 function inspect( dataType ) { 12833 var selected; 12834 inspected[ dataType ] = true; 12835 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 12836 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 12837 if ( typeof dataTypeOrTransport === "string" && 12838 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 12839 12840 options.dataTypes.unshift( dataTypeOrTransport ); 12841 inspect( dataTypeOrTransport ); 12842 return false; 12843 } else if ( seekingTransport ) { 12844 return !( selected = dataTypeOrTransport ); 12845 } 12846 } ); 12847 return selected; 12848 } 12849 12850 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 12851} 12852 12853// A special extend for ajax options 12854// that takes "flat" options (not to be deep extended) 12855// Fixes trac-9887 12856function ajaxExtend( target, src ) { 12857 var key, deep, 12858 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 12859 12860 for ( key in src ) { 12861 if ( src[ key ] !== undefined ) { 12862 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 12863 } 12864 } 12865 if ( deep ) { 12866 jQuery.extend( true, target, deep ); 12867 } 12868 12869 return target; 12870} 12871 12872/* Handles responses to an ajax request: 12873 * - finds the right dataType (mediates between content-type and expected dataType) 12874 * - returns the corresponding response 12875 */ 12876function ajaxHandleResponses( s, jqXHR, responses ) { 12877 12878 var ct, type, finalDataType, firstDataType, 12879 contents = s.contents, 12880 dataTypes = s.dataTypes; 12881 12882 // Remove auto dataType and get content-type in the process 12883 while ( dataTypes[ 0 ] === "*" ) { 12884 dataTypes.shift(); 12885 if ( ct === undefined ) { 12886 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 12887 } 12888 } 12889 12890 // Check if we're dealing with a known content-type 12891 if ( ct ) { 12892 for ( type in contents ) { 12893 if ( contents[ type ] && contents[ type ].test( ct ) ) { 12894 dataTypes.unshift( type ); 12895 break; 12896 } 12897 } 12898 } 12899 12900 // Check to see if we have a response for the expected dataType 12901 if ( dataTypes[ 0 ] in responses ) { 12902 finalDataType = dataTypes[ 0 ]; 12903 } else { 12904 12905 // Try convertible dataTypes 12906 for ( type in responses ) { 12907 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 12908 finalDataType = type; 12909 break; 12910 } 12911 if ( !firstDataType ) { 12912 firstDataType = type; 12913 } 12914 } 12915 12916 // Or just use first one 12917 finalDataType = finalDataType || firstDataType; 12918 } 12919 12920 // If we found a dataType 12921 // We add the dataType to the list if needed 12922 // and return the corresponding response 12923 if ( finalDataType ) { 12924 if ( finalDataType !== dataTypes[ 0 ] ) { 12925 dataTypes.unshift( finalDataType ); 12926 } 12927 return responses[ finalDataType ]; 12928 } 12929} 12930 12931/* Chain conversions given the request and the original response 12932 * Also sets the responseXXX fields on the jqXHR instance 12933 */ 12934function ajaxConvert( s, response, jqXHR, isSuccess ) { 12935 var conv2, current, conv, tmp, prev, 12936 converters = {}, 12937 12938 // Work with a copy of dataTypes in case we need to modify it for conversion 12939 dataTypes = s.dataTypes.slice(); 12940 12941 // Create converters map with lowercased keys 12942 if ( dataTypes[ 1 ] ) { 12943 for ( conv in s.converters ) { 12944 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 12945 } 12946 } 12947 12948 current = dataTypes.shift(); 12949 12950 // Convert to each sequential dataType 12951 while ( current ) { 12952 12953 if ( s.responseFields[ current ] ) { 12954 jqXHR[ s.responseFields[ current ] ] = response; 12955 } 12956 12957 // Apply the dataFilter if provided 12958 if ( !prev && isSuccess && s.dataFilter ) { 12959 response = s.dataFilter( response, s.dataType ); 12960 } 12961 12962 prev = current; 12963 current = dataTypes.shift(); 12964 12965 if ( current ) { 12966 12967 // There's only work to do if current dataType is non-auto 12968 if ( current === "*" ) { 12969 12970 current = prev; 12971 12972 // Convert response if prev dataType is non-auto and differs from current 12973 } else if ( prev !== "*" && prev !== current ) { 12974 12975 // Seek a direct converter 12976 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 12977 12978 // If none found, seek a pair 12979 if ( !conv ) { 12980 for ( conv2 in converters ) { 12981 12982 // If conv2 outputs current 12983 tmp = conv2.split( " " ); 12984 if ( tmp[ 1 ] === current ) { 12985 12986 // If prev can be converted to accepted input 12987 conv = converters[ prev + " " + tmp[ 0 ] ] || 12988 converters[ "* " + tmp[ 0 ] ]; 12989 if ( conv ) { 12990 12991 // Condense equivalence converters 12992 if ( conv === true ) { 12993 conv = converters[ conv2 ]; 12994 12995 // Otherwise, insert the intermediate dataType 12996 } else if ( converters[ conv2 ] !== true ) { 12997 current = tmp[ 0 ]; 12998 dataTypes.unshift( tmp[ 1 ] ); 12999 } 13000 break; 13001 } 13002 } 13003 } 13004 } 13005 13006 // Apply converter (if not an equivalence) 13007 if ( conv !== true ) { 13008 13009 // Unless errors are allowed to bubble, catch and return them 13010 if ( conv && s.throws ) { 13011 response = conv( response ); 13012 } else { 13013 try { 13014 response = conv( response ); 13015 } catch ( e ) { 13016 return { 13017 state: "parsererror", 13018 error: conv ? e : "No conversion from " + prev + " to " + current 13019 }; 13020 } 13021 } 13022 } 13023 } 13024 } 13025 } 13026 13027 return { state: "success", data: response }; 13028} 13029 13030jQuery.extend( { 13031 13032 // Counter for holding the number of active queries 13033 active: 0, 13034 13035 // Last-Modified header cache for next request 13036 lastModified: {}, 13037 etag: {}, 13038 13039 ajaxSettings: { 13040 url: location.href, 13041 type: "GET", 13042 isLocal: rlocalProtocol.test( location.protocol ), 13043 global: true, 13044 processData: true, 13045 async: true, 13046 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 13047 13048 /* 13049 timeout: 0, 13050 data: null, 13051 dataType: null, 13052 username: null, 13053 password: null, 13054 cache: null, 13055 throws: false, 13056 traditional: false, 13057 headers: {}, 13058 */ 13059 13060 accepts: { 13061 "*": allTypes, 13062 text: "text/plain", 13063 html: "text/html", 13064 xml: "application/xml, text/xml", 13065 json: "application/json, text/javascript" 13066 }, 13067 13068 contents: { 13069 xml: /\bxml\b/, 13070 html: /\bhtml/, 13071 json: /\bjson\b/ 13072 }, 13073 13074 responseFields: { 13075 xml: "responseXML", 13076 text: "responseText", 13077 json: "responseJSON" 13078 }, 13079 13080 // Data converters 13081 // Keys separate source (or catchall "*") and destination types with a single space 13082 converters: { 13083 13084 // Convert anything to text 13085 "* text": String, 13086 13087 // Text to html (true = no transformation) 13088 "text html": true, 13089 13090 // Evaluate text as a json expression 13091 "text json": JSON.parse, 13092 13093 // Parse text as xml 13094 "text xml": jQuery.parseXML 13095 }, 13096 13097 // For options that shouldn't be deep extended: 13098 // you can add your own custom options here if 13099 // and when you create one that shouldn't be 13100 // deep extended (see ajaxExtend) 13101 flatOptions: { 13102 url: true, 13103 context: true 13104 } 13105 }, 13106 13107 // Creates a full fledged settings object into target 13108 // with both ajaxSettings and settings fields. 13109 // If target is omitted, writes into ajaxSettings. 13110 ajaxSetup: function( target, settings ) { 13111 return settings ? 13112 13113 // Building a settings object 13114 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 13115 13116 // Extending ajaxSettings 13117 ajaxExtend( jQuery.ajaxSettings, target ); 13118 }, 13119 13120 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 13121 ajaxTransport: addToPrefiltersOrTransports( transports ), 13122 13123 // Main method 13124 ajax: function( url, options ) { 13125 13126 // If url is an object, simulate pre-1.5 signature 13127 if ( typeof url === "object" ) { 13128 options = url; 13129 url = undefined; 13130 } 13131 13132 // Force options to be an object 13133 options = options || {}; 13134 13135 var transport, 13136 13137 // URL without anti-cache param 13138 cacheURL, 13139 13140 // Response headers 13141 responseHeadersString, 13142 responseHeaders, 13143 13144 // timeout handle 13145 timeoutTimer, 13146 13147 // Url cleanup var 13148 urlAnchor, 13149 13150 // Request state (becomes false upon send and true upon completion) 13151 completed, 13152 13153 // To know if global events are to be dispatched 13154 fireGlobals, 13155 13156 // Loop variable 13157 i, 13158 13159 // uncached part of the url 13160 uncached, 13161 13162 // Create the final options object 13163 s = jQuery.ajaxSetup( {}, options ), 13164 13165 // Callbacks context 13166 callbackContext = s.context || s, 13167 13168 // Context for global events is callbackContext if it is a DOM node or jQuery collection 13169 globalEventContext = s.context && 13170 ( callbackContext.nodeType || callbackContext.jquery ) ? 13171 jQuery( callbackContext ) : 13172 jQuery.event, 13173 13174 // Deferreds 13175 deferred = jQuery.Deferred(), 13176 completeDeferred = jQuery.Callbacks( "once memory" ), 13177 13178 // Status-dependent callbacks 13179 statusCode = s.statusCode || {}, 13180 13181 // Headers (they are sent all at once) 13182 requestHeaders = {}, 13183 requestHeadersNames = {}, 13184 13185 // Default abort message 13186 strAbort = "canceled", 13187 13188 // Fake xhr 13189 jqXHR = { 13190 readyState: 0, 13191 13192 // Builds headers hashtable if needed 13193 getResponseHeader: function( key ) { 13194 var match; 13195 if ( completed ) { 13196 if ( !responseHeaders ) { 13197 responseHeaders = {}; 13198 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 13199 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 13200 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 13201 .concat( match[ 2 ] ); 13202 } 13203 } 13204 match = responseHeaders[ key.toLowerCase() + " " ]; 13205 } 13206 return match == null ? null : match.join( ", " ); 13207 }, 13208 13209 // Raw string 13210 getAllResponseHeaders: function() { 13211 return completed ? responseHeadersString : null; 13212 }, 13213 13214 // Caches the header 13215 setRequestHeader: function( name, value ) { 13216 if ( completed == null ) { 13217 name = requestHeadersNames[ name.toLowerCase() ] = 13218 requestHeadersNames[ name.toLowerCase() ] || name; 13219 requestHeaders[ name ] = value; 13220 } 13221 return this; 13222 }, 13223 13224 // Overrides response content-type header 13225 overrideMimeType: function( type ) { 13226 if ( completed == null ) { 13227 s.mimeType = type; 13228 } 13229 return this; 13230 }, 13231 13232 // Status-dependent callbacks 13233 statusCode: function( map ) { 13234 var code; 13235 if ( map ) { 13236 if ( completed ) { 13237 13238 // Execute the appropriate callbacks 13239 jqXHR.always( map[ jqXHR.status ] ); 13240 } else { 13241 13242 // Lazy-add the new callbacks in a way that preserves old ones 13243 for ( code in map ) { 13244 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 13245 } 13246 } 13247 } 13248 return this; 13249 }, 13250 13251 // Cancel the request 13252 abort: function( statusText ) { 13253 var finalText = statusText || strAbort; 13254 if ( transport ) { 13255 transport.abort( finalText ); 13256 } 13257 done( 0, finalText ); 13258 return this; 13259 } 13260 }; 13261 13262 // Attach deferreds 13263 deferred.promise( jqXHR ); 13264 13265 // Add protocol if not provided (prefilters might expect it) 13266 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 13267 // We also use the url parameter if available 13268 s.url = ( ( url || s.url || location.href ) + "" ) 13269 .replace( rprotocol, location.protocol + "//" ); 13270 13271 // Alias method option to type as per ticket trac-12004 13272 s.type = options.method || options.type || s.method || s.type; 13273 13274 // Extract dataTypes list 13275 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 13276 13277 // A cross-domain request is in order when the origin doesn't match the current origin. 13278 if ( s.crossDomain == null ) { 13279 urlAnchor = document.createElement( "a" ); 13280 13281 // Support: IE <=8 - 11, Edge 12 - 15 13282 // IE throws exception on accessing the href property if url is malformed, 13283 // e.g. http://example.com:80x/ 13284 try { 13285 urlAnchor.href = s.url; 13286 13287 // Support: IE <=8 - 11 only 13288 // Anchor's host property isn't correctly set when s.url is relative 13289 urlAnchor.href = urlAnchor.href; 13290 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 13291 urlAnchor.protocol + "//" + urlAnchor.host; 13292 } catch ( e ) { 13293 13294 // If there is an error parsing the URL, assume it is crossDomain, 13295 // it can be rejected by the transport if it is invalid 13296 s.crossDomain = true; 13297 } 13298 } 13299 13300 // Convert data if not already a string 13301 if ( s.data && s.processData && typeof s.data !== "string" ) { 13302 s.data = jQuery.param( s.data, s.traditional ); 13303 } 13304 13305 // Apply prefilters 13306 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 13307 13308 // If request was aborted inside a prefilter, stop there 13309 if ( completed ) { 13310 return jqXHR; 13311 } 13312 13313 // We can fire global events as of now if asked to 13314 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 13315 fireGlobals = jQuery.event && s.global; 13316 13317 // Watch for a new set of requests 13318 if ( fireGlobals && jQuery.active++ === 0 ) { 13319 jQuery.event.trigger( "ajaxStart" ); 13320 } 13321 13322 // Uppercase the type 13323 s.type = s.type.toUpperCase(); 13324 13325 // Determine if request has content 13326 s.hasContent = !rnoContent.test( s.type ); 13327 13328 // Save the URL in case we're toying with the If-Modified-Since 13329 // and/or If-None-Match header later on 13330 // Remove hash to simplify url manipulation 13331 cacheURL = s.url.replace( rhash, "" ); 13332 13333 // More options handling for requests with no content 13334 if ( !s.hasContent ) { 13335 13336 // Remember the hash so we can put it back 13337 uncached = s.url.slice( cacheURL.length ); 13338 13339 // If data is available and should be processed, append data to url 13340 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 13341 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 13342 13343 // trac-9682: remove data so that it's not used in an eventual retry 13344 delete s.data; 13345 } 13346 13347 // Add or update anti-cache param if needed 13348 if ( s.cache === false ) { 13349 cacheURL = cacheURL.replace( rantiCache, "$1" ); 13350 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 13351 uncached; 13352 } 13353 13354 // Put hash and anti-cache on the URL that will be requested (gh-1732) 13355 s.url = cacheURL + uncached; 13356 13357 // Change '%20' to '+' if this is encoded form body content (gh-2658) 13358 } else if ( s.data && s.processData && 13359 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 13360 s.data = s.data.replace( r20, "+" ); 13361 } 13362 13363 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 13364 if ( s.ifModified ) { 13365 if ( jQuery.lastModified[ cacheURL ] ) { 13366 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 13367 } 13368 if ( jQuery.etag[ cacheURL ] ) { 13369 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 13370 } 13371 } 13372 13373 // Set the correct header, if data is being sent 13374 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 13375 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 13376 } 13377 13378 // Set the Accepts header for the server, depending on the dataType 13379 jqXHR.setRequestHeader( 13380 "Accept", 13381 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 13382 s.accepts[ s.dataTypes[ 0 ] ] + 13383 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 13384 s.accepts[ "*" ] 13385 ); 13386 13387 // Check for headers option 13388 for ( i in s.headers ) { 13389 jqXHR.setRequestHeader( i, s.headers[ i ] ); 13390 } 13391 13392 // Allow custom headers/mimetypes and early abort 13393 if ( s.beforeSend && 13394 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 13395 13396 // Abort if not done already and return 13397 return jqXHR.abort(); 13398 } 13399 13400 // Aborting is no longer a cancellation 13401 strAbort = "abort"; 13402 13403 // Install callbacks on deferreds 13404 completeDeferred.add( s.complete ); 13405 jqXHR.done( s.success ); 13406 jqXHR.fail( s.error ); 13407 13408 // Get transport 13409 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 13410 13411 // If no transport, we auto-abort 13412 if ( !transport ) { 13413 done( -1, "No Transport" ); 13414 } else { 13415 jqXHR.readyState = 1; 13416 13417 // Send global event 13418 if ( fireGlobals ) { 13419 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 13420 } 13421 13422 // If request was aborted inside ajaxSend, stop there 13423 if ( completed ) { 13424 return jqXHR; 13425 } 13426 13427 // Timeout 13428 if ( s.async && s.timeout > 0 ) { 13429 timeoutTimer = window.setTimeout( function() { 13430 jqXHR.abort( "timeout" ); 13431 }, s.timeout ); 13432 } 13433 13434 try { 13435 completed = false; 13436 transport.send( requestHeaders, done ); 13437 } catch ( e ) { 13438 13439 // Rethrow post-completion exceptions 13440 if ( completed ) { 13441 throw e; 13442 } 13443 13444 // Propagate others as results 13445 done( -1, e ); 13446 } 13447 } 13448 13449 // Callback for when everything is done 13450 function done( status, nativeStatusText, responses, headers ) { 13451 var isSuccess, success, error, response, modified, 13452 statusText = nativeStatusText; 13453 13454 // Ignore repeat invocations 13455 if ( completed ) { 13456 return; 13457 } 13458 13459 completed = true; 13460 13461 // Clear timeout if it exists 13462 if ( timeoutTimer ) { 13463 window.clearTimeout( timeoutTimer ); 13464 } 13465 13466 // Dereference transport for early garbage collection 13467 // (no matter how long the jqXHR object will be used) 13468 transport = undefined; 13469 13470 // Cache response headers 13471 responseHeadersString = headers || ""; 13472 13473 // Set readyState 13474 jqXHR.readyState = status > 0 ? 4 : 0; 13475 13476 // Determine if successful 13477 isSuccess = status >= 200 && status < 300 || status === 304; 13478 13479 // Get response data 13480 if ( responses ) { 13481 response = ajaxHandleResponses( s, jqXHR, responses ); 13482 } 13483 13484 // Use a noop converter for missing script but not if jsonp 13485 if ( !isSuccess && 13486 jQuery.inArray( "script", s.dataTypes ) > -1 && 13487 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 13488 s.converters[ "text script" ] = function() {}; 13489 } 13490 13491 // Convert no matter what (that way responseXXX fields are always set) 13492 response = ajaxConvert( s, response, jqXHR, isSuccess ); 13493 13494 // If successful, handle type chaining 13495 if ( isSuccess ) { 13496 13497 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 13498 if ( s.ifModified ) { 13499 modified = jqXHR.getResponseHeader( "Last-Modified" ); 13500 if ( modified ) { 13501 jQuery.lastModified[ cacheURL ] = modified; 13502 } 13503 modified = jqXHR.getResponseHeader( "etag" ); 13504 if ( modified ) { 13505 jQuery.etag[ cacheURL ] = modified; 13506 } 13507 } 13508 13509 // if no content 13510 if ( status === 204 || s.type === "HEAD" ) { 13511 statusText = "nocontent"; 13512 13513 // if not modified 13514 } else if ( status === 304 ) { 13515 statusText = "notmodified"; 13516 13517 // If we have data, let's convert it 13518 } else { 13519 statusText = response.state; 13520 success = response.data; 13521 error = response.error; 13522 isSuccess = !error; 13523 } 13524 } else { 13525 13526 // Extract error from statusText and normalize for non-aborts 13527 error = statusText; 13528 if ( status || !statusText ) { 13529 statusText = "error"; 13530 if ( status < 0 ) { 13531 status = 0; 13532 } 13533 } 13534 } 13535 13536 // Set data for the fake xhr object 13537 jqXHR.status = status; 13538 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 13539 13540 // Success/Error 13541 if ( isSuccess ) { 13542 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 13543 } else { 13544 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 13545 } 13546 13547 // Status-dependent callbacks 13548 jqXHR.statusCode( statusCode ); 13549 statusCode = undefined; 13550 13551 if ( fireGlobals ) { 13552 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 13553 [ jqXHR, s, isSuccess ? success : error ] ); 13554 } 13555 13556 // Complete 13557 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 13558 13559 if ( fireGlobals ) { 13560 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 13561 13562 // Handle the global AJAX counter 13563 if ( !( --jQuery.active ) ) { 13564 jQuery.event.trigger( "ajaxStop" ); 13565 } 13566 } 13567 } 13568 13569 return jqXHR; 13570 }, 13571 13572 getJSON: function( url, data, callback ) { 13573 return jQuery.get( url, data, callback, "json" ); 13574 }, 13575 13576 getScript: function( url, callback ) { 13577 return jQuery.get( url, undefined, callback, "script" ); 13578 } 13579} ); 13580 13581jQuery.each( [ "get", "post" ], function( _i, method ) { 13582 jQuery[ method ] = function( url, data, callback, type ) { 13583 13584 // Shift arguments if data argument was omitted 13585 if ( isFunction( data ) ) { 13586 type = type || callback; 13587 callback = data; 13588 data = undefined; 13589 } 13590 13591 // The url can be an options object (which then must have .url) 13592 return jQuery.ajax( jQuery.extend( { 13593 url: url, 13594 type: method, 13595 dataType: type, 13596 data: data, 13597 success: callback 13598 }, jQuery.isPlainObject( url ) && url ) ); 13599 }; 13600} ); 13601 13602jQuery.ajaxPrefilter( function( s ) { 13603 var i; 13604 for ( i in s.headers ) { 13605 if ( i.toLowerCase() === "content-type" ) { 13606 s.contentType = s.headers[ i ] || ""; 13607 } 13608 } 13609} ); 13610 13611 13612jQuery._evalUrl = function( url, options, doc ) { 13613 return jQuery.ajax( { 13614 url: url, 13615 13616 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 13617 type: "GET", 13618 dataType: "script", 13619 cache: true, 13620 async: false, 13621 global: false, 13622 13623 // Only evaluate the response if it is successful (gh-4126) 13624 // dataFilter is not invoked for failure responses, so using it instead 13625 // of the default converter is kludgy but it works. 13626 converters: { 13627 "text script": function() {} 13628 }, 13629 dataFilter: function( response ) { 13630 jQuery.globalEval( response, options, doc ); 13631 } 13632 } ); 13633}; 13634 13635 13636jQuery.fn.extend( { 13637 wrapAll: function( html ) { 13638 var wrap; 13639 13640 if ( this[ 0 ] ) { 13641 if ( isFunction( html ) ) { 13642 html = html.call( this[ 0 ] ); 13643 } 13644 13645 // The elements to wrap the target around 13646 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 13647 13648 if ( this[ 0 ].parentNode ) { 13649 wrap.insertBefore( this[ 0 ] ); 13650 } 13651 13652 wrap.map( function() { 13653 var elem = this; 13654 13655 while ( elem.firstElementChild ) { 13656 elem = elem.firstElementChild; 13657 } 13658 13659 return elem; 13660 } ).append( this ); 13661 } 13662 13663 return this; 13664 }, 13665 13666 wrapInner: function( html ) { 13667 if ( isFunction( html ) ) { 13668 return this.each( function( i ) { 13669 jQuery( this ).wrapInner( html.call( this, i ) ); 13670 } ); 13671 } 13672 13673 return this.each( function() { 13674 var self = jQuery( this ), 13675 contents = self.contents(); 13676 13677 if ( contents.length ) { 13678 contents.wrapAll( html ); 13679 13680 } else { 13681 self.append( html ); 13682 } 13683 } ); 13684 }, 13685 13686 wrap: function( html ) { 13687 var htmlIsFunction = isFunction( html ); 13688 13689 return this.each( function( i ) { 13690 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 13691 } ); 13692 }, 13693 13694 unwrap: function( selector ) { 13695 this.parent( selector ).not( "body" ).each( function() { 13696 jQuery( this ).replaceWith( this.childNodes ); 13697 } ); 13698 return this; 13699 } 13700} ); 13701 13702 13703jQuery.expr.pseudos.hidden = function( elem ) { 13704 return !jQuery.expr.pseudos.visible( elem ); 13705}; 13706jQuery.expr.pseudos.visible = function( elem ) { 13707 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 13708}; 13709 13710 13711 13712 13713jQuery.ajaxSettings.xhr = function() { 13714 try { 13715 return new window.XMLHttpRequest(); 13716 } catch ( e ) {} 13717}; 13718 13719var xhrSuccessStatus = { 13720 13721 // File protocol always yields status code 0, assume 200 13722 0: 200, 13723 13724 // Support: IE <=9 only 13725 // trac-1450: sometimes IE returns 1223 when it should be 204 13726 1223: 204 13727 }, 13728 xhrSupported = jQuery.ajaxSettings.xhr(); 13729 13730support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 13731support.ajax = xhrSupported = !!xhrSupported; 13732 13733jQuery.ajaxTransport( function( options ) { 13734 var callback, errorCallback; 13735 13736 // Cross domain only allowed if supported through XMLHttpRequest 13737 if ( support.cors || xhrSupported && !options.crossDomain ) { 13738 return { 13739 send: function( headers, complete ) { 13740 var i, 13741 xhr = options.xhr(); 13742 13743 xhr.open( 13744 options.type, 13745 options.url, 13746 options.async, 13747 options.username, 13748 options.password 13749 ); 13750 13751 // Apply custom fields if provided 13752 if ( options.xhrFields ) { 13753 for ( i in options.xhrFields ) { 13754 xhr[ i ] = options.xhrFields[ i ]; 13755 } 13756 } 13757 13758 // Override mime type if needed 13759 if ( options.mimeType && xhr.overrideMimeType ) { 13760 xhr.overrideMimeType( options.mimeType ); 13761 } 13762 13763 // X-Requested-With header 13764 // For cross-domain requests, seeing as conditions for a preflight are 13765 // akin to a jigsaw puzzle, we simply never set it to be sure. 13766 // (it can always be set on a per-request basis or even using ajaxSetup) 13767 // For same-domain requests, won't change header if already provided. 13768 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 13769 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 13770 } 13771 13772 // Set headers 13773 for ( i in headers ) { 13774 xhr.setRequestHeader( i, headers[ i ] ); 13775 } 13776 13777 // Callback 13778 callback = function( type ) { 13779 return function() { 13780 if ( callback ) { 13781 callback = errorCallback = xhr.onload = 13782 xhr.onerror = xhr.onabort = xhr.ontimeout = 13783 xhr.onreadystatechange = null; 13784 13785 if ( type === "abort" ) { 13786 xhr.abort(); 13787 } else if ( type === "error" ) { 13788 13789 // Support: IE <=9 only 13790 // On a manual native abort, IE9 throws 13791 // errors on any property access that is not readyState 13792 if ( typeof xhr.status !== "number" ) { 13793 complete( 0, "error" ); 13794 } else { 13795 complete( 13796 13797 // File: protocol always yields status 0; see trac-8605, trac-14207 13798 xhr.status, 13799 xhr.statusText 13800 ); 13801 } 13802 } else { 13803 complete( 13804 xhrSuccessStatus[ xhr.status ] || xhr.status, 13805 xhr.statusText, 13806 13807 // Support: IE <=9 only 13808 // IE9 has no XHR2 but throws on binary (trac-11426) 13809 // For XHR2 non-text, let the caller handle it (gh-2498) 13810 ( xhr.responseType || "text" ) !== "text" || 13811 typeof xhr.responseText !== "string" ? 13812 { binary: xhr.response } : 13813 { text: xhr.responseText }, 13814 xhr.getAllResponseHeaders() 13815 ); 13816 } 13817 } 13818 }; 13819 }; 13820 13821 // Listen to events 13822 xhr.onload = callback(); 13823 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 13824 13825 // Support: IE 9 only 13826 // Use onreadystatechange to replace onabort 13827 // to handle uncaught aborts 13828 if ( xhr.onabort !== undefined ) { 13829 xhr.onabort = errorCallback; 13830 } else { 13831 xhr.onreadystatechange = function() { 13832 13833 // Check readyState before timeout as it changes 13834 if ( xhr.readyState === 4 ) { 13835 13836 // Allow onerror to be called first, 13837 // but that will not handle a native abort 13838 // Also, save errorCallback to a variable 13839 // as xhr.onerror cannot be accessed 13840 window.setTimeout( function() { 13841 if ( callback ) { 13842 errorCallback(); 13843 } 13844 } ); 13845 } 13846 }; 13847 } 13848 13849 // Create the abort callback 13850 callback = callback( "abort" ); 13851 13852 try { 13853 13854 // Do send the request (this may raise an exception) 13855 xhr.send( options.hasContent && options.data || null ); 13856 } catch ( e ) { 13857 13858 // trac-14683: Only rethrow if this hasn't been notified as an error yet 13859 if ( callback ) { 13860 throw e; 13861 } 13862 } 13863 }, 13864 13865 abort: function() { 13866 if ( callback ) { 13867 callback(); 13868 } 13869 } 13870 }; 13871 } 13872} ); 13873 13874 13875 13876 13877// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 13878jQuery.ajaxPrefilter( function( s ) { 13879 if ( s.crossDomain ) { 13880 s.contents.script = false; 13881 } 13882} ); 13883 13884// Install script dataType 13885jQuery.ajaxSetup( { 13886 accepts: { 13887 script: "text/javascript, application/javascript, " + 13888 "application/ecmascript, application/x-ecmascript" 13889 }, 13890 contents: { 13891 script: /\b(?:java|ecma)script\b/ 13892 }, 13893 converters: { 13894 "text script": function( text ) { 13895 jQuery.globalEval( text ); 13896 return text; 13897 } 13898 } 13899} ); 13900 13901// Handle cache's special case and crossDomain 13902jQuery.ajaxPrefilter( "script", function( s ) { 13903 if ( s.cache === undefined ) { 13904 s.cache = false; 13905 } 13906 if ( s.crossDomain ) { 13907 s.type = "GET"; 13908 } 13909} ); 13910 13911// Bind script tag hack transport 13912jQuery.ajaxTransport( "script", function( s ) { 13913 13914 // This transport only deals with cross domain or forced-by-attrs requests 13915 if ( s.crossDomain || s.scriptAttrs ) { 13916 var script, callback; 13917 return { 13918 send: function( _, complete ) { 13919 script = jQuery( "<script>" ) 13920 .attr( s.scriptAttrs || {} ) 13921 .prop( { charset: s.scriptCharset, src: s.url } ) 13922 .on( "load error", callback = function( evt ) { 13923 script.remove(); 13924 callback = null; 13925 if ( evt ) { 13926 complete( evt.type === "error" ? 404 : 200, evt.type ); 13927 } 13928 } ); 13929 13930 // Use native DOM manipulation to avoid our domManip AJAX trickery 13931 document.head.appendChild( script[ 0 ] ); 13932 }, 13933 abort: function() { 13934 if ( callback ) { 13935 callback(); 13936 } 13937 } 13938 }; 13939 } 13940} ); 13941 13942 13943 13944 13945var oldCallbacks = [], 13946 rjsonp = /(=)\?(?=&|$)|\?\?/; 13947 13948// Default jsonp settings 13949jQuery.ajaxSetup( { 13950 jsonp: "callback", 13951 jsonpCallback: function() { 13952 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 13953 this[ callback ] = true; 13954 return callback; 13955 } 13956} ); 13957 13958// Detect, normalize options and install callbacks for jsonp requests 13959jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 13960 13961 var callbackName, overwritten, responseContainer, 13962 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 13963 "url" : 13964 typeof s.data === "string" && 13965 ( s.contentType || "" ) 13966 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 13967 rjsonp.test( s.data ) && "data" 13968 ); 13969 13970 // Handle iff the expected data type is "jsonp" or we have a parameter to set 13971 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 13972 13973 // Get callback name, remembering preexisting value associated with it 13974 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 13975 s.jsonpCallback() : 13976 s.jsonpCallback; 13977 13978 // Insert callback into url or form data 13979 if ( jsonProp ) { 13980 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 13981 } else if ( s.jsonp !== false ) { 13982 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 13983 } 13984 13985 // Use data converter to retrieve json after script execution
vendor: 2,987 bytes, lines 13986-14095
13986 s.converters[ "script json" ] = function() { 13987 if ( !responseContainer ) { 13988 jQuery.error( callbackName + " was not called" ); 13989 } 13990 return responseContainer[ 0 ]; 13991 }; 13992 13993 // Force json dataType 13994 s.dataTypes[ 0 ] = "json"; 13995 13996 // Install callback 13997 overwritten = window[ callbackName ]; 13998 window[ callbackName ] = function() { 13999 responseContainer = arguments; 14000 }; 14001 14002 // Clean-up function (fires after converters) 14003 jqXHR.always( function() { 14004 14005 // If previous value didn't exist - remove it 14006 if ( overwritten === undefined ) { 14007 jQuery( window ).removeProp( callbackName ); 14008 14009 // Otherwise restore preexisting value 14010 } else { 14011 window[ callbackName ] = overwritten; 14012 } 14013 14014 // Save back as free 14015 if ( s[ callbackName ] ) { 14016 14017 // Make sure that re-using the options doesn't screw things around 14018 s.jsonpCallback = originalSettings.jsonpCallback; 14019 14020 // Save the callback name for future use 14021 oldCallbacks.push( callbackName ); 14022 } 14023 14024 // Call if it was a function and we have a response 14025 if ( responseContainer && isFunction( overwritten ) ) { 14026 overwritten( responseContainer[ 0 ] ); 14027 } 14028 14029 responseContainer = overwritten = undefined; 14030 } ); 14031 14032 // Delegate to script 14033 return "script"; 14034 } 14035} ); 14036 14037 14038 14039 14040// Support: Safari 8 only 14041// In Safari 8 documents created via document.implementation.createHTMLDocument 14042// collapse sibling forms: the second one becomes a child of the first one. 14043// Because of that, this security measure has to be disabled in Safari 8. 14044// https://bugs.webkit.org/show_bug.cgi?id=137337 14045support.createHTMLDocument = ( function() { 14046 var body = document.implementation.createHTMLDocument( "" ).body; 14047 body.innerHTML = "<form></form><form></form>"; 14048 return body.childNodes.length === 2; 14049} )(); 14050 14051 14052// Argument "data" should be string of html 14053// context (optional): If specified, the fragment will be created in this context, 14054// defaults to document 14055// keepScripts (optional): If true, will include scripts passed in the html string 14056jQuery.parseHTML = function( data, context, keepScripts ) { 14057 if ( typeof data !== "string" ) { 14058 return []; 14059 } 14060 if ( typeof context === "boolean" ) { 14061 keepScripts = context; 14062 context = false; 14063 } 14064 14065 var base, parsed, scripts; 14066 14067 if ( !context ) { 14068 14069 // Stop scripts or inline event handlers from being executed immediately 14070 // by using document.implementation 14071 if ( support.createHTMLDocument ) { 14072 context = document.implementation.createHTMLDocument( "" ); 14073 14074 // Set the base href for the created document 14075 // so any parsed elements with URLs 14076 // are based on the document's URL (gh-2965) 14077 base = context.createElement( "base" ); 14078 base.href = document.location.href; 14079 context.head.appendChild( base ); 14080 } else { 14081 context = document; 14082 } 14083 } 14084 14085 parsed = rsingleTag.exec( data ); 14086 scripts = !keepScripts && []; 14087 14088 // Single tag 14089 if ( parsed ) { 14090 return [ context.createElement( parsed[ 1 ] ) ]; 14091 } 14092 14093 parsed = buildFragment( [ data ], context, scripts ); 14094 14095 if ( scripts && scripts.length ) {
vendor: 10,712 bytes, lines 14096-14478
14096 jQuery( scripts ).remove(); 14097 } 14098 14099 return jQuery.merge( [], parsed.childNodes ); 14100}; 14101 14102 14103/** 14104 * Load a url into a page 14105 */ 14106jQuery.fn.load = function( url, params, callback ) { 14107 var selector, type, response, 14108 self = this, 14109 off = url.indexOf( " " ); 14110 14111 if ( off > -1 ) { 14112 selector = stripAndCollapse( url.slice( off ) ); 14113 url = url.slice( 0, off ); 14114 } 14115 14116 // If it's a function 14117 if ( isFunction( params ) ) { 14118 14119 // We assume that it's the callback 14120 callback = params; 14121 params = undefined; 14122 14123 // Otherwise, build a param string 14124 } else if ( params && typeof params === "object" ) { 14125 type = "POST"; 14126 } 14127 14128 // If we have elements to modify, make the request 14129 if ( self.length > 0 ) { 14130 jQuery.ajax( { 14131 url: url, 14132 14133 // If "type" variable is undefined, then "GET" method will be used. 14134 // Make value of this field explicit since 14135 // user can override it through ajaxSetup method 14136 type: type || "GET", 14137 dataType: "html", 14138 data: params 14139 } ).done( function( responseText ) { 14140 14141 // Save response for use in complete callback 14142 response = arguments; 14143 14144 self.html( selector ? 14145 14146 // If a selector was specified, locate the right elements in a dummy div 14147 // Exclude scripts to avoid IE 'Permission Denied' errors 14148 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 14149 14150 // Otherwise use the full result 14151 responseText ); 14152 14153 // If the request succeeds, this function gets "data", "status", "jqXHR" 14154 // but they are ignored because response was set above. 14155 // If it fails, this function gets "jqXHR", "status", "error" 14156 } ).always( callback && function( jqXHR, status ) { 14157 self.each( function() { 14158 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 14159 } ); 14160 } ); 14161 } 14162 14163 return this; 14164}; 14165 14166 14167 14168 14169jQuery.expr.pseudos.animated = function( elem ) { 14170 return jQuery.grep( jQuery.timers, function( fn ) { 14171 return elem === fn.elem; 14172 } ).length; 14173}; 14174 14175 14176 14177 14178jQuery.offset = { 14179 setOffset: function( elem, options, i ) { 14180 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 14181 position = jQuery.css( elem, "position" ), 14182 curElem = jQuery( elem ), 14183 props = {}; 14184 14185 // Set position first, in-case top/left are set even on static elem 14186 if ( position === "static" ) { 14187 elem.style.position = "relative"; 14188 } 14189 14190 curOffset = curElem.offset(); 14191 curCSSTop = jQuery.css( elem, "top" ); 14192 curCSSLeft = jQuery.css( elem, "left" ); 14193 calculatePosition = ( position === "absolute" || position === "fixed" ) && 14194 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 14195 14196 // Need to be able to calculate position if either 14197 // top or left is auto and position is either absolute or fixed 14198 if ( calculatePosition ) { 14199 curPosition = curElem.position(); 14200 curTop = curPosition.top; 14201 curLeft = curPosition.left; 14202 14203 } else { 14204 curTop = parseFloat( curCSSTop ) || 0; 14205 curLeft = parseFloat( curCSSLeft ) || 0; 14206 } 14207 14208 if ( isFunction( options ) ) { 14209 14210 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 14211 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 14212 } 14213 14214 if ( options.top != null ) { 14215 props.top = ( options.top - curOffset.top ) + curTop; 14216 } 14217 if ( options.left != null ) { 14218 props.left = ( options.left - curOffset.left ) + curLeft; 14219 } 14220 14221 if ( "using" in options ) { 14222 options.using.call( elem, props ); 14223 14224 } else { 14225 curElem.css( props ); 14226 } 14227 } 14228}; 14229 14230jQuery.fn.extend( { 14231 14232 // offset() relates an element's border box to the document origin 14233 offset: function( options ) { 14234 14235 // Preserve chaining for setter 14236 if ( arguments.length ) { 14237 return options === undefined ? 14238 this : 14239 this.each( function( i ) { 14240 jQuery.offset.setOffset( this, options, i ); 14241 } ); 14242 } 14243 14244 var rect, win, 14245 elem = this[ 0 ]; 14246 14247 if ( !elem ) { 14248 return; 14249 } 14250 14251 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 14252 // Support: IE <=11 only 14253 // Running getBoundingClientRect on a 14254 // disconnected node in IE throws an error 14255 if ( !elem.getClientRects().length ) { 14256 return { top: 0, left: 0 }; 14257 } 14258 14259 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 14260 rect = elem.getBoundingClientRect(); 14261 win = elem.ownerDocument.defaultView; 14262 return { 14263 top: rect.top + win.pageYOffset, 14264 left: rect.left + win.pageXOffset 14265 }; 14266 }, 14267 14268 // position() relates an element's margin box to its offset parent's padding box 14269 // This corresponds to the behavior of CSS absolute positioning 14270 position: function() { 14271 if ( !this[ 0 ] ) { 14272 return; 14273 } 14274 14275 var offsetParent, offset, doc, 14276 elem = this[ 0 ], 14277 parentOffset = { top: 0, left: 0 }; 14278 14279 // position:fixed elements are offset from the viewport, which itself always has zero offset 14280 if ( jQuery.css( elem, "position" ) === "fixed" ) { 14281 14282 // Assume position:fixed implies availability of getBoundingClientRect 14283 offset = elem.getBoundingClientRect(); 14284 14285 } else { 14286 offset = this.offset(); 14287 14288 // Account for the *real* offset parent, which can be the document or its root element 14289 // when a statically positioned element is identified 14290 doc = elem.ownerDocument; 14291 offsetParent = elem.offsetParent || doc.documentElement; 14292 while ( offsetParent && 14293 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 14294 jQuery.css( offsetParent, "position" ) === "static" ) { 14295 14296 offsetParent = offsetParent.parentNode; 14297 } 14298 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 14299 14300 // Incorporate borders into its offset, since they are outside its content origin 14301 parentOffset = jQuery( offsetParent ).offset(); 14302 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 14303 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 14304 } 14305 } 14306 14307 // Subtract parent offsets and element margins 14308 return { 14309 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 14310 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 14311 }; 14312 }, 14313 14314 // This method will return documentElement in the following cases: 14315 // 1) For the element inside the iframe without offsetParent, this method will return 14316 // documentElement of the parent window 14317 // 2) For the hidden or detached element 14318 // 3) For body or html element, i.e. in case of the html node - it will return itself 14319 // 14320 // but those exceptions were never presented as a real life use-cases 14321 // and might be considered as more preferable results. 14322 // 14323 // This logic, however, is not guaranteed and can change at any point in the future 14324 offsetParent: function() { 14325 return this.map( function() { 14326 var offsetParent = this.offsetParent; 14327 14328 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 14329 offsetParent = offsetParent.offsetParent; 14330 } 14331 14332 return offsetParent || documentElement; 14333 } ); 14334 } 14335} ); 14336 14337// Create scrollLeft and scrollTop methods 14338jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 14339 var top = "pageYOffset" === prop; 14340 14341 jQuery.fn[ method ] = function( val ) { 14342 return access( this, function( elem, method, val ) { 14343 14344 // Coalesce documents and windows 14345 var win; 14346 if ( isWindow( elem ) ) { 14347 win = elem; 14348 } else if ( elem.nodeType === 9 ) { 14349 win = elem.defaultView; 14350 } 14351 14352 if ( val === undefined ) { 14353 return win ? win[ prop ] : elem[ method ]; 14354 } 14355 14356 if ( win ) { 14357 win.scrollTo( 14358 !top ? val : win.pageXOffset, 14359 top ? val : win.pageYOffset 14360 ); 14361 14362 } else { 14363 elem[ method ] = val; 14364 } 14365 }, method, val, arguments.length ); 14366 }; 14367} ); 14368 14369// Support: Safari <=7 - 9.1, Chrome <=37 - 49 14370// Add the top/left cssHooks using jQuery.fn.position 14371// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 14372// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 14373// getComputedStyle returns percent when specified for top/left/bottom/right; 14374// rather than make the css module depend on the offset module, just check for it here 14375jQuery.each( [ "top", "left" ], function( _i, prop ) { 14376 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 14377 function( elem, computed ) { 14378 if ( computed ) { 14379 computed = curCSS( elem, prop ); 14380 14381 // If curCSS returns percentage, fallback to offset 14382 return rnumnonpx.test( computed ) ? 14383 jQuery( elem ).position()[ prop ] + "px" : 14384 computed; 14385 } 14386 } 14387 ); 14388} ); 14389 14390 14391// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 14392jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 14393 jQuery.each( { 14394 padding: "inner" + name, 14395 content: type, 14396 "": "outer" + name 14397 }, function( defaultExtra, funcName ) { 14398 14399 // Margin is only for outerHeight, outerWidth 14400 jQuery.fn[ funcName ] = function( margin, value ) { 14401 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 14402 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 14403 14404 return access( this, function( elem, type, value ) { 14405 var doc; 14406 14407 if ( isWindow( elem ) ) { 14408 14409 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 14410 return funcName.indexOf( "outer" ) === 0 ? 14411 elem[ "inner" + name ] : 14412 elem.document.documentElement[ "client" + name ]; 14413 } 14414 14415 // Get document width or height 14416 if ( elem.nodeType === 9 ) { 14417 doc = elem.documentElement; 14418 14419 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 14420 // whichever is greatest 14421 return Math.max( 14422 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 14423 elem.body[ "offset" + name ], doc[ "offset" + name ], 14424 doc[ "client" + name ] 14425 ); 14426 } 14427 14428 return value === undefined ? 14429 14430 // Get width or height on the element, requesting but not forcing parseFloat 14431 jQuery.css( elem, type, extra ) : 14432 14433 // Set width or height on the element 14434 jQuery.style( elem, type, value, extra ); 14435 }, type, chainable ? margin : undefined, chainable ); 14436 }; 14437 } ); 14438} ); 14439 14440 14441jQuery.each( [ 14442 "ajaxStart", 14443 "ajaxStop", 14444 "ajaxComplete", 14445 "ajaxError", 14446 "ajaxSuccess", 14447 "ajaxSend" 14448], function( _i, type ) { 14449 jQuery.fn[ type ] = function( fn ) { 14450 return this.on( type, fn ); 14451 }; 14452} ); 14453 14454 14455 14456 14457jQuery.fn.extend( { 14458 14459 bind: function( types, data, fn ) { 14460 return this.on( types, null, data, fn ); 14461 }, 14462 unbind: function( types, fn ) { 14463 return this.off( types, null, fn ); 14464 }, 14465 14466 delegate: function( selector, types, data, fn ) { 14467 return this.on( types, selector, data, fn ); 14468 }, 14469 undelegate: function( selector, types, fn ) { 14470 14471 // ( namespace ) or ( selector, types [, fn] ) 14472 return arguments.length === 1 ? 14473 this.off( selector, "**" ) : 14474 this.off( types, selector || "**", fn ); 14475 }, 14476 14477 hover: function( fnOver, fnOut ) { 14478 return this
vendor: 2,565 bytes, lines 14478-14570
14478.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 14479 } 14480} ); 14481 14482jQuery.each( 14483 ( "blur focus focusin focusout resize scroll click dblclick " + 14484 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 14485 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 14486 function( _i, name ) { 14487 14488 // Handle event binding 14489 jQuery.fn[ name ] = function( data, fn ) { 14490 return arguments.length > 0 ? 14491 this.on( name, null, data, fn ) : 14492 this.trigger( name ); 14493 }; 14494 } 14495); 14496 14497 14498 14499 14500// Support: Android <=4.0 only 14501// Make sure we trim BOM and NBSP 14502// Require that the "whitespace run" starts from a non-whitespace 14503// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 14504var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 14505 14506// Bind a function to a context, optionally partially applying any 14507// arguments. 14508// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 14509// However, it is not slated for removal any time soon 14510jQuery.proxy = function( fn, context ) { 14511 var tmp, args, proxy; 14512 14513 if ( typeof context === "string" ) { 14514 tmp = fn[ context ]; 14515 context = fn; 14516 fn = tmp; 14517 } 14518 14519 // Quick check to determine if target is callable, in the spec 14520 // this throws a TypeError, but we will just return undefined. 14521 if ( !isFunction( fn ) ) { 14522 return undefined; 14523 } 14524 14525 // Simulated bind 14526 args = slice.call( arguments, 2 ); 14527 proxy = function() { 14528 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 14529 }; 14530 14531 // Set the guid of unique handler to the same of original handler, so it can be removed 14532 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 14533 14534 return proxy; 14535}; 14536 14537jQuery.holdReady = function( hold ) { 14538 if ( hold ) { 14539 jQuery.readyWait++; 14540 } else { 14541 jQuery.ready( true ); 14542 } 14543}; 14544jQuery.isArray = Array.isArray; 14545jQuery.parseJSON = JSON.parse; 14546jQuery.nodeName = nodeName; 14547jQuery.isFunction = isFunction; 14548jQuery.isWindow = isWindow; 14549jQuery.camelCase = camelCase; 14550jQuery.type = toType; 14551 14552jQuery.now = Date.now; 14553 14554jQuery.isNumeric = function( obj ) { 14555 14556 // As of jQuery 3.0, isNumeric is limited to 14557 // strings and numbers (primitives or objects) 14558 // that can be coerced to finite numbers (gh-2662) 14559 var type = jQuery.type( obj ); 14560 return ( type === "number" || type === "string" ) && 14561 14562 // parseFloat NaNs numeric-cast false positives ("") 14563 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 14564 // subtraction forces infinities to NaN 14565 !isNaN( obj - parseFloat( obj ) ); 14566}; 14567 14568jQuery.trim = function( text ) { 14569 return text == null ? 14570 "" :
vendor: 23,236 bytes, lines 14571-14634
14571 ( text + "" ).replace( rtrim, "$1" ); 14572}; 14573 14574 14575 14576// Register as a named AMD module, since jQuery can be concatenated with other 14577// files that may use define, but not via a proper concatenation script that 14578// understands anonymous AMD modules. A named AMD is safest and most robust 14579// way to register. Lowercase jquery is used because AMD module names are 14580// derived from file names, and jQuery is normally delivered in a lowercase 14581// file name. Do this after creating the global so that if an AMD module wants 14582// to call noConflict to hide this version of jQuery, it will work. 14583 14584// Note that for maximum portability, libraries that are not jQuery should 14585// declare themselves as anonymous modules, and avoid setting a global if an 14586// AMD loader is present. jQuery is a special case. For more information, see 14587// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 14588 14589if ( typeof define === "function" && define.amd ) { 14590 define( "jquery", [], function() { 14591 return jQuery; 14592 } ); 14593} 14594 14595 14596 14597 14598var 14599 14600 // Map over jQuery in case of overwrite 14601 _jQuery = window.jQuery, 14602 14603 // Map over the $ in case of overwrite 14604 _$ = window.$; 14605 14606jQuery.noConflict = function( deep ) { 14607 if ( window.$ === jQuery ) { 14608 window.$ = _$; 14609 } 14610 14611 if ( deep && window.jQuery === jQuery ) { 14612 window.jQuery = _jQuery; 14613 } 14614 14615 return jQuery; 14616}; 14617 14618// Expose jQuery and $ identifiers, even in AMD 14619// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 14620// and CommonJS for browser emulators (trac-13566) 14621if ( typeof noGlobal === "undefined" ) { 14622 window.jQuery = window.$ = jQuery; 14623} 14624 14625 14626 14627 14628return jQuery; 14629} ); 14630/** 14631 * @popperjs/core v2.11.8 - MIT License 14632 */ 14633 14634!function (e, t) { "object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).Popper = {}) }(this, (function (e) { "use strict"; function t(e) { if (null == e) return window; if ("[object Window]" !== e.toString()) { var t = e.ownerDocument; return t && t.defaultView || window } return e } function n(e) { return e instanceof t(e).Element || e instanceof Element } function r(e) { return e instanceof t(e).HTMLElement || e instanceof HTMLElement } function o(e) { return "undefined" != typeof ShadowRoot && (e instanceof t(e).ShadowRoot || e instanceof ShadowRoot) } var i = Math.max, a = Math.min, s = Math.round; function f() { var e = navigator.userAgentData; return null != e && e.brands && Array.isArray(e.brands) ? e.brands.map((function (e) { return e.brand + "/" + e.version })).join(" ") : navigator.userAgent } function c() { return !/^((?!chrome|android).)*safari/i.test(f()) } function p(e, o, i) { void 0 === o && (o = !1), void 0 === i && (i = !1); var a = e.getBoundingClientRect(), f = 1, p = 1; o && r(e) && (f = e.offsetWidth > 0 && s(a.width) / e.offsetWidth || 1, p = e.offsetHeight > 0 && s(a.height) / e.offsetHeight || 1); var u = (n(e) ? t(e) : window).visualViewport, l = !c() && i, d = (a.left + (l && u ? u.offsetLeft : 0)) / f, h = (a.top + (l && u ? u.offsetTop : 0)) / p, m = a.width / f, v = a.height / p; return { width: m, height: v, top: h, right: d + m, bottom: h + v, left: d, x: d, y: h } } function u(e) { var n = t(e); return { scrollLeft: n.pageXOffset, scrollTop: n.pageYOffset } } function l(e) { return e ? (e.nodeName || "").toLowerCase() : null } function d(e) { return ((n(e) ? e.ownerDocument : e.document) || window.document).documentElement } function h(e) { return p(d(e)).left + u(e).scrollLeft } function m(e) { return t(e).getComputedStyle(e) } function v(e) { var t = m(e), n = t.overflow, r = t.overflowX, o = t.overflowY; return /auto|scroll|overlay|hidden/.test(n + o + r) } function y(e, n, o) { void 0 === o && (o = !1); var i, a, f = r(n), c = r(n) && function (e) { var t = e.getBoundingClientRect(), n = s(t.width) / e.offsetWidth || 1, r = s(t.height) / e.offsetHeight || 1; return 1 !== n || 1 !== r }(n), m = d(n), y = p(e, c, o), g = { scrollLeft: 0, scrollTop: 0 }, b = { x: 0, y: 0 }; return (f || !f && !o) && (("body" !== l(n) || v(m)) && (g = (i = n) !== t(i) && r(i) ? { scrollLeft: (a = i).scrollLeft, scrollTop: a.scrollTop } : u(i)), r(n) ? ((b = p(n, !0)).x += n.clientLeft, b.y += n.clientTop) : m && (b.x = h(m))), { x: y.left + g.scrollLeft - b.x, y: y.top + g.scrollTop - b.y, width: y.width, height: y.height } } function g(e) { var t = p(e), n = e.offsetWidth, r = e.offsetHeight; return Math.abs(t.width - n) <= 1 && (n = t.width), Math.abs(t.height - r) <= 1 && (r = t.height), { x: e.offsetLeft, y: e.offsetTop, width: n, height: r } } function b(e) { return "html" === l(e) ? e : e.assignedSlot || e.parentNode || (o(e) ? e.host : null) || d(e) } function x(e) { return ["html", "body", "#document"].indexOf(l(e)) >= 0 ? e.ownerDocument.body : r(e) && v(e) ? e : x(b(e)) } function w(e, n) { var r; void 0 === n && (n = []); var o = x(e), i = o === (null == (r = e.ownerDocument) ? void 0 : r.body), a = t(o), s = i ? [a].concat(a.visualViewport || [], v(o) ? o : []) : o, f = n.concat(s); return i ? f : f.concat(w(b(s))) } function O(e) { return ["table", "td", "th"].indexOf(l(e)) >= 0 } function j(e) { return r(e) && "fixed" !== m(e).position ? e.offsetParent : null } function E(e) { for (var n = t(e), i = j(e); i && O(i) && "static" === m(i).position;)i = j(i); return i && ("html" === l(i) || "body" === l(i) && "static" === m(i).position) ? n : i || function (e) { var t = /firefox/i.test(f()); if (/Trident/i.test(f()) && r(e) && "fixed" === m(e).position) return null; var n = b(e); for (o(n) && (n = n.host); r(n) && ["html", "body"].indexOf(l(n)) < 0;) { var i = m(n); if ("none" !== i.transform || "none" !== i.perspective || "paint" === i.contain || -1 !== ["transform", "perspective"].indexOf(i.willChange) || t && "filter" === i.willChange || t && i.filter && "none" !== i.filter) return n; n = n.parentNode } return null }(e) || n } var D = "top", A = "bottom", L = "right", P = "left", M = "auto", k = [D, A, L, P], W = "start", B = "end", H = "viewport", T = "popper", R = k.reduce((function (e, t) { return e.concat([t + "-" + W, t + "-" + B]) }), []), S = [].concat(k, [M]).reduce((function (e, t) { return e.concat([t, t + "-" + W, t + "-" + B]) }), []), V = ["beforeRead", "read", "afterRead", "beforeMain", "main", "afterMain", "beforeWrite", "write", "afterWrite"]; function q(e) { var t = new Map, n = new Set, r = []; function o(e) { n.add(e.name), [].concat(e.requires || [], e.requiresIfExists || []).forEach((function (e) { if (!n.has(e)) { var r = t.get(e); r && o(r) } })), r.push(e) } return e.forEach((function (e) { t.set(e.name, e) })), e.forEach((function (e) { n.has(e.name) || o(e) })), r } function C(e, t) { var n = t.getRootNode && t.getRootNode(); if (e.contains(t)) return !0; if (n && o(n)) { var r = t; do { if (r && e.isSameNode(r)) return !0; r = r.parentNode || r.host } while (r) } return !1 } function N(e) { return Object.assign({}, e, { left: e.x, top: e.y, right: e.x + e.width, bottom: e.y + e.height }) } function I(e, r, o) { return r === H ? N(function (e, n) { var r = t(e), o = d(e), i = r.visualViewport, a = o.clientWidth, s = o.clientHeight, f = 0, p = 0; if (i) { a = i.width, s = i.height; var u = c(); (u || !u && "fixed" === n) && (f = i.offsetLeft, p = i.offsetTop) } return { width: a, height: s, x: f + h(e), y: p } }(e, o)) : n(r) ? function (e, t) { var n = p(e, !1, "fixed" === t); return n.top = n.top + e.clientTop, n.left = n.left + e.clientLeft, n.bottom = n.top + e.clientHeight, n.right = n.left + e.clientWidth, n.width = e.clientWidth, n.height = e.clientHeight, n.x = n.left, n.y = n.top, n }(r, o) : N(function (e) { var t, n = d(e), r = u(e), o = null == (t = e.ownerDocument) ? void 0 : t.body, a = i(n.scrollWidth, n.clientWidth, o ? o.scrollWidth : 0, o ? o.clientWidth : 0), s = i(n.scrollHeight, n.clientHeight, o ? o.scrollHeight : 0, o ? o.clientHeight : 0), f = -r.scrollLeft + h(e), c = -r.scrollTop; return "rtl" === m(o || n).direction && (f += i(n.clientWidth, o ? o.clientWidth : 0) - a), { width: a, height: s, x: f, y: c } }(d(e))) } function _(e, t, o, s) { var f = "clippingParents" === t ? function (e) { var t = w(b(e)), o = ["absolute", "fixed"].indexOf(m(e).position) >= 0 && r(e) ? E(e) : e; return n(o) ? t.filter((function (e) { return n(e) && C(e, o) && "body" !== l(e) })) : [] }(e) : [].concat(t), c = [].concat(f, [o]), p = c[0], u = c.reduce((function (t, n) { var r = I(e, n, s); return t.top = i(r.top, t.top), t.right = a(r.right, t.right), t.bottom = a(r.bottom, t.bottom), t.left = i(r.left, t.left), t }), I(e, p, s)); return u.width = u.right - u.left, u.height = u.bottom - u.top, u.x = u.left, u.y = u.top, u } function F(e) { return e.split("-")[0] } function U(e) { return e.split("-")[1] } function z(e) { return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y" } function X(e) { var t, n = e.reference, r = e.element, o = e.placement, i = o ? F(o) : null, a = o ? U(o) : null, s = n.x + n.width / 2 - r.width / 2, f = n.y + n.height / 2 - r.height / 2; switch (i) { case D: t = { x: s, y: n.y - r.height }; break; case A: t = { x: s, y: n.y + n.height }; break; case L: t = { x: n.x + n.width, y: f }; break; case P: t = { x: n.x - r.width, y: f }; break; default: t = { x: n.x, y: n.y } }var c = i ? z(i) : null; if (null != c) { var p = "y" === c ? "height" : "width"; switch (a) { case W: t[c] = t[c] - (n[p] / 2 - r[p] / 2); break; case B: t[c] = t[c] + (n[p] / 2 - r[p] / 2) } } return t } function Y(e) { return Object.assign({}, { top: 0, right: 0, bottom: 0, left: 0 }, e) } function G(e, t) { return t.reduce((function (t, n) { return t[n] = e, t }), {}) } function J(e, t) { void 0 === t && (t = {}); var r = t, o = r.placement, i = void 0 === o ? e.placement : o, a = r.strategy, s = void 0 === a ? e.strategy : a, f = r.boundary, c = void 0 === f ? "clippingParents" : f, u = r.rootBoundary, l = void 0 === u ? H : u, h = r.elementContext, m = void 0 === h ? T : h, v = r.altBoundary, y = void 0 !== v && v, g = r.padding, b = void 0 === g ? 0 : g, x = Y("number" != typeof b ? b : G(b, k)), w = m === T ? "reference" : T, O = e.rects.popper, j = e.elements[y ? w : m], E = _(n(j) ? j : j.contextElement || d(e.elements.popper), c, l, s), P = p(e.elements.reference), M = X({ reference: P, element: O, strategy: "absolute", placement: i }), W = N(Object.assign({}, O, M)), B = m === T ? W : P, R = { top: E.top - B.top + x.top, bottom: B.bottom - E.bottom + x.bottom, left: E.left - B.left + x.left, right: B.right - E.right + x.right }, S = e.modifiersData.offset; if (m === T && S) { var V = S[i]; Object.keys(R).forEach((function (e) { var t = [L, A].indexOf(e) >= 0 ? 1 : -1, n = [D, A].indexOf(e) >= 0 ? "y" : "x"; R[e] += V[n] * t })) } return R } var K = { placement: "bottom", modifiers: [], strategy: "absolute" }; function Q() { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; return !t.some((function (e) { return !(e && "function" == typeof e.getBoundingClientRect) })) } function Z(e) { void 0 === e && (e = {}); var t = e, r = t.defaultModifiers, o = void 0 === r ? [] : r, i = t.defaultOptions, a = void 0 === i ? K : i; return function (e, t, r) { void 0 === r && (r = a); var i, s, f = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, K, a), modifiersData: {}, elements: { reference: e, popper: t }, attributes: {}, styles: {} }, c = [], p = !1, u = { state: f, setOptions: function (r) { var i = "function" == typeof r ? r(f.options) : r; l(), f.options = Object.assign({}, a, f.options, i), f.scrollParents = { reference: n(e) ? w(e) : e.contextElement ? w(e.contextElement) : [], popper: w(t) }; var s, p, d = function (e) { var t = q(e); return V.reduce((function (e, n) { return e.concat(t.filter((function (e) { return e.phase === n }))) }), []) }((s = [].concat(o, f.options.modifiers), p = s.reduce((function (e, t) { var n = e[t.name]; return e[t.name] = n ? Object.assign({}, n, t, { options: Object.assign({}, n.options, t.options), data: Object.assign({}, n.data, t.data) }) : t, e }), {}), Object.keys(p).map((function (e) { return p[e] })))); return f.orderedModifiers = d.filter((function (e) { return e.enabled })), f.orderedModifiers.forEach((function (e) { var t = e.name, n = e.options, r = void 0 === n ? {} : n, o = e.effect; if ("function" == typeof o) { var i = o({ state: f, name: t, instance: u, options: r }), a = function () { }; c.push(i || a) } })), u.update() }, forceUpdate: function () { if (!p) { var e = f.elements, t = e.reference, n = e.popper; if (Q(t, n)) { f.rects = { reference: y(t, E(n), "fixed" === f.options.strategy), popper: g(n) }, f.reset = !1, f.placement = f.options.placement, f.orderedModifiers.forEach((function (e) { return f.modifiersData[e.name] = Object.assign({}, e.data) })); for (var r = 0; r < f.orderedModifiers.length; r++)if (!0 !== f.reset) { var o = f.orderedModifiers[r], i = o.fn, a = o.options, s = void 0 === a ? {} : a, c = o.name; "function" == typeof i && (f = i({ state: f, options: s, name: c, instance: u }) || f) } else f.reset = !1, r = -1 } } }, update: (i = function () { return new Promise((function (e) { u.forceUpdate(), e(f) })) }, function () { return s || (s = new Promise((function (e) { Promise.resolve().then((function () { s = void 0, e(i()) })) }))), s }), destroy: function () { l(), p = !0 } }; if (!Q(e, t)) return u; function l() { c.forEach((function (e) { return e() })), c = [] } return u.setOptions(r).then((function (e) { !p && r.onFirstUpdate && r.onFirstUpdate(e) })), u } } var $ = { passive: !0 }; var ee = { name: "eventListeners", enabled: !0, phase: "write", fn: function () { }, effect: function (e) { var n = e.state, r = e.instance, o = e.options, i = o.scroll, a = void 0 === i || i, s = o.resize, f = void 0 === s || s, c = t(n.elements.popper), p = [].concat(n.scrollParents.reference, n.scrollParents.popper); return a && p.forEach((function (e) { e.addEventListener("scroll", r.update, $) })), f && c.addEventListener("resize", r.update, $), function () { a && p.forEach((function (e) { e.removeEventListener("scroll", r.update, $) })), f && c.removeEventListener("resize", r.update, $) } }, data: {} }; var te = { name: "popperOffsets", enabled: !0, phase: "read", fn: function (e) { var t = e.state, n = e.name; t.modifiersData[n] = X({ reference: t.rects.reference, element: t.rects.popper, strategy: "absolute", placement: t.placement }) }, data: {} }, ne = { top: "auto", right: "auto", bottom: "auto", left: "auto" }; function re(e) { var n, r = e.popper, o = e.popperRect, i = e.placement, a = e.variation, f = e.offsets, c = e.position, p = e.gpuAcceleration, u = e.adaptive, l = e.roundOffsets, h = e.isFixed, v = f.x, y = void 0 === v ? 0 : v, g = f.y, b = void 0 === g ? 0 : g, x = "function" == typeof l ? l({ x: y, y: b }) : { x: y, y: b }; y = x.x, b = x.y; var w = f.hasOwnProperty("x"), O = f.hasOwnProperty("y"), j = P, M = D, k = window; if (u) { var W = E(r), H = "clientHeight", T = "clientWidth"; if (W === t(r) && "static" !== m(W = d(r)).position && "absolute" === c && (H = "scrollHeight", T = "scrollWidth"), W = W, i === D || (i === P || i === L) && a === B) M = A, b -= (h && W === k && k.visualViewport ? k.visualViewport.height : W[H]) - o.height, b *= p ? 1 : -1; if (i === P || (i === D || i === A) && a === B) j = L, y -= (h && W === k && k.visualViewport ? k.visualViewport.width : W[T]) - o.width, y *= p ? 1 : -1 } var R, S = Object.assign({ position: c }, u && ne), V = !0 === l ? function (e, t) { var n = e.x, r = e.y, o = t.devicePixelRatio || 1; return { x: s(n * o) / o || 0, y: s(r * o) / o || 0 } }({ x: y, y: b }, t(r)) : { x: y, y: b }; return y = V.x, b = V.y, p ? Object.assign({}, S, ((R = {})[M] = O ? "0" : "", R[j] = w ? "0" : "", R.transform = (k.devicePixelRatio || 1) <= 1 ? "translate(" + y + "px, " + b + "px)" : "translate3d(" + y + "px, " + b + "px, 0)", R)) : Object.assign({}, S, ((n = {})[M] = O ? b + "px" : "", n[j] = w ? y + "px" : "", n.transform = "", n)) } var oe = { name: "computeStyles", enabled: !0, phase: "beforeWrite", fn: function (e) { var t = e.state, n = e.options, r = n.gpuAcceleration, o = void 0 === r || r, i = n.adaptive, a = void 0 === i || i, s = n.roundOffsets, f = void 0 === s || s, c = { placement: F(t.placement), variation: U(t.placement), popper: t.elements.popper, popperRect: t.rects.popper, gpuAcceleration: o, isFixed: "fixed" === t.options.strategy }; null != t.modifiersData.popperOffsets && (t.styles.popper = Object.assign({}, t.styles.popper, re(Object.assign({}, c, { offsets: t.modifiersData.popperOffsets, position: t.options.strategy, adaptive: a, roundOffsets: f })))), null != t.modifiersData.arrow && (t.styles.arrow = Object.assign({}, t.styles.arrow, re(Object.assign({}, c, { offsets: t.modifiersData.arrow, position: "absolute", adaptive: !1, roundOffsets: f })))), t.attributes.popper = Object.assign({}, t.attributes.popper, { "data-popper-placement": t.placement }) }, data: {} }; var ie = { name: "applyStyles", enabled: !0, phase: "write", fn: function (e) { var t = e.state; Object.keys(t.elements).forEach((function (e) { var n = t.styles[e] || {}, o = t.attributes[e] || {}, i = t.elements[e]; r(i) && l(i) && (Object.assign(i.style, n), Object.keys(o).forEach((function (e) { var t = o[e]; !1 === t ? i.removeAttribute(e) : i.setAttribute(e, !0 === t ? "" : t) }))) })) }, effect: function (e) { var t = e.state, n = { popper: { position: t.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} }; return Object.assign(t.elements.popper.style, n.popper), t.styles = n, t.elements.arrow && Object.assign(t.elements.arrow.style, n.arrow), function () { Object.keys(t.elements).forEach((function (e) { var o = t.elements[e], i = t.attributes[e] || {}, a = Object.keys(t.styles.hasOwnProperty(e) ? t.styles[e] : n[e]).reduce((function (e, t) { return e[t] = "", e }), {}); r(o) && l(o) && (Object.assign(o.style, a), Object.keys(i).forEach((function (e) { o.removeAttribute(e) }))) })) } }, requires: ["computeStyles"] }; var ae = { name: "offset", enabled: !0, phase: "main", requires: ["popperOffsets"], fn: function (e) { var t = e.state, n = e.options, r = e.name, o = n.offset, i = void 0 === o ? [0, 0] : o, a = S.reduce((function (e, n) { return e[n] = function (e, t, n) { var r = F(e), o = [P, D].indexOf(r) >= 0 ? -1 : 1, i = "function" == typeof n ? n(Object.assign({}, t, { placement: e })) : n, a = i[0], s = i[1]; return a = a || 0, s = (s || 0) * o, [P, L].indexOf(r) >= 0 ? { x: s, y: a } : { x: a, y: s } }(n, t.rects, i), e }), {}), s = a[t.placement], f = s.x, c = s.y; null != t.modifiersData.popperOffsets && (t.modifiersData.popperOffsets.x += f, t.modifiersData.popperOffsets.y += c), t.modifiersData[r] = a } }, se = { left: "right", right: "left", bottom: "top", top: "bottom" }; function fe(e) { return e.replace(/left|right|bottom|top/g, (function (e) { return se[e] })) } var ce = { start: "end", end: "start" }; function pe(e) { return e.replace(/start|end/g, (function (e) { return ce[e] })) } function ue(e, t) { void 0 === t && (t = {}); var n = t, r = n.placement, o = n.boundary, i = n.rootBoundary, a = n.padding, s = n.flipVariations, f = n.allowedAutoPlacements, c = void 0 === f ? S : f, p = U(r), u = p ? s ? R : R.filter((function (e) { return U(e) === p })) : k, l = u.filter((function (e) { return c.indexOf(e) >= 0 })); 0 === l.length && (l = u); var d = l.reduce((function (t, n) { return t[n] = J(e, { placement: n, boundary: o, rootBoundary: i, padding: a })[F(n)], t }), {}); return Object.keys(d).sort((function (e, t) { return d[e] - d[t] })) } var le = { name: "flip", enabled: !0, phase: "main", fn: function (e) { var t = e.state, n = e.options, r = e.name; if (!t.modifiersData[r]._skip) { for (var o = n.mainAxis, i = void 0 === o || o, a = n.altAxis, s = void 0 === a || a, f = n.fallbackPlacements, c = n.padding, p = n.boundary, u = n.rootBoundary, l = n.altBoundary, d = n.flipVariations, h = void 0 === d || d, m = n.allowedAutoPlacements, v = t.options.placement, y = F(v), g = f || (y === v || !h ? [fe(v)] : function (e) { if (F(e) === M) return []; var t = fe(e); return [pe(e), t, pe(t)] }(v)), b = [v].concat(g).reduce((function (e, n) { return e.concat(F(n) === M ? ue(t, { placement: n, boundary: p, rootBoundary: u, padding: c, flipVariations: h, allowedAutoPlacements: m }) : n) }), []), x = t.rects.reference, w = t.rects.popper, O = new Map, j = !0, E = b[0], k = 0; k < b.length; k++) { var B = b[k], H = F(B), T = U(B) === W, R = [D, A].indexOf(H) >= 0, S = R ? "width" : "height", V = J(t, { placement: B, boundary: p, rootBoundary: u, altBoundary: l, padding: c }), q = R ? T ? L : P : T ? A : D; x[S] > w[S] && (q = fe(q)); var C = fe(q), N = []; if (i && N.push(V[H] <= 0), s && N.push(V[q] <= 0, V[C] <= 0), N.every((function (e) { return e }))) { E = B, j = !1; break } O.set(B, N) } if (j) for (var I = function (e) { var t = b.find((function (t) { var n = O.get(t); if (n) return n.slice(0, e).every((function (e) { return e })) })); if (t) return E = t, "break" }, _ = h ? 3 : 1; _ > 0; _--) { if ("break" === I(_)) break } t.placement !== E && (t.modifiersData[r]._skip = !0, t.placement = E, t.reset = !0) } }, requiresIfExists: ["offset"], data: { _skip: !1 } }; function de(e, t, n) { return i(e, a(t, n)) } var he = { name: "preventOverflow", enabled: !0, phase: "main", fn: function (e) { var t = e.state, n = e.options, r = e.name, o = n.mainAxis, s = void 0 === o || o, f = n.altAxis, c = void 0 !== f && f, p = n.boundary, u = n.rootBoundary, l = n.altBoundary, d = n.padding, h = n.tether, m = void 0 === h || h, v = n.tetherOffset, y = void 0 === v ? 0 : v, b = J(t, { boundary: p, rootBoundary: u, padding: d, altBoundary: l }), x = F(t.placement), w = U(t.placement), O = !w, j = z(x), M = "x" === j ? "y" : "x", k = t.modifiersData.popperOffsets, B = t.rects.reference, H = t.rects.popper, T = "function" == typeof y ? y(Object.assign({}, t.rects, { placement: t.placement })) : y, R = "number" == typeof T ? { mainAxis: T, altAxis: T } : Object.assign({ mainAxis: 0, altAxis: 0 }, T), S = t.modifiersData.offset ? t.modifiersData.offset[t.placement] : null, V = { x: 0, y: 0 }; if (k) { if (s) { var q, C = "y" === j ? D : P, N = "y" === j ? A : L, I = "y" === j ? "height" : "width", _ = k[j], X = _ + b[C], Y = _ - b[N], G = m ? -H[I] / 2 : 0, K = w === W ? B[I] : H[I], Q = w === W ? -H[I] : -B[I], Z = t.elements.arrow, $ = m && Z ? g(Z) : { width: 0, height: 0 }, ee = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : { top: 0, right: 0, bottom: 0, left: 0 }, te = ee[C], ne = ee[N], re = de(0, B[I], $[I]), oe = O ? B[I] / 2 - G - re - te - R.mainAxis : K - re - te - R.mainAxis, ie = O ? -B[I] / 2 + G + re + ne + R.mainAxis : Q + re + ne + R.mainAxis, ae = t.elements.arrow && E(t.elements.arrow), se = ae ? "y" === j ? ae.clientTop || 0 : ae.clientLeft || 0 : 0, fe = null != (q = null == S ? void 0 : S[j]) ? q : 0, ce = _ + ie - fe, pe = de(m ? a(X, _ + oe - fe - se) : X, _, m ? i(Y, ce) : Y); k[j] = pe, V[j] = pe - _ } if (c) { var ue, le = "x" === j ? D : P, he = "x" === j ? A : L, me = k[M], ve = "y" === M ? "he
vendor: 4,578 bytes, lines 14634-14679
14634ight" : "width", ye = me + b[le], ge = me - b[he], be = -1 !== [D, P].indexOf(x), xe = null != (ue = null == S ? void 0 : S[M]) ? ue : 0, we = be ? ye : me - B[ve] - H[ve] - xe + R.altAxis, Oe = be ? me + B[ve] + H[ve] - xe - R.altAxis : ge, je = m && be ? function (e, t, n) { var r = de(e, t, n); return r > n ? n : r }(we, me, Oe) : de(m ? we : ye, me, m ? Oe : ge); k[M] = je, V[M] = je - me } t.modifiersData[r] = V } }, requiresIfExists: ["offset"] }; var me = { name: "arrow", enabled: !0, phase: "main", fn: function (e) { var t, n = e.state, r = e.name, o = e.options, i = n.elements.arrow, a = n.modifiersData.popperOffsets, s = F(n.placement), f = z(s), c = [P, L].indexOf(s) >= 0 ? "height" : "width"; if (i && a) { var p = function (e, t) { return Y("number" != typeof (e = "function" == typeof e ? e(Object.assign({}, t.rects, { placement: t.placement })) : e) ? e : G(e, k)) }(o.padding, n), u = g(i), l = "y" === f ? D : P, d = "y" === f ? A : L, h = n.rects.reference[c] + n.rects.reference[f] - a[f] - n.rects.popper[c], m = a[f] - n.rects.reference[f], v = E(i), y = v ? "y" === f ? v.clientHeight || 0 : v.clientWidth || 0 : 0, b = h / 2 - m / 2, x = p[l], w = y - u[c] - p[d], O = y / 2 - u[c] / 2 + b, j = de(x, O, w), M = f; n.modifiersData[r] = ((t = {})[M] = j, t.centerOffset = j - O, t) } }, effect: function (e) { var t = e.state, n = e.options.element, r = void 0 === n ? "[data-popper-arrow]" : n; null != r && ("string" != typeof r || (r = t.elements.popper.querySelector(r))) && C(t.elements.popper, r) && (t.elements.arrow = r) }, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] }; function ve(e, t, n) { return void 0 === n && (n = { x: 0, y: 0 }), { top: e.top - t.height - n.y, right: e.right - t.width + n.x, bottom: e.bottom - t.height + n.y, left: e.left - t.width - n.x } } function ye(e) { return [D, L, A, P].some((function (t) { return e[t] >= 0 })) } var ge = { name: "hide", enabled: !0, phase: "main", requiresIfExists: ["preventOverflow"], fn: function (e) { var t = e.state, n = e.name, r = t.rects.reference, o = t.rects.popper, i = t.modifiersData.preventOverflow, a = J(t, { elementContext: "reference" }), s = J(t, { altBoundary: !0 }), f = ve(a, r), c = ve(s, o, i), p = ye(f), u = ye(c); t.modifiersData[n] = { referenceClippingOffsets: f, popperEscapeOffsets: c, isReferenceHidden: p, hasPopperEscaped: u }, t.attributes.popper = Object.assign({}, t.attributes.popper, { "data-popper-reference-hidden": p, "data-popper-escaped": u }) } }, be = Z({ defaultModifiers: [ee, te, oe, ie] }), xe = [ee, te, oe, ie, ae, le, he, me, ge], we = Z({ defaultModifiers: xe }); e.applyStyles = ie, e.arrow = me, e.computeStyles = oe, e.createPopper = we, e.createPopperLite = be, e.defaultModifiers = xe, e.detectOverflow = J, e.eventListeners = ee, e.flip = le, e.hide = ge, e.offset = ae, e.popperGenerator = Z, e.popperOffsets = te, e.preventOverflow = he, Object.defineProperty(e, "__esModule", { value: !0 }) })); 14635//# sourceMappingURL=popper.min.js.map 14636/*! 14637 * Bootstrap v5.3.1 (https://getbootstrap.com/) 14638 * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 14639 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 14640 */ 14641! function(t, e) { 14642 "object" == typeof exports && "undefined" != typeof module ? module.exports = e(require("@popperjs/core")) : "function" == typeof define && define.amd ? define(["@popperjs/core"], e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).bootstrap = e(t.Popper) 14643}(this, (function(t) { 14644 "use strict"; 14645 14646 function e(t) { 14647 const e = Object.create(null, { 14648 [Symbol.toStringTag]: { 14649 value: "Module" 14650 } 14651 }); 14652 if (t) 14653 for (const i in t) 14654 if ("default" !== i) { 14655 const s = Object.getOwnPropertyDescriptor(t, i); 14656 Object.defineProperty(e, i, s.get ? s : { 14657 enumerable: !0, 14658 get: () => t[i] 14659 }) 14660 } return e.default = t, Object.freeze(e) 14661 } 14662 const i = e(t), 14663 s = new Map, 14664 n = { 14665 set(t, e, i) { 14666 s.has(t) || s.set(t, new Map); 14667 const n = s.get(t); 14668 n.has(e) || 0 === n.size ? n.set(e, i) : console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`) 14669 }, 14670 get: (t, e) => s.has(t) && s.get(t).get(e) || null, 14671 remove(t, e) { 14672 if (!s.has(t)) return; 14673 const i = s.get(t); 14674 i.delete(e), 0 === i.size && s.delete(t) 14675 } 14676 }, 14677 o = "transitionend", 14678 r = t => (t && window.CSS && window.CSS.escape && (t = t.replace(/#([^\s"#']+)/g, ((t, e) => `#${CSS.escape(e)}`))), t), 14679 a = t => {
vendor: 8,007 bytes, lines 14680-14937
14680 t.dispatchEvent(new Event(o)) 14681 }, 14682 l = t => !(!t || "object" != typeof t) && (void 0 !== t.jquery && (t = t[0]), void 0 !== t.nodeType), 14683 c = t => l(t) ? t.jquery ? t[0] : t : "string" == typeof t && t.length > 0 ? document.querySelector(r(t)) : null, 14684 h = t => { 14685 if (!l(t) || 0 === t.getClientRects().length) return !1; 14686 const e = "visible" === getComputedStyle(t).getPropertyValue("visibility"), 14687 i = t.closest("details:not([open])"); 14688 if (!i) return e; 14689 if (i !== t) { 14690 const e = t.closest("summary"); 14691 if (e && e.parentNode !== i) return !1; 14692 if (null === e) return !1 14693 } 14694 return e 14695 }, 14696 d = t => !t || t.nodeType !== Node.ELEMENT_NODE || !!t.classList.contains("disabled") || (void 0 !== t.disabled ? t.disabled : t.hasAttribute("disabled") && "false" !== t.getAttribute("disabled")), 14697 u = t => { 14698 if (!document.documentElement.attachShadow) return null; 14699 if ("function" == typeof t.getRootNode) { 14700 const e = t.getRootNode(); 14701 return e instanceof ShadowRoot ? e : null 14702 } 14703 return t instanceof ShadowRoot ? t : t.parentNode ? u(t.parentNode) : null 14704 }, 14705 _ = () => {}, 14706 g = t => { 14707 t.offsetHeight 14708 }, 14709 f = () => window.jQuery && !document.body.hasAttribute("data-bs-no-jquery") ? window.jQuery : null, 14710 m = [], 14711 p = () => "rtl" === document.documentElement.dir, 14712 b = t => { 14713 var e; 14714 e = () => { 14715 const e = f(); 14716 if (e) { 14717 const i = t.NAME, 14718 s = e.fn[i]; 14719 e.fn[i] = t.jQueryInterface, e.fn[i].Constructor = t, e.fn[i].noConflict = () => (e.fn[i] = s, t.jQueryInterface) 14720 } 14721 }, "loading" === document.readyState ? (m.length || document.addEventListener("DOMContentLoaded", (() => { 14722 for (const t of m) t() 14723 })), m.push(e)) : e() 14724 }, 14725 v = (t, e = [], i = t) => "function" == typeof t ? t(...e) : i, 14726 y = (t, e, i = !0) => { 14727 if (!i) return void v(t); 14728 const s = (t => { 14729 if (!t) return 0; 14730 let { 14731 transitionDuration: e, 14732 transitionDelay: i 14733 } = window.getComputedStyle(t); 14734 const s = Number.parseFloat(e), 14735 n = Number.parseFloat(i); 14736 return s || n ? (e = e.split(",")[0], i = i.split(",")[0], 1e3 * (Number.parseFloat(e) + Number.parseFloat(i))) : 0 14737 })(e) + 5; 14738 let n = !1; 14739 const r = ({ 14740 target: i 14741 }) => { 14742 i === e && (n = !0, e.removeEventListener(o, r), v(t)) 14743 }; 14744 e.addEventListener(o, r), setTimeout((() => { 14745 n || a(e) 14746 }), s) 14747 }, 14748 w = (t, e, i, s) => { 14749 const n = t.length; 14750 let o = t.indexOf(e); 14751 return -1 === o ? !i && s ? t[n - 1] : t[0] : (o += i ? 1 : -1, s && (o = (o + n) % n), t[Math.max(0, Math.min(o, n - 1))]) 14752 }, 14753 A = /[^.]*(?=\..*)\.|.*/, 14754 E = /\..*/, 14755 C = /::\d+$/, 14756 T = {}; 14757 let k = 1; 14758 const $ = { 14759 mouseenter: "mouseover", 14760 mouseleave: "mouseout" 14761 }, 14762 S = new Set(["click", "dblclick", "mouseup", "mousedown", "contextmenu", "mousewheel", "DOMMouseScroll", "mouseover", "mouseout", "mousemove", "selectstart", "selectend", "keydown", "keypress", "keyup", "orientationchange", "touchstart", "touchmove", "touchend", "touchcancel", "pointerdown", "pointermove", "pointerup", "pointerleave", "pointercancel", "gesturestart", "gesturechange", "gestureend", "focus", "blur", "change", "reset", "select", "submit", "focusin", "focusout", "load", "unload", "beforeunload", "resize", "move", "DOMContentLoaded", "readystatechange", "error", "abort", "scroll"]); 14763 14764 function L(t, e) { 14765 return e && `${e}::${k++}` || t.uidEvent || k++ 14766 } 14767 14768 function O(t) { 14769 const e = L(t); 14770 return t.uidEvent = e, T[e] = T[e] || {}, T[e] 14771 } 14772 14773 function I(t, e, i = null) { 14774 return Object.values(t).find((t => t.callable === e && t.delegationSelector === i)) 14775 } 14776 14777 function D(t, e, i) { 14778 const s = "string" == typeof e, 14779 n = s ? i : e || i; 14780 let o = M(t); 14781 return S.has(o) || (o = t), [s, n, o] 14782 } 14783 14784 function N(t, e, i, s, n) { 14785 if ("string" != typeof e || !t) return; 14786 let [o, r, a] = D(e, i, s); 14787 if (e in $) { 14788 const t = t => function(e) { 14789 if (!e.relatedTarget || e.relatedTarget !== e.delegateTarget && !e.delegateTarget.contains(e.relatedTarget)) return t.call(this, e) 14790 }; 14791 r = t(r) 14792 } 14793 const l = O(t), 14794 c = l[a] || (l[a] = {}), 14795 h = I(c, r, o ? i : null); 14796 if (h) return void(h.oneOff = h.oneOff && n); 14797 const d = L(r, e.replace(A, "")), 14798 u = o ? function(t, e, i) { 14799 return function s(n) { 14800 const o = t.querySelectorAll(e); 14801 for (let { 14802 target: r 14803 } = n; r && r !== this; r = r.parentNode) 14804 for (const a of o) 14805 if (a === r) return F(n, { 14806 delegateTarget: r 14807 }), s.oneOff && j.off(t, n.type, e, i), i.apply(r, [n]) 14808 } 14809 }(t, i, r) : function(t, e) { 14810 return function i(s) { 14811 return F(s, { 14812 delegateTarget: t 14813 }), i.oneOff && j.off(t, s.type, e), e.apply(t, [s]) 14814 } 14815 }(t, r); 14816 u.delegationSelector = o ? i : null, u.callable = r, u.oneOff = n, u.uidEvent = d, c[d] = u, t.addEventListener(a, u, o) 14817 } 14818 14819 function P(t, e, i, s, n) { 14820 const o = I(e[i], s, n); 14821 o && (t.removeEventListener(i, o, Boolean(n)), delete e[i][o.uidEvent]) 14822 } 14823 14824 function x(t, e, i, s) { 14825 const n = e[i] || {}; 14826 for (const [o, r] of Object.entries(n)) o.includes(s) && P(t, e, i, r.callable, r.delegationSelector) 14827 } 14828 14829 function M(t) { 14830 return t = t.replace(E, ""), $[t] || t 14831 } 14832 const j = { 14833 on(t, e, i, s) { 14834 N(t, e, i, s, !1) 14835 }, 14836 one(t, e, i, s) { 14837 N(t, e, i, s, !0) 14838 }, 14839 off(t, e, i, s) { 14840 if ("string" != typeof e || !t) return; 14841 const [n, o, r] = D(e, i, s), a = r !== e, l = O(t), c = l[r] || {}, h = e.startsWith("."); 14842 if (void 0 === o) { 14843 if (h) 14844 for (const i of Object.keys(l)) x(t, l, i, e.slice(1)); 14845 for (const [i, s] of Object.entries(c)) { 14846 const n = i.replace(C, ""); 14847 a && !e.includes(n) || P(t, l, r, s.callable, s.delegationSelector) 14848 } 14849 } else { 14850 if (!Object.keys(c).length) return; 14851 P(t, l, r, o, n ? i : null) 14852 } 14853 }, 14854 trigger(t, e, i) { 14855 if ("string" != typeof e || !t) return null; 14856 const s = f(); 14857 let n = null, 14858 o = !0, 14859 r = !0, 14860 a = !1; 14861 e !== M(e) && s && (n = s.Event(e, i), s(t).trigger(n), o = !n.isPropagationStopped(), r = !n.isImmediatePropagationStopped(), a = n.isDefaultPrevented()); 14862 const l = F(new Event(e, { 14863 bubbles: o, 14864 cancelable: !0 14865 }), i); 14866 return a && l.preventDefault(), r && t.dispatchEvent(l), l.defaultPrevented && n && n.preventDefault(), l 14867 } 14868 }; 14869 14870 function F(t, e = {}) { 14871 for (const [i, s] of Object.entries(e)) try { 14872 t[i] = s 14873 } catch (e) { 14874 Object.defineProperty(t, i, { 14875 configurable: !0, 14876 get: () => s 14877 }) 14878 } 14879 return t 14880 } 14881 14882 function z(t) { 14883 if ("true" === t) return !0; 14884 if ("false" === t) return !1; 14885 if (t === Number(t).toString()) return Number(t); 14886 if ("" === t || "null" === t) return null; 14887 if ("string" != typeof t) return t; 14888 try { 14889 return JSON.parse(decodeURIComponent(t)) 14890 } catch (e) { 14891 return t 14892 } 14893 } 14894 14895 function H(t) { 14896 return t.replace(/[A-Z]/g, (t => `-${t.toLowerCase()}`)) 14897 } 14898 const B = { 14899 setDataAttribute(t, e, i) { 14900 t.setAttribute(`data-bs-${H(e)}`, i) 14901 }, 14902 removeDataAttribute(t, e) { 14903 t.removeAttribute(`data-bs-${H(e)}`) 14904 }, 14905 getDataAttributes(t) { 14906 if (!t) return {}; 14907 const e = {}, 14908 i = Object.keys(t.dataset).filter((t => t.startsWith("bs") && !t.startsWith("bsConfig"))); 14909 for (const s of i) { 14910 let i = s.replace(/^bs/, ""); 14911 i = i.charAt(0).toLowerCase() + i.slice(1, i.length), e[i] = z(t.dataset[s]) 14912 } 14913 return e 14914 }, 14915 getDataAttribute: (t, e) => z(t.getAttribute(`data-bs-${H(e)}`)) 14916 }; 14917 class q { 14918 static get Default() { 14919 return {} 14920 } 14921 static get DefaultType() { 14922 return {} 14923 } 14924 static get NAME() { 14925 throw new Error('You have to implement the static method "NAME", for each component!') 14926 } 14927 _getConfig(t) { 14928 return t = this._mergeConfigObj(t), t = this._configAfterMerge(t), this._typeCheckConfig(t), t 14929 } 14930 _configAfterMerge(t) { 14931 return t 14932 } 14933 _mergeConfigObj(t, e) { 14934 const i = l(e) ? B.getDataAttribute(e, "config") : {}; 14935 return { 14936 ...this.constructor.Default, 14937 ..."object" == typeof i ? i : {},
14938 ...l(e) ? B.getDataAttributes(e) : {}, 14939 ..."object" == typeof t ? t : {} 14940 } 14941 } 14942 _typeCheckConfig(t, e = this.constructor.DefaultType) { 14943 for (const [s, n] of Object.entries(e)) { 14944 const e = t[s], 14945 o = l(e) ? "element" : null == (i = e) ? `${i}` : Object.prototype.toString.call(i).match(/\s([a-z]+)/i)[1].toLowerCase(); 14946 if (!new RegExp(n).test(o)) throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${s}" provided type "${o}" but expected type "${n}".`) 14947 } 14948 var i 14949 } 14950 } 14951 class W extends q { 14952 constructor(t, e) { 14953 super(), (t = c(t)) && (this._element = t, this._config = this._getConfig(e), n.set(this._element, this.constructor.DATA_KEY, this)) 14954 } 14955 dispose() { 14956 n.remove(this._element, this.constructor.DATA_KEY), j.off(this._element, this.constructor.EVENT_KEY); 14957 for (const t of Object.getOwnPropertyNames(this)) this[t] = null 14958 } 14959 _queueCallback(t, e, i = !0) { 14960 y(t, e, i) 14961 } 14962 _getConfig(t) { 14963 return t = this._mergeConfigObj(t, this._element), t = this._configAfterMerge(t), this._typeCheckConfig(t), t 14964 } 14965 static getInstance(t) { 14966 return n.get(c(t), this.DATA_KEY) 14967 } 14968 static getOrCreateInstance(t, e = {}) { 14969 return this.getInstance(t) || new this(t, "object" == typeof e ? e : null) 14970 } 14971 static get VERSION() { 14972 return "5.3.1" 14973 } 14974 static get DATA_KEY() { 14975 return `bs.${this.NAME}` 14976 } 14977 static get EVENT_KEY() { 14978 return `.${this.DATA_KEY}` 14979 } 14980 static eventName(t) { 14981 return `${t}${this.EVENT_KEY}` 14982 } 14983 } 14984 const R = t => { 14985 let e = t.getAttribute("data-bs-target"); 14986 if (!e || "#" === e) { 14987 let i = t.getAttribute("href"); 14988 if (!i || !i.includes("#") && !i.startsWith(".")) return null; 14989 i.includes("#") && !i.startsWith("#") && (i = `#${i.split("#")[1]}`), e = i && "#" !== i ? i.trim() : null 14990 } 14991 return r(e) 14992 }, 14993 K = { 14994 find: (t, e = document.documentElement) => [].concat(...Element.prototype.querySelectorAll.call(e, t)), 14995 findOne: (t, e = document.documentElement) => Element.prototype.querySelector.call(e, t), 14996 children: (t, e) => [].concat(...t.children).filter((t => t.matches(e))), 14997 parents(t, e) { 14998 const i = []; 14999 let s = t.parentNode.closest(e); 15000 for (; s;) i.push(s), s = s.parentNode.closest(e); 15001 return i 15002 }, 15003 prev(t, e) { 15004 let i = t.previousElementSibling; 15005 for (; i;) { 15006 if (i.matches(e)) return [i]; 15007 i = i.previousElementSibling 15008 } 15009 return [] 15010 }, 15011 next(t, e) { 15012 let i = t.nextElementSibling; 15013 for (; i;) { 15014 if (i.matches(e)) return [i]; 15015 i = i.nextElementSibling 15016 } 15017 return [] 15018 }, 15019 focusableChildren(t) { 15020 const e = ["a", "button", "input", "textarea", "select", "details", "[tabindex]", '[contenteditable="true"]'].map((t => `${t}:not([tabindex^="-"])`)).join(","); 15021 return this.find(e, t).filter((t => !d(t) && h(t))) 15022 }, 15023 getSelectorFromElement(t) { 15024 const e = R(t); 15025 return e && K.findOne(e) ? e : null 15026 }, 15027 getElementFromSelector(t) { 15028 const e = R(t); 15029 return e ? K.findOne(e) : null 15030 }, 15031 getMultipleElementsFromSelector(t) { 15032 const e = R(t); 15033 return e ? K.find(e) : [] 15034 } 15035 }, 15036 V = (t, e = "hide") => { 15037 const i = `click.dismiss${t.EVENT_KEY}`, 15038 s = t.NAME; 15039 j.on(document, i, `[data-bs-dismiss="${s}"]`, (function(i) { 15040 if (["A", "AREA"].includes(this.tagName) && i.preventDefault(), d(this)) return; 15041 const n = K.getElementFromSelector(this) || this.closest(`.${s}`); 15042 t.getOrCreateInstance(n)[e]() 15043 })) 15044 }, 15045 Q = ".bs.alert", 15046 X = `close${Q}`, 15047 Y = `closed${Q}`; 15048 class U extends W { 15049 static get NAME() { 15050 return "alert" 15051 } 15052 close() { 15053 if (j.trigger(this._element, X).defaultPrevented) return; 15054 this._element.classList.remove("show"); 15055 const t = this._element.classList.contains("fade"); 15056 this._queueCallback((() => this._destroyElement()), this._element, t) 15057 } 15058 _destroyElement() { 15059 this._element.remove(), j.trigger(this._element, Y), this.dispose() 15060 } 15061 static jQueryInterface(t) { 15062 return this.each((function() { 15063 const e = U.getOrCreateInstance(this); 15064 if ("string" == typeof t) { 15065 if (void 0 === e[t] || t.startsWith("_") || "constructor" === t) throw new TypeError(`No method n
15065amed "${t}"`); 15066 e[t](this) 15067 } 15068 })) 15069 } 15070 } 15071 V(U, "close"), b(U); 15072 const G = '[data-bs-toggle="button"]'; 15073 class J extends W { 15074 static get NAME() { 15075 return "button" 15076 } 15077 toggle() { 15078 this._element.setAttribute("aria-pressed", this._element.classList.toggle("active")) 15079 } 15080 static jQueryInterface(t) { 15081 return this.each((function() { 15082 const e = J.getOrCreateInstance(this); 15083 "toggle" === t && e[t]() 15084 })) 15085 } 15086 } 15087 j.on(document, "click.bs.button.data-api", G, (t => { 15088 t.preventDefault(); 15089 const e = t.target.closest(G); 15090 J.getOrCreateInstance(e).toggle() 15091 })), b(J); 15092 const Z = ".bs.swipe", 15093 tt = `touchstart${Z}`, 15094 et = `touchmove${Z}`, 15095 it = `touchend${Z}`, 15096 st = `pointerdown${Z}`, 15097 nt = `pointerup${Z}`, 15098 ot = { 15099 endCallback: null, 15100 leftCallback: null, 15101 rightCallback: null 15102 }, 15103 rt = { 15104 endCallback: "(function|null)", 15105 leftCallback: "(function|null)", 15106 rightCallback: "(function|null)" 15107 }; 15108 class at extends q { 15109 constructor(t, e) { 15110 super(), this._element = t, t && at.isSupported() && (this._config = this._getConfig(e), this._deltaX = 0, this._supportPointerEvents = Boolean(window.PointerEvent), this._initEvents()) 15111 } 15112 static get Default() { 15113 return ot 15114 } 15115 static get DefaultType() { 15116 return rt 15117 } 15118 static get NAME() { 15119 return "swipe" 15120 } 15121 dispose() { 15122 j.off(this._element, Z) 15123 } 15124 _start(t) { 15125 this._supportPointerEvents ? this._eventIsPointerPenTouch(t) && (this._deltaX = t.clientX) : this._deltaX = t.touches[0].clientX 15126 } 15127 _end(t) { 15128 this._eventIsPointerPenTouch(t) && (this._deltaX = t.clientX - this._deltaX), this._handleSwipe(), v(this._config.endCallback) 15129 } 15130 _move(t) { 15131 this._deltaX = t.touches && t.touches.length > 1 ? 0 : t.touches[0].clientX - this._deltaX 15132 } 15133 _handleSwipe() { 15134 const t = Math.abs(this._deltaX); 15135 if (t <= 40) return; 15136 const e = t / this._deltaX; 15137 this._deltaX = 0, e && v(e > 0 ? this._config.rightCallback : this._config.leftCallback) 15138 } 15139 _initEvents() { 15140 this._supportPointerEvents ? (j.on(this._element, st, (t => this._start(t))), j.on(this._element, nt, (t => this._end(t))), this._element.classList.add("pointer-event")) : (j.on(this._element, tt, (t => this._start(t))), j.on(this._element, et, (t => this._move(t))), j.on(this._element, it, (t => this._end(t)))) 15141 } 15142 _eventIsPointerPenTouch(t) { 15143 return this._supportPointerEvents && ("pen" === t.pointerType || "touch" === t.pointerType) 15144 } 15145 static isSupported() { 15146 return "ontouchstart" in document.documentElement || navigator.maxTouchPoints > 0 15147 } 15148 } 15149 const lt = ".bs.carousel", 15150 ct = ".data-api", 15151 ht = "next", 15152 dt = "prev", 15153 ut = "left", 15154 _t = "right", 15155 gt = `slide${lt}`, 15156 ft = `slid${lt}`, 15157 mt = `keydown${lt}`, 15158 pt = `mouseenter${lt}`, 15159 bt = `mouseleave${lt}`, 15160 vt = `dragstart${lt}`, 15161 yt = `load${lt}${ct}`, 15162 wt = `click${lt}${ct}`, 15163 At = "carousel", 15164 Et = "active", 15165 Ct = ".active", 15166 Tt = ".carousel-item", 15167 kt = Ct + Tt, 15168 $t = { 15169 ArrowLeft: _t, 15170 ArrowRight: ut 15171 }, 15172 St = { 15173 interval: 5e3, 15174 keyboard: !0, 15175 pause: "hover", 15176 ride: !1, 15177 touch: !0, 15178 wrap: !0 15179 }, 15180 Lt = { 15181 interval: "(number|boolean)", 15182 keyboard: "boolean", 15183 pause: "(string|boolean)", 15184 ride: "(boolean|string)", 15185 touch: "boolean", 15186 wrap: "boolean" 15187 }; 15188 class Ot extends W { 15189 constructor(t, e) { 15190 super(t, e), this._interval = null, this._activeElement = null, this._isSliding = !1, this.touchTimeout = null, this._swipeHelper = null, this._indicatorsElement = K.findOne(".carousel-indicators", this._element), this._addEventListeners(), this._config.ride === At && this.cycle() 15191 } 15192 static get Default() { 15193 return St 15194 } 15195 static get DefaultType() { 15196 return Lt 15197 } 15198 static get NAME() { 15199 return "carousel" 15200 } 15201 next() { 15202 this._slide(ht) 15203 } 15204 nextWhenVisible() { 15205 !document.hidden && h(this._element) && this.next() 15206 } 15207 prev() { 15208 this._slide(dt) 15209 } 15210 pause() { 15211 this._isSliding && a(this._element), this._clearInterval() 15212 } 15213 cycle() { 15214 this._clearInterval(), this._updateInterval(), this._interval = setInterval((() => this.nextWhenVisible()), this._config.interval) 15215 } 15216 _maybeEnableCycle() { 15217 this._config.ride && (this._isSliding ? j.one(this._element, ft, (() => this.cycle())) : this.cycle()) 15218 } 15219 to(t) { 15220 const e = this._getItems(); 15221 if (t > e.length - 1 || t < 0) return; 15222 if (this._isSliding) return void j.one(this._element, ft, (() => this.to(t))); 15223 const i = this._getItemIndex(this._getActive()); 15224 if (i === t) return; 15225 const s = t > i ? ht : dt; 15226 this._slide(s, e[t]) 15227 } 15228 dispose() {
vendor: 8,040 bytes, lines 15229-15432
15229 this._swipeHelper && this._swipeHelper.dispose(), super.dispose() 15230 } 15231 _configAfterMerge(t) { 15232 return t.defaultInterval = t.interval, t 15233 } 15234 _addEventListeners() { 15235 this._config.keyboard && j.on(this._element, mt, (t => this._keydown(t))), "hover" === this._config.pause && (j.on(this._element, pt, (() => this.pause())), j.on(this._element, bt, (() => this._maybeEnableCycle()))), this._config.touch && at.isSupported() && this._addTouchEventListeners() 15236 } 15237 _addTouchEventListeners() { 15238 for (const t of K.find(".carousel-item img", this._element)) j.on(t, vt, (t => t.preventDefault())); 15239 const t = { 15240 leftCallback: () => this._slide(this._directionToOrder(ut)), 15241 rightCallback: () => this._slide(this._directionToOrder(_t)), 15242 endCallback: () => { 15243 "hover" === this._config.pause && (this.pause(), this.touchTimeout && clearTimeout(this.touchTimeout), this.touchTimeout = setTimeout((() => this._maybeEnableCycle()), 500 + this._config.interval)) 15244 } 15245 }; 15246 this._swipeHelper = new at(this._element, t) 15247 } 15248 _keydown(t) { 15249 if (/input|textarea/i.test(t.target.tagName)) return; 15250 const e = $t[t.key]; 15251 e && (t.preventDefault(), this._slide(this._directionToOrder(e))) 15252 } 15253 _getItemIndex(t) { 15254 return this._getItems().indexOf(t) 15255 } 15256 _setActiveIndicatorElement(t) { 15257 if (!this._indicatorsElement) return; 15258 const e = K.findOne(Ct, this._indicatorsElement); 15259 e.classList.remove(Et), e.removeAttribute("aria-current"); 15260 const i = K.findOne(`[data-bs-slide-to="${t}"]`, this._indicatorsElement); 15261 i && (i.classList.add(Et), i.setAttribute("aria-current", "true")) 15262 } 15263 _updateInterval() { 15264 const t = this._activeElement || this._getActive(); 15265 if (!t) return; 15266 const e = Number.parseInt(t.getAttribute("data-bs-interval"), 10); 15267 this._config.interval = e || this._config.defaultInterval 15268 } 15269 _slide(t, e = null) { 15270 if (this._isSliding) return; 15271 const i = this._getActive(), 15272 s = t === ht, 15273 n = e || w(this._getItems(), i, s, this._config.wrap); 15274 if (n === i) return; 15275 const o = this._getItemIndex(n), 15276 r = e => j.trigger(this._element, e, { 15277 relatedTarget: n, 15278 direction: this._orderToDirection(t), 15279 from: this._getItemIndex(i), 15280 to: o 15281 }); 15282 if (r(gt).defaultPrevented) return; 15283 if (!i || !n) return; 15284 const a = Boolean(this._interval); 15285 this.pause(), this._isSliding = !0, this._setActiveIndicatorElement(o), this._activeElement = n; 15286 const l = s ? "carousel-item-start" : "carousel-item-end", 15287 c = s ? "carousel-item-next" : "carousel-item-prev"; 15288 n.classList.add(c), g(n), i.classList.add(l), n.classList.add(l), this._queueCallback((() => { 15289 n.classList.remove(l, c), n.classList.add(Et), i.classList.remove(Et, c, l), this._isSliding = !1, r(ft) 15290 }), i, this._isAnimated()), a && this.cycle() 15291 } 15292 _isAnimated() { 15293 return this._element.classList.contains("slide") 15294 } 15295 _getActive() { 15296 return K.findOne(kt, this._element) 15297 } 15298 _getItems() { 15299 return K.find(Tt, this._element) 15300 } 15301 _clearInterval() { 15302 this._interval && (clearInterval(this._interval), this._interval = null) 15303 } 15304 _directionToOrder(t) { 15305 return p() ? t === ut ? dt : ht : t === ut ? ht : dt 15306 } 15307 _orderToDirection(t) { 15308 return p() ? t === dt ? ut : _t : t === dt ? _t : ut 15309 } 15310 static jQueryInterface(t) { 15311 return this.each((function() { 15312 const e = Ot.getOrCreateInstance(this, t); 15313 if ("number" != typeof t) { 15314 if ("string" == typeof t) { 15315 if (void 0 === e[t] || t.startsWith("_") || "constructor" === t) throw new TypeError(`No method named "${t}"`); 15316 e[t]() 15317 } 15318 } else e.to(t) 15319 })) 15320 } 15321 } 15322 j.on(document, wt, "[data-bs-slide], [data-bs-slide-to]", (function(t) { 15323 const e = K.getElementFromSelector(this); 15324 if (!e || !e.classList.contains(At)) return; 15325 t.preventDefault(); 15326 const i = Ot.getOrCreateInstance(e), 15327 s = this.getAttribute("data-bs-slide-to"); 15328 return s ? (i.to(s), void i._maybeEnableCycle()) : "next" === B.getDataAttribute(this, "slide") ? (i.next(), void i._maybeEnableCycle()) : (i.prev(), void i._maybeEnableCycle()) 15329 })), j.on(window, yt, (() => { 15330 const t = K.find('[data-bs-ride="carousel"]'); 15331 for (const e of t) Ot.getOrCreateInstance(e) 15332 })), b(Ot); 15333 const It = ".bs.collapse", 15334 Dt = `show${It}`, 15335 Nt = `shown${It}`, 15336 Pt = `hide${It}`, 15337 xt = `hidden${It}`, 15338 Mt = `click${It}.data-api`, 15339 jt = "show", 15340 Ft = "collapse", 15341 zt = "collapsing", 15342 Ht = `:scope .${Ft} .${Ft}`, 15343 Bt = '[data-bs-toggle="collapse"]', 15344 qt = { 15345 parent: null, 15346 toggle: !0 15347 }, 15348 Wt = { 15349 parent: "(null|element)", 15350 toggle: "boolean" 15351 }; 15352 class Rt extends W { 15353 constructor(t, e) { 15354 super(t, e), this._isTransitioning = !1, this._triggerArray = []; 15355 const i = K.find(Bt); 15356 for (const t of i) { 15357 const e = K.getSelectorFromElement(t), 15358 i = K.find(e).filter((t => t === this._element)); 15359 null !== e && i.length && this._triggerArray.push(t) 15360 } 15361 this._initializeChildren(), this._config.parent || this._addAriaAndCollapsedClass(this._triggerArray, this._isShown()), this._config.toggle && this.toggle() 15362 } 15363 static get Default() { 15364 return qt 15365 } 15366 static get DefaultType() { 15367 return Wt 15368 } 15369 static get NAME() { 15370 return "collapse" 15371 } 15372 toggle() { 15373 this._isShown() ? this.hide() : this.show() 15374 } 15375 show() { 15376 if (this._isTransitioning || this._isShown()) return; 15377 let t = []; 15378 if (this._config.parent && (t = this._getFirstLevelChildren(".collapse.show, .collapse.collapsing").filter((t => t !== this._element)).map((t => Rt.getOrCreateInstance(t, { 15379 toggle: !1 15380 })))), t.length && t[0]._isTransitioning) return; 15381 if (j.trigger(this._element, Dt).defaultPrevented) return; 15382 for (const e of t) e.hide(); 15383 const e = this._getDimension(); 15384 this._element.classList.remove(Ft), this._element.classList.add(zt), this._element.style[e] = 0, this._addAriaAndCollapsedClass(this._triggerArray, !0), this._isTransitioning = !0; 15385 const i = `scroll${e[0].toUpperCase()+e.slice(1)}`; 15386 this._queueCallback((() => { 15387 this._isTransitioning = !1, this._element.classList.remove(zt), this._element.classList.add(Ft, jt), this._element.style[e] = "", j.trigger(this._element, Nt) 15388 }), this._element, !0), this._element.style[e] = `${this._element[i]}px` 15389 } 15390 hide() { 15391 if (this._isTransitioning || !this._isShown()) return; 15392 if (j.trigger(this._element, Pt).defaultPrevented) return; 15393 const t = this._getDimension(); 15394 this._element.style[t] = `${this._element.getBoundingClientRect()[t]}px`, g(this._element), this._element.classList.add(zt), this._element.classList.remove(Ft, jt); 15395 for (const t of this._triggerArray) { 15396 const e = K.getElementFromSelector(t); 15397 e && !this._isShown(e) && this._addAriaAndCollapsedClass([t], !1) 15398 } 15399 this._isTransitioning = !0, this._element.style[t] = "", this._queueCallback((() => { 15400 this._isTransitioning = !1, this._element.classList.remove(zt), this._element.classList.add(Ft), j.trigger(this._element, xt) 15401 }), this._element, !0) 15402 } 15403 _isShown(t = this._element) { 15404 return t.classList.contains(jt) 15405 } 15406 _configAfterMerge(t) { 15407 return t.toggle = Boolean(t.toggle), t.parent = c(t.parent), t 15408 } 15409 _getDimension() { 15410 return this._element.classList.contains("collapse-horizontal") ? "width" : "height" 15411 } 15412 _initializeChildren() { 15413 if (!this._config.parent) return; 15414 const t = this._getFirstLevelChildren(Bt); 15415 for (const e of t) { 15416 const t = K.getElementFromSelector(e); 15417 t && this._addAriaAndCollapsedClass([e], this._isShown(t)) 15418 } 15419 } 15420 _getFirstLevelChildren(t) { 15421 const e = K.find(Ht, this._config.parent); 15422 return K.find(t, this._config.parent).filter((t => !e.includes(t))) 15423 } 15424 _addAriaAndCollapsedClass(t, e) { 15425 if (t.length) 15426 for (const i of t) i.classList.toggle("collapsed", !e), i.setAttribute("aria-expanded", e) 15427 } 15428 static jQueryInterface(t) { 15429 const e = {}; 15430 return "string" == typeof t && /show|hide/.test(t) && (e.toggle = !1), this.each((function() { 15431 const i = Rt.getOrCreateInstance(this, e); 15432 if ("string" == typeof t) {
vendor: 2,149 bytes, lines 15433-15505
15433 if (void 0 === i[t]) throw new TypeError(`No method named "${t}"`); 15434 i[t]() 15435 } 15436 })) 15437 } 15438 } 15439 j.on(document, Mt, Bt, (function(t) { 15440 ("A" === t.target.tagName || t.delegateTarget && "A" === t.delegateTarget.tagName) && t.preventDefault(); 15441 for (const t of K.getMultipleElementsFromSelector(this)) Rt.getOrCreateInstance(t, { 15442 toggle: !1 15443 }).toggle() 15444 })), b(Rt); 15445 const Kt = "dropdown", 15446 Vt = ".bs.dropdown", 15447 Qt = ".data-api", 15448 Xt = "ArrowUp", 15449 Yt = "ArrowDown", 15450 Ut = `hide${Vt}`, 15451 Gt = `hidden${Vt}`, 15452 Jt = `show${Vt}`, 15453 Zt = `shown${Vt}`, 15454 te = `click${Vt}${Qt}`, 15455 ee = `keydown${Vt}${Qt}`, 15456 ie = `keyup${Vt}${Qt}`, 15457 se = "show", 15458 ne = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)', 15459 oe = `${ne}.${se}`, 15460 re = ".dropdown-menu", 15461 ae = p() ? "top-end" : "top-start", 15462 le = p() ? "top-start" : "top-end", 15463 ce = p() ? "bottom-end" : "bottom-start", 15464 he = p() ? "bottom-start" : "bottom-end", 15465 de = p() ? "left-start" : "right-start", 15466 ue = p() ? "right-start" : "left-start", 15467 _e = { 15468 autoClose: !0, 15469 boundary: "clippingParents", 15470 display: "dynamic", 15471 offset: [0, 2], 15472 popperConfig: null, 15473 reference: "toggle" 15474 }, 15475 ge = { 15476 autoClose: "(boolean|string)", 15477 boundary: "(string|element)", 15478 display: "string", 15479 offset: "(array|string|function)", 15480 popperConfig: "(null|object|function)", 15481 reference: "(string|element|object)" 15482 }; 15483 class fe extends W { 15484 constructor(t, e) { 15485 super(t, e), this._popper = null, this._parent = this._element.parentNode, this._menu = K.next(this._element, re)[0] || K.prev(this._element, re)[0] || K.findOne(re, this._parent), this._inNavbar = this._detectNavbar() 15486 } 15487 static get Default() { 15488 return _e 15489 } 15490 static get DefaultType() { 15491 return ge 15492 } 15493 static get NAME() { 15494 return Kt 15495 } 15496 toggle() { 15497 return this._isShown() ? this.hide() : this.show() 15498 } 15499 show() { 15500 if (d(this._element) || this._isShown()) return; 15501 const t = { 15502 relatedTarget: this._element 15503 }; 15504 if (!j.trigger(this._element, Jt, t).defaultPrevented) { 15505 if (this._createPopper(), "ontouchstart" in document.documentElement && !this._parent.closest(".
vendor: 2,347 bytes, lines 15505-15553
15505navbar-nav")) 15506 for (const t of [].concat(...document.body.children)) j.on(t, "mouseover", _); 15507 this._element.focus(), this._element.setAttribute("aria-expanded", !0), this._menu.classList.add(se), this._element.classList.add(se), j.trigger(this._element, Zt, t) 15508 } 15509 } 15510 hide() { 15511 if (d(this._element) || !this._isShown()) return; 15512 const t = { 15513 relatedTarget: this._element 15514 }; 15515 this._completeHide(t) 15516 } 15517 dispose() { 15518 this._popper && this._popper.destroy(), super.dispose() 15519 } 15520 update() { 15521 this._inNavbar = this._detectNavbar(), this._popper && this._popper.update() 15522 } 15523 _completeHide(t) { 15524 if (!j.trigger(this._element, Ut, t).defaultPrevented) { 15525 if ("ontouchstart" in document.documentElement) 15526 for (const t of [].concat(...document.body.children)) j.off(t, "mouseover", _); 15527 this._popper && this._popper.destroy(), this._menu.classList.remove(se), this._element.classList.remove(se), this._element.setAttribute("aria-expanded", "false"), B.removeDataAttribute(this._menu, "popper"), j.trigger(this._element, Gt, t) 15528 } 15529 } 15530 _getConfig(t) { 15531 if ("object" == typeof(t = super._getConfig(t)).reference && !l(t.reference) && "function" != typeof t.reference.getBoundingClientRect) throw new TypeError(`${Kt.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); 15532 return t 15533 } 15534 _createPopper() { 15535 if (void 0 === i) throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)"); 15536 let t = this._element; 15537 "parent" === this._config.reference ? t = this._parent : l(this._config.reference) ? t = c(this._config.reference) : "object" == typeof this._config.reference && (t = this._config.reference); 15538 const e = this._getPopperConfig(); 15539 this._popper = i.createPopper(t, this._menu, e) 15540 } 15541 _isShown() { 15542 return this._menu.classList.contains(se) 15543 } 15544 _getPlacement() { 15545 const t = this._parent; 15546 if (t.classList.contains("dropend")) return de; 15547 if (t.classList.contains("dropstart")) return ue; 15548 if (t.classList.contains("dropup-center")) return "top"; 15549 if (t.classList.contains("dropdown-center")) return "bottom"; 15550 const e = "end" === getComputedStyle(this._menu).getPropertyValue("--bs-position").trim(); 15551 return t.classList.contains("dropup") ? e ? le : ae : e ? he : ce 15552 } 15553 _detectNavbar() {
vendor: 6,723 bytes, lines 15554-15769
15554 return null !== this._element.closest(".navbar") 15555 } 15556 _getOffset() { 15557 const { 15558 offset: t 15559 } = this._config; 15560 return "string" == typeof t ? t.split(",").map((t => Number.parseInt(t, 10))) : "function" == typeof t ? e => t(e, this._element) : t 15561 } 15562 _getPopperConfig() { 15563 const t = { 15564 placement: this._getPlacement(), 15565 modifiers: [{ 15566 name: "preventOverflow", 15567 options: { 15568 boundary: this._config.boundary 15569 } 15570 }, { 15571 name: "offset", 15572 options: { 15573 offset: this._getOffset() 15574 } 15575 }] 15576 }; 15577 return (this._inNavbar || "static" === this._config.display) && (B.setDataAttribute(this._menu, "popper", "static"), t.modifiers = [{ 15578 name: "applyStyles", 15579 enabled: !1 15580 }]), { 15581 ...t, 15582 ...v(this._config.popperConfig, [t]) 15583 } 15584 } 15585 _selectMenuItem({ 15586 key: t, 15587 target: e 15588 }) { 15589 const i = K.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)", this._menu).filter((t => h(t))); 15590 i.length && w(i, e, t === Yt, !i.includes(e)).focus() 15591 } 15592 static jQueryInterface(t) { 15593 return this.each((function() { 15594 const e = fe.getOrCreateInstance(this, t); 15595 if ("string" == typeof t) { 15596 if (void 0 === e[t]) throw new TypeError(`No method named "${t}"`); 15597 e[t]() 15598 } 15599 })) 15600 } 15601 static clearMenus(t) { 15602 if (2 === t.button || "keyup" === t.type && "Tab" !== t.key) return; 15603 const e = K.find(oe); 15604 for (const i of e) { 15605 const e = fe.getInstance(i); 15606 if (!e || !1 === e._config.autoClose) continue; 15607 const s = t.composedPath(), 15608 n = s.includes(e._menu); 15609 if (s.includes(e._element) || "inside" === e._config.autoClose && !n || "outside" === e._config.autoClose && n) continue; 15610 if (e._menu.contains(t.target) && ("keyup" === t.type && "Tab" === t.key || /input|select|option|textarea|form/i.test(t.target.tagName))) continue; 15611 const o = { 15612 relatedTarget: e._element 15613 }; 15614 "click" === t.type && (o.clickEvent = t), e._completeHide(o) 15615 } 15616 } 15617 static dataApiKeydownHandler(t) { 15618 const e = /input|textarea/i.test(t.target.tagName), 15619 i = "Escape" === t.key, 15620 s = [Xt, Yt].includes(t.key); 15621 if (!s && !i) return; 15622 if (e && !i) return; 15623 t.preventDefault(); 15624 const n = this.matches(ne) ? this : K.prev(this, ne)[0] || K.next(this, ne)[0] || K.findOne(ne, t.delegateTarget.parentNode), 15625 o = fe.getOrCreateInstance(n); 15626 if (s) return t.stopPropagation(), o.show(), void o._selectMenuItem(t); 15627 o._isShown() && (t.stopPropagation(), o.hide(), n.focus()) 15628 } 15629 } 15630 j.on(document, ee, ne, fe.dataApiKeydownHandler), j.on(document, ee, re, fe.dataApiKeydownHandler), j.on(document, te, fe.clearMenus), j.on(document, ie, fe.clearMenus), j.on(document, te, ne, (function(t) { 15631 t.preventDefault(), fe.getOrCreateInstance(this).toggle() 15632 })), b(fe); 15633 const me = "backdrop", 15634 pe = "show", 15635 be = `mousedown.bs.${me}`, 15636 ve = { 15637 className: "modal-backdrop", 15638 clickCallback: null, 15639 isAnimated: !1, 15640 isVisible: !0, 15641 rootElement: "body" 15642 }, 15643 ye = { 15644 className: "string", 15645 clickCallback: "(function|null)", 15646 isAnimated: "boolean", 15647 isVisible: "boolean", 15648 rootElement: "(element|string)" 15649 }; 15650 class we extends q { 15651 constructor(t) { 15652 super(), this._config = this._getConfig(t), this._isAppended = !1, this._element = null 15653 } 15654 static get Default() { 15655 return ve 15656 } 15657 static get DefaultType() { 15658 return ye 15659 } 15660 static get NAME() { 15661 return me 15662 } 15663 show(t) { 15664 if (!this._config.isVisible) return void v(t); 15665 this._append(); 15666 const e = this._getElement(); 15667 this._config.isAnimated && g(e), e.classList.add(pe), this._emulateAnimation((() => { 15668 v(t) 15669 })) 15670 } 15671 hide(t) { 15672 this._config.isVisible ? (this._getElement().classList.remove(pe), this._emulateAnimation((() => { 15673 this.dispose(), v(t) 15674 }))) : v(t) 15675 } 15676 dispose() { 15677 this._isAppended && (j.off(this._element, be), this._element.remove(), this._isAppended = !1) 15678 } 15679 _getElement() { 15680 if (!this._element) { 15681 const t = document.createElement("div"); 15682 t.className = this._config.className, this._config.isAnimated && t.classList.add("fade"), this._element = t 15683 } 15684 return this._element 15685 } 15686 _configAfterMerge(t) { 15687 return t.rootElement = c(t.rootElement), t 15688 } 15689 _append() { 15690 if (this._isAppended) return; 15691 const t = this._getElement(); 15692 this._config.rootElement.append(t), j.on(t, be, (() => { 15693 v(this._config.clickCallback) 15694 })), this._isAppended = !0 15695 } 15696 _emulateAnimation(t) { 15697 y(t, this._getElement(), this._config.isAnimated) 15698 } 15699 } 15700 const Ae = ".bs.focustrap", 15701 Ee = `focusin${Ae}`, 15702 Ce = `keydown.tab${Ae}`, 15703 Te = "backward", 15704 ke = { 15705 autofocus: !0, 15706 trapElement: null 15707 }, 15708 $e = { 15709 autofocus: "boolean", 15710 trapElement: "element" 15711 }; 15712 class Se extends q { 15713 constructor(t) { 15714 super(), this._config = this._getConfig(t), this._isActive = !1, this._lastTabNavDirection = null 15715 } 15716 static get Default() { 15717 return ke 15718 } 15719 static get DefaultType() { 15720 return $e 15721 } 15722 static get NAME() { 15723 return "focustrap" 15724 } 15725 activate() { 15726 this._isActive || (this._config.autofocus && this._config.trapElement.focus(), j.off(document, Ae), j.on(document, Ee, (t => this._handleFocusin(t))), j.on(document, Ce, (t => this._handleKeydown(t))), this._isActive = !0) 15727 } 15728 deactivate() { 15729 this._isActive && (this._isActive = !1, j.off(document, Ae)) 15730 } 15731 _handleFocusin(t) { 15732 const { 15733 trapElement: e 15734 } = this._config; 15735 if (t.target === document || t.target === e || e.contains(t.target)) return; 15736 const i = K.focusableChildren(e); 15737 0 === i.length ? e.focus() : this._lastTabNavDirection === Te ? i[i.length - 1].focus() : i[0].focus() 15738 } 15739 _handleKeydown(t) { 15740 "Tab" === t.key && (this._lastTabNavDirection = t.shiftKey ? Te : "forward") 15741 } 15742 } 15743 const Le = ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top", 15744 Oe = ".sticky-top", 15745 Ie = "padding-right", 15746 De = "margin-right"; 15747 class Ne { 15748 constructor() { 15749 this._element = document.body 15750 } 15751 getWidth() { 15752 const t = document.documentElement.clientWidth; 15753 return Math.abs(window.innerWidth - t) 15754 } 15755 hide() { 15756 const t = this.getWidth(); 15757 this._disableOverFlow(), this._setElementAttributes(this._element, Ie, (e => e + t)), this._setElementAttributes(Le, Ie, (e => e + t)), this._setElementAttributes(Oe, De, (e => e - t)) 15758 } 15759 reset() { 15760 this._resetElementAttributes(this._element, "overflow"), this._resetElementAttributes(this._element, Ie), this._resetElementAttributes(Le, Ie), this._resetElementAttributes(Oe, De) 15761 } 15762 isOverflowing() { 15763 return this.getWidth() > 0 15764 } 15765 _disableOverFlow() { 15766 this._saveInitialAttribute(this._element, "overflow"), this._element.style.overflow = "hidden" 15767 } 15768 _setElementAttributes(t, e, i) { 15769 const s = this.getWidth();
15770 this._applyManipulationCallback(t, (t => { 15771 if (t !== this._element && window.innerWidth > t.clientWidth + s) return; 15772 this._saveInitialAttribute(t, e); 15773 const n = window.getComputedStyle(t).getPropertyValue(e); 15774 t.style.setProperty(e, `${i(Number.parseFloat(n))}px`) 15775 })) 15776 } 15777 _saveInitialAttribute(t, e) { 15778 const i = t.style.getPropertyValue(e); 15779 i && B.setDataAttribute(t, e, i) 15780 } 15781 _resetElementAttributes(t, e) { 15782 this._applyManipulationCallback(t, (t => { 15783 const i = B.getDataAttribute(t, e); 15784 null !== i ? (B.removeDataAttribute(t, e), t.style.setProperty(e, i)) : t.style.removeProperty(e) 15785 })) 15786 } 15787 _applyManipulationCallback(t, e) { 15788 if (l(t)) e(t); 15789 else 15790 for (const i of K.find(t, this._element)) e(i) 15791 } 15792 } 15793 const Pe = ".bs.modal", 15794 xe = `hide${Pe}`, 15795 Me = `hidePrevented${Pe}`, 15796 je = `hidden${Pe}`, 15797 Fe = `show${Pe}`, 15798 ze = `shown${Pe}`, 15799 He = `resize${Pe}`, 15800 Be = `click.dismiss${Pe}`, 15801 qe = `mousedown.dismiss${Pe}`, 15802 We = `keydown.dismiss${Pe}`, 15803 Re = `click${Pe}.data-api`, 15804 Ke = "modal-open", 15805 Ve = "show",
15806 Qe = "modal-static", 15807 Xe = { 15808 backdrop: !0, 15809 focus: !0, 15810 keyboard: !0 15811 }, 15812 Ye = { 15813 backdrop: "(boolean|string)", 15814 focus: "boolean", 15815 keyboard: "boolean" 15816 }; 15817 class Ue extends W { 15818 constructor(t, e) { 15819 super(t, e), this._dialog = K.findOne(".modal-dialog", this._element), this._backdrop = this._initializeBackDrop(), this._focustrap = this._initializeFocusTrap(), this._isShown = !1, this._isTransitioning = !1, this._scrollBar = new Ne, this._addEventListeners() 15820 } 15821 static get Default() { 15822 return Xe 15823 } 15824 static get DefaultType() { 15825 return Ye 15826 } 15827 static get NAME() { 15828 return "modal" 15829 } 15830 toggle(t) { 15831 return this._isShown ? this.hide() : this.show(t) 15832 } 15833 show(t) { 15834 this._isShown || this._isTransitioning || j.trigger(this._element, Fe, { 15835 relatedTarget: t 15836 }).defaultPrevented || (this._isShown = !0, this._isTransitioning = !0, this._scrollBar.hide(), document.body.classList.add(Ke), this._adjustDialog(), this._backdrop.show((() => this._showElement(t)))) 15837 } 15838 hide() { 15839 this._isShown && !this._isTransitioning && (j.trigger(this._element, xe).defaultPrevented || (this._isShown = !1, this._isTransitioning = !0, this._focustrap.deactivate(), this._element.classList.remove(Ve), this._queueCallback((() => this._hideModal()), this._element, this._isAnimated()))) 15840 } 15841 dispose() { 15842 j.off(window, Pe), j.off(this._dialog, Pe), this._backdrop.dispose(), this._focustrap.deactivate(), super.dispose() 15843 } 15844 handleUpdate() { 15845 this._adjustDialog() 15846 } 15847 _initializeBackDrop() { 15848 return new we({ 15849 isVisible: Boolean(this._config.backdrop), 15850 isAnimated: this._isAnimated() 15851 }) 15852 } 15853 _initializeFocusTrap() { 15854 return new Se({ 15855 trapElement: this._element 15856 }) 15857 } 15858 _showElement(t) { 15859 document.body.contains(this._element) || document.body.append(this._element), this._element.style.display = "block", this._element.removeAttribute("aria-hidden"), this._element.setAttribute("aria-modal", !0), this._element.setAttribute("role", "dialog"), this._element.scrollTop = 0; 15860 const e = K.findOne(".modal-body", this._dialog); 15861 e && (e.scrollTop = 0), g(this._element), this._element.classList.add(Ve), this._queueCallback((() => { 15862 this._config.focus && this._focustrap.activate(), this._isTransitioning = !1, j.trigger(this._element, ze, { 15863 relatedTarget: t 15864 }) 15865 }), this._dialog, this._isAnimated()) 15866 } 15867 _addEventListeners() { 15868 j.on(this._element, We, (t => { 15869 "Escape" === t.key && (this._config.keyboard ? this.hide() : this._triggerBackdropTransition()) 15870 })), j.on(window, He, (() => { 15871 this._isShown && !this._isTransitioning && this._adjustDialog() 15872 })), j.on(this._element, qe, (t => { 15873 j.one(this._element, Be, (e => { 15874 this._element === t.target && this._element === e.target && ("static" !== this._config.backdrop ? this._config.backdrop && this.hide() : this._triggerBackdropTransition()) 15875 })) 15876 })) 15877 } 15878 _hideModal() { 15879 this._element.style.display = "none", this._element.setAttribute("aria-hidden", !0), this._element.removeAttribute("aria-modal"), this._element.removeAttribute("role"), this._isTransitioning = !1, this._backdrop.hide((() => { 15880 document.body.classList.remove(Ke), this._resetAdjustments(), this._scrollBar.reset(), j.trigger(this._element, je) 15881 })) 15882 } 15883 _isAnimated() { 15884 return this._element.classList.contains("fade") 15885 } 15886 _triggerBackdropTransition() { 15887 if (j.trigger(this._element, Me).defaultPrevented) return; 15888 const t = this._element.scrollHeight > document.documentElement.clientHeight, 15889 e = this._element.style.overflowY; 15890 "hidden" === e || this._element.classList.contains(Qe) || (t || (this._element.style.overflowY = "hidden"), this._element.classList.add(Qe), this._queueCallback((() => { 15891 this._element.classList.remove(Qe), this._queueCallback((() => { 15892 this._element.style.overflowY = e 15893 }), this._dialog) 15894 }), this._dialog), this._element.focus()) 15895 }
15896 _adjustDialog() { 15897 const t = this._element.scrollHeight > document.documentElement.clientHeight, 15898 e = this._scrollBar.getWidth(), 15899 i = e > 0; 15900 if (i && !t) { 15901 const t = p() ? "paddingLeft" : "paddingRight"; 15902 this._element.style[t] = `${e}px` 15903 } 15904 if (!i && t) { 15905 const t = p() ? "paddingRight" : "paddingLeft"; 15906 this._element.style[t] = `${e}px` 15907 } 15908 } 15909 _resetAdjustments() { 15910 this._element.style.paddingLeft = "", this._element.style.paddingRight = "" 15911 } 15912 static jQueryInterface(t, e) { 15913 return this.each((function() { 15914 const i = Ue.getOrCreateInstance(this, t); 15915 if ("string" == typeof t) { 15916 if (void 0 === i[t]) throw new TypeError(`No method named "${t}"`); 15917 i[t](e) 15918 } 15919 })) 15920 } 15921 } 15922 j.on(document, Re, '[data-bs-toggle="modal"]', (function(t) { 15923 const e = K.getElementFromSelector(this); 15924 ["A", "AREA"].includes(this.tagName) && t.preventDefault(), j.one(e, Fe, (t => { 15925 t.defaultPrevented || j.one(e, je, (() => { 15926 h(this) && this.focus() 15927 })) 15928 })); 15929 const i = K.findOne(".modal.show"); 15930 i && Ue.getInstance(i).hide(), Ue.getOrCreateInstance(e).toggle(this) 15931 })), V(Ue), b(Ue); 15932 const Ge = ".bs.offcanvas", 15933 Je = ".data-api", 15934 Ze = `load${Ge}${Je}`, 15935 ti = "show", 15936 ei = "showing", 15937 ii = "hiding", 15938 si = ".offcanvas.show", 15939 ni = `show${Ge}`, 15940 oi = `shown${Ge}`, 15941 ri = `hide${Ge}`, 15942 ai = `hidePrevented${Ge}`, 15943 li = `hidden${Ge}`, 15944 ci = `resize${Ge}`, 15945 hi = `click${Ge}${Je}`, 15946 di = `keydown.dismiss${Ge}`, 15947 ui = { 15948 backdrop: !0, 15949 keyboard: !0, 15950 scroll: !1 15951 }, 15952 _i = { 15953 backdrop: "(boolean|string)", 15954 keyboard: "boolean", 15955 scroll: "boolean" 15956 }; 15957 class gi extends W { 15958 constructor(t, e) { 15959 super(t, e), this._isShown = !1, this._backdrop = this._initializeBackDrop(), this._focustrap = this._initializeFocusTrap(), this._addEventListeners() 15960 } 15961 static get Default() { 15962 return ui 15963 } 15964 static get DefaultType() { 15965 return _i 15966 } 15967 static get NAME() { 15968 return "offcanvas" 15969 } 15970 toggle(t) { 15971 return this._isShown ? this.hide() : this.show(t) 15972 } 15973 show(t) { 15974 this._isShown || j.trigger(this._element, ni, { 15975 relatedTarget: t 15976 }).defaultPrevented || (this._isShown = !0, this._backdrop.show(), this._config.scroll || (new Ne).hide(), this._element.setAttribute("aria-modal", !0), this._element.setAttribute("role", "dialog"), this._element.classList.add(ei), this._queueCallback((() => { 15977 this._config.scroll && !this._config.backdrop || this._focustrap.activate(), this._element.classList.add(ti), this._element.classList.remove(ei), j.trigger(this._element, oi, { 15978 relatedTarget: t 15979 }) 15980 }), this._element, !0)) 15981 } 15982 hide() { 15983 this._isShown && (j.trigger(this._element, ri).defaultPrevented || (this._focustrap.deactivate(), this._element.blur(), this._isShown = !1, this._element.classList.add(ii), this._backdrop.hide(), this._queueCallback((() => { 15984 this._element.classList.remove(ti, ii), this._element.removeAttribute("aria-modal"), this._element.removeAttribute("role"), this._config.scroll || (new Ne).reset(), j.trigger(this._element, li) 15985 }), this._element, !0))) 15986 } 15987 dispose() { 15988 this._backdrop.dispose(), this._focustrap.deactivate(), super.dispose() 15989 } 15990 _initializeBackDrop() { 15991 const t = Boolean(this._config.backdrop); 15992 return new we({ 15993 className: "offcanvas-backdrop", 15994 isVisible: t, 15995 isAnimated: !0, 15996 rootElement: this._element.parentNode, 15997 clickCallback: t ? () => { 15998 "static" !== this._config.backdrop ? this.hide() : j.trigger(this._element, ai) 15999 } : null 16000 }) 16001 } 16002 _initializeFocusTrap() { 16003 return new Se({ 16004 trapElement: this._element 16005 }) 16006 } 16007 _addEventListeners() { 16008 j.on(this._element, di, (t => { 16009 "Escape" === t.key && (this._config.keyboard ? this.hide() : j.trigger(this._element, ai)) 16010 })) 16011 } 16012 static jQueryInterface(t) { 16013 return this.each((function() { 16014 const e = gi.getOrCreateInstance(this, t); 16015 if ("string" == typeof t) { 16016 if (void 0 === e[t] || t.startsWith("_") || "constructor" === t) throw new TypeError(`No method named "${t}"`); 16017 e[t](this) 16018 } 16019 })) 16020 } 16021 } 16022 j.on(document, hi, '[data-bs-toggle="offcanvas"]', (function(t) { 16023 const e = K.getElementFromSelector(this); 16024 if (["A", "AREA"].includes(this.tagName) && t.preventDefault(), d(this)) return; 16025 j.one(e, li, (() => { 16026 h(this) && this.focus() 16027 })); 16028 const i = K.findOne(si); 16029 i && i !== e && gi.getInstance(i).hide(), gi.getOrCreateInstance(e).toggle(this) 16030 })), j.on(window, Ze, (() => { 16031 for (const t of K.find(si)) gi.getOrCreateInstance(t).show() 16032 })), j.on(window, ci, (() => { 16033 for (const t of K.find("[aria-modal][class*=show][class*=offcanvas-]")) "fixed" !== getComputedStyle(t).position && gi.getOrCreateInstance(t).hide() 16034 })), V(gi), b(gi); 16035 const fi = { 16036 "*": ["class", "dir", "id", "lang", "role", /^aria-[\w-]*$/i], 16037 a: ["target", "href", "title", "rel"], 16038 area: [], 16039 b: [], 16040 br: [], 16041 col: [], 16042 code: [], 16043 div: [], 16044 em: [], 16045 hr: [], 16046 h1: [], 16047 h2: [], 16048 h3: [], 16049 h4: [], 16050 h5: [], 16051 h6: [], 16052 i: [], 16053 img: ["src", "srcset", "alt", "title", "width", "height"], 16054 li: [], 16055 ol: [], 16056 p: [], 16057 pre: [], 16058 s: [], 16059 small: [], 16060 span: [], 16061 sub: [], 16062 sup: [], 16063 strong: [], 16064 u: [], 16065 ul: [] 16066 }, 16067 mi = new Set(["background", "cite", "href", "itemtype", "longdesc", "poster", "src", "xlink:href"]), 16068 pi = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i, 16069 bi = (t, e) => { 16070 const i = t.nodeName.toLowerCase();
vendor: 7,108 bytes, lines 16071-16276
16071 return e.includes(i) ? !mi.has(i) || Boolean(pi.test(t.nodeValue)) : e.filter((t => t instanceof RegExp)).some((t => t.test(i))) 16072 }, 16073 vi = { 16074 allowList: fi, 16075 content: {}, 16076 extraClass: "", 16077 html: !1, 16078 sanitize: !0, 16079 sanitizeFn: null, 16080 template: "<div></div>" 16081 }, 16082 yi = { 16083 allowList: "object", 16084 content: "object", 16085 extraClass: "(string|function)", 16086 html: "boolean", 16087 sanitize: "boolean", 16088 sanitizeFn: "(null|function)", 16089 template: "string" 16090 }, 16091 wi = { 16092 entry: "(string|element|function|null)", 16093 selector: "(string|element)" 16094 }; 16095 class Ai extends q { 16096 constructor(t) { 16097 super(), this._config = this._getConfig(t) 16098 } 16099 static get Default() { 16100 return vi 16101 } 16102 static get DefaultType() { 16103 return yi 16104 } 16105 static get NAME() { 16106 return "TemplateFactory" 16107 } 16108 getContent() { 16109 return Object.values(this._config.content).map((t => this._resolvePossibleFunction(t))).filter(Boolean) 16110 } 16111 hasContent() { 16112 return this.getContent().length > 0 16113 } 16114 changeContent(t) { 16115 return this._checkContent(t), this._config.content = { 16116 ...this._config.content, 16117 ...t 16118 }, this 16119 } 16120 toHtml() { 16121 const t = document.createElement("div"); 16122 t.innerHTML = this._maybeSanitize(this._config.template); 16123 for (const [e, i] of Object.entries(this._config.content)) this._setContent(t, i, e); 16124 const e = t.children[0], 16125 i = this._resolvePossibleFunction(this._config.extraClass); 16126 return i && e.classList.add(...i.split(" ")), e 16127 } 16128 _typeCheckConfig(t) { 16129 super._typeCheckConfig(t), this._checkContent(t.content) 16130 } 16131 _checkContent(t) { 16132 for (const [e, i] of Object.entries(t)) super._typeCheckConfig({ 16133 selector: e, 16134 entry: i 16135 }, wi) 16136 } 16137 _setContent(t, e, i) { 16138 const s = K.findOne(i, t); 16139 s && ((e = this._resolvePossibleFunction(e)) ? l(e) ? this._putElementInTemplate(c(e), s) : this._config.html ? s.innerHTML = this._maybeSanitize(e) : s.textContent = e : s.remove()) 16140 } 16141 _maybeSanitize(t) { 16142 return this._config.sanitize ? function(t, e, i) { 16143 if (!t.length) return t; 16144 if (i && "function" == typeof i) return i(t); 16145 const s = (new window.DOMParser).parseFromString(t, "text/html"), 16146 n = [].concat(...s.body.querySelectorAll("*")); 16147 for (const t of n) { 16148 const i = t.nodeName.toLowerCase(); 16149 if (!Object.keys(e).includes(i)) { 16150 t.remove(); 16151 continue 16152 } 16153 const s = [].concat(...t.attributes), 16154 n = [].concat(e["*"] || [], e[i] || []); 16155 for (const e of s) bi(e, n) || t.removeAttribute(e.nodeName) 16156 } 16157 return s.body.innerHTML 16158 }(t, this._config.allowList, this._config.sanitizeFn) : t 16159 } 16160 _resolvePossibleFunction(t) { 16161 return v(t, [this]) 16162 } 16163 _putElementInTemplate(t, e) { 16164 if (this._config.html) return e.innerHTML = "", void e.append(t); 16165 e.textContent = t.textContent 16166 } 16167 } 16168 const Ei = new Set(["sanitize", "allowList", "sanitizeFn"]), 16169 Ci = "fade", 16170 Ti = "show", 16171 ki = ".modal", 16172 $i = "hide.bs.modal", 16173 Si = "hover", 16174 Li = "focus", 16175 Oi = { 16176 AUTO: "auto", 16177 TOP: "top", 16178 RIGHT: p() ? "left" : "right", 16179 BOTTOM: "bottom", 16180 LEFT: p() ? "right" : "left" 16181 }, 16182 Ii = { 16183 allowList: fi, 16184 animation: !0, 16185 boundary: "clippingParents", 16186 container: !1, 16187 customClass: "", 16188 delay: 0, 16189 fallbackPlacements: ["top", "right", "bottom", "left"], 16190 html: !1, 16191 offset: [0, 6], 16192 placement: "top", 16193 popperConfig: null, 16194 sanitize: !0, 16195 sanitizeFn: null, 16196 selector: !1, 16197 template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', 16198 title: "", 16199 trigger: "hover focus" 16200 }, 16201 Di = { 16202 allowList: "object", 16203 animation: "boolean", 16204 boundary: "(string|element)", 16205 container: "(string|element|boolean)", 16206 customClass: "(string|function)", 16207 delay: "(number|object)", 16208 fallbackPlacements: "array", 16209 html: "boolean", 16210 offset: "(array|string|function)", 16211 placement: "(string|function)", 16212 popperConfig: "(null|object|function)", 16213 sanitize: "boolean", 16214 sanitizeFn: "(null|function)", 16215 selector: "(string|boolean)", 16216 template: "string", 16217 title: "(string|element|function)", 16218 trigger: "string" 16219 }; 16220 class Ni extends W { 16221 constructor(t, e) { 16222 if (void 0 === i) throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)"); 16223 super(t, e), this._isEnabled = !0, this._timeout = 0, this._isHovered = null, this._activeTrigger = {}, this._popper = null, this._templateFactory = null, this._newContent = null, this.tip = null, this._setListeners(), this._config.selector || this._fixTitle() 16224 } 16225 static get Default() { 16226 return Ii 16227 } 16228 static get DefaultType() { 16229 return Di 16230 } 16231 static get NAME() { 16232 return "tooltip" 16233 } 16234 enable() { 16235 this._isEnabled = !0 16236 } 16237 disable() { 16238 this._isEnabled = !1 16239 } 16240 toggleEnabled() { 16241 this._isEnabled = !this._isEnabled 16242 } 16243 toggle() { 16244 this._isEnabled && (this._activeTrigger.click = !this._activeTrigger.click, this._isShown() ? this._leave() : this._enter()) 16245 } 16246 dispose() { 16247 clearTimeout(this._timeout), j.off(this._element.closest(ki), $i, this._hideModalHandler), this._element.getAttribute("data-bs-original-title") && this._element.setAttribute("title", this._element.getAttribute("data-bs-original-title")), this._disposePopper(), super.dispose() 16248 } 16249 show() { 16250 if ("none" === this._element.style.display) throw new Error("Please use show on visible elements"); 16251 if (!this._isWithContent() || !this._isEnabled) return; 16252 const t = j.trigger(this._element, this.constructor.eventName("show")), 16253 e = (u(this._element) || this._element.ownerDocument.documentElement).contains(this._element); 16254 if (t.defaultPrevented || !e) return; 16255 this._disposePopper(); 16256 const i = this._getTipElement(); 16257 this._element.setAttribute("aria-describedby", i.getAttribute("id")); 16258 const { 16259 container: s 16260 } = this._config; 16261 if (this._element.ownerDocument.documentElement.contains(this.tip) || (s.append(i), j.trigger(this._element, this.constructor.eventName("inserted"))), this._popper = this._createPopper(i), i.classList.add(Ti), "ontouchstart" in document.documentElement) 16262 for (const t of [].concat(...document.body.children)) j.on(t, "mouseover", _); 16263 this._queueCallback((() => { 16264 j.trigger(this._element, this.constructor.eventName("shown")), !1 === this._isHovered && this._leave(), this._isHovered = !1 16265 }), this.tip, this._isAnimated()) 16266 } 16267 hide() { 16268 if (this._isShown() && !j.trigger(this._element, this.constructor.eventName("hide")).defaultPrevented) { 16269 if (this._getTipElement().classList.remove(Ti), "ontouchstart" in document.documentElement) 16270 for (const t of [].concat(...document.body.children)) j.off(t, "mouseover", _); 16271 this._activeTrigger.click = !1, this._activeTrigger[Li] = !1, this._activeTrigger[Si] = !1, this._isHovered = null, this._queueCallback((() => { 16272 this._isWithActiveTrigger() || (this._isHovered || this._disposePopper(), this._element.removeAttribute("aria-describedby"), j.trigger(this._element, this.constructor.eventName("hidden"))) 16273 }), this.tip, this._isAnimated()) 16274 } 16275 } 16276 update() {
vendor: 5,800 bytes, lines 16277-16441
16277 this._popper && this._popper.update() 16278 } 16279 _isWithContent() { 16280 return Boolean(this._getTitle()) 16281 } 16282 _getTipElement() { 16283 return this.tip || (this.tip = this._createTipElement(this._newContent || this._getContentForTemplate())), this.tip 16284 } 16285 _createTipElement(t) { 16286 const e = this._getTemplateFactory(t).toHtml(); 16287 if (!e) return null; 16288 e.classList.remove(Ci, Ti), e.classList.add(`bs-${this.constructor.NAME}-auto`); 16289 const i = (t => { 16290 do { 16291 t += Math.floor(1e6 * Math.random()) 16292 } while (document.getElementById(t)); 16293 return t 16294 })(this.constructor.NAME).toString(); 16295 return e.setAttribute("id", i), this._isAnimated() && e.classList.add(Ci), e 16296 } 16297 setContent(t) { 16298 this._newContent = t, this._isShown() && (this._disposePopper(), this.show()) 16299 } 16300 _getTemplateFactory(t) { 16301 return this._templateFactory ? this._templateFactory.changeContent(t) : this._templateFactory = new Ai({ 16302 ...this._config, 16303 content: t, 16304 extraClass: this._resolvePossibleFunction(this._config.customClass) 16305 }), this._templateFactory 16306 } 16307 _getContentForTemplate() { 16308 return { 16309 ".tooltip-inner": this._getTitle() 16310 } 16311 } 16312 _getTitle() { 16313 return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute("data-bs-original-title") 16314 } 16315 _initializeOnDelegatedTarget(t) { 16316 return this.constructor.getOrCreateInstance(t.delegateTarget, this._getDelegateConfig()) 16317 } 16318 _isAnimated() { 16319 return this._config.animation || this.tip && this.tip.classList.contains(Ci) 16320 } 16321 _isShown() { 16322 return this.tip && this.tip.classList.contains(Ti) 16323 } 16324 _createPopper(t) { 16325 const e = v(this._config.placement, [this, t, this._element]), 16326 s = Oi[e.toUpperCase()]; 16327 return i.createPopper(this._element, t, this._getPopperConfig(s)) 16328 } 16329 _getOffset() { 16330 const { 16331 offset: t 16332 } = this._config; 16333 return "string" == typeof t ? t.split(",").map((t => Number.parseInt(t, 10))) : "function" == typeof t ? e => t(e, this._element) : t 16334 } 16335 _resolvePossibleFunction(t) { 16336 return v(t, [this._element]) 16337 } 16338 _getPopperConfig(t) { 16339 const e = { 16340 placement: t, 16341 modifiers: [{ 16342 name: "flip", 16343 options: { 16344 fallbackPlacements: this._config.fallbackPlacements 16345 } 16346 }, { 16347 name: "offset", 16348 options: { 16349 offset: this._getOffset() 16350 } 16351 }, { 16352 name: "preventOverflow", 16353 options: { 16354 boundary: this._config.boundary 16355 } 16356 }, { 16357 name: "arrow", 16358 options: { 16359 element: `.${this.constructor.NAME}-arrow` 16360 } 16361 }, { 16362 name: "preSetPlacement", 16363 enabled: !0, 16364 phase: "beforeMain", 16365 fn: t => { 16366 this._getTipElement().setAttribute("data-popper-placement", t.state.placement) 16367 } 16368 }] 16369 }; 16370 return { 16371 ...e, 16372 ...v(this._config.popperConfig, [e]) 16373 } 16374 } 16375 _setListeners() { 16376 const t = this._config.trigger.split(" "); 16377 for (const e of t) 16378 if ("click" === e) j.on(this._element, this.constructor.eventName("click"), this._config.selector, (t => { 16379 this._initializeOnDelegatedTarget(t).toggle() 16380 })); 16381 else if ("manual" !== e) { 16382 const t = e === Si ? this.constructor.eventName("mouseenter") : this.constructor.eventName("focusin"), 16383 i = e === Si ? this.constructor.eventName("mouseleave") : this.constructor.eventName("focusout"); 16384 j.on(this._element, t, this._config.selector, (t => { 16385 const e = this._initializeOnDelegatedTarget(t); 16386 e._activeTrigger["focusin" === t.type ? Li : Si] = !0, e._enter() 16387 })), j.on(this._element, i, this._config.selector, (t => { 16388 const e = this._initializeOnDelegatedTarget(t); 16389 e._activeTrigger["focusout" === t.type ? Li : Si] = e._element.contains(t.relatedTarget), e._leave() 16390 })) 16391 } 16392 this._hideModalHandler = () => { 16393 this._element && this.hide() 16394 }, j.on(this._element.closest(ki), $i, this._hideModalHandler) 16395 } 16396 _fixTitle() { 16397 const t = this._element.getAttribute("title"); 16398 t && (this._element.getAttribute("aria-label") || this._element.textContent.trim() || this._element.setAttribute("aria-label", t), this._element.setAttribute("data-bs-original-title", t), this._element.removeAttribute("title")) 16399 } 16400 _enter() { 16401 this._isShown() || this._isHovered ? this._isHovered = !0 : (this._isHovered = !0, this._setTimeout((() => { 16402 this._isHovered && this.show() 16403 }), this._config.delay.show)) 16404 } 16405 _leave() { 16406 this._isWithActiveTrigger() || (this._isHovered = !1, this._setTimeout((() => { 16407 this._isHovered || this.hide() 16408 }), this._config.delay.hide)) 16409 } 16410 _setTimeout(t, e) { 16411 clearTimeout(this._timeout), this._timeout = setTimeout(t, e) 16412 } 16413 _isWithActiveTrigger() { 16414 return Object.values(this._activeTrigger).includes(!0) 16415 } 16416 _getConfig(t) { 16417 const e = B.getDataAttributes(this._element); 16418 for (const t of Object.keys(e)) Ei.has(t) && delete e[t]; 16419 return t = { 16420 ...e, 16421 ..."object" == typeof t && t ? t : {} 16422 }, t = this._mergeConfigObj(t), t = this._configAfterMerge(t), this._typeCheckConfig(t), t 16423 } 16424 _configAfterMerge(t) { 16425 return t.container = !1 === t.container ? document.body : c(t.container), "number" == typeof t.delay && (t.delay = { 16426 show: t.delay, 16427 hide: t.delay 16428 }), "number" == typeof t.title && (t.title = t.title.toString()), "number" == typeof t.content && (t.content = t.content.toString()), t 16429 } 16430 _getDelegateConfig() { 16431 const t = {}; 16432 for (const [e, i] of Object.entries(this._config)) this.constructor.Default[e] !== i && (t[e] = i); 16433 return t.selector = !1, t.trigger = "manual", t 16434 } 16435 _disposePopper() { 16436 this._popper && (this._popper.destroy(), this._popper = null), this.tip && (this.tip.remove(), this.tip = null) 16437 } 16438 static jQueryInterface(t) { 16439 return this.each((function() { 16440 const e = Ni.getOrCreateInstance(this, t); 16441 if ("string" == typeof t) {
vendor: 5,342 bytes, lines 16442-16613
16442 if (void 0 === e[t]) throw new TypeError(`No method named "${t}"`); 16443 e[t]() 16444 } 16445 })) 16446 } 16447 } 16448 b(Ni); 16449 const Pi = { 16450 ...Ni.Default, 16451 content: "", 16452 offset: [0, 8], 16453 placement: "right", 16454 template: '<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>', 16455 trigger: "click" 16456 }, 16457 xi = { 16458 ...Ni.DefaultType, 16459 content: "(null|string|element|function)" 16460 }; 16461 class Mi extends Ni { 16462 static get Default() { 16463 return Pi 16464 } 16465 static get DefaultType() { 16466 return xi 16467 } 16468 static get NAME() { 16469 return "popover" 16470 } 16471 _isWithContent() { 16472 return this._getTitle() || this._getContent() 16473 } 16474 _getContentForTemplate() { 16475 return { 16476 ".popover-header": this._getTitle(), 16477 ".popover-body": this._getContent() 16478 } 16479 } 16480 _getContent() { 16481 return this._resolvePossibleFunction(this._config.content) 16482 } 16483 static jQueryInterface(t) { 16484 return this.each((function() { 16485 const e = Mi.getOrCreateInstance(this, t); 16486 if ("string" == typeof t) { 16487 if (void 0 === e[t]) throw new TypeError(`No method named "${t}"`); 16488 e[t]() 16489 } 16490 })) 16491 } 16492 } 16493 b(Mi); 16494 const ji = ".bs.scrollspy", 16495 Fi = `activate${ji}`, 16496 zi = `click${ji}`, 16497 Hi = `load${ji}.data-api`, 16498 Bi = "active", 16499 qi = "[href]", 16500 Wi = ".nav-link", 16501 Ri = `${Wi}, .nav-item > ${Wi}, .list-group-item`, 16502 Ki = { 16503 offset: null, 16504 rootMargin: "0px 0px -25%", 16505 smoothScroll: !1, 16506 target: null, 16507 threshold: [.1, .5, 1] 16508 }, 16509 Vi = { 16510 offset: "(number|null)", 16511 rootMargin: "string", 16512 smoothScroll: "boolean", 16513 target: "element", 16514 threshold: "array" 16515 }; 16516 class Qi extends W { 16517 constructor(t, e) { 16518 super(t, e), this._targetLinks = new Map, this._observableSections = new Map, this._rootElement = "visible" === getComputedStyle(this._element).overflowY ? null : this._element, this._activeTarget = null, this._observer = null, this._previousScrollData = { 16519 visibleEntryTop: 0, 16520 parentScrollTop: 0 16521 }, this.refresh() 16522 } 16523 static get Default() { 16524 return Ki 16525 } 16526 static get DefaultType() { 16527 return Vi 16528 } 16529 static get NAME() { 16530 return "scrollspy" 16531 } 16532 refresh() { 16533 this._initializeTargetsAndObservables(), this._maybeEnableSmoothScroll(), this._observer ? this._observer.disconnect() : this._observer = this._getNewObserver(); 16534 for (const t of this._observableSections.values()) this._observer.observe(t) 16535 } 16536 dispose() { 16537 this._observer.disconnect(), super.dispose() 16538 } 16539 _configAfterMerge(t) { 16540 return t.target = c(t.target) || document.body, t.rootMargin = t.offset ? `${t.offset}px 0px -30%` : t.rootMargin, "string" == typeof t.threshold && (t.threshold = t.threshold.split(",").map((t => Number.parseFloat(t)))), t 16541 } 16542 _maybeEnableSmoothScroll() { 16543 this._config.smoothScroll && (j.off(this._config.target, zi), j.on(this._config.target, zi, qi, (t => { 16544 const e = this._observableSections.get(t.target.hash); 16545 if (e) { 16546 t.preventDefault(); 16547 const i = this._rootElement || window, 16548 s = e.offsetTop - this._element.offsetTop; 16549 if (i.scrollTo) return void i.scrollTo({ 16550 top: s, 16551 behavior: "smooth" 16552 }); 16553 i.scrollTop = s 16554 } 16555 }))) 16556 } 16557 _getNewObserver() { 16558 const t = { 16559 root: this._rootElement, 16560 threshold: this._config.threshold, 16561 rootMargin: this._config.rootMargin 16562 }; 16563 return new IntersectionObserver((t => this._observerCallback(t)), t) 16564 } 16565 _observerCallback(t) { 16566 const e = t => this._targetLinks.get(`#${t.target.id}`), 16567 i = t => { 16568 this._previousScrollData.visibleEntryTop = t.target.offsetTop, this._process(e(t)) 16569 }, 16570 s = (this._rootElement || document.documentElement).scrollTop, 16571 n = s >= this._previousScrollData.parentScrollTop; 16572 this._previousScrollData.parentScrollTop = s; 16573 for (const o of t) { 16574 if (!o.isIntersecting) { 16575 this._activeTarget = null, this._clearActiveClass(e(o)); 16576 continue 16577 } 16578 const t = o.target.offsetTop >= this._previousScrollData.visibleEntryTop; 16579 if (n && t) { 16580 if (i(o), !s) return 16581 } else n || t || i(o) 16582 } 16583 } 16584 _initializeTargetsAndObservables() { 16585 this._targetLinks = new Map, this._observableSections = new Map; 16586 const t = K.find(qi, this._config.target); 16587 for (const e of t) { 16588 if (!e.hash || d(e)) continue; 16589 const t = K.findOne(decodeURI(e.hash), this._element); 16590 h(t) && (this._targetLinks.set(decodeURI(e.hash), e), this._observableSections.set(e.hash, t)) 16591 } 16592 } 16593 _process(t) { 16594 this._activeTarget !== t && (this._clearActiveClass(this._config.target), this._activeTarget = t, t.classList.add(Bi), this._activateParents(t), j.trigger(this._element, Fi, { 16595 relatedTarget: t 16596 })) 16597 } 16598 _activateParents(t) { 16599 if (t.classList.contains("dropdown-item")) K.findOne(".dropdown-toggle", t.closest(".dropdown")).classList.add(Bi); 16600 else 16601 for (const e of K.parents(t, ".nav, .list-group")) 16602 for (const t of K.prev(e, Ri)) t.classList.add(Bi) 16603 } 16604 _clearActiveClass(t) { 16605 t.classList.remove(Bi); 16606 const e = K.find(`${qi}.${Bi}`, t); 16607 for (const t of e) t.classList.remove(Bi) 16608 } 16609 static jQueryInterface(t) { 16610 return this.each((function() { 16611 const e = Qi.getOrCreateInstance(this, t); 16612 if ("string" == typeof t) { 16613 if (void 0 === e[t] || t.startsWith("_") || "constructor" === t) throw new TypeError(`No method n
16613amed "${t}"`); 16614 e[t]() 16615 } 16616 })) 16617 } 16618 } 16619 j.on(window, Hi, (() => { 16620 for (const t of K.find('[data-bs-spy="scroll"]')) Qi.getOrCreateInstance(t) 16621 })), b(Qi); 16622 const Xi = ".bs.tab", 16623 Yi = `hide${Xi}`, 16624 Ui = `hidden${Xi}`, 16625 Gi = `show${Xi}`, 16626 Ji = `shown${Xi}`, 16627 Zi = `click${Xi}`, 16628 ts = `keydown${Xi}`, 16629 es = `load${Xi}`, 16630 is = "ArrowLeft", 16631 ss = "ArrowRight", 16632 ns = "ArrowUp", 16633 os = "ArrowDown", 16634 rs = "Home", 16635 as = "End", 16636 ls = "active", 16637 cs = "fade", 16638 hs = "show", 16639 ds = ":not(.dropdown-toggle)", 16640 us = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]', 16641 _s = `.nav-link${ds}, .list-group-item${ds}, [role="tab"]${ds}, ${us}`, 16642 gs = `.${ls}[data-bs-toggle="tab"], .${ls}[data-bs-toggle="pill"], .${ls}[data-bs-toggle="list"]`; 16643 class fs extends W { 16644 constructor(t) { 16645 super(t), this._parent = this._element.closest('.list-group, .nav, [role="tablist"]'), this._parent && (this._setInitialAttributes(this._parent, this._getChildren()), j.on(this._element, ts, (t => this._keydown(t)))) 16646 } 16647 static get NAME() { 16648 return "tab" 16649 } 16650 show() { 16651 const t = this._element; 16652 if (this._elemIsActive(t)) return; 16653 const e = this._getActiveElem(), 16654 i = e ? j.trigger(e, Yi, { 16655 relatedTarget: t 16656 }) : null; 16657 j.trigger(t, Gi, { 16658 relatedTarget: e 16659 }).defaultPrevented || i && i.defaultPrevented || (this._deactivate(e, t), this._activate(t, e)) 16660 } 16661 _activate(t, e) { 16662 t && (t.classList.add(ls), this._activate(K.getElementFromSelector(t)), this._queueCallback((() => { 16663 "tab" === t.getAttribute("role") ? (t.removeAttribute("tabindex"), t.setAttribute("aria-selected", !0), this._toggleDropDown(t, !0), j.trigger(t, Ji, { 16664 relatedTarget: e 16665 })) : t.classList.add(hs) 16666 }), t, t.classList.contains(cs))) 16667 } 16668 _deactivate(t, e) { 16669 t && (t.classList.remove(ls), t.blur(), this._deactivate(K.getElementFromSelector(t)), this._queueCallback((() => { 16670 "tab" === t.getAttribute("role") ? (t.setAttribute("aria-selected", !1), t.setAttribute("tabindex", "-1"), this._toggleDropDown(t, !1), j.trigger(t, Ui, { 16671 relatedTarget: e 16672 })) : t.classList.remove(hs) 16673 }), t, t.classList.contains(cs))) 16674 } 16675 _keydown(t) { 16676 if (![is, ss, ns, os, rs, as].includes(t.key)) return; 16677 t.stopPropagation(), t.preventDefault(); 16678 const e = this._getChildren().filter((t => !d(t))); 16679 let i; 16680 if ([rs, as].includes(t.key)) i = e[t.key === rs ? 0 : e.length - 1]; 16681 else { 16682 const s = [ss, os].includes(t.key); 16683 i = w(e, t.target, s, !0) 16684 } 16685 i && (i.focus({ 16686 preventScroll: !0 16687 }), fs.getOrCreateInstance(i).show()) 16688 } 16689 _getChildren() { 16690 return K.find(_s, this._parent) 16691 } 16692 _getActiveElem() { 16693 return this._getChildren().find((t => this._elemIsActive(t))) || null 16694 } 16695 _setInitialAttributes(t, e) { 16696 this._setAttributeIfNotExists(t, "role", "tablist"); 16697 for (const t of e) this._setInitialAttributesOnChild(t) 16698 } 16699 _setInitialAttributesOnChild(t) { 16700 t = this._getInnerElement(t); 16701 const e = this._elemIsActive(t), 16702 i = this._getOuterElement(t); 16703 t.setAttribute("aria-selected", e), i !== t && this._setAttributeIfNotExists(i, "role", "presentation"), e || t.setAttribute("tabindex", "-1"), this._setAttributeIfNotExists(t, "role", "tab"), this._setInitialAttributesOnTargetPanel(t) 16704 } 16705 _setInitialAttributesOnTargetPanel(t) { 16706 const e = K.getElementFromSelector(t); 16707 e && (this._setAttributeIfNotExists(e, "role", "tabpanel"), t.id && this._setAttributeIfNotExists(e, "aria-labelledby", `${t.id}`)) 16708 } 16709 _toggleDropDown(t, e) { 16710 const i = this._getOuterElement(t); 16711 if (!i.classList.contains("dropdown")) return; 16712 const s = (t, s) => { 16713 const n = K.findOne(t, i); 16714 n && n.classList.toggle(s, e) 16715 }; 16716 s(".dropdown-toggle", ls), s(".dropdown-menu", hs), i.setAttribute("aria-expanded", e) 16717 } 16718 _setAttributeIfNotExists(t, e, i) { 16719 t.hasAttribute(e) || t.setAttribute(e, i) 16720 } 16721 _elemIsActive(t) { 16722 return t.classList.contains(ls) 16723 } 16724 _getInnerElement(t) { 16725 return t.matches(_s) ? t : K.findOne(_s, t) 16726 } 16727 _getOuterElement(t) {
16728 return t.closest(".nav-item, .list-group-item") || t 16729 } 16730 static jQueryInterface(t) { 16731 return this.each((function() { 16732 const e = fs.getOrCreateInstance(this); 16733 if ("string" == typeof t) { 16734 if (void 0 === e[t] || t.startsWith("_") || "constructor" === t) throw new TypeError(`No method named "${t}"`); 16735 e[t]() 16736 } 16737 })) 16738 } 16739 } 16740 j.on(document, Zi, us, (function(t) { 16741 ["A", "AREA"].includes(this.tagName) && t.preventDefault(), d(this) || fs.getOrCreateInstance(this).show() 16742 })), j.on(window, es, (() => { 16743 for (const t of K.find(gs)) fs.getOrCreateInstance(t) 16744 })), b(fs); 16745 const ms = ".bs.toast", 16746 ps = `mouseover${ms}`, 16747 bs = `mouseout${ms}`, 16748 vs = `focusin${ms}`, 16749 ys = `focusout${ms}`, 16750 ws = `hide${ms}`, 16751 As = `hidden${ms}`, 16752 Es = `show${ms}`, 16753 Cs = `shown${ms}`, 16754 Ts = "hide", 16755 ks = "show", 16756 $s = "showing", 16757 Ss = { 16758 animation: "boolean", 16759 autohide: "boolean", 16760 delay: "number" 16761 }, 16762 Ls = { 16763 animation: !0, 16764 autohide: !0, 16765 delay: 5e3 16766 }; 16767 class Os extends W { 16768 constructor(t, e) { 16769 super(t, e), this._timeout = null, this._hasMouseInteraction = !1, this._hasKeyboardInteraction = !1, this._setListeners() 16770 } 16771 static get Default() { 16772 return Ls 16773 } 16774 static get DefaultType() { 16775 return Ss 16776 } 16777 static get NAME() { 16778 return "toast" 16779 } 16780 show() { 16781 j.trigger(this._element, Es).defaultPrevented || (this._clearTimeout(), this._config.animation && this._element.classList.add("fade"), this._element.classList.remove(Ts), g(this._element), this._element.classList.add(ks, $s), this._queueCallback((() => { 16782 this._element.classList.remove($s), j.trigger(this._element, Cs), this._maybeScheduleHide() 16783 }), this._element, this._config.animation)) 16784 } 16785 hide() { 16786 this.isShown() && (j.trigger(this._element, ws).defaultPrevented || (this._element.classList.add($s), this._queueCallback((() => { 16787 this._element.classList.add(Ts), this._element.classList.remove($s, ks), j.trigger(this._element, As) 16788 }), this._element, this._config.animation))) 16789 } 16790 dispose() { 16791 this._clearTimeout(), this.isShown() && this._element.classList.remove(ks), super.dispose() 16792 } 16793 isShown() { 16794 return this._element.classList.contains(ks) 16795 } 16796 _maybeScheduleHide() { 16797 this._config.autohide && (this._hasMouseInteraction || this._hasKeyboardInteraction || (this._timeout = setTimeout((() => { 16798 this.hide() 16799 }), this._config.delay))) 16800 } 16801 _onInteraction(t, e) { 16802 switch (t.type) { 16803 case "mouseover": 16804 case "mouseout": 16805 this._hasMouseInteraction = e; 16806 break; 16807 case "focusin": 16808 case "focusout": 16809 this._hasKeyboardInteraction = e 16810 } 16811 if (e) return void this._clearTimeout(); 16812 const i = t.relatedTarget; 16813 this._element === i || this._element.contains(i) || this._maybeScheduleHide() 16814 } 16815 _setListeners() { 16816 j.on(this._element, ps, (t => this._onInteraction(t, !0))), j.on(this._element, bs, (t => this._onInteraction(t, !1))), j.on(this._element, vs, (t => this._onInteraction(t, !0))), j.on(this._element, ys, (t => this._onInteraction(t, !1))) 16817 } 16818 _clearTimeout() { 16819 clearTimeout(this._timeout), this._timeout = null 16820 } 16821 static jQueryInterface(t) { 16822 return this.each((function() { 16823 const e = Os.getOrCreateInstance(this, t); 16824 if ("string" == typeof t) { 16825 if (void 0 === e[t]) throw new TypeError(`No method named "${t}"`); 16826 e[t](this) 16827 } 16828 })) 16829 } 16830 } 16831 return V(Os), b(Os), { 16832 Alert: U, 16833 Button: J, 16834 Carousel: Ot, 16835 Collapse: Rt, 16836 Dropdown: fe, 16837 Modal: Ue, 16838 Offcanvas: gi, 16839 Popover: Mi, 16840 ScrollSpy: Qi, 16841 Tab: fs, 16842 Toast: Os, 16843 Tooltip: Ni 16844 } 16845})); 16846//# sourceMappingURL=bootstrap.min.js.map 16847/* 16848 _ _ _ _ 16849 ___| (_) ___| | __ (_)___ 16850/ __| | |/ __| |/ / | / __| 16851\__ \ | | (__| < _ | \__ \ 16852|___/_|_|\___|_|\_(_)/ |___/ 16853 |__/ 16854 16855 Version: 1.8.0 16856 Author: Ken Wheeler 16857 Website: http://kenwheeler.github.io 16858 Docs: http://kenwheeler.github.io/slick 16859 Repo: http://github.com/kenwheeler/slick 16860 Issues: http://github.com/kenwheeler/slick/issues 16861 16862 */ 16863/* global window, document, define, jQuery, setInterval, clearInterval */ 16864;(function(factory) { 16865 'use strict'; 16866 if (typeof define === 'function' && define.amd) { 16867 define(['jquery'], factory); 16868 } else if (typeof exports !== 'undefined') { 16869 module.exports = factory(require('jquery')); 16870 } else { 16871 factory(jQuery); 16872 } 16873 16874}(function($) { 16875 'use strict'; 16876 var Slick = window.Slick || {}; 16877 16878 Slick = (function() { 16879 16880 var instanceUid = 0; 16881 16882 function Slick(element, settings) { 16883 16884 var _ = this, dataSettings; 16885 16886 _.defaults = { 16887 accessibility: true, 16888 adaptiveHeight: false, 16889 appendArrows: $(element), 16890 appendDots: $(element), 16891 arrows: true, 16892 asNavFor: null, 16893 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 16894 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 16895 autoplay: false, 16896 autoplaySpeed: 3000, 16897 centerMode: false, 16898 centerPadding: '50px', 16899 cssEase: 'ease', 16900 customPaging: function(slider, i) { 16901 return $('<button type="button" />').text(i + 1); 16902 }, 16903 dots: false, 16904 dotsClass: 'slick-dots', 16905 draggable: true, 16906 easing: 'linear', 16907 edgeFriction: 0.35, 16908 fade: false, 16909 focusOnSelect: false, 16910 focusOnChange: false, 16911 infinite: true, 16912 initialSlide: 0, 16913 lazyLoad: 'ondemand', 16914 mobileFirst: false, 16915 pauseOnHover: true, 16916 pauseOnFocus: true, 16917 pauseOnDotsHover: false, 16918 respondTo: 'window', 16919 responsive: null, 16920 rows: 1, 16921 rtl: false, 16922 slide: '', 16923 slidesPerRow: 1, 16924 slidesToShow: 1, 16925 slidesToScroll: 1, 16926 speed: 500, 16927 swipe: true, 16928 swipeToSlide: false, 16929 touchMove: true, 16930 touchThreshold: 5, 16931 useCSS: true, 16932 useTransform: true, 16933 variableWidth: false, 16934 vertical: false, 16935 verticalSwiping: false, 16936 waitForAnimate: true, 16937 zIndex: 1000 16938 }; 16939 16940 _.initials = { 16941 animating: false, 16942 dragging: false, 16943 autoPlayTimer: null, 16944 currentDirection: 0, 16945 currentLeft: null, 16946 currentSlide: 0, 16947 direction: 1, 16948 $dots: null, 16949 listWidth: null, 16950 listHeight: null, 16951 loadIndex: 0, 16952 $nextArrow: null, 16953 $prevArrow: null, 16954 scrolling: false, 16955 slideCount: null, 16956 slideWidth: null, 16957 $slideTrack: null, 16958 $slides: null, 16959 sliding: false, 16960 slideOffset: 0, 16961 swipeLeft: null, 16962 swiping: false, 16963 $list: null, 16964 touchObject: {}, 16965 transformsEnabled: false,
16966 unslicked: false 16967 }; 16968 16969 $.extend(_, _.initials); 16970 16971 _.activeBreakpoint = null; 16972 _.animType = null; 16973 _.animProp = null; 16974 _.breakpoints = []; 16975 _.breakpointSettings = []; 16976 _.cssTransitions = false; 16977 _.focussed = false; 16978 _.interrupted = false; 16979 _.hidden = 'hidden'; 16980 _.paused = true; 16981 _.positionProp = null; 16982 _.respondTo = null; 16983 _.rowCount = 1; 16984 _.shouldClick = true; 16985 _.$slider = $(element); 16986 _.$slidesCache = null; 16987 _.transformType = null; 16988 _.transitionType = null; 16989 _.visibilityChange = 'visibilitychange'; 16990 _.windowWidth = 0; 16991 _.windowTimer = null; 16992 16993 dataSettings = $(element).data('slick') || {}; 16994 16995 _.options = $.extend({}, _.defaults, settings, dataSettings); 16996 16997 _.currentSlide = _.options.initialSlide; 16998 16999 _.originalSettings = _.options; 17000 17001 if (typeof document.mozHidden !== 'undefined') { 17002 _.hidden = 'mozHidden'; 17003 _.visibilityChange = 'mozvisibilitychange'; 17004 } else if (typeof document.webkitHidden !== 'undefined') { 17005 _.hidden = 'webkitHidden'; 17006 _.visibilityChange = 'webkitvisibilitychange'; 17007 } 17008 17009 _.autoPlay = $.proxy(_.autoPlay, _); 17010 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 17011 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 17012 _.changeSlide = $.proxy(_.changeSlide, _); 17013 _.clickHandler = $.proxy(_.clickHandler, _); 17014 _.selectHandler = $.proxy(_.selectHandler, _); 17015 _.setPosition = $.proxy(_.setPosition, _); 17016 _.swipeHandler = $.proxy(_.swipeHandler, _); 17017 _.dragHandler = $.proxy(_.dragHandler, _); 17018 _.keyHandler = $.proxy(_.keyHandler, _); 17019 17020 _.instanceUid = instanceUid++; 17021 17022 // A simple way to check for HTML strings 17023 // Strict HTML recognition (must start with <) 17024 // Extracted from jQuery v1.11 source 17025 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 17026 17027 17028 _.registerBreakpoints(); 17029 _.init(true); 17030 17031 } 17032 17033 return Slick; 17034 17035 }()); 17036 17037 Slick.prototype.activateADA = function() { 17038 var _ = this; 17039 17040 _.$slideTrack.find('.slick-active').attr({ 17041 'aria-hidden': 'false' 17042 }).find('a, input, button, select').attr({ 17043 'tabindex': '0' 17044 }); 17045 17046 }; 17047 17048 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 17049 17050 var _ = this; 17051 17052 if (typeof(index) === 'boolean') { 17053 addBefore = index; 17054 index = null; 17055 } else if (index < 0 || (index >= _.slideCount)) { 17056 return false; 17057 } 17058 17059 _.unload(); 17060 17061 if (typeof(index) === 'number') { 17062 if (index === 0 && _.$slides.length === 0) { 17063 $(markup).appendTo(_.$slideTrack); 17064 } else if (addBefore) { 17065 $(markup).insertBefore(_.$slides.eq(index)); 17066 } else { 17067 $(markup).insertAfter(_.$slides.eq(index)); 17068 } 17069 } else { 17070 if (addBefore === true) { 17071 $(markup).prependTo(_.$slideTrack); 17072 } else { 17073 $(markup).appendTo(_.$slideTrack); 17074 } 17075 } 17076 17077 _.$slides = _.$slideTrack.children(this.options.slide); 17078 17079 _.$slideTrack.children(this.options.slide).detach(); 17080 17081 _.$slideTrack.append(_.$slides); 17082 17083 _.$slides.each(function(index, element) { 17084 $(element).attr('data-slick-index', index); 17085 }); 17086 17087 _.$slidesCache = _.$slides; 17088 17089 _.reinit(); 17090 17091 }; 17092 17093 Slick.prototype.animateHeight = function() { 17094 var _ = this; 17095 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 17096 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 17097 _.$list.animate({ 17098 height: targetHeight 17099 }, _.options.speed); 17100 } 17101 }; 17102 17103 Slick.prototype.animateSlide = function(targetLeft, callback) { 17104 17105 var animProps = {}, 17106 _ = this; 17107 17108 _.animateHeight(); 17109 17110 if (_.options.rtl === true && _.options.vertical === false) { 17111 targetLeft = -targetLeft; 17112 } 17113 if (_.transformsEnabled === false) { 17114 if (_.options.vertical === false) { 17115 _.$slideTrack.animate({ 17116 left: targetLeft 17117 }, _.options.speed, _.options.easing, callback); 17118 } else { 17119 _.$slideTrack.animate({ 17120 top: targetLeft 17121 }, _.options.speed, _.options.easing, callback); 17122 } 17123 17124 } else { 17125 17126 if (_.cssTransitions === false) { 17127 if (_.options.rtl === true) { 17128 _.currentLeft = -(_.currentLeft); 17129 } 17130 $({ 17131 animStart: _.currentLeft 17132 }).animate({ 17133 animStart: targetLeft 17134 }, { 17135 duration: _.options.speed, 17136 easing: _.options.easing, 17137 step: function(now) { 17138 now = Math.ceil(now); 17139 if (_.options.vertical === false) { 17140 animProps[_.animType] = 'translate(' + 17141 now + 'px, 0px)'; 17142 _.$slideTrack.css(animProps); 17143 } else { 17144 animProps[_.animType] = 'translate(0px,' + 17145 now + 'px)'; 17146 _.$slideTrack.css(animProps); 17147 } 17148 }, 17149 complete: function() { 17150 if (callback) { 17151 callback.call(); 17152 } 17153 } 17154 }); 17155 17156 } else { 17157 17158 _.applyTransition();
17159 targetLeft = Math.ceil(targetLeft); 17160 17161 if (_.options.vertical === false) { 17162 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 17163 } else { 17164 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 17165 } 17166 _.$slideTrack.css(animProps); 17167 17168 if (callback) { 17169 setTimeout(function() { 17170 17171 _.disableTransition(); 17172 17173 callback.call(); 17174 }, _.options.speed); 17175 } 17176 17177 } 17178 17179 } 17180 17181 }; 17182 17183 Slick.prototype.getNavTarget = function() { 17184 17185 var _ = this, 17186 asNavFor = _.options.asNavFor; 17187 17188 if ( asNavFor && asNavFor !== null ) { 17189 asNavFor = $(asNavFor).not(_.$slider); 17190 } 17191 17192 return asNavFor; 17193 17194 }; 17195 17196 Slick.prototype.asNavFor = function(index) { 17197 17198 var _ = this, 17199 asNavFor = _.getNavTarget(); 17200 17201 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 17202 asNavFor.each(function() { 17203 var target = $(this).slick('getSlick'); 17204 if(!target.unslicked) { 17205 target.slideHandler(index, true); 17206 } 17207 }); 17208 } 17209 17210 }; 17211 17212 Slick.prototype.applyTransition = function(slide) { 17213 17214 var _ = this, 17215 transition = {}; 17216 17217 if (_.options.fade === false) { 17218 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 17219 } else { 17220 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 17221 } 17222 17223 if (_.options.fade === false) { 17224 _.$slideTrack.css(transition); 17225 } else { 17226 _.$slides.eq(slide).css(transition); 17227 } 17228 17229 }; 17230 17231 Slick.prototype.autoPlay = function() { 17232 17233 var _ = this; 17234 17235 _.autoPlayClear(); 17236 17237 if ( _.slideCount > _.options.slidesToShow ) { 17238 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 17239 } 17240 17241 }; 17242 17243 Slick.prototype.autoPlayClear = function() { 17244 17245 var _ = this; 17246 17247 if (_.autoPlayTimer) { 17248 clearInterval(_.autoPlayTimer); 17249 } 17250 17251 }; 17252 17253 Slick.prototype.autoPlayIterator = function() { 17254 17255 var _ = this, 17256 slideTo = _.currentSlide + _.options.slidesToScroll; 17257 17258 if ( !_.paused && !_.interrupted && !_.focussed ) { 17259 17260 if ( _.options.infinite === false ) { 17261 17262 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 17263 _.direction = 0; 17264 } 17265 17266 else if ( _.direction === 0 ) { 17267 17268 slideTo = _.currentSlide - _.options.slidesToScroll; 17269 17270 if ( _.currentSlide - 1 === 0 ) { 17271 _.direction = 1; 17272 } 17273 17274 } 17275 17276 } 17277 17278 _.slideHandler( slideTo ); 17279 17280 } 17281 17282 }; 17283 17284 Slick.prototype.buildArrows = function() { 17285 17286 var _ = this; 17287 17288 if (_.options.arrows === true ) { 17289 17290 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 17291 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 17292 17293 if( _.slideCount > _.options.slidesToShow ) { 17294 17295 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 17296 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 17297 17298 if (_.htmlExpr.test(_.options.prevArrow)) { 17299 _.$prevArrow.prependTo(_.options.appendArrows); 17300 } 17301 17302 if (_.htmlExpr.test(_.options.nextArrow)) { 17303 _.$nextArrow.appendTo(_.options.appendArrows); 17304 } 17305 17306 if (_.options.infinite !== true) { 17307 _.$prevArrow 17308 .addClass('slick-disabled') 17309 .attr('aria-disabled', 'true'); 17310 } 17311 17312 } else { 17313 17314 _.$prevArrow.add( _.$nextArrow ) 17315 17316 .addClass('slick-hidden') 17317 .attr({ 17318 'aria-disabled': 'true', 17319 'tabindex': '-1' 17320 }); 17321 17322 } 17323 17324 } 17325 17326 }; 17327 17328 Slick.prototype.buildDots = function() { 17329 17330 var _ = this, 17331 i, dot; 17332 17333 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 17334 17335 _.$slider.addClass('slick-dotted'); 17336 17337 dot = $('<ul />').addClass(_.options.dotsClass); 17338 17339 for (i = 0; i <= _.getDotCount(); i += 1) { 17340 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 17341 } 17342 17343 _.$dots = dot.appendTo(_.options.appendDots); 17344 17345 _.$dots.find('li').first().addClass('slick-active'); 17346 17347 } 17348 17349 }; 17350 17351 Slick.prototype.buildOut = function() { 17352 17353 var _ = this; 17354 17355 _.$slides = 17356 _.$slider 17357 .children( _.options.slide + ':not(.slick-cloned)') 17358 .addClass('slick-slide'); 17359 17360 _.slideCount = _.$slides.length; 17361 17362 _.$slides.each(function(index, element) { 17363 $(element) 17364 .attr('data-slick-index', index) 17365 .data('originalStyling', $(element).attr('style') || ''); 17366 }); 17367 17368 _.$slider.addClass('slick-slider'); 17369 17370 _.$slideTrack = (_.slideCount === 0) ? 17371 $('<div class="slick-track"/>').appendTo(_.$slider) : 17372 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 17373 17374 _.$list = _.$slideTrack.wrap( 17375 '<div class="slick-list"/>').parent(); 17376 _.$slideTrack.css('opacity', 0); 17377 17378 if (_.options.centerMode === true || _.options.swipeToSlide === true) {
17379 _.options.slidesToScroll = 1; 17380 } 17381 17382 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 17383 17384 _.setupInfinite(); 17385 17386 _.buildArrows(); 17387 17388 _.buildDots(); 17389 17390 _.updateDots(); 17391 17392 17393 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 17394 17395 if (_.options.draggable === true) { 17396 _.$list.addClass('draggable'); 17397 } 17398 17399 }; 17400 17401 Slick.prototype.buildRows = function() { 17402 17403 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 17404 17405 newSlides = document.createDocumentFragment(); 17406 originalSlides = _.$slider.children(); 17407 17408 if(_.options.rows > 0) { 17409 17410 slidesPerSection = _.options.slidesPerRow * _.options.rows; 17411 numOfSlides = Math.ceil( 17412 originalSlides.length / slidesPerSection 17413 ); 17414 17415 for(a = 0; a < numOfSlides; a++){ 17416 var slide = document.createElement('div'); 17417 for(b = 0; b < _.options.rows; b++) { 17418 var row = document.createElement('div'); 17419 for(c = 0; c < _.options.slidesPerRow; c++) { 17420 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 17421 if (originalSlides.get(target)) { 17422 row.appendChild(originalSlides.get(target)); 17423 } 17424 } 17425 slide.appendChild(row); 17426 } 17427 newSlides.appendChild(slide); 17428 } 17429 17430 _.$slider.empty().append(newSlides); 17431 _.$slider.children().children().children() 17432 .css({ 17433 'width':(100 / _.options.slidesPerRow) + '%', 17434 'display': 'inline-block' 17435 }); 17436 17437 } 17438 17439 }; 17440 17441 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 17442 17443 var _ = this, 17444 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 17445 var sliderWidth = _.$slider.width(); 17446 var windowWidth = window.innerWidth || $(window).width(); 17447 17448 if (_.respondTo === 'window') { 17449 respondToWidth = windowWidth; 17450 } else if (_.respondTo === 'slider') { 17451 respondToWidth = sliderWidth; 17452 } else if (_.respondTo === 'min') { 17453 respondToWidth = Math.min(windowWidth, sliderWidth); 17454 } 17455 17456 if ( _.options.responsive && 17457 _.options.responsive.length && 17458 _.options.responsive !== null) { 17459 17460 targetBreakpoint = null; 17461 17462 for (breakpoint in _.breakpoints) { 17463 if (_.breakpoints.hasOwnProperty(breakpoint)) { 17464 if (_.originalSettings.mobileFirst === false) { 17465 if (respondToWidth < _.breakpoints[breakpoint]) { 17466 targetBreakpoint = _.breakpoints[breakpoint]; 17467 } 17468 } else { 17469 if (respondToWidth > _.breakpoints[breakpoint]) { 17470 targetBreakpoint = _.breakpoints[breakpoint]; 17471 } 17472 } 17473 } 17474 } 17475 17476 if (targetBreakpoint !== null) { 17477 if (_.activeBreakpoint !== null) { 17478 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 17479 _.activeBreakpoint = 17480 targetBreakpoint; 17481 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 17482 _.unslick(targetBreakpoint); 17483 } else { 17484 _.options = $.extend({}, _.originalSettings, 17485 _.breakpointSettings[ 17486 targetBreakpoint]); 17487 if (initial === true) { 17488 _.currentSlide = _.options.initialSlide; 17489 } 17490 _.refresh(initial); 17491 }
17492 triggerBreakpoint = targetBreakpoint; 17493 } 17494 } else { 17495 _.activeBreakpoint = targetBreakpoint; 17496 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 17497 _.unslick(targetBreakpoint); 17498 } else { 17499 _.options = $.extend({}, _.originalSettings, 17500 _.breakpointSettings[ 17501 targetBreakpoint]); 17502 if (initial === true) { 17503 _.currentSlide = _.options.initialSlide; 17504 } 17505 _.refresh(initial); 17506 } 17507 triggerBreakpoint = targetBreakpoint; 17508 } 17509 } else { 17510 if (_.activeBreakpoint !== null) { 17511 _.activeBreakpoint = null; 17512 _.options = _.originalSettings; 17513 if (initial === true) { 17514 _.currentSlide = _.options.initialSlide; 17515 } 17516 _.refresh(initial); 17517 triggerBreakpoint = targetBreakpoint; 17518 } 17519 } 17520 17521 // only trigger breakpoints during an actual break. not on initialize. 17522 if( !initial && triggerBreakpoint !== false ) { 17523 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 17524 } 17525 } 17526 17527 }; 17528 17529 Slick.prototype.changeSlide = function(event, dontAnimate) { 17530 17531 var _ = this, 17532 $target = $(event.currentTarget), 17533 indexOffset, slideOffset, unevenOffset; 17534 17535 // If target is a link, prevent default action. 17536 if($target.is('a')) { 17537 event.preventDefault(); 17538 } 17539 17540 // If target is not the <li> element (ie: a child), find the <li>. 17541 if(!$target.is('li')) { 17542 $target = $target.closest('li'); 17543 } 17544 17545 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 17546 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 17547 17548 switch (event.data.message) { 17549 17550 case 'previous': 17551 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 17552 if (_.slideCount > _.options.slidesToShow) { 17553 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 17554 } 17555 break; 17556 17557 case 'next': 17558 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 17559 if (_.slideCount > _.options.slidesToShow) { 17560 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 17561 } 17562 break; 17563 17564 case 'index': 17565 var index = event.data.index === 0 ? 0 : 17566 event.data.index || $target.index() * _.options.slidesToScroll; 17567 17568 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 17569 $target.children().trigger('focus'); 17570 break; 17571 17572 default: 17573 return; 17574 } 17575 17576 }; 17577 17578 Slick.prototype.checkNavigable = function(index) { 17579 17580 var _ = this, 17581 navigables, prevNavigable; 17582 17583 navigables = _.getNavigableIndexes(); 17584 prevNavigable = 0; 17585 if (index > navigables[navigables.length - 1]) { 17586 index = navigables[navigables.length - 1]; 17587 } else { 17588 for (var n in navigables) { 17589 if (index < navigables[n]) { 17590 index = prevNavigable; 17591 break; 17592 } 17593 prevNavigable = navigables[n]; 17594 } 17595 } 17596 17597 return index; 17598 }; 17599 17600 Slick.prototype.cleanUpEvents = function() { 17601 17602 var _ = this; 17603 17604 if (_.options.dots && _.$dots !== null) { 17605 17606 $('li', _.$dots) 17607 .off('click.slick', _.changeSlide) 17608 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 17609 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 17610 17611 if (_.options.accessibility === true) { 17612 _.$dots.off('keydown.slick', _.keyHandler); 17613 } 17614 } 17615 17616 _.$slider.off('focus.slick blur.slick'); 17617 17618 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 17619 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 17620 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 17621 17622 if (_.options.accessibility === true) { 17623 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 17624 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 17625 } 17626 } 17627 17628 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 17629 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 17630 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
17631 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 17632 17633 _.$list.off('click.slick', _.clickHandler); 17634 17635 $(document).off(_.visibilityChange, _.visibility); 17636 17637 _.cleanUpSlideEvents(); 17638 17639 if (_.options.accessibility === true) { 17640 _.$list.off('keydown.slick', _.keyHandler); 17641 } 17642 17643 if (_.options.focusOnSelect === true) { 17644 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 17645 } 17646 17647 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 17648 17649 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 17650 17651 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 17652 17653 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 17654 17655 }; 17656 17657 Slick.prototype.cleanUpSlideEvents = function() { 17658 17659 var _ = this; 17660 17661 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 17662 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 17663 17664 }; 17665 17666 Slick.prototype.cleanUpRows = function() { 17667 17668 var _ = this, originalSlides; 17669 17670 if(_.options.rows > 0) { 17671 originalSlides = _.$slides.children().children(); 17672 originalSlides.removeAttr('style'); 17673 _.$slider.empty().append(originalSlides); 17674 } 17675 17676 }; 17677 17678 Slick.prototype.clickHandler = function(event) { 17679 17680 var _ = this; 17681 17682 if (_.shouldClick === false) { 17683 event.stopImmediatePropagation(); 17684 event.stopPropagation(); 17685 event.preventDefault(); 17686 } 17687 17688 }; 17689 17690 Slick.prototype.destroy = function(refresh) { 17691 17692 var _ = this; 17693 17694 _.autoPlayClear(); 17695 17696 _.touchObject = {}; 17697 17698 _.cleanUpEvents(); 17699 17700 $('.slick-cloned', _.$slider).detach(); 17701 17702 if (_.$dots) { 17703 _.$dots.remove(); 17704 } 17705 17706 if ( _.$prevArrow && _.$prevArrow.length ) { 17707 17708 _.$prevArrow 17709 .removeClass('slick-disabled slick-arrow slick-hidden') 17710 .removeAttr('aria-hidden aria-disabled tabindex') 17711 .css('display',''); 17712 17713 if ( _.htmlExpr.test( _.options.prevArrow )) { 17714 _.$prevArrow.remove(); 17715 } 17716 } 17717 17718 if ( _.$nextArrow && _.$nextArrow.length ) { 17719 17720 _.$nextArrow 17721 .removeClass('slick-disabled slick-arrow slick-hidden') 17722 .removeAttr('aria-hidden aria-disabled tabindex') 17723 .css('display',''); 17724 17725 if ( _.htmlExpr.test( _.options.nextArrow )) { 17726 _.$nextArrow.remove(); 17727 } 17728 } 17729 17730 17731 if (_.$slides) { 17732 17733 _.$slides 17734 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 17735 .removeAttr('aria-hidden') 17736 .removeAttr('data-slick-index') 17737 .each(function(){ 17738 $(this).attr('style', $(this).data('originalStyling')); 17739 }); 17740 17741 _.$slideTrack.children(this.options.slide).detach(); 17742 17743 _.$slideTrack.detach(); 17744 17745 _.$list.detach(); 17746 17747 _.$slider.append(_.$slides); 17748 } 17749 17750 _.cleanUpRows(); 17751 17752 _.$slider.removeClass('slick-slider'); 17753 _.$slider.removeClass('slick-initialized'); 17754 _.$slider.removeClass('slick-dotted'); 17755 17756 _.unslicked = true; 17757 17758 if(!refresh) { 17759 _.$slider.trigger('destroy', [_]); 17760 } 17761 17762 }; 17763 17764 Slick.prototype.disableTransition = function(slide) { 17765 17766 var _ = this, 17767 transition = {}; 17768 17769 transition[_.transitionType] = ''; 17770 17771 if (_.options.fade === false) { 17772 _.$slideTrack.css(transition); 17773 } else { 17774 _.$slides.eq(slide).css(transition); 17775 } 17776 17777 }; 17778 17779 Slick.prototype.fadeSlide = function(slideIndex, callback) { 17780 17781 var _ = this; 17782 17783 if (_.cssTransitions === false) { 17784 17785 _.$slides.eq(slideIndex).css({ 17786 zIndex: _.options.zIndex 17787 }); 17788 17789 _.$slides.eq(slideIndex).animate({ 17790 opacity: 1 17791 }, _.options.speed, _.options.easing, callback); 17792 17793 } else { 17794 17795 _.applyTransition(slideIndex); 17796 17797 _.$slides.eq(slideIndex).css({ 17798 opacity: 1, 17799 zIndex: _.options.zIndex 17800 }); 17801 17802 if (callback) { 17803 setTimeout(function() { 17804 17805 _.disableTransition(slideIndex); 17806 17807 callback.call(); 17808 }, _.options.speed); 17809 } 17810 17811 } 17812 17813 }; 17814 17815 Slick.prototype.fadeSlideOut = function(slideIndex) { 17816 17817 var _ = this; 17818 17819 if (_.cssTransitions === false) { 17820 17821 _.$slides.eq(slideIndex).animate({ 17822 opacity: 0, 17823 zIndex: _.options.zIndex - 2 17824 }, _.options.speed, _.options.easing); 17825 17826 } else { 17827 17828 _.applyTransition(slideIndex); 17829 17830 _.$slides.eq(slideIndex).css({ 17831 opacity: 0, 17832 zIndex: _.options.zIndex - 2 17833 }); 17834 17835 } 17836 17837 }; 17838
17839 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 17840 17841 var _ = this; 17842 17843 if (filter !== null) { 17844 17845 _.$slidesCache = _.$slides; 17846 17847 _.unload(); 17848 17849 _.$slideTrack.children(this.options.slide).detach(); 17850 17851 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 17852 17853 _.reinit(); 17854 17855 } 17856 17857 }; 17858 17859 Slick.prototype.focusHandler = function() { 17860 17861 var _ = this; 17862 17863 _.$slider 17864 .off('focus.slick blur.slick') 17865 .on('focus.slick blur.slick', '*', function(event) { 17866 17867 event.stopImmediatePropagation(); 17868 var $sf = $(this); 17869 17870 setTimeout(function() { 17871 17872 if( _.options.pauseOnFocus ) { 17873 _.focussed = $sf.is(':focus'); 17874 _.autoPlay(); 17875 } 17876 17877 }, 0); 17878 17879 }); 17880 }; 17881 17882 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 17883 17884 var _ = this; 17885 return _.currentSlide; 17886 17887 }; 17888 17889 Slick.prototype.getDotCount = function() { 17890 17891 var _ = this; 17892 17893 var breakPoint = 0; 17894 var counter = 0; 17895 var pagerQty = 0; 17896 17897 if (_.options.infinite === true) { 17898 if (_.slideCount <= _.options.slidesToShow) { 17899 ++pagerQty; 17900 } else { 17901 while (breakPoint < _.slideCount) { 17902 ++pagerQty; 17903 breakPoint = counter + _.options.slidesToScroll; 17904 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 17905 } 17906 } 17907 } else if (_.options.centerMode === true) { 17908 pagerQty = _.slideCount; 17909 } else if(!_.options.asNavFor) { 17910 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 17911 }else { 17912 while (breakPoint < _.slideCount) { 17913 ++pagerQty; 17914 breakPoint = counter + _.options.slidesToScroll; 17915 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 17916 } 17917 } 17918 17919 return pagerQty - 1; 17920 17921 }; 17922 17923 Slick.prototype.getLeft = function(slideIndex) { 17924 17925 var _ = this, 17926 targetLeft, 17927 verticalHeight, 17928 verticalOffset = 0, 17929 targetSlide, 17930 coef; 17931 17932 _.slideOffset = 0; 17933 verticalHeight = _.$slides.first().outerHeight(true); 17934 17935 if (_.options.infinite === true) { 17936 if (_.slideCount > _.options.slidesToShow) { 17937 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 17938 coef = -1 17939 17940 if (_.options.vertical === true && _.options.centerMode === true) { 17941 if (_.options.slidesToShow === 2) { 17942 coef = -1.5; 17943 } else if (_.options.slidesToShow === 1) { 17944 coef = -2 17945 } 17946 } 17947 verticalOffset = (verticalHeight * _.options.slidesToShow) * coef; 17948 } 17949 if (_.slideCount % _.options.slidesToScroll !== 0) { 17950 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 17951 if (slideIndex > _.slideCount) { 17952 _.slideOffset = ((_.options.slidesToShow - (sl
17952ideIndex - _.slideCount)) * _.slideWidth) * -1; 17953 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 17954 } else { 17955 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 17956 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 17957 } 17958 } 17959 } 17960 } else { 17961 if (slideIndex + _.options.slidesToShow > _.slideCount) { 17962 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 17963 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 17964 } 17965 } 17966 17967 if (_.slideCount <= _.options.slidesToShow) { 17968 _.slideOffset = 0; 17969 verticalOffset = 0; 17970 } 17971 17972 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 17973 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 17974 } else if (_.options.centerMode === true && _.options.infinite === true) { 17975 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 17976 } else if (_.options.centerMode === true) { 17977 _.slideOffset = 0; 17978 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 17979 } 17980 17981 if (_.options.vertical === false) { 17982 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 17983 } else { 17984 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 17985 } 17986 17987 if (_.options.variableWidth === true) { 17988
17989 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 17990 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 17991 } else { 17992 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 17993 } 17994 17995 if (_.options.rtl === true) { 17996 if (targetSlide[0]) { 17997 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 17998 } else { 17999 targetLeft = 0; 18000 } 18001 } else { 18002 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 18003 } 18004 18005 if (_.options.centerMode === true) { 18006 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 18007 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 18008 } else { 18009 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 18010 } 18011 18012 if (_.options.rtl === true) { 18013 if (targetSlide[0]) { 18014 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 18015 } else { 18016 targetLeft = 0; 18017 } 18018 } else { 18019 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 18020 } 18021 18022 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 18023 } 18024 } 18025 18026 return targetLeft; 18027 18028 }; 18029 18030 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 18031 18032 var _ = this; 18033 18034 return _.options[option]; 18035 18036 }; 18037 18038 Slick.prototype.getNavigableIndexes = function() { 18039 18040 var _ = this, 18041 breakPoint = 0, 18042 counter = 0, 18043 indexes = [], 18044 max; 18045 18046 if (_.options.infinite === false) { 18047 max = _.slideCount; 18048 } else { 18049 breakPoint = _.options.slidesToScroll * -1; 18050 counter = _.options.slidesToScroll * -1; 18051 max = _.slideCount * 2; 18052 } 18053 18054 while (breakPoint < max) { 18055 indexes.push(breakPoint); 18056 breakPoint = counter + _.options.slidesToScroll; 18057 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 18058 } 18059 18060 return indexes; 18061 18062 }; 18063 18064 Slick.prototype.getSlick = function() { 18065 18066 return this; 18067 18068 }; 18069 18070 Slick.prototype.getSlideCount = function() { 18071 18072 var _ = this, 18073 slidesTraversed, swipedSlide, centerOffset; 18074 18075 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 18076 18077 if (_.options.swipeToSlide === true) { 18078 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 18079 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 18080 swipedSlide = slide; 18081 return false; 18082 } 18083 }); 18084 18085 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 18086 18087 return slidesTraversed; 18088 18089 } else { 18090 return _.options.slidesToScroll; 18091 } 18092 18093 }; 18094 18095 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 18096 18097 var _ = this; 18098 18099 _.changeSlide({ 18100 data: { 18101 message: 'index', 18102 index: parseInt(slide) 18103 } 18104 }, dontAnimate); 18105 18106 }; 18107 18108 Slick.prototype.init = function(creation) { 18109 18110 var _ = this; 18111 18112 if (!$(_.$slider).hasClass('slick-initialized')) { 18113 18114 $(_.$slider).addClass('slick-initialized'); 18115 18116 _.buildRows(); 18117 _.buildOut(); 18118 _.setProps(); 18119 _.startLoad(); 18120 _.loadSlider(); 18121 _.initializeEvents(); 18122 _.updateArrows(); 18123 _.updateDots(); 18124 _.checkResponsive(true); 18125 _.focusHandler(); 18126 18127 } 18128 18129 if (creation) { 18130 _.$slider.trigger('init', [_]); 18131 } 18132 18133 if (_.options.accessibility === true) { 18134 _.initADA(); 18135 } 18136 18137 if ( _.options.autoplay ) { 18138 18139 _.paused = false;
18140 _.autoPlay(); 18141 18142 } 18143 18144 }; 18145 18146 Slick.prototype.initADA = function() { 18147 var _ = this, 18148 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 18149 tabControlIndexes = _.getNavigableIndexes().filter(function(val) { 18150 return (val >= 0) && (val < _.slideCount); 18151 }); 18152 18153 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 18154 'aria-hidden': 'true', 18155 'tabindex': '-1' 18156 }).find('a, input, button, select').attr({ 18157 'tabindex': '-1' 18158 }); 18159 18160 if (_.$dots !== null) { 18161 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 18162 var slideControlIndex = tabControlIndexes.indexOf(i); 18163 18164 $(this).attr({ 18165 'role': 'tabpanel', 18166 'id': 'slick-slide' + _.instanceUid + i, 18167 'tabindex': -1 18168 }); 18169 18170 if (slideControlIndex !== -1) { 18171 var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex 18172 if ($('#' + ariaButtonControl).length) { 18173 $(this).attr({ 18174 'aria-describedby': ariaButtonControl 18175 }); 18176 } 18177 } 18178 }); 18179 18180 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 18181 var mappedSlideIndex = tabControlIndexes[i]; 18182 18183 $(this).attr({ 18184 'role': 'presentation' 18185 }); 18186 18187 $(this).find('button').first().attr({ 18188 'role': 'tab', 18189 'id': 'slick-slide-control' + _.instanceUid + i, 18190 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 18191 'aria-label': (i + 1) + ' of ' + numDotGroups, 18192 'aria-selected': null, 18193 'tabindex': '-1' 18194 }); 18195 18196 }).eq(_.currentSlide).find('button').attr({ 18197 'aria-selected': 'true', 18198 'tabindex': '0' 18199 }).end(); 18200 } 18201 18202 for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) { 18203 if (_.options.focusOnChange) { 18204 _.$slides.eq(i).attr({'tabindex': '0'}); 18205 } else { 18206 _.$slides.eq(i).removeAttr('tabindex'); 18207 } 18208 } 18209 18210 _.activateADA(); 18211 18212 }; 18213 18214 Slick.prototype.initArrowEvents = function() { 18215 18216 var _ = this; 18217 18218 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 18219 _.$prevArrow 18220 .off('click.slick') 18221 .on('click.slick', { 18222 message: 'previous' 18223 }, _.changeSlide); 18224 _.$nextArrow 18225 .off('click.slick') 18226 .on('click.slick', { 18227 message: 'next' 18228 }, _.changeSlide); 18229 18230 if (_.options.accessibility === true) { 18231 _.$prevArrow.on('keydown.slick', _.keyHandler); 18232 _.$nextArrow.on('keydown.slick', _.keyHandler); 18233 } 18234 } 18235 18236 }; 18237 18238 Slick.prototype.initDotEvents = function() { 18239 18240 var _ = this; 18241 18242 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 18243 $('li', _.$dots).on('click.slick', { 18244 message: 'index' 18245 }, _.changeSlide); 18246 18247 if (_.options.accessibility === true) { 18248 _.$dots.on('keydown.slick', _.keyHandler); 18249 } 18250 } 18251 18252 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) { 18253 18254 $('li', _.$dots) 18255 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 18256 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 18257 18258 } 18259 18260 }; 18261 18262 Slick.prototype.initSlideEvents = function() { 18263 18264 var _ = this; 18265 18266 if ( _.options.pauseOnHover ) { 18267 18268 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true));
18269 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 18270 18271 } 18272 18273 }; 18274 18275 Slick.prototype.initializeEvents = function() { 18276 18277 var _ = this; 18278 18279 _.initArrowEvents(); 18280 18281 _.initDotEvents(); 18282 _.initSlideEvents(); 18283 18284 _.$list.on('touchstart.slick mousedown.slick', { 18285 action: 'start' 18286 }, _.swipeHandler); 18287 _.$list.on('touchmove.slick mousemove.slick', { 18288 action: 'move' 18289 }, _.swipeHandler); 18290 _.$list.on('touchend.slick mouseup.slick', { 18291 action: 'end' 18292 }, _.swipeHandler); 18293 _.$list.on('touchcancel.slick mouseleave.slick', { 18294 action: 'end' 18295 }, _.swipeHandler); 18296 18297 _.$list.on('click.slick', _.clickHandler); 18298 18299 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 18300 18301 if (_.options.accessibility === true) { 18302 _.$list.on('keydown.slick', _.keyHandler); 18303 } 18304 18305 if (_.options.focusOnSelect === true) { 18306 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 18307 } 18308 18309 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 18310 18311 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 18312 18313 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 18314 18315 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 18316 $(_.setPosition); 18317 18318 }; 18319 18320 Slick.prototype.initUI = function() { 18321 18322 var _ = this; 18323 18324 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 18325 18326 _.$prevArrow.show(); 18327 _.$nextArrow.show(); 18328 18329 } 18330 18331 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 18332 18333 _.$dots.show(); 18334 18335 } 18336 18337 }; 18338 18339 Slick.prototype.keyHandler = function(event) { 18340 18341 var _ = this; 18342 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 18343 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 18344 if (event.keyCode === 37 && _.options.accessibility === true) { 18345 _.changeSlide({ 18346 data: { 18347 message: _.options.rtl === true ? 'next' : 'previous' 18348 } 18349 }); 18350 } else if (event.keyCode === 39 && _.options.accessibility === true) { 18351 _.changeSlide({ 18352 data: { 18353 message: _.options.rtl === true ? 'previous' : 'next' 18354 } 18355 }); 18356 } 18357 } 18358 18359 }; 18360 18361 Slick.prototype.lazyLoad = function() { 18362 18363 var _ = this, 18364 loadRange, cloneRange, rangeStart, rangeEnd; 18365 18366 function loadImages(imagesScope) { 18367 18368 $('img[data-lazy]', imagesScope).each(function() { 18369 18370 var image = $(this), 18371 imageSource = $(this).attr('data-lazy'), 18372 imageSrcSet = $(this).attr('data-srcset'), 18373 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 18374 imageToLoad = document.createElement('img'); 18375 18376 imageToLoad.onload = function() { 18377 18378 image 18379 .animate({ opacity: 0 }, 100, function() { 18380 18381 if (imageSrcSet) { 18382 image 18383 .attr('srcset', imageSrcSet ); 18384 18385 if (imageSizes) { 18386 image 18387 .attr('sizes', imageSizes ); 18388 } 18389 } 18390 18391 image 18392 .attr('src', imageSource) 18393 .animate({ opacity: 1 }, 200, function() { 18394 image 18395 .removeAttr('data-lazy data-srcset data-sizes') 18396 .removeClass('slick-loading'); 18397 }); 18398 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 18399 }); 18400 18401 }; 18402 18403 imageToLoad.onerror = function() { 18404 18405 image 18406 .removeAttr( 'data-lazy' ) 18407 .removeClass( 'slick-loading' ) 18408 .addClass( 'slick-lazyload-error' ); 18409 18410 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 18411 18412 }; 18413 18414 imageToLoad.src = imageSource; 18415 18416 }); 18417 18418 } 18419 18420 if (_.options.centerMode === true) { 18421 if (_.options.infinite === true) { 18422 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 18423 rangeEnd = rangeStart + _.options.slidesToShow + 2; 18424 } else { 18425 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 18426 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 18427 } 18428 } else {
18429 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 18430 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 18431 if (_.options.fade === true) { 18432 if (rangeStart > 0) rangeStart--; 18433 if (rangeEnd <= _.slideCount) rangeEnd++; 18434 } 18435 } 18436 18437 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 18438 18439 if (_.options.lazyLoad === 'anticipated') { 18440 var prevSlide = rangeStart - 1, 18441 nextSlide = rangeEnd, 18442 $slides = _.$slider.find('.slick-slide'); 18443 18444 for (var i = 0; i < _.options.slidesToScroll; i++) { 18445 if (prevSlide < 0) prevSlide = _.slideCount - 1; 18446 loadRange = loadRange.add($slides.eq(prevSlide)); 18447 loadRange = loadRange.add($slides.eq(nextSlide)); 18448 prevSlide--; 18449 nextSlide++; 18450 } 18451 } 18452 18453 loadImages(loadRange); 18454 18455 if (_.slideCount <= _.options.slidesToShow) { 18456 cloneRange = _.$slider.find('.slick-slide'); 18457 loadImages(cloneRange); 18458 } else 18459 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 18460 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 18461 loadImages(cloneRange); 18462 } else if (_.currentSlide === 0) { 18463 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 18464 loadImages(cloneRange); 18465 } 18466 18467 }; 18468 18469 Slick.prototype.loadSlider = function() { 18470 18471 var _ = this; 18472 18473 _.setPosition(); 18474 18475 _.$slideTrack.css({ 18476 opacity: 1 18477 }); 18478 18479 _.$slider.removeClass('slick-loading'); 18480 18481 _.initUI(); 18482 18483 if (_.options.lazyLoad === 'progressive') { 18484 _.progressiveLazyLoad(); 18485 } 18486 18487 }; 18488 18489 Slick.prototype.next = Slick.prototype.slickNext = function() { 18490 18491 var _ = this; 18492 18493 _.changeSlide({ 18494 data: { 18495 message: 'next' 18496 } 18497 }); 18498 18499 }; 18500 18501 Slick.prototype.orientationChange = function() { 18502 18503 var _ = this; 18504 18505 _.checkResponsive(); 18506 _.setPosition(); 18507 18508 }; 18509 18510 Slick.prototype.pause = Slick.prototype.slickPause = function() { 18511 18512 var _ = this; 18513 18514 _.autoPlayClear(); 18515 _.paused = true; 18516 18517 }; 18518 18519 Slick.prototype.play = Slick.prototype.slickPlay = function() { 18520 18521 var _ = this; 18522 18523 _.autoPlay(); 18524 _.options.autoplay = true; 18525 _.paused = false; 18526 _.focussed = false; 18527 _.interrupted = false; 18528 18529 }; 18530 18531 Slick.prototype.postSlide = function(index) { 18532 18533 var _ = this; 18534 18535 if( !_.unslicked ) { 18536 18537 _.$slider.trigger('afterChange', [_, index]); 18538 18539 _.animating = false; 18540 18541 if (_.slideCount > _.options.slidesToShow) { 18542 _.setPosition(); 18543 } 18544 18545 _.swipeLeft = null; 18546 18547 if ( _.options.autoplay ) { 18548 _.autoPlay(); 18549 } 18550 18551 if (_.options.accessibility === true) { 18552 _.initADA(); 18553 18554 if (_.options.focusOnChange) { 18555 var $currentSlide = $(_.$slides.get(_.currentSlide)); 18556 $currentSlide.attr('tabindex', 0).focus(); 18557 } 18558 } 18559 18560 } 18561 18562 }; 18563 18564 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 18565 18566 var _ = this; 18567 18568 _.changeSlide({ 18569 data: { 18570 message: 'previous' 18571 } 18572 }); 18573 18574 }; 18575 18576 Slick.prototype.preventDefault = function(event) { 18577 18578 event.preventDefault(); 18579 18580 }; 18581 18582 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 18583 18584 tryCount = tryCount || 1; 18585 18586 var _ = this, 18587 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 18588 image, 18589 imageSource, 18590 imageSrcSet, 18591 imageSizes, 18592 imageToLoad; 18593 18594 if ( $imgsToLoad.length ) { 18595 18596 image = $imgsToLoad.first(); 18597 imageSource = image.attr('data-lazy'); 18598 imageSrcSet = image.attr('data-srcset'); 18599 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 18600 imageToLoad = document.createElement('img'); 18601 18602 imageToLoad.onload = function() { 18603 18604 if (imageSrcSet) { 18605 image 18606 .attr('srcset', imageSrcSet ); 18607 18608 if (imageSizes) { 18609 image 18610 .attr('sizes', imageSizes ); 18611 } 18612 } 18613 18614 image 18615 .attr( 'src', imageSource ) 18616 .removeAttr('data-lazy data-srcset data-sizes') 18617 .removeClass('slick-loading'); 18618 18619 if ( _.options.adaptiveHeight === true ) { 18620 _.setPosition(); 18621 } 18622 18623 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 18624 _.progressiveLazyLoad(); 18625 18626 }; 18627 18628 imageToLoad.onerror = function() { 18629 18630 if ( tryCount < 3 ) { 18631 18632 /** 18633 * try to load the image 3 times, 18634 * leave a slight delay so we don't get 18635 * servers blocking the request. 18636 */ 18637 setTimeout( function() { 18638 _.progressiveLazyLoad( tryCount + 1 ); 18639 }, 500 ); 18640 18641 } else { 18642 18643 image 18644 .removeAttr( 'data-lazy' ) 18645 .removeClass( 'slick-loading' ) 18646 .addClass( 'slick-lazyload-error' ); 18647 18648 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 18649 18650 _.progressiveLazyLoad(); 18651 18652 } 18653 18654 }; 18655 18656 imageToLoad.src = imageSource; 18657 18658 } else { 18659 18660 _.$slider.trigger('allImagesLoaded', [ _ ]); 18661 18662 } 18663 18664 }; 18665 18666 Slick.prototype.refresh = function( initializing ) { 18667 18668 var _ = this, currentSlide, lastVisibleIndex; 18669 18670 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 18671 18672 // in non-infinite sliders, we don't want to go past the 18673 // last visible index. 18674 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 18675 _.currentSlide = lastVisibleIndex; 18676 } 18677 18678 // if less slides than to show, go to start. 18679 if ( _.slideCount <= _.options.slidesToShow ) { 18680 _.currentSlide = 0; 18681 18682 } 18683 18684 currentSlide = _.currentSlide; 18685 18686 _.destroy(true); 18687 18688 $.extend(_, _.initials, { currentSlide: currentSlide }); 18689
18690 _.init(); 18691 18692 if( !initializing ) { 18693 18694 _.changeSlide({ 18695 data: { 18696 message: 'index', 18697 index: currentSlide 18698 } 18699 }, false); 18700 18701 } 18702 18703 }; 18704 18705 Slick.prototype.registerBreakpoints = function() { 18706 18707 var _ = this, breakpoint, currentBreakpoint, l, 18708 responsiveSettings = _.options.responsive || null; 18709 18710 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 18711 18712 _.respondTo = _.options.respondTo || 'window'; 18713 18714 for ( breakpoint in responsiveSettings ) { 18715 18716 l = _.breakpoints.length-1; 18717 18718 if (responsiveSettings.hasOwnProperty(breakpoint)) { 18719 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 18720 18721 // loop through the breakpoints and cut out any existing 18722 // ones with the same breakpoint number, we don't want dupes. 18723 while( l >= 0 ) { 18724 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 18725 _.breakpoints.splice(l,1); 18726 } 18727 l--; 18728 } 18729 18730 _.breakpoints.push(currentBreakpoint); 18731 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 18732 18733 } 18734 18735 } 18736 18737 _.breakpoints.sort(function(a, b) { 18738 return ( _.options.mobileFirst ) ? a-b : b-a; 18739 }); 18740 18741 } 18742 18743 }; 18744 18745 Slick.prototype.reinit = function() { 18746 18747 var _ = this; 18748 18749 _.$slides = 18750 _.$slideTrack 18751 .children(_.options.slide) 18752 .addClass('slick-slide'); 18753 18754 _.slideCount = _.$slides.length; 18755 18756 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 18757 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 18758 } 18759 18760 if (_.slideCount <= _.options.slidesToShow) { 18761 _.currentSlide = 0; 18762 } 18763 18764 _.registerBreakpoints(); 18765 18766 _.setProps(); 18767 _.setupInfinite(); 18768 _.buildArrows(); 18769 _.updateArrows(); 18770 _.initArrowEvents(); 18771 _.buildDots(); 18772 _.updateDots(); 18773 _.initDotEvents(); 18774 _.cleanUpSlideEvents(); 18775 _.initSlideEvents(); 18776 18777 _.checkResponsive(false, true); 18778 18779 if (_.options.focusOnSelect === true) { 18780 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 18781 } 18782 18783 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 18784 18785 _.setPosition(); 18786 _.focusHandler(); 18787 18788 _.paused = !_.options.autoplay; 18789 _.autoPlay(); 18790 18791 _.$slider.trigger('reInit', [_]); 18792 18793 }; 18794 18795 Slick.prototype.resize = function() { 18796 18797 var _ = this; 18798 18799 if ($(window).width() !== _.windowWidth) { 18800 clearTimeout(_.windowDelay); 18801 _.windowDelay = window.setTimeout(function() { 18802 _.windowWidth = $(window).width(); 18803 _.checkResponsive(); 18804 if( !_.unslicked ) { _.setPosition(); } 18805 }, 50); 18806 } 18807 }; 18808 18809 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 18810 18811 var _ = this; 18812 18813 if (typeof(index) === 'boolean') { 18814 removeBefore = index; 18815 index = removeBefore === true ? 0 : _.slideCount - 1; 18816 } else { 18817 index = removeBefore === true ? --index : index; 18818 } 18819 18820 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 18821 return false; 18822 } 18823 18824 _.unload(); 18825 18826 if (removeAll === true) { 18827 _.$slideTrack.children().remove(); 18828 } else { 18829 _.$slideTrack.children(this.options.slide).eq(index).remove(); 18830 } 18831 18832 _.$slides = _.$slideTrack.children(this.options.slide); 18833 18834 _.$slideTrack.children(this.options.slide).detach(); 18835 18836 _.$slideTrack.append(_.$slides); 18837 18838 _.$slidesCache = _.$slides; 18839 18840 _.reinit(); 18841 18842 }; 18843 18844 Slick.prototype.setCSS = function(position) { 18845 18846 var _ = this, 18847 positionProps = {}, 18848 x, y; 18849 18850 if (_.options.rtl === true) { 18851 position = -position; 18852 } 18853 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 18854 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 18855 18856 positionProps[_.positionProp] = position; 18857 18858 if (_.transformsEnabled === false) { 18859 _.$slideTrack.css(positionProps); 18860 } else { 18861 positionProps = {}; 18862 if (_.cssTransitions === false) { 18863 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 18864 _.$slideTrack.css(positionProps); 18865 } else { 18866 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 18867 _.$slideTrack.css(positionProps); 18868 } 18869 } 18870 18871 }; 18872 18873 Slick.prototype.setDimensions = function() { 18874 18875 var _ = this; 18876 18877 if (_.options.vertical === false) { 18878 if (_.options.centerMode === true) { 18879 _.$list.css({ 18880 padding: ('0px ' + _.options.centerPadding) 18881 }); 18882 } 18883 } else { 18884 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 18885 if (_.options.centerMode === true) { 18886 _.$list.css({ 18887 padding: (_.options.centerPadding + ' 0px') 18888 }); 18889 } 18890 } 18891 18892 _.listWidth = _.$list.width(); 18893 _.listHeight = _.$list.height(); 18894 18895 18896 if (_.options.vertical === false && _.options.variableWidth === false) { 18897 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 18898 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 18899 18900 } else if (_.options.variableWidth === true) { 18901 _.$slideTrack.width(5000 * _.slideCount); 18902 } else { 18903 _.slideWidth = Math.ceil(_.listWidth); 18904 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 18905 } 18906 18907 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 18908 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 18909 18910 }; 18911 18912 Slick.prototype.setFade = function() { 18913 18914 var _ = this, 18915 targetLeft; 18916 18917 _.$slides.each(function(index, element) { 18918 targetLeft = (_.slideWidth * index) * -1; 18919 if (_.options.rtl === true) { 18920 $(element).css({ 18921 position: 'relative', 18922 right: targetLeft, 18923 top: 0, 18924 zIndex: _.options.zIndex - 2, 18925 opacity: 0 18926 }); 18927 } else { 18928 $(element).css({ 18929 position: 'relative', 18930 left: targetLeft, 18931 top: 0, 18932 zIndex: _.options.zIndex - 2, 18933 opacity: 0 18934 }); 18935 } 18936 }); 18937 18938 _.$slides.eq(_.currentSlide).css({ 18939 zIndex: _.options.zIndex - 1, 18940 opacity: 1 18941 }); 18942 18943 }; 18944 18945 Slick.prototype.setHeight = function() { 18946 18947 var _ = this; 18948 18949 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 18950 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 18951 _.$list.css('height', targetHeight); 18952 } 18953 18954 }; 18955 18956 Slick.prototype.setOption = 18957 Slick.prototype.slickSetOption = function() { 18958 18959 /** 18960 * accepts arguments in format of: 18961 * 18962 * - for changing a single option's value: 18963 * .slick("setOption", option, value, refresh ) 18964 * 18965 * - for changing a set of responsive options: 18966 * .slick("setOption", 'responsive', [{}, ...], refresh ) 18967 * 18968 * - for updating multiple values at once (not responsive) 18969 * .slick("setOption", { 'option': value, ... }, refresh ) 18970 */ 18971 18972 var _ = this, l, item, option, value, refresh = false, t
18972ype; 18973 18974 if( $.type( arguments[0] ) === 'object' ) { 18975 18976 option = arguments[0]; 18977 refresh = arguments[1]; 18978 type = 'multiple'; 18979 18980 } else if ( $.type( arguments[0] ) === 'string' ) { 18981 18982 option = arguments[0]; 18983 value = arguments[1]; 18984 refresh = arguments[2]; 18985 18986 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 18987 18988 type = 'responsive'; 18989 18990 } else if ( typeof arguments[1] !== 'undefined' ) { 18991 18992 type = 'single'; 18993 18994 } 18995 18996 } 18997 18998 if ( type === 'single' ) { 18999 19000 _.options[option] = value; 19001 19002 19003 } else if ( type === 'multiple' ) { 19004 19005 $.each( option , function( opt, val ) { 19006 19007 _.options[opt] = val; 19008 19009 }); 19010 19011 19012 } else if ( type === 'responsive' ) { 19013 19014 for ( item in value ) { 19015 19016 if( $.type( _.options.responsive ) !== 'array' ) { 19017 19018 _.options.responsive = [ value[item] ]; 19019 19020 } else { 19021 19022 l = _.options.responsive.length-1; 19023 19024 // loop through the responsive object and splice out duplicates. 19025 while( l >= 0 ) { 19026 19027 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 19028 19029 _.options.responsive.splice(l,1); 19030 19031 } 19032 19033 l--; 19034 19035 } 19036 19037 _.options.responsive.push( value[item] ); 19038 19039 } 19040 19041 } 19042 19043 } 19044 19045 if ( refresh ) { 19046 19047 _.unload(); 19048 _.reinit(); 19049 19050 } 19051 19052 }; 19053 19054 Slick.prototype.setPosition = function() { 19055 19056 var _ = this; 19057 19058 _.setDimensions(); 19059 19060 _.setHeight(); 19061 19062 if (_.options.fade === false) { 19063 _.setCSS(_.getLeft(_.currentSlide)); 19064 } else { 19065 _.setFade(); 19066 } 19067 19068 _.$slider.trigger('setPosition', [_]); 19069 19070 }; 19071 19072 Slick.prototype.setProps = function() { 19073 19074 var _ = this, 19075 bodyStyle = document.body.style; 19076 19077 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 19078 19079 if (_.positionProp === 'top') { 19080 _.$slider.addClass('slick-vertical'); 19081 } else { 19082 _.$slider.removeClass('slick-vertical'); 19083 } 19084 19085 if (bodyStyle.WebkitTransition !== undefined || 19086 bodyStyle.MozTransition !== undefined || 19087 bodyStyle.msTransition !== undefined) { 19088 if (_.options.useCSS === true) { 19089 _.cssTransitions = true; 19090 } 19091 } 19092 19093 if ( _.options.fade ) { 19094 if ( typeof _.options.zIndex === 'number' ) { 19095 if( _.options.zIndex < 3 ) { 19096 _.options.zIndex = 3; 19097 } 19098 } else { 19099 _.options.zIndex = _.defaults.zIndex; 19100 } 19101 } 19102 19103 if (bodyStyle.OTransform !== undefined) { 19104 _.animType = 'OTransform'; 19105 _.transformType = '-o-transform'; 19106 _.transitionType = 'OTransition'; 19107 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
19108 } 19109 if (bodyStyle.MozTransform !== undefined) { 19110 _.animType = 'MozTransform'; 19111 _.transformType = '-moz-transform'; 19112 _.transitionType = 'MozTransition'; 19113 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 19114 } 19115 if (bodyStyle.webkitTransform !== undefined) { 19116 _.animType = 'webkitTransform'; 19117 _.transformType = '-webkit-transform'; 19118 _.transitionType = 'webkitTransition'; 19119 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 19120 } 19121 if (bodyStyle.msTransform !== undefined) { 19122 _.animType = 'msTransform'; 19123 _.transformType = '-ms-transform'; 19124 _.transitionType = 'msTransition'; 19125 if (bodyStyle.msTransform === undefined) _.animType = false; 19126 } 19127 if (bodyStyle.transform !== undefined && _.animType !== false) { 19128 _.animType = 'transform'; 19129 _.transformType = 'transform'; 19130 _.transitionType = 'transition'; 19131 } 19132 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 19133 }; 19134 19135 19136 Slick.prototype.setSlideClasses = function(index) { 19137 19138 var _ = this, 19139 centerOffset, allSlides, indexOffset, remainder; 19140 19141 allSlides = _.$slider 19142 .find('.slick-slide') 19143 .removeClass('slick-active slick-center slick-current') 19144 .attr('aria-hidden', 'true'); 19145 19146 _.$slides 19147 .eq(index) 19148 .addClass('slick-current'); 19149 19150 if (_.options.centerMode === true) { 19151 19152 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 19153 19154 centerOffset = Math.floor(_.options.slidesToShow / 2); 19155 19156 if (_.options.infinite === true) { 19157 19158 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 19159 _.$slides 19160 .slice(index - centerOffset + evenCoef, index + centerOffset + 1) 19161 .addClass('slick-active') 19162 .attr('aria-hidden', 'false'); 19163 19164 } else { 19165 19166 indexOffset = _.options.slidesToShow + index; 19167 allSlides 19168 .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2) 19169 .addClass('slick-active') 19170 .attr('aria-hidden', 'false'); 19171 19172 } 19173 19174 if (index === 0) { 19175 19176 allSlides 19177 .eq(allSlides.length - 1 - _.options.slidesToShow) 19178 .addClass('slick-center'); 19179 19180 } else if (index === _.slideCount - 1) { 19181 19182 allSlides 19183 .eq(_.options.slidesToShow) 19184 .addClass('slick-center'); 19185 19186 } 19187 19188 } 19189 19190 _.$slides 19191 .eq(index) 19192 .addClass('slick-center'); 19193 19194 } else { 19195 19196 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 19197 19198 _.$slides 19199 .slice(index, index + _.options.slidesToShow) 19200 .addClass('slick-active') 19201 .attr('aria-hidden', 'false'); 19202 19203 } else if (allSlides.length <= _.options.slidesToShow) { 19204 19205 allSlides 19206 .addClass('slick-active') 19207 .attr('aria-hidden', 'false'); 19208 19209 } else { 19210 19211 remainder = _.slideCount % _.options.slidesToShow; 19212 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 19213 19214 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 19215 19216 allSlides 19217 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 19218 .addClass('slick-active') 19219 .attr('aria-hidden', 'false'); 19220 19221 } else { 19222 19223 allSlides 19224 .slice(indexOffset, indexOffset + _.options.slidesToShow) 19225 .addClass('slick-active') 19226 .attr('aria-hidden', 'false'); 19227 19228 } 19229 19230 } 19231 19232 } 19233 19234 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 19235 _.lazyLoad(); 19236 } 19237 }; 19238 19239 Slick.prototype.setupInfinite = function() { 19240 19241 var _ = this, 19242 i, slideIndex, infiniteCount; 19243 19244 if (_.options.fade === true) {
19245 _.options.centerMode = false; 19246 } 19247 19248 if (_.options.infinite === true && _.options.fade === false) { 19249 19250 slideIndex = null; 19251 19252 if (_.slideCount > _.options.slidesToShow) { 19253 19254 if (_.options.centerMode === true) { 19255 infiniteCount = _.options.slidesToShow + 1; 19256 } else { 19257 infiniteCount = _.options.slidesToShow; 19258 } 19259 19260 for (i = _.slideCount; i > (_.slideCount - 19261 infiniteCount); i -= 1) { 19262 slideIndex = i - 1; 19263 $(_.$slides[slideIndex]).clone(true).attr('id', '') 19264 .attr('data-slick-index', slideIndex - _.slideCount) 19265 .prependTo(_.$slideTrack).addClass('slick-cloned'); 19266 } 19267 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 19268 slideIndex = i; 19269 $(_.$slides[slideIndex]).clone(true).attr('id', '') 19270 .attr('data-slick-index', slideIndex + _.slideCount) 19271 .appendTo(_.$slideTrack).addClass('slick-cloned'); 19272 } 19273 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 19274 $(this).attr('id', ''); 19275 }); 19276 19277 } 19278 19279 } 19280 19281 }; 19282 19283 Slick.prototype.interrupt = function( toggle ) { 19284 19285 var _ = this; 19286 19287 if( !toggle ) { 19288 _.autoPlay(); 19289 } 19290 _.interrupted = toggle; 19291 19292 }; 19293 19294 Slick.prototype.selectHandler = function(event) { 19295 19296 var _ = this; 19297 19298 var targetElement = 19299 $(event.target).is('.slick-slide') ? 19300 $(event.target) : 19301 $(event.target).parents('.slick-slide'); 19302 19303 var index = parseInt(targetElement.attr('data-slick-index')); 19304 19305 if (!index) index = 0; 19306 19307 if (_.slideCount <= _.options.slidesToShow) { 19308 19309 _.slideHandler(index, false, true); 19310 return; 19311 19312 } 19313 19314 _.slideHandler(index); 19315 19316 }; 19317 19318 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 19319 19320 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 19321 _ = this, navTarget; 19322 19323 sync = sync || false; 19324 19325 if (_.animating === true && _.options.waitForAnimate === true) { 19326 return; 19327 } 19328 19329 if (_.options.fade === true && _.currentSlide === index) { 19330 return; 19331 } 19332 19333 if (sync === false) { 19334 _.asNavFor(index); 19335 } 19336 19337 targetSlide = index; 19338 targetLeft = _.getLeft(targetSlide); 19339 slideLeft = _.getLeft(_.currentSlide); 19340 19341 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 19342 19343 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 19344 if (_.options.fade === false) { 19345 targetSlide = _.currentSlide; 19346 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 19347 _.animateSlide(slideLeft, function() { 19348 _.postSlide(targetSlide); 19349 }); 19350 } else { 19351 _.postSlide(targetSlide); 19352 } 19353 } 19354 return; 19355 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 19356 if (_.options.fade === false) { 19357 targetSlide = _.currentSlide; 19358 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 19359 _.animateSlide(slideLeft, function() { 19360 _.postSlide(targetSlide); 19361 }); 19362 } else { 19363 _.postSlide(targetSlide); 19364 } 19365 } 19366 return; 19367 } 19368 19369 if ( _.options.autoplay ) { 19370 clearInterval(_.autoPlayTimer); 19371 } 19372 19373 if (targetSlide < 0) { 19374 if (_.slideCount % _.options.slidesToScroll !== 0) { 19375 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 19376 } else { 19377 animSlide = _.slideCount + targetSlide; 19378 } 19379 }
19379 else if (targetSlide >= _.slideCount) { 19380 if (_.slideCount % _.options.slidesToScroll !== 0) { 19381 animSlide = 0; 19382 } else { 19383 animSlide = targetSlide - _.slideCount; 19384 } 19385 } else { 19386 animSlide = targetSlide; 19387 } 19388 19389 _.animating = true; 19390 19391 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 19392 19393 oldSlide = _.currentSlide; 19394 _.currentSlide = animSlide; 19395 19396 _.setSlideClasses(_.currentSlide); 19397 19398 if ( _.options.asNavFor ) { 19399 19400 navTarget = _.getNavTarget(); 19401 navTarget = navTarget.slick('getSlick'); 19402 19403 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 19404 navTarget.setSlideClasses(_.currentSlide); 19405 } 19406 19407 } 19408 19409 _.updateDots(); 19410 _.updateArrows(); 19411 19412 if (_.options.fade === true) { 19413 if (dontAnimate !== true) { 19414 19415 _.fadeSlideOut(oldSlide); 19416 19417 _.fadeSlide(animSlide, function() { 19418 _.postSlide(animSlide); 19419 }); 19420 19421 } else { 19422 _.postSlide(animSlide); 19423 } 19424 _.animateHeight(); 19425 return; 19426 } 19427 19428 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 19429 _.animateSlide(targetLeft, function() { 19430 _.postSlide(animSlide); 19431 }); 19432 } else { 19433 _.postSlide(animSlide); 19434 } 19435 19436 }; 19437 19438 Slick.prototype.startLoad = function() { 19439 19440 var _ = this; 19441 19442 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 19443 19444 _.$prevArrow.hide(); 19445 _.$nextArrow.hide(); 19446 19447 } 19448 19449 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 19450 19451 _.$dots.hide(); 19452 19453 } 19454 19455 _.$slider.addClass('slick-loading'); 19456 19457 }; 19458 19459 Slick.prototype.swipeDirection = function() { 19460 19461 var xDist, yDist, r, swipeAngle, _ = this; 19462 19463 xDist = _.touchObject.startX - _.touchObject.curX; 19464 yDist = _.touchObject.startY - _.touchObject.curY; 19465 r = Math.atan2(yDist, xDist); 19466 19467 swipeAngle = Math.round(r * 180 / Math.PI); 19468 if (swipeAngle < 0) { 19469 swipeAngle = 360 - Math.abs(swipeAngle); 19470 } 19471 19472 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 19473 return (_.options.rtl === false ? 'left' : 'right'); 19474 } 19475 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 19476 return (_.options.rtl === false ? 'left' : 'right'); 19477 } 19478 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 19479 return (_.options.rtl === false ? 'right' : 'left'); 19480 } 19481 if (_.options.verticalSwiping === true) { 19482 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 19483 return 'down'; 19484 } else { 19485 return 'up'; 19486 } 19487 } 19488 19489 return 'vertical'; 19490 19491 }; 19492 19493 Slick.prototype.swipeEnd = function(event) { 19494 19495 var _ = this, 19496 slideCount, 19497 direction; 19498 19499 _.dragging = false; 19500 _.swiping = false; 19501 19502 if (_.scrolling) { 19503 _.scrolling = false; 19504 return false; 19505 } 19506 19507 _.interrupted = false; 19508 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 19509 19510 if ( _.touchObject.curX === undefined ) { 19511 return false; 19512 } 19513 19514 if ( _.touchObject.edgeHit === true ) { 19515 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 19516 } 19517 19518 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 19519 19520 direction = _.swipeDirection(); 19521 19522 switch ( direction ) { 19523 19524 case 'left': 19525 case 'down': 19526 19527 slideCount = 19528 _.options.swipeToSlide ? 19529 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 19530 _.currentSlide + _.getSlideCount(); 19531 19532 _.currentDirection = 0; 19533 19534 break; 19535 19536 case 'right': 19537 case 'up': 19538 19539 slideCount =
19540 _.options.swipeToSlide ? 19541 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 19542 _.currentSlide - _.getSlideCount(); 19543 19544 _.currentDirection = 1; 19545 19546 break; 19547 19548 default: 19549 19550 19551 } 19552 19553 if( direction != 'vertical' ) { 19554 19555 _.slideHandler( slideCount ); 19556 _.touchObject = {}; 19557 _.$slider.trigger('swipe', [_, direction ]); 19558 19559 } 19560 19561 } else { 19562 19563 if ( _.touchObject.startX !== _.touchObject.curX ) { 19564 19565 _.slideHandler( _.currentSlide ); 19566 _.touchObject = {}; 19567 19568 } 19569 19570 } 19571 19572 }; 19573 19574 Slick.prototype.swipeHandler = function(event) { 19575 19576 var _ = this; 19577 19578 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 19579 return; 19580 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 19581 return; 19582 } 19583 19584 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 19585 event.originalEvent.touches.length : 1; 19586 19587 _.touchObject.minSwipe = _.listWidth / _.options 19588 .touchThreshold; 19589 19590 if (_.options.verticalSwiping === true) { 19591 _.touchObject.minSwipe = _.listHeight / _.options 19592 .touchThreshold; 19593 } 19594 19595 switch (event.data.action) { 19596 19597 case 'start': 19598 _.swipeStart(event); 19599 break; 19600 19601 case 'move': 19602 _.swipeMove(event); 19603 break; 19604 19605 case 'end': 19606 _.swipeEnd(event); 19607 break; 19608 19609 } 19610 19611 }; 19612 19613 Slick.prototype.swipeMove = function(event) { 19614 19615 var _ = this, 19616 edgeWasHit = false, 19617 curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 19618 19619 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 19620 19621 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 19622 return false; 19623 } 19624 19625 curLeft = _.getLeft(_.currentSlide); 19626 19627 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 19628 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 19629 19630 _.touchObject.swipeLength = Math.round(Math.sqrt( 19631 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 19632 19633 verticalSwipeLength = Math.round(Math.sqrt( 19634 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 19635 19636 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 19637 _.scrolling = true; 19638 return false; 19639 } 19640 19641 if (_.options.verticalSwiping === true) { 19642 _.touchObject.swipeLength = verticalSwipeLength; 19643 } 19644 19645 swipeDirection = _.swipeDirection(); 19646 19647 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 19648 _.swiping = true; 19649 event.preventDefault(); 19650 } 19651 19652 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 19653 if (_.options.verticalSwiping === true) { 19654 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 19655 } 19656 19657 19658 swipeLength = _.touchObject.swipeLength; 19659 19660 _.touchObject.edgeHit = false; 19661 19662 if (_.options.infinite === false) { 19663 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 19664 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 19665 _.touchObject.edgeHit = true; 19666 } 19667 } 19668 19669 if (_.options.vertical === false) { 19670 _.swipeLeft = curLeft + swipeLength * positionOffset; 19671 } else { 19672 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 19673 } 19674 if (_.options.verticalSwiping === true) { 19675 _.swipeLeft = curLeft + swipeLength * positionOffset; 19676 } 19677 19678 if (_.options.fade === true || _.options.touchMove === false) { 19679 return false;
19680 } 19681 19682 if (_.animating === true) { 19683 _.swipeLeft = null; 19684 return false; 19685 } 19686 19687 _.setCSS(_.swipeLeft); 19688 19689 }; 19690 19691 Slick.prototype.swipeStart = function(event) { 19692 19693 var _ = this, 19694 touches; 19695 19696 _.interrupted = true; 19697 19698 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 19699 _.touchObject = {}; 19700 return false; 19701 } 19702 19703 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 19704 touches = event.originalEvent.touches[0]; 19705 } 19706 19707 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 19708 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 19709 19710 _.dragging = true; 19711 19712 }; 19713 19714 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 19715 19716 var _ = this; 19717 19718 if (_.$slidesCache !== null) { 19719 19720 _.unload(); 19721 19722 _.$slideTrack.children(this.options.slide).detach(); 19723 19724 _.$slidesCache.appendTo(_.$slideTrack); 19725 19726 _.reinit(); 19727 19728 } 19729 19730 }; 19731 19732 Slick.prototype.unload = function() { 19733 19734 var _ = this; 19735 19736 $('.slick-cloned', _.$slider).remove(); 19737 19738 if (_.$dots) { 19739 _.$dots.remove(); 19740 } 19741 19742 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 19743 _.$prevArrow.remove(); 19744 } 19745 19746 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 19747 _.$nextArrow.remove(); 19748 } 19749 19750 _.$slides 19751 .removeClass('slick-slide slick-active slick-visible slick-current') 19752 .attr('aria-hidden', 'true') 19753 .css('width', ''); 19754 19755 }; 19756 19757 Slick.prototype.unslick = function(fromBreakpoint) { 19758 19759 var _ = this; 19760 _.$slider.trigger('unslick', [_, fromBreakpoint]); 19761 _.destroy(); 19762 19763 }; 19764 19765 Slick.prototype.updateArrows = function() { 19766 19767 var _ = this, 19768 centerOffset; 19769 19770 centerOffset = Math.floor(_.options.slidesToShow / 2); 19771 19772 if ( _.options.arrows === true && 19773 _.slideCount > _.options.slidesToShow && 19774 !_.options.infinite ) { 19775 19776 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 19777 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 19778 19779 if (_.currentSlide === 0) { 19780 19781 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 19782 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 19783 19784 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 19785 19786 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 19787 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 19788 19789 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 19790 19791 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 19792 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 19793 19794 } 19795 19796 } 19797 19798 }; 19799 19800 Slick.prototype.updateDots = function() { 19801 19802 var _ = this; 19803 19804 if (_.$dots !== null) { 19805 19806 _.$dots 19807 .find('li') 19808 .removeClass('slick-active') 19809 .end(); 19810 19811 _.$dots 19812 .find('li') 19813 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 19814 .addClass('slick-active'); 19815 19816 } 19817 19818 }; 19819 19820 Slick.prototype.visibility = function() { 19821 19822 var _ = this; 19823 19824 if ( _.options.autoplay ) { 19825 19826 if ( document[_.hidden] ) { 19827 19828 _.interrupted = true; 19829 19830 } else { 19831 19832 _.interrupted = false; 19833 19834 } 19835 19836 } 19837 19838 }; 19839 19840 $.fn.slick = function() { 19841 var _ = this, 19842 opt = arguments[0], 19843 args = Array.prototype.slice.call(arguments, 1), 19844 l = _.length, 19845 i, 19846 ret; 19847 for (i = 0; i < l; i++) { 19848 if (typeof opt == 'object' || typeof opt == 'undefined') 19849 _[i].slick = new Slick(_[i], opt); 19850 else 19851 ret = _[i].slick[opt].apply(_[i].slick, args); 19852 if (typeof ret != 'undefined') return ret; 19853 } 19854 return _; 19855 }; 19856 19857}));
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.