vendor: 87 bytes, lines 1-4
1/******/ (() => { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3 4/***/ "./
4resources/js/bootstrap.js": 5/*!***********************************!*\ 6 !*** ./resources/js/bootstrap.js ***! 7 \***********************************/ 8/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 9 10try { 11 window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 12 13 //require('bootstrap-sass'); 14} catch (e) {} 15 16/** 17 * We'll load jQuery and the Bootstrap jQuery plugin which provides support 18 * for JavaScript based Bootstrap features such as modals and tabs. This 19 * code may be modified to fit the specific needs of your application. 20 21 22 try { 23 window.$ = window.jQuery = require('jquery'); 24 25 require('bootstrap-sass'); 26} catch (e) {} 27 */ 28/** 29 * We'll load the axios HTTP library which allows us to easily issue requests 30 * to our Laravel back-end. This library automatically handles sending the 31 * CSRF token as a header based on the value of the "XSRF" token cookie. 32 */ 33 34/** 35 * Next we will register the CSRF Token as a common header with Axios so that 36 * all outgoing HTTP requests automatically have it attached. This is just 37 * a simple convenience so we don't have to attach every token manually. 38 */ 39 40var token = document.head.querySelector('meta[name="csrf-token"]'); 41 42/** 43 * Echo exposes an expressive API for subscribing to channels and listening 44 * for events that are broadcast by Laravel. Echo and event broadcasting 45 * allows your team to easily build robust real-time web applications. 46 */ 47 48// import Echo from 'laravel-echo' 49 50// window.Pusher = require('pusher-js'); 51 52// window.Echo = new Echo({ 53// broadcaster: 'pusher', 54// key: 'your-pusher-key', 55// cluster: 'mt1', 56// encrypted: true 57// }); 58 59/***/ }), 60
61/***/ "./resources/js/main.js": 62/*!******************************!*\ 63 !*** ./resources/js/main.js ***! 64 \******************************/ 65/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 66 67"use strict"; 68__webpack_require__.r(__webpack_exports__); 69/* harmony import */ var lazysizes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lazysizes */ "./node_modules/lazysizes/lazysizes.js"); 70/* harmony import */ var lazysizes__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lazysizes__WEBPACK_IMPORTED_MODULE_0__); 71/* harmony import */ var lazysizes_plugins_parent_fit_ls_parent_fit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lazysizes/plugins/parent-fit/ls.parent-fit */ "./node_modules/lazysizes/plugins/parent-fit/ls.parent-fit.js"); 72/* harmony import */ var lazysizes_plugins_parent_fit_ls_parent_fit__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lazysizes_plugins_parent_fit_ls_parent_fit__WEBPACK_IMPORTED_MODULE_1__); 73__webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js"); 74 75 76window.Swal = __webpack_require__(/*! sweetalert2 */ "./node_modules/sweetalert2/dist/sweetalert2.all.js"), $(document).ready(function () { 77 $.ajaxSetup({ 78 headers: { 79 "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content") 80 } 81 }); 82}), window.owlCarousel = __webpack_require__(/*! owl.carousel */ "./node_modules/owl.carousel/dist/owl.carousel.js"); 83 84/***/ }), 85
vendor: 285,755 bytes, lines 86-10812
86/***/ "./node_modules/jquery/dist/jquery.js": 87/*!********************************************!*\ 88 !*** ./node_modules/jquery/dist/jquery.js ***! 89 \********************************************/ 90/***/ (function(module, exports) { 91 92var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 93 * jQuery JavaScript Library v3.7.1 94 * https://jquery.com/ 95 * 96 * Copyright OpenJS Foundation and other contributors 97 * Released under the MIT license 98 * https://jquery.org/license 99 * 100 * Date: 2023-08-28T13:37Z 101 */ 102( function( global, factory ) { 103 104 "use strict"; 105 106 if ( true && typeof module.exports === "object" ) { 107 108 // For CommonJS and CommonJS-like environments where a proper `window` 109 // is present, execute the factory and get jQuery. 110 // For environments that do not have a `window` with a `document` 111 // (such as Node.js), expose a factory as module.exports. 112 // This accentuates the need for the creation of a real `window`. 113 // e.g. var jQuery = require("jquery")(window); 114 // See ticket trac-14549 for more info. 115 module.exports = global.document ? 116 factory( global, true ) : 117 function( w ) { 118 if ( !w.document ) { 119 throw new Error( "jQuery requires a window with a document" ); 120 } 121 return factory( w ); 122 }; 123 } else { 124 factory( global ); 125 } 126 127// Pass this if window is not defined yet 128} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 129 130// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 131// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 132// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 133// enough that all such attempts are guarded in a try block. 134"use strict"; 135 136var arr = []; 137 138var getProto = Object.getPrototypeOf; 139 140var slice = arr.slice; 141 142var flat = arr.flat ? function( array ) { 143 return arr.flat.call( array ); 144} : function( array ) { 145 return arr.concat.apply( [], array ); 146}; 147 148 149var push = arr.push; 150 151var indexOf = arr.indexOf; 152 153var class2type = {}; 154 155var toString = class2type.toString; 156 157var hasOwn = class2type.hasOwnProperty; 158 159var fnToString = hasOwn.toString; 160 161var ObjectFunctionString = fnToString.call( Object ); 162 163var support = {}; 164 165var isFunction = function isFunction( obj ) { 166 167 // Support: Chrome <=57, Firefox <=52 168 // In some browsers, typeof returns "function" for HTML <object> elements 169 // (i.e., `typeof document.createElement( "object" ) === "function"`). 170 // We don't want to classify *any* DOM node as a function. 171 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 172 // Plus for old WebKit, typeof returns "function" for HTML collections 173 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 174 return typeof obj === "function" && typeof obj.nodeType !== "number" && 175 typeof obj.item !== "function"; 176 }; 177 178 179var isWindow = function isWindow( obj ) { 180 return obj != null && obj === obj.window; 181 }; 182 183 184var document = window.document; 185 186 187 188 var preservedScriptAttributes = { 189 type: true, 190 src: true, 191 nonce: true, 192 noModule: true 193 }; 194 195 function DOMEval( code, node, doc ) { 196 doc = doc || document; 197 198 var i, val, 199 script = doc.createElement( "script" ); 200 201 script.text = code; 202 if ( node ) { 203 for ( i in preservedScriptAttributes ) { 204 205 // Support: Firefox 64+, Edge 18+ 206 // Some browsers don't support the "nonce" property on scripts. 207 // On the other hand, just using `getAttribute` is not enough as 208 // the `nonce` attribute is reset to an empty string whenever it 209 // becomes browsing-context connected. 210 // See https://github.com/whatwg/html/issues/2369 211 // See https://html.spec.whatwg.org/#nonce-attributes 212 // The `node.getAttribute` check was added for the sake of 213 // `jQuery.globalEval` so that it can fake a nonce-containing node 214 // via an object. 215 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 216 if ( val ) { 217 script.setAttribute( i, val ); 218 } 219 } 220 } 221 doc.head.appendChild( script ).parentNode.removeChild( script ); 222 } 223 224 225function toType( obj ) { 226 if ( obj == null ) { 227 return obj + ""; 228 } 229 230 // Support: Android <=2.3 only (functionish RegExp) 231 return typeof obj === "object" || typeof obj === "function" ? 232 class2type[ toString.call( obj ) ] || "object" : 233 typeof obj; 234} 235/* global Symbol */ 236// Defining this global in .eslintrc.json would create a danger of using the global 237// unguarded in another place, it seems safer to define global only for this module 238 239 240 241var version = "3.7.1", 242 243 rhtmlSuffix = /HTML$/i, 244 245 // Define a local copy of jQuery 246 jQuery = function( selector, context ) { 247 248 // The jQuery object is actually just the init constructor 'enhanced' 249 // Need init if jQuery is called (just allow error to be thrown if not included) 250 return new jQuery.fn.init( selector, context ); 251 }; 252 253jQuery.fn = jQuery.prototype = { 254 255 // The current version of jQuery being used 256 jquery: version, 257 258 constructor: jQuery, 259 260 // The default length of a jQuery object is 0 261 length: 0, 262 263 toArray: function() { 264 return slice.call( this ); 265 }, 266 267 // Get the Nth element in the matched element set OR 268 // Get the whole matched element set as a clean array 269 get: function( num ) { 270 271 // Return all the elements in a clean array 272 if ( num == null ) { 273 return slice.call( this ); 274 } 275 276 // Return just the one element from the set 277 return num < 0 ? this[ num + this.length ] : this[ num ]; 278 }, 279 280 // Take an array of elements and push it onto the stack 281 // (returning the new matched element set) 282 pushStack: function( elems ) { 283 284 // Build a new jQuery matched element set 285 var ret = jQuery.merge( this.constructor(), elems ); 286 287 // Add the old object onto the stack (as a reference) 288 ret.prevObject = this; 289 290 // Return the newly-formed element set 291 return ret; 292 }, 293 294 // Execute a callback for every element in the matched set. 295 each: function( callback ) { 296 return jQuery.each( this, callback ); 297 }, 298 299 map: function( callback ) { 300 return this.pushStack( jQuery.map( this, function( elem, i ) { 301 return callback.call( elem, i, elem ); 302 } ) ); 303 }, 304 305 slice: function() { 306 return this.pushStack( slice.apply( this, arguments ) ); 307 }, 308 309 first: function() { 310 return this.eq( 0 ); 311 }, 312 313 last: function() { 314 return this.eq( -1 ); 315 }, 316 317 even: function() { 318 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 319 return ( i + 1 ) % 2; 320 } ) ); 321 }, 322 323 odd: function() { 324 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 325 return i % 2; 326 } ) ); 327 }, 328 329 eq: function( i ) { 330 var len = this.length, 331 j = +i + ( i < 0 ? len : 0 ); 332 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 333 }, 334 335 end: function() { 336 return this.prevObject || this.constructor(); 337 }, 338 339 // For internal use only. 340 // Behaves like an Array's method, not like a jQuery method. 341 push: push, 342 sort: arr.sort, 343 splice: arr.splice 344}; 345 346jQuery.extend = jQuery.fn.extend = function() { 347 var options, name, src, copy, copyIsArray, clone, 348 target = arguments[ 0 ] || {}, 349 i = 1, 350 length = arguments.length, 351 deep = false; 352 353 // Handle a deep copy situation 354 if ( typeof target === "boolean" ) { 355 deep = target; 356 357 // Skip the boolean and the target 358 target = arguments[ i ] || {}; 359 i++; 360 } 361 362 // Handle case when target is a string or something (possible in deep copy) 363 if ( typeof target !== "object" && !isFunction( target ) ) { 364 target = {}; 365 } 366 367 // Extend jQuery itself if only one argument is passed 368 if ( i === length ) { 369 target = this; 370 i--; 371 } 372 373 for ( ; i < length; i++ ) { 374 375 // Only deal with non-null/undefined values 376 if ( ( options = arguments[ i ] ) != null ) { 377 378 // Extend the base object 379 for ( name in options ) { 380 copy = options[ name ]; 381 382 // Prevent Object.prototype pollution 383 // Prevent never-ending loop 384 if ( name === "__proto__" || target === copy ) { 385 continue; 386 } 387 388 // Recurse if we're merging plain objects or arrays 389 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 390 ( copyIsArray = Array.isArray( copy ) ) ) ) { 391 src = target[ name ]; 392 393 // Ensure proper type for the source value 394 if ( copyIsArray && !Array.isArray( src ) ) { 395 clone = []; 396 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 397 clone = {}; 398 } else { 399 clone = src; 400 } 401 copyIsArray = false; 402 403 // Never move original objects, clone them 404 target[ name ] = jQuery.extend( deep, clone, copy ); 405 406 // Don't bring in undefined values 407 } else if ( copy !== undefined ) { 408 target[ name ] = copy; 409 } 410 } 411 } 412 } 413 414 // Return the modified object 415 return target; 416}; 417 418jQuery.extend( { 419 420 // Unique for each copy of jQuery on the page 421 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 422 423 // Assume jQuery is ready without the ready module 424 isReady: true, 425 426 error: function( msg ) { 427 throw new Error( msg ); 428 }, 429 430 noop: function() {}, 431 432 isPlainObject: function( obj ) { 433 var proto, Ctor; 434 435 // Detect obvious negatives 436 // Use toString instead of jQuery.type to catch host objects 437 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 438 return false; 439 } 440 441 proto = getProto( obj ); 442 443 // Objects with no prototype (e.g., `Object.create( null )`) are plain 444 if ( !proto ) { 445 return true; 446 } 447 448 // Objects with prototype are plain iff they were constructed by a global Object function 449 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 450 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 451 }, 452 453 isEmptyObject: function( obj ) { 454 var name; 455 456 for ( name in obj ) { 457 return false; 458 } 459 return true; 460 }, 461 462 // Evaluates a script in a provided context; falls back to the global one 463 // if not specified. 464 globalEval: function( code, options, doc ) { 465 DOMEval( code, { nonce: options && options.nonce }, doc ); 466 }, 467 468 each: function( obj, callback ) { 469 var length, i = 0; 470 471 if ( isArrayLike( obj ) ) { 472 length = obj.length; 473 for ( ; i < length; i++ ) { 474 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 475 break; 476 } 477 } 478 } else { 479 for ( i in obj ) { 480 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 481 break; 482 } 483 } 484 } 485 486 return obj; 487 }, 488 489 490 // Retrieve the text value of an array of DOM nodes 491 text: function( elem ) { 492 var node, 493 ret = "", 494 i = 0, 495 nodeType = elem.nodeType; 496 497 if ( !nodeType ) { 498 499 // If no nodeType, this is expected to be an array 500 while ( ( node = elem[ i++ ] ) ) { 501 502 // Do not traverse comment nodes 503 ret += jQuery.text( node ); 504 } 505 } 506 if ( nodeType === 1 || nodeType === 11 ) { 507 return elem.textContent; 508 } 509 if ( nodeType === 9 ) { 510 return elem.documentElement.textContent; 511 } 512 if ( nodeType === 3 || nodeType === 4 ) { 513 return elem.nodeValue; 514 } 515 516 // Do not include comment or processing instruction nodes 517 518 return ret; 519 }, 520 521 // results is for internal usage only 522 makeArray: function( arr, results ) { 523 var ret = results || []; 524 525 if ( arr != null ) { 526 if ( isArrayLike( Object( arr ) ) ) { 527 jQuery.merge( ret, 528 typeof arr === "string" ? 529 [ arr ] : arr 530 ); 531 } else { 532 push.call( ret, arr ); 533 } 534 } 535 536 return ret; 537 }, 538 539 inArray: function( elem, arr, i ) { 540 return arr == null ? -1 : indexOf.call( arr, elem, i ); 541 }, 542 543 isXMLDoc: function( elem ) { 544 var namespace = elem && elem.namespaceURI, 545 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 546 547 // Assume HTML when documentElement doesn't yet exist, such as inside 548 // document fragments. 549 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); 550 }, 551 552 // Support: Android <=4.0 only, PhantomJS 1 only 553 // push.apply(_, arraylike) throws on ancient WebKit 554 merge: function( first, second ) { 555 var len = +second.length, 556 j = 0, 557 i = first.length; 558 559 for ( ; j < len; j++ ) { 560 first[ i++ ] = second[ j ]; 561 } 562 563 first.length = i; 564 565 return first; 566 }, 567 568 grep: function( elems, callback, invert ) { 569 var callbackInverse, 570 matches = [], 571 i = 0, 572 length = elems.length, 573 callbackExpect = !invert; 574 575 // Go through the array, only saving the items 576 // that pass the validator function 577 for ( ; i < length; i++ ) { 578 callbackInverse = !callback( elems[ i ], i ); 579 if ( callbackInverse !== callbackExpect ) { 580 matches.push( elems[ i ] ); 581 } 582 } 583 584 return matches; 585 }, 586 587 // arg is for internal usage only 588 map: function( elems, callback, arg ) { 589 var length, value, 590 i = 0, 591 ret = []; 592 593 // Go through the array, translating each of the items to their new values 594 if ( isArrayLike( elems ) ) { 595 length = elems.length; 596 for ( ; i < length; i++ ) { 597 value = callback( elems[ i ], i, arg ); 598 599 if ( value != null ) { 600 ret.push( value ); 601 } 602 } 603 604 // Go through every key on the object, 605 } else { 606 for ( i in elems ) { 607 value = callback( elems[ i ], i, arg ); 608 609 if ( value != null ) { 610 ret.push( value ); 611 } 612 } 613 } 614 615 // Flatten any nested arrays 616 return flat( ret ); 617 }, 618 619 // A global GUID counter for objects 620 guid: 1, 621 622 // jQuery.support is not used in Core but other projects attach their 623 // properties to it so it needs to exist. 624 support: support 625} ); 626 627if ( typeof Symbol === "function" ) { 628 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 629} 630 631// Populate the class2type map 632jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 633 function( _i, name ) { 634 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 635 } ); 636 637function isArrayLike( obj ) { 638 639 // Support: real iOS 8.2 only (not reproducible in simulator) 640 // `in` check used to prevent JIT error (gh-2145) 641 // hasOwn isn't used here due to false negatives 642 // regarding Nodelist length in IE 643 var length = !!obj && "length" in obj && obj.length, 644 type = toType( obj ); 645 646 if ( isFunction( obj ) || isWindow( obj ) ) { 647 return false; 648 } 649 650 return type === "array" || length === 0 || 651 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 652} 653 654 655function nodeName( elem, name ) { 656 657 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 658 659} 660var pop = arr.pop; 661 662 663var sort = arr.sort; 664 665 666var splice = arr.splice; 667 668 669var whitespace = "[\\x20\\t\\r\\n\\f]"; 670 671 672var rtrimCSS = new RegExp( 673 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 674 "g" 675); 676 677 678 679 680// Note: an element does not contain itself 681jQuery.contains = function( a, b ) { 682 var bup = b && b.parentNode; 683 684 return a === bup || !!( bup && bup.nodeType === 1 && ( 685 686 // Support: IE 9 - 11+ 687 // IE doesn't have `contains` on SVG. 688 a.contains ? 689 a.contains( bup ) : 690 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 691 ) ); 692}; 693 694 695 696 697// CSS string/identifier serialization 698// https://drafts.csswg.org/cssom/#common-serializing-idioms 699var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 700 701function fcssescape( ch, asCodePoint ) { 702 if ( asCodePoint ) { 703 704 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 705 if ( ch === "\0" ) { 706 return "\uFFFD"; 707 } 708 709 // Control characters and (dependent upon position) numbers get escaped as code points 710 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 711 } 712 713 // Other potentially-special ASCII characters get backslash-escaped 714 return "\\" + ch; 715} 716 717jQuery.escapeSelector = function( sel ) { 718 return ( sel + "" ).replace( rcssescape, fcssescape ); 719}; 720 721 722 723 724var preferredDoc = document, 725 pushNative = push; 726 727( function() { 728 729var i, 730 Expr, 731 outermostContext, 732 sortInput, 733 hasDuplicate, 734 push = pushNative, 735 736 // Local document vars 737 document, 738 documentElement, 739 documentIsHTML, 740 rbuggyQSA, 741 matches, 742 743 // Instance-specific data 744 expando = jQuery.expando, 745 dirruns = 0, 746 done = 0, 747 classCache = createCache(), 748 tokenCache = createCache(), 749 compilerCache = createCache(), 750 nonnativeSelectorCache = createCache(), 751 sortOrder = function( a, b ) { 752 if ( a === b ) { 753 hasDuplicate = true; 754 } 755 return 0; 756 }, 757 758 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + 759 "loop|multiple|open|readonly|required|scoped", 760 761 // Regular expressions 762 763 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 764 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 765 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 766 767 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors 768 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 769 770 // Operator (capture 2) 771 "*([*^$|!~]?=)" + whitespace + 772 773 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 774 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 775 whitespace + "*\\]", 776 777 pseudos = ":(" + identifier + ")(?:\\((" + 778 779 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 780 // 1. quoted (capture 3; capture 4 or capture 5) 781 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 782 783 // 2. simple (capture 6) 784 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 785 786 // 3. anything else (capture 2) 787 ".*" + 788 ")\\)|)", 789 790 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 791 rwhitespace = new RegExp( whitespace + "+", "g" ), 792 793 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 794 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + 795 whitespace + "*" ), 796 rdescend = new RegExp( whitespace + "|>" ), 797 798 rpseudo = new RegExp( pseudos ), 799 ridentifier = new RegExp( "^" + identifier + "$" ), 800 801 matchExpr = { 802 ID: new RegExp( "^#(" + identifier + ")" ), 803 CLASS: new RegExp( "^\\.(" + identifier + ")" ), 804 TAG: new RegExp( "^(" + identifier + "|[*])" ), 805 ATTR: new RegExp( "^" + attributes ), 806 PSEUDO: new RegExp( "^" + pseudos ), 807 CHILD: new RegExp( 808 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 809 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 810 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 811 bool: new RegExp( "^(?:" + booleans + ")$", "i" ), 812 813 // For use in libraries implementing .is() 814 // We use this for POS matching in `select` 815 needsContext: new RegExp( "^" + whitespace + 816 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 817 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 818 }, 819 820 rinputs = /^(?:input|select|textarea|button)$/i, 821 rheader = /^h\d$/i, 822 823 // Easily-parseable/retrievable ID or TAG or CLASS selectors 824 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 825 826 rsibling = /[+~]/, 827 828 // CSS escapes 829 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters 830 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + 831 "?|\\\\([^\\r\\n\\f])", "g" ), 832 funescape = function( escape, nonHex ) { 833 var high = "0x" + escape.slice( 1 ) - 0x10000; 834 835 if ( nonHex ) { 836 837 // Strip the backslash prefix from a non-hex escape sequence 838 return nonHex; 839 } 840 841 // Replace a hexadecimal escape sequence with the encoded Unicode code point 842 // Support: IE <=11+ 843 // For values outside the Basic Multilingual Plane (BMP), manually construct a 844 // surrogate pair 845 return high < 0 ? 846 String.fromCharCode( high + 0x10000 ) : 847 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 848 }, 849 850 // Used for iframes; see `setDocument`. 851 // Support: IE 9 - 11+, Edge 12 - 18+ 852 // Removing the function wrapper causes a "Permission Denied" 853 // error in IE/Edge. 854 unloadHandler = function() { 855 setDocument(); 856 }, 857 858 inDisabledFieldset = addCombinator( 859 function( elem ) { 860 return elem.disabled === true && nodeName( elem, "fieldset" ); 861 }, 862 { dir: "parentNode", next: "legend" } 863 ); 864 865// Support: IE <=9 only 866// Accessing document.activeElement can throw unexpectedly 867// https://bugs.jquery.com/ticket/13393 868function safeActiveElement() { 869 try { 870 return document.activeElement; 871 } catch ( err ) { } 872} 873 874// Optimize for push.apply( _, NodeList ) 875try { 876 push.apply( 877 ( arr = slice.call( preferredDoc.childNodes ) ), 878 preferredDoc.childNodes 879 ); 880 881 // Support: Android <=4.0 882 // Detect silently failing push.apply 883 // eslint-disable-next-line no-unused-expressions 884 arr[ preferredDoc.childNodes.length ].nodeType; 885} catch ( e ) { 886 push = { 887 apply: function( target, els ) { 888 pushNative.apply( target, slice.call( els ) ); 889 }, 890 call: function( target ) { 891 pushNative.apply( target, slice.call( arguments, 1 ) ); 892 } 893 }; 894} 895 896function find( selector, context, results, seed ) { 897 var m, i, elem, nid, match, groups, newSelector, 898 newContext = context && context.ownerDocument, 899 900 // nodeType defaults to 9, since context defaults to document 901 nodeType = context ? context.nodeType : 9; 902 903 results = results || []; 904 905 // Return early from calls with invalid selector or context 906 if ( typeof selector !== "string" || !selector || 907 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 908 909 return results; 910 } 911 912 // Try to shortcut find operations (as opposed to filters) in HTML documents 913 if ( !seed ) { 914 setDocument( context ); 915 context = context || document; 916 917 if ( documentIsHTML ) { 918 919 // If the selector is sufficiently simple, try using a "get*By*" DOM method 920 // (excepting DocumentFragment context, where the methods don't exist) 921 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 922 923 // ID selector 924 if ( ( m = match[ 1 ] ) ) { 925 926 // Document context 927 if ( nodeType === 9 ) { 928 if ( ( elem = context.getElementById( m ) ) ) { 929 930 // Support: IE 9 only 931 // getElementById can match elements by name instead of ID 932 if ( elem.id === m ) { 933 push.call( results, elem ); 934 return results; 935 } 936 } else { 937 return results; 938 } 939 940 // Element context 941 } else { 942 943 // Support: IE 9 only 944 // getElementById can match elements by name instead of ID 945 if ( newContext && ( elem = newContext.getElementById( m ) ) && 946 find.contains( context, elem ) && 947 elem.id === m ) { 948 949 push.call( results, elem ); 950 return results; 951 } 952 } 953 954 // Type selector 955 } else if ( match[ 2 ] ) { 956 push.apply( results, context.getElementsByTagName( selector ) ); 957 return results; 958 959 // Class selector 960 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { 961 push.apply( results, context.getElementsByClassName( m ) ); 962 return results; 963 } 964 } 965 966 // Take advantage of querySelectorAll 967 if ( !nonnativeSelectorCache[ selector + " " ] && 968 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { 969 970 newSelector = selector; 971 newContext = context; 972 973 // qSA considers elements outside a scoping root when evaluating child or 974 // descendant combinators, which is not what we want. 975 // In such cases, we work around the behavior by prefixing every selector in the 976 // list with an ID selector referencing the scope context. 977 // The technique has to be used as well when a leading combinator is used 978 // as such selectors are not recognized by querySelectorAll. 979 // Thanks to Andrew Dupont for this technique. 980 if ( nodeType === 1 && 981 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { 982 983 // Expand context for sibling selectors 984 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 985 context; 986 987 // We can use :scope instead of the ID hack if the browser 988 // supports it & if we're not changing the context. 989 // Support: IE 11+, Edge 17 - 18+ 990 // IE/Edge sometimes throw a "Permission denied" error when 991 // strict-comparing two documents; shallow comparisons work. 992 // eslint-disable-next-line eqeqeq 993 if ( newContext != context || !support.scope ) { 994 995 // Capture the context ID, setting it first if necessary 996 if ( ( nid = context.getAttribute( "id" ) ) ) { 997 nid = jQuery.escapeSelector( nid ); 998 } else { 999 context.setAttribute( "id", ( nid = expando ) ); 1000 } 1001 } 1002 1003 // Prefix every selector in the list 1004 groups = tokenize( selector ); 1005 i = groups.length; 1006 while ( i-- ) { 1007 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 1008 toSelector( groups[ i ] ); 1009 } 1010 newSelector = groups.join( "," ); 1011 } 1012 1013 try { 1014 push.apply( results, 1015 newContext.querySelectorAll( newSelector ) 1016 ); 1017 return results; 1018 } catch ( qsaError ) { 1019 nonnativeSelectorCache( selector, true ); 1020 } finally { 1021 if ( nid === expando ) { 1022 context.removeAttribute( "id" ); 1023 } 1024 } 1025 } 1026 } 1027 } 1028 1029 // All others 1030 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); 1031} 1032 1033/** 1034 * Create key-value caches of limited size 1035 * @returns {function(string, object)} Returns the Object data after storing it on itself with 1036 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 1037 * deleting the oldest entry 1038 */ 1039function createCache() { 1040 var keys = []; 1041 1042 function cache( key, value ) { 1043 1044 // Use (key + " ") to avoid collision with native prototype properties 1045 // (see https://github.com/jquery/sizzle/issues/157) 1046 if ( keys.push( key + " " ) > Expr.cacheLength ) { 1047 1048 // Only keep the most recent entries 1049 delete cache[ keys.shift() ]; 1050 } 1051 return ( cache[ key + " " ] = value ); 1052 } 1053 return cache; 1054} 1055 1056/** 1057 * Mark a function for special use by jQuery selector module 1058 * @param {Function} fn The function to mark 1059 */ 1060function markFunction( fn ) { 1061 fn[ expando ] = true; 1062 return fn; 1063} 1064 1065/** 1066 * Support testing using an element 1067 * @param {Function} fn Passed the created element and returns a boolean result 1068 */ 1069function assert( fn ) { 1070 var el = document.createElement( "fieldset" ); 1071 1072 try { 1073 return !!fn( el ); 1074 } catch ( e ) { 1075 return false; 1076 } finally { 1077 1078 // Remove from its parent by default 1079 if ( el.parentNode ) { 1080 el.parentNode.removeChild( el ); 1081 } 1082 1083 // release memory in IE 1084 el = null; 1085 } 1086} 1087 1088/** 1089 * Returns a function to use in pseudos for input types 1090 * @param {String} type 1091 */ 1092function createInputPseudo( type ) { 1093 return function( elem ) { 1094 return nodeName( elem, "input" ) && elem.type === type; 1095 }; 1096} 1097 1098/** 1099 * Returns a function to use in pseudos for buttons 1100 * @param {String} type 1101 */ 1102function createButtonPseudo( type ) { 1103 return function( elem ) { 1104 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && 1105 elem.type === type; 1106 }; 1107} 1108 1109/** 1110 * Returns a function to use in pseudos for :enabled/:disabled 1111 * @param {Boolean} disabled true for :disabled; false for :enabled 1112 */ 1113function createDisabledPseudo( disabled ) { 1114 1115 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 1116 return function( elem ) { 1117 1118 // Only certain elements can match :enabled or :disabled 1119 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 1120 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 1121 if ( "form" in elem ) { 1122 1123 // Check for inherited disabledness on relevant non-disabled elements: 1124 // * listed form-associated elements in a disabled fieldset 1125 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 1126 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 1127 // * option elements in a disabled optgroup 1128 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 1129 // All such elements have a "form" property. 1130 if ( elem.parentNode && elem.disabled === false ) { 1131 1132 // Option elements defer to a parent optgroup if present 1133 if ( "label" in elem ) { 1134 if ( "label" in elem.parentNode ) { 1135 return elem.parentNode.disabled === disabled; 1136 } else { 1137 return elem.disabled === disabled; 1138 } 1139 } 1140 1141 // Support: IE 6 - 11+ 1142 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1143 return elem.isDisabled === disabled || 1144 1145 // Where there is no isDisabled, check manually 1146 elem.isDisabled !== !disabled && 1147 inDisabledFieldset( elem ) === disabled; 1148 } 1149 1150 return elem.disabled === disabled; 1151 1152 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1153 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1154 // even exist on them, let alone have a boolean value. 1155 } else if ( "label" in elem ) { 1156 return elem.disabled === disabled; 1157 } 1158 1159 // Remaining elements are neither :enabled nor :disabled 1160 return false; 1161 }; 1162} 1163 1164/** 1165 * Returns a function to use in pseudos for positionals 1166 * @param {Function} fn 1167 */ 1168function createPositionalPseudo( fn ) { 1169 return markFunction( function( argument ) { 1170 argument = +argument; 1171 return markFunction( function( seed, matches ) { 1172 var j, 1173 matchIndexes = fn( [], seed.length, argument ), 1174 i = matchIndexes.length; 1175 1176 // Match elements found at the specified indexes 1177 while ( i-- ) { 1178 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 1179 seed[ j ] = !( matches[ j ] = seed[ j ] ); 1180 } 1181 } 1182 } ); 1183 } ); 1184} 1185 1186/** 1187 * Checks a node for validity as a jQuery selector context 1188 * @param {Element|Object=} context 1189 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1190 */ 1191function testContext( context ) { 1192 return context && typeof context.getElementsByTagName !== "undefined" && context; 1193} 1194 1195/** 1196 * Sets document-related variables once based on the current document 1197 * @param {Element|Object} [node] An element or document object to use to set the document 1198 * @returns {Object} Returns the current document 1199 */ 1200function setDocument( node ) { 1201 var subWindow, 1202 doc = node ? node.ownerDocument || node : preferredDoc; 1203 1204 // Return early if doc is invalid or already selected 1205 // Support: IE 11+, Edge 17 - 18+ 1206 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1207 // two documents; shallow comparisons work. 1208 // eslint-disable-next-line eqeqeq 1209 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 1210 return document; 1211 } 1212 1213 // Update global variables 1214 document = doc; 1215 documentElement = document.documentElement; 1216 documentIsHTML = !jQuery.isXMLDoc( document ); 1217 1218 // Support: iOS 7 only, IE 9 - 11+ 1219 // Older browsers didn't support unprefixed `matches`. 1220 matches = documentElement.matches || 1221 documentElement.webkitMatchesSelector || 1222 documentElement.msMatchesSelector; 1223 1224 // Support: IE 9 - 11+, Edge 12 - 18+ 1225 // Accessing iframe documents after unload throws "permission denied" errors 1226 // (see trac-13936). 1227 // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, 1228 // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. 1229 if ( documentElement.msMatchesSelector && 1230 1231 // Support: IE 11+, Edge 17 - 18+ 1232 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1233 // two documents; shallow comparisons work. 1234 // eslint-disable-next-line eqeqeq 1235 preferredDoc != document && 1236 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 1237 1238 // Support: IE 9 - 11+, Edge 12 - 18+ 1239 subWindow.addEventListener( "unload", unloadHandler ); 1240 } 1241 1242 // Support: IE <10 1243 // Check if getElementById returns elements by name 1244 // The broken getElementById methods don't pick up programmatically-set names, 1245 // so use a roundabout getElementsByName test 1246 support.getById = assert( function( el ) { 1247 documentElement.appendChild( el ).id = jQuery.expando; 1248 return !document.getElementsByName || 1249 !document.getElementsByName( jQuery.expando ).length; 1250 } ); 1251 1252 // Support: IE 9 only 1253 // Check to see if it's possible to do matchesSelector 1254 // on a disconnected node. 1255 support.disconnectedMatch = assert( function( el ) { 1256 return matches.call( el, "*" ); 1257 } ); 1258 1259 // Support: IE 9 - 11+, Edge 12 - 18+ 1260 // IE/Edge don't support the :scope pseudo-class. 1261 support.scope = assert( function() { 1262 return document.querySelectorAll( ":scope" ); 1263 } ); 1264 1265 // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only 1266 // Make sure the `:has()` argument is parsed unforgivingly. 1267 // We include `*` in the test to detect buggy implementations that are 1268 // _selectively_ forgiving (specifically when the list includes at least 1269 // one valid selector). 1270 // Note that we treat complete lack of support for `:has()` as if it were 1271 // spec-compliant support, which is fine because use of `:has()` in such 1272 // environments will fail in the qSA path and fall back to jQuery traversal 1273 // anyway. 1274 support.cssHas = assert( function() { 1275 try { 1276 document.querySelector( ":has(*,:jqfake)" ); 1277 return false; 1278 } catch ( e ) { 1279 return true; 1280 } 1281 } ); 1282 1283 // ID filter and find 1284 if ( support.getById ) { 1285 Expr.filter.ID = function( id ) { 1286 var attrId = id.replace( runescape, funescape ); 1287 return function( elem ) { 1288 return elem.getAttribute( "id" ) === attrId; 1289 }; 1290 }; 1291 Expr.find.ID = function( id, context ) { 1292 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1293 var elem = context.getElementById( id ); 1294 return elem ? [ elem ] : []; 1295 } 1296 }; 1297 } else { 1298 Expr.filter.ID = function( id ) { 1299 var attrId = id.replace( runescape, funescape ); 1300 return function( elem ) { 1301 var node = typeof elem.getAttributeNode !== "undefined" && 1302 elem.getAttributeNode( "id" ); 1303 return node && node.value === attrId; 1304 }; 1305 }; 1306 1307 // Support: IE 6 - 7 only 1308 // getElementById is not reliable as a find shortcut 1309 Expr.find.ID = function( id, context ) { 1310 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1311 var node, i, elems, 1312 elem = context.getElementById( id ); 1313 1314 if ( elem ) { 1315 1316 // Verify the id attribute 1317 node = elem.getAttributeNode( "id" ); 1318 if ( node && node.value === id ) { 1319 return [ elem ]; 1320 } 1321 1322 // Fall back on getElementsByName 1323 elems = context.getElementsByName( id ); 1324 i = 0; 1325 while ( ( elem = elems[ i++ ] ) ) { 1326 node = elem.getAttributeNode( "id" ); 1327 if ( node && node.value === id ) { 1328 return [ elem ]; 1329 } 1330 } 1331 } 1332 1333 return []; 1334 } 1335 }; 1336 } 1337 1338 // Tag 1339 Expr.find.TAG = function( tag, context ) { 1340 if ( typeof context.getElementsByTagName !== "undefined" ) { 1341 return context.getElementsByTagName( tag ); 1342 1343 // DocumentFragment nodes don't have gEBTN 1344 } else { 1345 return context.querySelectorAll( tag ); 1346 } 1347 }; 1348 1349 // Class 1350 Expr.find.CLASS = function( className, context ) { 1351 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1352 return context.getElementsByClassName( className ); 1353 } 1354 }; 1355 1356 /* QSA/matchesSelector 1357 ---------------------------------------------------------------------- */ 1358 1359 // QSA and matchesSelector support 1360 1361 rbuggyQSA = []; 1362 1363 // Build QSA regex 1364 // Regex strategy adopted from Diego Perini 1365 assert( function( el ) { 1366 1367 var input; 1368 1369 documentElement.appendChild( el ).innerHTML = 1370 "<a id='" + expando + "' href='' disabled='disabled'></a>" + 1371 "<select id='" + expando + "-\r\\' disabled='disabled'>" + 1372 "<option selected=''></option></select>"; 1373 1374 // Support: iOS <=7 - 8 only 1375 // Boolean attributes and "value" are not treated correctly in some XML documents 1376 if ( !el.querySelectorAll( "[selected]" ).length ) { 1377 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1378 } 1379 1380 // Support: iOS <=7 - 8 only 1381 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1382 rbuggyQSA.push( "~=" ); 1383 } 1384 1385 // Support: iOS 8 only 1386 // https://bugs.webkit.org/show_bug.cgi?id=136851 1387 // In-page `selector#id sibling-combinator selector` fails 1388 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1389 rbuggyQSA.push( ".#.+[+~]" ); 1390 } 1391 1392 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 1393 // In some of the document kinds, these selectors wouldn't work natively. 1394 // This is probably OK but for backwards compatibility we want to maintain 1395 // handling them through jQuery traversal in jQuery 3.x. 1396 if ( !el.querySelectorAll( ":checked" ).length ) { 1397 rbuggyQSA.push( ":checked" ); 1398 } 1399 1400 // Support: Windows 8 Native Apps 1401 // The type and name attributes are restricted during .innerHTML assignment 1402 input = document.createElement( "input" ); 1403 input.setAttribute( "type", "hidden" ); 1404 el.appendChild( input ).setAttribute( "name", "D" ); 1405 1406 // Support: IE 9 - 11+ 1407 // IE's :disabled selector does not pick up the children of disabled fieldsets 1408 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 1409 // In some of the document kinds, these selectors wouldn't work natively. 1410 // This is probably OK but for backwards compatibility we want to maintain 1411 // handling them through jQuery traversal in jQuery 3.x. 1412 documentElement.appendChild( el ).disabled = true; 1413 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 1414 rbuggyQSA.push( ":enabled", ":disabled" ); 1415 } 1416 1417 // Support: IE 11+, Edge 15 - 18+ 1418 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 1419 // Adding a temporary attribute to the document before the selection works 1420 // around the issue. 1421 // Interestingly, IE 10 & older don't seem to have the issue. 1422 input = document.createElement( "input" ); 1423 input.setAttribute( "name", "" ); 1424 el.appendChild( input ); 1425 if ( !el.querySelectorAll( "[name='']" ).length ) { 1426 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 1427 whitespace + "*(?:''|\"\")" ); 1428 } 1429 } ); 1430 1431 if ( !support.cssHas ) { 1432 1433 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 1434 // Our regular `try-catch` mechanism fails to detect natively-unsupported 1435 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) 1436 // in browsers that parse the `:has()` argument as a forgiving selector list. 1437 // https://drafts.csswg.org/selectors/#relational now requires the argument 1438 // to be parsed unforgivingly, but browsers have not yet fully adjusted. 1439 rbuggyQSA.push( ":has" ); 1440 } 1441 1442 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 1443 1444 /* Sorting 1445 ---------------------------------------------------------------------- */ 1446 1447 // Document order sorting 1448 sortOrder = function( a, b ) { 1449 1450 // Flag for duplicate removal 1451 if ( a === b ) { 1452 hasDuplicate = true; 1453 return 0; 1454 } 1455 1456 // Sort on method existence if only one input has compareDocumentPosition 1457 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1458 if ( compare ) { 1459 return compare; 1460 } 1461 1462 // Calculate position if both inputs belong to the same document 1463 // Support: IE 11+, Edge 17 - 18+ 1464 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1465 // two documents; shallow comparisons work. 1466 // eslint-disable-next-line eqeqeq 1467 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 1468 a.compareDocumentPosition( b ) : 1469 1470 // Otherwise we know they are disconnected 1471 1; 1472 1473 // Disconnected nodes 1474 if ( compare & 1 || 1475 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 1476 1477 // Choose the first element that is related to our preferred document 1478 // Support: IE 11+, Edge 17 - 18+ 1479 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1480 // two documents; shallow comparisons work. 1481 // eslint-disable-next-line eqeqeq 1482 if ( a === document || a.ownerDocument == preferredDoc && 1483 find.contains( preferredDoc, a ) ) { 1484 return -1; 1485 } 1486 1487 // Support: IE 11+, Edge 17 - 18+ 1488 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1489 // two documents; shallow comparisons work. 1490 // eslint-disable-next-line eqeqeq 1491 if ( b === document || b.ownerDocument == preferredDoc && 1492 find.contains( preferredDoc, b ) ) { 1493 return 1; 1494 } 1495 1496 // Maintain original order 1497 return sortInput ? 1498 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 1499 0; 1500 } 1501 1502 return compare & 4 ? -1 : 1; 1503 }; 1504 1505 return document; 1506} 1507 1508find.matches = function( expr, elements ) { 1509 return find( expr, null, null, elements ); 1510}; 1511 1512find.matchesSelector = function( elem, expr ) { 1513 setDocument( elem ); 1514 1515 if ( documentIsHTML && 1516 !nonnativeSelectorCache[ expr + " " ] && 1517 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1518 1519 try { 1520 var ret = matches.call( elem, expr ); 1521 1522 // IE 9's matchesSelector returns false on disconnected nodes 1523 if ( ret || support.disconnectedMatch || 1524 1525 // As well, disconnected nodes are said to be in a document 1526 // fragment in IE 9 1527 elem.document && elem.document.nodeType !== 11 ) { 1528 return ret; 1529 } 1530 } catch ( e ) { 1531 nonnativeSelectorCache( expr, true ); 1532 } 1533 } 1534 1535 return find( expr, document, null, [ elem ] ).length > 0; 1536}; 1537 1538find.contains = function( context, elem ) { 1539 1540 // Set document vars if needed 1541 // Support: IE 11+, Edge 17 - 18+ 1542 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1543 // two documents; shallow comparisons work. 1544 // eslint-disable-next-line eqeqeq 1545 if ( ( context.ownerDocument || context ) != document ) { 1546 setDocument( context ); 1547 } 1548 return jQuery.contains( context, elem ); 1549}; 1550 1551 1552find.attr = function( elem, name ) { 1553 1554 // Set document vars if needed 1555 // Support: IE 11+, Edge 17 - 18+ 1556 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1557 // two documents; shallow comparisons work. 1558 // eslint-disable-next-line eqeqeq 1559 if ( ( elem.ownerDocument || elem ) != document ) { 1560 setDocument( elem ); 1561 } 1562 1563 var fn = Expr.attrHandle[ name.toLowerCase() ], 1564 1565 // Don't get fooled by Object.prototype properties (see trac-13807) 1566 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1567 fn( elem, name, !documentIsHTML ) : 1568 undefined; 1569 1570 if ( val !== undefined ) { 1571 return val; 1572 } 1573 1574 return elem.getAttribute( name ); 1575}; 1576 1577find.error = function( msg ) { 1578 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1579}; 1580 1581/** 1582 * Document sorting and removing duplicates 1583 * @param {ArrayLike} results 1584 */ 1585jQuery.uniqueSort = function( results ) { 1586 var elem, 1587 duplicates = [], 1588 j = 0, 1589 i = 0; 1590 1591 // Unless we *know* we can detect duplicates, assume their presence 1592 // 1593 // Support: Android <=4.0+ 1594 // Testing for detecting duplicates is unpredictable so instead assume we can't 1595 // depend on duplicate detection in all browsers without a stable sort. 1596 hasDuplicate = !support.sortStable; 1597 sortInput = !support.sortStable && slice.call( results, 0 ); 1598 sort.call( results, sortOrder ); 1599 1600 if ( hasDuplicate ) { 1601 while ( ( elem = results[ i++ ] ) ) { 1602 if ( elem === results[ i ] ) { 1603 j = duplicates.push( i ); 1604 } 1605 } 1606 while ( j-- ) { 1607 splice.call( results, duplicates[ j ], 1 ); 1608 } 1609 } 1610 1611 // Clear input after sorting to release objects 1612 // See https://github.com/jquery/sizzle/pull/225 1613 sortInput = null; 1614 1615 return results; 1616}; 1617 1618jQuery.fn.uniqueSort = function() { 1619 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); 1620}; 1621 1622Expr = jQuery.expr = { 1623 1624 // Can be adjusted by the user 1625 cacheLength: 50, 1626 1627 createPseudo: markFunction, 1628 1629 match: matchExpr, 1630 1631 attrHandle: {}, 1632 1633 find: {}, 1634 1635 relative: { 1636 ">": { dir: "parentNode", first: true }, 1637 " ": { dir: "parentNode" }, 1638 "+": { dir: "previousSibling", first: true }, 1639 "~": { dir: "previousSibling" } 1640 }, 1641 1642 preFilter: { 1643 ATTR: function( match ) { 1644 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 1645 1646 // Move the given value to match[3] whether quoted or unquoted 1647 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) 1648 .replace( runescape, funescape ); 1649 1650 if ( match[ 2 ] === "~=" ) { 1651 match[ 3 ] = " " + match[ 3 ] + " "; 1652 } 1653 1654 return match.slice( 0, 4 ); 1655 }, 1656 1657 CHILD: function( match ) { 1658 1659 /* matches from matchExpr["CHILD"] 1660 1 type (only|nth|...) 1661 2 what (child|of-type) 1662 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1663 4 xn-component of xn+y argument ([+-]?\d*n|) 1664 5 sign of xn-component 1665 6 x of xn-component 1666 7 sign of y-component 1667 8 y of y-component 1668 */ 1669 match[ 1 ] = match[ 1 ].toLowerCase(); 1670 1671 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 1672 1673 // nth-* requires argument 1674 if ( !match[ 3 ] ) { 1675 find.error( match[ 0 ] ); 1676 } 1677 1678 // numeric x and y parameters for Expr.filter.CHILD 1679 // remember that false/true cast respectively to 0/1 1680 match[ 4 ] = +( match[ 4 ] ? 1681 match[ 5 ] + ( match[ 6 ] || 1 ) : 1682 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) 1683 ); 1684 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 1685 1686 // other types prohibit arguments 1687 } else if ( match[ 3 ] ) { 1688 find.error( match[ 0 ] ); 1689 } 1690 1691 return match; 1692 }, 1693 1694 PSEUDO: function( match ) { 1695 var excess, 1696 unquoted = !match[ 6 ] && match[ 2 ]; 1697 1698 if ( matchExpr.CHILD.test( match[ 0 ] ) ) { 1699 return null; 1700 } 1701 1702 // Accept quoted arguments as-is 1703 if ( match[ 3 ] ) { 1704 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 1705 1706 // Strip excess characters from unquoted arguments 1707 } else if ( unquoted && rpseudo.test( unquoted ) && 1708 1709 // Get excess from tokenize (recursively) 1710 ( excess = tokenize( unquoted, true ) ) && 1711 1712 // advance to the next closing parenthesis 1713 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 1714 1715 // excess is a negative index 1716 match[ 0 ] = match[ 0 ].slice( 0, excess ); 1717 match[ 2 ] = unquoted.slice( 0, excess ); 1718 } 1719 1720 // Return only captures needed by the pseudo filter method (type and argument) 1721 return match.slice( 0, 3 ); 1722 } 1723 }, 1724 1725 filter: { 1726 1727 TAG: function( nodeNameSelector ) { 1728 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1729 return nodeNameSelector === "*" ? 1730 function() { 1731 return true; 1732 } : 1733 function( elem ) { 1734 return nodeName( elem, expectedNodeName ); 1735 }; 1736 }, 1737 1738 CLASS: function( className ) { 1739 var pattern = classCache[ className + " " ]; 1740 1741 return pattern || 1742 ( pattern = new RegExp( "(^|" + whitespace + ")" + className + 1743 "(" + whitespace + "|$)" ) ) && 1744 classCache( className, function( elem ) { 1745 return pattern.test( 1746 typeof elem.className === "string" && elem.className || 1747 typeof elem.getAttribute !== "undefined" && 1748 elem.getAttribute( "class" ) || 1749 "" 1750 ); 1751 } ); 1752 }, 1753 1754 ATTR: function( name, operator, check ) { 1755 return function( elem ) { 1756 var result = find.attr( elem, name ); 1757 1758 if ( result == null ) { 1759 return operator === "!="; 1760 } 1761 if ( !operator ) { 1762 return true; 1763 } 1764 1765 result += ""; 1766 1767 if ( operator === "=" ) { 1768 return result === check; 1769 } 1770 if ( operator === "!=" ) { 1771 return result !== check; 1772 } 1773 if ( operator === "^=" ) { 1774 return check && result.indexOf( check ) === 0; 1775 } 1776 if ( operator === "*=" ) { 1777 return check && result.indexOf( check ) > -1; 1778 } 1779 if ( operator === "$=" ) { 1780 return check && result.slice( -check.length ) === check; 1781 } 1782 if ( operator === "~=" ) { 1783 return ( " " + result.replace( rwhitespace, " " ) + " " ) 1784 .indexOf( check ) > -1; 1785 } 1786 if ( operator === "|=" ) { 1787 return result === check || result.slice( 0, check.length + 1 ) === check + "-"; 1788 } 1789 1790 return false; 1791 }; 1792 }, 1793 1794 CHILD: function( type, what, _argument, first, last ) { 1795 var simple = type.slice( 0, 3 ) !== "nth", 1796 forward = type.slice( -4 ) !== "last", 1797 ofType = what === "of-type"; 1798 1799 return first === 1 && last === 0 ? 1800 1801 // Shortcut for :nth-*(n) 1802 function( elem ) { 1803 return !!elem.parentNode; 1804 } : 1805 1806 function( elem, _context, xml ) { 1807 var cache, outerCache, node, nodeIndex, start, 1808 dir = simple !== forward ? "nextSibling" : "previousSibling", 1809 parent = elem.parentNode, 1810 name = ofType && elem.nodeName.toLowerCase(), 1811 useCache = !xml && !ofType, 1812 diff = false; 1813 1814 if ( parent ) { 1815 1816 // :(first|last|only)-(child|of-type) 1817 if ( simple ) { 1818 while ( dir ) { 1819 node = elem; 1820 while ( ( node = node[ dir ] ) ) { 1821 if ( ofType ? 1822 nodeName( node, name ) : 1823 node.nodeType === 1 ) { 1824 1825 return false; 1826 } 1827 } 1828 1829 // Reverse direction for :only-* (if we haven't yet done so) 1830 start = dir = type === "only" && !start && "nextSibling"; 1831 } 1832 return true; 1833 } 1834 1835 start = [ forward ? parent.firstChild : parent.lastChild ]; 1836 1837 // non-xml :nth-child(...) stores cache data on `parent` 1838 if ( forward && useCache ) { 1839 1840 // Seek `elem` from a previously-cached index 1841 outerCache = parent[ expando ] || ( parent[ expando ] = {} ); 1842 cache = outerCache[ type ] || []; 1843 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1844 diff = nodeIndex && cache[ 2 ]; 1845 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1846 1847 while ( ( node = ++nodeIndex && node && node[ dir ] || 1848 1849 // Fallback to seeking `elem` from the start 1850 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1851 1852 // When found, cache indexes on `parent` and break 1853 if ( node.nodeType === 1 && ++diff && node === elem ) { 1854 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; 1855 break; 1856 } 1857 } 1858 1859 } else { 1860 1861 // Use previously-cached element index if available 1862 if ( useCache ) { 1863 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 1864 cache = outerCache[ type ] || []; 1865 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1866 diff = nodeIndex; 1867 } 1868 1869 // xml :nth-child(...) 1870 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 1871 if ( diff === false ) { 1872 1873 // Use the same loop as above to seek `elem` from the start 1874 while ( ( node = ++nodeIndex && node && node[ dir ] || 1875 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1876 1877 if ( ( ofType ? 1878 nodeName( node, name ) : 1879 node.nodeType === 1 ) && 1880 ++diff ) { 1881 1882 // Cache the index of each encountered element 1883 if ( useCache ) { 1884 outerCache = node[ expando ] || 1885 ( node[ expando ] = {} ); 1886 outerCache[ type ] = [ dirruns, diff ]; 1887 } 1888 1889 if ( node === elem ) { 1890 break; 1891 } 1892 } 1893 } 1894 } 1895 } 1896 1897 // Incorporate the offset, then check against cycle size 1898 diff -= last; 1899 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1900 } 1901 }; 1902 }, 1903 1904 PSEUDO: function( pseudo, argument ) { 1905 1906 // pseudo-class names are case-insensitive 1907 // https://www.w3.org/TR/selectors/#pseudo-classes 1908 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1909 // Remember that setFilters inherits from pseudos 1910 var args, 1911 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1912 find.error( "unsupported pseudo: " + pseudo ); 1913 1914 // The user may use createPseudo to indicate that 1915 // arguments are needed to create the filter function 1916 // just as jQuery does 1917 if ( fn[ expando ] ) { 1918 return fn( argument ); 1919 } 1920 1921 // But maintain support for old signatures 1922 if ( fn.length > 1 ) { 1923 args = [ pseudo, pseudo, "", argument ]; 1924 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 1925 markFunction( function( seed, matches ) { 1926 var idx, 1927 matched = fn( seed, argument ), 1928 i = matched.length; 1929 while ( i-- ) { 1930 idx = indexOf.call( seed, matched[ i ] ); 1931 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 1932 } 1933 } ) : 1934 function( elem ) { 1935 return fn( elem, 0, args ); 1936 }; 1937 } 1938 1939 return fn; 1940 } 1941 }, 1942 1943 pseudos: { 1944 1945 // Potentially complex pseudos 1946 not: markFunction( function( selector ) { 1947 1948 // Trim the selector passed to compile 1949 // to avoid treating leading and trailing 1950 // spaces as combinators 1951 var input = [], 1952 results = [], 1953 matcher = compile( selector.replace( rtrimCSS, "$1" ) ); 1954 1955 return matcher[ expando ] ? 1956 markFunction( function( seed, matches, _context, xml ) { 1957 var elem, 1958 unmatched = matcher( seed, null, xml, [] ), 1959 i = seed.length; 1960 1961 // Match elements unmatched by `matcher` 1962 while ( i-- ) { 1963 if ( ( elem = unmatched[ i ] ) ) { 1964 seed[ i ] = !( matches[ i ] = elem ); 1965 } 1966 } 1967 } ) : 1968 function( elem, _context, xml ) { 1969 input[ 0 ] = elem; 1970 matcher( input, null, xml, results ); 1971 1972 // Don't keep the element 1973 // (see https://github.com/jquery/sizzle/issues/299) 1974 input[ 0 ] = null; 1975 return !results.pop(); 1976 }; 1977 } ), 1978 1979 has: markFunction( function( selector ) { 1980 return function( elem ) { 1981 return find( selector, elem ).length > 0; 1982 }; 1983 } ), 1984 1985 contains: markFunction( function( text ) { 1986 text = text.replace( runescape, funescape ); 1987 return function( elem ) { 1988 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; 1989 }; 1990 } ), 1991 1992 // "Whether an element is represented by a :lang() selector 1993 // is based solely on the element's language value 1994 // being equal to the identifier C, 1995 // or beginning with the identifier C immediately followed by "-". 1996 // The matching of C against the element's language value is performed case-insensitively. 1997 // The identifier C does not have to be a valid language name." 1998 // https://www.w3.org/TR/selectors/#lang-pseudo 1999 lang: markFunction( function( lang ) { 2000 2001 // lang value must be a valid identifier 2002 if ( !ridentifier.test( lang || "" ) ) { 2003 find.error( "unsupported lang: " + lang ); 2004 } 2005 lang = lang.replace( runescape, funescape ).toLowerCase(); 2006 return function( elem ) { 2007 var elemLang; 2008 do { 2009 if ( ( elemLang = documentIsHTML ? 2010 elem.lang : 2011 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 2012 2013 elemLang = elemLang.toLowerCase(); 2014 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 2015 } 2016 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 2017 return false; 2018 }; 2019 } ), 2020 2021 // Miscellaneous 2022 target: function( elem ) { 2023 var hash = window.location && window.location.hash; 2024 return hash && hash.slice( 1 ) === elem.id; 2025 }, 2026 2027 root: function( elem ) { 2028 return elem === documentElement; 2029 }, 2030 2031 focus: function( elem ) { 2032 return elem === safeActiveElement() && 2033 document.hasFocus() && 2034 !!( elem.type || elem.href || ~elem.tabIndex ); 2035 }, 2036 2037 // Boolean properties 2038 enabled: createDisabledPseudo( false ), 2039 disabled: createDisabledPseudo( true ), 2040 2041 checked: function( elem ) { 2042 2043 // In CSS3, :checked should return both checked and selected elements 2044 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2045 return ( nodeName( elem, "input" ) && !!elem.checked ) || 2046 ( nodeName( elem, "option" ) && !!elem.selected ); 2047 }, 2048 2049 selected: function( elem ) { 2050 2051 // Support: IE <=11+ 2052 // Accessing the selectedIndex property 2053 // forces the browser to treat the default option as 2054 // selected when in an optgroup. 2055 if ( elem.parentNode ) { 2056 // eslint-disable-next-line no-unused-expressions 2057 elem.parentNode.selectedIndex; 2058 } 2059 2060 return elem.selected === true; 2061 }, 2062 2063 // Contents 2064 empty: function( elem ) { 2065 2066 // https://www.w3.org/TR/selectors/#empty-pseudo 2067 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2068 // but not by others (comment: 8; processing instruction: 7; etc.) 2069 // nodeType < 6 works because attributes (2) do not appear as children 2070 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2071 if ( elem.nodeType < 6 ) { 2072 return false; 2073 } 2074 } 2075 return true; 2076 }, 2077 2078 parent: function( elem ) { 2079 return !Expr.pseudos.empty( elem ); 2080 }, 2081 2082 // Element/input types 2083 header: function( elem ) { 2084 return rheader.test( elem.nodeName ); 2085 }, 2086 2087 input: function( elem ) { 2088 return rinputs.test( elem.nodeName ); 2089 }, 2090 2091 button: function( elem ) { 2092 return nodeName( elem, "input" ) && elem.type === "button" || 2093 nodeName( elem, "button" ); 2094 }, 2095 2096 text: function( elem ) { 2097 var attr; 2098 return nodeName( elem, "input" ) && elem.type === "text" && 2099 2100 // Support: IE <10 only 2101 // New HTML5 attribute values (e.g., "search") appear 2102 // with elem.type === "text" 2103 ( ( attr = elem.getAttribute( "type" ) ) == null || 2104 attr.toLowerCase() === "text" ); 2105 }, 2106 2107 // Position-in-collection 2108 first: createPositionalPseudo( function() { 2109 return [ 0 ]; 2110 } ), 2111 2112 last: createPositionalPseudo( function( _matchIndexes, length ) { 2113 return [ length - 1 ]; 2114 } ), 2115 2116 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { 2117 return [ argument < 0 ? argument + length : argument ]; 2118 } ), 2119 2120 even: createPositionalPseudo( function( matchIndexes, length ) { 2121 var i = 0; 2122 for ( ; i < length; i += 2 ) { 2123 matchIndexes.push( i ); 2124 } 2125 return matchIndexes; 2126 } ), 2127 2128 odd: createPositionalPseudo( function( matchIndexes, length ) { 2129 var i = 1; 2130 for ( ; i < length; i += 2 ) { 2131 matchIndexes.push( i ); 2132 } 2133 return matchIndexes; 2134 } ), 2135 2136 lt: createPositionalPseudo( function( matchIndexes, length, argument ) { 2137 var i; 2138 2139 if ( argument < 0 ) { 2140 i = argument + length; 2141 } else if ( argument > length ) { 2142 i = length; 2143 } else { 2144 i = argument; 2145 } 2146 2147 for ( ; --i >= 0; ) { 2148 matchIndexes.push( i ); 2149 } 2150 return matchIndexes; 2151 } ), 2152 2153 gt: createPositionalPseudo( function( matchIndexes, length, argument ) { 2154 var i = argument < 0 ? argument + length : argument; 2155 for ( ; ++i < length; ) { 2156 matchIndexes.push( i ); 2157 } 2158 return matchIndexes; 2159 } ) 2160 } 2161}; 2162 2163Expr.pseudos.nth = Expr.pseudos.eq; 2164 2165// Add button/input type pseudos 2166for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2167 Expr.pseudos[ i ] = createInputPseudo( i ); 2168} 2169for ( i in { submit: true, reset: true } ) { 2170 Expr.pseudos[ i ] = createButtonPseudo( i ); 2171} 2172 2173// Easy API for creating new setFilters 2174function setFilters() {} 2175setFilters.prototype = Expr.filters = Expr.pseudos; 2176Expr.setFilters = new setFilters(); 2177 2178function tokenize( selector, parseOnly ) { 2179 var matched, match, tokens, type, 2180 soFar, groups, preFilters, 2181 cached = tokenCache[ selector + " " ]; 2182 2183 if ( cached ) { 2184 return parseOnly ? 0 : cached.slice( 0 ); 2185 } 2186 2187 soFar = selector; 2188 groups = []; 2189 preFilters = Expr.preFilter; 2190 2191 while ( soFar ) { 2192 2193 // Comma and first run 2194 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 2195 if ( match ) { 2196 2197 // Don't consume trailing commas as valid 2198 soFar = soFar.slice( match[ 0 ].length ) || soFar; 2199 } 2200 groups.push( ( tokens = [] ) ); 2201 } 2202 2203 matched = false; 2204 2205 // Combinators 2206 if ( ( match = rleadingCombinator.exec( soFar ) ) ) { 2207 matched = match.shift(); 2208 tokens.push( { 2209 value: matched, 2210 2211 // Cast descendant combinators to space 2212 type: match[ 0 ].replace( rtrimCSS, " " ) 2213 } ); 2214 soFar = soFar.slice( matched.length ); 2215 } 2216 2217 // Filters 2218 for ( type in Expr.filter ) { 2219 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 2220 ( match = preFilters[ type ]( match ) ) ) ) { 2221 matched = match.shift(); 2222 tokens.push( { 2223 value: matched, 2224 type: type, 2225 matches: match 2226 } ); 2227 soFar = soFar.slice( matched.length ); 2228 } 2229 } 2230 2231 if ( !matched ) { 2232 break; 2233 } 2234 } 2235 2236 // Return the length of the invalid excess 2237 // if we're just parsing 2238 // Otherwise, throw an error or return tokens 2239 if ( parseOnly ) { 2240 return soFar.length; 2241 } 2242 2243 return soFar ? 2244 find.error( selector ) : 2245 2246 // Cache the tokens 2247 tokenCache( selector, groups ).slice( 0 ); 2248} 2249 2250function toSelector( tokens ) { 2251 var i = 0, 2252 len = tokens.length, 2253 selector = ""; 2254 for ( ; i < len; i++ ) { 2255 selector += tokens[ i ].value; 2256 } 2257 return selector; 2258} 2259 2260function addCombinator( matcher, combinator, base ) { 2261 var dir = combinator.dir, 2262 skip = combinator.next, 2263 key = skip || dir, 2264 checkNonElements = base && key === "parentNode", 2265 doneName = done++; 2266 2267 return combinator.first ? 2268 2269 // Check against closest ancestor/preceding element 2270 function( elem, context, xml ) { 2271 while ( ( elem = elem[ dir ] ) ) { 2272 if ( elem.nodeType === 1 || checkNonElements ) { 2273 return matcher( elem, context, xml ); 2274 } 2275 } 2276 return false; 2277 } : 2278 2279 // Check against all ancestor/preceding elements 2280 function( elem, context, xml ) { 2281 var oldCache, outerCache, 2282 newCache = [ dirruns, doneName ]; 2283 2284 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2285 if ( xml ) { 2286 while ( ( elem = elem[ dir ] ) ) { 2287 if ( elem.nodeType === 1 || checkNonElements ) { 2288 if ( matcher( elem, context, xml ) ) { 2289 return true; 2290 } 2291 } 2292 } 2293 } else { 2294 while ( ( elem = elem[ dir ] ) ) { 2295 if ( elem.nodeType === 1 || checkNonElements ) { 2296 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 2297 2298 if ( skip && nodeName( elem, skip ) ) { 2299 elem = elem[ dir ] || elem; 2300 } else if ( ( oldCache = outerCache[ key ] ) && 2301 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2302 2303 // Assign to newCache so results back-propagate to previous elements 2304 return ( newCache[ 2 ] = oldCache[ 2 ] ); 2305 } else { 2306 2307 // Reuse newcache so results back-propagate to previous elements 2308 outerCache[ key ] = newCache; 2309 2310 // A match means we're done; a fail means we have to keep checking 2311 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 2312 return true; 2313 } 2314 } 2315 } 2316 } 2317 } 2318 return false; 2319 }; 2320} 2321 2322function elementMatcher( matchers ) { 2323 return matchers.length > 1 ? 2324 function( elem, context, xml ) { 2325 var i = matchers.length; 2326 while ( i-- ) { 2327 if ( !matchers[ i ]( elem, context, xml ) ) { 2328 return false; 2329 } 2330 } 2331 return true; 2332 } : 2333 matchers[ 0 ]; 2334} 2335 2336function multipleContexts( selector, contexts, results ) { 2337 var i = 0, 2338 len = contexts.length; 2339 for ( ; i < len; i++ ) { 2340 find( selector, contexts[ i ], results ); 2341 } 2342 return results; 2343} 2344 2345function condense( unmatched, map, filter, context, xml ) { 2346 var elem, 2347 newUnmatched = [], 2348 i = 0, 2349 len = unmatched.length, 2350 mapped = map != null; 2351 2352 for ( ; i < len; i++ ) { 2353 if ( ( elem = unmatched[ i ] ) ) { 2354 if ( !filter || filter( elem, context, xml ) ) { 2355 newUnmatched.push( elem ); 2356 if ( mapped ) { 2357 map.push( i ); 2358 } 2359 } 2360 } 2361 } 2362 2363 return newUnmatched; 2364} 2365 2366function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2367 if ( postFilter && !postFilter[ expando ] ) { 2368 postFilter = setMatcher( postFilter ); 2369 } 2370 if ( postFinder && !postFinder[ expando ] ) { 2371 postFinder = setMatcher( postFinder, postSelector ); 2372 } 2373 return markFunction( function( seed, results, context, xml ) { 2374 var temp, i, elem, matcherOut, 2375 preMap = [], 2376 postMap = [], 2377 preexisting = results.length, 2378 2379 // Get initial elements from seed or context 2380 elems = seed || 2381 multipleContexts( selector || "*", 2382 context.nodeType ? [ context ] : context, [] ), 2383 2384 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2385 matcherIn = preFilter && ( seed || !selector ) ? 2386 condense( elems, preMap, preFilter, context, xml ) : 2387 elems; 2388 2389 if ( matcher ) { 2390 2391 // If we have a postFinder, or filtered seed, or non-seed postFilter 2392 // or preexisting results, 2393 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2394 2395 // ...intermediate processing is necessary 2396 [] : 2397 2398 // ...otherwise use results directly 2399 results; 2400 2401 // Find primary matches 2402 matcher( matcherIn, matcherOut, context, xml ); 2403 } else { 2404 matcherOut = matcherIn; 2405 } 2406 2407 // Apply postFilter 2408 if ( postFilter ) { 2409 temp = condense( matcherOut, postMap ); 2410 postFilter( temp, [], context, xml ); 2411 2412 // Un-match failing elements by moving them back to matcherIn 2413 i = temp.length; 2414 while ( i-- ) { 2415 if ( ( elem = temp[ i ] ) ) { 2416 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 2417 } 2418 } 2419 } 2420 2421 if ( seed ) { 2422 if ( postFinder || preFilter ) { 2423 if ( postFinder ) { 2424 2425 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2426 temp = []; 2427 i = matcherOut.length; 2428 while ( i-- ) { 2429 if ( ( elem = matcherOut[ i ] ) ) { 2430 2431 // Restore matcherIn since elem is not yet a final match 2432 temp.push( ( matcherIn[ i ] = elem ) ); 2433 } 2434 } 2435 postFinder( null, ( matcherOut = [] ), temp, xml ); 2436 } 2437 2438 // Move matched elements from seed to results to keep them synchronized 2439 i = matcherOut.length; 2440 while ( i-- ) { 2441 if ( ( elem = matcherOut[ i ] ) && 2442 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { 2443 2444 seed[ temp ] = !( results[ temp ] = elem ); 2445 } 2446 } 2447 } 2448 2449 // Add elements to results, through postFinder if defined 2450 } else { 2451 matcherOut = condense( 2452 matcherOut === results ? 2453 matcherOut.splice( preexisting, matcherOut.length ) : 2454 matcherOut 2455 ); 2456 if ( postFinder ) { 2457 postFinder( null, results, matcherOut, xml ); 2458 } else { 2459 push.apply( results, matcherOut ); 2460 } 2461 } 2462 } ); 2463} 2464 2465function matcherFromTokens( tokens ) { 2466 var checkContext, matcher, j, 2467 len = tokens.length, 2468 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 2469 implicitRelative = leadingRelative || Expr.relative[ " " ], 2470 i = leadingRelative ? 1 : 0, 2471 2472 // The foundational matcher ensures that elements are reachable from top-level context(s) 2473 matchContext = addCombinator( function( elem ) { 2474 return elem === checkContext; 2475 }, implicitRelative, true ), 2476 matchAnyContext = addCombinator( function( elem ) { 2477 return indexOf.call( checkContext, elem ) > -1; 2478 }, implicitRelative, true ), 2479 matchers = [ function( elem, context, xml ) { 2480 2481 // Support: IE 11+, Edge 17 - 18+ 2482 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2483 // two documents; shallow comparisons work. 2484 // eslint-disable-next-line eqeqeq 2485 var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( 2486 ( checkContext = context ).nodeType ? 2487 matchContext( elem, context, xml ) : 2488 matchAnyContext( elem, context, xml ) ); 2489 2490 // Avoid hanging onto element 2491 // (see https://github.com/jquery/sizzle/issues/299) 2492 checkContext = null; 2493 return ret; 2494 } ]; 2495 2496 for ( ; i < len; i++ ) { 2497 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 2498 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 2499 } else { 2500 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 2501 2502 // Return special upon seeing a positional matcher 2503 if ( matcher[ expando ] ) { 2504 2505 // Find the next relative operator (if any) for proper handling 2506 j = ++i; 2507 for ( ; j < len; j++ ) { 2508 if ( Expr.relative[ tokens[ j ].type ] ) { 2509 break; 2510 } 2511 } 2512 return setMatcher( 2513 i > 1 && elementMatcher( matchers ), 2514 i > 1 && toSelector( 2515 2516 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2517 tokens.slice( 0, i - 1 ) 2518 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 2519 ).replace( rtrimCSS, "$1" ), 2520 matcher, 2521 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2522 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 2523 j < len && toSelector( tokens ) 2524 ); 2525 } 2526 matchers.push( matcher ); 2527 } 2528 } 2529 2530 return elementMatcher( matchers ); 2531} 2532 2533function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2534 var bySet = setMatchers.length > 0, 2535 byElement = elementMatchers.length > 0, 2536 superMatcher = function( seed, context, xml, results, outermost ) { 2537 var elem, j, matcher, 2538 matchedCount = 0, 2539 i = "0", 2540 unmatched = seed && [], 2541 setMatched = [], 2542 contextBackup = outermostContext, 2543 2544 // We must always have either seed elements or outermost context 2545 elems = seed || byElement && Expr.find.TAG( "*", outermost ), 2546 2547 // Use integer dirruns iff this is the outermost matcher 2548 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 2549 len = elems.length; 2550 2551 if ( outermost ) { 2552 2553 // Support: IE 11+, Edge 17 - 18+ 2554 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2555 // two documents; shallow comparisons work. 2556 // eslint-disable-next-line eqeqeq 2557 outermostContext = context == document || context || outermost; 2558 } 2559 2560 // Add elements passing elementMatchers directly to results 2561 // Support: iOS <=7 - 9 only 2562 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching 2563 // elements by id. (see trac-14142) 2564 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 2565 if ( byElement && elem ) { 2566 j = 0; 2567 2568 // Support: IE 11+, Edge 17 - 18+ 2569 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2570 // two documents; shallow comparisons work. 2571 // eslint-disable-next-line eqeqeq 2572 if ( !context && elem.ownerDocument != document ) { 2573 setDocument( elem ); 2574 xml = !documentIsHTML; 2575 } 2576 while ( ( matcher = elementMatchers[ j++ ] ) ) { 2577 if ( matcher( elem, context || document, xml ) ) { 2578 push.call( results, elem ); 2579 break; 2580 } 2581 } 2582 if ( outermost ) { 2583 dirruns = dirrunsUnique; 2584 } 2585 } 2586 2587 // Track unmatched elements for set filters 2588 if ( bySet ) { 2589 2590 // They will have gone through all possible matchers 2591 if ( ( elem = !matcher && elem ) ) { 2592 matchedCount--; 2593 } 2594 2595 // Lengthen the array for every element, matched or not 2596 if ( seed ) { 2597 unmatched.push( elem ); 2598 } 2599 } 2600 } 2601 2602 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2603 // makes the latter nonnegative. 2604 matchedCount += i; 2605 2606 // Apply set filters to unmatched elements 2607 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2608 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2609 // no element matchers and no seed. 2610 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2611 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2612 // numerically zero. 2613 if ( bySet && i !== matchedCount ) { 2614 j = 0; 2615 while ( ( matcher = setMatchers[ j++ ] ) ) { 2616 matcher( unmatched, setMatched, context, xml ); 2617 } 2618 2619 if ( seed ) { 2620 2621 // Reintegrate element matches to eliminate the need for sorting 2622 if ( matchedCount > 0 ) { 2623 while ( i-- ) { 2624 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 2625 setMatched[ i ] = pop.call( results ); 2626 } 2627 } 2628 } 2629 2630 // Discard index placeholder values to get only actual matches 2631 setMatched = condense( setMatched ); 2632 } 2633 2634 // Add matches to results 2635 push.apply( results, setMatched ); 2636 2637 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2638 if ( outermost && !seed && setMatched.length > 0 && 2639 ( matchedCount + setMatchers.length ) > 1 ) { 2640 2641 jQuery.uniqueSort( results ); 2642 } 2643 } 2644 2645 // Override manipulation of globals by nested matchers 2646 if ( outermost ) { 2647 dirruns = dirrunsUnique; 2648 outermostContext = contextBackup; 2649 } 2650 2651 return unmatched; 2652 }; 2653 2654 return bySet ? 2655 markFunction( superMatcher ) : 2656 superMatcher; 2657} 2658 2659function compile( selector, match /* Internal Use Only */ ) { 2660 var i, 2661 setMatchers = [], 2662 elementMatchers = [], 2663 cached = compilerCache[ selector + " " ]; 2664 2665 if ( !cached ) { 2666 2667 // Generate a function of recursive functions that can be used to check each element 2668 if ( !match ) { 2669 match = tokenize( selector ); 2670 } 2671 i = match.length; 2672 while ( i-- ) { 2673 cached = matcherFromTokens( match[ i ] ); 2674 if ( cached[ expando ] ) { 2675 setMatchers.push( cached ); 2676 } else { 2677 elementMatchers.push( cached ); 2678 } 2679 } 2680 2681 // Cache the compiled function 2682 cached = compilerCache( selector, 2683 matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2684 2685 // Save selector and tokenization 2686 cached.selector = selector; 2687 } 2688 return cached; 2689} 2690 2691/** 2692 * A low-level selection function that works with jQuery's compiled 2693 * selector functions 2694 * @param {String|Function} selector A selector or a pre-compiled 2695 * selector function built with jQuery selector compile 2696 * @param {Element} context 2697 * @param {Array} [results] 2698 * @param {Array} [seed] A set of elements to match against 2699 */ 2700function select( selector, context, results, seed ) { 2701 var i, tokens, token, type, find, 2702 compiled = typeof selector === "function" && selector, 2703 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 2704 2705 results = results || []; 2706 2707 // Try to minimize operations if there is only one selector in the list and no seed 2708 // (the latter of which guarantees us context) 2709 if ( match.length === 1 ) { 2710 2711 // Reduce context if the leading compound selector is an ID 2712 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 2713 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 2714 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 2715 2716 context = ( Expr.find.ID( 2717 token.matches[ 0 ].replace( runescape, funescape ), 2718 context 2719 ) || [] )[ 0 ]; 2720 if ( !context ) { 2721 return results; 2722 2723 // Precompiled matchers will still verify ancestry, so step up a level 2724 } else if ( compiled ) { 2725 context = context.parentNode; 2726 } 2727 2728 selector = selector.slice( tokens.shift().value.length ); 2729 } 2730 2731 // Fetch a seed set for right-to-left matching 2732 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; 2733 while ( i-- ) { 2734 token = tokens[ i ]; 2735 2736 // Abort if we hit a combinator 2737 if ( Expr.relative[ ( type = token.type ) ] ) { 2738 break; 2739 } 2740 if ( ( find = Expr.find[ type ] ) ) { 2741 2742 // Search, expanding context for leading sibling combinators 2743 if ( ( seed = find( 2744 token.matches[ 0 ].replace( runescape, funescape ), 2745 rsibling.test( tokens[ 0 ].type ) && 2746 testContext( context.parentNode ) || context 2747 ) ) ) { 2748 2749 // If seed is empty or no tokens remain, we can return early 2750 tokens.splice( i, 1 ); 2751 selector = seed.length && toSelector( tokens ); 2752 if ( !selector ) { 2753 push.apply( results, seed ); 2754 return results; 2755 } 2756 2757 break; 2758 } 2759 } 2760 } 2761 } 2762 2763 // Compile and execute a filtering function if one is not provided 2764 // Provide `match` to avoid retokenization if we modified the selector above 2765 ( compiled || compile( selector, match ) )( 2766 seed, 2767 context, 2768 !documentIsHTML, 2769 results, 2770 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2771 ); 2772 return results; 2773} 2774 2775// One-time assignments 2776 2777// Support: Android <=4.0 - 4.1+ 2778// Sort stability 2779support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 2780 2781// Initialize against the default document 2782setDocument(); 2783 2784// Support: Android <=4.0 - 4.1+ 2785// Detached nodes confoundingly follow *each other* 2786support.sortDetached = assert( function( el ) { 2787 2788 // Should return 1, but returns 4 (following) 2789 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 2790} ); 2791 2792jQuery.find = find; 2793 2794// Deprecated 2795jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2796jQuery.unique = jQuery.uniqueSort; 2797 2798// These have always been private, but they used to be documented as part of 2799// Sizzle so let's maintain them for now for backwards compatibility purposes. 2800find.compile = compile; 2801find.select = select; 2802find.setDocument = setDocument; 2803find.tokenize = tokenize; 2804 2805find.escape = jQuery.escapeSelector; 2806find.getText = jQuery.text; 2807find.isXML = jQuery.isXMLDoc; 2808find.selectors = jQuery.expr; 2809find.support = jQuery.support; 2810find.uniqueSort = jQuery.uniqueSort; 2811 2812 /* eslint-enable */ 2813 2814} )(); 2815 2816 2817var dir = function( elem, dir, until ) { 2818 var matched = [], 2819 truncate = until !== undefined; 2820 2821 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2822 if ( elem.nodeType === 1 ) { 2823 if ( truncate && jQuery( elem ).is( until ) ) { 2824 break; 2825 } 2826 matched.push( elem ); 2827 } 2828 } 2829 return matched; 2830}; 2831 2832 2833var siblings = function( n, elem ) { 2834 var matched = []; 2835 2836 for ( ; n; n = n.nextSibling ) { 2837 if ( n.nodeType === 1 && n !== elem ) { 2838 matched.push( n ); 2839 } 2840 } 2841 2842 return matched; 2843}; 2844 2845 2846var rneedsContext = jQuery.expr.match.needsContext; 2847 2848var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 2849 2850 2851 2852// Implement the identical functionality for filter and not 2853function winnow( elements, qualifier, not ) { 2854 if ( isFunction( qualifier ) ) { 2855 return jQuery.grep( elements, function( elem, i ) { 2856 return !!qualifier.call( elem, i, elem ) !== not; 2857 } ); 2858 } 2859 2860 // Single element 2861 if ( qualifier.nodeType ) { 2862 return jQuery.grep( elements, function( elem ) { 2863 return ( elem === qualifier ) !== not; 2864 } ); 2865 } 2866 2867 // Arraylike of elements (jQuery, arguments, Array) 2868 if ( typeof qualifier !== "string" ) { 2869 return jQuery.grep( elements, function( elem ) { 2870 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 2871 } ); 2872 } 2873 2874 // Filtered directly for both simple and complex selectors 2875 return jQuery.filter( qualifier, elements, not ); 2876} 2877 2878jQuery.filter = function( expr, elems, not ) { 2879 var elem = elems[ 0 ]; 2880 2881 if ( not ) { 2882 expr = ":not(" + expr + ")"; 2883 } 2884 2885 if ( elems.length === 1 && elem.nodeType === 1 ) { 2886 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 2887 } 2888 2889 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 2890 return elem.nodeType === 1; 2891 } ) ); 2892}; 2893 2894jQuery.fn.extend( { 2895 find: function( selector ) { 2896 var i, ret, 2897 len = this.length, 2898 self = this; 2899 2900 if ( typeof selector !== "string" ) { 2901 return this.pushStack( jQuery( selector ).filter( function() { 2902 for ( i = 0; i < len; i++ ) { 2903 if ( jQuery.contains( self[ i ], this ) ) { 2904 return true; 2905 } 2906 } 2907 } ) ); 2908 } 2909 2910 ret = this.pushStack( [] ); 2911 2912 for ( i = 0; i < len; i++ ) { 2913 jQuery.find( selector, self[ i ], ret ); 2914 } 2915 2916 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 2917 }, 2918 filter: function( selector ) { 2919 return this.pushStack( winnow( this, selector || [], false ) ); 2920 }, 2921 not: function( selector ) { 2922 return this.pushStack( winnow( this, selector || [], true ) ); 2923 }, 2924 is: function( selector ) { 2925 return !!winnow( 2926 this, 2927 2928 // If this is a positional/relative selector, check membership in the returned set 2929 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2930 typeof selector === "string" && rneedsContext.test( selector ) ? 2931 jQuery( selector ) : 2932 selector || [], 2933 false 2934 ).length; 2935 } 2936} ); 2937 2938 2939// Initialize a jQuery object 2940 2941 2942// A central reference to the root jQuery(document) 2943var rootjQuery, 2944 2945 // A simple way to check for HTML strings 2946 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) 2947 // Strict HTML recognition (trac-11290: must start with <) 2948 // Shortcut simple #id case for speed 2949 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 2950 2951 init = jQuery.fn.init = function( selector, context, root ) { 2952 var match, elem; 2953 2954 // HANDLE: $(""), $(null), $(undefined), $(false) 2955 if ( !selector ) { 2956 return this; 2957 } 2958 2959 // Method init() accepts an alternate rootjQuery 2960 // so migrate can support jQuery.sub (gh-2101) 2961 root = root || rootjQuery; 2962 2963 // Handle HTML strings 2964 if ( typeof selector === "string" ) { 2965 if ( selector[ 0 ] === "<" && 2966 selector[ selector.length - 1 ] === ">" && 2967 selector.length >= 3 ) { 2968 2969 // Assume that strings that start and end with <> are HTML and skip the regex check 2970 match = [ null, selector, null ]; 2971 2972 } else { 2973 match = rquickExpr.exec( selector ); 2974 } 2975 2976 // Match html or make sure no context is specified for #id 2977 if ( match && ( match[ 1 ] || !context ) ) { 2978 2979 // HANDLE: $(html) -> $(array) 2980 if ( match[ 1 ] ) { 2981 context = context instanceof jQuery ? context[ 0 ] : context; 2982 2983 // Option to run scripts is true for back-compat 2984 // Intentionally let the error be thrown if parseHTML is not present 2985 jQuery.merge( this, jQuery.parseHTML( 2986 match[ 1 ], 2987 context && context.nodeType ? context.ownerDocument || context : document, 2988 true 2989 ) ); 2990 2991 // HANDLE: $(html, props) 2992 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 2993 for ( match in context ) { 2994 2995 // Properties of context are called as methods if possible 2996 if ( isFunction( this[ match ] ) ) { 2997 this[ match ]( context[ match ] ); 2998 2999 // ...and otherwise set as attributes 3000 } else { 3001 this.attr( match, context[ match ] ); 3002 } 3003 } 3004 } 3005 3006 return this; 3007 3008 // HANDLE: $(#id) 3009 } else { 3010 elem = document.getElementById( match[ 2 ] ); 3011 3012 if ( elem ) { 3013 3014 // Inject the element directly into the jQuery object 3015 this[ 0 ] = elem; 3016 this.length = 1; 3017 } 3018 return this; 3019 } 3020 3021 // HANDLE: $(expr, $(...)) 3022 } else if ( !context || context.jquery ) { 3023 return ( context || root ).find( selector ); 3024 3025 // HANDLE: $(expr, context) 3026 // (which is just equivalent to: $(context).find(expr) 3027 } else { 3028 return this.constructor( context ).find( selector ); 3029 } 3030 3031 // HANDLE: $(DOMElement) 3032 } else if ( selector.nodeType ) { 3033 this[ 0 ] = selector; 3034 this.length = 1; 3035 return this; 3036 3037 // HANDLE: $(function) 3038 // Shortcut for document ready 3039 } else if ( isFunction( selector ) ) { 3040 return root.ready !== undefined ? 3041 root.ready( selector ) : 3042 3043 // Execute immediately if ready is not present 3044 selector( jQuery ); 3045 } 3046 3047 return jQuery.makeArray( selector, this ); 3048 }; 3049 3050// Give the init function the jQuery prototype for later instantiation 3051init.prototype = jQuery.fn; 3052 3053// Initialize central reference 3054rootjQuery = jQuery( document ); 3055 3056 3057var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3058 3059 // Methods guaranteed to produce a unique set when starting from a unique set 3060 guaranteedUnique = { 3061 children: true, 3062 contents: true, 3063 next: true, 3064 prev: true 3065 }; 3066 3067jQuery.fn.extend( { 3068 has: function( target ) { 3069 var targets = jQuery( target, this ), 3070 l = targets.length; 3071 3072 return this.filter( function() { 3073 var i = 0; 3074 for ( ; i < l; i++ ) { 3075 if ( jQuery.contains( this, targets[ i ] ) ) { 3076 return true; 3077 } 3078 } 3079 } ); 3080 }, 3081 3082 closest: function( selectors, context ) { 3083 var cur, 3084 i = 0, 3085 l = this.length, 3086 matched = [], 3087 targets = typeof selectors !== "string" && jQuery( selectors ); 3088 3089 // Positional selectors never match, since there's no _selection_ context 3090 if ( !rneedsContext.test( selectors ) ) { 3091 for ( ; i < l; i++ ) { 3092 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3093 3094 // Always skip document fragments 3095 if ( cur.nodeType < 11 && ( targets ? 3096 targets.index( cur ) > -1 : 3097 3098 // Don't pass non-elements to jQuery#find 3099 cur.nodeType === 1 && 3100 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3101 3102 matched.push( cur ); 3103 break; 3104 } 3105 } 3106 } 3107 } 3108 3109 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3110 }, 3111 3112 // Determine the position of an element within the set 3113 index: function( elem ) { 3114 3115 // No argument, return index in parent 3116 if ( !elem ) { 3117 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3118 } 3119 3120 // Index in selector 3121 if ( typeof elem === "string" ) { 3122 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3123 } 3124 3125 // Locate the position of the desired element 3126 return indexOf.call( this, 3127 3128 // If it receives a jQuery object, the first element is used 3129 elem.jquery ? elem[ 0 ] : elem 3130 ); 3131 }, 3132 3133 add: function( selector, context ) { 3134 return this.pushStack( 3135 jQuery.uniqueSort( 3136 jQuery.merge( this.get(), jQuery( selector, context ) ) 3137 ) 3138 ); 3139 }, 3140 3141 addBack: function( selector ) { 3142 return this.add( selector == null ? 3143 this.prevObject : this.prevObject.filter( selector ) 3144 ); 3145 } 3146} ); 3147 3148function sibling( cur, dir ) { 3149 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 3150 return cur; 3151} 3152 3153jQuery.each( { 3154 parent: function( elem ) { 3155 var parent = elem.parentNode; 3156 return parent && parent.nodeType !== 11 ? parent : null; 3157 }, 3158 parents: function( elem ) { 3159 return dir( elem, "parentNode" ); 3160 }, 3161 parentsUntil: function( elem, _i, until ) { 3162 return dir( elem, "parentNode", until ); 3163 }, 3164 next: function( elem ) { 3165 return sibling( elem, "nextSibling" ); 3166 }, 3167 prev: function( elem ) { 3168 return sibling( elem, "previousSibling" ); 3169 }, 3170 nextAll: function( elem ) { 3171 return dir( elem, "nextSibling" ); 3172 }, 3173 prevAll: function( elem ) { 3174 return dir( elem, "previousSibling" ); 3175 }, 3176 nextUntil: function( elem, _i, until ) { 3177 return dir( elem, "nextSibling", until ); 3178 }, 3179 prevUntil: function( elem, _i, until ) { 3180 return dir( elem, "previousSibling", until ); 3181 }, 3182 siblings: function( elem ) { 3183 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3184 }, 3185 children: function( elem ) { 3186 return siblings( elem.firstChild ); 3187 }, 3188 contents: function( elem ) { 3189 if ( elem.contentDocument != null && 3190 3191 // Support: IE 11+ 3192 // <object> elements with no `data` attribute has an object 3193 // `contentDocument` with a `null` prototype. 3194 getProto( elem.contentDocument ) ) { 3195 3196 return elem.contentDocument; 3197 } 3198 3199 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3200 // Treat the template element as a regular one in browsers that 3201 // don't support it. 3202 if ( nodeName( elem, "template" ) ) { 3203 elem = elem.content || elem; 3204 } 3205 3206 return jQuery.merge( [], elem.childNodes ); 3207 } 3208}, function( name, fn ) { 3209 jQuery.fn[ name ] = function( until, selector ) { 3210 var matched = jQuery.map( this, fn, until ); 3211 3212 if ( name.slice( -5 ) !== "Until" ) { 3213 selector = until; 3214 } 3215 3216 if ( selector && typeof selector === "string" ) { 3217 matched = jQuery.filter( selector, matched ); 3218 } 3219 3220 if ( this.length > 1 ) { 3221 3222 // Remove duplicates 3223 if ( !guaranteedUnique[ name ] ) { 3224 jQuery.uniqueSort( matched ); 3225 } 3226 3227 // Reverse order for parents* and prev-derivatives 3228 if ( rparentsprev.test( name ) ) { 3229 matched.reverse(); 3230 } 3231 } 3232 3233 return this.pushStack( matched ); 3234 }; 3235} ); 3236var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 3237 3238 3239 3240// Convert String-formatted options into Object-formatted ones 3241function createOptions( options ) { 3242 var object = {}; 3243 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 3244 object[ flag ] = true; 3245 } ); 3246 return object; 3247} 3248 3249/* 3250 * Create a callback list using the following parameters: 3251 * 3252 * options: an optional list of space-separated options that will change how 3253 * the callback list behaves or a more traditional option object 3254 * 3255 * By default a callback list will act like an event callback list and can be 3256 * "fired" multiple times. 3257 * 3258 * Possible options: 3259 * 3260 * once: will ensure the callback list can only be fired once (like a Deferred) 3261 * 3262 * memory: will keep track of previous values and will call any callback added 3263 * after the list has been fired right away with the latest "memorized" 3264 * values (like a Deferred) 3265 * 3266 * unique: will ensure a callback can only be added once (no duplicate in the list) 3267 * 3268 * stopOnFalse: interrupt callings when a callback returns false 3269 * 3270 */ 3271jQuery.Callbacks = function( options ) { 3272 3273 // Convert options from String-formatted to Object-formatted if needed 3274 // (we check in cache first) 3275 options = typeof options === "string" ? 3276 createOptions( options ) : 3277 jQuery.extend( {}, options ); 3278 3279 var // Flag to know if list is currently firing 3280 firing, 3281 3282 // Last fire value for non-forgettable lists 3283 memory, 3284 3285 // Flag to know if list was already fired 3286 fired, 3287 3288 // Flag to prevent firing 3289 locked, 3290 3291 // Actual callback list 3292 list = [], 3293 3294 // Queue of execution data for repeatable lists 3295 queue = [], 3296 3297 // Index of currently firing callback (modified by add/remove as needed) 3298 firingIndex = -1, 3299 3300 // Fire callbacks 3301 fire = function() { 3302 3303 // Enforce single-firing 3304 locked = locked || options.once; 3305 3306 // Execute callbacks for all pending executions, 3307 // respecting firingIndex overrides and runtime changes 3308 fired = firing = true; 3309 for ( ; queue.length; firingIndex = -1 ) { 3310 memory = queue.shift(); 3311 while ( ++firingIndex < list.length ) { 3312 3313 // Run callback and check for early termination 3314 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3315 options.stopOnFalse ) { 3316 3317 // Jump to end and forget the data so .add doesn't re-fire 3318 firingIndex = list.length; 3319 memory = false; 3320 } 3321 } 3322 } 3323 3324 // Forget the data if we're done with it 3325 if ( !options.memory ) { 3326 memory = false; 3327 } 3328 3329 firing = false; 3330 3331 // Clean up if we're done firing for good 3332 if ( locked ) { 3333 3334 // Keep an empty list if we have data for future add calls 3335 if ( memory ) { 3336 list = []; 3337 3338 // Otherwise, this object is spent 3339 } else { 3340 list = ""; 3341 } 3342 } 3343 }, 3344 3345 // Actual Callbacks object 3346 self = { 3347 3348 // Add a callback or a collection of callbacks to the list 3349 add: function() { 3350 if ( list ) { 3351 3352 // If we have memory from a past run, we should fire after adding 3353 if ( memory && !firing ) { 3354 firingIndex = list.length - 1; 3355 queue.push( memory ); 3356 } 3357 3358 ( function add( args ) { 3359 jQuery.each( args, function( _, arg ) { 3360 if ( isFunction( arg ) ) { 3361 if ( !options.unique || !self.has( arg ) ) { 3362 list.push( arg ); 3363 } 3364 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 3365 3366 // Inspect recursively 3367 add( arg ); 3368 } 3369 } ); 3370 } )( arguments ); 3371 3372 if ( memory && !firing ) { 3373 fire(); 3374 } 3375 } 3376 return this; 3377 }, 3378 3379 // Remove a callback from the list 3380 remove: function() { 3381 jQuery.each( arguments, function( _, arg ) { 3382 var index; 3383 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3384 list.splice( index, 1 ); 3385 3386 // Handle firing indexes 3387 if ( index <= firingIndex ) { 3388 firingIndex--; 3389 } 3390 } 3391 } ); 3392 return this; 3393 }, 3394 3395 // Check if a given callback is in the list. 3396 // If no argument is given, return whether or not list has callbacks attached. 3397 has: function( fn ) { 3398 return fn ? 3399 jQuery.inArray( fn, list ) > -1 : 3400 list.length > 0; 3401 }, 3402 3403 // Remove all callbacks from the list 3404 empty: function() { 3405 if ( list ) { 3406 list = []; 3407 } 3408 return this; 3409 }, 3410 3411 // Disable .fire and .add 3412 // Abort any current/pending executions 3413 // Clear all callbacks and values 3414 disable: function() { 3415 locked = queue = []; 3416 list = memory = ""; 3417 return this; 3418 }, 3419 disabled: function() { 3420 return !list; 3421 }, 3422 3423 // Disable .fire 3424 // Also disable .add unless we have memory (since it would have no effect) 3425 // Abort any pending executions 3426 lock: function() { 3427 locked = queue = []; 3428 if ( !memory && !firing ) { 3429 list = memory = ""; 3430 } 3431 return this; 3432 }, 3433 locked: function() { 3434 return !!locked; 3435 }, 3436 3437 // Call all callbacks with the given context and arguments 3438 fireWith: function( context, args ) { 3439 if ( !locked ) { 3440 args = args || []; 3441 args = [ context, args.slice ? args.slice() : args ]; 3442 queue.push( args ); 3443 if ( !firing ) { 3444 fire(); 3445 } 3446 } 3447 return this; 3448 }, 3449 3450 // Call all the callbacks with the given arguments 3451 fire: function() { 3452 self.fireWith( this, arguments ); 3453 return this; 3454 }, 3455 3456 // To know if the callbacks have already been called at least once 3457 fired: function() { 3458 return !!fired; 3459 } 3460 }; 3461 3462 return self; 3463}; 3464 3465 3466function Identity( v ) { 3467 return v; 3468} 3469function Thrower( ex ) { 3470 throw ex; 3471} 3472 3473function adoptValue( value, resolve, reject, noValue ) { 3474 var method; 3475 3476 try { 3477 3478 // Check for promise aspect first to privilege synchronous behavior 3479 if ( value && isFunction( ( method = value.promise ) ) ) { 3480 method.call( value ).done( resolve ).fail( reject ); 3481 3482 // Other thenables 3483 } else if ( value && isFunction( ( method = value.then ) ) ) { 3484 method.call( value, resolve, reject ); 3485 3486 // Other non-thenables 3487 } else { 3488 3489 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3490 // * false: [ value ].slice( 0 ) => resolve( value ) 3491 // * true: [ value ].slice( 1 ) => resolve() 3492 resolve.apply( undefined, [ value ].slice( noValue ) ); 3493 } 3494 3495 // For Promises/A+, convert exceptions into rejections 3496 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3497 // Deferred#then to conditionally suppress rejection. 3498 } catch ( value ) { 3499 3500 // Support: Android 4.0 only 3501 // Strict mode functions invoked without .call/.apply get global-object context 3502 reject.apply( undefined, [ value ] ); 3503 } 3504} 3505 3506jQuery.extend( { 3507 3508 Deferred: function( func ) { 3509 var tuples = [ 3510 3511 // action, add listener, callbacks, 3512 // ... .then handlers, argument index, [final state] 3513 [ "notify", "progress", jQuery.Callbacks( "memory" ), 3514 jQuery.Callbacks( "memory" ), 2 ], 3515 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 3516 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 3517 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 3518 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 3519 ], 3520 state = "pending", 3521 promise = { 3522 state: function() { 3523 return state; 3524 }, 3525 always: function() { 3526 deferred.done( arguments ).fail( arguments ); 3527 return this; 3528 }, 3529 "catch": function( fn ) { 3530 return promise.then( null, fn ); 3531 }, 3532 3533 // Keep pipe for back-compat 3534 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 3535 var fns = arguments; 3536 3537 return jQuery.Deferred( function( newDefer ) { 3538 jQuery.each( tuples, function( _i, tuple ) { 3539 3540 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3541 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 3542 3543 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3544 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3545 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3546 deferred[ tuple[ 1 ] ]( function() { 3547 var returned = fn && fn.apply( this, arguments ); 3548 if ( returned && isFunction( returned.promise ) ) { 3549 returned.promise() 3550 .progress( newDefer.notify ) 3551 .done( newDefer.resolve ) 3552 .fail( newDefer.reject ); 3553 } else { 3554 newDefer[ tuple[ 0 ] + "With" ]( 3555 this, 3556 fn ? [ returned ] : arguments 3557 ); 3558 } 3559 } ); 3560 } ); 3561 fns = null; 3562 } ).promise(); 3563 }, 3564 then: function( onFulfilled, onRejected, onProgress ) { 3565 var maxDepth = 0; 3566 function resolve( depth, deferred, handler, special ) { 3567 return function() { 3568 var that = this, 3569 args = arguments, 3570 mightThrow = function() { 3571 var returned, then; 3572 3573 // Support: Promises/A+ section 2.3.3.3.3 3574 // https://promisesaplus.com/#point-59 3575 // Ignore double-resolution attempts 3576 if ( depth < maxDepth ) { 3577 return; 3578 } 3579 3580 returned = handler.apply( that, args ); 3581 3582 // Support: Promises/A+ section 2.3.1 3583 // https://promisesaplus.com/#point-48 3584 if ( returned === deferred.promise() ) { 3585 throw new TypeError( "Thenable self-resolution" ); 3586 } 3587 3588 // Support: Promises/A+ sections 2.3.3.1, 3.5 3589 // https://promisesaplus.com/#point-54 3590 // https://promisesaplus.com/#point-75 3591 // Retrieve `then` only once 3592 then = returned && 3593 3594 // Support: Promises/A+ section 2.3.4 3595 // https://promisesaplus.com/#point-64 3596 // Only check objects and functions for thenability 3597 ( typeof returned === "object" || 3598 typeof returned === "function" ) && 3599 returned.then; 3600 3601 // Handle a returned thenable 3602 if ( isFunction( then ) ) { 3603 3604 // Special processors (notify) just wait for resolution 3605 if ( special ) { 3606 then.call( 3607 returned, 3608 resolve( maxDepth, deferred, Identity, special ), 3609 resolve( maxDepth, deferred, Thrower, special ) 3610 ); 3611 3612 // Normal processors (resolve) also hook into progress 3613 } else { 3614 3615 // ...and disregard older resolution values 3616 maxDepth++; 3617 3618 then.call( 3619 returned, 3620 resolve( maxDepth, deferred, Identity, special ), 3621 resolve( maxDepth, deferred, Thrower, special ), 3622 resolve( maxDepth, deferred, Identity, 3623 deferred.notifyWith ) 3624 ); 3625 } 3626 3627 // Handle all other returned values 3628 } else { 3629 3630 // Only substitute handlers pass on context 3631 // and multiple values (non-spec behavior) 3632 if ( handler !== Identity ) { 3633 that = undefined; 3634 args = [ returned ]; 3635 } 3636 3637 // Process the value(s) 3638 // Default process is resolve 3639 ( special || deferred.resolveWith )( that, args ); 3640 } 3641 }, 3642 3643 // Only normal processors (resolve) catch and reject exceptions 3644 process = special ? 3645 mightThrow : 3646 function() { 3647 try { 3648 mightThrow(); 3649 } catch ( e ) { 3650 3651 if ( jQuery.Deferred.exceptionHook ) { 3652 jQuery.Deferred.exceptionHook( e, 3653 process.error ); 3654 } 3655 3656 // Support: Promises/A+ section 2.3.3.3.4.1 3657 // https://promisesaplus.com/#point-61 3658 // Ignore post-resolution exceptions 3659 if ( depth + 1 >= maxDepth ) { 3660 3661 // Only substitute handlers pass on context 3662 // and multiple values (non-spec behavior) 3663 if ( handler !== Thrower ) { 3664 that = undefined; 3665 args = [ e ]; 3666 } 3667 3668 deferred.rejectWith( that, args ); 3669 } 3670 } 3671 }; 3672 3673 // Support: Promises/A+ section 2.3.3.3.1 3674 // https://promisesaplus.com/#point-57 3675 // Re-resolve promises immediately to dodge false rejection from 3676 // subsequent errors 3677 if ( depth ) { 3678 process(); 3679 } else { 3680 3681 // Call an optional hook to record the error, in case of exception 3682 // since it's otherwise lost when execution goes async 3683 if ( jQuery.Deferred.getErrorHook ) { 3684 process.error = jQuery.Deferred.getErrorHook(); 3685 3686 // The deprecated alias of the above. While the name suggests 3687 // returning the stack, not an error instance, jQuery just passes 3688 // it directly to `console.warn` so both will work; an instance 3689 // just better cooperates with source maps. 3690 } else if ( jQuery.Deferred.getStackHook ) { 3691 process.error = jQuery.Deferred.getStackHook(); 3692 } 3693 window.setTimeout( process ); 3694 } 3695 }; 3696 } 3697 3698 return jQuery.Deferred( function( newDefer ) { 3699 3700 // progress_handlers.add( ... ) 3701 tuples[ 0 ][ 3 ].add( 3702 resolve( 3703 0, 3704 newDefer, 3705 isFunction( onProgress ) ? 3706 onProgress : 3707 Identity, 3708 newDefer.notifyWith 3709 ) 3710 ); 3711 3712 // fulfilled_handlers.add( ... ) 3713 tuples[ 1 ][ 3 ].add( 3714 resolve( 3715 0, 3716 newDefer, 3717 isFunction( onFulfilled ) ? 3718 onFulfilled : 3719 Identity 3720 ) 3721 ); 3722 3723 // rejected_handlers.add( ... ) 3724 tuples[ 2 ][ 3 ].add( 3725 resolve( 3726 0, 3727 newDefer, 3728 isFunction( onRejected ) ? 3729 onRejected : 3730 Thrower 3731 ) 3732 ); 3733 } ).promise(); 3734 }, 3735 3736 // Get a promise for this deferred 3737 // If obj is provided, the promise aspect is added to the object 3738 promise: function( obj ) { 3739 return obj != null ? jQuery.extend( obj, promise ) : promise; 3740 } 3741 }, 3742 deferred = {}; 3743 3744 // Add list-specific methods 3745 jQuery.each( tuples, function( i, tuple ) { 3746 var list = tuple[ 2 ], 3747 stateString = tuple[ 5 ]; 3748 3749 // promise.progress = list.add 3750 // promise.done = list.add 3751 // promise.fail = list.add 3752 promise[ tuple[ 1 ] ] = list.add; 3753 3754 // Handle state 3755 if ( stateString ) { 3756 list.add( 3757 function() { 3758 3759 // state = "resolved" (i.e., fulfilled) 3760 // state = "rejected" 3761 state = stateString; 3762 }, 3763 3764 // rejected_callbacks.disable 3765 // fulfilled_callbacks.disable 3766 tuples[ 3 - i ][ 2 ].disable, 3767 3768 // rejected_handlers.disable 3769 // fulfilled_handlers.disable 3770 tuples[ 3 - i ][ 3 ].disable, 3771 3772 // progress_callbacks.lock 3773 tuples[ 0 ][ 2 ].lock, 3774 3775 // progress_handlers.lock 3776 tuples[ 0 ][ 3 ].lock 3777 ); 3778 } 3779 3780 // progress_handlers.fire 3781 // fulfilled_handlers.fire 3782 // rejected_handlers.fire 3783 list.add( tuple[ 3 ].fire ); 3784 3785 // deferred.notify = function() { deferred.notifyWith(...) } 3786 // deferred.resolve = function() { deferred.resolveWith(...) } 3787 // deferred.reject = function() { deferred.rejectWith(...) } 3788 deferred[ tuple[ 0 ] ] = function() { 3789 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 3790 return this; 3791 }; 3792 3793 // deferred.notifyWith = list.fireWith 3794 // deferred.resolveWith = list.fireWith 3795 // deferred.rejectWith = list.fireWith 3796 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3797 } ); 3798 3799 // Make the deferred a promise 3800 promise.promise( deferred ); 3801 3802 // Call given func if any 3803 if ( func ) { 3804 func.call( deferred, deferred ); 3805 } 3806 3807 // All done! 3808 return deferred; 3809 }, 3810 3811 // Deferred helper 3812 when: function( singleValue ) { 3813 var 3814 3815 // count of uncompleted subordinates 3816 remaining = arguments.length, 3817 3818 // count of unprocessed arguments 3819 i = remaining, 3820 3821 // subordinate fulfillment data 3822 resolveContexts = Array( i ), 3823 resolveValues = slice.call( arguments ), 3824 3825 // the primary Deferred 3826 primary = jQuery.Deferred(), 3827 3828 // subordinate callback factory 3829 updateFunc = function( i ) { 3830 return function( value ) { 3831 resolveContexts[ i ] = this; 3832 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 3833 if ( !( --remaining ) ) { 3834 primary.resolveWith( resolveContexts, resolveValues ); 3835 } 3836 }; 3837 }; 3838 3839 // Single- and empty arguments are adopted like Promise.resolve 3840 if ( remaining <= 1 ) { 3841 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 3842 !remaining ); 3843 3844 // Use .then() to unwrap secondary thenables (cf. gh-3000) 3845 if ( primary.state() === "pending" || 3846 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 3847 3848 return primary.then(); 3849 } 3850 } 3851 3852 // Multiple arguments are aggregated like Promise.all array elements 3853 while ( i-- ) { 3854 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 3855 } 3856 3857 return primary.promise(); 3858 } 3859} ); 3860 3861 3862// These usually indicate a programmer mistake during development, 3863// warn about them ASAP rather than swallowing them by default. 3864var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 3865 3866// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error 3867// captured before the async barrier to get the original error cause 3868// which may otherwise be hidden. 3869jQuery.Deferred.exceptionHook = function( error, asyncError ) { 3870 3871 // Support: IE 8 - 9 only 3872 // Console exists when dev tools are open, which can happen at any time 3873 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 3874 window.console.warn( "jQuery.Deferred exception: " + error.message, 3875 error.stack, asyncError ); 3876 } 3877}; 3878 3879 3880 3881 3882jQuery.readyException = function( error ) { 3883 window.setTimeout( function() { 3884 throw error; 3885 } ); 3886}; 3887 3888 3889 3890 3891// The deferred used on DOM ready 3892var readyList = jQuery.Deferred(); 3893 3894jQuery.fn.ready = function( fn ) { 3895 3896 readyList 3897 .then( fn ) 3898 3899 // Wrap jQuery.readyException in a function so that the lookup 3900 // happens at the time of error handling instead of callback 3901 // registration. 3902 .catch( function( error ) { 3903 jQuery.readyException( error ); 3904 } ); 3905 3906 return this; 3907}; 3908 3909jQuery.extend( { 3910 3911 // Is the DOM ready to be used? Set to true once it occurs. 3912 isReady: false, 3913 3914 // A counter to track how many items to wait for before 3915 // the ready event fires. See trac-6781 3916 readyWait: 1, 3917 3918 // Handle when the DOM is ready 3919 ready: function( wait ) { 3920 3921 // Abort if there are pending holds or we're already ready 3922 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 3923 return; 3924 } 3925 3926 // Remember that the DOM is ready 3927 jQuery.isReady = true; 3928 3929 // If a normal DOM Ready event fired, decrement, and wait if need be 3930 if ( wait !== true && --jQuery.readyWait > 0 ) { 3931 return; 3932 } 3933 3934 // If there are functions bound, to execute 3935 readyList.resolveWith( document, [ jQuery ] ); 3936 } 3937} ); 3938 3939jQuery.ready.then = readyList.then; 3940 3941// The ready event handler and self cleanup method 3942function completed() { 3943 document.removeEventListener( "DOMContentLoaded", completed ); 3944 window.removeEventListener( "load", completed ); 3945 jQuery.ready(); 3946} 3947 3948// Catch cases where $(document).ready() is called 3949// after the browser event has already occurred. 3950// Support: IE <=9 - 10 only 3951// Older IE sometimes signals "interactive" too soon 3952if ( document.readyState === "complete" || 3953 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 3954 3955 // Handle it asynchronously to allow scripts the opportunity to delay ready 3956 window.setTimeout( jQuery.ready ); 3957 3958} else { 3959 3960 // Use the handy event callback 3961 document.addEventListener( "DOMContentLoaded", completed ); 3962 3963 // A fallback to window.onload, that will always work 3964 window.addEventListener( "load", completed ); 3965} 3966 3967 3968 3969 3970// Multifunctional method to get and set values of a collection 3971// The value/s can optionally be executed if it's a function 3972var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 3973 var i = 0, 3974 len = elems.length, 3975 bulk = key == null; 3976 3977 // Sets many values 3978 if ( toType( key ) === "object" ) { 3979 chainable = true; 3980 for ( i in key ) { 3981 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 3982 } 3983 3984 // Sets one value 3985 } else if ( value !== undefined ) { 3986 chainable = true; 3987 3988 if ( !isFunction( value ) ) { 3989 raw = true; 3990 } 3991 3992 if ( bulk ) { 3993 3994 // Bulk operations run against the entire set 3995 if ( raw ) { 3996 fn.call( elems, value ); 3997 fn = null; 3998 3999 // ...except when executing function values 4000 } else { 4001 bulk = fn; 4002 fn = function( elem, _key, value ) { 4003 return bulk.call( jQuery( elem ), value ); 4004 }; 4005 } 4006 } 4007 4008 if ( fn ) { 4009 for ( ; i < len; i++ ) { 4010 fn( 4011 elems[ i ], key, raw ? 4012 value : 4013 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 4014 ); 4015 } 4016 } 4017 } 4018 4019 if ( chainable ) { 4020 return elems; 4021 } 4022 4023 // Gets 4024 if ( bulk ) { 4025 return fn.call( elems ); 4026 } 4027 4028 return len ? fn( elems[ 0 ], key ) : emptyGet; 4029}; 4030 4031 4032// Matches dashed string for camelizing 4033var rmsPrefix = /^-ms-/, 4034 rdashAlpha = /-([a-z])/g; 4035 4036// Used by camelCase as callback to replace() 4037function fcamelCase( _all, letter ) { 4038 return letter.toUpperCase(); 4039} 4040 4041// Convert dashed to camelCase; used by the css and data modules 4042// Support: IE <=9 - 11, Edge 12 - 15 4043// Microsoft forgot to hump their vendor prefix (trac-9572) 4044function camelCase( string ) { 4045 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 4046} 4047var acceptData = function( owner ) { 4048 4049 // Accepts only: 4050 // - Node 4051 // - Node.ELEMENT_NODE 4052 // - Node.DOCUMENT_NODE 4053 // - Object 4054 // - Any 4055 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 4056}; 4057 4058 4059 4060 4061function Data() { 4062 this.expando = jQuery.expando + Data.uid++; 4063} 4064 4065Data.uid = 1; 4066 4067Data.prototype = { 4068 4069 cache: function( owner ) { 4070 4071 // Check if the owner object already has a cache 4072 var value = owner[ this.expando ]; 4073 4074 // If not, create one 4075 if ( !value ) { 4076 value = {}; 4077 4078 // We can accept data for non-element nodes in modern browsers, 4079 // but we should not, see trac-8335. 4080 // Always return an empty object. 4081 if ( acceptData( owner ) ) { 4082 4083 // If it is a node unlikely to be stringify-ed or looped over 4084 // use plain assignment 4085 if ( owner.nodeType ) { 4086 owner[ this.expando ] = value; 4087 4088 // Otherwise secure it in a non-enumerable property 4089 // configurable must be true to allow the property to be 4090 // deleted when data is removed 4091 } else { 4092 Object.defineProperty( owner, this.expando, { 4093 value: value, 4094 configurable: true 4095 } ); 4096 } 4097 } 4098 } 4099 4100 return value; 4101 }, 4102 set: function( owner, data, value ) { 4103 var prop, 4104 cache = this.cache( owner ); 4105 4106 // Handle: [ owner, key, value ] args 4107 // Always use camelCase key (gh-2257) 4108 if ( typeof data === "string" ) { 4109 cache[ camelCase( data ) ] = value; 4110 4111 // Handle: [ owner, { properties } ] args 4112 } else { 4113 4114 // Copy the properties one-by-one to the cache object 4115 for ( prop in data ) { 4116 cache[ camelCase( prop ) ] = data[ prop ]; 4117 } 4118 } 4119 return cache; 4120 }, 4121 get: function( owner, key ) { 4122 return key === undefined ? 4123 this.cache( owner ) : 4124 4125 // Always use camelCase key (gh-2257) 4126 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4127 }, 4128 access: function( owner, key, value ) { 4129 4130 // In cases where either: 4131 // 4132 // 1. No key was specified 4133 // 2. A string key was specified, but no value provided 4134 // 4135 // Take the "read" path and allow the get method to determine 4136 // which value to return, respectively either: 4137 // 4138 // 1. The entire cache object 4139 // 2. The data stored at the key 4140 // 4141 if ( key === undefined || 4142 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4143 4144 return this.get( owner, key ); 4145 } 4146 4147 // When the key is not a string, or both a key and value 4148 // are specified, set or extend (existing objects) with either: 4149 // 4150 // 1. An object of properties 4151 // 2. A key and value 4152 // 4153 this.set( owner, key, value ); 4154 4155 // Since the "set" path can have two possible entry points 4156 // return the expected data based on which path was taken[*] 4157 return value !== undefined ? value : key; 4158 }, 4159 remove: function( owner, key ) { 4160 var i, 4161 cache = owner[ this.expando ]; 4162 4163 if ( cache === undefined ) { 4164 return; 4165 } 4166 4167 if ( key !== undefined ) { 4168 4169 // Support array or space separated string of keys 4170 if ( Array.isArray( key ) ) { 4171 4172 // If key is an array of keys... 4173 // We always set camelCase keys, so remove that. 4174 key = key.map( camelCase ); 4175 } else { 4176 key = camelCase( key ); 4177 4178 // If a key with the spaces exists, use it. 4179 // Otherwise, create an array by matching non-whitespace 4180 key = key in cache ? 4181 [ key ] : 4182 ( key.match( rnothtmlwhite ) || [] ); 4183 } 4184 4185 i = key.length; 4186 4187 while ( i-- ) { 4188 delete cache[ key[ i ] ]; 4189 } 4190 } 4191 4192 // Remove the expando if there's no more data 4193 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 4194 4195 // Support: Chrome <=35 - 45 4196 // Webkit & Blink performance suffers when deleting properties 4197 // from DOM nodes, so set to undefined instead 4198 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4199 if ( owner.nodeType ) { 4200 owner[ this.expando ] = undefined; 4201 } else { 4202 delete owner[ this.expando ]; 4203 } 4204 } 4205 }, 4206 hasData: function( owner ) { 4207 var cache = owner[ this.expando ]; 4208 return cache !== undefined && !jQuery.isEmptyObject( cache ); 4209 } 4210}; 4211var dataPriv = new Data(); 4212 4213var dataUser = new Data(); 4214 4215 4216 4217// Implementation Summary 4218// 4219// 1. Enforce API surface and semantic compatibility with 1.9.x branch 4220// 2. Improve the module's maintainability by reducing the storage 4221// paths to a single mechanism. 4222// 3. Use the same single mechanism to support "private" and "user" data. 4223// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4224// 5. Avoid exposing implementation details on user objects (eg. expando properties) 4225// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4226 4227var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4228 rmultiDash = /[A-Z]/g; 4229 4230function getData( data ) { 4231 if ( data === "true" ) { 4232 return true; 4233 } 4234 4235 if ( data === "false" ) { 4236 return false; 4237 } 4238 4239 if ( data === "null" ) { 4240 return null; 4241 } 4242 4243 // Only convert to a number if it doesn't change the string 4244 if ( data === +data + "" ) { 4245 return +data; 4246 } 4247 4248 if ( rbrace.test( data ) ) { 4249 return JSON.parse( data ); 4250 } 4251 4252 return data; 4253} 4254 4255function dataAttr( elem, key, data ) { 4256 var name; 4257 4258 // If nothing was found internally, try to fetch any 4259 // data from the HTML5 data-* attribute 4260 if ( data === undefined && elem.nodeType === 1 ) { 4261 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 4262 data = elem.getAttribute( name ); 4263 4264 if ( typeof data === "string" ) { 4265 try { 4266 data = getData( data ); 4267 } catch ( e ) {} 4268 4269 // Make sure we set the data so it isn't changed later 4270 dataUser.set( elem, key, data ); 4271 } else { 4272 data = undefined; 4273 } 4274 } 4275 return data; 4276} 4277 4278jQuery.extend( { 4279 hasData: function( elem ) { 4280 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 4281 }, 4282 4283 data: function( elem, name, data ) { 4284 return dataUser.access( elem, name, data ); 4285 }, 4286 4287 removeData: function( elem, name ) { 4288 dataUser.remove( elem, name ); 4289 }, 4290 4291 // TODO: Now that all calls to _data and _removeData have been replaced 4292 // with direct calls to dataPriv methods, these can be deprecated. 4293 _data: function( elem, name, data ) { 4294 return dataPriv.access( elem, name, data ); 4295 }, 4296 4297 _removeData: function( elem, name ) { 4298 dataPriv.remove( elem, name ); 4299 } 4300} ); 4301 4302jQuery.fn.extend( { 4303 data: function( key, value ) { 4304 var i, name, data, 4305 elem = this[ 0 ], 4306 attrs = elem && elem.attributes; 4307 4308 // Gets all values 4309 if ( key === undefined ) { 4310 if ( this.length ) { 4311 data = dataUser.get( elem ); 4312 4313 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 4314 i = attrs.length; 4315 while ( i-- ) { 4316 4317 // Support: IE 11 only 4318 // The attrs elements can be null (trac-14894) 4319 if ( attrs[ i ] ) { 4320 name = attrs[ i ].name; 4321 if ( name.indexOf( "data-" ) === 0 ) { 4322 name = camelCase( name.slice( 5 ) ); 4323 dataAttr( elem, name, data[ name ] ); 4324 } 4325 } 4326 } 4327 dataPriv.set( elem, "hasDataAttrs", true ); 4328 } 4329 } 4330 4331 return data; 4332 } 4333 4334 // Sets multiple values 4335 if ( typeof key === "object" ) { 4336 return this.each( function() { 4337 dataUser.set( this, key ); 4338 } ); 4339 } 4340 4341 return access( this, function( value ) { 4342 var data; 4343 4344 // The calling jQuery object (element matches) is not empty 4345 // (and therefore has an element appears at this[ 0 ]) and the 4346 // `value` parameter was not undefined. An empty jQuery object 4347 // will result in `undefined` for elem = this[ 0 ] which will 4348 // throw an exception if an attempt to read a data cache is made. 4349 if ( elem && value === undefined ) { 4350 4351 // Attempt to get data from the cache 4352 // The key will always be camelCased in Data 4353 data = dataUser.get( elem, key ); 4354 if ( data !== undefined ) { 4355 return data; 4356 } 4357 4358 // Attempt to "discover" the data in 4359 // HTML5 custom data-* attrs 4360 data = dataAttr( elem, key ); 4361 if ( data !== undefined ) { 4362 return data; 4363 } 4364 4365 // We tried really hard, but the data doesn't exist. 4366 return; 4367 } 4368 4369 // Set the data... 4370 this.each( function() { 4371 4372 // We always store the camelCased key 4373 dataUser.set( this, key, value ); 4374 } ); 4375 }, null, value, arguments.length > 1, null, true ); 4376 }, 4377 4378 removeData: function( key ) { 4379 return this.each( function() { 4380 dataUser.remove( this, key ); 4381 } ); 4382 } 4383} ); 4384 4385 4386jQuery.extend( { 4387 queue: function( elem, type, data ) { 4388 var queue; 4389 4390 if ( elem ) { 4391 type = ( type || "fx" ) + "queue"; 4392 queue = dataPriv.get( elem, type ); 4393 4394 // Speed up dequeue by getting out quickly if this is just a lookup 4395 if ( data ) { 4396 if ( !queue || Array.isArray( data ) ) { 4397 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 4398 } else { 4399 queue.push( data ); 4400 } 4401 } 4402 return queue || []; 4403 } 4404 }, 4405 4406 dequeue: function( elem, type ) { 4407 type = type || "fx"; 4408 4409 var queue = jQuery.queue( elem, type ), 4410 startLength = queue.length, 4411 fn = queue.shift(), 4412 hooks = jQuery._queueHooks( elem, type ), 4413 next = function() { 4414 jQuery.dequeue( elem, type ); 4415 }; 4416 4417 // If the fx queue is dequeued, always remove the progress sentinel 4418 if ( fn === "inprogress" ) { 4419 fn = queue.shift(); 4420 startLength--; 4421 } 4422 4423 if ( fn ) { 4424 4425 // Add a progress sentinel to prevent the fx queue from being 4426 // automatically dequeued 4427 if ( type === "fx" ) { 4428 queue.unshift( "inprogress" ); 4429 } 4430 4431 // Clear up the last queue stop function 4432 delete hooks.stop; 4433 fn.call( elem, next, hooks ); 4434 } 4435 4436 if ( !startLength && hooks ) { 4437 hooks.empty.fire(); 4438 } 4439 }, 4440 4441 // Not public - generate a queueHooks object, or return the current one 4442 _queueHooks: function( elem, type ) { 4443 var key = type + "queueHooks"; 4444 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 4445 empty: jQuery.Callbacks( "once memory" ).add( function() { 4446 dataPriv.remove( elem, [ type + "queue", key ] ); 4447 } ) 4448 } ); 4449 } 4450} ); 4451 4452jQuery.fn.extend( { 4453 queue: function( type, data ) { 4454 var setter = 2; 4455 4456 if ( typeof type !== "string" ) { 4457 data = type; 4458 type = "fx"; 4459 setter--; 4460 } 4461 4462 if ( arguments.length < setter ) { 4463 return jQuery.queue( this[ 0 ], type ); 4464 } 4465 4466 return data === undefined ? 4467 this : 4468 this.each( function() { 4469 var queue = jQuery.queue( this, type, data ); 4470 4471 // Ensure a hooks for this queue 4472 jQuery._queueHooks( this, type ); 4473 4474 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4475 jQuery.dequeue( this, type ); 4476 } 4477 } ); 4478 }, 4479 dequeue: function( type ) { 4480 return this.each( function() { 4481 jQuery.dequeue( this, type ); 4482 } ); 4483 }, 4484 clearQueue: function( type ) { 4485 return this.queue( type || "fx", [] ); 4486 }, 4487 4488 // Get a promise resolved when queues of a certain type 4489 // are emptied (fx is the type by default) 4490 promise: function( type, obj ) { 4491 var tmp, 4492 count = 1, 4493 defer = jQuery.Deferred(), 4494 elements = this, 4495 i = this.length, 4496 resolve = function() { 4497 if ( !( --count ) ) { 4498 defer.resolveWith( elements, [ elements ] ); 4499 } 4500 }; 4501 4502 if ( typeof type !== "string" ) { 4503 obj = type; 4504 type = undefined; 4505 } 4506 type = type || "fx"; 4507 4508 while ( i-- ) { 4509 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 4510 if ( tmp && tmp.empty ) { 4511 count++; 4512 tmp.empty.add( resolve ); 4513 } 4514 } 4515 resolve(); 4516 return defer.promise( obj ); 4517 } 4518} ); 4519var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4520 4521var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4522 4523 4524var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4525 4526var documentElement = document.documentElement; 4527 4528 4529 4530 var isAttached = function( elem ) { 4531 return jQuery.contains( elem.ownerDocument, elem ); 4532 }, 4533 composed = { composed: true }; 4534 4535 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 4536 // Check attachment across shadow DOM boundaries when possible (gh-3504) 4537 // Support: iOS 10.0-10.2 only 4538 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 4539 // leading to errors. We need to check for `getRootNode`. 4540 if ( documentElement.getRootNode ) { 4541 isAttached = function( elem ) { 4542 return jQuery.contains( elem.ownerDocument, elem ) || 4543 elem.getRootNode( composed ) === elem.ownerDocument; 4544 }; 4545 } 4546var isHiddenWithinTree = function( elem, el ) { 4547 4548 // isHiddenWithinTree might be called from jQuery#filter function; 4549 // in that case, element will be second argument 4550 elem = el || elem; 4551 4552 // Inline style trumps all 4553 return elem.style.display === "none" || 4554 elem.style.display === "" && 4555 4556 // Otherwise, check computed style 4557 // Support: Firefox <=43 - 45 4558 // Disconnected elements can have computed display: none, so first confirm that elem is 4559 // in the document. 4560 isAttached( elem ) && 4561 4562 jQuery.css( elem, "display" ) === "none"; 4563 }; 4564 4565 4566 4567function adjustCSS( elem, prop, valueParts, tween ) { 4568 var adjusted, scale, 4569 maxIterations = 20, 4570 currentValue = tween ? 4571 function() { 4572 return tween.cur(); 4573 } : 4574 function() { 4575 return jQuery.css( elem, prop, "" ); 4576 }, 4577 initial = currentValue(), 4578 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4579 4580 // Starting value computation is required for potential unit mismatches 4581 initialInUnit = elem.nodeType && 4582 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4583 rcssNum.exec( jQuery.css( elem, prop ) ); 4584 4585 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4586 4587 // Support: Firefox <=54 4588 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4589 initial = initial / 2; 4590 4591 // Trust units reported by jQuery.css 4592 unit = unit || initialInUnit[ 3 ]; 4593 4594 // Iteratively approximate from a nonzero starting point 4595 initialInUnit = +initial || 1; 4596 4597 while ( maxIterations-- ) { 4598 4599 // Evaluate and update our best guess (doubling guesses that zero out). 4600 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4601 jQuery.style( elem, prop, initialInUnit + unit ); 4602 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 4603 maxIterations = 0; 4604 } 4605 initialInUnit = initialInUnit / scale; 4606 4607 } 4608 4609 initialInUnit = initialInUnit * 2; 4610 jQuery.style( elem, prop, initialInUnit + unit ); 4611 4612 // Make sure we update the tween properties later on 4613 valueParts = valueParts || []; 4614 } 4615 4616 if ( valueParts ) { 4617 initialInUnit = +initialInUnit || +initial || 0; 4618 4619 // Apply relative offset (+=/-=) if specified 4620 adjusted = valueParts[ 1 ] ? 4621 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4622 +valueParts[ 2 ]; 4623 if ( tween ) { 4624 tween.unit = unit; 4625 tween.start = initialInUnit; 4626 tween.end = adjusted; 4627 } 4628 } 4629 return adjusted; 4630} 4631 4632 4633var defaultDisplayMap = {}; 4634 4635function getDefaultDisplay( elem ) { 4636 var temp, 4637 doc = elem.ownerDocument, 4638 nodeName = elem.nodeName, 4639 display = defaultDisplayMap[ nodeName ]; 4640 4641 if ( display ) { 4642 return display; 4643 } 4644 4645 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 4646 display = jQuery.css( temp, "display" ); 4647 4648 temp.parentNode.removeChild( temp ); 4649 4650 if ( display === "none" ) { 4651 display = "block"; 4652 } 4653 defaultDisplayMap[ nodeName ] = display; 4654 4655 return display; 4656} 4657 4658function showHide( elements, show ) { 4659 var display, elem, 4660 values = [], 4661 index = 0, 4662 length = elements.length; 4663 4664 // Determine new display value for elements that need to change 4665 for ( ; index < length; index++ ) { 4666 elem = elements[ index ]; 4667 if ( !elem.style ) { 4668 continue; 4669 } 4670 4671 display = elem.style.display; 4672 if ( show ) { 4673 4674 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4675 // check is required in this first loop unless we have a nonempty display value (either 4676 // inline or about-to-be-restored) 4677 if ( display === "none" ) { 4678 values[ index ] = dataPriv.get( elem, "display" ) || null; 4679 if ( !values[ index ] ) { 4680 elem.style.display = ""; 4681 } 4682 } 4683 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 4684 values[ index ] = getDefaultDisplay( elem ); 4685 } 4686 } else { 4687 if ( display !== "none" ) { 4688 values[ index ] = "none"; 4689 4690 // Remember what we're overwriting 4691 dataPriv.set( elem, "display", display ); 4692 } 4693 } 4694 } 4695 4696 // Set the display of the elements in a second loop to avoid constant reflow 4697 for ( index = 0; index < length; index++ ) { 4698 if ( values[ index ] != null ) { 4699 elements[ index ].style.display = values[ index ]; 4700 } 4701 } 4702 4703 return elements; 4704} 4705 4706jQuery.fn.extend( { 4707 show: function() { 4708 return showHide( this, true ); 4709 }, 4710 hide: function() { 4711 return showHide( this ); 4712 }, 4713 toggle: function( state ) { 4714 if ( typeof state === "boolean" ) { 4715 return state ? this.show() : this.hide(); 4716 } 4717 4718 return this.each( function() { 4719 if ( isHiddenWithinTree( this ) ) { 4720 jQuery( this ).show(); 4721 } else { 4722 jQuery( this ).hide(); 4723 } 4724 } ); 4725 } 4726} ); 4727var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4728 4729var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 4730 4731var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 4732 4733 4734 4735( function() { 4736 var fragment = document.createDocumentFragment(), 4737 div = fragment.appendChild( document.createElement( "div" ) ), 4738 input = document.createElement( "input" ); 4739 4740 // Support: Android 4.0 - 4.3 only 4741 // Check state lost if the name is set (trac-11217) 4742 // Support: Windows Web Apps (WWA) 4743 // `name` and `type` must use .setAttribute for WWA (trac-14901) 4744 input.setAttribute( "type", "radio" ); 4745 input.setAttribute( "checked", "checked" ); 4746 input.setAttribute( "name", "t" ); 4747 4748 div.appendChild( input ); 4749 4750 // Support: Android <=4.1 only 4751 // Older WebKit doesn't clone checked state correctly in fragments 4752 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4753 4754 // Support: IE <=11 only 4755 // Make sure textarea (and checkbox) defaultValue is properly cloned 4756 div.innerHTML = "<textarea>x</textarea>"; 4757 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4758 4759 // Support: IE <=9 only 4760 // IE <=9 replaces <option> tags with their contents when inserted outside of 4761 // the select element. 4762 div.innerHTML = "<option></option>"; 4763 support.option = !!div.lastChild; 4764} )(); 4765 4766 4767// We have to close these tags to support XHTML (trac-13200) 4768var wrapMap = { 4769 4770 // XHTML parsers do not magically insert elements in the 4771 // same way that tag soup parsers do. So we cannot shorten 4772 // this by omitting <tbody> or other required elements. 4773 thead: [ 1, "<table>", "</table>" ], 4774 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 4775 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4776 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4777 4778 _default: [ 0, "", "" ] 4779}; 4780 4781wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4782wrapMap.th = wrapMap.td; 4783 4784// Support: IE <=9 only 4785if ( !support.option ) { 4786 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 4787} 4788 4789 4790function getAll( context, tag ) { 4791 4792 // Support: IE <=9 - 11 only 4793 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 4794 var ret; 4795 4796 if ( typeof context.getElementsByTagName !== "undefined" ) { 4797 ret = context.getElementsByTagName( tag || "*" ); 4798 4799 } else if ( typeof context.querySelectorAll !== "undefined" ) { 4800 ret = context.querySelectorAll( tag || "*" ); 4801 4802 } else { 4803 ret = []; 4804 } 4805 4806 if ( tag === undefined || tag && nodeName( context, tag ) ) { 4807 return jQuery.merge( [ context ], ret ); 4808 } 4809 4810 return ret; 4811} 4812 4813 4814// Mark scripts as having already been evaluated 4815function setGlobalEval( elems, refElements ) { 4816 var i = 0, 4817 l = elems.length; 4818 4819 for ( ; i < l; i++ ) { 4820 dataPriv.set( 4821 elems[ i ], 4822 "globalEval", 4823 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 4824 ); 4825 } 4826} 4827 4828 4829var rhtml = /<|&#?\w+;/; 4830 4831function buildFragment( elems, context, scripts, selection, ignored ) { 4832 var elem, tmp, tag, wrap, attached, j, 4833 fragment = context.createDocumentFragment(), 4834 nodes = [], 4835 i = 0, 4836 l = elems.length; 4837 4838 for ( ; i < l; i++ ) { 4839 elem = elems[ i ]; 4840 4841 if ( elem || elem === 0 ) { 4842 4843 // Add nodes directly 4844 if ( toType( elem ) === "object" ) { 4845 4846 // Support: Android <=4.0 only, PhantomJS 1 only 4847 // push.apply(_, arraylike) throws on ancient WebKit 4848 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 4849 4850 // Convert non-html into a text node 4851 } else if ( !rhtml.test( elem ) ) { 4852 nodes.push( context.createTextNode( elem ) ); 4853 4854 // Convert html into DOM nodes 4855 } else { 4856 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 4857 4858 // Deserialize a standard representation 4859 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 4860 wrap = wrapMap[ tag ] || wrapMap._default; 4861 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 4862 4863 // Descend through wrappers to the right content 4864 j = wrap[ 0 ]; 4865 while ( j-- ) { 4866 tmp = tmp.lastChild; 4867 } 4868 4869 // Support: Android <=4.0 only, PhantomJS 1 only 4870 // push.apply(_, arraylike) throws on ancient WebKit 4871 jQuery.merge( nodes, tmp.childNodes ); 4872 4873 // Remember the top-level container 4874 tmp = fragment.firstChild; 4875 4876 // Ensure the created nodes are orphaned (trac-12392) 4877 tmp.textContent = ""; 4878 } 4879 } 4880 } 4881 4882 // Remove wrapper from fragment 4883 fragment.textContent = ""; 4884 4885 i = 0; 4886 while ( ( elem = nodes[ i++ ] ) ) { 4887 4888 // Skip elements already in the context collection (trac-4087) 4889 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 4890 if ( ignored ) { 4891 ignored.push( elem ); 4892 } 4893 continue; 4894 } 4895 4896 attached = isAttached( elem ); 4897 4898 // Append to fragment 4899 tmp = getAll( fragment.appendChild( elem ), "script" ); 4900 4901 // Preserve script evaluation history 4902 if ( attached ) { 4903 setGlobalEval( tmp ); 4904 } 4905 4906 // Capture executables 4907 if ( scripts ) { 4908 j = 0; 4909 while ( ( elem = tmp[ j++ ] ) ) { 4910 if ( rscriptType.test( elem.type || "" ) ) { 4911 scripts.push( elem ); 4912 } 4913 } 4914 } 4915 } 4916 4917 return fragment; 4918} 4919 4920 4921var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 4922 4923function returnTrue() { 4924 return true; 4925} 4926 4927function returnFalse() { 4928 return false; 4929} 4930 4931function on( elem, types, selector, data, fn, one ) { 4932 var origFn, type; 4933 4934 // Types can be a map of types/handlers 4935 if ( typeof types === "object" ) { 4936 4937 // ( types-Object, selector, data ) 4938 if ( typeof selector !== "string" ) { 4939 4940 // ( types-Object, data ) 4941 data = data || selector; 4942 selector = undefined; 4943 } 4944 for ( type in types ) { 4945 on( elem, type, selector, data, types[ type ], one ); 4946 } 4947 return elem; 4948 } 4949 4950 if ( data == null && fn == null ) { 4951 4952 // ( types, fn ) 4953 fn = selector; 4954 data = selector = undefined; 4955 } else if ( fn == null ) { 4956 if ( typeof selector === "string" ) { 4957 4958 // ( types, selector, fn ) 4959 fn = data; 4960 data = undefined; 4961 } else { 4962 4963 // ( types, data, fn ) 4964 fn = data; 4965 data = selector; 4966 selector = undefined; 4967 } 4968 } 4969 if ( fn === false ) { 4970 fn = returnFalse; 4971 } else if ( !fn ) { 4972 return elem; 4973 } 4974 4975 if ( one === 1 ) { 4976 origFn = fn; 4977 fn = function( event ) { 4978 4979 // Can use an empty set, since event contains the info 4980 jQuery().off( event ); 4981 return origFn.apply( this, arguments ); 4982 }; 4983 4984 // Use same guid so caller can remove using origFn 4985 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 4986 } 4987 return elem.each( function() { 4988 jQuery.event.add( this, types, fn, data, selector ); 4989 } ); 4990} 4991 4992/* 4993 * Helper functions for managing events -- not part of the public interface. 4994 * Props to Dean Edwards' addEvent library for many of the ideas. 4995 */ 4996jQuery.event = { 4997 4998 global: {}, 4999 5000 add: function( elem, types, handler, data, selector ) { 5001 5002 var handleObjIn, eventHandle, tmp, 5003 events, t, handleObj, 5004 special, handlers, type, namespaces, origType, 5005 elemData = dataPriv.get( elem ); 5006 5007 // Only attach events to objects that accept data 5008 if ( !acceptData( elem ) ) { 5009 return; 5010 } 5011 5012 // Caller can pass in an object of custom data in lieu of the handler 5013 if ( handler.handler ) { 5014 handleObjIn = handler; 5015 handler = handleObjIn.handler; 5016 selector = handleObjIn.selector; 5017 } 5018 5019 // Ensure that invalid selectors throw exceptions at attach time 5020 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 5021 if ( selector ) { 5022 jQuery.find.matchesSelector( documentElement, selector ); 5023 } 5024 5025 // Make sure that the handler has a unique ID, used to find/remove it later 5026 if ( !handler.guid ) { 5027 handler.guid = jQuery.guid++; 5028 } 5029 5030 // Init the element's event structure and main handler, if this is the first 5031 if ( !( events = elemData.events ) ) { 5032 events = elemData.events = Object.create( null ); 5033 } 5034 if ( !( eventHandle = elemData.handle ) ) { 5035 eventHandle = elemData.handle = function( e ) { 5036 5037 // Discard the second event of a jQuery.event.trigger() and 5038 // when an event is called after a page has unloaded 5039 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 5040 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 5041 }; 5042 } 5043 5044 // Handle multiple events separated by a space 5045 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5046 t = types.length; 5047 while ( t-- ) { 5048 tmp = rtypenamespace.exec( types[ t ] ) || []; 5049 type = origType = tmp[ 1 ]; 5050 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5051 5052 // There *must* be a type, no attaching namespace-only handlers 5053 if ( !type ) { 5054 continue; 5055 } 5056 5057 // If event changes its type, use the special event handlers for the changed type 5058 special = jQuery.event.special[ type ] || {}; 5059 5060 // If selector defined, determine special event api type, otherwise given type 5061 type = ( selector ? special.delegateType : special.bindType ) || type; 5062 5063 // Update special based on newly reset type 5064 special = jQuery.event.special[ type ] || {}; 5065 5066 // handleObj is passed to all event handlers 5067 handleObj = jQuery.extend( { 5068 type: type, 5069 origType: origType, 5070 data: data, 5071 handler: handler, 5072 guid: handler.guid, 5073 selector: selector, 5074 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 5075 namespace: namespaces.join( "." ) 5076 }, handleObjIn ); 5077 5078 // Init the event handler queue if we're the first 5079 if ( !( handlers = events[ type ] ) ) { 5080 handlers = events[ type ] = []; 5081 handlers.delegateCount = 0; 5082 5083 // Only use addEventListener if the special events handler returns false 5084 if ( !special.setup || 5085 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 5086 5087 if ( elem.addEventListener ) { 5088 elem.addEventListener( type, eventHandle ); 5089 } 5090 } 5091 } 5092 5093 if ( special.add ) { 5094 special.add.call( elem, handleObj ); 5095 5096 if ( !handleObj.handler.guid ) { 5097 handleObj.handler.guid = handler.guid; 5098 } 5099 } 5100 5101 // Add to the element's handler list, delegates in front 5102 if ( selector ) { 5103 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5104 } else { 5105 handlers.push( handleObj ); 5106 } 5107 5108 // Keep track of which events have ever been used, for event optimization 5109 jQuery.event.global[ type ] = true; 5110 } 5111 5112 }, 5113 5114 // Detach an event or set of events from an element 5115 remove: function( elem, types, handler, selector, mappedTypes ) { 5116 5117 var j, origCount, tmp, 5118 events, t, handleObj, 5119 special, handlers, type, namespaces, origType, 5120 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 5121 5122 if ( !elemData || !( events = elemData.events ) ) { 5123 return; 5124 } 5125 5126 // Once for each type.namespace in types; type may be omitted 5127 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5128 t = types.length; 5129 while ( t-- ) { 5130 tmp = rtypenamespace.exec( types[ t ] ) || []; 5131 type = origType = tmp[ 1 ]; 5132 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5133 5134 // Unbind all events (on this namespace, if provided) for the element 5135 if ( !type ) { 5136 for ( type in events ) { 5137 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 5138 } 5139 continue; 5140 } 5141 5142 special = jQuery.event.special[ type ] || {}; 5143 type = ( selector ? special.delegateType : special.bindType ) || type; 5144 handlers = events[ type ] || []; 5145 tmp = tmp[ 2 ] && 5146 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5147 5148 // Remove matching events 5149 origCount = j = handlers.length; 5150 while ( j-- ) { 5151 handleObj = handlers[ j ]; 5152 5153 if ( ( mappedTypes || origType === handleObj.origType ) && 5154 ( !handler || handler.guid === handleObj.guid ) && 5155 ( !tmp || tmp.test( handleObj.namespace ) ) && 5156 ( !selector || selector === handleObj.selector || 5157 selector === "**" && handleObj.selector ) ) { 5158 handlers.splice( j, 1 ); 5159 5160 if ( handleObj.selector ) { 5161 handlers.delegateCount--; 5162 } 5163 if ( special.remove ) { 5164 special.remove.call( elem, handleObj ); 5165 } 5166 } 5167 } 5168 5169 // Remove generic event handler if we removed something and no more handlers exist 5170 // (avoids potential for endless recursion during removal of special event handlers) 5171 if ( origCount && !handlers.length ) { 5172 if ( !special.teardown || 5173 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5174 5175 jQuery.removeEvent( elem, type, elemData.handle ); 5176 } 5177 5178 delete events[ type ]; 5179 } 5180 } 5181 5182 // Remove data and the expando if it's no longer used 5183 if ( jQuery.isEmptyObject( events ) ) { 5184 dataPriv.remove( elem, "handle events" ); 5185 } 5186 }, 5187 5188 dispatch: function( nativeEvent ) { 5189 5190 var i, j, ret, matched, handleObj, handlerQueue, 5191 args = new Array( arguments.length ), 5192 5193 // Make a writable jQuery.Event from the native event object 5194 event = jQuery.event.fix( nativeEvent ), 5195 5196 handlers = ( 5197 dataPriv.get( this, "events" ) || Object.create( null ) 5198 )[ event.type ] || [], 5199 special = jQuery.event.special[ event.type ] || {}; 5200 5201 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5202 args[ 0 ] = event; 5203 5204 for ( i = 1; i < arguments.length; i++ ) { 5205 args[ i ] = arguments[ i ]; 5206 } 5207 5208 event.delegateTarget = this; 5209 5210 // Call the preDispatch hook for the mapped type, and let it bail if desired 5211 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5212 return; 5213 } 5214 5215 // Determine handlers 5216 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5217 5218 // Run delegates first; they may want to stop propagation beneath us 5219 i = 0; 5220 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5221 event.currentTarget = matched.elem; 5222 5223 j = 0; 5224 while ( ( handleObj = matched.handlers[ j++ ] ) && 5225 !event.isImmediatePropagationStopped() ) { 5226 5227 // If the event is namespaced, then each handler is only invoked if it is 5228 // specially universal or its namespaces are a superset of the event's. 5229 if ( !event.rnamespace || handleObj.namespace === false || 5230 event.rnamespace.test( handleObj.namespace ) ) { 5231 5232 event.handleObj = handleObj; 5233 event.data = handleObj.data; 5234 5235 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5236 handleObj.handler ).apply( matched.elem, args ); 5237 5238 if ( ret !== undefined ) { 5239 if ( ( event.result = ret ) === false ) { 5240 event.preventDefault(); 5241 event.stopPropagation(); 5242 } 5243 } 5244 } 5245 } 5246 } 5247 5248 // Call the postDispatch hook for the mapped type 5249 if ( special.postDispatch ) { 5250 special.postDispatch.call( this, event ); 5251 } 5252 5253 return event.result; 5254 }, 5255 5256 handlers: function( event, handlers ) { 5257 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5258 handlerQueue = [], 5259 delegateCount = handlers.delegateCount, 5260 cur = event.target; 5261 5262 // Find delegate handlers 5263 if ( delegateCount && 5264 5265 // Support: IE <=9 5266 // Black-hole SVG <use> instance trees (trac-13180) 5267 cur.nodeType && 5268 5269 // Support: Firefox <=42 5270 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5271 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5272 // Support: IE 11 only 5273 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5274 !( event.type === "click" && event.button >= 1 ) ) { 5275 5276 for ( ; cur !== this; cur = cur.parentNode || this ) { 5277 5278 // Don't check non-elements (trac-13208) 5279 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 5280 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 5281 matchedHandlers = []; 5282 matchedSelectors = {}; 5283 for ( i = 0; i < delegateCount; i++ ) { 5284 handleObj = handlers[ i ]; 5285 5286 // Don't conflict with Object.prototype properties (trac-13203) 5287 sel = handleObj.selector + " "; 5288 5289 if ( matchedSelectors[ sel ] === undefined ) { 5290 matchedSelectors[ sel ] = handleObj.needsContext ? 5291 jQuery( sel, this ).index( cur ) > -1 : 5292 jQuery.find( sel, this, null, [ cur ] ).length; 5293 } 5294 if ( matchedSelectors[ sel ] ) { 5295 matchedHandlers.push( handleObj ); 5296 } 5297 } 5298 if ( matchedHandlers.length ) { 5299 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 5300 } 5301 } 5302 } 5303 } 5304 5305 // Add the remaining (directly-bound) handlers 5306 cur = this; 5307 if ( delegateCount < handlers.length ) { 5308 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 5309 } 5310 5311 return handlerQueue; 5312 }, 5313 5314 addProp: function( name, hook ) { 5315 Object.defineProperty( jQuery.Event.prototype, name, { 5316 enumerable: true, 5317 configurable: true, 5318 5319 get: isFunction( hook ) ? 5320 function() { 5321 if ( this.originalEvent ) { 5322 return hook( this.originalEvent ); 5323 } 5324 } : 5325 function() { 5326 if ( this.originalEvent ) { 5327 return this.originalEvent[ name ]; 5328 } 5329 }, 5330 5331 set: function( value ) { 5332 Object.defineProperty( this, name, { 5333 enumerable: true, 5334 configurable: true, 5335 writable: true, 5336 value: value 5337 } ); 5338 } 5339 } ); 5340 }, 5341 5342 fix: function( originalEvent ) { 5343 return originalEvent[ jQuery.expando ] ? 5344 originalEvent : 5345 new jQuery.Event( originalEvent ); 5346 }, 5347 5348 special: { 5349 load: { 5350 5351 // Prevent triggered image.load events from bubbling to window.load 5352 noBubble: true 5353 }, 5354 click: { 5355 5356 // Utilize native event to ensure correct state for checkable inputs 5357 setup: function( data ) { 5358 5359 // For mutual compressibility with _default, replace `this` access with a local var. 5360 // `|| data` is dead code meant only to preserve the variable through minification. 5361 var el = this || data; 5362 5363 // Claim the first handler 5364 if ( rcheckableType.test( el.type ) && 5365 el.click && nodeName( el, "input" ) ) { 5366 5367 // dataPriv.set( el, "click", ... ) 5368 leverageNative( el, "click", true ); 5369 } 5370 5371 // Return false to allow normal processing in the caller 5372 return false; 5373 }, 5374 trigger: function( data ) { 5375 5376 // For mutual compressibility with _default, replace `this` access with a local var. 5377 // `|| data` is dead code meant only to preserve the variable through minification. 5378 var el = this || data; 5379 5380 // Force setup before triggering a click 5381 if ( rcheckableType.test( el.type ) && 5382 el.click && nodeName( el, "input" ) ) { 5383 5384 leverageNative( el, "click" ); 5385 } 5386 5387 // Return non-false to allow normal event-path propagation 5388 return true; 5389 }, 5390 5391 // For cross-browser consistency, suppress native .click() on links 5392 // Also prevent it if we're currently inside a leveraged native-event stack 5393 _default: function( event ) { 5394 var target = event.target; 5395 return rcheckableType.test( target.type ) && 5396 target.click && nodeName( target, "input" ) && 5397 dataPriv.get( target, "click" ) || 5398 nodeName( target, "a" ); 5399 } 5400 }, 5401 5402 beforeunload: { 5403 postDispatch: function( event ) { 5404 5405 // Support: Firefox 20+ 5406 // Firefox doesn't alert if the returnValue field is not set. 5407 if ( event.result !== undefined && event.originalEvent ) { 5408 event.originalEvent.returnValue = event.result; 5409 } 5410 } 5411 } 5412 } 5413}; 5414 5415// Ensure the presence of an event listener that handles manually-triggered 5416// synthetic events by interrupting progress until reinvoked in response to 5417// *native* events that it fires directly, ensuring that state changes have 5418// already occurred before other listeners are invoked. 5419function leverageNative( el, type, isSetup ) { 5420 5421 // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add 5422 if ( !isSetup ) { 5423 if ( dataPriv.get( el, type ) === undefined ) { 5424 jQuery.event.add( el, type, returnTrue ); 5425 } 5426 return; 5427 } 5428 5429 // Register the controller as a special universal handler for all event namespaces 5430 dataPriv.set( el, type, false ); 5431 jQuery.event.add( el, type, { 5432 namespace: false, 5433 handler: function( event ) { 5434 var result, 5435 saved = dataPriv.get( this, type ); 5436 5437 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 5438 5439 // Interrupt processing of the outer synthetic .trigger()ed event 5440 if ( !saved ) { 5441 5442 // Store arguments for use when handling the inner native event 5443 // There will always be at least one argument (an event object), so this array 5444 // will not be confused with a leftover capture object. 5445 saved = slice.call( arguments ); 5446 dataPriv.set( this, type, saved ); 5447 5448 // Trigger the native event and capture its result 5449 this[ type ](); 5450 result = dataPriv.get( this, type ); 5451 dataPriv.set( this, type, false ); 5452 5453 if ( saved !== result ) { 5454 5455 // Cancel the outer synthetic event 5456 event.stopImmediatePropagation(); 5457 event.preventDefault(); 5458 5459 return result; 5460 } 5461 5462 // If this is an inner synthetic event for an event with a bubbling surrogate 5463 // (focus or blur), assume that the surrogate already propagated from triggering 5464 // the native event and prevent that from happening again here. 5465 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 5466 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5467 // less bad than duplication. 5468 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 5469 event.stopPropagation(); 5470 } 5471 5472 // If this is a native event triggered above, everything is now in order 5473 // Fire an inner synthetic event with the original arguments 5474 } else if ( saved ) { 5475 5476 // ...and capture the result 5477 dataPriv.set( this, type, jQuery.event.trigger( 5478 saved[ 0 ], 5479 saved.slice( 1 ), 5480 this 5481 ) ); 5482 5483 // Abort handling of the native event by all jQuery handlers while allowing 5484 // native handlers on the same element to run. On target, this is achieved 5485 // by stopping immediate propagation just on the jQuery event. However, 5486 // the native event is re-wrapped by a jQuery one on each level of the 5487 // propagation so the only way to stop it for jQuery is to stop it for 5488 // everyone via native `stopPropagation()`. This is not a problem for 5489 // focus/blur which don't bubble, but it does also stop click on checkboxes 5490 // and radios. We accept this limitation. 5491 event.stopPropagation(); 5492 event.isImmediatePropagationStopped = returnTrue; 5493 } 5494 } 5495 } ); 5496} 5497 5498jQuery.removeEvent = function( elem, type, handle ) { 5499 5500 // This "if" is needed for plain objects 5501 if ( elem.removeEventListener ) { 5502 elem.removeEventListener( type, handle ); 5503 } 5504}; 5505 5506jQuery.Event = function( src, props ) { 5507 5508 // Allow instantiation without the 'new' keyword 5509 if ( !( this instanceof jQuery.Event ) ) { 5510 return new jQuery.Event( src, props ); 5511 } 5512 5513 // Event object 5514 if ( src && src.type ) { 5515 this.originalEvent = src; 5516 this.type = src.type; 5517 5518 // Events bubbling up the document may have been marked as prevented 5519 // by a handler lower down the tree; reflect the correct value. 5520 this.isDefaultPrevented = src.defaultPrevented || 5521 src.defaultPrevented === undefined && 5522 5523 // Support: Android <=2.3 only 5524 src.returnValue === false ? 5525 returnTrue : 5526 returnFalse; 5527 5528 // Create target properties 5529 // Support: Safari <=6 - 7 only 5530 // Target should not be a text node (trac-504, trac-13143) 5531 this.target = ( src.target && src.target.nodeType === 3 ) ? 5532 src.target.parentNode : 5533 src.target; 5534 5535 this.currentTarget = src.currentTarget; 5536 this.relatedTarget = src.relatedTarget; 5537 5538 // Event type 5539 } else { 5540 this.type = src; 5541 } 5542 5543 // Put explicitly provided properties onto the event object 5544 if ( props ) { 5545 jQuery.extend( this, props ); 5546 } 5547 5548 // Create a timestamp if incoming event doesn't have one 5549 this.timeStamp = src && src.timeStamp || Date.now(); 5550 5551 // Mark it as fixed 5552 this[ jQuery.expando ] = true; 5553}; 5554 5555// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5556// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5557jQuery.Event.prototype = { 5558 constructor: jQuery.Event, 5559 isDefaultPrevented: returnFalse, 5560 isPropagationStopped: returnFalse, 5561 isImmediatePropagationStopped: returnFalse, 5562 isSimulated: false, 5563 5564 preventDefault: function() { 5565 var e = this.originalEvent; 5566 5567 this.isDefaultPrevented = returnTrue; 5568 5569 if ( e && !this.isSimulated ) { 5570 e.preventDefault(); 5571 } 5572 }, 5573 stopPropagation: function() { 5574 var e = this.originalEvent; 5575 5576 this.isPropagationStopped = returnTrue; 5577 5578 if ( e && !this.isSimulated ) { 5579 e.stopPropagation(); 5580 } 5581 }, 5582 stopImmediatePropagation: function() { 5583 var e = this.originalEvent; 5584 5585 this.isImmediatePropagationStopped = returnTrue; 5586 5587 if ( e && !this.isSimulated ) { 5588 e.stopImmediatePropagation(); 5589 } 5590 5591 this.stopPropagation(); 5592 } 5593}; 5594 5595// Includes all common event props including KeyEvent and MouseEvent specific props 5596jQuery.each( { 5597 altKey: true, 5598 bubbles: true, 5599 cancelable: true, 5600 changedTouches: true, 5601 ctrlKey: true, 5602 detail: true, 5603 eventPhase: true, 5604 metaKey: true, 5605 pageX: true, 5606 pageY: true, 5607 shiftKey: true, 5608 view: true, 5609 "char": true, 5610 code: true, 5611 charCode: true, 5612 key: true, 5613 keyCode: true, 5614 button: true, 5615 buttons: true, 5616 clientX: true, 5617 clientY: true, 5618 offsetX: true, 5619 offsetY: true, 5620 pointerId: true, 5621 pointerType: true, 5622 screenX: true, 5623 screenY: true, 5624 targetTouches: true, 5625 toElement: true, 5626 touches: true, 5627 which: true 5628}, jQuery.event.addProp ); 5629 5630jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 5631 5632 function focusMappedHandler( nativeEvent ) { 5633 if ( document.documentMode ) { 5634 5635 // Support: IE 11+ 5636 // Attach a single focusin/focusout handler on the document while someone wants 5637 // focus/blur. This is because the former are synchronous in IE while the latter 5638 // are async. In other browsers, all those handlers are invoked synchronously. 5639 5640 // `handle` from private data would already wrap the event, but we need 5641 // to change the `type` here. 5642 var handle = dataPriv.get( this, "handle" ), 5643 event = jQuery.event.fix( nativeEvent ); 5644 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 5645 event.isSimulated = true; 5646 5647 // First, handle focusin/focusout 5648 handle( nativeEvent ); 5649 5650 // ...then, handle focus/blur 5651 // 5652 // focus/blur don't bubble while focusin/focusout do; simulate the former by only 5653 // invoking the handler at the lower level. 5654 if ( event.target === event.currentTarget ) { 5655 5656 // The setup part calls `leverageNative`, which, in turn, calls 5657 // `jQuery.event.add`, so event handle will already have been set 5658 // by this point. 5659 handle( event ); 5660 } 5661 } else { 5662 5663 // For non-IE browsers, attach a single capturing handler on the document 5664 // while someone wants focusin/focusout. 5665 jQuery.event.simulate( delegateType, nativeEvent.target, 5666 jQuery.event.fix( nativeEvent ) ); 5667 } 5668 } 5669 5670 jQuery.event.special[ type ] = { 5671 5672 // Utilize native event if possible so blur/focus sequence is correct 5673 setup: function() { 5674 5675 var attaches; 5676 5677 // Claim the first handler 5678 // dataPriv.set( this, "focus", ... ) 5679 // dataPriv.set( this, "blur", ... ) 5680 leverageNative( this, type, true ); 5681 5682 if ( document.documentMode ) { 5683 5684 // Support: IE 9 - 11+ 5685 // We use the same native handler for focusin & focus (and focusout & blur) 5686 // so we need to coordinate setup & teardown parts between those events. 5687 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 5688 attaches = dataPriv.get( this, delegateType ); 5689 if ( !attaches ) { 5690 this.addEventListener( delegateType, focusMappedHandler ); 5691 } 5692 dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); 5693 } else { 5694 5695 // Return false to allow normal processing in the caller 5696 return false; 5697 } 5698 }, 5699 trigger: function() { 5700 5701 // Force setup before trigger 5702 leverageNative( this, type ); 5703 5704 // Return non-false to allow normal event-path propagation 5705 return true; 5706 }, 5707 5708 teardown: function() { 5709 var attaches; 5710 5711 if ( document.documentMode ) { 5712 attaches = dataPriv.get( this, delegateType ) - 1; 5713 if ( !attaches ) { 5714 this.removeEventListener( delegateType, focusMappedHandler ); 5715 dataPriv.remove( this, delegateType ); 5716 } else { 5717 dataPriv.set( this, delegateType, attaches ); 5718 } 5719 } else { 5720 5721 // Return false to indicate standard teardown should be applied 5722 return false; 5723 } 5724 }, 5725 5726 // Suppress native focus or blur if we're currently inside 5727 // a leveraged native-event stack 5728 _default: function( event ) { 5729 return dataPriv.get( event.target, type ); 5730 }, 5731 5732 delegateType: delegateType 5733 }; 5734 5735 // Support: Firefox <=44 5736 // Firefox doesn't have focus(in | out) events 5737 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 5738 // 5739 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 5740 // focus(in | out) events fire after focus & blur events, 5741 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 5742 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 5743 // 5744 // Support: IE 9 - 11+ 5745 // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, 5746 // attach a single handler for both events in IE. 5747 jQuery.event.special[ delegateType ] = { 5748 setup: function() { 5749 5750 // Handle: regular nodes (via `this.ownerDocument`), window 5751 // (via `this.document`) & document (via `this`). 5752 var doc = this.ownerDocument || this.document || this, 5753 dataHolder = document.documentMode ? this : doc, 5754 attaches = dataPriv.get( dataHolder, delegateType ); 5755 5756 // Support: IE 9 - 11+ 5757 // We use the same native handler for focusin & focus (and focusout & blur) 5758 // so we need to coordinate setup & teardown parts between those events. 5759 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 5760 if ( !attaches ) { 5761 if ( document.documentMode ) { 5762 this.addEventListener( delegateType, focusMappedHandler ); 5763 } else { 5764 doc.addEventListener( type, focusMappedHandler, true ); 5765 } 5766 } 5767 dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); 5768 }, 5769 teardown: function() { 5770 var doc = this.ownerDocument || this.document || this, 5771 dataHolder = document.documentMode ? this : doc, 5772 attaches = dataPriv.get( dataHolder, delegateType ) - 1; 5773 5774 if ( !attaches ) { 5775 if ( document.documentMode ) { 5776 this.removeEventListener( delegateType, focusMappedHandler ); 5777 } else { 5778 doc.removeEventListener( type, focusMappedHandler, true ); 5779 } 5780 dataPriv.remove( dataHolder, delegateType ); 5781 } else { 5782 dataPriv.set( dataHolder, delegateType, attaches ); 5783 } 5784 } 5785 }; 5786} ); 5787 5788// Create mouseenter/leave events using mouseover/out and event-time checks 5789// so that event delegation works in jQuery. 5790// Do the same for pointerenter/pointerleave and pointerover/pointerout 5791// 5792// Support: Safari 7 only 5793// Safari sends mouseenter too often; see: 5794// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5795// for the description of the bug (it existed in older Chrome versions as well). 5796jQuery.each( { 5797 mouseenter: "mouseover", 5798 mouseleave: "mouseout", 5799 pointerenter: "pointerover", 5800 pointerleave: "pointerout" 5801}, function( orig, fix ) { 5802 jQuery.event.special[ orig ] = { 5803 delegateType: fix, 5804 bindType: fix, 5805 5806 handle: function( event ) { 5807 var ret, 5808 target = this, 5809 related = event.relatedTarget, 5810 handleObj = event.handleObj; 5811 5812 // For mouseenter/leave call the handler if related is outside the target. 5813 // NB: No relatedTarget if the mouse left/entered the browser window 5814 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5815 event.type = handleObj.origType; 5816 ret = handleObj.handler.apply( this, arguments ); 5817 event.type = fix; 5818 } 5819 return ret; 5820 } 5821 }; 5822} ); 5823 5824jQuery.fn.extend( { 5825 5826 on: function( types, selector, data, fn ) { 5827 return on( this, types, selector, data, fn ); 5828 }, 5829 one: function( types, selector, data, fn ) { 5830 return on( this, types, selector, data, fn, 1 ); 5831 }, 5832 off: function( types, selector, fn ) { 5833 var handleObj, type; 5834 if ( types && types.preventDefault && types.handleObj ) { 5835 5836 // ( event ) dispatched jQuery.Event 5837 handleObj = types.handleObj; 5838 jQuery( types.delegateTarget ).off( 5839 handleObj.namespace ? 5840 handleObj.origType + "." + handleObj.namespace : 5841 handleObj.origType, 5842 handleObj.selector, 5843 handleObj.handler 5844 ); 5845 return this; 5846 } 5847 if ( typeof types === "object" ) { 5848 5849 // ( types-object [, selector] ) 5850 for ( type in types ) { 5851 this.off( type, selector, types[ type ] ); 5852 } 5853 return this; 5854 } 5855 if ( selector === false || typeof selector === "function" ) { 5856 5857 // ( types [, fn] ) 5858 fn = selector; 5859 selector = undefined; 5860 } 5861 if ( fn === false ) { 5862 fn = returnFalse; 5863 } 5864 return this.each( function() { 5865 jQuery.event.remove( this, types, fn, selector ); 5866 } ); 5867 } 5868} ); 5869 5870 5871var 5872 5873 // Support: IE <=10 - 11, Edge 12 - 13 only 5874 // In IE/Edge using regex groups here causes severe slowdowns. 5875 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5876 rnoInnerhtml = /<script|<style|<link/i, 5877 5878 // checked="checked" or checked 5879 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5880 5881 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 5882 5883// Prefer a tbody over its parent table for containing new rows 5884function manipulationTarget( elem, content ) { 5885 if ( nodeName( elem, "table" ) && 5886 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 5887 5888 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 5889 } 5890 5891 return elem; 5892} 5893 5894// Replace/restore the type attribute of script elements for safe DOM manipulation 5895function disableScript( elem ) { 5896 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 5897 return elem; 5898} 5899function restoreScript( elem ) { 5900 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 5901 elem.type = elem.type.slice( 5 ); 5902 } else { 5903 elem.removeAttribute( "type" ); 5904 } 5905 5906 return elem; 5907} 5908 5909function cloneCopyEvent( src, dest ) { 5910 var i, l, type, pdataOld, udataOld, udataCur, events; 5911 5912 if ( dest.nodeType !== 1 ) { 5913 return; 5914 } 5915 5916 // 1. Copy private data: events, handlers, etc. 5917 if ( dataPriv.hasData( src ) ) { 5918 pdataOld = dataPriv.get( src ); 5919 events = pdataOld.events; 5920 5921 if ( events ) { 5922 dataPriv.remove( dest, "handle events" ); 5923 5924 for ( type in events ) { 5925 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 5926 jQuery.event.add( dest, type, events[ type ][ i ] ); 5927 } 5928 } 5929 } 5930 } 5931 5932 // 2. Copy user data 5933 if ( dataUser.hasData( src ) ) { 5934 udataOld = dataUser.access( src ); 5935 udataCur = jQuery.extend( {}, udataOld ); 5936 5937 dataUser.set( dest, udataCur ); 5938 } 5939} 5940 5941// Fix IE bugs, see support tests 5942function fixInput( src, dest ) { 5943 var nodeName = dest.nodeName.toLowerCase(); 5944 5945 // Fails to persist the checked state of a cloned checkbox or radio button. 5946 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 5947 dest.checked = src.checked; 5948 5949 // Fails to return the selected option to the default selected state when cloning options 5950 } else if ( nodeName === "input" || nodeName === "textarea" ) { 5951 dest.defaultValue = src.defaultValue; 5952 } 5953} 5954 5955function domManip( collection, args, callback, ignored ) { 5956 5957 // Flatten any nested arrays 5958 args = flat( args ); 5959 5960 var fragment, first, scripts, hasScripts, node, doc, 5961 i = 0, 5962 l = collection.length, 5963 iNoClone = l - 1, 5964 value = args[ 0 ], 5965 valueIsFunction = isFunction( value ); 5966 5967 // We can't cloneNode fragments that contain checked, in WebKit 5968 if ( valueIsFunction || 5969 ( l > 1 && typeof value === "string" && 5970 !support.checkClone && rchecked.test( value ) ) ) { 5971 return collection.each( function( index ) { 5972 var self = collection.eq( index ); 5973 if ( valueIsFunction ) { 5974 args[ 0 ] = value.call( this, index, self.html() ); 5975 } 5976 domManip( self, args, callback, ignored ); 5977 } ); 5978 } 5979 5980 if ( l ) { 5981 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 5982 first = fragment.firstChild; 5983 5984 if ( fragment.childNodes.length === 1 ) { 5985 fragment = first; 5986 } 5987 5988 // Require either new content or an interest in ignored elements to invoke the callback 5989 if ( first || ignored ) { 5990 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 5991 hasScripts = scripts.length; 5992 5993 // Use the original fragment for the last item 5994 // instead of the first because it can end up 5995 // being emptied incorrectly in certain situations (trac-8070). 5996 for ( ; i < l; i++ ) { 5997 node = fragment; 5998 5999 if ( i !== iNoClone ) { 6000 node = jQuery.clone( node, true, true ); 6001 6002 // Keep references to cloned scripts for later restoration 6003 if ( hasScripts ) { 6004 6005 // Support: Android <=4.0 only, PhantomJS 1 only 6006 // push.apply(_, arraylike) throws on ancient WebKit 6007 jQuery.merge( scripts, getAll( node, "script" ) ); 6008 } 6009 } 6010 6011 callback.call( collection[ i ], node, i ); 6012 } 6013 6014 if ( hasScripts ) { 6015 doc = scripts[ scripts.length - 1 ].ownerDocument; 6016 6017 // Re-enable scripts 6018 jQuery.map( scripts, restoreScript ); 6019 6020 // Evaluate executable scripts on first document insertion 6021 for ( i = 0; i < hasScripts; i++ ) { 6022 node = scripts[ i ]; 6023 if ( rscriptType.test( node.type || "" ) && 6024 !dataPriv.access( node, "globalEval" ) && 6025 jQuery.contains( doc, node ) ) { 6026 6027 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 6028 6029 // Optional AJAX dependency, but won't run scripts if not present 6030 if ( jQuery._evalUrl && !node.noModule ) { 6031 jQuery._evalUrl( node.src, { 6032 nonce: node.nonce || node.getAttribute( "nonce" ) 6033 }, doc ); 6034 } 6035 } else { 6036 6037 // Unwrap a CDATA section containing script contents. This shouldn't be 6038 // needed as in XML documents they're already not visible when 6039 // inspecting element contents and in HTML documents they have no 6040 // meaning but we're preserving that logic for backwards compatibility. 6041 // This will be removed completely in 4.0. See gh-4904. 6042 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 6043 } 6044 } 6045 } 6046 } 6047 } 6048 } 6049 6050 return collection; 6051} 6052 6053function remove( elem, selector, keepData ) { 6054 var node, 6055 nodes = selector ? jQuery.filter( selector, elem ) : elem, 6056 i = 0; 6057 6058 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 6059 if ( !keepData && node.nodeType === 1 ) { 6060 jQuery.cleanData( getAll( node ) ); 6061 } 6062 6063 if ( node.parentNode ) { 6064 if ( keepData && isAttached( node ) ) { 6065 setGlobalEval( getAll( node, "script" ) ); 6066 } 6067 node.parentNode.removeChild( node ); 6068 } 6069 } 6070 6071 return elem; 6072} 6073 6074jQuery.extend( { 6075 htmlPrefilter: function( html ) { 6076 return html; 6077 }, 6078 6079 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6080 var i, l, srcElements, destElements, 6081 clone = elem.cloneNode( true ), 6082 inPage = isAttached( elem ); 6083 6084 // Fix IE cloning issues 6085 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 6086 !jQuery.isXMLDoc( elem ) ) { 6087 6088 // We eschew jQuery#find here for performance reasons: 6089 // https://jsperf.com/getall-vs-sizzle/2 6090 destElements = getAll( clone ); 6091 srcElements = getAll( elem ); 6092 6093 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6094 fixInput( srcElements[ i ], destElements[ i ] ); 6095 } 6096 } 6097 6098 // Copy the events from the original to the clone 6099 if ( dataAndEvents ) { 6100 if ( deepDataAndEvents ) { 6101 srcElements = srcElements || getAll( elem ); 6102 destElements = destElements || getAll( clone ); 6103 6104 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6105 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 6106 } 6107 } else { 6108 cloneCopyEvent( elem, clone ); 6109 } 6110 } 6111 6112 // Preserve script evaluation history 6113 destElements = getAll( clone, "script" ); 6114 if ( destElements.length > 0 ) { 6115 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6116 } 6117 6118 // Return the cloned set 6119 return clone; 6120 }, 6121 6122 cleanData: function( elems ) { 6123 var data, elem, type, 6124 special = jQuery.event.special, 6125 i = 0; 6126 6127 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 6128 if ( acceptData( elem ) ) { 6129 if ( ( data = elem[ dataPriv.expando ] ) ) { 6130 if ( data.events ) { 6131 for ( type in data.events ) { 6132 if ( special[ type ] ) { 6133 jQuery.event.remove( elem, type ); 6134 6135 // This is a shortcut to avoid jQuery.event.remove's overhead 6136 } else { 6137 jQuery.removeEvent( elem, type, data.handle ); 6138 } 6139 } 6140 } 6141 6142 // Support: Chrome <=35 - 45+ 6143 // Assign undefined instead of using delete, see Data#remove 6144 elem[ dataPriv.expando ] = undefined; 6145 } 6146 if ( elem[ dataUser.expando ] ) { 6147 6148 // Support: Chrome <=35 - 45+ 6149 // Assign undefined instead of using delete, see Data#remove 6150 elem[ dataUser.expando ] = undefined; 6151 } 6152 } 6153 } 6154 } 6155} ); 6156 6157jQuery.fn.extend( { 6158 detach: function( selector ) { 6159 return remove( this, selector, true ); 6160 }, 6161 6162 remove: function( selector ) { 6163 return remove( this, selector ); 6164 }, 6165 6166 text: function( value ) { 6167 return access( this, function( value ) { 6168 return value === undefined ? 6169 jQuery.text( this ) : 6170 this.empty().each( function() { 6171 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6172 this.textContent = value; 6173 } 6174 } ); 6175 }, null, value, arguments.length ); 6176 }, 6177 6178 append: function() { 6179 return domManip( this, arguments, function( elem ) { 6180 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6181 var target = manipulationTarget( this, elem ); 6182 target.appendChild( elem ); 6183 } 6184 } ); 6185 }, 6186 6187 prepend: function() { 6188 return domManip( this, arguments, function( elem ) { 6189 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6190 var target = manipulationTarget( this, elem ); 6191 target.insertBefore( elem, target.firstChild ); 6192 } 6193 } ); 6194 }, 6195 6196 before: function() { 6197 return domManip( this, arguments, function( elem ) { 6198 if ( this.parentNode ) { 6199 this.parentNode.insertBefore( elem, this ); 6200 } 6201 } ); 6202 }, 6203 6204 after: function() { 6205 return domManip( this, arguments, function( elem ) { 6206 if ( this.parentNode ) { 6207 this.parentNode.insertBefore( elem, this.nextSibling ); 6208 } 6209 } ); 6210 }, 6211 6212 empty: function() { 6213 var elem, 6214 i = 0; 6215 6216 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6217 if ( elem.nodeType === 1 ) { 6218 6219 // Prevent memory leaks 6220 jQuery.cleanData( getAll( elem, false ) ); 6221 6222 // Remove any remaining nodes 6223 elem.textContent = ""; 6224 } 6225 } 6226 6227 return this; 6228 }, 6229 6230 clone: function( dataAndEvents, deepDataAndEvents ) { 6231 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6232 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6233 6234 return this.map( function() { 6235 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6236 } ); 6237 }, 6238 6239 html: function( value ) { 6240 return access( this, function( value ) { 6241 var elem = this[ 0 ] || {}, 6242 i = 0, 6243 l = this.length; 6244 6245 if ( value === undefined && elem.nodeType === 1 ) { 6246 return elem.innerHTML; 6247 } 6248 6249 // See if we can take a shortcut and just use innerHTML 6250 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6251 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6252 6253 value = jQuery.htmlPrefilter( value ); 6254 6255 try { 6256 for ( ; i < l; i++ ) { 6257 elem = this[ i ] || {}; 6258 6259 // Remove element nodes and prevent memory leaks 6260 if ( elem.nodeType === 1 ) { 6261 jQuery.cleanData( getAll( elem, false ) ); 6262 elem.innerHTML = value; 6263 } 6264 } 6265 6266 elem = 0; 6267 6268 // If using innerHTML throws an exception, use the fallback method 6269 } catch ( e ) {} 6270 } 6271 6272 if ( elem ) { 6273 this.empty().append( value ); 6274 } 6275 }, null, value, arguments.length ); 6276 }, 6277 6278 replaceWith: function() { 6279 var ignored = []; 6280 6281 // Make the changes, replacing each non-ignored context element with the new content 6282 return domManip( this, arguments, function( elem ) { 6283 var parent = this.parentNode; 6284 6285 if ( jQuery.inArray( this, ignored ) < 0 ) { 6286 jQuery.cleanData( getAll( this ) ); 6287 if ( parent ) { 6288 parent.replaceChild( elem, this ); 6289 } 6290 } 6291 6292 // Force callback invocation 6293 }, ignored ); 6294 } 6295} ); 6296 6297jQuery.each( { 6298 appendTo: "append", 6299 prependTo: "prepend", 6300 insertBefore: "before", 6301 insertAfter: "after", 6302 replaceAll: "replaceWith" 6303}, function( name, original ) { 6304 jQuery.fn[ name ] = function( selector ) { 6305 var elems, 6306 ret = [], 6307 insert = jQuery( selector ), 6308 last = insert.length - 1, 6309 i = 0; 6310 6311 for ( ; i <= last; i++ ) { 6312 elems = i === last ? this : this.clone( true ); 6313 jQuery( insert[ i ] )[ original ]( elems ); 6314 6315 // Support: Android <=4.0 only, PhantomJS 1 only 6316 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6317 push.apply( ret, elems.get() ); 6318 } 6319 6320 return this.pushStack( ret ); 6321 }; 6322} ); 6323var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6324 6325var rcustomProp = /^--/; 6326 6327 6328var getStyles = function( elem ) { 6329 6330 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 6331 // IE throws on elements created in popups 6332 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6333 var view = elem.ownerDocument.defaultView; 6334 6335 if ( !view || !view.opener ) { 6336 view = window; 6337 } 6338 6339 return view.getComputedStyle( elem ); 6340 }; 6341 6342var swap = function( elem, options, callback ) { 6343 var ret, name, 6344 old = {}; 6345 6346 // Remember the old values, and insert the new ones 6347 for ( name in options ) { 6348 old[ name ] = elem.style[ name ]; 6349 elem.style[ name ] = options[ name ]; 6350 } 6351 6352 ret = callback.call( elem ); 6353 6354 // Revert the old values 6355 for ( name in options ) { 6356 elem.style[ name ] = old[ name ]; 6357 } 6358 6359 return ret; 6360}; 6361 6362 6363var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6364 6365 6366 6367( function() { 6368 6369 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6370 // so they're executed at the same time to save the second computation. 6371 function computeStyleTests() { 6372 6373 // This is a singleton, we need to execute it only once 6374 if ( !div ) { 6375 return; 6376 } 6377 6378 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6379 "margin-top:1px;padding:0;border:0"; 6380 div.style.cssText = 6381 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6382 "margin:auto;border:1px;padding:1px;" + 6383 "width:60%;top:1%"; 6384 documentElement.appendChild( container ).appendChild( div ); 6385 6386 var divStyle = window.getComputedStyle( div ); 6387 pixelPositionVal = divStyle.top !== "1%"; 6388 6389 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6390 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 6391 6392 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6393 // Some styles come back with percentage values, even though they shouldn't 6394 div.style.right = "60%"; 6395 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 6396 6397 // Support: IE 9 - 11 only 6398 // Detect misreporting of content dimensions for box-sizing:border-box elements 6399 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 6400 6401 // Support: IE 9 only 6402 // Detect overflow:scroll screwiness (gh-3699) 6403 // Support: Chrome <=64 6404 // Don't get tricked when zoom affects offsetWidth (gh-4029) 6405 div.style.position = "absolute"; 6406 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 6407 6408 documentElement.removeChild( container ); 6409 6410 // Nullify the div so it wouldn't be stored in the memory and 6411 // it will also be a sign that checks already performed 6412 div = null; 6413 } 6414 6415 function roundPixelMeasures( measure ) { 6416 return Math.round( parseFloat( measure ) ); 6417 } 6418 6419 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6420 reliableTrDimensionsVal, reliableMarginLeftVal, 6421 container = document.createElement( "div" ), 6422 div = document.createElement( "div" ); 6423 6424 // Finish early in limited (non-browser) environments 6425 if ( !div.style ) { 6426 return; 6427 } 6428 6429 // Support: IE <=9 - 11 only 6430 // Style of cloned element affects source element cloned (trac-8908) 6431 div.style.backgroundClip = "content-box"; 6432 div.cloneNode( true ).style.backgroundClip = ""; 6433 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6434 6435 jQuery.extend( support, { 6436 boxSizingReliable: function() { 6437 computeStyleTests(); 6438 return boxSizingReliableVal; 6439 }, 6440 pixelBoxStyles: function() { 6441 computeStyleTests(); 6442 return pixelBoxStylesVal; 6443 }, 6444 pixelPosition: function() { 6445 computeStyleTests(); 6446 return pixelPositionVal; 6447 }, 6448 reliableMarginLeft: function() { 6449 computeStyleTests(); 6450 return reliableMarginLeftVal; 6451 }, 6452 scrollboxSize: function() { 6453 computeStyleTests(); 6454 return scrollboxSizeVal; 6455 }, 6456 6457 // Support: IE 9 - 11+, Edge 15 - 18+ 6458 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6459 // set in CSS while `offset*` properties report correct values. 6460 // Behavior in IE 9 is more subtle than in newer versions & it passes 6461 // some versions of this test; make sure not to make it pass there! 6462 // 6463 // Support: Firefox 70+ 6464 // Only Firefox includes border widths 6465 // in computed dimensions. (gh-4529) 6466 reliableTrDimensions: function() { 6467 var table, tr, trChild, trStyle; 6468 if ( reliableTrDimensionsVal == null ) { 6469 table = document.createElement( "table" ); 6470 tr = document.createElement( "tr" ); 6471 trChild = document.createElement( "div" ); 6472 6473 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 6474 tr.style.cssText = "box-sizing:content-box;border:1px solid"; 6475 6476 // Support: Chrome 86+ 6477 // Height set through cssText does not get applied. 6478 // Computed height then comes back as 0. 6479 tr.style.height = "1px"; 6480 trChild.style.height = "9px"; 6481 6482 // Support: Android 8 Chrome 86+ 6483 // In our bodyBackground.html iframe, 6484 // display for all div elements is set to "inline", 6485 // which causes a problem only in Android 8 Chrome 86. 6486 // Ensuring the div is `display: block` 6487 // gets around this issue. 6488 trChild.style.display = "block"; 6489 6490 documentElement 6491 .appendChild( table ) 6492 .appendChild( tr ) 6493 .appendChild( trChild ); 6494 6495 trStyle = window.getComputedStyle( tr ); 6496 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 6497 parseInt( trStyle.borderTopWidth, 10 ) + 6498 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 6499 6500 documentElement.removeChild( table ); 6501 } 6502 return reliableTrDimensionsVal; 6503 } 6504 } ); 6505} )(); 6506 6507 6508function curCSS( elem, name, computed ) { 6509 var width, minWidth, maxWidth, ret, 6510 isCustomProp = rcustomProp.test( name ), 6511 6512 // Support: Firefox 51+ 6513 // Retrieving style before computed somehow 6514 // fixes an issue with getting wrong values 6515 // on detached elements 6516 style = elem.style; 6517 6518 computed = computed || getStyles( elem ); 6519 6520 // getPropertyValue is needed for: 6521 // .css('filter') (IE 9 only, trac-12537) 6522 // .css('--customProperty) (gh-3144) 6523 if ( computed ) { 6524 6525 // Support: IE <=9 - 11+ 6526 // IE only supports `"float"` in `getPropertyValue`; in computed styles 6527 // it's only available as `"cssFloat"`. We no longer modify properties 6528 // sent to `.css()` apart from camelCasing, so we need to check both. 6529 // Normally, this would create difference in behavior: if 6530 // `getPropertyValue` returns an empty string, the value returned 6531 // by `.css()` would be `undefined`. This is usually the case for 6532 // disconnected elements. However, in IE even disconnected elements 6533 // with no styles return `"none"` for `getPropertyValue( "float" )` 6534 ret = computed.getPropertyValue( name ) || computed[ name ]; 6535 6536 if ( isCustomProp && ret ) { 6537 6538 // Support: Firefox 105+, Chrome <=105+ 6539 // Spec requires trimming whitespace for custom properties (gh-4926). 6540 // Firefox only trims leading whitespace. Chrome just collapses 6541 // both leading & trailing whitespace to a single space. 6542 // 6543 // Fall back to `undefined` if empty string returned. 6544 // This collapses a missing definition with property defined 6545 // and set to an empty string but there's no standard API 6546 // allowing us to differentiate them without a performance penalty 6547 // and returning `undefined` aligns with older jQuery. 6548 // 6549 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED 6550 // as whitespace while CSS does not, but this is not a problem 6551 // because CSS preprocessing replaces them with U+000A LINE FEED 6552 // (which *is* CSS whitespace) 6553 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 6554 ret = ret.replace( rtrimCSS, "$1" ) || undefined; 6555 } 6556 6557 if ( ret === "" && !isAttached( elem ) ) { 6558 ret = jQuery.style( elem, name ); 6559 } 6560 6561 // A tribute to the "awesome hack by Dean Edwards" 6562 // Android Browser returns percentage for some values, 6563 // but width seems to be reliably pixels. 6564 // This is against the CSSOM draft spec: 6565 // https://drafts.csswg.org/cssom/#resolved-values 6566 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 6567 6568 // Remember the original values 6569 width = style.width; 6570 minWidth = style.minWidth; 6571 maxWidth = style.maxWidth; 6572 6573 // Put in the new values to get a computed value out 6574 style.minWidth = style.maxWidth = style.width = ret; 6575 ret = computed.width; 6576 6577 // Revert the changed values 6578 style.width = width; 6579 style.minWidth = minWidth; 6580 style.maxWidth = maxWidth; 6581 } 6582 } 6583 6584 return ret !== undefined ? 6585 6586 // Support: IE <=9 - 11 only 6587 // IE returns zIndex value as an integer. 6588 ret + "" : 6589 ret; 6590} 6591 6592 6593function addGetHookIf( conditionFn, hookFn ) { 6594 6595 // Define the hook, we'll check on the first run if it's really needed. 6596 return { 6597 get: function() { 6598 if ( conditionFn() ) { 6599 6600 // Hook not needed (or it's not possible to use it due 6601 // to missing dependency), remove it. 6602 delete this.get; 6603 return; 6604 } 6605 6606 // Hook needed; redefine it so that the support test is not executed again. 6607 return ( this.get = hookFn ).apply( this, arguments ); 6608 } 6609 }; 6610} 6611 6612 6613var cssPrefixes = [ "Webkit", "Moz", "ms" ], 6614 emptyStyle = document.createElement( "div" ).style, 6615 vendorProps = {}; 6616 6617// Return a vendor-prefixed property or undefined 6618function vendorPropName( name ) { 6619 6620 // Check for vendor prefixed names 6621 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 6622 i = cssPrefixes.length; 6623 6624 while ( i-- ) { 6625 name = cssPrefixes[ i ] + capName; 6626 if ( name in emptyStyle ) { 6627 return name; 6628 } 6629 } 6630} 6631 6632// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 6633function finalPropName( name ) { 6634 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 6635 6636 if ( final ) { 6637 return final; 6638 } 6639 if ( name in emptyStyle ) { 6640 return name; 6641 } 6642 return vendorProps[ name ] = vendorPropName( name ) || name; 6643} 6644 6645 6646var 6647 6648 // Swappable if display is none or starts with table 6649 // except "table", "table-cell", or "table-caption" 6650 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6651 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6652 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6653 cssNormalTransform = { 6654 letterSpacing: "0", 6655 fontWeight: "400" 6656 }; 6657 6658function setPositiveNumber( _elem, value, subtract ) { 6659 6660 // Any relative (+/-) values have already been 6661 // normalized at this point 6662 var matches = rcssNum.exec( value ); 6663 return matches ? 6664 6665 // Guard against undefined "subtract", e.g., when used as in cssHooks 6666 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 6667 value; 6668} 6669 6670function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6671 var i = dimension === "width" ? 1 : 0, 6672 extra = 0, 6673 delta = 0, 6674 marginDelta = 0; 6675 6676 // Adjustment may not be necessary 6677 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6678 return 0; 6679 } 6680 6681 for ( ; i < 4; i += 2 ) { 6682 6683 // Both box models exclude margin 6684 // Count margin delta separately to only add it after scroll gutter adjustment. 6685 // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). 6686 if ( box === "margin" ) { 6687 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6688 } 6689 6690 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6691 if ( !isBorderBox ) { 6692 6693 // Add padding 6694 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6695 6696 // For "border" or "margin", add border 6697 if ( box !== "padding" ) { 6698 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6699 6700 // But still keep track of it otherwise 6701 } else { 6702 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6703 } 6704 6705 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6706 // "padding" or "margin" 6707 } else { 6708 6709 // For "content", subtract padding 6710 if ( box === "content" ) { 6711 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6712 } 6713 6714 // For "content" or "padding", subtract border 6715 if ( box !== "margin" ) { 6716 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6717 } 6718 } 6719 } 6720 6721 // Account for positive content-box scroll gutter when requested by providing computedVal 6722 if ( !isBorderBox && computedVal >= 0 ) { 6723 6724 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6725 // Assuming integer scroll gutter, subtract the rest and round down 6726 delta += Math.max( 0, Math.ceil( 6727 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6728 computedVal - 6729 delta - 6730 extra - 6731 0.5 6732 6733 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 6734 // Use an explicit zero to avoid NaN (gh-3964) 6735 ) ) || 0; 6736 } 6737 6738 return delta + marginDelta; 6739} 6740 6741function getWidthOrHeight( elem, dimension, extra ) { 6742 6743 // Start with computed style 6744 var styles = getStyles( elem ), 6745 6746 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 6747 // Fake content-box until we know it's needed to know the true value. 6748 boxSizingNeeded = !support.boxSizingReliable() || extra, 6749 isBorderBox = boxSizingNeeded && 6750 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6751 valueIsBorderBox = isBorderBox, 6752 6753 val = curCSS( elem, dimension, styles ), 6754 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 6755 6756 // Support: Firefox <=54 6757 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6758 if ( rnumnonpx.test( val ) ) { 6759 if ( !extra ) { 6760 return val; 6761 } 6762 val = "auto"; 6763 } 6764 6765 6766 // Support: IE 9 - 11 only 6767 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 6768 // In those cases, the computed value can be trusted to be border-box. 6769 if ( ( !support.boxSizingReliable() && isBorderBox || 6770 6771 // Support: IE 10 - 11+, Edge 15 - 18+ 6772 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6773 // set in CSS while `offset*` properties report correct values. 6774 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 6775 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 6776 6777 // Fall back to offsetWidth/offsetHeight when value is "auto" 6778 // This happens for inline elements with no explicit setting (gh-3571) 6779 val === "auto" || 6780 6781 // Support: Android <=4.1 - 4.3 only 6782 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6783 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 6784 6785 // Make sure the element is visible & connected 6786 elem.getClientRects().length ) { 6787 6788 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 6789 6790 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 6791 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 6792 // retrieved value as a content box dimension. 6793 valueIsBorderBox = offsetProp in elem; 6794 if ( valueIsBorderBox ) { 6795 val = elem[ offsetProp ]; 6796 } 6797 } 6798 6799 // Normalize "" and auto 6800 val = parseFloat( val ) || 0; 6801 6802 // Adjust for the element's box model 6803 return ( val + 6804 boxModelAdjustment( 6805 elem, 6806 dimension, 6807 extra || ( isBorderBox ? "border" : "content" ), 6808 valueIsBorderBox, 6809 styles, 6810 6811 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6812 val 6813 ) 6814 ) + "px"; 6815} 6816 6817jQuery.extend( { 6818 6819 // Add in style property hooks for overriding the default 6820 // behavior of getting and setting a style property 6821 cssHooks: { 6822 opacity: { 6823 get: function( elem, computed ) { 6824 if ( computed ) { 6825 6826 // We should always get a number back from opacity 6827 var ret = curCSS( elem, "opacity" ); 6828 return ret === "" ? "1" : ret; 6829 } 6830 } 6831 } 6832 }, 6833 6834 // Don't automatically add "px" to these possibly-unitless properties 6835 cssNumber: { 6836 animationIterationCount: true, 6837 aspectRatio: true, 6838 borderImageSlice: true, 6839 columnCount: true, 6840 flexGrow: true, 6841 flexShrink: true, 6842 fontWeight: true, 6843 gridArea: true, 6844 gridColumn: true, 6845 gridColumnEnd: true, 6846 gridColumnStart: true, 6847 gridRow: true, 6848 gridRowEnd: true, 6849 gridRowStart: true, 6850 lineHeight: true, 6851 opacity: true, 6852 order: true, 6853 orphans: true, 6854 scale: true, 6855 widows: true, 6856 zIndex: true, 6857 zoom: true, 6858 6859 // SVG-related 6860 fillOpacity: true, 6861 floodOpacity: true, 6862 stopOpacity: true, 6863 strokeMiterlimit: true, 6864 strokeOpacity: true 6865 }, 6866 6867 // Add in properties whose names you wish to fix before 6868 // setting or getting the value 6869 cssProps: {}, 6870 6871 // Get and set the style property on a DOM Node 6872 style: function( elem, name, value, extra ) { 6873 6874 // Don't set styles on text and comment nodes 6875 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6876 return; 6877 } 6878 6879 // Make sure that we're working with the right name 6880 var ret, type, hooks, 6881 origName = camelCase( name ), 6882 isCustomProp = rcustomProp.test( name ), 6883 style = elem.style; 6884 6885 // Make sure that we're working with the right name. We don't 6886 // want to query the value if it is a CSS custom property 6887 // since they are user-defined. 6888 if ( !isCustomProp ) { 6889 name = finalPropName( origName ); 6890 } 6891 6892 // Gets hook for the prefixed version, then unprefixed version 6893 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6894 6895 // Check if we're setting a value 6896 if ( value !== undefined ) { 6897 type = typeof value; 6898 6899 // Convert "+=" or "-=" to relative numbers (trac-7345) 6900 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 6901 value = adjustCSS( elem, name, ret ); 6902 6903 // Fixes bug trac-9237 6904 type = "number"; 6905 } 6906 6907 // Make sure that null and NaN values aren't set (trac-7116) 6908 if ( value == null || value !== value ) { 6909 return; 6910 } 6911 6912 // If a number was passed in, add the unit (except for certain CSS properties) 6913 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 6914 // "px" to a few hardcoded values. 6915 if ( type === "number" && !isCustomProp ) { 6916 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 6917 } 6918 6919 // background-* props affect original clone's values 6920 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 6921 style[ name ] = "inherit"; 6922 } 6923 6924 // If a hook was provided, use that value, otherwise just set the specified value 6925 if ( !hooks || !( "set" in hooks ) || 6926 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 6927 6928 if ( isCustomProp ) { 6929 style.setProperty( name, value ); 6930 } else { 6931 style[ name ] = value; 6932 } 6933 } 6934 6935 } else { 6936 6937 // If a hook was provided get the non-computed value from there 6938 if ( hooks && "get" in hooks && 6939 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 6940 6941 return ret; 6942 } 6943 6944 // Otherwise just get the value from the style object 6945 return style[ name ]; 6946 } 6947 }, 6948 6949 css: function( elem, name, extra, styles ) { 6950 var val, num, hooks, 6951 origName = camelCase( name ), 6952 isCustomProp = rcustomProp.test( name ); 6953 6954 // Make sure that we're working with the right name. We don't 6955 // want to modify the value if it is a CSS custom property 6956 // since they are user-defined. 6957 if ( !isCustomProp ) { 6958 name = finalPropName( origName ); 6959 } 6960 6961 // Try prefixed name followed by the unprefixed name 6962 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6963 6964 // If a hook was provided get the computed value from there 6965 if ( hooks && "get" in hooks ) { 6966 val = hooks.get( elem, true, extra ); 6967 } 6968 6969 // Otherwise, if a way to get the computed value exists, use that 6970 if ( val === undefined ) { 6971 val = curCSS( elem, name, styles ); 6972 } 6973 6974 // Convert "normal" to computed value 6975 if ( val === "normal" && name in cssNormalTransform ) { 6976 val = cssNormalTransform[ name ]; 6977 } 6978 6979 // Make numeric if forced or a qualifier was provided and val looks numeric 6980 if ( extra === "" || extra ) { 6981 num = parseFloat( val ); 6982 return extra === true || isFinite( num ) ? num || 0 : val; 6983 } 6984 6985 return val; 6986 } 6987} ); 6988 6989jQuery.each( [ "height", "width" ], function( _i, dimension ) { 6990 jQuery.cssHooks[ dimension ] = { 6991 get: function( elem, computed, extra ) { 6992 if ( computed ) { 6993 6994 // Certain elements can have dimension info if we invisibly show them 6995 // but it must have a current display style that would benefit 6996 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 6997 6998 // Support: Safari 8+ 6999 // Table columns in Safari have non-zero offsetWidth & zero 7000 // getBoundingClientRect().width unless display is changed. 7001 // Support: IE <=11 only 7002 // Running getBoundingClientRect on a disconnected node 7003 // in IE throws an error. 7004 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 7005 swap( elem, cssShow, function() { 7006 return getWidthOrHeight( elem, dimension, extra ); 7007 } ) : 7008 getWidthOrHeight( elem, dimension, extra ); 7009 } 7010 }, 7011 7012 set: function( elem, value, extra ) { 7013 var matches, 7014 styles = getStyles( elem ), 7015 7016 // Only read styles.position if the test has a chance to fail 7017 // to avoid forcing a reflow. 7018 scrollboxSizeBuggy = !support.scrollboxSize() && 7019 styles.position === "absolute", 7020 7021 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 7022 boxSizingNeeded = scrollboxSizeBuggy || extra, 7023 isBorderBox = boxSizingNeeded && 7024 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 7025 subtract = extra ? 7026 boxModelAdjustment( 7027 elem, 7028 dimension, 7029 extra, 7030 isBorderBox, 7031 styles 7032 ) : 7033 0; 7034 7035 // Account for unreliable border-box dimensions by comparing offset* to computed and 7036 // faking a content-box to get border and padding (gh-3699) 7037 if ( isBorderBox && scrollboxSizeBuggy ) { 7038 subtract -= Math.ceil( 7039 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 7040 parseFloat( styles[ dimension ] ) - 7041 boxModelAdjustment( elem, dimension, "border", false, styles ) - 7042 0.5 7043 ); 7044 } 7045 7046 // Convert to pixels if value adjustment is needed 7047 if ( subtract && ( matches = rcssNum.exec( value ) ) && 7048 ( matches[ 3 ] || "px" ) !== "px" ) { 7049 7050 elem.style[ dimension ] = value; 7051 value = jQuery.css( elem, dimension ); 7052 } 7053 7054 return setPositiveNumber( elem, value, subtract ); 7055 } 7056 }; 7057} ); 7058 7059jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 7060 function( elem, computed ) { 7061 if ( computed ) { 7062 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 7063 elem.getBoundingClientRect().left - 7064 swap( elem, { marginLeft: 0 }, function() { 7065 return elem.getBoundingClientRect().left; 7066 } ) 7067 ) + "px"; 7068 } 7069 } 7070); 7071 7072// These hooks are used by animate to expand properties 7073jQuery.each( { 7074 margin: "", 7075 padding: "", 7076 border: "Width" 7077}, function( prefix, suffix ) { 7078 jQuery.cssHooks[ prefix + suffix ] = { 7079 expand: function( value ) { 7080 var i = 0, 7081 expanded = {}, 7082 7083 // Assumes a single number if not a string 7084 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 7085 7086 for ( ; i < 4; i++ ) { 7087 expanded[ prefix + cssExpand[ i ] + suffix ] = 7088 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 7089 } 7090 7091 return expanded; 7092 } 7093 }; 7094 7095 if ( prefix !== "margin" ) { 7096 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 7097 } 7098} ); 7099 7100jQuery.fn.extend( { 7101 css: function( name, value ) { 7102 return access( this, function( elem, name, value ) { 7103 var styles, len, 7104 map = {}, 7105 i = 0; 7106 7107 if ( Array.isArray( name ) ) { 7108 styles = getStyles( elem ); 7109 len = name.length; 7110 7111 for ( ; i < len; i++ ) { 7112 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7113 } 7114 7115 return map; 7116 } 7117 7118 return value !== undefined ? 7119 jQuery.style( elem, name, value ) : 7120 jQuery.css( elem, name ); 7121 }, name, value, arguments.length > 1 ); 7122 } 7123} ); 7124 7125 7126function Tween( elem, options, prop, end, easing ) { 7127 return new Tween.prototype.init( elem, options, prop, end, easing ); 7128} 7129jQuery.Tween = Tween; 7130 7131Tween.prototype = { 7132 constructor: Tween, 7133 init: function( elem, options, prop, end, easing, unit ) { 7134 this.elem = elem; 7135 this.prop = prop; 7136 this.easing = easing || jQuery.easing._default; 7137 this.options = options; 7138 this.start = this.now = this.cur(); 7139 this.end = end; 7140 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7141 }, 7142 cur: function() { 7143 var hooks = Tween.propHooks[ this.prop ]; 7144 7145 return hooks && hooks.get ? 7146 hooks.get( this ) : 7147 Tween.propHooks._default.get( this ); 7148 }, 7149 run: function( percent ) { 7150 var eased, 7151 hooks = Tween.propHooks[ this.prop ]; 7152 7153 if ( this.options.duration ) { 7154 this.pos = eased = jQuery.easing[ this.easing ]( 7155 percent, this.options.duration * percent, 0, 1, this.options.duration 7156 ); 7157 } else { 7158 this.pos = eased = percent; 7159 } 7160 this.now = ( this.end - this.start ) * eased + this.start; 7161 7162 if ( this.options.step ) { 7163 this.options.step.call( this.elem, this.now, this ); 7164 } 7165 7166 if ( hooks && hooks.set ) { 7167 hooks.set( this ); 7168 } else { 7169 Tween.propHooks._default.set( this ); 7170 } 7171 return this; 7172 } 7173}; 7174 7175Tween.prototype.init.prototype = Tween.prototype; 7176 7177Tween.propHooks = { 7178 _default: { 7179 get: function( tween ) { 7180 var result; 7181 7182 // Use a property on the element directly when it is not a DOM element, 7183 // or when there is no matching style property that exists. 7184 if ( tween.elem.nodeType !== 1 || 7185 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7186 return tween.elem[ tween.prop ]; 7187 } 7188 7189 // Passing an empty string as a 3rd parameter to .css will automatically 7190 // attempt a parseFloat and fallback to a string if the parse fails. 7191 // Simple values such as "10px" are parsed to Float; 7192 // complex values such as "rotate(1rad)" are returned as-is. 7193 result = jQuery.css( tween.elem, tween.prop, "" ); 7194 7195 // Empty strings, null, undefined and "auto" are converted to 0. 7196 return !result || result === "auto" ? 0 : result; 7197 }, 7198 set: function( tween ) { 7199 7200 // Use step hook for back compat. 7201 // Use cssHook if its there. 7202 // Use .style if available and use plain properties where available. 7203 if ( jQuery.fx.step[ tween.prop ] ) { 7204 jQuery.fx.step[ tween.prop ]( tween ); 7205 } else if ( tween.elem.nodeType === 1 && ( 7206 jQuery.cssHooks[ tween.prop ] || 7207 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 7208 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7209 } else { 7210 tween.elem[ tween.prop ] = tween.now; 7211 } 7212 } 7213 } 7214}; 7215 7216// Support: IE <=9 only 7217// Panic based approach to setting things on disconnected nodes 7218Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7219 set: function( tween ) { 7220 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7221 tween.elem[ tween.prop ] = tween.now; 7222 } 7223 } 7224}; 7225 7226jQuery.easing = { 7227 linear: function( p ) { 7228 return p; 7229 }, 7230 swing: function( p ) { 7231 return 0.5 - Math.cos( p * Math.PI ) / 2; 7232 }, 7233 _default: "swing" 7234}; 7235 7236jQuery.fx = Tween.prototype.init; 7237 7238// Back compat <1.8 extension point 7239jQuery.fx.step = {}; 7240 7241 7242 7243 7244var 7245 fxNow, inProgress, 7246 rfxtypes = /^(?:toggle|show|hide)$/, 7247 rrun = /queueHooks$/; 7248 7249function schedule() { 7250 if ( inProgress ) { 7251 if ( document.hidden === false && window.requestAnimationFrame ) { 7252 window.requestAnimationFrame( schedule ); 7253 } else { 7254 window.setTimeout( schedule, jQuery.fx.interval ); 7255 } 7256 7257 jQuery.fx.tick(); 7258 } 7259} 7260 7261// Animations created synchronously will run synchronously 7262function createFxNow() { 7263 window.setTimeout( function() { 7264 fxNow = undefined; 7265 } ); 7266 return ( fxNow = Date.now() ); 7267} 7268 7269// Generate parameters to create a standard animation 7270function genFx( type, includeWidth ) { 7271 var which, 7272 i = 0, 7273 attrs = { height: type }; 7274 7275 // If we include width, step value is 1 to do all cssExpand values, 7276 // otherwise step value is 2 to skip over Left and Right 7277 includeWidth = includeWidth ? 1 : 0; 7278 for ( ; i < 4; i += 2 - includeWidth ) { 7279 which = cssExpand[ i ]; 7280 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7281 } 7282 7283 if ( includeWidth ) { 7284 attrs.opacity = attrs.width = type; 7285 } 7286 7287 return attrs; 7288} 7289 7290function createTween( value, prop, animation ) { 7291 var tween, 7292 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7293 index = 0, 7294 length = collection.length; 7295 for ( ; index < length; index++ ) { 7296 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7297 7298 // We're done with this property 7299 return tween; 7300 } 7301 } 7302} 7303 7304function defaultPrefilter( elem, props, opts ) { 7305 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7306 isBox = "width" in props || "height" in props, 7307 anim = this, 7308 orig = {}, 7309 style = elem.style, 7310 hidden = elem.nodeType && isHiddenWithinTree( elem ), 7311 dataShow = dataPriv.get( elem, "fxshow" ); 7312 7313 // Queue-skipping animations hijack the fx hooks 7314 if ( !opts.queue ) { 7315 hooks = jQuery._queueHooks( elem, "fx" ); 7316 if ( hooks.unqueued == null ) { 7317 hooks.unqueued = 0; 7318 oldfire = hooks.empty.fire; 7319 hooks.empty.fire = function() { 7320 if ( !hooks.unqueued ) { 7321 oldfire(); 7322 } 7323 }; 7324 } 7325 hooks.unqueued++; 7326 7327 anim.always( function() { 7328 7329 // Ensure the complete handler is called before this completes 7330 anim.always( function() { 7331 hooks.unqueued--; 7332 if ( !jQuery.queue( elem, "fx" ).length ) { 7333 hooks.empty.fire(); 7334 } 7335 } ); 7336 } ); 7337 } 7338 7339 // Detect show/hide animations 7340 for ( prop in props ) { 7341 value = props[ prop ]; 7342 if ( rfxtypes.test( value ) ) { 7343 delete props[ prop ]; 7344 toggle = toggle || value === "toggle"; 7345 if ( value === ( hidden ? "hide" : "show" ) ) { 7346 7347 // Pretend to be hidden if this is a "show" and 7348 // there is still data from a stopped show/hide 7349 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7350 hidden = true; 7351 7352 // Ignore all other no-op show/hide data 7353 } else { 7354 continue; 7355 } 7356 } 7357 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7358 } 7359 } 7360 7361 // Bail out if this is a no-op like .hide().hide() 7362 propTween = !jQuery.isEmptyObject( props ); 7363 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 7364 return; 7365 } 7366 7367 // Restrict "overflow" and "display" styles during box animations 7368 if ( isBox && elem.nodeType === 1 ) { 7369 7370 // Support: IE <=9 - 11, Edge 12 - 15 7371 // Record all 3 overflow attributes because IE does not infer the shorthand 7372 // from identically-valued overflowX and overflowY and Edge just mirrors 7373 // the overflowX value there. 7374 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7375 7376 // Identify a display type, preferring old show/hide data over the CSS cascade 7377 restoreDisplay = dataShow && dataShow.display; 7378 if ( restoreDisplay == null ) { 7379 restoreDisplay = dataPriv.get( elem, "display" ); 7380 } 7381 display = jQuery.css( elem, "display" ); 7382 if ( display === "none" ) { 7383 if ( restoreDisplay ) { 7384 display = restoreDisplay; 7385 } else { 7386 7387 // Get nonempty value(s) by temporarily forcing visibility 7388 showHide( [ elem ], true ); 7389 restoreDisplay = elem.style.display || restoreDisplay; 7390 display = jQuery.css( elem, "display" ); 7391 showHide( [ elem ] ); 7392 } 7393 } 7394 7395 // Animate inline elements as inline-block 7396 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 7397 if ( jQuery.css( elem, "float" ) === "none" ) { 7398 7399 // Restore the original display value at the end of pure show/hide animations 7400 if ( !propTween ) { 7401 anim.done( function() { 7402 style.display = restoreDisplay; 7403 } ); 7404 if ( restoreDisplay == null ) { 7405 display = style.display; 7406 restoreDisplay = display === "none" ? "" : display; 7407 } 7408 } 7409 style.display = "inline-block"; 7410 } 7411 } 7412 } 7413 7414 if ( opts.overflow ) { 7415 style.overflow = "hidden"; 7416 anim.always( function() { 7417 style.overflow = opts.overflow[ 0 ]; 7418 style.overflowX = opts.overflow[ 1 ]; 7419 style.overflowY = opts.overflow[ 2 ]; 7420 } ); 7421 } 7422 7423 // Implement show/hide animations 7424 propTween = false; 7425 for ( prop in orig ) { 7426 7427 // General show/hide setup for this element animation 7428 if ( !propTween ) { 7429 if ( dataShow ) { 7430 if ( "hidden" in dataShow ) { 7431 hidden = dataShow.hidden; 7432 } 7433 } else { 7434 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 7435 } 7436 7437 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 7438 if ( toggle ) { 7439 dataShow.hidden = !hidden; 7440 } 7441 7442 // Show elements before animating them 7443 if ( hidden ) { 7444 showHide( [ elem ], true ); 7445 } 7446 7447 /* eslint-disable no-loop-func */ 7448 7449 anim.done( function() { 7450 7451 /* eslint-enable no-loop-func */ 7452 7453 // The final step of a "hide" animation is actually hiding the element 7454 if ( !hidden ) { 7455 showHide( [ elem ] ); 7456 } 7457 dataPriv.remove( elem, "fxshow" ); 7458 for ( prop in orig ) { 7459 jQuery.style( elem, prop, orig[ prop ] ); 7460 } 7461 } ); 7462 } 7463 7464 // Per-property setup 7465 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7466 if ( !( prop in dataShow ) ) { 7467 dataShow[ prop ] = propTween.start; 7468 if ( hidden ) { 7469 propTween.end = propTween.start; 7470 propTween.start = 0; 7471 } 7472 } 7473 } 7474} 7475 7476function propFilter( props, specialEasing ) { 7477 var index, name, easing, value, hooks; 7478 7479 // camelCase, specialEasing and expand cssHook pass 7480 for ( index in props ) { 7481 name = camelCase( index ); 7482 easing = specialEasing[ name ]; 7483 value = props[ index ]; 7484 if ( Array.isArray( value ) ) { 7485 easing = value[ 1 ]; 7486 value = props[ index ] = value[ 0 ]; 7487 } 7488 7489 if ( index !== name ) { 7490 props[ name ] = value; 7491 delete props[ index ]; 7492 } 7493 7494 hooks = jQuery.cssHooks[ name ]; 7495 if ( hooks && "expand" in hooks ) { 7496 value = hooks.expand( value ); 7497 delete props[ name ]; 7498 7499 // Not quite $.extend, this won't overwrite existing keys. 7500 // Reusing 'index' because we have the correct "name" 7501 for ( index in value ) { 7502 if ( !( index in props ) ) { 7503 props[ index ] = value[ index ]; 7504 specialEasing[ index ] = easing; 7505 } 7506 } 7507 } else { 7508 specialEasing[ name ] = easing; 7509 } 7510 } 7511} 7512 7513function Animation( elem, properties, options ) { 7514 var result, 7515 stopped, 7516 index = 0, 7517 length = Animation.prefilters.length, 7518 deferred = jQuery.Deferred().always( function() { 7519 7520 // Don't match elem in the :animated selector 7521 delete tick.elem; 7522 } ), 7523 tick = function() { 7524 if ( stopped ) { 7525 return false; 7526 } 7527 var currentTime = fxNow || createFxNow(), 7528 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7529 7530 // Support: Android 2.3 only 7531 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 7532 temp = remaining / animation.duration || 0, 7533 percent = 1 - temp, 7534 index = 0, 7535 length = animation.tweens.length; 7536 7537 for ( ; index < length; index++ ) { 7538 animation.tweens[ index ].run( percent ); 7539 } 7540 7541 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7542 7543 // If there's more to do, yield 7544 if ( percent < 1 && length ) { 7545 return remaining; 7546 } 7547 7548 // If this was an empty animation, synthesize a final progress notification 7549 if ( !length ) { 7550 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7551 } 7552 7553 // Resolve the animation and report its conclusion 7554 deferred.resolveWith( elem, [ animation ] ); 7555 return false; 7556 }, 7557 animation = deferred.promise( { 7558 elem: elem, 7559 props: jQuery.extend( {}, properties ), 7560 opts: jQuery.extend( true, { 7561 specialEasing: {}, 7562 easing: jQuery.easing._default 7563 }, options ), 7564 originalProperties: properties, 7565 originalOptions: options, 7566 startTime: fxNow || createFxNow(), 7567 duration: options.duration, 7568 tweens: [], 7569 createTween: function( prop, end ) { 7570 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7571 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7572 animation.tweens.push( tween ); 7573 return tween; 7574 }, 7575 stop: function( gotoEnd ) { 7576 var index = 0, 7577 7578 // If we are going to the end, we want to run all the tweens 7579 // otherwise we skip this part 7580 length = gotoEnd ? animation.tweens.length : 0; 7581 if ( stopped ) { 7582 return this; 7583 } 7584 stopped = true; 7585 for ( ; index < length; index++ ) { 7586 animation.tweens[ index ].run( 1 ); 7587 } 7588 7589 // Resolve when we played the last frame; otherwise, reject 7590 if ( gotoEnd ) { 7591 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7592 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7593 } else { 7594 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7595 } 7596 return this; 7597 } 7598 } ), 7599 props = animation.props; 7600 7601 propFilter( props, animation.opts.specialEasing ); 7602 7603 for ( ; index < length; index++ ) { 7604 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7605 if ( result ) { 7606 if ( isFunction( result.stop ) ) { 7607 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7608 result.stop.bind( result ); 7609 } 7610 return result; 7611 } 7612 } 7613 7614 jQuery.map( props, createTween, animation ); 7615 7616 if ( isFunction( animation.opts.start ) ) { 7617 animation.opts.start.call( elem, animation ); 7618 } 7619 7620 // Attach callbacks from options 7621 animation 7622 .progress( animation.opts.progress ) 7623 .done( animation.opts.done, animation.opts.complete ) 7624 .fail( animation.opts.fail ) 7625 .always( animation.opts.always ); 7626 7627 jQuery.fx.timer( 7628 jQuery.extend( tick, { 7629 elem: elem, 7630 anim: animation, 7631 queue: animation.opts.queue 7632 } ) 7633 ); 7634 7635 return animation; 7636} 7637 7638jQuery.Animation = jQuery.extend( Animation, { 7639 7640 tweeners: { 7641 "*": [ function( prop, value ) { 7642 var tween = this.createTween( prop, value ); 7643 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7644 return tween; 7645 } ] 7646 }, 7647 7648 tweener: function( props, callback ) { 7649 if ( isFunction( props ) ) { 7650 callback = props; 7651 props = [ "*" ]; 7652 } else { 7653 props = props.match( rnothtmlwhite ); 7654 } 7655 7656 var prop, 7657 index = 0, 7658 length = props.length; 7659 7660 for ( ; index < length; index++ ) { 7661 prop = props[ index ]; 7662 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7663 Animation.tweeners[ prop ].unshift( callback ); 7664 } 7665 }, 7666 7667 prefilters: [ defaultPrefilter ], 7668 7669 prefilter: function( callback, prepend ) { 7670 if ( prepend ) { 7671 Animation.prefilters.unshift( callback ); 7672 } else { 7673 Animation.prefilters.push( callback ); 7674 } 7675 } 7676} ); 7677 7678jQuery.speed = function( speed, easing, fn ) { 7679 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7680 complete: fn || !fn && easing || 7681 isFunction( speed ) && speed, 7682 duration: speed, 7683 easing: fn && easing || easing && !isFunction( easing ) && easing 7684 }; 7685 7686 // Go to the end state if fx are off 7687 if ( jQuery.fx.off ) { 7688 opt.duration = 0; 7689 7690 } else { 7691 if ( typeof opt.duration !== "number" ) { 7692 if ( opt.duration in jQuery.fx.speeds ) { 7693 opt.duration = jQuery.fx.speeds[ opt.duration ]; 7694 7695 } else { 7696 opt.duration = jQuery.fx.speeds._default; 7697 } 7698 } 7699 } 7700 7701 // Normalize opt.queue - true/undefined/null -> "fx" 7702 if ( opt.queue == null || opt.queue === true ) { 7703 opt.queue = "fx"; 7704 } 7705 7706 // Queueing 7707 opt.old = opt.complete; 7708 7709 opt.complete = function() { 7710 if ( isFunction( opt.old ) ) { 7711 opt.old.call( this ); 7712 } 7713 7714 if ( opt.queue ) { 7715 jQuery.dequeue( this, opt.queue ); 7716 } 7717 }; 7718 7719 return opt; 7720}; 7721 7722jQuery.fn.extend( { 7723 fadeTo: function( speed, to, easing, callback ) { 7724 7725 // Show any hidden elements after setting opacity to 0 7726 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 7727 7728 // Animate to the value specified 7729 .end().animate( { opacity: to }, speed, easing, callback ); 7730 }, 7731 animate: function( prop, speed, easing, callback ) { 7732 var empty = jQuery.isEmptyObject( prop ), 7733 optall = jQuery.speed( speed, easing, callback ), 7734 doAnimation = function() { 7735 7736 // Operate on a copy of prop so per-property easing won't be lost 7737 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7738 7739 // Empty animations, or finishing resolves immediately 7740 if ( empty || dataPriv.get( this, "finish" ) ) { 7741 anim.stop( true ); 7742 } 7743 }; 7744 7745 doAnimation.finish = doAnimation; 7746 7747 return empty || optall.queue === false ? 7748 this.each( doAnimation ) : 7749 this.queue( optall.queue, doAnimation ); 7750 }, 7751 stop: function( type, clearQueue, gotoEnd ) { 7752 var stopQueue = function( hooks ) { 7753 var stop = hooks.stop; 7754 delete hooks.stop; 7755 stop( gotoEnd ); 7756 }; 7757 7758 if ( typeof type !== "string" ) { 7759 gotoEnd = clearQueue; 7760 clearQueue = type; 7761 type = undefined; 7762 } 7763 if ( clearQueue ) { 7764 this.queue( type || "fx", [] ); 7765 } 7766 7767 return this.each( function() { 7768 var dequeue = true, 7769 index = type != null && type + "queueHooks", 7770 timers = jQuery.timers, 7771 data = dataPriv.get( this ); 7772 7773 if ( index ) { 7774 if ( data[ index ] && data[ index ].stop ) { 7775 stopQueue( data[ index ] ); 7776 } 7777 } else { 7778 for ( index in data ) { 7779 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7780 stopQueue( data[ index ] ); 7781 } 7782 } 7783 } 7784 7785 for ( index = timers.length; index--; ) { 7786 if ( timers[ index ].elem === this && 7787 ( type == null || timers[ index ].queue === type ) ) { 7788 7789 timers[ index ].anim.stop( gotoEnd ); 7790 dequeue = false; 7791 timers.splice( index, 1 ); 7792 } 7793 } 7794 7795 // Start the next in the queue if the last step wasn't forced. 7796 // Timers currently will call their complete callbacks, which 7797 // will dequeue but only if they were gotoEnd. 7798 if ( dequeue || !gotoEnd ) { 7799 jQuery.dequeue( this, type ); 7800 } 7801 } ); 7802 }, 7803 finish: function( type ) { 7804 if ( type !== false ) { 7805 type = type || "fx"; 7806 } 7807 return this.each( function() { 7808 var index, 7809 data = dataPriv.get( this ), 7810 queue = data[ type + "queue" ], 7811 hooks = data[ type + "queueHooks" ], 7812 timers = jQuery.timers, 7813 length = queue ? queue.length : 0; 7814 7815 // Enable finishing flag on private data 7816 data.finish = true; 7817 7818 // Empty the queue first 7819 jQuery.queue( this, type, [] ); 7820 7821 if ( hooks && hooks.stop ) { 7822 hooks.stop.call( this, true ); 7823 } 7824 7825 // Look for any active animations, and finish them 7826 for ( index = timers.length; index--; ) { 7827 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 7828 timers[ index ].anim.stop( true ); 7829 timers.splice( index, 1 ); 7830 } 7831 } 7832 7833 // Look for any animations in the old queue and finish them 7834 for ( index = 0; index < length; index++ ) { 7835 if ( queue[ index ] && queue[ index ].finish ) { 7836 queue[ index ].finish.call( this ); 7837 } 7838 } 7839 7840 // Turn off finishing flag 7841 delete data.finish; 7842 } ); 7843 } 7844} ); 7845 7846jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 7847 var cssFn = jQuery.fn[ name ]; 7848 jQuery.fn[ name ] = function( speed, easing, callback ) { 7849 return speed == null || typeof speed === "boolean" ? 7850 cssFn.apply( this, arguments ) : 7851 this.animate( genFx( name, true ), speed, easing, callback ); 7852 }; 7853} ); 7854 7855// Generate shortcuts for custom animations 7856jQuery.each( { 7857 slideDown: genFx( "show" ), 7858 slideUp: genFx( "hide" ), 7859 slideToggle: genFx( "toggle" ), 7860 fadeIn: { opacity: "show" }, 7861 fadeOut: { opacity: "hide" }, 7862 fadeToggle: { opacity: "toggle" } 7863}, function( name, props ) { 7864 jQuery.fn[ name ] = function( speed, easing, callback ) { 7865 return this.animate( props, speed, easing, callback ); 7866 }; 7867} ); 7868 7869jQuery.timers = []; 7870jQuery.fx.tick = function() { 7871 var timer, 7872 i = 0, 7873 timers = jQuery.timers; 7874 7875 fxNow = Date.now(); 7876 7877 for ( ; i < timers.length; i++ ) { 7878 timer = timers[ i ]; 7879 7880 // Run the timer and safely remove it when done (allowing for external removal) 7881 if ( !timer() && timers[ i ] === timer ) { 7882 timers.splice( i--, 1 ); 7883 } 7884 } 7885 7886 if ( !timers.length ) { 7887 jQuery.fx.stop(); 7888 } 7889 fxNow = undefined; 7890}; 7891 7892jQuery.fx.timer = function( timer ) { 7893 jQuery.timers.push( timer ); 7894 jQuery.fx.start(); 7895}; 7896 7897jQuery.fx.interval = 13; 7898jQuery.fx.start = function() { 7899 if ( inProgress ) { 7900 return; 7901 } 7902 7903 inProgress = true; 7904 schedule(); 7905}; 7906 7907jQuery.fx.stop = function() { 7908 inProgress = null; 7909}; 7910 7911jQuery.fx.speeds = { 7912 slow: 600, 7913 fast: 200, 7914 7915 // Default speed 7916 _default: 400 7917}; 7918 7919 7920// Based off of the plugin by Clint Helfers, with permission. 7921jQuery.fn.delay = function( time, type ) { 7922 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 7923 type = type || "fx"; 7924 7925 return this.queue( type, function( next, hooks ) { 7926 var timeout = window.setTimeout( next, time ); 7927 hooks.stop = function() { 7928 window.clearTimeout( timeout ); 7929 }; 7930 } ); 7931}; 7932 7933 7934( function() { 7935 var input = document.createElement( "input" ), 7936 select = document.createElement( "select" ), 7937 opt = select.appendChild( document.createElement( "option" ) ); 7938 7939 input.type = "checkbox"; 7940 7941 // Support: Android <=4.3 only 7942 // Default value for a checkbox should be "on" 7943 support.checkOn = input.value !== ""; 7944 7945 // Support: IE <=11 only 7946 // Must access selectedIndex to make default options select 7947 support.optSelected = opt.selected; 7948 7949 // Support: IE <=11 only 7950 // An input loses its value after becoming a radio 7951 input = document.createElement( "input" ); 7952 input.value = "t"; 7953 input.type = "radio"; 7954 support.radioValue = input.value === "t"; 7955} )(); 7956 7957 7958var boolHook, 7959 attrHandle = jQuery.expr.attrHandle; 7960 7961jQuery.fn.extend( { 7962 attr: function( name, value ) { 7963 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 7964 }, 7965 7966 removeAttr: function( name ) { 7967 return this.each( function() { 7968 jQuery.removeAttr( this, name ); 7969 } ); 7970 } 7971} ); 7972 7973jQuery.extend( { 7974 attr: function( elem, name, value ) { 7975 var ret, hooks, 7976 nType = elem.nodeType; 7977 7978 // Don't get/set attributes on text, comment and attribute nodes 7979 if ( nType === 3 || nType === 8 || nType === 2 ) { 7980 return; 7981 } 7982 7983 // Fallback to prop when attributes are not supported 7984 if ( typeof elem.getAttribute === "undefined" ) { 7985 return jQuery.prop( elem, name, value ); 7986 } 7987 7988 // Attribute hooks are determined by the lowercase version 7989 // Grab necessary hook if one is defined 7990 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 7991 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 7992 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 7993 } 7994 7995 if ( value !== undefined ) { 7996 if ( value === null ) { 7997 jQuery.removeAttr( elem, name ); 7998 return; 7999 } 8000 8001 if ( hooks && "set" in hooks && 8002 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8003 return ret; 8004 } 8005 8006 elem.setAttribute( name, value + "" ); 8007 return value; 8008 } 8009 8010 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8011 return ret; 8012 } 8013 8014 ret = jQuery.find.attr( elem, name ); 8015 8016 // Non-existent attributes return null, we normalize to undefined 8017 return ret == null ? undefined : ret; 8018 }, 8019 8020 attrHooks: { 8021 type: { 8022 set: function( elem, value ) { 8023 if ( !support.radioValue && value === "radio" && 8024 nodeName( elem, "input" ) ) { 8025 var val = elem.value; 8026 elem.setAttribute( "type", value ); 8027 if ( val ) { 8028 elem.value = val; 8029 } 8030 return value; 8031 } 8032 } 8033 } 8034 }, 8035 8036 removeAttr: function( elem, value ) { 8037 var name, 8038 i = 0, 8039 8040 // Attribute names can contain non-HTML whitespace characters 8041 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 8042 attrNames = value && value.match( rnothtmlwhite ); 8043 8044 if ( attrNames && elem.nodeType === 1 ) { 8045 while ( ( name = attrNames[ i++ ] ) ) { 8046 elem.removeAttribute( name ); 8047 } 8048 } 8049 } 8050} ); 8051 8052// Hooks for boolean attributes 8053boolHook = { 8054 set: function( elem, value, name ) { 8055 if ( value === false ) { 8056 8057 // Remove boolean attributes when set to false 8058 jQuery.removeAttr( elem, name ); 8059 } else { 8060 elem.setAttribute( name, name ); 8061 } 8062 return name; 8063 } 8064}; 8065 8066jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 8067 var getter = attrHandle[ name ] || jQuery.find.attr; 8068 8069 attrHandle[ name ] = function( elem, name, isXML ) { 8070 var ret, handle, 8071 lowercaseName = name.toLowerCase(); 8072 8073 if ( !isXML ) { 8074 8075 // Avoid an infinite loop by temporarily removing this function from the getter 8076 handle = attrHandle[ lowercaseName ]; 8077 attrHandle[ lowercaseName ] = ret; 8078 ret = getter( elem, name, isXML ) != null ? 8079 lowercaseName : 8080 null; 8081 attrHandle[ lowercaseName ] = handle; 8082 } 8083 return ret; 8084 }; 8085} ); 8086 8087 8088 8089 8090var rfocusable = /^(?:input|select|textarea|button)$/i, 8091 rclickable = /^(?:a|area)$/i; 8092 8093jQuery.fn.extend( { 8094 prop: function( name, value ) { 8095 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8096 }, 8097 8098 removeProp: function( name ) { 8099 return this.each( function() { 8100 delete this[ jQuery.propFix[ name ] || name ]; 8101 } ); 8102 } 8103} ); 8104 8105jQuery.extend( { 8106 prop: function( elem, name, value ) { 8107 var ret, hooks, 8108 nType = elem.nodeType; 8109 8110 // Don't get/set properties on text, comment and attribute nodes 8111 if ( nType === 3 || nType === 8 || nType === 2 ) { 8112 return; 8113 } 8114 8115 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8116 8117 // Fix name and attach hooks 8118 name = jQuery.propFix[ name ] || name; 8119 hooks = jQuery.propHooks[ name ]; 8120 } 8121 8122 if ( value !== undefined ) { 8123 if ( hooks && "set" in hooks && 8124 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8125 return ret; 8126 } 8127 8128 return ( elem[ name ] = value ); 8129 } 8130 8131 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8132 return ret; 8133 } 8134 8135 return elem[ name ]; 8136 }, 8137 8138 propHooks: { 8139 tabIndex: { 8140 get: function( elem ) { 8141 8142 // Support: IE <=9 - 11 only 8143 // elem.tabIndex doesn't always return the 8144 // correct value when it hasn't been explicitly set 8145 // Use proper attribute retrieval (trac-12072) 8146 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8147 8148 if ( tabindex ) { 8149 return parseInt( tabindex, 10 ); 8150 } 8151 8152 if ( 8153 rfocusable.test( elem.nodeName ) || 8154 rclickable.test( elem.nodeName ) && 8155 elem.href 8156 ) { 8157 return 0; 8158 } 8159 8160 return -1; 8161 } 8162 } 8163 }, 8164 8165 propFix: { 8166 "for": "htmlFor", 8167 "class": "className" 8168 } 8169} ); 8170 8171// Support: IE <=11 only 8172// Accessing the selectedIndex property 8173// forces the browser to respect setting selected 8174// on the option 8175// The getter ensures a default option is selected 8176// when in an optgroup 8177// eslint rule "no-unused-expressions" is disabled for this code 8178// since it considers such accessions noop 8179if ( !support.optSelected ) { 8180 jQuery.propHooks.selected = { 8181 get: function( elem ) { 8182 8183 /* eslint no-unused-expressions: "off" */ 8184 8185 var parent = elem.parentNode; 8186 if ( parent && parent.parentNode ) { 8187 parent.parentNode.selectedIndex; 8188 } 8189 return null; 8190 }, 8191 set: function( elem ) { 8192 8193 /* eslint no-unused-expressions: "off" */ 8194 8195 var parent = elem.parentNode; 8196 if ( parent ) { 8197 parent.selectedIndex; 8198 8199 if ( parent.parentNode ) { 8200 parent.parentNode.selectedIndex; 8201 } 8202 } 8203 } 8204 }; 8205} 8206 8207jQuery.each( [ 8208 "tabIndex", 8209 "readOnly", 8210 "maxLength", 8211 "cellSpacing", 8212 "cellPadding", 8213 "rowSpan", 8214 "colSpan", 8215 "useMap", 8216 "frameBorder", 8217 "contentEditable" 8218], function() { 8219 jQuery.propFix[ this.toLowerCase() ] = this; 8220} ); 8221 8222 8223 8224 8225 // Strip and collapse whitespace according to HTML spec 8226 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 8227 function stripAndCollapse( value ) { 8228 var tokens = value.match( rnothtmlwhite ) || []; 8229 return tokens.join( " " ); 8230 } 8231 8232 8233function getClass( elem ) { 8234 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 8235} 8236 8237function classesToArray( value ) { 8238 if ( Array.isArray( value ) ) { 8239 return value; 8240 } 8241 if ( typeof value === "string" ) { 8242 return value.match( rnothtmlwhite ) || []; 8243 } 8244 return []; 8245} 8246 8247jQuery.fn.extend( { 8248 addClass: function( value ) { 8249 var classNames, cur, curValue, className, i, finalValue; 8250 8251 if ( isFunction( value ) ) { 8252 return this.each( function( j ) { 8253 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8254 } ); 8255 } 8256 8257 classNames = classesToArray( value ); 8258 8259 if ( classNames.length ) { 8260 return this.each( function() { 8261 curValue = getClass( this ); 8262 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8263 8264 if ( cur ) { 8265 for ( i = 0; i < classNames.length; i++ ) { 8266 className = classNames[ i ]; 8267 if ( cur.indexOf( " " + className + " " ) < 0 ) { 8268 cur += className + " "; 8269 } 8270 } 8271 8272 // Only assign if different to avoid unneeded rendering. 8273 finalValue = stripAndCollapse( cur ); 8274 if ( curValue !== finalValue ) { 8275 this.setAttribute( "class", finalValue ); 8276 } 8277 } 8278 } ); 8279 } 8280 8281 return this; 8282 }, 8283 8284 removeClass: function( value ) { 8285 var classNames, cur, curValue, className, i, finalValue; 8286 8287 if ( isFunction( value ) ) { 8288 return this.each( function( j ) { 8289 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8290 } ); 8291 } 8292 8293 if ( !arguments.length ) { 8294 return this.attr( "class", "" ); 8295 } 8296 8297 classNames = classesToArray( value ); 8298 8299 if ( classNames.length ) { 8300 return this.each( function() { 8301 curValue = getClass( this ); 8302 8303 // This expression is here for better compressibility (see addClass) 8304 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8305 8306 if ( cur ) { 8307 for ( i = 0; i < classNames.length; i++ ) { 8308 className = classNames[ i ]; 8309 8310 // Remove *all* instances 8311 while ( cur.indexOf( " " + className + " " ) > -1 ) { 8312 cur = cur.replace( " " + className + " ", " " ); 8313 } 8314 } 8315 8316 // Only assign if different to avoid unneeded rendering. 8317 finalValue = stripAndCollapse( cur ); 8318 if ( curValue !== finalValue ) { 8319 this.setAttribute( "class", finalValue ); 8320 } 8321 } 8322 } ); 8323 } 8324 8325 return this; 8326 }, 8327 8328 toggleClass: function( value, stateVal ) { 8329 var classNames, className, i, self, 8330 type = typeof value, 8331 isValidValue = type === "string" || Array.isArray( value ); 8332 8333 if ( isFunction( value ) ) { 8334 return this.each( function( i ) { 8335 jQuery( this ).toggleClass( 8336 value.call( this, i, getClass( this ), stateVal ), 8337 stateVal 8338 ); 8339 } ); 8340 } 8341 8342 if ( typeof stateVal === "boolean" && isValidValue ) { 8343 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8344 } 8345 8346 classNames = classesToArray( value ); 8347 8348 return this.each( function() { 8349 if ( isValidValue ) { 8350 8351 // Toggle individual class names 8352 self = jQuery( this ); 8353 8354 for ( i = 0; i < classNames.length; i++ ) { 8355 className = classNames[ i ]; 8356 8357 // Check each className given, space separated list 8358 if ( self.hasClass( className ) ) { 8359 self.removeClass( className ); 8360 } else { 8361 self.addClass( className ); 8362 } 8363 } 8364 8365 // Toggle whole class name 8366 } else if ( value === undefined || type === "boolean" ) { 8367 className = getClass( this ); 8368 if ( className ) { 8369 8370 // Store className if set 8371 dataPriv.set( this, "__className__", className ); 8372 } 8373 8374 // If the element has a class name or if we're passed `false`, 8375 // then remove the whole classname (if there was one, the above saved it). 8376 // Otherwise bring back whatever was previously saved (if anything), 8377 // falling back to the empty string if nothing was stored. 8378 if ( this.setAttribute ) { 8379 this.setAttribute( "class", 8380 className || value === false ? 8381 "" : 8382 dataPriv.get( this, "__className__" ) || "" 8383 ); 8384 } 8385 } 8386 } ); 8387 }, 8388 8389 hasClass: function( selector ) { 8390 var className, elem, 8391 i = 0; 8392 8393 className = " " + selector + " "; 8394 while ( ( elem = this[ i++ ] ) ) { 8395 if ( elem.nodeType === 1 && 8396 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 8397 return true; 8398 } 8399 } 8400 8401 return false; 8402 } 8403} ); 8404 8405 8406 8407 8408var rreturn = /\r/g; 8409 8410jQuery.fn.extend( { 8411 val: function( value ) { 8412 var hooks, ret, valueIsFunction, 8413 elem = this[ 0 ]; 8414 8415 if ( !arguments.length ) { 8416 if ( elem ) { 8417 hooks = jQuery.valHooks[ elem.type ] || 8418 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8419 8420 if ( hooks && 8421 "get" in hooks && 8422 ( ret = hooks.get( elem, "value" ) ) !== undefined 8423 ) { 8424 return ret; 8425 } 8426 8427 ret = elem.value; 8428 8429 // Handle most common string cases 8430 if ( typeof ret === "string" ) { 8431 return ret.replace( rreturn, "" ); 8432 } 8433 8434 // Handle cases where value is null/undef or number 8435 return ret == null ? "" : ret; 8436 } 8437 8438 return; 8439 } 8440 8441 valueIsFunction = isFunction( value ); 8442 8443 return this.each( function( i ) { 8444 var val; 8445 8446 if ( this.nodeType !== 1 ) { 8447 return; 8448 } 8449 8450 if ( valueIsFunction ) { 8451 val = value.call( this, i, jQuery( this ).val() ); 8452 } else { 8453 val = value; 8454 } 8455 8456 // Treat null/undefined as ""; convert numbers to string 8457 if ( val == null ) { 8458 val = ""; 8459 8460 } else if ( typeof val === "number" ) { 8461 val += ""; 8462 8463 } else if ( Array.isArray( val ) ) { 8464 val = jQuery.map( val, function( value ) { 8465 return value == null ? "" : value + ""; 8466 } ); 8467 } 8468 8469 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8470 8471 // If set returns undefined, fall back to normal setting 8472 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8473 this.value = val; 8474 } 8475 } ); 8476 } 8477} ); 8478 8479jQuery.extend( { 8480 valHooks: { 8481 option: { 8482 get: function( elem ) { 8483 8484 var val = jQuery.find.attr( elem, "value" ); 8485 return val != null ? 8486 val : 8487 8488 // Support: IE <=10 - 11 only 8489 // option.text throws exceptions (trac-14686, trac-14858) 8490 // Strip and collapse whitespace 8491 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8492 stripAndCollapse( jQuery.text( elem ) ); 8493 } 8494 }, 8495 select: { 8496 get: function( elem ) { 8497 var value, option, i, 8498 options = elem.options, 8499 index = elem.selectedIndex, 8500 one = elem.type === "select-one", 8501 values = one ? null : [], 8502 max = one ? index + 1 : options.length; 8503 8504 if ( index < 0 ) { 8505 i = max; 8506 8507 } else { 8508 i = one ? index : 0; 8509 } 8510 8511 // Loop through all the selected options 8512 for ( ; i < max; i++ ) { 8513 option = options[ i ]; 8514 8515 // Support: IE <=9 only 8516 // IE8-9 doesn't update selected after form reset (trac-2551) 8517 if ( ( option.selected || i === index ) && 8518 8519 // Don't return options that are disabled or in a disabled optgroup 8520 !option.disabled && 8521 ( !option.parentNode.disabled || 8522 !nodeName( option.parentNode, "optgroup" ) ) ) { 8523 8524 // Get the specific value for the option 8525 value = jQuery( option ).val(); 8526 8527 // We don't need an array for one selects 8528 if ( one ) { 8529 return value; 8530 } 8531 8532 // Multi-Selects return an array 8533 values.push( value ); 8534 } 8535 } 8536 8537 return values; 8538 }, 8539 8540 set: function( elem, value ) { 8541 var optionSet, option, 8542 options = elem.options, 8543 values = jQuery.makeArray( value ), 8544 i = options.length; 8545 8546 while ( i-- ) { 8547 option = options[ i ]; 8548 8549 /* eslint-disable no-cond-assign */ 8550 8551 if ( option.selected = 8552 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 8553 ) { 8554 optionSet = true; 8555 } 8556 8557 /* eslint-enable no-cond-assign */ 8558 } 8559 8560 // Force browsers to behave consistently when non-matching value is set 8561 if ( !optionSet ) { 8562 elem.selectedIndex = -1; 8563 } 8564 return values; 8565 } 8566 } 8567 } 8568} ); 8569 8570// Radios and checkboxes getter/setter 8571jQuery.each( [ "radio", "checkbox" ], function() { 8572 jQuery.valHooks[ this ] = { 8573 set: function( elem, value ) { 8574 if ( Array.isArray( value ) ) { 8575 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8576 } 8577 } 8578 }; 8579 if ( !support.checkOn ) { 8580 jQuery.valHooks[ this ].get = function( elem ) { 8581 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8582 }; 8583 } 8584} ); 8585 8586 8587 8588 8589// Return jQuery for attributes-only inclusion 8590var location = window.location; 8591 8592var nonce = { guid: Date.now() }; 8593 8594var rquery = ( /\?/ ); 8595 8596 8597 8598// Cross-browser xml parsing 8599jQuery.parseXML = function( data ) { 8600 var xml, parserErrorElem; 8601 if ( !data || typeof data !== "string" ) { 8602 return null; 8603 } 8604 8605 // Support: IE 9 - 11 only 8606 // IE throws on parseFromString with invalid input. 8607 try { 8608 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 8609 } catch ( e ) {} 8610 8611 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 8612 if ( !xml || parserErrorElem ) { 8613 jQuery.error( "Invalid XML: " + ( 8614 parserErrorElem ? 8615 jQuery.map( parserErrorElem.childNodes, function( el ) { 8616 return el.textContent; 8617 } ).join( "\n" ) : 8618 data 8619 ) ); 8620 } 8621 return xml; 8622}; 8623 8624 8625var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8626 stopPropagationCallback = function( e ) { 8627 e.stopPropagation(); 8628 }; 8629 8630jQuery.extend( jQuery.event, { 8631 8632 trigger: function( event, data, elem, onlyHandlers ) { 8633 8634 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8635 eventPath = [ elem || document ], 8636 type = hasOwn.call( event, "type" ) ? event.type : event, 8637 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 8638 8639 cur = lastElement = tmp = elem = elem || document; 8640 8641 // Don't do events on text and comment nodes 8642 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 8643 return; 8644 } 8645 8646 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8647 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 8648 return; 8649 } 8650 8651 if ( type.indexOf( "." ) > -1 ) { 8652 8653 // Namespaced trigger; create a regexp to match event type in handle() 8654 namespaces = type.split( "." ); 8655 type = namespaces.shift(); 8656 namespaces.sort(); 8657 } 8658 ontype = type.indexOf( ":" ) < 0 && "on" + type; 8659 8660 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8661 event = event[ jQuery.expando ] ? 8662 event : 8663 new jQuery.Event( type, typeof event === "object" && event ); 8664 8665 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8666 event.isTrigger = onlyHandlers ? 2 : 3; 8667 event.namespace = namespaces.join( "." ); 8668 event.rnamespace = event.namespace ? 8669 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 8670 null; 8671 8672 // Clean up the event in case it is being reused 8673 event.result = undefined; 8674 if ( !event.target ) { 8675 event.target = elem; 8676 } 8677 8678 // Clone any incoming data and prepend the event, creating the handler arg list 8679 data = data == null ? 8680 [ event ] : 8681 jQuery.makeArray( data, [ event ] ); 8682 8683 // Allow special events to draw outside the lines 8684 special = jQuery.event.special[ type ] || {}; 8685 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 8686 return; 8687 } 8688 8689 // Determine event propagation path in advance, per W3C events spec (trac-9951) 8690 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 8691 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 8692 8693 bubbleType = special.delegateType || type; 8694 if ( !rfocusMorph.test( bubbleType + type ) ) { 8695 cur = cur.parentNode; 8696 } 8697 for ( ; cur; cur = cur.parentNode ) { 8698 eventPath.push( cur ); 8699 tmp = cur; 8700 } 8701 8702 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8703 if ( tmp === ( elem.ownerDocument || document ) ) { 8704 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 8705 } 8706 } 8707 8708 // Fire handlers on the event path 8709 i = 0; 8710 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 8711 lastElement = cur; 8712 event.type = i > 1 ? 8713 bubbleType : 8714 special.bindType || type; 8715 8716 // jQuery handler 8717 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 8718 dataPriv.get( cur, "handle" ); 8719 if ( handle ) { 8720 handle.apply( cur, data ); 8721 } 8722 8723 // Native handler 8724 handle = ontype && cur[ ontype ]; 8725 if ( handle && handle.apply && acceptData( cur ) ) { 8726 event.result = handle.apply( cur, data ); 8727 if ( event.result === false ) { 8728 event.preventDefault(); 8729 } 8730 } 8731 } 8732 event.type = type; 8733 8734 // If nobody prevented the default action, do it now 8735 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 8736 8737 if ( ( !special._default || 8738 special._default.apply( eventPath.pop(), data ) === false ) && 8739 acceptData( elem ) ) { 8740 8741 // Call a native DOM method on the target with the same name as the event. 8742 // Don't do default actions on window, that's where global variables be (trac-6170) 8743 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 8744 8745 // Don't re-trigger an onFOO event when we call its FOO() method 8746 tmp = elem[ ontype ]; 8747 8748 if ( tmp ) { 8749 elem[ ontype ] = null; 8750 } 8751 8752 // Prevent re-triggering of the same event, since we already bubbled it above 8753 jQuery.event.triggered = type; 8754 8755 if ( event.isPropagationStopped() ) { 8756 lastElement.addEventListener( type, stopPropagationCallback ); 8757 } 8758 8759 elem[ type ](); 8760 8761 if ( event.isPropagationStopped() ) { 8762 lastElement.removeEventListener( type, stopPropagationCallback ); 8763 } 8764 8765 jQuery.event.triggered = undefined; 8766 8767 if ( tmp ) { 8768 elem[ ontype ] = tmp; 8769 } 8770 } 8771 } 8772 } 8773 8774 return event.result; 8775 }, 8776 8777 // Piggyback on a donor event to simulate a different one 8778 // Used only for `focus(in | out)` events 8779 simulate: function( type, elem, event ) { 8780 var e = jQuery.extend( 8781 new jQuery.Event(), 8782 event, 8783 { 8784 type: type, 8785 isSimulated: true 8786 } 8787 ); 8788 8789 jQuery.event.trigger( e, null, elem ); 8790 } 8791 8792} ); 8793 8794jQuery.fn.extend( { 8795 8796 trigger: function( type, data ) { 8797 return this.each( function() { 8798 jQuery.event.trigger( type, data, this ); 8799 } ); 8800 }, 8801 triggerHandler: function( type, data ) { 8802 var elem = this[ 0 ]; 8803 if ( elem ) { 8804 return jQuery.event.trigger( type, data, elem, true ); 8805 } 8806 } 8807} ); 8808 8809 8810var 8811 rbracket = /\[\]$/, 8812 rCRLF = /\r?\n/g, 8813 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8814 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8815 8816function buildParams( prefix, obj, traditional, add ) { 8817 var name; 8818 8819 if ( Array.isArray( obj ) ) { 8820 8821 // Serialize array item. 8822 jQuery.each( obj, function( i, v ) { 8823 if ( traditional || rbracket.test( prefix ) ) { 8824 8825 // Treat each array item as a scalar. 8826 add( prefix, v ); 8827 8828 } else { 8829 8830 // Item is non-scalar (array or object), encode its numeric index. 8831 buildParams( 8832 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 8833 v, 8834 traditional, 8835 add 8836 ); 8837 } 8838 } ); 8839 8840 } else if ( !traditional && toType( obj ) === "object" ) { 8841 8842 // Serialize object item. 8843 for ( name in obj ) { 8844 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 8845 } 8846 8847 } else { 8848 8849 // Serialize scalar item. 8850 add( prefix, obj ); 8851 } 8852} 8853 8854// Serialize an array of form elements or a set of 8855// key/values into a query string 8856jQuery.param = function( a, traditional ) { 8857 var prefix, 8858 s = [], 8859 add = function( key, valueOrFunction ) { 8860 8861 // If value is a function, invoke it and use its return value 8862 var value = isFunction( valueOrFunction ) ? 8863 valueOrFunction() : 8864 valueOrFunction; 8865 8866 s[ s.length ] = encodeURIComponent( key ) + "=" + 8867 encodeURIComponent( value == null ? "" : value ); 8868 }; 8869 8870 if ( a == null ) { 8871 return ""; 8872 } 8873 8874 // If an array was passed in, assume that it is an array of form elements. 8875 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 8876 8877 // Serialize the form elements 8878 jQuery.each( a, function() { 8879 add( this.name, this.value ); 8880 } ); 8881 8882 } else { 8883 8884 // If traditional, encode the "old" way (the way 1.3.2 or older 8885 // did it), otherwise encode params recursively. 8886 for ( prefix in a ) { 8887 buildParams( prefix, a[ prefix ], traditional, add ); 8888 } 8889 } 8890 8891 // Return the resulting serialization 8892 return s.join( "&" ); 8893}; 8894 8895jQuery.fn.extend( { 8896 serialize: function() { 8897 return jQuery.param( this.serializeArray() ); 8898 }, 8899 serializeArray: function() { 8900 return this.map( function() { 8901 8902 // Can add propHook for "elements" to filter or add form elements 8903 var elements = jQuery.prop( this, "elements" ); 8904 return elements ? jQuery.makeArray( elements ) : this; 8905 } ).filter( function() { 8906 var type = this.type; 8907 8908 // Use .is( ":disabled" ) so that fieldset[disabled] works 8909 return this.name && !jQuery( this ).is( ":disabled" ) && 8910 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 8911 ( this.checked || !rcheckableType.test( type ) ); 8912 } ).map( function( _i, elem ) { 8913 var val = jQuery( this ).val(); 8914 8915 if ( val == null ) { 8916 return null; 8917 } 8918 8919 if ( Array.isArray( val ) ) { 8920 return jQuery.map( val, function( val ) { 8921 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8922 } ); 8923 } 8924 8925 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8926 } ).get(); 8927 } 8928} ); 8929 8930 8931var 8932 r20 = /%20/g, 8933 rhash = /#.*$/, 8934 rantiCache = /([?&])_=[^&]*/, 8935 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 8936 8937 // trac-7653, trac-8125, trac-8152: local protocol detection 8938 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 8939 rnoContent = /^(?:GET|HEAD)$/, 8940 rprotocol = /^\/\//, 8941 8942 /* Prefilters 8943 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 8944 * 2) These are called: 8945 * - BEFORE asking for a transport 8946 * - AFTER param serialization (s.data is a string if s.processData is true) 8947 * 3) key is the dataType 8948 * 4) the catchall symbol "*" can be used 8949 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 8950 */ 8951 prefilters = {}, 8952 8953 /* Transports bindings 8954 * 1) key is the dataType 8955 * 2) the catchall symbol "*" can be used 8956 * 3) selection will start with transport dataType and THEN go to "*" if needed 8957 */ 8958 transports = {}, 8959 8960 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 8961 allTypes = "*/".concat( "*" ), 8962 8963 // Anchor tag for parsing the document origin 8964 originAnchor = document.createElement( "a" ); 8965 8966originAnchor.href = location.href; 8967 8968// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 8969function addToPrefiltersOrTransports( structure ) { 8970 8971 // dataTypeExpression is optional and defaults to "*" 8972 return function( dataTypeExpression, func ) { 8973 8974 if ( typeof dataTypeExpression !== "string" ) { 8975 func = dataTypeExpression; 8976 dataTypeExpression = "*"; 8977 } 8978 8979 var dataType, 8980 i = 0, 8981 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 8982 8983 if ( isFunction( func ) ) { 8984 8985 // For each dataType in the dataTypeExpression 8986 while ( ( dataType = dataTypes[ i++ ] ) ) { 8987 8988 // Prepend if requested 8989 if ( dataType[ 0 ] === "+" ) { 8990 dataType = dataType.slice( 1 ) || "*"; 8991 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 8992 8993 // Otherwise append 8994 } else { 8995 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 8996 } 8997 } 8998 } 8999 }; 9000} 9001 9002// Base inspection function for prefilters and transports 9003function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 9004 9005 var inspected = {}, 9006 seekingTransport = ( structure === transports ); 9007 9008 function inspect( dataType ) { 9009 var selected; 9010 inspected[ dataType ] = true; 9011 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 9012 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 9013 if ( typeof dataTypeOrTransport === "string" && 9014 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 9015 9016 options.dataTypes.unshift( dataTypeOrTransport ); 9017 inspect( dataTypeOrTransport ); 9018 return false; 9019 } else if ( seekingTransport ) { 9020 return !( selected = dataTypeOrTransport ); 9021 } 9022 } ); 9023 return selected; 9024 } 9025 9026 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 9027} 9028 9029// A special extend for ajax options 9030// that takes "flat" options (not to be deep extended) 9031// Fixes trac-9887 9032function ajaxExtend( target, src ) { 9033 var key, deep, 9034 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9035 9036 for ( key in src ) { 9037 if ( src[ key ] !== undefined ) { 9038 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 9039 } 9040 } 9041 if ( deep ) { 9042 jQuery.extend( true, target, deep ); 9043 } 9044 9045 return target; 9046} 9047 9048/* Handles responses to an ajax request: 9049 * - finds the right dataType (mediates between content-type and expected dataType) 9050 * - returns the corresponding response 9051 */ 9052function ajaxHandleResponses( s, jqXHR, responses ) { 9053 9054 var ct, type, finalDataType, firstDataType, 9055 contents = s.contents, 9056 dataTypes = s.dataTypes; 9057 9058 // Remove auto dataType and get content-type in the process 9059 while ( dataTypes[ 0 ] === "*" ) { 9060 dataTypes.shift(); 9061 if ( ct === undefined ) { 9062 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 9063 } 9064 } 9065 9066 // Check if we're dealing with a known content-type 9067 if ( ct ) { 9068 for ( type in contents ) { 9069 if ( contents[ type ] && contents[ type ].test( ct ) ) { 9070 dataTypes.unshift( type ); 9071 break; 9072 } 9073 } 9074 } 9075 9076 // Check to see if we have a response for the expected dataType 9077 if ( dataTypes[ 0 ] in responses ) { 9078 finalDataType = dataTypes[ 0 ]; 9079 } else { 9080 9081 // Try convertible dataTypes 9082 for ( type in responses ) { 9083 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 9084 finalDataType = type; 9085 break; 9086 } 9087 if ( !firstDataType ) { 9088 firstDataType = type; 9089 } 9090 } 9091 9092 // Or just use first one 9093 finalDataType = finalDataType || firstDataType; 9094 } 9095 9096 // If we found a dataType 9097 // We add the dataType to the list if needed 9098 // and return the corresponding response 9099 if ( finalDataType ) { 9100 if ( finalDataType !== dataTypes[ 0 ] ) { 9101 dataTypes.unshift( finalDataType ); 9102 } 9103 return responses[ finalDataType ]; 9104 } 9105} 9106 9107/* Chain conversions given the request and the original response 9108 * Also sets the responseXXX fields on the jqXHR instance 9109 */ 9110function ajaxConvert( s, response, jqXHR, isSuccess ) { 9111 var conv2, current, conv, tmp, prev, 9112 converters = {}, 9113 9114 // Work with a copy of dataTypes in case we need to modify it for conversion 9115 dataTypes = s.dataTypes.slice(); 9116 9117 // Create converters map with lowercased keys 9118 if ( dataTypes[ 1 ] ) { 9119 for ( conv in s.converters ) { 9120 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9121 } 9122 } 9123 9124 current = dataTypes.shift(); 9125 9126 // Convert to each sequential dataType 9127 while ( current ) { 9128 9129 if ( s.responseFields[ current ] ) { 9130 jqXHR[ s.responseFields[ current ] ] = response; 9131 } 9132 9133 // Apply the dataFilter if provided 9134 if ( !prev && isSuccess && s.dataFilter ) { 9135 response = s.dataFilter( response, s.dataType ); 9136 } 9137 9138 prev = current; 9139 current = dataTypes.shift(); 9140 9141 if ( current ) { 9142 9143 // There's only work to do if current dataType is non-auto 9144 if ( current === "*" ) { 9145 9146 current = prev; 9147 9148 // Convert response if prev dataType is non-auto and differs from current 9149 } else if ( prev !== "*" && prev !== current ) { 9150 9151 // Seek a direct converter 9152 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9153 9154 // If none found, seek a pair 9155 if ( !conv ) { 9156 for ( conv2 in converters ) { 9157 9158 // If conv2 outputs current 9159 tmp = conv2.split( " " ); 9160 if ( tmp[ 1 ] === current ) { 9161 9162 // If prev can be converted to accepted input 9163 conv = converters[ prev + " " + tmp[ 0 ] ] || 9164 converters[ "* " + tmp[ 0 ] ]; 9165 if ( conv ) { 9166 9167 // Condense equivalence converters 9168 if ( conv === true ) { 9169 conv = converters[ conv2 ]; 9170 9171 // Otherwise, insert the intermediate dataType 9172 } else if ( converters[ conv2 ] !== true ) { 9173 current = tmp[ 0 ]; 9174 dataTypes.unshift( tmp[ 1 ] ); 9175 } 9176 break; 9177 } 9178 } 9179 } 9180 } 9181 9182 // Apply converter (if not an equivalence) 9183 if ( conv !== true ) { 9184 9185 // Unless errors are allowed to bubble, catch and return them 9186 if ( conv && s.throws ) { 9187 response = conv( response ); 9188 } else { 9189 try { 9190 response = conv( response ); 9191 } catch ( e ) { 9192 return { 9193 state: "parsererror", 9194 error: conv ? e : "No conversion from " + prev + " to " + current 9195 }; 9196 } 9197 } 9198 } 9199 } 9200 } 9201 } 9202 9203 return { state: "success", data: response }; 9204} 9205 9206jQuery.extend( { 9207 9208 // Counter for holding the number of active queries 9209 active: 0, 9210 9211 // Last-Modified header cache for next request 9212 lastModified: {}, 9213 etag: {}, 9214 9215 ajaxSettings: { 9216 url: location.href, 9217 type: "GET", 9218 isLocal: rlocalProtocol.test( location.protocol ), 9219 global: true, 9220 processData: true, 9221 async: true, 9222 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9223 9224 /* 9225 timeout: 0, 9226 data: null, 9227 dataType: null, 9228 username: null, 9229 password: null, 9230 cache: null, 9231 throws: false, 9232 traditional: false, 9233 headers: {}, 9234 */ 9235 9236 accepts: { 9237 "*": allTypes, 9238 text: "text/plain", 9239 html: "text/html", 9240 xml: "application/xml, text/xml", 9241 json: "application/json, text/javascript" 9242 }, 9243 9244 contents: { 9245 xml: /\bxml\b/, 9246 html: /\bhtml/, 9247 json: /\bjson\b/ 9248 }, 9249 9250 responseFields: { 9251 xml: "responseXML", 9252 text: "responseText", 9253 json: "responseJSON" 9254 }, 9255 9256 // Data converters 9257 // Keys separate source (or catchall "*") and destination types with a single space 9258 converters: { 9259 9260 // Convert anything to text 9261 "* text": String, 9262 9263 // Text to html (true = no transformation) 9264 "text html": true, 9265 9266 // Evaluate text as a json expression 9267 "text json": JSON.parse, 9268 9269 // Parse text as xml 9270 "text xml": jQuery.parseXML 9271 }, 9272 9273 // For options that shouldn't be deep extended: 9274 // you can add your own custom options here if 9275 // and when you create one that shouldn't be 9276 // deep extended (see ajaxExtend) 9277 flatOptions: { 9278 url: true, 9279 context: true 9280 } 9281 }, 9282 9283 // Creates a full fledged settings object into target 9284 // with both ajaxSettings and settings fields. 9285 // If target is omitted, writes into ajaxSettings. 9286 ajaxSetup: function( target, settings ) { 9287 return settings ? 9288 9289 // Building a settings object 9290 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9291 9292 // Extending ajaxSettings 9293 ajaxExtend( jQuery.ajaxSettings, target ); 9294 }, 9295 9296 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9297 ajaxTransport: addToPrefiltersOrTransports( transports ), 9298 9299 // Main method 9300 ajax: function( url, options ) { 9301 9302 // If url is an object, simulate pre-1.5 signature 9303 if ( typeof url === "object" ) { 9304 options = url; 9305 url = undefined; 9306 } 9307 9308 // Force options to be an object 9309 options = options || {}; 9310 9311 var transport, 9312 9313 // URL without anti-cache param 9314 cacheURL, 9315 9316 // Response headers 9317 responseHeadersString, 9318 responseHeaders, 9319 9320 // timeout handle 9321 timeoutTimer, 9322 9323 // Url cleanup var 9324 urlAnchor, 9325 9326 // Request state (becomes false upon send and true upon completion) 9327 completed, 9328 9329 // To know if global events are to be dispatched 9330 fireGlobals, 9331 9332 // Loop variable 9333 i, 9334 9335 // uncached part of the url 9336 uncached, 9337 9338 // Create the final options object 9339 s = jQuery.ajaxSetup( {}, options ), 9340 9341 // Callbacks context 9342 callbackContext = s.context || s, 9343 9344 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9345 globalEventContext = s.context && 9346 ( callbackContext.nodeType || callbackContext.jquery ) ? 9347 jQuery( callbackContext ) : 9348 jQuery.event, 9349 9350 // Deferreds 9351 deferred = jQuery.Deferred(), 9352 completeDeferred = jQuery.Callbacks( "once memory" ), 9353 9354 // Status-dependent callbacks 9355 statusCode = s.statusCode || {}, 9356 9357 // Headers (they are sent all at once) 9358 requestHeaders = {}, 9359 requestHeadersNames = {}, 9360 9361 // Default abort message 9362 strAbort = "canceled", 9363 9364 // Fake xhr 9365 jqXHR = { 9366 readyState: 0, 9367 9368 // Builds headers hashtable if needed 9369 getResponseHeader: function( key ) { 9370 var match; 9371 if ( completed ) { 9372 if ( !responseHeaders ) { 9373 responseHeaders = {}; 9374 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9375 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 9376 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 9377 .concat( match[ 2 ] ); 9378 } 9379 } 9380 match = responseHeaders[ key.toLowerCase() + " " ]; 9381 } 9382 return match == null ? null : match.join( ", " ); 9383 }, 9384 9385 // Raw string 9386 getAllResponseHeaders: function() { 9387 return completed ? responseHeadersString : null; 9388 }, 9389 9390 // Caches the header 9391 setRequestHeader: function( name, value ) { 9392 if ( completed == null ) { 9393 name = requestHeadersNames[ name.toLowerCase() ] = 9394 requestHeadersNames[ name.toLowerCase() ] || name; 9395 requestHeaders[ name ] = value; 9396 } 9397 return this; 9398 }, 9399 9400 // Overrides response content-type header 9401 overrideMimeType: function( type ) { 9402 if ( completed == null ) { 9403 s.mimeType = type; 9404 } 9405 return this; 9406 }, 9407 9408 // Status-dependent callbacks 9409 statusCode: function( map ) { 9410 var code; 9411 if ( map ) { 9412 if ( completed ) { 9413 9414 // Execute the appropriate callbacks 9415 jqXHR.always( map[ jqXHR.status ] ); 9416 } else { 9417 9418 // Lazy-add the new callbacks in a way that preserves old ones 9419 for ( code in map ) { 9420 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9421 } 9422 } 9423 } 9424 return this; 9425 }, 9426 9427 // Cancel the request 9428 abort: function( statusText ) { 9429 var finalText = statusText || strAbort; 9430 if ( transport ) { 9431 transport.abort( finalText ); 9432 } 9433 done( 0, finalText ); 9434 return this; 9435 } 9436 }; 9437 9438 // Attach deferreds 9439 deferred.promise( jqXHR ); 9440 9441 // Add protocol if not provided (prefilters might expect it) 9442 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 9443 // We also use the url parameter if available 9444 s.url = ( ( url || s.url || location.href ) + "" ) 9445 .replace( rprotocol, location.protocol + "//" ); 9446 9447 // Alias method option to type as per ticket trac-12004 9448 s.type = options.method || options.type || s.method || s.type; 9449 9450 // Extract dataTypes list 9451 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 9452 9453 // A cross-domain request is in order when the origin doesn't match the current origin. 9454 if ( s.crossDomain == null ) { 9455 urlAnchor = document.createElement( "a" ); 9456 9457 // Support: IE <=8 - 11, Edge 12 - 15 9458 // IE throws exception on accessing the href property if url is malformed, 9459 // e.g. http://example.com:80x/ 9460 try { 9461 urlAnchor.href = s.url; 9462 9463 // Support: IE <=8 - 11 only 9464 // Anchor's host property isn't correctly set when s.url is relative 9465 urlAnchor.href = urlAnchor.href; 9466 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9467 urlAnchor.protocol + "//" + urlAnchor.host; 9468 } catch ( e ) { 9469 9470 // If there is an error parsing the URL, assume it is crossDomain, 9471 // it can be rejected by the transport if it is invalid 9472 s.crossDomain = true; 9473 } 9474 } 9475 9476 // Convert data if not already a string 9477 if ( s.data && s.processData && typeof s.data !== "string" ) { 9478 s.data = jQuery.param( s.data, s.traditional ); 9479 } 9480 9481 // Apply prefilters 9482 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9483 9484 // If request was aborted inside a prefilter, stop there 9485 if ( completed ) { 9486 return jqXHR; 9487 } 9488 9489 // We can fire global events as of now if asked to 9490 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 9491 fireGlobals = jQuery.event && s.global; 9492 9493 // Watch for a new set of requests 9494 if ( fireGlobals && jQuery.active++ === 0 ) { 9495 jQuery.event.trigger( "ajaxStart" ); 9496 } 9497 9498 // Uppercase the type 9499 s.type = s.type.toUpperCase(); 9500 9501 // Determine if request has content 9502 s.hasContent = !rnoContent.test( s.type ); 9503 9504 // Save the URL in case we're toying with the If-Modified-Since 9505 // and/or If-None-Match header later on 9506 // Remove hash to simplify url manipulation 9507 cacheURL = s.url.replace( rhash, "" ); 9508 9509 // More options handling for requests with no content 9510 if ( !s.hasContent ) { 9511 9512 // Remember the hash so we can put it back 9513 uncached = s.url.slice( cacheURL.length ); 9514 9515 // If data is available and should be processed, append data to url 9516 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 9517 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 9518 9519 // trac-9682: remove data so that it's not used in an eventual retry 9520 delete s.data; 9521 } 9522 9523 // Add or update anti-cache param if needed 9524 if ( s.cache === false ) { 9525 cacheURL = cacheURL.replace( rantiCache, "$1" ); 9526 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 9527 uncached; 9528 } 9529 9530 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9531 s.url = cacheURL + uncached; 9532 9533 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9534 } else if ( s.data && s.processData && 9535 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 9536 s.data = s.data.replace( r20, "+" ); 9537 } 9538 9539 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9540 if ( s.ifModified ) { 9541 if ( jQuery.lastModified[ cacheURL ] ) { 9542 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9543 } 9544 if ( jQuery.etag[ cacheURL ] ) { 9545 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9546 } 9547 } 9548 9549 // Set the correct header, if data is being sent 9550 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9551 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9552 } 9553 9554 // Set the Accepts header for the server, depending on the dataType 9555 jqXHR.setRequestHeader( 9556 "Accept", 9557 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9558 s.accepts[ s.dataTypes[ 0 ] ] + 9559 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9560 s.accepts[ "*" ] 9561 ); 9562 9563 // Check for headers option 9564 for ( i in s.headers ) { 9565 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9566 } 9567 9568 // Allow custom headers/mimetypes and early abort 9569 if ( s.beforeSend && 9570 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 9571 9572 // Abort if not done already and return 9573 return jqXHR.abort(); 9574 } 9575 9576 // Aborting is no longer a cancellation 9577 strAbort = "abort"; 9578 9579 // Install callbacks on deferreds 9580 completeDeferred.add( s.complete ); 9581 jqXHR.done( s.success ); 9582 jqXHR.fail( s.error ); 9583 9584 // Get transport 9585 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9586 9587 // If no transport, we auto-abort 9588 if ( !transport ) { 9589 done( -1, "No Transport" ); 9590 } else { 9591 jqXHR.readyState = 1; 9592 9593 // Send global event 9594 if ( fireGlobals ) { 9595 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9596 } 9597 9598 // If request was aborted inside ajaxSend, stop there 9599 if ( completed ) { 9600 return jqXHR; 9601 } 9602 9603 // Timeout 9604 if ( s.async && s.timeout > 0 ) { 9605 timeoutTimer = window.setTimeout( function() { 9606 jqXHR.abort( "timeout" ); 9607 }, s.timeout ); 9608 } 9609 9610 try { 9611 completed = false; 9612 transport.send( requestHeaders, done ); 9613 } catch ( e ) { 9614 9615 // Rethrow post-completion exceptions 9616 if ( completed ) { 9617 throw e; 9618 } 9619 9620 // Propagate others as results 9621 done( -1, e ); 9622 } 9623 } 9624 9625 // Callback for when everything is done 9626 function done( status, nativeStatusText, responses, headers ) { 9627 var isSuccess, success, error, response, modified, 9628 statusText = nativeStatusText; 9629 9630 // Ignore repeat invocations 9631 if ( completed ) { 9632 return; 9633 } 9634 9635 completed = true; 9636 9637 // Clear timeout if it exists 9638 if ( timeoutTimer ) { 9639 window.clearTimeout( timeoutTimer ); 9640 } 9641 9642 // Dereference transport for early garbage collection 9643 // (no matter how long the jqXHR object will be used) 9644 transport = undefined; 9645 9646 // Cache response headers 9647 responseHeadersString = headers || ""; 9648 9649 // Set readyState 9650 jqXHR.readyState = status > 0 ? 4 : 0; 9651 9652 // Determine if successful 9653 isSuccess = status >= 200 && status < 300 || status === 304; 9654 9655 // Get response data 9656 if ( responses ) { 9657 response = ajaxHandleResponses( s, jqXHR, responses ); 9658 } 9659 9660 // Use a noop converter for missing script but not if jsonp 9661 if ( !isSuccess && 9662 jQuery.inArray( "script", s.dataTypes ) > -1 && 9663 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 9664 s.converters[ "text script" ] = function() {}; 9665 } 9666 9667 // Convert no matter what (that way responseXXX fields are always set) 9668 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9669 9670 // If successful, handle type chaining 9671 if ( isSuccess ) { 9672 9673 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9674 if ( s.ifModified ) { 9675 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9676 if ( modified ) { 9677 jQuery.lastModified[ cacheURL ] = modified; 9678 } 9679 modified = jqXHR.getResponseHeader( "etag" ); 9680 if ( modified ) { 9681 jQuery.etag[ cacheURL ] = modified; 9682 } 9683 } 9684 9685 // if no content 9686 if ( status === 204 || s.type === "HEAD" ) { 9687 statusText = "nocontent"; 9688 9689 // if not modified 9690 } else if ( status === 304 ) { 9691 statusText = "notmodified"; 9692 9693 // If we have data, let's convert it 9694 } else { 9695 statusText = response.state; 9696 success = response.data; 9697 error = response.error; 9698 isSuccess = !error; 9699 } 9700 } else { 9701 9702 // Extract error from statusText and normalize for non-aborts 9703 error = statusText; 9704 if ( status || !statusText ) { 9705 statusText = "error"; 9706 if ( status < 0 ) { 9707 status = 0; 9708 } 9709 } 9710 } 9711 9712 // Set data for the fake xhr object 9713 jqXHR.status = status; 9714 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9715 9716 // Success/Error 9717 if ( isSuccess ) { 9718 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9719 } else { 9720 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9721 } 9722 9723 // Status-dependent callbacks 9724 jqXHR.statusCode( statusCode ); 9725 statusCode = undefined; 9726 9727 if ( fireGlobals ) { 9728 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9729 [ jqXHR, s, isSuccess ? success : error ] ); 9730 } 9731 9732 // Complete 9733 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9734 9735 if ( fireGlobals ) { 9736 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9737 9738 // Handle the global AJAX counter 9739 if ( !( --jQuery.active ) ) { 9740 jQuery.event.trigger( "ajaxStop" ); 9741 } 9742 } 9743 } 9744 9745 return jqXHR; 9746 }, 9747 9748 getJSON: function( url, data, callback ) { 9749 return jQuery.get( url, data, callback, "json" ); 9750 }, 9751 9752 getScript: function( url, callback ) { 9753 return jQuery.get( url, undefined, callback, "script" ); 9754 } 9755} ); 9756 9757jQuery.each( [ "get", "post" ], function( _i, method ) { 9758 jQuery[ method ] = function( url, data, callback, type ) { 9759 9760 // Shift arguments if data argument was omitted 9761 if ( isFunction( data ) ) { 9762 type = type || callback; 9763 callback = data; 9764 data = undefined; 9765 } 9766 9767 // The url can be an options object (which then must have .url) 9768 return jQuery.ajax( jQuery.extend( { 9769 url: url, 9770 type: method, 9771 dataType: type, 9772 data: data, 9773 success: callback 9774 }, jQuery.isPlainObject( url ) && url ) ); 9775 }; 9776} ); 9777 9778jQuery.ajaxPrefilter( function( s ) { 9779 var i; 9780 for ( i in s.headers ) { 9781 if ( i.toLowerCase() === "content-type" ) { 9782 s.contentType = s.headers[ i ] || ""; 9783 } 9784 } 9785} ); 9786 9787 9788jQuery._evalUrl = function( url, options, doc ) { 9789 return jQuery.ajax( { 9790 url: url, 9791 9792 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 9793 type: "GET", 9794 dataType: "script", 9795 cache: true, 9796 async: false, 9797 global: false, 9798 9799 // Only evaluate the response if it is successful (gh-4126) 9800 // dataFilter is not invoked for failure responses, so using it instead 9801 // of the default converter is kludgy but it works. 9802 converters: { 9803 "text script": function() {} 9804 }, 9805 dataFilter: function( response ) { 9806 jQuery.globalEval( response, options, doc ); 9807 } 9808 } ); 9809}; 9810 9811 9812jQuery.fn.extend( { 9813 wrapAll: function( html ) { 9814 var wrap; 9815 9816 if ( this[ 0 ] ) { 9817 if ( isFunction( html ) ) { 9818 html = html.call( this[ 0 ] ); 9819 } 9820 9821 // The elements to wrap the target around 9822 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9823 9824 if ( this[ 0 ].parentNode ) { 9825 wrap.insertBefore( this[ 0 ] ); 9826 } 9827 9828 wrap.map( function() { 9829 var elem = this; 9830 9831 while ( elem.firstElementChild ) { 9832 elem = elem.firstElementChild; 9833 } 9834 9835 return elem; 9836 } ).append( this ); 9837 } 9838 9839 return this; 9840 }, 9841 9842 wrapInner: function( html ) { 9843 if ( isFunction( html ) ) { 9844 return this.each( function( i ) { 9845 jQuery( this ).wrapInner( html.call( this, i ) ); 9846 } ); 9847 } 9848 9849 return this.each( function() { 9850 var self = jQuery( this ), 9851 contents = self.contents(); 9852 9853 if ( contents.length ) { 9854 contents.wrapAll( html ); 9855 9856 } else { 9857 self.append( html ); 9858 } 9859 } ); 9860 }, 9861 9862 wrap: function( html ) { 9863 var htmlIsFunction = isFunction( html ); 9864 9865 return this.each( function( i ) { 9866 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 9867 } ); 9868 }, 9869 9870 unwrap: function( selector ) { 9871 this.parent( selector ).not( "body" ).each( function() { 9872 jQuery( this ).replaceWith( this.childNodes ); 9873 } ); 9874 return this; 9875 } 9876} ); 9877 9878 9879jQuery.expr.pseudos.hidden = function( elem ) { 9880 return !jQuery.expr.pseudos.visible( elem ); 9881}; 9882jQuery.expr.pseudos.visible = function( elem ) { 9883 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 9884}; 9885 9886 9887 9888 9889jQuery.ajaxSettings.xhr = function() { 9890 try { 9891 return new window.XMLHttpRequest(); 9892 } catch ( e ) {} 9893}; 9894 9895var xhrSuccessStatus = { 9896 9897 // File protocol always yields status code 0, assume 200 9898 0: 200, 9899 9900 // Support: IE <=9 only 9901 // trac-1450: sometimes IE returns 1223 when it should be 204 9902 1223: 204 9903 }, 9904 xhrSupported = jQuery.ajaxSettings.xhr(); 9905 9906support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 9907support.ajax = xhrSupported = !!xhrSupported; 9908 9909jQuery.ajaxTransport( function( options ) { 9910 var callback, errorCallback; 9911 9912 // Cross domain only allowed if supported through XMLHttpRequest 9913 if ( support.cors || xhrSupported && !options.crossDomain ) { 9914 return { 9915 send: function( headers, complete ) { 9916 var i, 9917 xhr = options.xhr(); 9918 9919 xhr.open( 9920 options.type, 9921 options.url, 9922 options.async, 9923 options.username, 9924 options.password 9925 ); 9926 9927 // Apply custom fields if provided 9928 if ( options.xhrFields ) { 9929 for ( i in options.xhrFields ) { 9930 xhr[ i ] = options.xhrFields[ i ]; 9931 } 9932 } 9933 9934 // Override mime type if needed 9935 if ( options.mimeType && xhr.overrideMimeType ) { 9936 xhr.overrideMimeType( options.mimeType ); 9937 } 9938 9939 // X-Requested-With header 9940 // For cross-domain requests, seeing as conditions for a preflight are 9941 // akin to a jigsaw puzzle, we simply never set it to be sure. 9942 // (it can always be set on a per-request basis or even using ajaxSetup) 9943 // For same-domain requests, won't change header if already provided. 9944 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 9945 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 9946 } 9947 9948 // Set headers 9949 for ( i in headers ) { 9950 xhr.setRequestHeader( i, headers[ i ] ); 9951 } 9952 9953 // Callback 9954 callback = function( type ) { 9955 return function() { 9956 if ( callback ) { 9957 callback = errorCallback = xhr.onload = 9958 xhr.onerror = xhr.onabort = xhr.ontimeout = 9959 xhr.onreadystatechange = null; 9960 9961 if ( type === "abort" ) { 9962 xhr.abort(); 9963 } else if ( type === "error" ) { 9964 9965 // Support: IE <=9 only 9966 // On a manual native abort, IE9 throws 9967 // errors on any property access that is not readyState 9968 if ( typeof xhr.status !== "number" ) { 9969 complete( 0, "error" ); 9970 } else { 9971 complete( 9972 9973 // File: protocol always yields status 0; see trac-8605, trac-14207 9974 xhr.status, 9975 xhr.statusText 9976 ); 9977 } 9978 } else { 9979 complete( 9980 xhrSuccessStatus[ xhr.status ] || xhr.status, 9981 xhr.statusText, 9982 9983 // Support: IE <=9 only 9984 // IE9 has no XHR2 but throws on binary (trac-11426) 9985 // For XHR2 non-text, let the caller handle it (gh-2498) 9986 ( xhr.responseType || "text" ) !== "text" || 9987 typeof xhr.responseText !== "string" ? 9988 { binary: xhr.response } : 9989 { text: xhr.responseText }, 9990 xhr.getAllResponseHeaders() 9991 ); 9992 } 9993 } 9994 }; 9995 }; 9996 9997 // Listen to events 9998 xhr.onload = callback(); 9999 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 10000 10001 // Support: IE 9 only 10002 // Use onreadystatechange to replace onabort 10003 // to handle uncaught aborts 10004 if ( xhr.onabort !== undefined ) { 10005 xhr.onabort = errorCallback; 10006 } else { 10007 xhr.onreadystatechange = function() { 10008 10009 // Check readyState before timeout as it changes 10010 if ( xhr.readyState === 4 ) { 10011 10012 // Allow onerror to be called first, 10013 // but that will not handle a native abort 10014 // Also, save errorCallback to a variable 10015 // as xhr.onerror cannot be accessed 10016 window.setTimeout( function() { 10017 if ( callback ) { 10018 errorCallback(); 10019 } 10020 } ); 10021 } 10022 }; 10023 } 10024 10025 // Create the abort callback 10026 callback = callback( "abort" ); 10027 10028 try { 10029 10030 // Do send the request (this may raise an exception) 10031 xhr.send( options.hasContent && options.data || null ); 10032 } catch ( e ) { 10033 10034 // trac-14683: Only rethrow if this hasn't been notified as an error yet 10035 if ( callback ) { 10036 throw e; 10037 } 10038 } 10039 }, 10040 10041 abort: function() { 10042 if ( callback ) { 10043 callback(); 10044 } 10045 } 10046 }; 10047 } 10048} ); 10049 10050 10051 10052 10053// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 10054jQuery.ajaxPrefilter( function( s ) { 10055 if ( s.crossDomain ) { 10056 s.contents.script = false; 10057 } 10058} ); 10059 10060// Install script dataType 10061jQuery.ajaxSetup( { 10062 accepts: { 10063 script: "text/javascript, application/javascript, " + 10064 "application/ecmascript, application/x-ecmascript" 10065 }, 10066 contents: { 10067 script: /\b(?:java|ecma)script\b/ 10068 }, 10069 converters: { 10070 "text script": function( text ) { 10071 jQuery.globalEval( text ); 10072 return text; 10073 } 10074 } 10075} ); 10076 10077// Handle cache's special case and crossDomain 10078jQuery.ajaxPrefilter( "script", function( s ) { 10079 if ( s.cache === undefined ) { 10080 s.cache = false; 10081 } 10082 if ( s.crossDomain ) { 10083 s.type = "GET"; 10084 } 10085} ); 10086 10087// Bind script tag hack transport 10088jQuery.ajaxTransport( "script", function( s ) { 10089 10090 // This transport only deals with cross domain or forced-by-attrs requests 10091 if ( s.crossDomain || s.scriptAttrs ) { 10092 var script, callback; 10093 return { 10094 send: function( _, complete ) { 10095 script = jQuery( "<script>" ) 10096 .attr( s.scriptAttrs || {} ) 10097 .prop( { charset: s.scriptCharset, src: s.url } ) 10098 .on( "load error", callback = function( evt ) { 10099 script.remove(); 10100 callback = null; 10101 if ( evt ) { 10102 complete( evt.type === "error" ? 404 : 200, evt.type ); 10103 } 10104 } ); 10105 10106 // Use native DOM manipulation to avoid our domManip AJAX trickery 10107 document.head.appendChild( script[ 0 ] ); 10108 }, 10109 abort: function() { 10110 if ( callback ) { 10111 callback(); 10112 } 10113 } 10114 }; 10115 } 10116} ); 10117 10118 10119 10120 10121var oldCallbacks = [], 10122 rjsonp = /(=)\?(?=&|$)|\?\?/; 10123 10124// Default jsonp settings 10125jQuery.ajaxSetup( { 10126 jsonp: "callback", 10127 jsonpCallback: function() { 10128 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 10129 this[ callback ] = true; 10130 return callback; 10131 } 10132} ); 10133 10134// Detect, normalize options and install callbacks for jsonp requests 10135jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10136 10137 var callbackName, overwritten, responseContainer, 10138 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10139 "url" : 10140 typeof s.data === "string" && 10141 ( s.contentType || "" ) 10142 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10143 rjsonp.test( s.data ) && "data" 10144 ); 10145 10146 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10147 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10148 10149 // Get callback name, remembering preexisting value associated with it 10150 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 10151 s.jsonpCallback() : 10152 s.jsonpCallback; 10153 10154 // Insert callback into url or form data 10155 if ( jsonProp ) { 10156 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10157 } else if ( s.jsonp !== false ) { 10158 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10159 } 10160 10161 // Use data converter to retrieve json after script execution 10162 s.converters[ "script json" ] = function() { 10163 if ( !responseContainer ) { 10164 jQuery.error( callbackName + " was not called" ); 10165 } 10166 return responseContainer[ 0 ]; 10167 }; 10168 10169 // Force json dataType 10170 s.dataTypes[ 0 ] = "json"; 10171 10172 // Install callback 10173 overwritten = window[ callbackName ]; 10174 window[ callbackName ] = function() { 10175 responseContainer = arguments; 10176 }; 10177 10178 // Clean-up function (fires after converters) 10179 jqXHR.always( function() { 10180 10181 // If previous value didn't exist - remove it 10182 if ( overwritten === undefined ) { 10183 jQuery( window ).removeProp( callbackName ); 10184 10185 // Otherwise restore preexisting value 10186 } else { 10187 window[ callbackName ] = overwritten; 10188 } 10189 10190 // Save back as free 10191 if ( s[ callbackName ] ) { 10192 10193 // Make sure that re-using the options doesn't screw things around 10194 s.jsonpCallback = originalSettings.jsonpCallback; 10195 10196 // Save the callback name for future use 10197 oldCallbacks.push( callbackName ); 10198 } 10199 10200 // Call if it was a function and we have a response 10201 if ( responseContainer && isFunction( overwritten ) ) { 10202 overwritten( responseContainer[ 0 ] ); 10203 } 10204 10205 responseContainer = overwritten = undefined; 10206 } ); 10207 10208 // Delegate to script 10209 return "script"; 10210 } 10211} ); 10212 10213 10214 10215 10216// Support: Safari 8 only 10217// In Safari 8 documents created via document.implementation.createHTMLDocument 10218// collapse sibling forms: the second one becomes a child of the first one. 10219// Because of that, this security measure has to be disabled in Safari 8. 10220// https://bugs.webkit.org/show_bug.cgi?id=137337 10221support.createHTMLDocument = ( function() { 10222 var body = document.implementation.createHTMLDocument( "" ).body; 10223 body.innerHTML = "<form></form><form></form>"; 10224 return body.childNodes.length === 2; 10225} )(); 10226 10227 10228// Argument "data" should be string of html 10229// context (optional): If specified, the fragment will be created in this context, 10230// defaults to document 10231// keepScripts (optional): If true, will include scripts passed in the html string 10232jQuery.parseHTML = function( data, context, keepScripts ) { 10233 if ( typeof data !== "string" ) { 10234 return []; 10235 } 10236 if ( typeof context === "boolean" ) { 10237 keepScripts = context; 10238 context = false; 10239 } 10240 10241 var base, parsed, scripts; 10242 10243 if ( !context ) { 10244 10245 // Stop scripts or inline event handlers from being executed immediately 10246 // by using document.implementation 10247 if ( support.createHTMLDocument ) { 10248 context = document.implementation.createHTMLDocument( "" ); 10249 10250 // Set the base href for the created document 10251 // so any parsed elements with URLs 10252 // are based on the document's URL (gh-2965) 10253 base = context.createElement( "base" ); 10254 base.href = document.location.href; 10255 context.head.appendChild( base ); 10256 } else { 10257 context = document; 10258 } 10259 } 10260 10261 parsed = rsingleTag.exec( data ); 10262 scripts = !keepScripts && []; 10263 10264 // Single tag 10265 if ( parsed ) { 10266 return [ context.createElement( parsed[ 1 ] ) ]; 10267 } 10268 10269 parsed = buildFragment( [ data ], context, scripts ); 10270 10271 if ( scripts && scripts.length ) { 10272 jQuery( scripts ).remove(); 10273 } 10274 10275 return jQuery.merge( [], parsed.childNodes ); 10276}; 10277 10278 10279/** 10280 * Load a url into a page 10281 */ 10282jQuery.fn.load = function( url, params, callback ) { 10283 var selector, type, response, 10284 self = this, 10285 off = url.indexOf( " " ); 10286 10287 if ( off > -1 ) { 10288 selector = stripAndCollapse( url.slice( off ) ); 10289 url = url.slice( 0, off ); 10290 } 10291 10292 // If it's a function 10293 if ( isFunction( params ) ) { 10294 10295 // We assume that it's the callback 10296 callback = params; 10297 params = undefined; 10298 10299 // Otherwise, build a param string 10300 } else if ( params && typeof params === "object" ) { 10301 type = "POST"; 10302 } 10303 10304 // If we have elements to modify, make the request 10305 if ( self.length > 0 ) { 10306 jQuery.ajax( { 10307 url: url, 10308 10309 // If "type" variable is undefined, then "GET" method will be used. 10310 // Make value of this field explicit since 10311 // user can override it through ajaxSetup method 10312 type: type || "GET", 10313 dataType: "html", 10314 data: params 10315 } ).done( function( responseText ) { 10316 10317 // Save response for use in complete callback 10318 response = arguments; 10319 10320 self.html( selector ? 10321 10322 // If a selector was specified, locate the right elements in a dummy div 10323 // Exclude scripts to avoid IE 'Permission Denied' errors 10324 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10325 10326 // Otherwise use the full result 10327 responseText ); 10328 10329 // If the request succeeds, this function gets "data", "status", "jqXHR" 10330 // but they are ignored because response was set above. 10331 // If it fails, this function gets "jqXHR", "status", "error" 10332 } ).always( callback && function( jqXHR, status ) { 10333 self.each( function() { 10334 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10335 } ); 10336 } ); 10337 } 10338 10339 return this; 10340}; 10341 10342 10343 10344 10345jQuery.expr.pseudos.animated = function( elem ) { 10346 return jQuery.grep( jQuery.timers, function( fn ) { 10347 return elem === fn.elem; 10348 } ).length; 10349}; 10350 10351 10352 10353 10354jQuery.offset = { 10355 setOffset: function( elem, options, i ) { 10356 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10357 position = jQuery.css( elem, "position" ), 10358 curElem = jQuery( elem ), 10359 props = {}; 10360 10361 // Set position first, in-case top/left are set even on static elem 10362 if ( position === "static" ) { 10363 elem.style.position = "relative"; 10364 } 10365 10366 curOffset = curElem.offset(); 10367 curCSSTop = jQuery.css( elem, "top" ); 10368 curCSSLeft = jQuery.css( elem, "left" ); 10369 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10370 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 10371 10372 // Need to be able to calculate position if either 10373 // top or left is auto and position is either absolute or fixed 10374 if ( calculatePosition ) { 10375 curPosition = curElem.position(); 10376 curTop = curPosition.top; 10377 curLeft = curPosition.left; 10378 10379 } else { 10380 curTop = parseFloat( curCSSTop ) || 0; 10381 curLeft = parseFloat( curCSSLeft ) || 0; 10382 } 10383 10384 if ( isFunction( options ) ) { 10385 10386 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10387 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10388 } 10389 10390 if ( options.top != null ) { 10391 props.top = ( options.top - curOffset.top ) + curTop; 10392 } 10393 if ( options.left != null ) { 10394 props.left = ( options.left - curOffset.left ) + curLeft; 10395 } 10396 10397 if ( "using" in options ) { 10398 options.using.call( elem, props ); 10399 10400 } else { 10401 curElem.css( props ); 10402 } 10403 } 10404}; 10405 10406jQuery.fn.extend( { 10407 10408 // offset() relates an element's border box to the document origin 10409 offset: function( options ) { 10410 10411 // Preserve chaining for setter 10412 if ( arguments.length ) { 10413 return options === undefined ? 10414 this : 10415 this.each( function( i ) { 10416 jQuery.offset.setOffset( this, options, i ); 10417 } ); 10418 } 10419 10420 var rect, win, 10421 elem = this[ 0 ]; 10422 10423 if ( !elem ) { 10424 return; 10425 } 10426 10427 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10428 // Support: IE <=11 only 10429 // Running getBoundingClientRect on a 10430 // disconnected node in IE throws an error 10431 if ( !elem.getClientRects().length ) { 10432 return { top: 0, left: 0 }; 10433 } 10434 10435 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10436 rect = elem.getBoundingClientRect(); 10437 win = elem.ownerDocument.defaultView; 10438 return { 10439 top: rect.top + win.pageYOffset, 10440 left: rect.left + win.pageXOffset 10441 }; 10442 }, 10443 10444 // position() relates an element's margin box to its offset parent's padding box 10445 // This corresponds to the behavior of CSS absolute positioning 10446 position: function() { 10447 if ( !this[ 0 ] ) { 10448 return; 10449 } 10450 10451 var offsetParent, offset, doc, 10452 elem = this[ 0 ], 10453 parentOffset = { top: 0, left: 0 }; 10454 10455 // position:fixed elements are offset from the viewport, which itself always has zero offset 10456 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10457 10458 // Assume position:fixed implies availability of getBoundingClientRect 10459 offset = elem.getBoundingClientRect(); 10460 10461 } else { 10462 offset = this.offset(); 10463 10464 // Account for the *real* offset parent, which can be the document or its root element 10465 // when a statically positioned element is identified 10466 doc = elem.ownerDocument; 10467 offsetParent = elem.offsetParent || doc.documentElement; 10468 while ( offsetParent && 10469 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 10470 jQuery.css( offsetParent, "position" ) === "static" ) { 10471 10472 offsetParent = offsetParent.parentNode; 10473 } 10474 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 10475 10476 // Incorporate borders into its offset, since they are outside its content origin 10477 parentOffset = jQuery( offsetParent ).offset(); 10478 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 10479 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 10480 } 10481 } 10482 10483 // Subtract parent offsets and element margins 10484 return { 10485 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10486 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10487 }; 10488 }, 10489 10490 // This method will return documentElement in the following cases: 10491 // 1) For the element inside the iframe without offsetParent, this method will return 10492 // documentElement of the parent window 10493 // 2) For the hidden or detached element 10494 // 3) For body or html element, i.e. in case of the html node - it will return itself 10495 // 10496 // but those exceptions were never presented as a real life use-cases 10497 // and might be considered as more preferable results. 10498 // 10499 // This logic, however, is not guaranteed and can change at any point in the future 10500 offsetParent: function() { 10501 return this.map( function() { 10502 var offsetParent = this.offsetParent; 10503 10504 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 10505 offsetParent = offsetParent.offsetParent; 10506 } 10507 10508 return offsetParent || documentElement; 10509 } ); 10510 } 10511} ); 10512 10513// Create scrollLeft and scrollTop methods 10514jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10515 var top = "pageYOffset" === prop; 10516 10517 jQuery.fn[ method ] = function( val ) { 10518 return access( this, function( elem, method, val ) { 10519 10520 // Coalesce documents and windows 10521 var win; 10522 if ( isWindow( elem ) ) { 10523 win = elem; 10524 } else if ( elem.nodeType === 9 ) { 10525 win = elem.defaultView; 10526 } 10527 10528 if ( val === undefined ) { 10529 return win ? win[ prop ] : elem[ method ]; 10530 } 10531 10532 if ( win ) { 10533 win.scrollTo( 10534 !top ? val : win.pageXOffset, 10535 top ? val : win.pageYOffset 10536 ); 10537 10538 } else { 10539 elem[ method ] = val; 10540 } 10541 }, method, val, arguments.length ); 10542 }; 10543} ); 10544 10545// Support: Safari <=7 - 9.1, Chrome <=37 - 49 10546// Add the top/left cssHooks using jQuery.fn.position 10547// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10548// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10549// getComputedStyle returns percent when specified for top/left/bottom/right; 10550// rather than make the css module depend on the offset module, just check for it here 10551jQuery.each( [ "top", "left" ], function( _i, prop ) { 10552 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10553 function( elem, computed ) { 10554 if ( computed ) { 10555 computed = curCSS( elem, prop ); 10556 10557 // If curCSS returns percentage, fallback to offset 10558 return rnumnonpx.test( computed ) ? 10559 jQuery( elem ).position()[ prop ] + "px" : 10560 computed; 10561 } 10562 } 10563 ); 10564} ); 10565 10566 10567// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10568jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10569 jQuery.each( { 10570 padding: "inner" + name, 10571 content: type, 10572 "": "outer" + name 10573 }, function( defaultExtra, funcName ) { 10574 10575 // Margin is only for outerHeight, outerWidth 10576 jQuery.fn[ funcName ] = function( margin, value ) { 10577 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10578 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10579 10580 return access( this, function( elem, type, value ) { 10581 var doc; 10582 10583 if ( isWindow( elem ) ) { 10584 10585 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10586 return funcName.indexOf( "outer" ) === 0 ? 10587 elem[ "inner" + name ] : 10588 elem.document.documentElement[ "client" + name ]; 10589 } 10590 10591 // Get document width or height 10592 if ( elem.nodeType === 9 ) { 10593 doc = elem.documentElement; 10594 10595 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10596 // whichever is greatest 10597 return Math.max( 10598 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10599 elem.body[ "offset" + name ], doc[ "offset" + name ], 10600 doc[ "client" + name ] 10601 ); 10602 } 10603 10604 return value === undefined ? 10605 10606 // Get width or height on the element, requesting but not forcing parseFloat 10607 jQuery.css( elem, type, extra ) : 10608 10609 // Set width or height on the element 10610 jQuery.style( elem, type, value, extra ); 10611 }, type, chainable ? margin : undefined, chainable ); 10612 }; 10613 } ); 10614} ); 10615 10616 10617jQuery.each( [ 10618 "ajaxStart", 10619 "ajaxStop", 10620 "ajaxComplete", 10621 "ajaxError", 10622 "ajaxSuccess", 10623 "ajaxSend" 10624], function( _i, type ) { 10625 jQuery.fn[ type ] = function( fn ) { 10626 return this.on( type, fn ); 10627 }; 10628} ); 10629 10630 10631 10632 10633jQuery.fn.extend( { 10634 10635 bind: function( types, data, fn ) { 10636 return this.on( types, null, data, fn ); 10637 }, 10638 unbind: function( types, fn ) { 10639 return this.off( types, null, fn ); 10640 }, 10641 10642 delegate: function( selector, types, data, fn ) { 10643 return this.on( types, selector, data, fn ); 10644 }, 10645 undelegate: function( selector, types, fn ) { 10646 10647 // ( namespace ) or ( selector, types [, fn] ) 10648 return arguments.length === 1 ? 10649 this.off( selector, "**" ) : 10650 this.off( types, selector || "**", fn ); 10651 }, 10652 10653 hover: function( fnOver, fnOut ) { 10654 return this 10655 .on( "mouseenter", fnOver ) 10656 .on( "mouseleave", fnOut || fnOver ); 10657 } 10658} ); 10659 10660jQuery.each( 10661 ( "blur focus focusin focusout resize scroll click dblclick " + 10662 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10663 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 10664 function( _i, name ) { 10665 10666 // Handle event binding 10667 jQuery.fn[ name ] = function( data, fn ) { 10668 return arguments.length > 0 ? 10669 this.on( name, null, data, fn ) : 10670 this.trigger( name ); 10671 }; 10672 } 10673); 10674 10675 10676 10677 10678// Support: Android <=4.0 only 10679// Make sure we trim BOM and NBSP 10680// Require that the "whitespace run" starts from a non-whitespace 10681// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 10682var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 10683 10684// Bind a function to a context, optionally partially applying any 10685// arguments. 10686// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10687// However, it is not slated for removal any time soon 10688jQuery.proxy = function( fn, context ) { 10689 var tmp, args, proxy; 10690 10691 if ( typeof context === "string" ) { 10692 tmp = fn[ context ]; 10693 context = fn; 10694 fn = tmp; 10695 } 10696 10697 // Quick check to determine if target is callable, in the spec 10698 // this throws a TypeError, but we will just return undefined. 10699 if ( !isFunction( fn ) ) { 10700 return undefined; 10701 } 10702 10703 // Simulated bind 10704 args = slice.call( arguments, 2 ); 10705 proxy = function() { 10706 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 10707 }; 10708 10709 // Set the guid of unique handler to the same of original handler, so it can be removed 10710 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10711 10712 return proxy; 10713}; 10714 10715jQuery.holdReady = function( hold ) { 10716 if ( hold ) { 10717 jQuery.readyWait++; 10718 } else { 10719 jQuery.ready( true ); 10720 } 10721}; 10722jQuery.isArray = Array.isArray; 10723jQuery.parseJSON = JSON.parse; 10724jQuery.nodeName = nodeName; 10725jQuery.isFunction = isFunction; 10726jQuery.isWindow = isWindow; 10727jQuery.camelCase = camelCase; 10728jQuery.type = toType; 10729 10730jQuery.now = Date.now; 10731 10732jQuery.isNumeric = function( obj ) { 10733 10734 // As of jQuery 3.0, isNumeric is limited to 10735 // strings and numbers (primitives or objects) 10736 // that can be coerced to finite numbers (gh-2662) 10737 var type = jQuery.type( obj ); 10738 return ( type === "number" || type === "string" ) && 10739 10740 // parseFloat NaNs numeric-cast false positives ("") 10741 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10742 // subtraction forces infinities to NaN 10743 !isNaN( obj - parseFloat( obj ) ); 10744}; 10745 10746jQuery.trim = function( text ) { 10747 return text == null ? 10748 "" : 10749 ( text + "" ).replace( rtrim, "$1" ); 10750}; 10751 10752 10753 10754// Register as a named AMD module, since jQuery can be concatenated with other 10755// files that may use define, but not via a proper concatenation script that 10756// understands anonymous AMD modules. A named AMD is safest and most robust 10757// way to register. Lowercase jquery is used because AMD module names are 10758// derived from file names, and jQuery is normally delivered in a lowercase 10759// file name. Do this after creating the global so that if an AMD module wants 10760// to call noConflict to hide this version of jQuery, it will work. 10761 10762// Note that for maximum portability, libraries that are not jQuery should 10763// declare themselves as anonymous modules, and avoid setting a global if an 10764// AMD loader is present. jQuery is a special case. For more information, see 10765// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10766 10767if ( true ) { 10768 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 10769 return jQuery; 10770 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 10771 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 10772} 10773 10774 10775 10776 10777var 10778 10779 // Map over jQuery in case of overwrite 10780 _jQuery = window.jQuery, 10781 10782 // Map over the $ in case of overwrite 10783 _$ = window.$; 10784 10785jQuery.noConflict = function( deep ) { 10786 if ( window.$ === jQuery ) { 10787 window.$ = _$; 10788 } 10789 10790 if ( deep && window.jQuery === jQuery ) { 10791 window.jQuery = _jQuery; 10792 } 10793 10794 return jQuery; 10795}; 10796 10797// Expose jQuery and $ identifiers, even in AMD 10798// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 10799// and CommonJS for browser emulators (trac-13566) 10800if ( typeof noGlobal === "undefined" ) { 10801 window.jQuery = window.$ = jQuery; 10802} 10803 10804 10805 10806 10807return jQuery; 10808} ); 10809 10810 10811/***/ }), 10812
vendor: 20,201 bytes, lines 10813-11636
10813/***/ "./node_modules/lazysizes/lazysizes.js": 10814/*!*********************************************!*\ 10815 !*** ./node_modules/lazysizes/lazysizes.js ***! 10816 \*********************************************/ 10817/***/ ((module) => { 10818 10819(function(window, factory) { 10820 var lazySizes = factory(window, window.document, Date); 10821 window.lazySizes = lazySizes; 10822 if( true && module.exports){ 10823 module.exports = lazySizes; 10824 } 10825}(typeof window != 'undefined' ? 10826 window : {}, 10827/** 10828 * import("./types/global") 10829 * @typedef { import("./types/lazysizes-config").LazySizesConfigPartial } LazySizesConfigPartial 10830 */ 10831function l(window, document, Date) { // Pass in the window Date function also for SSR because the Date class can be lost 10832 'use strict'; 10833 /*jshint eqnull:true */ 10834 10835 var lazysizes, 10836 /** 10837 * @type { LazySizesConfigPartial } 10838 */ 10839 lazySizesCfg; 10840 10841 (function(){ 10842 var prop; 10843 10844 var lazySizesDefaults = { 10845 lazyClass: 'lazyload', 10846 loadedClass: 'lazyloaded', 10847 loadingClass: 'lazyloading', 10848 preloadClass: 'lazypreload', 10849 errorClass: 'lazyerror', 10850 //strictClass: 'lazystrict', 10851 autosizesClass: 'lazyautosizes', 10852 fastLoadedClass: 'ls-is-cached', 10853 iframeLoadMode: 0, 10854 srcAttr: 'data-src', 10855 srcsetAttr: 'data-srcset', 10856 sizesAttr: 'data-sizes', 10857 //preloadAfterLoad: false, 10858 minSize: 40, 10859 customMedia: {}, 10860 init: true, 10861 expFactor: 1.5, 10862 hFac: 0.8, 10863 loadMode: 2, 10864 loadHidden: true, 10865 ricTimeout: 0, 10866 throttleDelay: 125, 10867 }; 10868 10869 lazySizesCfg = window.lazySizesConfig || window.lazysizesConfig || {}; 10870 10871 for(prop in lazySizesDefaults){ 10872 if(!(prop in lazySizesCfg)){ 10873 lazySizesCfg[prop] = lazySizesDefaults[prop]; 10874 } 10875 } 10876 })(); 10877 10878 if (!document || !document.getElementsByClassName) { 10879 return { 10880 init: function () {}, 10881 /** 10882 * @type { LazySizesConfigPartial } 10883 */ 10884 cfg: lazySizesCfg, 10885 /** 10886 * @type { true } 10887 */ 10888 noSupport: true, 10889 }; 10890 } 10891 10892 var docElem = document.documentElement; 10893 10894 var supportPicture = window.HTMLPictureElement; 10895 10896 var _addEventListener = 'addEventListener'; 10897 10898 var _getAttribute = 'getAttribute'; 10899 10900 /** 10901 * Update to bind to window because 'this' becomes null during SSR 10902 * builds. 10903 */ 10904 var addEventListener = window[_addEventListener].bind(window); 10905 10906 var setTimeout = window.setTimeout; 10907 10908 var requestAnimationFrame = window.requestAnimationFrame || setTimeout; 10909 10910 var requestIdleCallback = window.requestIdleCallback; 10911 10912 var regPicture = /^picture$/i; 10913 10914 var loadEvents = ['load', 'error', 'lazyincluded', '_lazyloaded']; 10915 10916 var regClassCache = {}; 10917 10918 var forEach = Array.prototype.forEach; 10919 10920 /** 10921 * @param ele {Element} 10922 * @param cls {string} 10923 */ 10924 var hasClass = function(ele, cls) { 10925 if(!regClassCache[cls]){ 10926 regClassCache[cls] = new RegExp('(\\s|^)'+cls+'(\\s|$)'); 10927 } 10928 return regClassCache[cls].test(ele[_getAttribute]('class') || '') && regClassCache[cls]; 10929 }; 10930 10931 /** 10932 * @param ele {Element} 10933 * @param cls {string} 10934 */ 10935 var addClass = function(ele, cls) { 10936 if (!hasClass(ele, cls)){ 10937 ele.setAttribute('class', (ele[_getAttribute]('class') || '').trim() + ' ' + cls); 10938 } 10939 }; 10940 10941 /** 10942 * @param ele {Element} 10943 * @param cls {string} 10944 */ 10945 var removeClass = function(ele, cls) { 10946 var reg; 10947 if ((reg = hasClass(ele,cls))) { 10948 ele.setAttribute('class', (ele[_getAttribute]('class') || '').replace(reg, ' ')); 10949 } 10950 }; 10951 10952 var addRemoveLoadEvents = function(dom, fn, add){ 10953 var action = add ? _addEventListener : 'removeEventListener'; 10954 if(add){ 10955 addRemoveLoadEvents(dom, fn); 10956 } 10957 loadEvents.forEach(function(evt){ 10958 dom[action](evt, fn); 10959 }); 10960 }; 10961 10962 /** 10963 * @param elem { Element } 10964 * @param name { string } 10965 * @param detail { any } 10966 * @param noBubbles { boolean } 10967 * @param noCancelable { boolean } 10968 * @returns { CustomEvent } 10969 */ 10970 var triggerEvent = function(elem, name, detail, noBubbles, noCancelable){ 10971 var event = document.createEvent('Event'); 10972 10973 if(!detail){ 10974 detail = {}; 10975 } 10976 10977 detail.instance = lazysizes; 10978 10979 event.initEvent(name, !noBubbles, !noCancelable); 10980 10981 event.detail = detail; 10982 10983 elem.dispatchEvent(event); 10984 return event; 10985 }; 10986 10987 var updatePolyfill = function (el, full){ 10988 var polyfill; 10989 if( !supportPicture && ( polyfill = (window.picturefill || lazySizesCfg.pf) ) ){ 10990 if(full && full.src && !el[_getAttribute]('srcset')){ 10991 el.setAttribute('srcset', full.src); 10992 } 10993 polyfill({reevaluate: true, elements: [el]}); 10994 } else if(full && full.src){ 10995 el.src = full.src; 10996 } 10997 }; 10998 10999 var getCSS = function (elem, style){ 11000 return (getComputedStyle(elem, null) || {})[style]; 11001 }; 11002 11003 /** 11004 * 11005 * @param elem { Element } 11006 * @param parent { Element } 11007 * @param [width] {number} 11008 * @returns {number} 11009 */ 11010 var getWidth = function(elem, parent, width){ 11011 width = width || elem.offsetWidth; 11012 11013 while(width < lazySizesCfg.minSize && parent && !elem._lazysizesWidth){ 11014 width = parent.offsetWidth; 11015 parent = parent.parentNode; 11016 } 11017 11018 return width; 11019 }; 11020 11021 var rAF = (function(){ 11022 var running, waiting; 11023 var firstFns = []; 11024 var secondFns = []; 11025 var fns = firstFns; 11026 11027 var run = function(){ 11028 var runFns = fns; 11029 11030 fns = firstFns.length ? secondFns : firstFns; 11031 11032 running = true; 11033 waiting = false; 11034 11035 while(runFns.length){ 11036 runFns.shift()(); 11037 } 11038 11039 running = false; 11040 }; 11041 11042 var rafBatch = function(fn, queue){ 11043 if(running && !queue){ 11044 fn.apply(this, arguments); 11045 } else { 11046 fns.push(fn); 11047 11048 if(!waiting){ 11049 waiting = true; 11050 (document.hidden ? setTimeout : requestAnimationFrame)(run); 11051 } 11052 } 11053 }; 11054 11055 rafBatch._lsFlush = run; 11056 11057 return rafBatch; 11058 })(); 11059 11060 var rAFIt = function(fn, simple){ 11061 return simple ? 11062 function() { 11063 rAF(fn); 11064 } : 11065 function(){ 11066 var that = this; 11067 var args = arguments; 11068 rAF(function(){ 11069 fn.apply(that, args); 11070 }); 11071 } 11072 ; 11073 }; 11074 11075 var throttle = function(fn){ 11076 var running; 11077 var lastTime = 0; 11078 var gDelay = lazySizesCfg.throttleDelay; 11079 var rICTimeout = lazySizesCfg.ricTimeout; 11080 var run = function(){ 11081 running = false; 11082 lastTime = Date.now(); 11083 fn(); 11084 }; 11085 var idleCallback = requestIdleCallback && rICTimeout > 49 ? 11086 function(){ 11087 requestIdleCallback(run, {timeout: rICTimeout}); 11088 11089 if(rICTimeout !== lazySizesCfg.ricTimeout){ 11090 rICTimeout = lazySizesCfg.ricTimeout; 11091 } 11092 } : 11093 rAFIt(function(){ 11094 setTimeout(run); 11095 }, true) 11096 ; 11097 11098 return function(isPriority){ 11099 var delay; 11100 11101 if((isPriority = isPriority === true)){ 11102 rICTimeout = 33; 11103 } 11104 11105 if(running){ 11106 return; 11107 } 11108 11109 running = true; 11110 11111 delay = gDelay - (Date.now() - lastTime); 11112 11113 if(delay < 0){ 11114 delay = 0; 11115 } 11116 11117 if(isPriority || delay < 9){ 11118 idleCallback(); 11119 } else { 11120 setTimeout(idleCallback, delay); 11121 } 11122 }; 11123 }; 11124 11125 //based on http://modernjavascript.blogspot.de/2013/08/building-better-debounce.html 11126 var debounce = function(func) { 11127 var timeout, timestamp; 11128 var wait = 99; 11129 var run = function(){ 11130 timeout = null; 11131 func(); 11132 }; 11133 var later = function() { 11134 var last = Date.now() - timestamp; 11135 11136 if (last < wait) { 11137 setTimeout(later, wait - last); 11138 } else { 11139 (requestIdleCallback || run)(run); 11140 } 11141 }; 11142 11143 return function() { 11144 timestamp = Date.now(); 11145 11146 if (!timeout) { 11147 timeout = setTimeout(later, wait); 11148 } 11149 }; 11150 }; 11151 11152 var loader = (function(){ 11153 var preloadElems, isCompleted, resetPreloadingTimer, loadMode, started; 11154 11155 var eLvW, elvH, eLtop, eLleft, eLright, eLbottom, isBodyHidden; 11156 11157 var regImg = /^img$/i; 11158 var regIframe = /^iframe$/i; 11159 11160 var supportScroll = ('onscroll' in window) && !(/(gle|ing)bot/.test(navigator.userAgent)); 11161 11162 var shrinkExpand = 0; 11163 var currentExpand = 0; 11164 11165 var isLoading = 0; 11166 var lowRuns = -1; 11167 11168 var resetPreloading = function(e){ 11169 isLoading--; 11170 if(!e || isLoading < 0 || !e.target){ 11171 isLoading = 0; 11172 } 11173 }; 11174 11175 var isVisible = function (elem) { 11176 if (isBodyHidden == null) { 11177 isBodyHidden = getCSS(document.body, 'visibility') == 'hidden'; 11178 } 11179 11180 return isBodyHidden || !(getCSS(elem.parentNode, 'visibility') == 'hidden' && getCSS(elem, 'visibility') == 'hidden'); 11181 }; 11182 11183 var isNestedVisible = function(elem, elemExpand){ 11184 var outerRect; 11185 var parent = elem; 11186 var visible = isVisible(elem); 11187 11188 eLtop -= elemExpand; 11189 eLbottom += elemExpand; 11190 eLleft -= elemExpand; 11191 eLright += elemExpand; 11192 11193 while(visible && (parent = parent.offsetParent) && parent != document.body && parent != docElem){ 11194 visible = ((getCSS(parent, 'opacity') || 1) > 0); 11195 11196 if(visible && getCSS(parent, 'overflow') != 'visible'){ 11197 outerRect = parent.getBoundingClientRect(); 11198 visible = eLright > outerRect.left && 11199 eLleft < outerRect.right && 11200 eLbottom > outerRect.top - 1 && 11201 eLtop < outerRect.bottom + 1 11202 ; 11203 } 11204 } 11205 11206 return visible; 11207 }; 11208 11209 var checkElements = function() { 11210 var eLlen, i, rect, autoLoadElem, loadedSomething, elemExpand, elemNegativeExpand, elemExpandVal, 11211 beforeExpandVal, defaultExpand, preloadExpand, hFac; 11212 var lazyloadElems = lazysizes.elements; 11213 11214 if((loadMode = lazySizesCfg.loadMode) && isLoading < 8 && (eLlen = lazyloadElems.length)){ 11215 11216 i = 0; 11217 11218 lowRuns++; 11219 11220 for(; i < eLlen; i++){ 11221 11222 if(!lazyloadElems[i] || lazyloadElems[i]._lazyRace){continue;} 11223 11224 if(!supportScroll || (lazysizes.prematureUnveil && lazysizes.prematureUnveil(lazyloadElems[i]))){unveilElement(lazyloadElems[i]);continue;} 11225 11226 if(!(elemExpandVal = lazyloadElems[i][_getAttribute]('data-expand')) || !(elemExpand = elemExpandVal * 1)){ 11227 elemExpand = currentExpand; 11228 } 11229 11230 if (!defaultExpand) { 11231 defaultExpand = (!lazySizesCfg.expand || lazySizesCfg.expand < 1) ? 11232 docElem.clientHeight > 500 && docElem.clientWidth > 500 ? 500 : 370 : 11233 lazySizesCfg.expand; 11234 11235 lazysizes._defEx = defaultExpand; 11236 11237 preloadExpand = defaultExpand * lazySizesCfg.expFactor; 11238 hFac = lazySizesCfg.hFac; 11239 isBodyHidden = null; 11240 11241 if(currentExpand < preloadExpand && isLoading < 1 && lowRuns > 2 && loadMode > 2 && !document.hidden){ 11242 currentExpand = preloadExpand; 11243 lowRuns = 0; 11244 } else if(loadMode > 1 && lowRuns > 1 && isLoading < 6){ 11245 currentExpand = defaultExpand; 11246 } else { 11247 currentExpand = shrinkExpand; 11248 } 11249 } 11250 11251 if(beforeExpandVal !== elemExpand){ 11252 eLvW = innerWidth + (elemExpand * hFac); 11253 elvH = innerHeight + elemExpand; 11254 elemNegativeExpand = elemExpand * -1; 11255 beforeExpandVal = elemExpand; 11256 } 11257 11258 rect = lazyloadElems[i].getBoundingClientRect(); 11259 11260 if ((eLbottom = rect.bottom) >= elemNegativeExpand && 11261 (eLtop = rect.top) <= elvH && 11262 (eLright = rect.right) >= elemNegativeExpand * hFac && 11263 (eLleft = rect.left) <= eLvW && 11264 (eLbottom || eLright || eLleft || eLtop) && 11265 (lazySizesCfg.loadHidden || isVisible(lazyloadElems[i])) && 11266 ((isCompleted && isLoading < 3 && !elemExpandVal && (loadMode < 3 || lowRuns < 4)) || isNestedVisible(lazyloadElems[i], elemExpand))){ 11267 unveilElement(lazyloadElems[i]); 11268 loadedSomething = true; 11269 if(isLoading > 9){break;} 11270 } else if(!loadedSomething && isCompleted && !autoLoadElem && 11271 isLoading < 4 && lowRuns < 4 && loadMode > 2 && 11272 (preloadElems[0] || lazySizesCfg.preloadAfterLoad) && 11273 (preloadElems[0] || (!elemExpandVal && ((eLbottom || eLright || eLleft || eLtop) || lazyloadElems[i][_getAttribute](lazySizesCfg.sizesAttr) != 'auto')))){ 11274 autoLoadElem = preloadElems[0] || lazyloadElems[i]; 11275 } 11276 } 11277 11278 if(autoLoadElem && !loadedSomething){ 11279 unveilElement(autoLoadElem); 11280 } 11281 } 11282 }; 11283 11284 var throttledCheckElements = throttle(checkElements); 11285 11286 var switchLoadingClass = function(e){ 11287 var elem = e.target; 11288 11289 if (elem._lazyCache) { 11290 delete elem._lazyCache; 11291 return; 11292 } 11293 11294 resetPreloading(e); 11295 addClass(elem, lazySizesCfg.loadedClass); 11296 removeClass(elem, lazySizesCfg.loadingClass); 11297 addRemoveLoadEvents(elem, rafSwitchLoadingClass); 11298 triggerEvent(elem, 'lazyloaded'); 11299 }; 11300 var rafedSwitchLoadingClass = rAFIt(switchLoadingClass); 11301 var rafSwitchLoadingClass = function(e){ 11302 rafedSwitchLoadingClass({target: e.target}); 11303 }; 11304 11305 var changeIframeSrc = function(elem, src){ 11306 var loadMode = elem.getAttribute('data-load-mode') || lazySizesCfg.iframeLoadMode; 11307 11308 // loadMode can be also a string! 11309 if (loadMode == 0) { 11310 elem.contentWindow.location.replace(src); 11311 } else if (loadMode == 1) { 11312 elem.src = src; 11313 } 11314 }; 11315 11316 var handleSources = function(source){ 11317 var customMedia; 11318 11319 var sourceSrcset = source[_getAttribute](lazySizesCfg.srcsetAttr); 11320 11321 if( (customMedia = lazySizesCfg.customMedia[source[_getAttribute]('data-media') || source[_getAttribute]('media')]) ){ 11322 source.setAttribute('media', customMedia); 11323 } 11324 11325 if(sourceSrcset){ 11326 source.setAttribute('srcset', sourceSrcset); 11327 } 11328 }; 11329 11330 var lazyUnveil = rAFIt(function (elem, detail, isAuto, sizes, isImg){ 11331 var src, srcset, parent, isPicture, event, firesLoad; 11332 11333 if(!(event = triggerEvent(elem, 'lazybeforeunveil', detail)).defaultPrevented){ 11334 11335 if(sizes){ 11336 if(isAuto){ 11337 addClass(elem, lazySizesCfg.autosizesClass); 11338 } else { 11339 elem.setAttribute('sizes', sizes); 11340 } 11341 } 11342 11343 srcset = elem[_getAttribute](lazySizesCfg.srcsetAttr); 11344 src = elem[_getAttribute](lazySizesCfg.srcAttr); 11345 11346 if(isImg) { 11347 parent = elem.parentNode; 11348 isPicture = parent && regPicture.test(parent.nodeName || ''); 11349 } 11350 11351 firesLoad = detail.firesLoad || (('src' in elem) && (srcset || src || isPicture)); 11352 11353 event = {target: elem}; 11354 11355 addClass(elem, lazySizesCfg.loadingClass); 11356 11357 if(firesLoad){ 11358 clearTimeout(resetPreloadingTimer); 11359 resetPreloadingTimer = setTimeout(resetPreloading, 2500); 11360 addRemoveLoadEvents(elem, rafSwitchLoadingClass, true); 11361 } 11362 11363 if(isPicture){ 11364 forEach.call(parent.getElementsByTagName('source'), handleSources); 11365 } 11366 11367 if(srcset){ 11368 elem.setAttribute('srcset', srcset); 11369 } else if(src && !isPicture){ 11370 if(regIframe.test(elem.nodeName)){ 11371 changeIframeSrc(elem, src); 11372 } else { 11373 elem.src = src; 11374 } 11375 } 11376 11377 if(isImg && (srcset || isPicture)){ 11378 updatePolyfill(elem, {src: src}); 11379 } 11380 } 11381 11382 if(elem._lazyRace){ 11383 delete elem._lazyRace; 11384 } 11385 removeClass(elem, lazySizesCfg.lazyClass); 11386 11387 rAF(function(){ 11388 // Part of this can be removed as soon as this fix is older: https://bugs.chromium.org/p/chromium/issues/detail?id=7731 (2015) 11389 var isLoaded = elem.complete && elem.naturalWidth > 1; 11390 11391 if( !firesLoad || isLoaded){ 11392 if (isLoaded) { 11393 addClass(elem, lazySizesCfg.fastLoadedClass); 11394 } 11395 switchLoadingClass(event); 11396 elem._lazyCache = true; 11397 setTimeout(function(){ 11398 if ('_lazyCache' in elem) { 11399 delete elem._lazyCache; 11400 } 11401 }, 9); 11402 } 11403 if (elem.loading == 'lazy') { 11404 isLoading--; 11405 } 11406 }, true); 11407 }); 11408 11409 /** 11410 * 11411 * @param elem { Element } 11412 */ 11413 var unveilElement = function (elem){ 11414 if (elem._lazyRace) {return;} 11415 var detail; 11416 11417 var isImg = regImg.test(elem.nodeName); 11418 11419 //allow using sizes="auto", but don't use. it's invalid. Use data-sizes="auto" or a valid value for sizes instead (i.e.: sizes="80vw") 11420 var sizes = isImg && (elem[_getAttribute](lazySizesCfg.sizesAttr) || elem[_getAttribute]('sizes')); 11421 var isAuto = sizes == 'auto'; 11422 11423 if( (isAuto || !isCompleted) && isImg && (elem[_getAttribute]('src') || elem.srcset) && !elem.complete && !hasClass(elem, lazySizesCfg.errorClass) && hasClass(elem, lazySizesCfg.lazyClass)){return;} 11424 11425 detail = triggerEvent(elem, 'lazyunveilread').detail; 11426 11427 if(isAuto){ 11428 autoSizer.updateElem(elem, true, elem.offsetWidth); 11429 } 11430 11431 elem._lazyRace = true; 11432 isLoading++; 11433 11434 lazyUnveil(elem, detail, isAuto, sizes, isImg); 11435 }; 11436 11437 var afterScroll = debounce(function(){ 11438 lazySizesCfg.loadMode = 3; 11439 throttledCheckElements(); 11440 }); 11441 11442 var altLoadmodeScrollListner = function(){ 11443 if(lazySizesCfg.loadMode == 3){ 11444 lazySizesCfg.loadMode = 2; 11445 } 11446 afterScroll(); 11447 }; 11448 11449 var onload = function(){ 11450 if(isCompleted){return;} 11451 if(Date.now() - started < 999){ 11452 setTimeout(onload, 999); 11453 return; 11454 } 11455 11456 11457 isCompleted = true; 11458 11459 lazySizesCfg.loadMode = 3; 11460 11461 throttledCheckElements(); 11462 11463 addEventListener('scroll', altLoadmodeScrollListner, true); 11464 }; 11465 11466 return { 11467 _: function(){ 11468 started = Date.now(); 11469 11470 lazysizes.elements = document.getElementsByClassName(lazySizesCfg.lazyClass); 11471 preloadElems = document.getElementsByClassName(lazySizesCfg.lazyClass + ' ' + lazySizesCfg.preloadClass); 11472 11473 addEventListener('scroll', throttledCheckElements, true); 11474 11475 addEventListener('resize', throttledCheckElements, true); 11476 11477 addEventListener('pageshow', function (e) { 11478 if (e.persisted) { 11479 var loadingElements = document.querySelectorAll('.' + lazySizesCfg.loadingClass); 11480 11481 if (loadingElements.length && loadingElements.forEach) { 11482 requestAnimationFrame(function () { 11483 loadingElements.forEach( function (img) { 11484 if (img.complete) { 11485 unveilElement(img); 11486 } 11487 }); 11488 }); 11489 } 11490 } 11491 }); 11492 11493 if(window.MutationObserver){ 11494 new MutationObserver( throttledCheckElements ).observe( docElem, {childList: true, subtree: true, attributes: true} ); 11495 } else { 11496 docElem[_addEventListener]('DOMNodeInserted', throttledCheckElements, true); 11497 docElem[_addEventListener]('DOMAttrModified', throttledCheckElements, true); 11498 setInterval(throttledCheckElements, 999); 11499 } 11500 11501 addEventListener('hashchange', throttledCheckElements, true); 11502 11503 //, 'fullscreenchange' 11504 ['focus', 'mouseover', 'click', 'load', 'transitionend', 'animationend'].forEach(function(name){ 11505 document[_addEventListener](name, throttledCheckElements, true); 11506 }); 11507 11508 if((/d$|^c/.test(document.readyState))){ 11509 onload(); 11510 } else { 11511 addEventListener('load', onload); 11512 document[_addEventListener]('DOMContentLoaded', throttledCheckElements); 11513 setTimeout(onload, 20000); 11514 } 11515 11516 if(lazysizes.elements.length){ 11517 checkElements(); 11518 rAF._lsFlush(); 11519 } else { 11520 throttledCheckElements(); 11521 } 11522 }, 11523 checkElems: throttledCheckElements, 11524 unveil: unveilElement, 11525 _aLSL: altLoadmodeScrollListner, 11526 }; 11527 })(); 11528 11529 11530 var autoSizer = (function(){ 11531 var autosizesElems; 11532 11533 var sizeElement = rAFIt(function(elem, parent, event, width){ 11534 var sources, i, len; 11535 elem._lazysizesWidth = width; 11536 width += 'px'; 11537 11538 elem.setAttribute('sizes', width); 11539 11540 if(regPicture.test(parent.nodeName || '')){ 11541 sources = parent.getElementsByTagName('source'); 11542 for(i = 0, len = sources.length; i < len; i++){ 11543 sources[i].setAttribute('sizes', width); 11544 } 11545 } 11546 11547 if(!event.detail.dataAttr){ 11548 updatePolyfill(elem, event.detail); 11549 } 11550 }); 11551 /** 11552 * 11553 * @param elem {Element} 11554 * @param dataAttr 11555 * @param [width] { number } 11556 */ 11557 var getSizeElement = function (elem, dataAttr, width){ 11558 var event; 11559 var parent = elem.parentNode; 11560 11561 if(parent){ 11562 width = getWidth(elem, parent, width); 11563 event = triggerEvent(elem, 'lazybeforesizes', {width: width, dataAttr: !!dataAttr}); 11564 11565 if(!event.defaultPrevented){ 11566 width = event.detail.width; 11567 11568 if(width && width !== elem._lazysizesWidth){ 11569 sizeElement(elem, parent, event, width); 11570 } 11571 } 11572 } 11573 }; 11574 11575 var updateElementsSizes = function(){ 11576 var i; 11577 var len = autosizesElems.length; 11578 if(len){ 11579 i = 0; 11580 11581 for(; i < len; i++){ 11582 getSizeElement(autosizesElems[i]); 11583 } 11584 } 11585 }; 11586 11587 var debouncedUpdateElementsSizes = debounce(updateElementsSizes); 11588 11589 return { 11590 _: function(){ 11591 autosizesElems = document.getElementsByClassName(lazySizesCfg.autosizesClass); 11592 addEventListener('resize', debouncedUpdateElementsSizes); 11593 }, 11594 checkElems: debouncedUpdateElementsSizes, 11595 updateElem: getSizeElement 11596 }; 11597 })(); 11598 11599 var init = function(){ 11600 if(!init.i && document.getElementsByClassName){ 11601 init.i = true; 11602 autoSizer._(); 11603 loader._(); 11604 } 11605 }; 11606 11607 setTimeout(function(){ 11608 if(lazySizesCfg.init){ 11609 init(); 11610 } 11611 }); 11612 11613 lazysizes = { 11614 /** 11615 * @type { LazySizesConfigPartial } 11616 */ 11617 cfg: lazySizesCfg, 11618 autoSizer: autoSizer, 11619 loader: loader, 11620 init: init, 11621 uP: updatePolyfill, 11622 aC: addClass, 11623 rC: removeClass, 11624 hC: hasClass, 11625 fire: triggerEvent, 11626 gW: getWidth, 11627 rAF: rAF, 11628 }; 11629 11630 return lazysizes; 11631} 11632)); 11633 11634 11635/***/ }), 11636
vendor: 5,457 bytes, lines 11637-11819
11637/***/ "./node_modules/lazysizes/plugins/parent-fit/ls.parent-fit.js": 11638/*!********************************************************************!*\ 11639 !*** ./node_modules/lazysizes/plugins/parent-fit/ls.parent-fit.js ***! 11640 \********************************************************************/ 11641/***/ ((module, exports, __webpack_require__) => { 11642 11643var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function(window, factory) { 11644 if(!window) {return;} 11645 var globalInstall = function(){ 11646 factory(window.lazySizes); 11647 window.removeEventListener('lazyunveilread', globalInstall, true); 11648 }; 11649 11650 factory = factory.bind(null, window, window.document); 11651 11652 if( true && module.exports){ 11653 factory(__webpack_require__(/*! lazysizes */ "./node_modules/lazysizes/lazysizes.js")); 11654 } else if (true) { 11655 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! lazysizes */ "./node_modules/lazysizes/lazysizes.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 11656 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 11657 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 11658 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 11659 } else {} 11660}(typeof window != 'undefined' ? 11661 window : 0, function(window, document, lazySizes) { 11662 'use strict'; 11663 11664 if(!window.addEventListener){return;} 11665 11666 var regDescriptors = /\s+(\d+)(w|h)\s+(\d+)(w|h)/; 11667 var regCssFit = /parent-fit["']*\s*:\s*["']*(contain|cover|width)/; 11668 var regCssObject = /parent-container["']*\s*:\s*["']*(.+?)(?=(\s|$|,|'|"|;))/; 11669 var regPicture = /^picture$/i; 11670 var cfg = lazySizes.cfg; 11671 11672 var getCSS = function (elem){ 11673 return (getComputedStyle(elem, null) || {}); 11674 }; 11675 11676 var parentFit = { 11677 11678 getParent: function(element, parentSel){ 11679 var parent = element; 11680 var parentNode = element.parentNode; 11681 11682 if((!parentSel || parentSel == 'prev') && parentNode && regPicture.test(parentNode.nodeName || '')){ 11683 parentNode = parentNode.parentNode; 11684 } 11685 11686 if(parentSel != 'self'){ 11687 if(parentSel == 'prev'){ 11688 parent = element.previousElementSibling; 11689 } else if(parentSel && (parentNode.closest || window.jQuery)){ 11690 parent = (parentNode.closest ? 11691 parentNode.closest(parentSel) : 11692 jQuery(parentNode).closest(parentSel)[0]) || 11693 parentNode 11694 ; 11695 } else { 11696 parent = parentNode; 11697 } 11698 } 11699 11700 return parent; 11701 }, 11702 11703 getFit: function(element){ 11704 var tmpMatch, parentObj; 11705 var css = getCSS(element); 11706 var content = css.content || css.fontFamily; 11707 var obj = { 11708 fit: element._lazysizesParentFit || element.getAttribute('data-parent-fit') 11709 }; 11710 11711 if(!obj.fit && content && (tmpMatch = content.match(regCssFit))){ 11712 obj.fit = tmpMatch[1]; 11713 } 11714 11715 if(obj.fit){ 11716 parentObj = element._lazysizesParentContainer || element.getAttribute('data-parent-container'); 11717 11718 if(!parentObj && content && (tmpMatch = content.match(regCssObject))){ 11719 parentObj = tmpMatch[1]; 11720 } 11721 11722 obj.parent = parentFit.getParent(element, parentObj); 11723 11724 11725 } else { 11726 obj.fit = css.objectFit; 11727 } 11728 11729 return obj; 11730 }, 11731 11732 getImageRatio: function(element){ 11733 var i, srcset, media, ratio, match, width, height; 11734 var parent = element.parentNode; 11735 var elements = parent && regPicture.test(parent.nodeName || '') ? 11736 parent.querySelectorAll('source, img') : 11737 [element] 11738 ; 11739 11740 for(i = 0; i < elements.length; i++){ 11741 element = elements[i]; 11742 srcset = element.getAttribute(cfg.srcsetAttr) || element.getAttribute('srcset') || element.getAttribute('data-pfsrcset') || element.getAttribute('data-risrcset') || ''; 11743 media = element._lsMedia || element.getAttribute('media'); 11744 media = cfg.customMedia[element.getAttribute('data-media') || media] || media; 11745 11746 if(srcset && (!media || (window.matchMedia && matchMedia(media) || {}).matches )){ 11747 ratio = parseFloat(element.getAttribute('data-aspectratio')); 11748 11749 if (!ratio) { 11750 match = srcset.match(regDescriptors); 11751 11752 if (match) { 11753 if(match[2] == 'w'){ 11754 width = match[1]; 11755 height = match[3]; 11756 } else { 11757 width = match[3]; 11758 height = match[1]; 11759 } 11760 } else { 11761 width = element.getAttribute('width'); 11762 height = element.getAttribute('height'); 11763 } 11764 11765 ratio = width / height; 11766 } 11767 11768 break; 11769 } 11770 } 11771 11772 return ratio; 11773 }, 11774 11775 calculateSize: function(element, width){ 11776 var displayRatio, height, imageRatio, retWidth; 11777 var fitObj = this.getFit(element); 11778 var fit = fitObj.fit; 11779 var fitElem = fitObj.parent; 11780 11781 if(fit != 'width' && ((fit != 'contain' && fit != 'cover') || !(imageRatio = this.getImageRatio(element)))){ 11782 return width; 11783 } 11784 11785 if(fitElem){ 11786 width = fitElem.clientWidth; 11787 } else { 11788 fitElem = element; 11789 } 11790 11791 retWidth = width; 11792 11793 if(fit == 'width'){ 11794 retWidth = width; 11795 } else { 11796 height = fitElem.clientHeight; 11797 11798 if((displayRatio = width / height) && ((fit == 'cover' && displayRatio < imageRatio) || (fit == 'contain' && displayRatio > imageRatio))){ 11799 retWidth = width * (imageRatio / displayRatio); 11800 } 11801 } 11802 11803 return retWidth; 11804 } 11805 }; 11806 11807 lazySizes.parentFit = parentFit; 11808 11809 document.addEventListener('lazybeforesizes', function(e){ 11810 if(e.defaultPrevented || e.detail.instance != lazySizes){return;} 11811 11812 var element = e.target; 11813 e.detail.width = parentFit.calculateSize(element, e.detail.width); 11814 }); 11815})); 11816 11817 11818/***/ }), 11819
11820/***/ "./resources/scss/main.scss": 11821/*!**********************************!*\ 11822 !*** ./resources/scss/main.scss ***! 11823 \**********************************/ 11824/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11825 11826"use strict"; 11827__webpack_require__.r(__webpack_exports__); 11828// extracted by mini-css-extract-plugin 11829 11830 11831/***/ }), 11832
11833/***/ "./resources/scss/secondary.scss": 11834/*!***************************************!*\ 11835 !*** ./resources/scss/secondary.scss ***! 11836 \***************************************/ 11837/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11838 11839"use strict"; 11840__webpack_require__.r(__webpack_exports__); 11841// extracted by mini-css-extract-plugin 11842 11843 11844/***/ }), 11845
vendor: 90,264 bytes, lines 11846-15303
11846/***/ "./node_modules/owl.carousel/dist/owl.carousel.js": 11847/*!********************************************************!*\ 11848 !*** ./node_modules/owl.carousel/dist/owl.carousel.js ***! 11849 \********************************************************/ 11850/***/ (() => { 11851 11852/** 11853 * Owl Carousel v2.3.4 11854 * Copyright 2013-2018 David Deutsch 11855 * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE 11856 */ 11857/** 11858 * Owl carousel 11859 * @version 2.3.4 11860 * @author Bartosz Wojciechowski 11861 * @author David Deutsch 11862 * @license The MIT License (MIT) 11863 * @todo Lazy Load Icon 11864 * @todo prevent animationend bubling 11865 * @todo itemsScaleUp 11866 * @todo Test Zepto 11867 * @todo stagePadding calculate wrong active classes 11868 */ 11869;(function($, window, document, undefined) { 11870 11871 /** 11872 * Creates a carousel. 11873 * @class The Owl Carousel. 11874 * @public 11875 * @param {HTMLElement|jQuery} element - The element to create the carousel for. 11876 * @param {Object} [options] - The options 11877 */ 11878 function Owl(element, options) { 11879 11880 /** 11881 * Current settings for the carousel. 11882 * @public 11883 */ 11884 this.settings = null; 11885 11886 /** 11887 * Current options set by the caller including defaults. 11888 * @public 11889 */ 11890 this.options = $.extend({}, Owl.Defaults, options); 11891 11892 /** 11893 * Plugin element. 11894 * @public 11895 */ 11896 this.$element = $(element); 11897 11898 /** 11899 * Proxied event handlers. 11900 * @protected 11901 */ 11902 this._handlers = {}; 11903 11904 /** 11905 * References to the running plugins of this carousel. 11906 * @protected 11907 */ 11908 this._plugins = {}; 11909 11910 /** 11911 * Currently suppressed events to prevent them from being retriggered. 11912 * @protected 11913 */ 11914 this._supress = {}; 11915 11916 /** 11917 * Absolute current position. 11918 * @protected 11919 */ 11920 this._current = null; 11921 11922 /** 11923 * Animation speed in milliseconds. 11924 * @protected 11925 */ 11926 this._speed = null; 11927 11928 /** 11929 * Coordinates of all items in pixel. 11930 * @todo The name of this member is missleading. 11931 * @protected 11932 */ 11933 this._coordinates = []; 11934 11935 /** 11936 * Current breakpoint. 11937 * @todo Real media queries would be nice. 11938 * @protected 11939 */ 11940 this._breakpoint = null; 11941 11942 /** 11943 * Current width of the plugin element. 11944 */ 11945 this._width = null; 11946 11947 /** 11948 * All real items. 11949 * @protected 11950 */ 11951 this._items = []; 11952 11953 /** 11954 * All cloned items. 11955 * @protected 11956 */ 11957 this._clones = []; 11958 11959 /** 11960 * Merge values of all items. 11961 * @todo Maybe this could be part of a plugin. 11962 * @protected 11963 */ 11964 this._mergers = []; 11965 11966 /** 11967 * Widths of all items. 11968 */ 11969 this._widths = []; 11970 11971 /** 11972 * Invalidated parts within the update process. 11973 * @protected 11974 */ 11975 this._invalidated = {}; 11976 11977 /** 11978 * Ordered list of workers for the update process. 11979 * @protected 11980 */ 11981 this._pipe = []; 11982 11983 /** 11984 * Current state information for the drag operation. 11985 * @todo #261 11986 * @protected 11987 */ 11988 this._drag = { 11989 time: null, 11990 target: null, 11991 pointer: null, 11992 stage: { 11993 start: null, 11994 current: null 11995 }, 11996 direction: null 11997 }; 11998 11999 /** 12000 * Current state information and their tags. 12001 * @type {Object} 12002 * @protected 12003 */ 12004 this._states = { 12005 current: {}, 12006 tags: { 12007 'initializing': [ 'busy' ], 12008 'animating': [ 'busy' ], 12009 'dragging': [ 'interacting' ] 12010 } 12011 }; 12012 12013 $.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler) { 12014 this._handlers[handler] = $.proxy(this[handler], this); 12015 }, this)); 12016 12017 $.each(Owl.Plugins, $.proxy(function(key, plugin) { 12018 this._plugins[key.charAt(0).toLowerCase() + key.slice(1)] 12019 = new plugin(this); 12020 }, this)); 12021 12022 $.each(Owl.Workers, $.proxy(function(priority, worker) { 12023 this._pipe.push({ 12024 'filter': worker.filter, 12025 'run': $.proxy(worker.run, this) 12026 }); 12027 }, this)); 12028 12029 this.setup(); 12030 this.initialize(); 12031 } 12032 12033 /** 12034 * Default options for the carousel. 12035 * @public 12036 */ 12037 Owl.Defaults = { 12038 items: 3, 12039 loop: false, 12040 center: false, 12041 rewind: false, 12042 checkVisibility: true, 12043 12044 mouseDrag: true, 12045 touchDrag: true, 12046 pullDrag: true, 12047 freeDrag: false, 12048 12049 margin: 0, 12050 stagePadding: 0, 12051 12052 merge: false, 12053 mergeFit: true, 12054 autoWidth: false, 12055 12056 startPosition: 0, 12057 rtl: false, 12058 12059 smartSpeed: 250, 12060 fluidSpeed: false, 12061 dragEndSpeed: false, 12062 12063 responsive: {}, 12064 responsiveRefreshRate: 200, 12065 responsiveBaseElement: window, 12066 12067 fallbackEasing: 'swing', 12068 slideTransition: '', 12069 12070 info: false, 12071 12072 nestedItemSelector: false, 12073 itemElement: 'div', 12074 stageElement: 'div', 12075 12076 refreshClass: 'owl-refresh', 12077 loadedClass: 'owl-loaded', 12078 loadingClass: 'owl-loading', 12079 rtlClass: 'owl-rtl', 12080 responsiveClass: 'owl-responsive', 12081 dragClass: 'owl-drag', 12082 itemClass: 'owl-item', 12083 stageClass: 'owl-stage', 12084 stageOuterClass: 'owl-stage-outer', 12085 grabClass: 'owl-grab' 12086 }; 12087 12088 /** 12089 * Enumeration for width. 12090 * @public 12091 * @readonly 12092 * @enum {String} 12093 */ 12094 Owl.Width = { 12095 Default: 'default', 12096 Inner: 'inner', 12097 Outer: 'outer' 12098 }; 12099 12100 /** 12101 * Enumeration for types. 12102 * @public 12103 * @readonly 12104 * @enum {String} 12105 */ 12106 Owl.Type = { 12107 Event: 'event', 12108 State: 'state' 12109 }; 12110 12111 /** 12112 * Contains all registered plugins. 12113 * @public 12114 */ 12115 Owl.Plugins = {}; 12116 12117 /** 12118 * List of workers involved in the update process. 12119 */ 12120 Owl.Workers = [ { 12121 filter: [ 'width', 'settings' ], 12122 run: function() { 12123 this._width = this.$element.width(); 12124 } 12125 }, { 12126 filter: [ 'width', 'items', 'settings' ], 12127 run: function(cache) { 12128 cache.current = this._items && this._items[this.relative(this._current)]; 12129 } 12130 }, { 12131 filter: [ 'items', 'settings' ], 12132 run: function() { 12133 this.$stage.children('.cloned').remove(); 12134 } 12135 }, { 12136 filter: [ 'width', 'items', 'settings' ], 12137 run: function(cache) { 12138 var margin = this.settings.margin || '', 12139 grid = !this.settings.autoWidth, 12140 rtl = this.settings.rtl, 12141 css = { 12142 'width': 'auto', 12143 'margin-left': rtl ? margin : '', 12144 'margin-right': rtl ? '' : margin 12145 }; 12146 12147 !grid && this.$stage.children().css(css); 12148 12149 cache.css = css; 12150 } 12151 }, { 12152 filter: [ 'width', 'items', 'settings' ], 12153 run: function(cache) { 12154 var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin, 12155 merge = null, 12156 iterator = this._items.length, 12157 grid = !this.settings.autoWidth, 12158 widths = []; 12159 12160 cache.items = { 12161 merge: false, 12162 width: width 12163 }; 12164 12165 while (iterator--) { 12166 merge = this._mergers[iterator]; 12167 merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge; 12168 12169 cache.items.merge = merge > 1 || cache.items.merge; 12170 12171 widths[iterator] = !grid ? this._items[iterator].width() : width * merge; 12172 } 12173 12174 this._widths = widths; 12175 } 12176 }, { 12177 filter: [ 'items', 'settings' ], 12178 run: function() { 12179 var clones = [], 12180 items = this._items, 12181 settings = this.settings, 12182 // TODO: Should be computed from number of min width items in stage 12183 view = Math.max(settings.items * 2, 4), 12184 size = Math.ceil(items.length / 2) * 2, 12185 repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0, 12186 append = '', 12187 prepend = ''; 12188 12189 repeat /= 2; 12190 12191 while (repeat > 0) { 12192 // Switch to only using appended clones 12193 clones.push(this.normalize(clones.length / 2, true)); 12194 append = append + items[clones[clones.length - 1]][0].outerHTML; 12195 clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true)); 12196 prepend = items[clones[clones.length - 1]][0].outerHTML + prepend; 12197 repeat -= 1; 12198 } 12199 12200 this._clones = clones; 12201 12202 $(append).addClass('cloned').appendTo(this.$stage); 12203 $(prepend).addClass('cloned').prependTo(this.$stage); 12204 } 12205 }, { 12206 filter: [ 'width', 'items', 'settings' ], 12207 run: function() { 12208 var rtl = this.settings.rtl ? 1 : -1, 12209 size = this._clones.length + this._items.length, 12210 iterator = -1, 12211 previous = 0, 12212 current = 0, 12213 coordinates = []; 12214 12215 while (++iterator < size) { 12216 previous = coordinates[iterator - 1] || 0; 12217 current = this._widths[this.relative(iterator)] + this.settings.margin; 12218 coordinates.push(previous + current * rtl); 12219 } 12220 12221 this._coordinates = coordinates; 12222 } 12223 }, { 12224 filter: [ 'width', 'items', 'settings' ], 12225 run: function() { 12226 var padding = this.settings.stagePadding, 12227 coordinates = this._coordinates, 12228 css = { 12229 'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2, 12230 'padding-left': padding || '', 12231 'padding-right': padding || '' 12232 }; 12233 12234 this.$stage.css(css); 12235 } 12236 }, { 12237 filter: [ 'width', 'items', 'settings' ], 12238 run: function(cache) { 12239 var iterator = this._coordinates.length, 12240 grid = !this.settings.autoWidth, 12241 items = this.$stage.children(); 12242 12243 if (grid && cache.items.merge) { 12244 while (iterator--) { 12245 cache.css.width = this._widths[this.relative(iterator)]; 12246 items.eq(iterator).css(cache.css); 12247 } 12248 } else if (grid) { 12249 cache.css.width = cache.items.width; 12250 items.css(cache.css); 12251 } 12252 } 12253 }, { 12254 filter: [ 'items' ], 12255 run: function() { 12256 this._coordinates.length < 1 && this.$stage.removeAttr('style'); 12257 } 12258 }, { 12259 filter: [ 'width', 'items', 'settings' ], 12260 run: function(cache) { 12261 cache.current = cache.current ? this.$stage.children().index(cache.current) : 0; 12262 cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current)); 12263 this.reset(cache.current); 12264 } 12265 }, { 12266 filter: [ 'position' ], 12267 run: function() { 12268 this.animate(this.coordinates(this._current)); 12269 } 12270 }, { 12271 filter: [ 'width', 'position', 'items', 'settings' ], 12272 run: function() { 12273 var rtl = this.settings.rtl ? 1 : -1, 12274 padding = this.settings.stagePadding * 2, 12275 begin = this.coordinates(this.current()) + padding, 12276 end = begin + this.width() * rtl, 12277 inner, outer, matches = [], i, n; 12278 12279 for (i = 0, n = this._coordinates.length; i < n; i++) { 12280 inner = this._coordinates[i - 1] || 0; 12281 outer = Math.abs(this._coordinates[i]) + padding * rtl; 12282 12283 if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end))) 12284 || (this.op(outer, '<', begin) && this.op(outer, '>', end))) { 12285 matches.push(i); 12286 } 12287 } 12288 12289 this.$stage.children('.active').removeClass('active'); 12290 this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active'); 12291 12292 this.$stage.children('.center').removeClass('center'); 12293 if (this.settings.center) { 12294 this.$stage.children().eq(this.current()).addClass('center'); 12295 } 12296 } 12297 } ]; 12298 12299 /** 12300 * Create the stage DOM element 12301 */ 12302 Owl.prototype.initializeStage = function() { 12303 this.$stage = this.$element.find('.' + this.settings.stageClass); 12304 12305 // if the stage is already in the DOM, grab it and skip stage initialization 12306 if (this.$stage.length) { 12307 return; 12308 } 12309 12310 this.$element.addClass(this.options.loadingClass); 12311 12312 // create stage 12313 this.$stage = $('<' + this.settings.stageElement + '>', { 12314 "class": this.settings.stageClass 12315 }).wrap( $( '<div/>', { 12316 "class": this.settings.stageOuterClass 12317 })); 12318 12319 // append stage 12320 this.$element.append(this.$stage.parent()); 12321 }; 12322 12323 /** 12324 * Create item DOM elements 12325 */ 12326 Owl.prototype.initializeItems = function() { 12327 var $items = this.$element.find('.owl-item'); 12328 12329 // if the items are already in the DOM, grab them and skip item initialization 12330 if ($items.length) { 12331 this._items = $items.get().map(function(item) { 12332 return $(item); 12333 }); 12334 12335 this._mergers = this._items.map(function() { 12336 return 1; 12337 }); 12338 12339 this.refresh(); 12340 12341 return; 12342 } 12343 12344 // append content 12345 this.replace(this.$element.children().not(this.$stage.parent())); 12346 12347 // check visibility 12348 if (this.isVisible()) { 12349 // update view 12350 this.refresh(); 12351 } else { 12352 // invalidate width 12353 this.invalidate('width'); 12354 } 12355 12356 this.$element 12357 .removeClass(this.options.loadingClass) 12358 .addClass(this.options.loadedClass); 12359 }; 12360 12361 /** 12362 * Initializes the carousel. 12363 * @protected 12364 */ 12365 Owl.prototype.initialize = function() { 12366 this.enter('initializing'); 12367 this.trigger('initialize'); 12368 12369 this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl); 12370 12371 if (this.settings.autoWidth && !this.is('pre-loading')) { 12372 var imgs, nestedSelector, width; 12373 imgs = this.$element.find('img'); 12374 nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined; 12375 width = this.$element.children(nestedSelector).width(); 12376 12377 if (imgs.length && width <= 0) { 12378 this.preloadAutoWidthImages(imgs); 12379 } 12380 } 12381 12382 this.initializeStage(); 12383 this.initializeItems(); 12384 12385 // register event handlers 12386 this.registerEventHandlers(); 12387 12388 this.leave('initializing'); 12389 this.trigger('initialized'); 12390 }; 12391 12392 /** 12393 * @returns {Boolean} visibility of $element 12394 * if you know the carousel will always be visible you can set `checkVisibility` to `false` to 12395 * prevent the expensive browser layout forced reflow the $element.is(':visible') does 12396 */ 12397 Owl.prototype.isVisible = function() { 12398 return this.settings.checkVisibility 12399 ? this.$element.is(':visible') 12400 : true; 12401 }; 12402 12403 /** 12404 * Setups the current settings. 12405 * @todo Remove responsive classes. Why should adaptive designs be brought into IE8? 12406 * @todo Support for media queries by using `matchMedia` would be nice. 12407 * @public 12408 */ 12409 Owl.prototype.setup = function() { 12410 var viewport = this.viewport(), 12411 overwrites = this.options.responsive, 12412 match = -1, 12413 settings = null; 12414 12415 if (!overwrites) { 12416 settings = $.extend({}, this.options); 12417 } else { 12418 $.each(overwrites, function(breakpoint) { 12419 if (breakpoint <= viewport && breakpoint > match) { 12420 match = Number(breakpoint); 12421 } 12422 }); 12423 12424 settings = $.extend({}, this.options, overwrites[match]); 12425 if (typeof settings.stagePadding === 'function') { 12426 settings.stagePadding = settings.stagePadding(); 12427 } 12428 delete settings.responsive; 12429 12430 // responsive class 12431 if (settings.responsiveClass) { 12432 this.$element.attr('class', 12433 this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match) 12434 ); 12435 } 12436 } 12437 12438 this.trigger('change', { property: { name: 'settings', value: settings } }); 12439 this._breakpoint = match; 12440 this.settings = settings; 12441 this.invalidate('settings'); 12442 this.trigger('changed', { property: { name: 'settings', value: this.settings } }); 12443 }; 12444 12445 /** 12446 * Updates option logic if necessery. 12447 * @protected 12448 */ 12449 Owl.prototype.optionsLogic = function() { 12450 if (this.settings.autoWidth) { 12451 this.settings.stagePadding = false; 12452 this.settings.merge = false; 12453 } 12454 }; 12455 12456 /** 12457 * Prepares an item before add. 12458 * @todo Rename event parameter `content` to `item`. 12459 * @protected 12460 * @returns {jQuery|HTMLElement} - The item container. 12461 */ 12462 Owl.prototype.prepare = function(item) { 12463 var event = this.trigger('prepare', { content: item }); 12464 12465 if (!event.data) { 12466 event.data = $('<' + this.settings.itemElement + '/>') 12467 .addClass(this.options.itemClass).append(item) 12468 } 12469 12470 this.trigger('prepared', { content: event.data }); 12471 12472 return event.data; 12473 }; 12474 12475 /** 12476 * Updates the view. 12477 * @public 12478 */ 12479 Owl.prototype.update = function() { 12480 var i = 0, 12481 n = this._pipe.length, 12482 filter = $.proxy(function(p) { return this[p] }, this._invalidated), 12483 cache = {}; 12484 12485 while (i < n) { 12486 if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) { 12487 this._pipe[i].run(cache); 12488 } 12489 i++; 12490 } 12491 12492 this._invalidated = {}; 12493 12494 !this.is('valid') && this.enter('valid'); 12495 }; 12496 12497 /** 12498 * Gets the width of the view. 12499 * @public 12500 * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return. 12501 * @returns {Number} - The width of the view in pixel. 12502 */ 12503 Owl.prototype.width = function(dimension) { 12504 dimension = dimension || Owl.Width.Default; 12505 switch (dimension) { 12506 case Owl.Width.Inner: 12507 case Owl.Width.Outer: 12508 return this._width; 12509 default: 12510 return this._width - this.settings.stagePadding * 2 + this.settings.margin; 12511 } 12512 }; 12513 12514 /** 12515 * Refreshes the carousel primarily for adaptive purposes. 12516 * @public 12517 */ 12518 Owl.prototype.refresh = function() { 12519 this.enter('refreshing'); 12520 this.trigger('refresh'); 12521 12522 this.setup(); 12523 12524 this.optionsLogic(); 12525 12526 this.$element.addClass(this.options.refreshClass); 12527 12528 this.update(); 12529 12530 this.$element.removeClass(this.options.refreshClass); 12531 12532 this.leave('refreshing'); 12533 this.trigger('refreshed'); 12534 }; 12535 12536 /** 12537 * Checks window `resize` event. 12538 * @protected 12539 */ 12540 Owl.prototype.onThrottledResize = function() { 12541 window.clearTimeout(this.resizeTimer); 12542 this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate); 12543 }; 12544 12545 /** 12546 * Checks window `resize` event. 12547 * @protected 12548 */ 12549 Owl.prototype.onResize = function() { 12550 if (!this._items.length) { 12551 return false; 12552 } 12553 12554 if (this._width === this.$element.width()) { 12555 return false; 12556 } 12557 12558 if (!this.isVisible()) { 12559 return false; 12560 } 12561 12562 this.enter('resizing'); 12563 12564 if (this.trigger('resize').isDefaultPrevented()) { 12565 this.leave('resizing'); 12566 return false; 12567 } 12568 12569 this.invalidate('width'); 12570 12571 this.refresh(); 12572 12573 this.leave('resizing'); 12574 this.trigger('resized'); 12575 }; 12576 12577 /** 12578 * Registers event handlers. 12579 * @todo Check `msPointerEnabled` 12580 * @todo #261 12581 * @protected 12582 */ 12583 Owl.prototype.registerEventHandlers = function() { 12584 if ($.support.transition) { 12585 this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this)); 12586 } 12587 12588 if (this.settings.responsive !== false) { 12589 this.on(window, 'resize', this._handlers.onThrottledResize); 12590 } 12591 12592 if (this.settings.mouseDrag) { 12593 this.$element.addClass(this.options.dragClass); 12594 this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this)); 12595 this.$stage.on('dragstart.owl.core selectstart.owl.core', function() { return false }); 12596 } 12597 12598 if (this.settings.touchDrag){ 12599 this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this)); 12600 this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this)); 12601 } 12602 }; 12603 12604 /** 12605 * Handles `touchstart` and `mousedown` events. 12606 * @todo Horizontal swipe threshold as option 12607 * @todo #261 12608 * @protected 12609 * @param {Event} event - The event arguments. 12610 */ 12611 Owl.prototype.onDragStart = function(event) { 12612 var stage = null; 12613 12614 if (event.which === 3) { 12615 return; 12616 } 12617 12618 if ($.support.transform) { 12619 stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(','); 12620 stage = { 12621 x: stage[stage.length === 16 ? 12 : 4], 12622 y: stage[stage.length === 16 ? 13 : 5] 12623 }; 12624 } else { 12625 stage = this.$stage.position(); 12626 stage = { 12627 x: this.settings.rtl ? 12628 stage.left + this.$stage.width() - this.width() + this.settings.margin : 12629 stage.left, 12630 y: stage.top 12631 }; 12632 } 12633 12634 if (this.is('animating')) { 12635 $.support.transform ? this.animate(stage.x) : this.$stage.stop() 12636 this.invalidate('position'); 12637 } 12638 12639 this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown'); 12640 12641 this.speed(0); 12642 12643 this._drag.time = new Date().getTime(); 12644 this._drag.target = $(event.target); 12645 this._drag.stage.start = stage; 12646 this._drag.stage.current = stage; 12647 this._drag.pointer = this.pointer(event); 12648 12649 $(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this)); 12650 12651 $(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event) { 12652 var delta = this.difference(this._drag.pointer, this.pointer(event)); 12653 12654 $(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this)); 12655 12656 if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')) { 12657 return; 12658 } 12659 12660 event.preventDefault(); 12661 12662 this.enter('dragging'); 12663 this.trigger('drag'); 12664 }, this)); 12665 }; 12666 12667 /** 12668 * Handles the `touchmove` and `mousemove` events. 12669 * @todo #261 12670 * @protected 12671 * @param {Event} event - The event arguments. 12672 */ 12673 Owl.prototype.onDragMove = function(event) { 12674 var minimum = null, 12675 maximum = null, 12676 pull = null, 12677 delta = this.difference(this._drag.pointer, this.pointer(event)), 12678 stage = this.difference(this._drag.stage.start, delta); 12679 12680 if (!this.is('dragging')) { 12681 return; 12682 } 12683 12684 event.preventDefault(); 12685 12686 if (this.settings.loop) { 12687 minimum = this.coordinates(this.minimum()); 12688 maximum = this.coordinates(this.maximum() + 1) - minimum; 12689 stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum; 12690 } else { 12691 minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum()); 12692 maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum()); 12693 pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0; 12694 stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull); 12695 } 12696 12697 this._drag.stage.current = stage; 12698 12699 this.animate(stage.x); 12700 }; 12701 12702 /** 12703 * Handles the `touchend` and `mouseup` events. 12704 * @todo #261 12705 * @todo Threshold for click event 12706 * @protected 12707 * @param {Event} event - The event arguments. 12708 */ 12709 Owl.prototype.onDragEnd = function(event) { 12710 var delta = this.difference(this._drag.pointer, this.pointer(event)), 12711 stage = this._drag.stage.current, 12712 direction = delta.x > 0 ^ this.settings.rtl ? 'left' : 'right'; 12713 12714 $(document).off('.owl.core'); 12715 12716 this.$element.removeClass(this.options.grabClass); 12717 12718 if (delta.x !== 0 && this.is('dragging') || !this.is('valid')) { 12719 this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed); 12720 this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction)); 12721 this.invalidate('position'); 12722 this.update(); 12723 12724 this._drag.direction = direction; 12725 12726 if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) { 12727 this._drag.target.one('click.owl.core', function() { return false; }); 12728 } 12729 } 12730 12731 if (!this.is('dragging')) { 12732 return; 12733 } 12734 12735 this.leave('dragging'); 12736 this.trigger('dragged'); 12737 }; 12738 12739 /** 12740 * Gets absolute position of the closest item for a coordinate. 12741 * @todo Setting `freeDrag` makes `closest` not reusable. See #165. 12742 * @protected 12743 * @param {Number} coordinate - The coordinate in pixel. 12744 * @param {String} direction - The direction to check for the closest item. Ether `left` or `right`. 12745 * @return {Number} - The absolute position of the closest item. 12746 */ 12747 Owl.prototype.closest = function(coordinate, direction) { 12748 var position = -1, 12749 pull = 30, 12750 width = this.width(), 12751 coordinates = this.coordinates(); 12752 12753 if (!this.settings.freeDrag) { 12754 // check closest item 12755 $.each(coordinates, $.proxy(function(index, value) { 12756 // on a left pull, check on current index 12757 if (direction === 'left' && coordinate > value - pull && coordinate < value + pull) { 12758 position = index; 12759 // on a right pull, check on previous index 12760 // to do so, subtract width from value and set position = index + 1 12761 } else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull) { 12762 position = index + 1; 12763 } else if (this.op(coordinate, '<', value) 12764 && this.op(coordinate, '>', coordinates[index + 1] !== undefined ? coordinates[index + 1] : value - width)) { 12765 position = direction === 'left' ? index + 1 : index; 12766 } 12767 return position === -1; 12768 }, this)); 12769 } 12770 12771 if (!this.settings.loop) { 12772 // non loop boundries 12773 if (this.op(coordinate, '>', coordinates[this.minimum()])) { 12774 position = coordinate = this.minimum(); 12775 } else if (this.op(coordinate, '<', coordinates[this.maximum()])) { 12776 position = coordinate = this.maximum(); 12777 } 12778 } 12779 12780 return position; 12781 }; 12782 12783 /** 12784 * Animates the stage. 12785 * @todo #270 12786 * @public 12787 * @param {Number} coordinate - The coordinate in pixels. 12788 */ 12789 Owl.prototype.animate = function(coordinate) { 12790 var animate = this.speed() > 0; 12791 12792 this.is('animating') && this.onTransitionEnd(); 12793 12794 if (animate) { 12795 this.enter('animating'); 12796 this.trigger('translate'); 12797 } 12798 12799 if ($.support.transform3d && $.support.transition) { 12800 this.$stage.css({ 12801 transform: 'translate3d(' + coordinate + 'px,0px,0px)', 12802 transition: (this.speed() / 1000) + 's' + ( 12803 this.settings.slideTransition ? ' ' + this.settings.slideTransition : '' 12804 ) 12805 }); 12806 } else if (animate) { 12807 this.$stage.animate({ 12808 left: coordinate + 'px' 12809 }, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this)); 12810 } else { 12811 this.$stage.css({ 12812 left: coordinate + 'px' 12813 }); 12814 } 12815 }; 12816 12817 /** 12818 * Checks whether the carousel is in a specific state or not. 12819 * @param {String} state - The state to check. 12820 * @returns {Boolean} - The flag which indicates if the carousel is busy. 12821 */ 12822 Owl.prototype.is = function(state) { 12823 return this._states.current[state] && this._states.current[state] > 0; 12824 }; 12825 12826 /** 12827 * Sets the absolute position of the current item. 12828 * @public 12829 * @param {Number} [position] - The new absolute position or nothing to leave it unchanged. 12830 * @returns {Number} - The absolute position of the current item. 12831 */ 12832 Owl.prototype.current = function(position) { 12833 if (position === undefined) { 12834 return this._current; 12835 } 12836 12837 if (this._items.length === 0) { 12838 return undefined; 12839 } 12840 12841 position = this.normalize(position); 12842 12843 if (this._current !== position) { 12844 var event = this.trigger('change', { property: { name: 'position', value: position } }); 12845 12846 if (event.data !== undefined) { 12847 position = this.normalize(event.data); 12848 } 12849 12850 this._current = position; 12851 12852 this.invalidate('position'); 12853 12854 this.trigger('changed', { property: { name: 'position', value: this._current } }); 12855 } 12856 12857 return this._current; 12858 }; 12859 12860 /** 12861 * Invalidates the given part of the update routine. 12862 * @param {String} [part] - The part to invalidate. 12863 * @returns {Array.<String>} - The invalidated parts. 12864 */ 12865 Owl.prototype.invalidate = function(part) { 12866 if ($.type(part) === 'string') { 12867 this._invalidated[part] = true; 12868 this.is('valid') && this.leave('valid'); 12869 } 12870 return $.map(this._invalidated, function(v, i) { return i }); 12871 }; 12872 12873 /** 12874 * Resets the absolute position of the current item. 12875 * @public 12876 * @param {Number} position - The absolute position of the new item. 12877 */ 12878 Owl.prototype.reset = function(position) { 12879 position = this.normalize(position); 12880 12881 if (position === undefined) { 12882 return; 12883 } 12884 12885 this._speed = 0; 12886 this._current = position; 12887 12888 this.suppress([ 'translate', 'translated' ]); 12889 12890 this.animate(this.coordinates(position)); 12891 12892 this.release([ 'translate', 'translated' ]); 12893 }; 12894 12895 /** 12896 * Normalizes an absolute or a relative position of an item. 12897 * @public 12898 * @param {Number} position - The absolute or relative position to normalize. 12899 * @param {Boolean} [relative=false] - Whether the given position is relative or not. 12900 * @returns {Number} - The normalized position. 12901 */ 12902 Owl.prototype.normalize = function(position, relative) { 12903 var n = this._items.length, 12904 m = relative ? 0 : this._clones.length; 12905 12906 if (!this.isNumeric(position) || n < 1) { 12907 position = undefined; 12908 } else if (position < 0 || position >= n + m) { 12909 position = ((position - m / 2) % n + n) % n + m / 2; 12910 } 12911 12912 return position; 12913 }; 12914 12915 /** 12916 * Converts an absolute position of an item into a relative one. 12917 * @public 12918 * @param {Number} position - The absolute position to convert. 12919 * @returns {Number} - The converted position. 12920 */ 12921 Owl.prototype.relative = function(position) { 12922 position -= this._clones.length / 2; 12923 return this.normalize(position, true); 12924 }; 12925 12926 /** 12927 * Gets the maximum position for the current item. 12928 * @public 12929 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position. 12930 * @returns {Number} 12931 */ 12932 Owl.prototype.maximum = function(relative) { 12933 var settings = this.settings, 12934 maximum = this._coordinates.length, 12935 iterator, 12936 reciprocalItemsWidth, 12937 elementWidth; 12938 12939 if (settings.loop) { 12940 maximum = this._clones.length / 2 + this._items.length - 1; 12941 } else if (settings.autoWidth || settings.merge) { 12942 iterator = this._items.length; 12943 if (iterator) { 12944 reciprocalItemsWidth = this._items[--iterator].width(); 12945 elementWidth = this.$element.width(); 12946 while (iterator--) { 12947 reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin; 12948 if (reciprocalItemsWidth > elementWidth) { 12949 break; 12950 } 12951 } 12952 } 12953 maximum = iterator + 1; 12954 } else if (settings.center) { 12955 maximum = this._items.length - 1; 12956 } else { 12957 maximum = this._items.length - settings.items; 12958 } 12959 12960 if (relative) { 12961 maximum -= this._clones.length / 2; 12962 } 12963 12964 return Math.max(maximum, 0); 12965 }; 12966 12967 /** 12968 * Gets the minimum position for the current item. 12969 * @public 12970 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position. 12971 * @returns {Number} 12972 */ 12973 Owl.prototype.minimum = function(relative) { 12974 return relative ? 0 : this._clones.length / 2; 12975 }; 12976 12977 /** 12978 * Gets an item at the specified relative position. 12979 * @public 12980 * @param {Number} [position] - The relative position of the item. 12981 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given. 12982 */ 12983 Owl.prototype.items = function(position) { 12984 if (position === undefined) { 12985 return this._items.slice(); 12986 } 12987 12988 position = this.normalize(position, true); 12989 return this._items[position]; 12990 }; 12991 12992 /** 12993 * Gets an item at the specified relative position. 12994 * @public 12995 * @param {Number} [position] - The relative position of the item. 12996 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given. 12997 */ 12998 Owl.prototype.mergers = function(position) { 12999 if (position === undefined) { 13000 return this._mergers.slice(); 13001 } 13002 13003 position = this.normalize(position, true); 13004 return this._mergers[position]; 13005 }; 13006 13007 /** 13008 * Gets the absolute positions of clones for an item. 13009 * @public 13010 * @param {Number} [position] - The relative position of the item. 13011 * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given. 13012 */ 13013 Owl.prototype.clones = function(position) { 13014 var odd = this._clones.length / 2, 13015 even = odd + this._items.length, 13016 map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 }; 13017 13018 if (position === undefined) { 13019 return $.map(this._clones, function(v, i) { return map(i) }); 13020 } 13021 13022 return $.map(this._clones, function(v, i) { return v === position ? map(i) : null }); 13023 }; 13024 13025 /** 13026 * Sets the current animation speed. 13027 * @public 13028 * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged. 13029 * @returns {Number} - The current animation speed in milliseconds. 13030 */ 13031 Owl.prototype.speed = function(speed) { 13032 if (speed !== undefined) { 13033 this._speed = speed; 13034 } 13035 13036 return this._speed; 13037 }; 13038 13039 /** 13040 * Gets the coordinate of an item. 13041 * @todo The name of this method is missleanding. 13042 * @public 13043 * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`. 13044 * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates. 13045 */ 13046 Owl.prototype.coordinates = function(position) { 13047 var multiplier = 1, 13048 newPosition = position - 1, 13049 coordinate; 13050 13051 if (position === undefined) { 13052 return $.map(this._coordinates, $.proxy(function(coordinate, index) { 13053 return this.coordinates(index); 13054 }, this)); 13055 } 13056 13057 if (this.settings.center) { 13058 if (this.settings.rtl) { 13059 multiplier = -1; 13060 newPosition = position + 1; 13061 } 13062 13063 coordinate = this._coordinates[position]; 13064 coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier; 13065 } else { 13066 coordinate = this._coordinates[newPosition] || 0; 13067 } 13068 13069 coordinate = Math.ceil(coordinate); 13070 13071 return coordinate; 13072 }; 13073 13074 /** 13075 * Calculates the speed for a translation. 13076 * @protected 13077 * @param {Number} from - The absolute position of the start item. 13078 * @param {Number} to - The absolute position of the target item. 13079 * @param {Number} [factor=undefined] - The time factor in milliseconds. 13080 * @returns {Number} - The time in milliseconds for the translation. 13081 */ 13082 Owl.prototype.duration = function(from, to, factor) { 13083 if (factor === 0) { 13084 return 0; 13085 } 13086 13087 return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed)); 13088 }; 13089 13090 /** 13091 * Slides to the specified item. 13092 * @public 13093 * @param {Number} position - The position of the item. 13094 * @param {Number} [speed] - The time in milliseconds for the transition. 13095 */ 13096 Owl.prototype.to = function(position, speed) { 13097 var current = this.current(), 13098 revert = null, 13099 distance = position - this.relative(current), 13100 direction = (distance > 0) - (distance < 0), 13101 items = this._items.length, 13102 minimum = this.minimum(), 13103 maximum = this.maximum(); 13104 13105 if (this.settings.loop) { 13106 if (!this.settings.rewind && Math.abs(distance) > items / 2) { 13107 distance += direction * -1 * items; 13108 } 13109 13110 position = current + distance; 13111 revert = ((position - minimum) % items + items) % items + minimum; 13112 13113 if (revert !== position && revert - distance <= maximum && revert - distance > 0) { 13114 current = revert - distance; 13115 position = revert; 13116 this.reset(current); 13117 } 13118 } else if (this.settings.rewind) { 13119 maximum += 1; 13120 position = (position % maximum + maximum) % maximum; 13121 } else { 13122 position = Math.max(minimum, Math.min(maximum, position)); 13123 } 13124 13125 this.speed(this.duration(current, position, speed)); 13126 this.current(position); 13127 13128 if (this.isVisible()) { 13129 this.update(); 13130 } 13131 }; 13132 13133 /** 13134 * Slides to the next item. 13135 * @public 13136 * @param {Number} [speed] - The time in milliseconds for the transition. 13137 */ 13138 Owl.prototype.next = function(speed) { 13139 speed = speed || false; 13140 this.to(this.relative(this.current()) + 1, speed); 13141 }; 13142 13143 /** 13144 * Slides to the previous item. 13145 * @public 13146 * @param {Number} [speed] - The time in milliseconds for the transition. 13147 */ 13148 Owl.prototype.prev = function(speed) { 13149 speed = speed || false; 13150 this.to(this.relative(this.current()) - 1, speed); 13151 }; 13152 13153 /** 13154 * Handles the end of an animation. 13155 * @protected 13156 * @param {Event} event - The event arguments. 13157 */ 13158 Owl.prototype.onTransitionEnd = function(event) { 13159 13160 // if css2 animation then event object is undefined 13161 if (event !== undefined) { 13162 event.stopPropagation(); 13163 13164 // Catch only owl-stage transitionEnd event 13165 if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) { 13166 return false; 13167 } 13168 } 13169 13170 this.leave('animating'); 13171 this.trigger('translated'); 13172 }; 13173 13174 /** 13175 * Gets viewport width. 13176 * @protected 13177 * @return {Number} - The width in pixel. 13178 */ 13179 Owl.prototype.viewport = function() { 13180 var width; 13181 if (this.options.responsiveBaseElement !== window) { 13182 width = $(this.options.responsiveBaseElement).width(); 13183 } else if (window.innerWidth) { 13184 width = window.innerWidth; 13185 } else if (document.documentElement && document.documentElement.clientWidth) { 13186 width = document.documentElement.clientWidth; 13187 } else { 13188 console.warn('Can not detect viewport width.'); 13189 } 13190 return width; 13191 }; 13192 13193 /** 13194 * Replaces the current content. 13195 * @public 13196 * @param {HTMLElement|jQuery|String} content - The new content. 13197 */ 13198 Owl.prototype.replace = function(content) { 13199 this.$stage.empty(); 13200 this._items = []; 13201 13202 if (content) { 13203 content = (content instanceof jQuery) ? content : $(content); 13204 } 13205 13206 if (this.settings.nestedItemSelector) { 13207 content = content.find('.' + this.settings.nestedItemSelector); 13208 } 13209 13210 content.filter(function() { 13211 return this.nodeType === 1; 13212 }).each($.proxy(function(index, item) { 13213 item = this.prepare(item); 13214 this.$stage.append(item); 13215 this._items.push(item); 13216 this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); 13217 }, this)); 13218 13219 this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0); 13220 13221 this.invalidate('items'); 13222 }; 13223 13224 /** 13225 * Adds an item. 13226 * @todo Use `item` instead of `content` for the event arguments. 13227 * @public 13228 * @param {HTMLElement|jQuery|String} content - The item content to add. 13229 * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end. 13230 */ 13231 Owl.prototype.add = function(content, position) { 13232 var current = this.relative(this._current); 13233 13234 position = position === undefined ? this._items.length : this.normalize(position, true); 13235 content = content instanceof jQuery ? content : $(content); 13236 13237 this.trigger('add', { content: content, position: position }); 13238 13239 content = this.prepare(content); 13240 13241 if (this._items.length === 0 || position === this._items.length) { 13242 this._items.length === 0 && this.$stage.append(content); 13243 this._items.length !== 0 && this._items[position - 1].after(content); 13244 this._items.push(content); 13245 this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); 13246 } else { 13247 this._items[position].before(content); 13248 this._items.splice(position, 0, content); 13249 this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); 13250 } 13251 13252 this._items[current] && this.reset(this._items[current].index()); 13253 13254 this.invalidate('items'); 13255 13256 this.trigger('added', { content: content, position: position }); 13257 }; 13258 13259 /** 13260 * Removes an item by its position. 13261 * @todo Use `item` instead of `content` for the event arguments. 13262 * @public 13263 * @param {Number} position - The relative position of the item to remove. 13264 */ 13265 Owl.prototype.remove = function(position) { 13266 position = this.normalize(position, true); 13267 13268 if (position === undefined) { 13269 return; 13270 } 13271 13272 this.trigger('remove', { content: this._items[position], position: position }); 13273 13274 this._items[position].remove(); 13275 this._items.splice(position, 1); 13276 this._mergers.splice(position, 1); 13277 13278 this.invalidate('items'); 13279 13280 this.trigger('removed', { content: null, position: position }); 13281 }; 13282 13283 /** 13284 * Preloads images with auto width. 13285 * @todo Replace by a more generic approach 13286 * @protected 13287 */ 13288 Owl.prototype.preloadAutoWidthImages = function(images) { 13289 images.each($.proxy(function(i, element) { 13290 this.enter('pre-loading'); 13291 element = $(element); 13292 $(new Image()).one('load', $.proxy(function(e) { 13293 element.attr('src', e.target.src); 13294 element.css('opacity', 1); 13295 this.leave('pre-loading'); 13296 !this.is('pre-loading') && !this.is('initializing') && this.refresh(); 13297 }, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina')); 13298 }, this)); 13299 }; 13300 13301 /** 13302 * Destroys the carousel. 13303 * @public 13304 */ 13305 Owl.prototype.destroy = function() { 13306 13307 this.$element.off('.owl.core'); 13308 this.$stage.off('.owl.core'); 13309 $(document).off('.owl.core'); 13310 13311 if (this.settings.responsive !== false) { 13312 window.clearTimeout(this.resizeTimer); 13313 this.off(window, 'resize', this._handlers.onThrottledResize); 13314 } 13315 13316 for (var i in this._plugins) { 13317 this._plugins[i].destroy(); 13318 } 13319 13320 this.$stage.children('.cloned').remove(); 13321 13322 this.$stage.unwrap(); 13323 this.$stage.children().contents().unwrap(); 13324 this.$stage.children().unwrap(); 13325 this.$stage.remove(); 13326 this.$element 13327 .removeClass(this.options.refreshClass) 13328 .removeClass(this.options.loadingClass) 13329 .removeClass(this.options.loadedClass) 13330 .removeClass(this.options.rtlClass) 13331 .removeClass(this.options.dragClass) 13332 .removeClass(this.options.grabClass) 13333 .attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), '')) 13334 .removeData('owl.carousel'); 13335 }; 13336 13337 /** 13338 * Operators to calculate right-to-left and left-to-right. 13339 * @protected 13340 * @param {Number} [a] - The left side operand. 13341 * @param {String} [o] - The operator. 13342 * @param {Number} [b] - The right side operand. 13343 */ 13344 Owl.prototype.op = function(a, o, b) { 13345 var rtl = this.settings.rtl; 13346 switch (o) { 13347 case '<': 13348 return rtl ? a > b : a < b; 13349 case '>': 13350 return rtl ? a < b : a > b; 13351 case '>=': 13352 return rtl ? a <= b : a >= b; 13353 case '<=': 13354 return rtl ? a >= b : a <= b; 13355 default: 13356 break; 13357 } 13358 }; 13359 13360 /** 13361 * Attaches to an internal event. 13362 * @protected 13363 * @param {HTMLElement} element - The event source. 13364 * @param {String} event - The event name. 13365 * @param {Function} listener - The event handler to attach. 13366 * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not. 13367 */ 13368 Owl.prototype.on = function(element, event, listener, capture) { 13369 if (element.addEventListener) { 13370 element.addEventListener(event, listener, capture); 13371 } else if (element.attachEvent) { 13372 element.attachEvent('on' + event, listener); 13373 } 13374 }; 13375 13376 /** 13377 * Detaches from an internal event. 13378 * @protected 13379 * @param {HTMLElement} element - The event source. 13380 * @param {String} event - The event name. 13381 * @param {Function} listener - The attached event handler to detach. 13382 * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not. 13383 */ 13384 Owl.prototype.off = function(element, event, listener, capture) { 13385 if (element.removeEventListener) { 13386 element.removeEventListener(event, listener, capture); 13387 } else if (element.detachEvent) { 13388 element.detachEvent('on' + event, listener); 13389 } 13390 }; 13391 13392 /** 13393 * Triggers a public event. 13394 * @todo Remove `status`, `relatedTarget` should be used instead. 13395 * @protected 13396 * @param {String} name - The event name. 13397 * @param {*} [data=null] - The event data. 13398 * @param {String} [namespace=carousel] - The event namespace. 13399 * @param {String} [state] - The state which is associated with the event. 13400 * @param {Boolean} [enter=false] - Indicates if the call enters the specified state or not. 13401 * @returns {Event} - The event arguments. 13402 */ 13403 Owl.prototype.trigger = function(name, data, namespace, state, enter) { 13404 var status = { 13405 item: { count: this._items.length, index: this.current() } 13406 }, handler = $.camelCase( 13407 $.grep([ 'on', name, namespace ], function(v) { return v }) 13408 .join('-').toLowerCase() 13409 ), event = $.Event( 13410 [ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(), 13411 $.extend({ relatedTarget: this }, status, data) 13412 ); 13413 13414 if (!this._supress[name]) { 13415 $.each(this._plugins, function(name, plugin) { 13416 if (plugin.onTrigger) { 13417 plugin.onTrigger(event); 13418 } 13419 }); 13420 13421 this.register({ type: Owl.Type.Event, name: name }); 13422 this.$element.trigger(event); 13423 13424 if (this.settings && typeof this.settings[handler] === 'function') { 13425 this.settings[handler].call(this, event); 13426 } 13427 } 13428 13429 return event; 13430 }; 13431 13432 /** 13433 * Enters a state. 13434 * @param name - The state name. 13435 */ 13436 Owl.prototype.enter = function(name) { 13437 $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) { 13438 if (this._states.current[name] === undefined) { 13439 this._states.current[name] = 0; 13440 } 13441 13442 this._states.current[name]++; 13443 }, this)); 13444 }; 13445 13446 /** 13447 * Leaves a state. 13448 * @param name - The state name. 13449 */ 13450 Owl.prototype.leave = function(name) { 13451 $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) { 13452 this._states.current[name]--; 13453 }, this)); 13454 }; 13455 13456 /** 13457 * Registers an event or state. 13458 * @public 13459 * @param {Object} object - The event or state to register. 13460 */ 13461 Owl.prototype.register = function(object) { 13462 if (object.type === Owl.Type.Event) { 13463 if (!$.event.special[object.name]) { 13464 $.event.special[object.name] = {}; 13465 } 13466 13467 if (!$.event.special[object.name].owl) { 13468 var _default = $.event.special[object.name]._default; 13469 $.event.special[object.name]._default = function(e) { 13470 if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)) { 13471 return _default.apply(this, arguments); 13472 } 13473 return e.namespace && e.namespace.indexOf('owl') > -1; 13474 }; 13475 $.event.special[object.name].owl = true; 13476 } 13477 } else if (object.type === Owl.Type.State) { 13478 if (!this._states.tags[object.name]) { 13479 this._states.tags[object.name] = object.tags; 13480 } else { 13481 this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags); 13482 } 13483 13484 this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) { 13485 return $.inArray(tag, this._states.tags[object.name]) === i; 13486 }, this)); 13487 } 13488 }; 13489 13490 /** 13491 * Suppresses events. 13492 * @protected 13493 * @param {Array.<String>} events - The events to suppress. 13494 */ 13495 Owl.prototype.suppress = function(events) { 13496 $.each(events, $.proxy(function(index, event) { 13497 this._supress[event] = true; 13498 }, this)); 13499 }; 13500 13501 /** 13502 * Releases suppressed events. 13503 * @protected 13504 * @param {Array.<String>} events - The events to release. 13505 */ 13506 Owl.prototype.release = function(events) { 13507 $.each(events, $.proxy(function(index, event) { 13508 delete this._supress[event]; 13509 }, this)); 13510 }; 13511 13512 /** 13513 * Gets unified pointer coordinates from event. 13514 * @todo #261 13515 * @protected 13516 * @param {Event} - The `mousedown` or `touchstart` event. 13517 * @returns {Object} - Contains `x` and `y` coordinates of current pointer position. 13518 */ 13519 Owl.prototype.pointer = function(event) { 13520 var result = { x: null, y: null }; 13521 13522 event = event.originalEvent || event || window.event; 13523 13524 event = event.touches && event.touches.length ? 13525 event.touches[0] : event.changedTouches && event.changedTouches.length ? 13526 event.changedTouches[0] : event; 13527 13528 if (event.pageX) { 13529 result.x = event.pageX; 13530 result.y = event.pageY; 13531 } else { 13532 result.x = event.clientX; 13533 result.y = event.clientY; 13534 } 13535 13536 return result; 13537 }; 13538 13539 /** 13540 * Determines if the input is a Number or something that can be coerced to a Number 13541 * @protected 13542 * @param {Number|String|Object|Array|Boolean|RegExp|Function|Symbol} - The input to be tested 13543 * @returns {Boolean} - An indication if the input is a Number or can be coerced to a Number 13544 */ 13545 Owl.prototype.isNumeric = function(number) { 13546 return !isNaN(parseFloat(number)); 13547 }; 13548 13549 /** 13550 * Gets the difference of two vectors. 13551 * @todo #261 13552 * @protected 13553 * @param {Object} - The first vector. 13554 * @param {Object} - The second vector. 13555 * @returns {Object} - The difference. 13556 */ 13557 Owl.prototype.difference = function(first, second) { 13558 return { 13559 x: first.x - second.x, 13560 y: first.y - second.y 13561 }; 13562 }; 13563 13564 /** 13565 * The jQuery Plugin for the Owl Carousel 13566 * @todo Navigation plugin `next` and `prev` 13567 * @public 13568 */ 13569 $.fn.owlCarousel = function(option) { 13570 var args = Array.prototype.slice.call(arguments, 1); 13571 13572 return this.each(function() { 13573 var $this = $(this), 13574 data = $this.data('owl.carousel'); 13575 13576 if (!data) { 13577 data = new Owl(this, typeof option == 'object' && option); 13578 $this.data('owl.carousel', data); 13579 13580 $.each([ 13581 'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove' 13582 ], function(i, event) { 13583 data.register({ type: Owl.Type.Event, name: event }); 13584 data.$element.on(event + '.owl.carousel.core', $.proxy(function(e) { 13585 if (e.namespace && e.relatedTarget !== this) { 13586 this.suppress([ event ]); 13587 data[event].apply(this, [].slice.call(arguments, 1)); 13588 this.release([ event ]); 13589 } 13590 }, data)); 13591 }); 13592 } 13593 13594 if (typeof option == 'string' && option.charAt(0) !== '_') { 13595 data[option].apply(data, args); 13596 } 13597 }); 13598 }; 13599 13600 /** 13601 * The constructor for the jQuery Plugin 13602 * @public 13603 */ 13604 $.fn.owlCarousel.Constructor = Owl; 13605 13606})(window.Zepto || window.jQuery, window, document); 13607 13608/** 13609 * AutoRefresh Plugin 13610 * @version 2.3.4 13611 * @author Artus Kolanowski 13612 * @author David Deutsch 13613 * @license The MIT License (MIT) 13614 */ 13615;(function($, window, document, undefined) { 13616 13617 /** 13618 * Creates the auto refresh plugin. 13619 * @class The Auto Refresh Plugin 13620 * @param {Owl} carousel - The Owl Carousel 13621 */ 13622 var AutoRefresh = function(carousel) { 13623 /** 13624 * Reference to the core. 13625 * @protected 13626 * @type {Owl} 13627 */ 13628 this._core = carousel; 13629 13630 /** 13631 * Refresh interval. 13632 * @protected 13633 * @type {number} 13634 */ 13635 this._interval = null; 13636 13637 /** 13638 * Whether the element is currently visible or not. 13639 * @protected 13640 * @type {Boolean} 13641 */ 13642 this._visible = null; 13643 13644 /** 13645 * All event handlers. 13646 * @protected 13647 * @type {Object} 13648 */ 13649 this._handlers = { 13650 'initialized.owl.carousel': $.proxy(function(e) { 13651 if (e.namespace && this._core.settings.autoRefresh) { 13652 this.watch(); 13653 } 13654 }, this) 13655 }; 13656 13657 // set default options 13658 this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options); 13659 13660 // register event handlers 13661 this._core.$element.on(this._handlers); 13662 }; 13663 13664 /** 13665 * Default options. 13666 * @public 13667 */ 13668 AutoRefresh.Defaults = { 13669 autoRefresh: true, 13670 autoRefreshInterval: 500 13671 }; 13672 13673 /** 13674 * Watches the element. 13675 */ 13676 AutoRefresh.prototype.watch = function() { 13677 if (this._interval) { 13678 return; 13679 } 13680 13681 this._visible = this._core.isVisible(); 13682 this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval); 13683 }; 13684 13685 /** 13686 * Refreshes the element. 13687 */ 13688 AutoRefresh.prototype.refresh = function() { 13689 if (this._core.isVisible() === this._visible) { 13690 return; 13691 } 13692 13693 this._visible = !this._visible; 13694 13695 this._core.$element.toggleClass('owl-hidden', !this._visible); 13696 13697 this._visible && (this._core.invalidate('width') && this._core.refresh()); 13698 }; 13699 13700 /** 13701 * Destroys the plugin. 13702 */ 13703 AutoRefresh.prototype.destroy = function() { 13704 var handler, property; 13705 13706 window.clearInterval(this._interval); 13707 13708 for (handler in this._handlers) { 13709 this._core.$element.off(handler, this._handlers[handler]); 13710 } 13711 for (property in Object.getOwnPropertyNames(this)) { 13712 typeof this[property] != 'function' && (this[property] = null); 13713 } 13714 }; 13715 13716 $.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh; 13717 13718})(window.Zepto || window.jQuery, window, document); 13719 13720/** 13721 * Lazy Plugin 13722 * @version 2.3.4 13723 * @author Bartosz Wojciechowski 13724 * @author David Deutsch 13725 * @license The MIT License (MIT) 13726 */ 13727;(function($, window, document, undefined) { 13728 13729 /** 13730 * Creates the lazy plugin. 13731 * @class The Lazy Plugin 13732 * @param {Owl} carousel - The Owl Carousel 13733 */ 13734 var Lazy = function(carousel) { 13735 13736 /** 13737 * Reference to the core. 13738 * @protected 13739 * @type {Owl} 13740 */ 13741 this._core = carousel; 13742 13743 /** 13744 * Already loaded items. 13745 * @protected 13746 * @type {Array.<jQuery>} 13747 */ 13748 this._loaded = []; 13749 13750 /** 13751 * Event handlers. 13752 * @protected 13753 * @type {Object} 13754 */ 13755 this._handlers = { 13756 'initialized.owl.carousel change.owl.carousel resized.owl.carousel': $.proxy(function(e) { 13757 if (!e.namespace) { 13758 return; 13759 } 13760 13761 if (!this._core.settings || !this._core.settings.lazyLoad) { 13762 return; 13763 } 13764 13765 if ((e.property && e.property.name == 'position') || e.type == 'initialized') { 13766 var settings = this._core.settings, 13767 n = (settings.center && Math.ceil(settings.items / 2) || settings.items), 13768 i = ((settings.center && n * -1) || 0), 13769 position = (e.property && e.property.value !== undefined ? e.property.value : this._core.current()) + i, 13770 clones = this._core.clones().length, 13771 load = $.proxy(function(i, v) { this.load(v) }, this); 13772 //TODO: Need documentation for this new option 13773 if (settings.lazyLoadEager > 0) { 13774 n += settings.lazyLoadEager; 13775 // If the carousel is looping also preload images that are to the "left" 13776 if (settings.loop) { 13777 position -= settings.lazyLoadEager; 13778 n++; 13779 } 13780 } 13781 13782 while (i++ < n) { 13783 this.load(clones / 2 + this._core.relative(position)); 13784 clones && $.each(this._core.clones(this._core.relative(position)), load); 13785 position++; 13786 } 13787 } 13788 }, this) 13789 }; 13790 13791 // set the default options 13792 this._core.options = $.extend({}, Lazy.Defaults, this._core.options); 13793 13794 // register event handler 13795 this._core.$element.on(this._handlers); 13796 }; 13797 13798 /** 13799 * Default options. 13800 * @public 13801 */ 13802 Lazy.Defaults = { 13803 lazyLoad: false, 13804 lazyLoadEager: 0 13805 }; 13806 13807 /** 13808 * Loads all resources of an item at the specified position. 13809 * @param {Number} position - The absolute position of the item. 13810 * @protected 13811 */ 13812 Lazy.prototype.load = function(position) { 13813 var $item = this._core.$stage.children().eq(position), 13814 $elements = $item && $item.find('.owl-lazy'); 13815 13816 if (!$elements || $.inArray($item.get(0), this._loaded) > -1) { 13817 return; 13818 } 13819 13820 $elements.each($.proxy(function(index, element) { 13821 var $element = $(element), image, 13822 url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src') || $element.attr('data-srcset'); 13823 13824 this._core.trigger('load', { element: $element, url: url }, 'lazy'); 13825 13826 if ($element.is('img')) { 13827 $element.one('load.owl.lazy', $.proxy(function() { 13828 $element.css('opacity', 1); 13829 this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); 13830 }, this)).attr('src', url); 13831 } else if ($element.is('source')) { 13832 $element.one('load.owl.lazy', $.proxy(function() { 13833 this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); 13834 }, this)).attr('srcset', url); 13835 } else { 13836 image = new Image(); 13837 image.onload = $.proxy(function() { 13838 $element.css({ 13839 'background-image': 'url("' + url + '")', 13840 'opacity': '1' 13841 }); 13842 this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); 13843 }, this); 13844 image.src = url; 13845 } 13846 }, this)); 13847 13848 this._loaded.push($item.get(0)); 13849 }; 13850 13851 /** 13852 * Destroys the plugin. 13853 * @public 13854 */ 13855 Lazy.prototype.destroy = function() { 13856 var handler, property; 13857 13858 for (handler in this.handlers) { 13859 this._core.$element.off(handler, this.handlers[handler]); 13860 } 13861 for (property in Object.getOwnPropertyNames(this)) { 13862 typeof this[property] != 'function' && (this[property] = null); 13863 } 13864 }; 13865 13866 $.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy; 13867 13868})(window.Zepto || window.jQuery, window, document); 13869 13870/** 13871 * AutoHeight Plugin 13872 * @version 2.3.4 13873 * @author Bartosz Wojciechowski 13874 * @author David Deutsch 13875 * @license The MIT License (MIT) 13876 */ 13877;(function($, window, document, undefined) { 13878 13879 /** 13880 * Creates the auto height plugin. 13881 * @class The Auto Height Plugin 13882 * @param {Owl} carousel - The Owl Carousel 13883 */ 13884 var AutoHeight = function(carousel) { 13885 /** 13886 * Reference to the core. 13887 * @protected 13888 * @type {Owl} 13889 */ 13890 this._core = carousel; 13891 13892 this._previousHeight = null; 13893 13894 /** 13895 * All event handlers. 13896 * @protected 13897 * @type {Object} 13898 */ 13899 this._handlers = { 13900 'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) { 13901 if (e.namespace && this._core.settings.autoHeight) { 13902 this.update(); 13903 } 13904 }, this), 13905 'changed.owl.carousel': $.proxy(function(e) { 13906 if (e.namespace && this._core.settings.autoHeight && e.property.name === 'position'){ 13907 this.update(); 13908 } 13909 }, this), 13910 'loaded.owl.lazy': $.proxy(function(e) { 13911 if (e.namespace && this._core.settings.autoHeight 13912 && e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) { 13913 this.update(); 13914 } 13915 }, this) 13916 }; 13917 13918 // set default options 13919 this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options); 13920 13921 // register event handlers 13922 this._core.$element.on(this._handlers); 13923 this._intervalId = null; 13924 var refThis = this; 13925 13926 // These changes have been taken from a PR by gavrochelegnou proposed in #1575 13927 // and have been made compatible with the latest jQuery version 13928 $(window).on('load', function() { 13929 if (refThis._core.settings.autoHeight) { 13930 refThis.update(); 13931 } 13932 }); 13933 13934 // Autoresize the height of the carousel when window is resized 13935 // When carousel has images, the height is dependent on the width 13936 // and should also change on resize 13937 $(window).resize(function() { 13938 if (refThis._core.settings.autoHeight) { 13939 if (refThis._intervalId != null) { 13940 clearTimeout(refThis._intervalId); 13941 } 13942 13943 refThis._intervalId = setTimeout(function() { 13944 refThis.update(); 13945 }, 250); 13946 } 13947 }); 13948 13949 }; 13950 13951 /** 13952 * Default options. 13953 * @public 13954 */ 13955 AutoHeight.Defaults = { 13956 autoHeight: false, 13957 autoHeightClass: 'owl-height' 13958 }; 13959 13960 /** 13961 * Updates the view. 13962 */ 13963 AutoHeight.prototype.update = function() { 13964 var start = this._core._current, 13965 end = start + this._core.settings.items, 13966 lazyLoadEnabled = this._core.settings.lazyLoad, 13967 visible = this._core.$stage.children().toArray().slice(start, end), 13968 heights = [], 13969 maxheight = 0; 13970 13971 $.each(visible, function(index, item) { 13972 heights.push($(item).height()); 13973 }); 13974 13975 maxheight = Math.max.apply(null, heights); 13976 13977 if (maxheight <= 1 && lazyLoadEnabled && this._previousHeight) { 13978 maxheight = this._previousHeight; 13979 } 13980 13981 this._previousHeight = maxheight; 13982 13983 this._core.$stage.parent() 13984 .height(maxheight) 13985 .addClass(this._core.settings.autoHeightClass); 13986 }; 13987 13988 AutoHeight.prototype.destroy = function() { 13989 var handler, property; 13990 13991 for (handler in this._handlers) { 13992 this._core.$element.off(handler, this._handlers[handler]); 13993 } 13994 for (property in Object.getOwnPropertyNames(this)) { 13995 typeof this[property] !== 'function' && (this[property] = null); 13996 } 13997 }; 13998 13999 $.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight; 14000 14001})(window.Zepto || window.jQuery, window, document); 14002 14003/** 14004 * Video Plugin 14005 * @version 2.3.4 14006 * @author Bartosz Wojciechowski 14007 * @author David Deutsch 14008 * @license The MIT License (MIT) 14009 */ 14010;(function($, window, document, undefined) { 14011 14012 /** 14013 * Creates the video plugin. 14014 * @class The Video Plugin 14015 * @param {Owl} carousel - The Owl Carousel 14016 */ 14017 var Video = function(carousel) { 14018 /** 14019 * Reference to the core. 14020 * @protected 14021 * @type {Owl} 14022 */ 14023 this._core = carousel; 14024 14025 /** 14026 * Cache all video URLs. 14027 * @protected 14028 * @type {Object} 14029 */ 14030 this._videos = {}; 14031 14032 /** 14033 * Current playing item. 14034 * @protected 14035 * @type {jQuery} 14036 */ 14037 this._playing = null; 14038 14039 /** 14040 * All event handlers. 14041 * @todo The cloned content removale is too late 14042 * @protected 14043 * @type {Object} 14044 */ 14045 this._handlers = { 14046 'initialized.owl.carousel': $.proxy(function(e) { 14047 if (e.namespace) { 14048 this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] }); 14049 } 14050 }, this), 14051 'resize.owl.carousel': $.proxy(function(e) { 14052 if (e.namespace && this._core.settings.video && this.isInFullScreen()) { 14053 e.preventDefault(); 14054 } 14055 }, this), 14056 'refreshed.owl.carousel': $.proxy(function(e) { 14057 if (e.namespace && this._core.is('resizing')) { 14058 this._core.$stage.find('.cloned .owl-video-frame').remove(); 14059 } 14060 }, this), 14061 'changed.owl.carousel': $.proxy(function(e) { 14062 if (e.namespace && e.property.name === 'position' && this._playing) { 14063 this.stop(); 14064 } 14065 }, this), 14066 'prepared.owl.carousel': $.proxy(function(e) { 14067 if (!e.namespace) { 14068 return; 14069 } 14070 14071 var $element = $(e.content).find('.owl-video'); 14072 14073 if ($element.length) { 14074 $element.css('display', 'none'); 14075 this.fetch($element, $(e.content)); 14076 } 14077 }, this) 14078 }; 14079 14080 // set default options 14081 this._core.options = $.extend({}, Video.Defaults, this._core.options); 14082 14083 // register event handlers 14084 this._core.$element.on(this._handlers); 14085 14086 this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) { 14087 this.play(e); 14088 }, this)); 14089 }; 14090 14091 /** 14092 * Default options. 14093 * @public 14094 */ 14095 Video.Defaults = { 14096 video: false, 14097 videoHeight: false, 14098 videoWidth: false 14099 }; 14100 14101 /** 14102 * Gets the video ID and the type (YouTube/Vimeo/vzaar only). 14103 * @protected 14104 * @param {jQuery} target - The target containing the video data. 14105 * @param {jQuery} item - The item containing the video. 14106 */ 14107 Video.prototype.fetch = function(target, item) { 14108 var type = (function() { 14109 if (target.attr('data-vimeo-id')) { 14110 return 'vimeo'; 14111 } else if (target.attr('data-vzaar-id')) { 14112 return 'vzaar' 14113 } else { 14114 return 'youtube'; 14115 } 14116 })(), 14117 id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'), 14118 width = target.attr('data-width') || this._core.settings.videoWidth, 14119 height = target.attr('data-height') || this._core.settings.videoHeight, 14120 url = target.attr('href'); 14121 14122 if (url) { 14123 14124 /* 14125 Parses the id's out of the following urls (and probably more): 14126 https://www.youtube.com/watch?v=:id 14127 https://youtu.be/:id 14128 https://vimeo.com/:id 14129 https://vimeo.com/channels/:channel/:id 14130 https://vimeo.com/groups/:group/videos/:id 14131 https://app.vzaar.com/videos/:id 14132 14133 Visual example: https://regexper.com/#(http%3A%7Chttps%3A%7C)%5C%2F%5C%2F(player.%7Cwww.%7Capp.)%3F(vimeo%5C.com%7Cyoutu(be%5C.com%7C%5C.be%7Cbe%5C.googleapis%5C.com)%7Cvzaar%5C.com)%5C%2F(video%5C%2F%7Cvideos%5C%2F%7Cembed%5C%2F%7Cchannels%5C%2F.%2B%5C%2F%7Cgroups%5C%2F.%2B%5C%2F%7Cwatch%5C%3Fv%3D%7Cv%5C%2F)%3F(%5BA-Za-z0-9._%25-%5D*)(%5C%26%5CS%2B)%3F 14134 */ 14135 14136 id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/); 14137 14138 if (id[3].indexOf('youtu') > -1) { 14139 type = 'youtube'; 14140 } else if (id[3].indexOf('vimeo') > -1) { 14141 type = 'vimeo'; 14142 } else if (id[3].indexOf('vzaar') > -1) { 14143 type = 'vzaar'; 14144 } else { 14145 throw new Error('Video URL not supported.'); 14146 } 14147 id = id[6]; 14148 } else { 14149 throw new Error('Missing video URL.'); 14150 } 14151 14152 this._videos[url] = { 14153 type: type, 14154 id: id, 14155 width: width, 14156 height: height 14157 }; 14158 14159 item.attr('data-video', url); 14160 14161 this.thumbnail(target, this._videos[url]); 14162 }; 14163 14164 /** 14165 * Creates video thumbnail. 14166 * @protected 14167 * @param {jQuery} target - The target containing the video data. 14168 * @param {Object} info - The video info object. 14169 * @see `fetch` 14170 */ 14171 Video.prototype.thumbnail = function(target, video) { 14172 var tnLink, 14173 icon, 14174 path, 14175 dimensions = video.width && video.height ? 'width:' + video.width + 'px;height:' + video.height + 'px;' : '', 14176 customTn = target.find('img'), 14177 srcType = 'src', 14178 lazyClass = '', 14179 settings = this._core.settings, 14180 create = function(path) { 14181 icon = '<div class="owl-video-play-icon"></div>'; 14182 14183 if (settings.lazyLoad) { 14184 tnLink = $('<div/>',{ 14185 "class": 'owl-video-tn ' + lazyClass, 14186 "srcType": path 14187 }); 14188 } else { 14189 tnLink = $( '<div/>', { 14190 "class": "owl-video-tn", 14191 "style": 'opacity:1;background-image:url(' + path + ')' 14192 }); 14193 } 14194 target.after(tnLink); 14195 target.after(icon); 14196 }; 14197 14198 // wrap video content into owl-video-wrapper div 14199 target.wrap( $( '<div/>', { 14200 "class": "owl-video-wrapper", 14201 "style": dimensions 14202 })); 14203 14204 if (this._core.settings.lazyLoad) { 14205 srcType = 'data-src'; 14206 lazyClass = 'owl-lazy'; 14207 } 14208 14209 // custom thumbnail 14210 if (customTn.length) { 14211 create(customTn.attr(srcType)); 14212 customTn.remove(); 14213 return false; 14214 } 14215 14216 if (video.type === 'youtube') { 14217 path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg"; 14218 create(path); 14219 } else if (video.type === 'vimeo') { 14220 $.ajax({ 14221 type: 'GET', 14222 url: '//vimeo.com/api/v2/video/' + video.id + '.json', 14223 jsonp: 'callback', 14224 dataType: 'jsonp', 14225 success: function(data) { 14226 path = data[0].thumbnail_large; 14227 create(path); 14228 } 14229 }); 14230 } else if (video.type === 'vzaar') { 14231 $.ajax({ 14232 type: 'GET', 14233 url: '//vzaar.com/api/videos/' + video.id + '.json', 14234 jsonp: 'callback', 14235 dataType: 'jsonp', 14236 success: function(data) { 14237 path = data.framegrab_url; 14238 create(path); 14239 } 14240 }); 14241 } 14242 }; 14243 14244 /** 14245 * Stops the current video. 14246 * @public 14247 */ 14248 Video.prototype.stop = function() { 14249 this._core.trigger('stop', null, 'video'); 14250 this._playing.find('.owl-video-frame').remove(); 14251 this._playing.removeClass('owl-video-playing'); 14252 this._playing = null; 14253 this._core.leave('playing'); 14254 this._core.trigger('stopped', null, 'video'); 14255 }; 14256 14257 /** 14258 * Starts the current video. 14259 * @public 14260 * @param {Event} event - The event arguments. 14261 */ 14262 Video.prototype.play = function(event) { 14263 var target = $(event.target), 14264 item = target.closest('.' + this._core.settings.itemClass), 14265 video = this._videos[item.attr('data-video')], 14266 width = video.width || '100%', 14267 height = video.height || this._core.$stage.height(), 14268 html, 14269 iframe; 14270 14271 if (this._playing) { 14272 return; 14273 } 14274 14275 this._core.enter('playing'); 14276 this._core.trigger('play', null, 'video'); 14277 14278 item = this._core.items(this._core.relative(item.index())); 14279 14280 this._core.reset(item.index()); 14281 14282 html = $( '<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>' ); 14283 html.attr( 'height', height ); 14284 html.attr( 'width', width ); 14285 if (video.type === 'youtube') { 14286 html.attr( 'src', '//www.youtube.com/embed/' + video.id + '?autoplay=1&rel=0&v=' + video.id ); 14287 } else if (video.type === 'vimeo') { 14288 html.attr( 'src', '//player.vimeo.com/video/' + video.id + '?autoplay=1' ); 14289 } else if (video.type === 'vzaar') { 14290 html.attr( 'src', '//view.vzaar.com/' + video.id + '/player?autoplay=true' ); 14291 } 14292 14293 iframe = $(html).wrap( '<div class="owl-video-frame" />' ).insertAfter(item.find('.owl-video')); 14294 14295 this._playing = item.addClass('owl-video-playing'); 14296 }; 14297 14298 /** 14299 * Checks whether an video is currently in full screen mode or not. 14300 * @todo Bad style because looks like a readonly method but changes members. 14301 * @protected 14302 * @returns {Boolean} 14303 */ 14304 Video.prototype.isInFullScreen = function() { 14305 var element = document.fullscreenElement || document.mozFullScreenElement || 14306 document.webkitFullscreenElement; 14307 14308 return element && $(element).parent().hasClass('owl-video-frame'); 14309 }; 14310 14311 /** 14312 * Destroys the plugin. 14313 */ 14314 Video.prototype.destroy = function() { 14315 var handler, property; 14316 14317 this._core.$element.off('click.owl.video'); 14318 14319 for (handler in this._handlers) { 14320 this._core.$element.off(handler, this._handlers[handler]); 14321 } 14322 for (property in Object.getOwnPropertyNames(this)) { 14323 typeof this[property] != 'function' && (this[property] = null); 14324 } 14325 }; 14326 14327 $.fn.owlCarousel.Constructor.Plugins.Video = Video; 14328 14329})(window.Zepto || window.jQuery, window, document); 14330 14331/** 14332 * Animate Plugin 14333 * @version 2.3.4 14334 * @author Bartosz Wojciechowski 14335 * @author David Deutsch 14336 * @license The MIT License (MIT) 14337 */ 14338;(function($, window, document, undefined) { 14339 14340 /** 14341 * Creates the animate plugin. 14342 * @class The Navigation Plugin 14343 * @param {Owl} scope - The Owl Carousel 14344 */ 14345 var Animate = function(scope) { 14346 this.core = scope; 14347 this.core.options = $.extend({}, Animate.Defaults, this.core.options); 14348 this.swapping = true; 14349 this.previous = undefined; 14350 this.next = undefined; 14351 14352 this.handlers = { 14353 'change.owl.carousel': $.proxy(function(e) { 14354 if (e.namespace && e.property.name == 'position') { 14355 this.previous = this.core.current(); 14356 this.next = e.property.value; 14357 } 14358 }, this), 14359 'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) { 14360 if (e.namespace) { 14361 this.swapping = e.type == 'translated'; 14362 } 14363 }, this), 14364 'translate.owl.carousel': $.proxy(function(e) { 14365 if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) { 14366 this.swap(); 14367 } 14368 }, this) 14369 }; 14370 14371 this.core.$element.on(this.handlers); 14372 }; 14373 14374 /** 14375 * Default options. 14376 * @public 14377 */ 14378 Animate.Defaults = { 14379 animateOut: false, 14380 animateIn: false 14381 }; 14382 14383 /** 14384 * Toggles the animation classes whenever an translations starts. 14385 * @protected 14386 * @returns {Boolean|undefined} 14387 */ 14388 Animate.prototype.swap = function() { 14389 14390 if (this.core.settings.items !== 1) { 14391 return; 14392 } 14393 14394 if (!$.support.animation || !$.support.transition) { 14395 return; 14396 } 14397 14398 this.core.speed(0); 14399 14400 var left, 14401 clear = $.proxy(this.clear, this), 14402 previous = this.core.$stage.children().eq(this.previous), 14403 next = this.core.$stage.children().eq(this.next), 14404 incoming = this.core.settings.animateIn, 14405 outgoing = this.core.settings.animateOut; 14406 14407 if (this.core.current() === this.previous) { 14408 return; 14409 } 14410 14411 if (outgoing) { 14412 left = this.core.coordinates(this.previous) - this.core.coordinates(this.next); 14413 previous.one($.support.animation.end, clear) 14414 .css( { 'left': left + 'px' } ) 14415 .addClass('animated owl-animated-out') 14416 .addClass(outgoing); 14417 } 14418 14419 if (incoming) { 14420 next.one($.support.animation.end, clear) 14421 .addClass('animated owl-animated-in') 14422 .addClass(incoming); 14423 } 14424 }; 14425 14426 Animate.prototype.clear = function(e) { 14427 $(e.target).css( { 'left': '' } ) 14428 .removeClass('animated owl-animated-out owl-animated-in') 14429 .removeClass(this.core.settings.animateIn) 14430 .removeClass(this.core.settings.animateOut); 14431 this.core.onTransitionEnd(); 14432 }; 14433 14434 /** 14435 * Destroys the plugin. 14436 * @public 14437 */ 14438 Animate.prototype.destroy = function() { 14439 var handler, property; 14440 14441 for (handler in this.handlers) { 14442 this.core.$element.off(handler, this.handlers[handler]); 14443 } 14444 for (property in Object.getOwnPropertyNames(this)) { 14445 typeof this[property] != 'function' && (this[property] = null); 14446 } 14447 }; 14448 14449 $.fn.owlCarousel.Constructor.Plugins.Animate = Animate; 14450 14451})(window.Zepto || window.jQuery, window, document); 14452 14453/** 14454 * Autoplay Plugin 14455 * @version 2.3.4 14456 * @author Bartosz Wojciechowski 14457 * @author Artus Kolanowski 14458 * @author David Deutsch 14459 * @author Tom De Caluwé 14460 * @license The MIT License (MIT) 14461 */ 14462;(function($, window, document, undefined) { 14463 14464 /** 14465 * Creates the autoplay plugin. 14466 * @class The Autoplay Plugin 14467 * @param {Owl} scope - The Owl Carousel 14468 */ 14469 var Autoplay = function(carousel) { 14470 /** 14471 * Reference to the core. 14472 * @protected 14473 * @type {Owl} 14474 */ 14475 this._core = carousel; 14476 14477 /** 14478 * The autoplay timeout id. 14479 * @type {Number} 14480 */ 14481 this._call = null; 14482 14483 /** 14484 * Depending on the state of the plugin, this variable contains either 14485 * the start time of the timer or the current timer value if it's 14486 * paused. Since we start in a paused state we initialize the timer 14487 * value. 14488 * @type {Number} 14489 */ 14490 this._time = 0; 14491 14492 /** 14493 * Stores the timeout currently used. 14494 * @type {Number} 14495 */ 14496 this._timeout = 0; 14497 14498 /** 14499 * Indicates whenever the autoplay is paused. 14500 * @type {Boolean} 14501 */ 14502 this._paused = true; 14503 14504 /** 14505 * All event handlers. 14506 * @protected 14507 * @type {Object} 14508 */ 14509 this._handlers = { 14510 'changed.owl.carousel': $.proxy(function(e) { 14511 if (e.namespace && e.property.name === 'settings') { 14512 if (this._core.settings.autoplay) { 14513 this.play(); 14514 } else { 14515 this.stop(); 14516 } 14517 } else if (e.namespace && e.property.name === 'position' && this._paused) { 14518 // Reset the timer. This code is triggered when the position 14519 // of the carousel was changed through user interaction. 14520 this._time = 0; 14521 } 14522 }, this), 14523 'initialized.owl.carousel': $.proxy(function(e) { 14524 if (e.namespace && this._core.settings.autoplay) { 14525 this.play(); 14526 } 14527 }, this), 14528 'play.owl.autoplay': $.proxy(function(e, t, s) { 14529 if (e.namespace) { 14530 this.play(t, s); 14531 } 14532 }, this), 14533 'stop.owl.autoplay': $.proxy(function(e) { 14534 if (e.namespace) { 14535 this.stop(); 14536 } 14537 }, this), 14538 'mouseover.owl.autoplay': $.proxy(function() { 14539 if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { 14540 this.pause(); 14541 } 14542 }, this), 14543 'mouseleave.owl.autoplay': $.proxy(function() { 14544 if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { 14545 this.play(); 14546 } 14547 }, this), 14548 'touchstart.owl.core': $.proxy(function() { 14549 if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { 14550 this.pause(); 14551 } 14552 }, this), 14553 'touchend.owl.core': $.proxy(function() { 14554 if (this._core.settings.autoplayHoverPause) { 14555 this.play(); 14556 } 14557 }, this) 14558 }; 14559 14560 // register event handlers 14561 this._core.$element.on(this._handlers); 14562 14563 // set default options 14564 this._core.options = $.extend({}, Autoplay.Defaults, this._core.options); 14565 }; 14566 14567 /** 14568 * Default options. 14569 * @public 14570 */ 14571 Autoplay.Defaults = { 14572 autoplay: false, 14573 autoplayTimeout: 5000, 14574 autoplayHoverPause: false, 14575 autoplaySpeed: false 14576 }; 14577 14578 /** 14579 * Transition to the next slide and set a timeout for the next transition. 14580 * @private 14581 * @param {Number} [speed] - The animation speed for the animations. 14582 */ 14583 Autoplay.prototype._next = function(speed) { 14584 this._call = window.setTimeout( 14585 $.proxy(this._next, this, speed), 14586 this._timeout * (Math.round(this.read() / this._timeout) + 1) - this.read() 14587 ); 14588 14589 if (this._core.is('interacting') || document.hidden) { 14590 return; 14591 } 14592 this._core.next(speed || this._core.settings.autoplaySpeed); 14593 } 14594 14595 /** 14596 * Reads the current timer value when the timer is playing. 14597 * @public 14598 */ 14599 Autoplay.prototype.read = function() { 14600 return new Date().getTime() - this._time; 14601 }; 14602 14603 /** 14604 * Starts the autoplay. 14605 * @public 14606 * @param {Number} [timeout] - The interval before the next animation starts. 14607 * @param {Number} [speed] - The animation speed for the animations. 14608 */ 14609 Autoplay.prototype.play = function(timeout, speed) { 14610 var elapsed; 14611 14612 if (!this._core.is('rotating')) { 14613 this._core.enter('rotating'); 14614 } 14615 14616 timeout = timeout || this._core.settings.autoplayTimeout; 14617 14618 // Calculate the elapsed time since the last transition. If the carousel 14619 // wasn't playing this calculation will yield zero. 14620 elapsed = Math.min(this._time % (this._timeout || timeout), timeout); 14621 14622 if (this._paused) { 14623 // Start the clock. 14624 this._time = this.read(); 14625 this._paused = false; 14626 } else { 14627 // Clear the active timeout to allow replacement. 14628 window.clearTimeout(this._call); 14629 } 14630 14631 // Adjust the origin of the timer to match the new timeout value. 14632 this._time += this.read() % timeout - elapsed; 14633 14634 this._timeout = timeout; 14635 this._call = window.setTimeout($.proxy(this._next, this, speed), timeout - elapsed); 14636 }; 14637 14638 /** 14639 * Stops the autoplay. 14640 * @public 14641 */ 14642 Autoplay.prototype.stop = function() { 14643 if (this._core.is('rotating')) { 14644 // Reset the clock. 14645 this._time = 0; 14646 this._paused = true; 14647 14648 window.clearTimeout(this._call); 14649 this._core.leave('rotating'); 14650 } 14651 }; 14652 14653 /** 14654 * Pauses the autoplay. 14655 * @public 14656 */ 14657 Autoplay.prototype.pause = function() { 14658 if (this._core.is('rotating') && !this._paused) { 14659 // Pause the clock. 14660 this._time = this.read(); 14661 this._paused = true; 14662 14663 window.clearTimeout(this._call); 14664 } 14665 }; 14666 14667 /** 14668 * Destroys the plugin. 14669 */ 14670 Autoplay.prototype.destroy = function() { 14671 var handler, property; 14672 14673 this.stop(); 14674 14675 for (handler in this._handlers) { 14676 this._core.$element.off(handler, this._handlers[handler]); 14677 } 14678 for (property in Object.getOwnPropertyNames(this)) { 14679 typeof this[property] != 'function' && (this[property] = null); 14680 } 14681 }; 14682 14683 $.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay; 14684 14685})(window.Zepto || window.jQuery, window, document); 14686 14687/** 14688 * Navigation Plugin 14689 * @version 2.3.4 14690 * @author Artus Kolanowski 14691 * @author David Deutsch 14692 * @license The MIT License (MIT) 14693 */ 14694;(function($, window, document, undefined) { 14695 'use strict'; 14696 14697 /** 14698 * Creates the navigation plugin. 14699 * @class The Navigation Plugin 14700 * @param {Owl} carousel - The Owl Carousel. 14701 */ 14702 var Navigation = function(carousel) { 14703 /** 14704 * Reference to the core. 14705 * @protected 14706 * @type {Owl} 14707 */ 14708 this._core = carousel; 14709 14710 /** 14711 * Indicates whether the plugin is initialized or not. 14712 * @protected 14713 * @type {Boolean} 14714 */ 14715 this._initialized = false; 14716 14717 /** 14718 * The current paging indexes. 14719 * @protected 14720 * @type {Array} 14721 */ 14722 this._pages = []; 14723 14724 /** 14725 * All DOM elements of the user interface. 14726 * @protected 14727 * @type {Object} 14728 */ 14729 this._controls = {}; 14730 14731 /** 14732 * Markup for an indicator. 14733 * @protected 14734 * @type {Array.<String>} 14735 */ 14736 this._templates = []; 14737 14738 /** 14739 * The carousel element. 14740 * @type {jQuery} 14741 */ 14742 this.$element = this._core.$element; 14743 14744 /** 14745 * Overridden methods of the carousel. 14746 * @protected 14747 * @type {Object} 14748 */ 14749 this._overrides = { 14750 next: this._core.next, 14751 prev: this._core.prev, 14752 to: this._core.to 14753 }; 14754 14755 /** 14756 * All event handlers. 14757 * @protected 14758 * @type {Object} 14759 */ 14760 this._handlers = { 14761 'prepared.owl.carousel': $.proxy(function(e) { 14762 if (e.namespace && this._core.settings.dotsData) { 14763 this._templates.push('<div class="' + this._core.settings.dotClass + '">' + 14764 $(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '</div>'); 14765 } 14766 }, this), 14767 'added.owl.carousel': $.proxy(function(e) { 14768 if (e.namespace && this._core.settings.dotsData) { 14769 this._templates.splice(e.position, 0, this._templates.pop()); 14770 } 14771 }, this), 14772 'remove.owl.carousel': $.proxy(function(e) { 14773 if (e.namespace && this._core.settings.dotsData) { 14774 this._templates.splice(e.position, 1); 14775 } 14776 }, this), 14777 'changed.owl.carousel': $.proxy(function(e) { 14778 if (e.namespace && e.property.name == 'position') { 14779 this.draw(); 14780 } 14781 }, this), 14782 'initialized.owl.carousel': $.proxy(function(e) { 14783 if (e.namespace && !this._initialized) { 14784 this._core.trigger('initialize', null, 'navigation'); 14785 this.initialize(); 14786 this.update(); 14787 this.draw(); 14788 this._initialized = true; 14789 this._core.trigger('initialized', null, 'navigation'); 14790 } 14791 }, this), 14792 'refreshed.owl.carousel': $.proxy(function(e) { 14793 if (e.namespace && this._initialized) { 14794 this._core.trigger('refresh', null, 'navigation'); 14795 this.update(); 14796 this.draw(); 14797 this._core.trigger('refreshed', null, 'navigation'); 14798 } 14799 }, this) 14800 }; 14801 14802 // set default options 14803 this._core.options = $.extend({}, Navigation.Defaults, this._core.options); 14804 14805 // register event handlers 14806 this.$element.on(this._handlers); 14807 }; 14808 14809 /** 14810 * Default options. 14811 * @public 14812 * @todo Rename `slideBy` to `navBy` 14813 */ 14814 Navigation.Defaults = { 14815 nav: false, 14816 navText: [ 14817 '<span aria-label="' + 'Previous' + '">‹</span>', 14818 '<span aria-label="' + 'Next' + '">›</span>' 14819 ], 14820 navSpeed: false, 14821 navElement: 'button type="button" role="presentation"', 14822 navContainer: false, 14823 navContainerClass: 'owl-nav', 14824 navClass: [ 14825 'owl-prev', 14826 'owl-next' 14827 ], 14828 slideBy: 1, 14829 dotClass: 'owl-dot', 14830 dotsClass: 'owl-dots', 14831 dots: true, 14832 dotsEach: false, 14833 dotsData: false, 14834 dotsSpeed: false, 14835 dotsContainer: false 14836 }; 14837 14838 /** 14839 * Initializes the layout of the plugin and extends the carousel. 14840 * @protected 14841 */ 14842 Navigation.prototype.initialize = function() { 14843 var override, 14844 settings = this._core.settings; 14845 14846 // create DOM structure for relative navigation 14847 this._controls.$relative = (settings.navContainer ? $(settings.navContainer) 14848 : $('<div>').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled'); 14849 14850 this._controls.$previous = $('<' + settings.navElement + '>') 14851 .addClass(settings.navClass[0]) 14852 .html(settings.navText[0]) 14853 .prependTo(this._controls.$relative) 14854 .on('click', $.proxy(function(e) { 14855 this.prev(settings.navSpeed); 14856 }, this)); 14857 this._controls.$next = $('<' + settings.navElement + '>') 14858 .addClass(settings.navClass[1]) 14859 .html(settings.navText[1]) 14860 .appendTo(this._controls.$relative) 14861 .on('click', $.proxy(function(e) { 14862 this.next(settings.navSpeed); 14863 }, this)); 14864 14865 // create DOM structure for absolute navigation 14866 if (!settings.dotsData) { 14867 this._templates = [ $('<button role="button">') 14868 .addClass(settings.dotClass) 14869 .append($('<span>')) 14870 .prop('outerHTML') ]; 14871 } 14872 14873 this._controls.$absolute = (settings.dotsContainer ? $(settings.dotsContainer) 14874 : $('<div>').addClass(settings.dotsClass).appendTo(this.$element)).addClass('disabled'); 14875 14876 this._controls.$absolute.on('click', 'button', $.proxy(function(e) { 14877 var index = $(e.target).parent().is(this._controls.$absolute) 14878 ? $(e.target).index() : $(e.target).parent().index(); 14879 14880 e.preventDefault(); 14881 14882 this.to(index, settings.dotsSpeed); 14883 }, this)); 14884 14885 /*$el.on('focusin', function() { 14886 $(document).off(".carousel"); 14887 14888 $(document).on('keydown.carousel', function(e) { 14889 if(e.keyCode == 37) { 14890 $el.trigger('prev.owl') 14891 } 14892 if(e.keyCode == 39) { 14893 $el.trigger('next.owl') 14894 } 14895 }); 14896 });*/ 14897 14898 // override public methods of the carousel 14899 for (override in this._overrides) { 14900 this._core[override] = $.proxy(this[override], this); 14901 } 14902 }; 14903 14904 /** 14905 * Destroys the plugin. 14906 * @protected 14907 */ 14908 Navigation.prototype.destroy = function() { 14909 var handler, control, property, override, settings; 14910 settings = this._core.settings; 14911 14912 for (handler in this._handlers) { 14913 this.$element.off(handler, this._handlers[handler]); 14914 } 14915 for (control in this._controls) { 14916 if (control === '$relative' && settings.navContainer) { 14917 this._controls[control].html(''); 14918 } else { 14919 this._controls[control].remove(); 14920 } 14921 } 14922 for (override in this.overides) { 14923 this._core[override] = this._overrides[override]; 14924 } 14925 for (property in Object.getOwnPropertyNames(this)) { 14926 typeof this[property] != 'function' && (this[property] = null); 14927 } 14928 }; 14929 14930 /** 14931 * Updates the internal state. 14932 * @protected 14933 */ 14934 Navigation.prototype.update = function() { 14935 var i, j, k, 14936 lower = this._core.clones().length / 2, 14937 upper = lower + this._core.items().length, 14938 maximum = this._core.maximum(true), 14939 settings = this._core.settings, 14940 size = settings.center || settings.autoWidth || settings.dotsData 14941 ? 1 : settings.dotsEach || settings.items; 14942 14943 if (settings.slideBy !== 'page') { 14944 settings.slideBy = Math.min(settings.slideBy, settings.items); 14945 } 14946 14947 if (settings.dots || settings.slideBy == 'page') { 14948 this._pages = []; 14949 14950 for (i = lower, j = 0, k = 0; i < upper; i++) { 14951 if (j >= size || j === 0) { 14952 this._pages.push({ 14953 start: Math.min(maximum, i - lower), 14954 end: i - lower + size - 1 14955 }); 14956 if (Math.min(maximum, i - lower) === maximum) { 14957 break; 14958 } 14959 j = 0, ++k; 14960 } 14961 j += this._core.mergers(this._core.relative(i)); 14962 } 14963 } 14964 }; 14965 14966 /** 14967 * Draws the user interface. 14968 * @todo The option `dotsData` wont work. 14969 * @protected 14970 */ 14971 Navigation.prototype.draw = function() { 14972 var difference, 14973 settings = this._core.settings, 14974 disabled = this._core.items().length <= settings.items, 14975 index = this._core.relative(this._core.current()), 14976 loop = settings.loop || settings.rewind; 14977 14978 this._controls.$relative.toggleClass('disabled', !settings.nav || disabled); 14979 14980 if (settings.nav) { 14981 this._controls.$previous.toggleClass('disabled', !loop && index <= this._core.minimum(true)); 14982 this._controls.$next.toggleClass('disabled', !loop && index >= this._core.maximum(true)); 14983 } 14984 14985 this._controls.$absolute.toggleClass('disabled', !settings.dots || disabled); 14986 14987 if (settings.dots) { 14988 difference = this._pages.length - this._controls.$absolute.children().length; 14989 14990 if (settings.dotsData && difference !== 0) { 14991 this._controls.$absolute.html(this._templates.join('')); 14992 } else if (difference > 0) { 14993 this._controls.$absolute.append(new Array(difference + 1).join(this._templates[0])); 14994 } else if (difference < 0) { 14995 this._controls.$absolute.children().slice(difference).remove(); 14996 } 14997 14998 this._controls.$absolute.find('.active').removeClass('active'); 14999 this._controls.$absolute.children().eq($.inArray(this.current(), this._pages)).addClass('active'); 15000 } 15001 }; 15002 15003 /** 15004 * Extends event data. 15005 * @protected 15006 * @param {Event} event - The event object which gets thrown. 15007 */ 15008 Navigation.prototype.onTrigger = function(event) { 15009 var settings = this._core.settings; 15010 15011 event.page = { 15012 index: $.inArray(this.current(), this._pages), 15013 count: this._pages.length, 15014 size: settings && (settings.center || settings.autoWidth || settings.dotsData 15015 ? 1 : settings.dotsEach || settings.items) 15016 }; 15017 }; 15018 15019 /** 15020 * Gets the current page position of the carousel. 15021 * @protected 15022 * @returns {Number} 15023 */ 15024 Navigation.prototype.current = function() { 15025 var current = this._core.relative(this._core.current()); 15026 return $.grep(this._pages, $.proxy(function(page, index) { 15027 return page.start <= current && page.end >= current; 15028 }, this)).pop(); 15029 }; 15030 15031 /** 15032 * Gets the current succesor/predecessor position. 15033 * @protected 15034 * @returns {Number} 15035 */ 15036 Navigation.prototype.getPosition = function(successor) { 15037 var position, length, 15038 settings = this._core.settings; 15039 15040 if (settings.slideBy == 'page') { 15041 position = $.inArray(this.current(), this._pages); 15042 length = this._pages.length; 15043 successor ? ++position : --position; 15044 position = this._pages[((position % length) + length) % length].start; 15045 } else { 15046 position = this._core.relative(this._core.current()); 15047 length = this._core.items().length; 15048 successor ? position += settings.slideBy : position -= settings.slideBy; 15049 } 15050 15051 return position; 15052 }; 15053 15054 /** 15055 * Slides to the next item or page. 15056 * @public 15057 * @param {Number} [speed=false] - The time in milliseconds for the transition. 15058 */ 15059 Navigation.prototype.next = function(speed) { 15060 $.proxy(this._overrides.to, this._core)(this.getPosition(true), speed); 15061 }; 15062 15063 /** 15064 * Slides to the previous item or page. 15065 * @public 15066 * @param {Number} [speed=false] - The time in milliseconds for the transition. 15067 */ 15068 Navigation.prototype.prev = function(speed) { 15069 $.proxy(this._overrides.to, this._core)(this.getPosition(false), speed); 15070 }; 15071 15072 /** 15073 * Slides to the specified item or page. 15074 * @public 15075 * @param {Number} position - The position of the item or page. 15076 * @param {Number} [speed] - The time in milliseconds for the transition. 15077 * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not. 15078 */ 15079 Navigation.prototype.to = function(position, speed, standard) { 15080 var length; 15081 15082 if (!standard && this._pages.length) { 15083 length = this._pages.length; 15084 $.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed); 15085 } else { 15086 $.proxy(this._overrides.to, this._core)(position, speed); 15087 } 15088 }; 15089 15090 $.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation; 15091 15092})(window.Zepto || window.jQuery, window, document); 15093 15094/** 15095 * Hash Plugin 15096 * @version 2.3.4 15097 * @author Artus Kolanowski 15098 * @author David Deutsch 15099 * @license The MIT License (MIT) 15100 */ 15101;(function($, window, document, undefined) { 15102 'use strict'; 15103 15104 /** 15105 * Creates the hash plugin. 15106 * @class The Hash Plugin 15107 * @param {Owl} carousel - The Owl Carousel 15108 */ 15109 var Hash = function(carousel) { 15110 /** 15111 * Reference to the core. 15112 * @protected 15113 * @type {Owl} 15114 */ 15115 this._core = carousel; 15116 15117 /** 15118 * Hash index for the items. 15119 * @protected 15120 * @type {Object} 15121 */ 15122 this._hashes = {}; 15123 15124 /** 15125 * The carousel element. 15126 * @type {jQuery} 15127 */ 15128 this.$element = this._core.$element; 15129 15130 /** 15131 * All event handlers. 15132 * @protected 15133 * @type {Object} 15134 */ 15135 this._handlers = { 15136 'initialized.owl.carousel': $.proxy(function(e) { 15137 if (e.namespace && this._core.settings.startPosition === 'URLHash') { 15138 $(window).trigger('hashchange.owl.navigation'); 15139 } 15140 }, this), 15141 'prepared.owl.carousel': $.proxy(function(e) { 15142 if (e.namespace) { 15143 var hash = $(e.content).find('[data-hash]').addBack('[data-hash]').attr('data-hash'); 15144 15145 if (!hash) { 15146 return; 15147 } 15148 15149 this._hashes[hash] = e.content; 15150 } 15151 }, this), 15152 'changed.owl.carousel': $.proxy(function(e) { 15153 if (e.namespace && e.property.name === 'position') { 15154 var current = this._core.items(this._core.relative(this._core.current())), 15155 hash = $.map(this._hashes, function(item, hash) { 15156 return item === current ? hash : null; 15157 }).join(); 15158 15159 if (!hash || window.location.hash.slice(1) === hash) { 15160 return; 15161 } 15162 15163 window.location.hash = hash; 15164 } 15165 }, this) 15166 }; 15167 15168 // set default options 15169 this._core.options = $.extend({}, Hash.Defaults, this._core.options); 15170 15171 // register the event handlers 15172 this.$element.on(this._handlers); 15173 15174 // register event listener for hash navigation 15175 $(window).on('hashchange.owl.navigation', $.proxy(function(e) { 15176 var hash = window.location.hash.substring(1), 15177 items = this._core.$stage.children(), 15178 position = this._hashes[hash] && items.index(this._hashes[hash]); 15179 15180 if (position === undefined || position === this._core.current()) { 15181 return; 15182 } 15183 15184 this._core.to(this._core.relative(position), false, true); 15185 }, this)); 15186 }; 15187 15188 /** 15189 * Default options. 15190 * @public 15191 */ 15192 Hash.Defaults = { 15193 URLhashListener: false 15194 }; 15195 15196 /** 15197 * Destroys the plugin. 15198 * @public 15199 */ 15200 Hash.prototype.destroy = function() { 15201 var handler, property; 15202 15203 $(window).off('hashchange.owl.navigation'); 15204 15205 for (handler in this._handlers) { 15206 this._core.$element.off(handler, this._handlers[handler]); 15207 } 15208 for (property in Object.getOwnPropertyNames(this)) { 15209 typeof this[property] != 'function' && (this[property] = null); 15210 } 15211 }; 15212 15213 $.fn.owlCarousel.Constructor.Plugins.Hash = Hash; 15214 15215})(window.Zepto || window.jQuery, window, document); 15216 15217/** 15218 * Support Plugin 15219 * 15220 * @version 2.3.4 15221 * @author Vivid Planet Software GmbH 15222 * @author Artus Kolanowski 15223 * @author David Deutsch 15224 * @license The MIT License (MIT) 15225 */ 15226;(function($, window, document, undefined) { 15227 15228 var style = $('<support>').get(0).style, 15229 prefixes = 'Webkit Moz O ms'.split(' '), 15230 events = { 15231 transition: { 15232 end: { 15233 WebkitTransition: 'webkitTransitionEnd', 15234 MozTransition: 'transitionend', 15235 OTransition: 'oTransitionEnd', 15236 transition: 'transitionend' 15237 } 15238 }, 15239 animation: { 15240 end: { 15241 WebkitAnimation: 'webkitAnimationEnd', 15242 MozAnimation: 'animationend', 15243 OAnimation: 'oAnimationEnd', 15244 animation: 'animationend' 15245 } 15246 } 15247 }, 15248 tests = { 15249 csstransforms: function() { 15250 return !!test('transform'); 15251 }, 15252 csstransforms3d: function() { 15253 return !!test('perspective'); 15254 }, 15255 csstransitions: function() { 15256 return !!test('transition'); 15257 }, 15258 cssanimations: function() { 15259 return !!test('animation'); 15260 } 15261 }; 15262 15263 function test(property, prefixed) { 15264 var result = false, 15265 upper = property.charAt(0).toUpperCase() + property.slice(1); 15266 15267 $.each((property + ' ' + prefixes.join(upper + ' ') + upper).split(' '), function(i, property) { 15268 if (style[property] !== undefined) { 15269 result = prefixed ? property : true; 15270 return false; 15271 } 15272 }); 15273 15274 return result; 15275 } 15276 15277 function prefixed(property) { 15278 return test(property, true); 15279 } 15280 15281 if (tests.csstransitions()) { 15282 /* jshint -W053 */ 15283 $.support.transition = new String(prefixed('transition')) 15284 $.support.transition.end = events.transition.end[ $.support.transition ]; 15285 } 15286 15287 if (tests.cssanimations()) { 15288 /* jshint -W053 */ 15289 $.support.animation = new String(prefixed('animation')) 15290 $.support.animation.end = events.animation.end[ $.support.animation ]; 15291 } 15292 15293 if (tests.csstransforms()) { 15294 /* jshint -W053 */ 15295 $.support.transform = new String(prefixed('transform')); 15296 $.support.transform3d = tests.csstransforms3d(); 15297 } 15298 15299})(window.Zepto || window.jQuery, window, document); 15300 15301 15302/***/ }), 15303
vendor: 163,084 bytes, lines 15304-19815
15304/***/ "./node_modules/sweetalert2/dist/sweetalert2.all.js": 15305/*!**********************************************************!*\ 15306 !*** ./node_modules/sweetalert2/dist/sweetalert2.all.js ***! 15307 \**********************************************************/ 15308/***/ (function(module) { 15309 15310/*! 15311* sweetalert2 v11.14.5 15312* Released under the MIT License. 15313*/ 15314(function (global, factory) { 15315 true ? module.exports = factory() : 15316 0; 15317})(this, (function () { 'use strict'; 15318 15319 function _assertClassBrand(e, t, n) { 15320 if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; 15321 throw new TypeError("Private element is not present on this object"); 15322 } 15323 function _checkPrivateRedeclaration(e, t) { 15324 if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); 15325 } 15326 function _classPrivateFieldGet2(s, a) { 15327 return s.get(_assertClassBrand(s, a)); 15328 } 15329 function _classPrivateFieldInitSpec(e, t, a) { 15330 _checkPrivateRedeclaration(e, t), t.set(e, a); 15331 } 15332 function _classPrivateFieldSet2(s, a, r) { 15333 return s.set(_assertClassBrand(s, a), r), r; 15334 } 15335 15336 const RESTORE_FOCUS_TIMEOUT = 100; 15337 15338 /** @type {GlobalState} */ 15339 const globalState = {}; 15340 const focusPreviousActiveElement = () => { 15341 if (globalState.previousActiveElement instanceof HTMLElement) { 15342 globalState.previousActiveElement.focus(); 15343 globalState.previousActiveElement = null; 15344 } else if (document.body) { 15345 document.body.focus(); 15346 } 15347 }; 15348 15349 /** 15350 * Restore previous active (focused) element 15351 * 15352 * @param {boolean} returnFocus 15353 * @returns {Promise<void>} 15354 */ 15355 const restoreActiveElement = returnFocus => { 15356 return new Promise(resolve => { 15357 if (!returnFocus) { 15358 return resolve(); 15359 } 15360 const x = window.scrollX; 15361 const y = window.scrollY; 15362 globalState.restoreFocusTimeout = setTimeout(() => { 15363 focusPreviousActiveElement(); 15364 resolve(); 15365 }, RESTORE_FOCUS_TIMEOUT); // issues/900 15366 15367 window.scrollTo(x, y); 15368 }); 15369 }; 15370 15371 const swalPrefix = 'swal2-'; 15372 15373 /** 15374 * @typedef {Record<SwalClass, string>} SwalClasses 15375 */ 15376 15377 /** 15378 * @typedef {'success' | 'warning' | 'info' | 'question' | 'error'} SwalIcon 15379 * @typedef {Record<SwalIcon, string>} SwalIcons 15380 */ 15381 15382 /** @type {SwalClass[]} */ 15383 const classNames = ['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'no-transition', 'toast', 'toast-shown', 'show', 'hide', 'close', 'title', 'html-container', 'actions', 'confirm', 'deny', 'cancel', 'default-outline', 'footer', 'icon', 'icon-content', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'input-label', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loader', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen', 'rtl', 'timer-progress-bar', 'timer-progress-bar-container', 'scrollbar-measure', 'icon-success', 'icon-warning', 'icon-info', 'icon-question', 'icon-error']; 15384 const swalClasses = classNames.reduce((acc, className) => { 15385 acc[className] = swalPrefix + className; 15386 return acc; 15387 }, /** @type {SwalClasses} */{}); 15388 15389 /** @type {SwalIcon[]} */ 15390 const icons = ['success', 'warning', 'info', 'question', 'error']; 15391 const iconTypes = icons.reduce((acc, icon) => { 15392 acc[icon] = swalPrefix + icon; 15393 return acc; 15394 }, /** @type {SwalIcons} */{}); 15395 15396 const consolePrefix = 'SweetAlert2:'; 15397 15398 /** 15399 * Capitalize the first letter of a string 15400 * 15401 * @param {string} str 15402 * @returns {string} 15403 */ 15404 const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1); 15405 15406 /** 15407 * Standardize console warnings 15408 * 15409 * @param {string | string[]} message 15410 */ 15411 const warn = message => { 15412 console.warn(`${consolePrefix} ${typeof message === 'object' ? message.join(' ') : message}`); 15413 }; 15414 15415 /** 15416 * Standardize console errors 15417 * 15418 * @param {string} message 15419 */ 15420 const error = message => { 15421 console.error(`${consolePrefix} ${message}`); 15422 }; 15423 15424 /** 15425 * Private global state for `warnOnce` 15426 * 15427 * @type {string[]} 15428 * @private 15429 */ 15430 const previousWarnOnceMessages = []; 15431 15432 /** 15433 * Show a console warning, but only if it hasn't already been shown 15434 * 15435 * @param {string} message 15436 */ 15437 const warnOnce = message => { 15438 if (!previousWarnOnceMessages.includes(message)) { 15439 previousWarnOnceMessages.push(message); 15440 warn(message); 15441 } 15442 }; 15443 15444 /** 15445 * Show a one-time console warning about deprecated params/methods 15446 * 15447 * @param {string} deprecatedParam 15448 * @param {string?} useInstead 15449 */ 15450 const warnAboutDeprecation = function (deprecatedParam) { 15451 let useInstead = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 15452 warnOnce(`"${deprecatedParam}" is deprecated and will be removed in the next major release.${useInstead ? ` Use "${useInstead}" instead.` : ''}`); 15453 }; 15454 15455 /** 15456 * If `arg` is a function, call it (with no arguments or context) and return the result. 15457 * Otherwise, just pass the value through 15458 * 15459 * @param {Function | any} arg 15460 * @returns {any} 15461 */ 15462 const callIfFunction = arg => typeof arg === 'function' ? arg() : arg; 15463 15464 /** 15465 * @param {any} arg 15466 * @returns {boolean} 15467 */ 15468 const hasToPromiseFn = arg => arg && typeof arg.toPromise === 'function'; 15469 15470 /** 15471 * @param {any} arg 15472 * @returns {Promise<any>} 15473 */ 15474 const asPromise = arg => hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg); 15475 15476 /** 15477 * @param {any} arg 15478 * @returns {boolean} 15479 */ 15480 const isPromise = arg => arg && Promise.resolve(arg) === arg; 15481 15482 /** 15483 * Gets the popup container which contains the backdrop and the popup itself. 15484 * 15485 * @returns {HTMLElement | null} 15486 */ 15487 const getContainer = () => document.body.querySelector(`.${swalClasses.container}`); 15488 15489 /** 15490 * @param {string} selectorString 15491 * @returns {HTMLElement | null} 15492 */ 15493 const elementBySelector = selectorString => { 15494 const container = getContainer(); 15495 return container ? container.querySelector(selectorString) : null; 15496 }; 15497 15498 /** 15499 * @param {string} className 15500 * @returns {HTMLElement | null} 15501 */ 15502 const elementByClass = className => { 15503 return elementBySelector(`.${className}`); 15504 }; 15505 15506 /** 15507 * @returns {HTMLElement | null} 15508 */ 15509 const getPopup = () => elementByClass(swalClasses.popup); 15510 15511 /** 15512 * @returns {HTMLElement | null} 15513 */ 15514 const getIcon = () => elementByClass(swalClasses.icon); 15515 15516 /** 15517 * @returns {HTMLElement | null} 15518 */ 15519 const getIconContent = () => elementByClass(swalClasses['icon-content']); 15520 15521 /** 15522 * @returns {HTMLElement | null} 15523 */ 15524 const getTitle = () => elementByClass(swalClasses.title); 15525 15526 /** 15527 * @returns {HTMLElement | null} 15528 */ 15529 const getHtmlContainer = () => elementByClass(swalClasses['html-container']); 15530 15531 /** 15532 * @returns {HTMLElement | null} 15533 */ 15534 const getImage = () => elementByClass(swalClasses.image); 15535 15536 /** 15537 * @returns {HTMLElement | null} 15538 */ 15539 const getProgressSteps = () => elementByClass(swalClasses['progress-steps']); 15540 15541 /** 15542 * @returns {HTMLElement | null} 15543 */ 15544 const getValidationMessage = () => elementByClass(swalClasses['validation-message']); 15545 15546 /** 15547 * @returns {HTMLButtonElement | null} 15548 */ 15549 const getConfirmButton = () => (/** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.confirm}`)); 15550 15551 /** 15552 * @returns {HTMLButtonElement | null} 15553 */ 15554 const getCancelButton = () => (/** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.cancel}`)); 15555 15556 /** 15557 * @returns {HTMLButtonElement | null} 15558 */ 15559 const getDenyButton = () => (/** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.deny}`)); 15560 15561 /** 15562 * @returns {HTMLElement | null} 15563 */ 15564 const getInputLabel = () => elementByClass(swalClasses['input-label']); 15565 15566 /** 15567 * @returns {HTMLElement | null} 15568 */ 15569 const getLoader = () => elementBySelector(`.${swalClasses.loader}`); 15570 15571 /** 15572 * @returns {HTMLElement | null} 15573 */ 15574 const getActions = () => elementByClass(swalClasses.actions); 15575 15576 /** 15577 * @returns {HTMLElement | null} 15578 */ 15579 const getFooter = () => elementByClass(swalClasses.footer); 15580 15581 /** 15582 * @returns {HTMLElement | null} 15583 */ 15584 const getTimerProgressBar = () => elementByClass(swalClasses['timer-progress-bar']); 15585 15586 /** 15587 * @returns {HTMLElement | null} 15588 */ 15589 const getCloseButton = () => elementByClass(swalClasses.close); 15590 15591 // https://github.com/jkup/focusable/blob/master/index.js 15592 const focusable = ` 15593 a[href], 15594 area[href], 15595 input:not([disabled]), 15596 select:not([disabled]), 15597 textarea:not([disabled]), 15598 button:not([disabled]), 15599 iframe, 15600 object, 15601 embed, 15602 [tabindex="0"], 15603 [contenteditable], 15604 audio[controls], 15605 video[controls], 15606 summary 15607`; 15608 /** 15609 * @returns {HTMLElement[]} 15610 */ 15611 const getFocusableElements = () => { 15612 const popup = getPopup(); 15613 if (!popup) { 15614 return []; 15615 } 15616 /** @type {NodeListOf<HTMLElement>} */ 15617 const focusableElementsWithTabindex = popup.querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])'); 15618 const focusableElementsWithTabindexSorted = Array.from(focusableElementsWithTabindex) 15619 // sort according to tabindex 15620 .sort((a, b) => { 15621 const tabindexA = parseInt(a.getAttribute('tabindex') || '0'); 15622 const tabindexB = parseInt(b.getAttribute('tabindex') || '0'); 15623 if (tabindexA > tabindexB) { 15624 return 1; 15625 } else if (tabindexA < tabindexB) { 15626 return -1; 15627 } 15628 return 0; 15629 }); 15630 15631 /** @type {NodeListOf<HTMLElement>} */ 15632 const otherFocusableElements = popup.querySelectorAll(focusable); 15633 const otherFocusableElementsFiltered = Array.from(otherFocusableElements).filter(el => el.getAttribute('tabindex') !== '-1'); 15634 return [...new Set(focusableElementsWithTabindexSorted.concat(otherFocusableElementsFiltered))].filter(el => isVisible$1(el)); 15635 }; 15636 15637 /** 15638 * @returns {boolean} 15639 */ 15640 const isModal = () => { 15641 return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']); 15642 }; 15643 15644 /** 15645 * @returns {boolean} 15646 */ 15647 const isToast = () => { 15648 const popup = getPopup(); 15649 if (!popup) { 15650 return false; 15651 } 15652 return hasClass(popup, swalClasses.toast); 15653 }; 15654 15655 /** 15656 * @returns {boolean} 15657 */ 15658 const isLoading = () => { 15659 const popup = getPopup(); 15660 if (!popup) { 15661 return false; 15662 } 15663 return popup.hasAttribute('data-loading'); 15664 }; 15665 15666 /** 15667 * Securely set innerHTML of an element 15668 * https://github.com/sweetalert2/sweetalert2/issues/1926 15669 * 15670 * @param {HTMLElement} elem 15671 * @param {string} html 15672 */ 15673 const setInnerHtml = (elem, html) => { 15674 elem.textContent = ''; 15675 if (html) { 15676 const parser = new DOMParser(); 15677 const parsed = parser.parseFromString(html, `text/html`); 15678 const head = parsed.querySelector('head'); 15679 if (head) { 15680 Array.from(head.childNodes).forEach(child => { 15681 elem.appendChild(child); 15682 }); 15683 } 15684 const body = parsed.querySelector('body'); 15685 if (body) { 15686 Array.from(body.childNodes).forEach(child => { 15687 if (child instanceof HTMLVideoElement || child instanceof HTMLAudioElement) { 15688 elem.appendChild(child.cloneNode(true)); // https://github.com/sweetalert2/sweetalert2/issues/2507 15689 } else { 15690 elem.appendChild(child); 15691 } 15692 }); 15693 } 15694 } 15695 }; 15696 15697 /** 15698 * @param {HTMLElement} elem 15699 * @param {string} className 15700 * @returns {boolean} 15701 */ 15702 const hasClass = (elem, className) => { 15703 if (!className) { 15704 return false; 15705 } 15706 const classList = className.split(/\s+/); 15707 for (let i = 0; i < classList.length; i++) { 15708 if (!elem.classList.contains(classList[i])) { 15709 return false; 15710 } 15711 } 15712 return true; 15713 }; 15714 15715 /** 15716 * @param {HTMLElement} elem 15717 * @param {SweetAlertOptions} params 15718 */ 15719 const removeCustomClasses = (elem, params) => { 15720 Array.from(elem.classList).forEach(className => { 15721 if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass || {}).includes(className)) { 15722 elem.classList.remove(className); 15723 } 15724 }); 15725 }; 15726 15727 /** 15728 * @param {HTMLElement} elem 15729 * @param {SweetAlertOptions} params 15730 * @param {string} className 15731 */ 15732 const applyCustomClass = (elem, params, className) => { 15733 removeCustomClasses(elem, params); 15734 if (!params.customClass) { 15735 return; 15736 } 15737 const customClass = params.customClass[(/** @type {keyof SweetAlertCustomClass} */className)]; 15738 if (!customClass) { 15739 return; 15740 } 15741 if (typeof customClass !== 'string' && !customClass.forEach) { 15742 warn(`Invalid type of customClass.${className}! Expected string or iterable object, got "${typeof customClass}"`); 15743 return; 15744 } 15745 addClass(elem, customClass); 15746 }; 15747 15748 /** 15749 * @param {HTMLElement} popup 15750 * @param {import('./renderers/renderInput').InputClass | SweetAlertInput} inputClass 15751 * @returns {HTMLInputElement | null} 15752 */ 15753 const getInput$1 = (popup, inputClass) => { 15754 if (!inputClass) { 15755 return null; 15756 } 15757 switch (inputClass) { 15758 case 'select': 15759 case 'textarea': 15760 case 'file': 15761 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses[inputClass]}`); 15762 case 'checkbox': 15763 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.checkbox} input`); 15764 case 'radio': 15765 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.radio} input:checked`) || popup.querySelector(`.${swalClasses.popup} > .${swalClasses.radio} input:first-child`); 15766 case 'range': 15767 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.range} input`); 15768 default: 15769 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.input}`); 15770 } 15771 }; 15772 15773 /** 15774 * @param {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} input 15775 */ 15776 const focusInput = input => { 15777 input.focus(); 15778 15779 // place cursor at end of text in text input 15780 if (input.type !== 'file') { 15781 // http://stackoverflow.com/a/2345915 15782 const val = input.value; 15783 input.value = ''; 15784 input.value = val; 15785 } 15786 }; 15787 15788 /** 15789 * @param {HTMLElement | HTMLElement[] | null} target 15790 * @param {string | string[] | readonly string[] | undefined} classList 15791 * @param {boolean} condition 15792 */ 15793 const toggleClass = (target, classList, condition) => { 15794 if (!target || !classList) { 15795 return; 15796 } 15797 if (typeof classList === 'string') { 15798 classList = classList.split(/\s+/).filter(Boolean); 15799 } 15800 classList.forEach(className => { 15801 if (Array.isArray(target)) { 15802 target.forEach(elem => { 15803 if (condition) { 15804 elem.classList.add(className); 15805 } else { 15806 elem.classList.remove(className); 15807 } 15808 }); 15809 } else { 15810 if (condition) { 15811 target.classList.add(className); 15812 } else { 15813 target.classList.remove(className); 15814 } 15815 } 15816 }); 15817 }; 15818 15819 /** 15820 * @param {HTMLElement | HTMLElement[] | null} target 15821 * @param {string | string[] | readonly string[] | undefined} classList 15822 */ 15823 const addClass = (target, classList) => { 15824 toggleClass(target, classList, true); 15825 }; 15826 15827 /** 15828 * @param {HTMLElement | HTMLElement[] | null} target 15829 * @param {string | string[] | readonly string[] | undefined} classList 15830 */ 15831 const removeClass = (target, classList) => { 15832 toggleClass(target, classList, false); 15833 }; 15834 15835 /** 15836 * Get direct child of an element by class name 15837 * 15838 * @param {HTMLElement} elem 15839 * @param {string} className 15840 * @returns {HTMLElement | undefined} 15841 */ 15842 const getDirectChildByClass = (elem, className) => { 15843 const children = Array.from(elem.children); 15844 for (let i = 0; i < children.length; i++) { 15845 const child = children[i]; 15846 if (child instanceof HTMLElement && hasClass(child, className)) { 15847 return child; 15848 } 15849 } 15850 }; 15851 15852 /** 15853 * @param {HTMLElement} elem 15854 * @param {string} property 15855 * @param {*} value 15856 */ 15857 const applyNumericalStyle = (elem, property, value) => { 15858 if (value === `${parseInt(value)}`) { 15859 value = parseInt(value); 15860 } 15861 if (value || parseInt(value) === 0) { 15862 elem.style.setProperty(property, typeof value === 'number' ? `${value}px` : value); 15863 } else { 15864 elem.style.removeProperty(property); 15865 } 15866 }; 15867 15868 /** 15869 * @param {HTMLElement | null} elem 15870 * @param {string} display 15871 */ 15872 const show = function (elem) { 15873 let display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex'; 15874 if (!elem) { 15875 return; 15876 } 15877 elem.style.display = display; 15878 }; 15879 15880 /** 15881 * @param {HTMLElement | null} elem 15882 */ 15883 const hide = elem => { 15884 if (!elem) { 15885 return; 15886 } 15887 elem.style.display = 'none'; 15888 }; 15889 15890 /** 15891 * @param {HTMLElement | null} elem 15892 * @param {string} display 15893 */ 15894 const showWhenInnerHtmlPresent = function (elem) { 15895 let display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'block'; 15896 if (!elem) { 15897 return; 15898 } 15899 new MutationObserver(() => { 15900 toggle(elem, elem.innerHTML, display); 15901 }).observe(elem, { 15902 childList: true, 15903 subtree: true 15904 }); 15905 }; 15906 15907 /** 15908 * @param {HTMLElement} parent 15909 * @param {string} selector 15910 * @param {string} property 15911 * @param {string} value 15912 */ 15913 const setStyle = (parent, selector, property, value) => { 15914 /** @type {HTMLElement | null} */ 15915 const el = parent.querySelector(selector); 15916 if (el) { 15917 el.style.setProperty(property, value); 15918 } 15919 }; 15920 15921 /** 15922 * @param {HTMLElement} elem 15923 * @param {any} condition 15924 * @param {string} display 15925 */ 15926 const toggle = function (elem, condition) { 15927 let display = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'flex'; 15928 if (condition) { 15929 show(elem, display); 15930 } else { 15931 hide(elem); 15932 } 15933 }; 15934 15935 /** 15936 * borrowed from jquery $(elem).is(':visible') implementation 15937 * 15938 * @param {HTMLElement | null} elem 15939 * @returns {boolean} 15940 */ 15941 const isVisible$1 = elem => !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length)); 15942 15943 /** 15944 * @returns {boolean} 15945 */ 15946 const allButtonsAreHidden = () => !isVisible$1(getConfirmButton()) && !isVisible$1(getDenyButton()) && !isVisible$1(getCancelButton()); 15947 15948 /** 15949 * @param {HTMLElement} elem 15950 * @returns {boolean} 15951 */ 15952 const isScrollable = elem => !!(elem.scrollHeight > elem.clientHeight); 15953 15954 /** 15955 * borrowed from https://stackoverflow.com/a/46352119 15956 * 15957 * @param {HTMLElement} elem 15958 * @returns {boolean} 15959 */ 15960 const hasCssAnimation = elem => { 15961 const style = window.getComputedStyle(elem); 15962 const animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0'); 15963 const transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0'); 15964 return animDuration > 0 || transDuration > 0; 15965 }; 15966 15967 /** 15968 * @param {number} timer 15969 * @param {boolean} reset 15970 */ 15971 const animateTimerProgressBar = function (timer) { 15972 let reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 15973 const timerProgressBar = getTimerProgressBar(); 15974 if (!timerProgressBar) { 15975 return; 15976 } 15977 if (isVisible$1(timerProgressBar)) { 15978 if (reset) { 15979 timerProgressBar.style.transition = 'none'; 15980 timerProgressBar.style.width = '100%'; 15981 } 15982 setTimeout(() => { 15983 timerProgressBar.style.transition = `width ${timer / 1000}s linear`; 15984 timerProgressBar.style.width = '0%'; 15985 }, 10); 15986 } 15987 }; 15988 const stopTimerProgressBar = () => { 15989 const timerProgressBar = getTimerProgressBar(); 15990 if (!timerProgressBar) { 15991 return; 15992 } 15993 const timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width); 15994 timerProgressBar.style.removeProperty('transition'); 15995 timerProgressBar.style.width = '100%'; 15996 const timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width); 15997 const timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100; 15998 timerProgressBar.style.width = `${timerProgressBarPercent}%`; 15999 }; 16000 16001 /** 16002 * Detect Node env 16003 * 16004 * @returns {boolean} 16005 */ 16006 const isNodeEnv = () => typeof window === 'undefined' || typeof document === 'undefined'; 16007 16008 const sweetHTML = ` 16009 <div aria-labelledby="${swalClasses.title}" aria-describedby="${swalClasses['html-container']}" class="${swalClasses.popup}" tabindex="-1"> 16010 <button type="button" class="${swalClasses.close}"></button> 16011 <ul class="${swalClasses['progress-steps']}"></ul> 16012 <div class="${swalClasses.icon}"></div> 16013 <img class="${swalClasses.image}" /> 16014 <h2 class="${swalClasses.title}" id="${swalClasses.title}"></h2> 16015 <div class="${swalClasses['html-container']}" id="${swalClasses['html-container']}"></div> 16016 <input class="${swalClasses.input}" id="${swalClasses.input}" /> 16017 <input type="file" class="${swalClasses.file}" /> 16018 <div class="${swalClasses.range}"> 16019 <input type="range" /> 16020 <output></output> 16021 </div> 16022 <select class="${swalClasses.select}" id="${swalClasses.select}"></select> 16023 <div class="${swalClasses.radio}"></div> 16024 <label class="${swalClasses.checkbox}"> 16025 <input type="checkbox" id="${swalClasses.checkbox}" /> 16026 <span class="${swalClasses.label}"></span> 16027 </label> 16028 <textarea class="${swalClasses.textarea}" id="${swalClasses.textarea}"></textarea> 16029 <div class="${swalClasses['validation-message']}" id="${swalClasses['validation-message']}"></div> 16030 <div class="${swalClasses.actions}"> 16031 <div class="${swalClasses.loader}"></div> 16032 <button type="button" class="${swalClasses.confirm}"></button> 16033 <button type="button" class="${swalClasses.deny}"></button> 16034 <button type="button" class="${swalClasses.cancel}"></button> 16035 </div> 16036 <div class="${swalClasses.footer}"></div> 16037 <div class="${swalClasses['timer-progress-bar-container']}"> 16038 <div class="${swalClasses['timer-progress-bar']}"></div> 16039 </div> 16040 </div> 16041`.replace(/(^|\n)\s*/g, ''); 16042 16043 /** 16044 * @returns {boolean} 16045 */ 16046 const resetOldContainer = () => { 16047 const oldContainer = getContainer(); 16048 if (!oldContainer) { 16049 return false; 16050 } 16051 oldContainer.remove(); 16052 removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]); 16053 return true; 16054 }; 16055 const resetValidationMessage$1 = () => { 16056 globalState.currentInstance.resetValidationMessage(); 16057 }; 16058 const addInputChangeListeners = () => { 16059 const popup = getPopup(); 16060 const input = getDirectChildByClass(popup, swalClasses.input); 16061 const file = getDirectChildByClass(popup, swalClasses.file); 16062 /** @type {HTMLInputElement} */ 16063 const range = popup.querySelector(`.${swalClasses.range} input`); 16064 /** @type {HTMLOutputElement} */ 16065 const rangeOutput = popup.querySelector(`.${swalClasses.range} output`); 16066 const select = getDirectChildByClass(popup, swalClasses.select); 16067 /** @type {HTMLInputElement} */ 16068 const checkbox = popup.querySelector(`.${swalClasses.checkbox} input`); 16069 const textarea = getDirectChildByClass(popup, swalClasses.textarea); 16070 input.oninput = resetValidationMessage$1; 16071 file.onchange = resetValidationMessage$1; 16072 select.onchange = resetValidationMessage$1; 16073 checkbox.onchange = resetValidationMessage$1; 16074 textarea.oninput = resetValidationMessage$1; 16075 range.oninput = () => { 16076 resetValidationMessage$1(); 16077 rangeOutput.value = range.value; 16078 }; 16079 range.onchange = () => { 16080 resetValidationMessage$1(); 16081 rangeOutput.value = range.value; 16082 }; 16083 }; 16084 16085 /** 16086 * @param {string | HTMLElement} target 16087 * @returns {HTMLElement} 16088 */ 16089 const getTarget = target => typeof target === 'string' ? document.querySelector(target) : target; 16090 16091 /** 16092 * @param {SweetAlertOptions} params 16093 */ 16094 const setupAccessibility = params => { 16095 const popup = getPopup(); 16096 popup.setAttribute('role', params.toast ? 'alert' : 'dialog'); 16097 popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive'); 16098 if (!params.toast) { 16099 popup.setAttribute('aria-modal', 'true'); 16100 } 16101 }; 16102 16103 /** 16104 * @param {HTMLElement} targetElement 16105 */ 16106 const setupRTL = targetElement => { 16107 if (window.getComputedStyle(targetElement).direction === 'rtl') { 16108 addClass(getContainer(), swalClasses.rtl); 16109 } 16110 }; 16111 16112 /** 16113 * Add modal + backdrop + no-war message for Russians to DOM 16114 * 16115 * @param {SweetAlertOptions} params 16116 */ 16117 const init = params => { 16118 // Clean up the old popup container if it exists 16119 const oldContainerExisted = resetOldContainer(); 16120 if (isNodeEnv()) { 16121 error('SweetAlert2 requires document to initialize'); 16122 return; 16123 } 16124 const container = document.createElement('div'); 16125 container.className = swalClasses.container; 16126 if (oldContainerExisted) { 16127 addClass(container, swalClasses['no-transition']); 16128 } 16129 setInnerHtml(container, sweetHTML); 16130 const targetElement = getTarget(params.target); 16131 targetElement.appendChild(container); 16132 setupAccessibility(params); 16133 setupRTL(targetElement); 16134 addInputChangeListeners(); 16135 }; 16136 16137 /** 16138 * @param {HTMLElement | object | string} param 16139 * @param {HTMLElement} target 16140 */ 16141 const parseHtmlToContainer = (param, target) => { 16142 // DOM element 16143 if (param instanceof HTMLElement) { 16144 target.appendChild(param); 16145 } 16146 16147 // Object 16148 else if (typeof param === 'object') { 16149 handleObject(param, target); 16150 } 16151 16152 // Plain string 16153 else if (param) { 16154 setInnerHtml(target, param); 16155 } 16156 }; 16157 16158 /** 16159 * @param {any} param 16160 * @param {HTMLElement} target 16161 */ 16162 const handleObject = (param, target) => { 16163 // JQuery element(s) 16164 if (param.jquery) { 16165 handleJqueryElem(target, param); 16166 } 16167 16168 // For other objects use their string representation 16169 else { 16170 setInnerHtml(target, param.toString()); 16171 } 16172 }; 16173 16174 /** 16175 * @param {HTMLElement} target 16176 * @param {any} elem 16177 */ 16178 const handleJqueryElem = (target, elem) => { 16179 target.textContent = ''; 16180 if (0 in elem) { 16181 for (let i = 0; i in elem; i++) { 16182 target.appendChild(elem[i].cloneNode(true)); 16183 } 16184 } else { 16185 target.appendChild(elem.cloneNode(true)); 16186 } 16187 }; 16188 16189 /** 16190 * @param {SweetAlert} instance 16191 * @param {SweetAlertOptions} params 16192 */ 16193 const renderActions = (instance, params) => { 16194 const actions = getActions(); 16195 const loader = getLoader(); 16196 if (!actions || !loader) { 16197 return; 16198 } 16199 16200 // Actions (buttons) wrapper 16201 if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) { 16202 hide(actions); 16203 } else { 16204 show(actions); 16205 } 16206 16207 // Custom class 16208 applyCustomClass(actions, params, 'actions'); 16209 16210 // Render all the buttons 16211 renderButtons(actions, loader, params); 16212 16213 // Loader 16214 setInnerHtml(loader, params.loaderHtml || ''); 16215 applyCustomClass(loader, params, 'loader'); 16216 }; 16217 16218 /** 16219 * @param {HTMLElement} actions 16220 * @param {HTMLElement} loader 16221 * @param {SweetAlertOptions} params 16222 */ 16223 function renderButtons(actions, loader, params) { 16224 const confirmButton = getConfirmButton(); 16225 const denyButton = getDenyButton(); 16226 const cancelButton = getCancelButton(); 16227 if (!confirmButton || !denyButton || !cancelButton) { 16228 return; 16229 } 16230 16231 // Render buttons 16232 renderButton(confirmButton, 'confirm', params); 16233 renderButton(denyButton, 'deny', params); 16234 renderButton(cancelButton, 'cancel', params); 16235 handleButtonsStyling(confirmButton, denyButton, cancelButton, params); 16236 if (params.reverseButtons) { 16237 if (params.toast) { 16238 actions.insertBefore(cancelButton, confirmButton); 16239 actions.insertBefore(denyButton, confirmButton); 16240 } else { 16241 actions.insertBefore(cancelButton, loader); 16242 actions.insertBefore(denyButton, loader); 16243 actions.insertBefore(confirmButton, loader); 16244 } 16245 } 16246 } 16247 16248 /** 16249 * @param {HTMLElement} confirmButton 16250 * @param {HTMLElement} denyButton 16251 * @param {HTMLElement} cancelButton 16252 * @param {SweetAlertOptions} params 16253 */ 16254 function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) { 16255 if (!params.buttonsStyling) { 16256 removeClass([confirmButton, denyButton, cancelButton], swalClasses.styled); 16257 return; 16258 } 16259 addClass([confirmButton, denyButton, cancelButton], swalClasses.styled); 16260 16261 // Buttons background colors 16262 if (params.confirmButtonColor) { 16263 confirmButton.style.backgroundColor = params.confirmButtonColor; 16264 addClass(confirmButton, swalClasses['default-outline']); 16265 } 16266 if (params.denyButtonColor) { 16267 denyButton.style.backgroundColor = params.denyButtonColor; 16268 addClass(denyButton, swalClasses['default-outline']); 16269 } 16270 if (params.cancelButtonColor) { 16271 cancelButton.style.backgroundColor = params.cancelButtonColor; 16272 addClass(cancelButton, swalClasses['default-outline']); 16273 } 16274 } 16275 16276 /** 16277 * @param {HTMLElement} button 16278 * @param {'confirm' | 'deny' | 'cancel'} buttonType 16279 * @param {SweetAlertOptions} params 16280 */ 16281 function renderButton(button, buttonType, params) { 16282 const buttonName = /** @type {'Confirm' | 'Deny' | 'Cancel'} */capitalizeFirstLetter(buttonType); 16283 toggle(button, params[`show${buttonName}Button`], 'inline-block'); 16284 setInnerHtml(button, params[`${buttonType}ButtonText`] || ''); // Set caption text 16285 button.setAttribute('aria-label', params[`${buttonType}ButtonAriaLabel`] || ''); // ARIA label 16286 16287 // Add buttons custom classes 16288 button.className = swalClasses[buttonType]; 16289 applyCustomClass(button, params, `${buttonType}Button`); 16290 } 16291 16292 /** 16293 * @param {SweetAlert} instance 16294 * @param {SweetAlertOptions} params 16295 */ 16296 const renderCloseButton = (instance, params) => { 16297 const closeButton = getCloseButton(); 16298 if (!closeButton) { 16299 return; 16300 } 16301 setInnerHtml(closeButton, params.closeButtonHtml || ''); 16302 16303 // Custom class 16304 applyCustomClass(closeButton, params, 'closeButton'); 16305 toggle(closeButton, params.showCloseButton); 16306 closeButton.setAttribute('aria-label', params.closeButtonAriaLabel || ''); 16307 }; 16308 16309 /** 16310 * @param {SweetAlert} instance 16311 * @param {SweetAlertOptions} params 16312 */ 16313 const renderContainer = (instance, params) => { 16314 const container = getContainer(); 16315 if (!container) { 16316 return; 16317 } 16318 handleBackdropParam(container, params.backdrop); 16319 handlePositionParam(container, params.position); 16320 handleGrowParam(container, params.grow); 16321 16322 // Custom class 16323 applyCustomClass(container, params, 'container'); 16324 }; 16325 16326 /** 16327 * @param {HTMLElement} container 16328 * @param {SweetAlertOptions['backdrop']} backdrop 16329 */ 16330 function handleBackdropParam(container, backdrop) { 16331 if (typeof backdrop === 'string') { 16332 container.style.background = backdrop; 16333 } else if (!backdrop) { 16334 addClass([document.documentElement, document.body], swalClasses['no-backdrop']); 16335 } 16336 } 16337 16338 /** 16339 * @param {HTMLElement} container 16340 * @param {SweetAlertOptions['position']} position 16341 */ 16342 function handlePositionParam(container, position) { 16343 if (!position) { 16344 return; 16345 } 16346 if (position in swalClasses) { 16347 addClass(container, swalClasses[position]); 16348 } else { 16349 warn('The "position" parameter is not valid, defaulting to "center"'); 16350 addClass(container, swalClasses.center); 16351 } 16352 } 16353 16354 /** 16355 * @param {HTMLElement} container 16356 * @param {SweetAlertOptions['grow']} grow 16357 */ 16358 function handleGrowParam(container, grow) { 16359 if (!grow) { 16360 return; 16361 } 16362 addClass(container, swalClasses[`grow-${grow}`]); 16363 } 16364 16365 /** 16366 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has. 16367 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` 16368 * This is the approach that Babel will probably take to implement private methods/fields 16369 * https://github.com/tc39/proposal-private-methods 16370 * https://github.com/babel/babel/pull/7555 16371 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* 16372 * then we can use that language feature. 16373 */ 16374 16375 var privateProps = { 16376 innerParams: new WeakMap(), 16377 domCache: new WeakMap() 16378 }; 16379 16380 /// <reference path="../../../../sweetalert2.d.ts"/> 16381 16382 16383 /** @type {InputClass[]} */ 16384 const inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']; 16385 16386 /** 16387 * @param {SweetAlert} instance 16388 * @param {SweetAlertOptions} params 16389 */ 16390 const renderInput = (instance, params) => { 16391 const popup = getPopup(); 16392 if (!popup) { 16393 return; 16394 } 16395 const innerParams = privateProps.innerParams.get(instance); 16396 const rerender = !innerParams || params.input !== innerParams.input; 16397 inputClasses.forEach(inputClass => { 16398 const inputContainer = getDirectChildByClass(popup, swalClasses[inputClass]); 16399 if (!inputContainer) { 16400 return; 16401 } 16402 16403 // set attributes 16404 setAttributes(inputClass, params.inputAttributes); 16405 16406 // set class 16407 inputContainer.className = swalClasses[inputClass]; 16408 if (rerender) { 16409 hide(inputContainer); 16410 } 16411 }); 16412 if (params.input) { 16413 if (rerender) { 16414 showInput(params); 16415 } 16416 // set custom class 16417 setCustomClass(params); 16418 } 16419 }; 16420 16421 /** 16422 * @param {SweetAlertOptions} params 16423 */ 16424 const showInput = params => { 16425 if (!params.input) { 16426 return; 16427 } 16428 if (!renderInputType[params.input]) { 16429 error(`Unexpected type of input! Expected ${Object.keys(renderInputType).join(' | ')}, got "${params.input}"`); 16430 return; 16431 } 16432 const inputContainer = getInputContainer(params.input); 16433 if (!inputContainer) { 16434 return; 16435 } 16436 const input = renderInputType[params.input](inputContainer, params); 16437 show(inputContainer); 16438 16439 // input autofocus 16440 if (params.inputAutoFocus) { 16441 setTimeout(() => { 16442 focusInput(input); 16443 }); 16444 } 16445 }; 16446 16447 /** 16448 * @param {HTMLInputElement} input 16449 */ 16450 const removeAttributes = input => { 16451 for (let i = 0; i < input.attributes.length; i++) { 16452 const attrName = input.attributes[i].name; 16453 if (!['id', 'type', 'value', 'style'].includes(attrName)) { 16454 input.removeAttribute(attrName); 16455 } 16456 } 16457 }; 16458 16459 /** 16460 * @param {InputClass} inputClass 16461 * @param {SweetAlertOptions['inputAttributes']} inputAttributes 16462 */ 16463 const setAttributes = (inputClass, inputAttributes) => { 16464 const popup = getPopup(); 16465 if (!popup) { 16466 return; 16467 } 16468 const input = getInput$1(popup, inputClass); 16469 if (!input) { 16470 return; 16471 } 16472 removeAttributes(input); 16473 for (const attr in inputAttributes) { 16474 input.setAttribute(attr, inputAttributes[attr]); 16475 } 16476 }; 16477 16478 /** 16479 * @param {SweetAlertOptions} params 16480 */ 16481 const setCustomClass = params => { 16482 if (!params.input) { 16483 return; 16484 } 16485 const inputContainer = getInputContainer(params.input); 16486 if (inputContainer) { 16487 applyCustomClass(inputContainer, params, 'input'); 16488 } 16489 }; 16490 16491 /** 16492 * @param {HTMLInputElement | HTMLTextAreaElement} input 16493 * @param {SweetAlertOptions} params 16494 */ 16495 const setInputPlaceholder = (input, params) => { 16496 if (!input.placeholder && params.inputPlaceholder) { 16497 input.placeholder = params.inputPlaceholder; 16498 } 16499 }; 16500 16501 /** 16502 * @param {Input} input 16503 * @param {Input} prependTo 16504 * @param {SweetAlertOptions} params 16505 */ 16506 const setInputLabel = (input, prependTo, params) => { 16507 if (params.inputLabel) { 16508 const label = document.createElement('label'); 16509 const labelClass = swalClasses['input-label']; 16510 label.setAttribute('for', input.id); 16511 label.className = labelClass; 16512 if (typeof params.customClass === 'object') { 16513 addClass(label, params.customClass.inputLabel); 16514 } 16515 label.innerText = params.inputLabel; 16516 prependTo.insertAdjacentElement('beforebegin', label); 16517 } 16518 }; 16519 16520 /** 16521 * @param {SweetAlertInput} inputType 16522 * @returns {HTMLElement | undefined} 16523 */ 16524 const getInputContainer = inputType => { 16525 const popup = getPopup(); 16526 if (!popup) { 16527 return; 16528 } 16529 return getDirectChildByClass(popup, swalClasses[(/** @type {SwalClass} */inputType)] || swalClasses.input); 16530 }; 16531 16532 /** 16533 * @param {HTMLInputElement | HTMLOutputElement | HTMLTextAreaElement} input 16534 * @param {SweetAlertOptions['inputValue']} inputValue 16535 */ 16536 const checkAndSetInputValue = (input, inputValue) => { 16537 if (['string', 'number'].includes(typeof inputValue)) { 16538 input.value = `${inputValue}`; 16539 } else if (!isPromise(inputValue)) { 16540 warn(`Unexpected type of inputValue! Expected "string", "number" or "Promise", got "${typeof inputValue}"`); 16541 } 16542 }; 16543 16544 /** @type {Record<SweetAlertInput, (input: Input | HTMLElement, params: SweetAlertOptions) => Input>} */ 16545 const renderInputType = {}; 16546 16547 /** 16548 * @param {HTMLInputElement} input 16549 * @param {SweetAlertOptions} params 16550 * @returns {HTMLInputElement} 16551 */ 16552 renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = renderInputType.search = renderInputType.date = renderInputType['datetime-local'] = renderInputType.time = renderInputType.week = renderInputType.month = /** @type {(input: Input | HTMLElement, params: SweetAlertOptions) => Input} */ 16553 (input, params) => { 16554 checkAndSetInputValue(input, params.inputValue); 16555 setInputLabel(input, input, params); 16556 setInputPlaceholder(input, params); 16557 input.type = params.input; 16558 return input; 16559 }; 16560 16561 /** 16562 * @param {HTMLInputElement} input 16563 * @param {SweetAlertOptions} params 16564 * @returns {HTMLInputElement} 16565 */ 16566 renderInputType.file = (input, params) => { 16567 setInputLabel(input, input, params); 16568 setInputPlaceholder(input, params); 16569 return input; 16570 }; 16571 16572 /** 16573 * @param {HTMLInputElement} range 16574 * @param {SweetAlertOptions} params 16575 * @returns {HTMLInputElement} 16576 */ 16577 renderInputType.range = (range, params) => { 16578 const rangeInput = range.querySelector('input'); 16579 const rangeOutput = range.querySelector('output'); 16580 checkAndSetInputValue(rangeInput, params.inputValue); 16581 rangeInput.type = params.input; 16582 checkAndSetInputValue(rangeOutput, params.inputValue); 16583 setInputLabel(rangeInput, range, params); 16584 return range; 16585 }; 16586 16587 /** 16588 * @param {HTMLSelectElement} select 16589 * @param {SweetAlertOptions} params 16590 * @returns {HTMLSelectElement} 16591 */ 16592 renderInputType.select = (select, params) => { 16593 select.textContent = ''; 16594 if (params.inputPlaceholder) { 16595 const placeholder = document.createElement('option'); 16596 setInnerHtml(placeholder, params.inputPlaceholder); 16597 placeholder.value = ''; 16598 placeholder.disabled = true; 16599 placeholder.selected = true; 16600 select.appendChild(placeholder); 16601 } 16602 setInputLabel(select, select, params); 16603 return select; 16604 }; 16605 16606 /** 16607 * @param {HTMLInputElement} radio 16608 * @returns {HTMLInputElement} 16609 */ 16610 renderInputType.radio = radio => { 16611 radio.textContent = ''; 16612 return radio; 16613 }; 16614 16615 /** 16616 * @param {HTMLLabelElement} checkboxContainer 16617 * @param {SweetAlertOptions} params 16618 * @returns {HTMLInputElement} 16619 */ 16620 renderInputType.checkbox = (checkboxContainer, params) => { 16621 const checkbox = getInput$1(getPopup(), 'checkbox'); 16622 checkbox.value = '1'; 16623 checkbox.checked = Boolean(params.inputValue); 16624 const label = checkboxContainer.querySelector('span'); 16625 setInnerHtml(label, params.inputPlaceholder || params.inputLabel); 16626 return checkbox; 16627 }; 16628 16629 /** 16630 * @param {HTMLTextAreaElement} textarea 16631 * @param {SweetAlertOptions} params 16632 * @returns {HTMLTextAreaElement} 16633 */ 16634 renderInputType.textarea = (textarea, params) => { 16635 checkAndSetInputValue(textarea, params.inputValue); 16636 setInputPlaceholder(textarea, params); 16637 setInputLabel(textarea, textarea, params); 16638 16639 /** 16640 * @param {HTMLElement} el 16641 * @returns {number} 16642 */ 16643 const getMargin = el => parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight); 16644 16645 // https://github.com/sweetalert2/sweetalert2/issues/2291 16646 setTimeout(() => { 16647 // https://github.com/sweetalert2/sweetalert2/issues/1699 16648 if ('MutationObserver' in window) { 16649 const initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width); 16650 const textareaResizeHandler = () => { 16651 // check if texarea is still in document (i.e. popup wasn't closed in the meantime) 16652 if (!document.body.contains(textarea)) { 16653 return; 16654 } 16655 const textareaWidth = textarea.offsetWidth + getMargin(textarea); 16656 if (textareaWidth > initialPopupWidth) { 16657 getPopup().style.width = `${textareaWidth}px`; 16658 } else { 16659 applyNumericalStyle(getPopup(), 'width', params.width); 16660 } 16661 }; 16662 new MutationObserver(textareaResizeHandler).observe(textarea, { 16663 attributes: true, 16664 attributeFilter: ['style'] 16665 }); 16666 } 16667 }); 16668 return textarea; 16669 }; 16670 16671 /** 16672 * @param {SweetAlert} instance 16673 * @param {SweetAlertOptions} params 16674 */ 16675 const renderContent = (instance, params) => { 16676 const htmlContainer = getHtmlContainer(); 16677 if (!htmlContainer) { 16678 return; 16679 } 16680 showWhenInnerHtmlPresent(htmlContainer); 16681 applyCustomClass(htmlContainer, params, 'htmlContainer'); 16682 16683 // Content as HTML 16684 if (params.html) { 16685 parseHtmlToContainer(params.html, htmlContainer); 16686 show(htmlContainer, 'block'); 16687 } 16688 16689 // Content as plain text 16690 else if (params.text) { 16691 htmlContainer.textContent = params.text; 16692 show(htmlContainer, 'block'); 16693 } 16694 16695 // No content 16696 else { 16697 hide(htmlContainer); 16698 } 16699 renderInput(instance, params); 16700 }; 16701 16702 /** 16703 * @param {SweetAlert} instance 16704 * @param {SweetAlertOptions} params 16705 */ 16706 const renderFooter = (instance, params) => { 16707 const footer = getFooter(); 16708 if (!footer) { 16709 return; 16710 } 16711 showWhenInnerHtmlPresent(footer); 16712 toggle(footer, params.footer, 'block'); 16713 if (params.footer) { 16714 parseHtmlToContainer(params.footer, footer); 16715 } 16716 16717 // Custom class 16718 applyCustomClass(footer, params, 'footer'); 16719 }; 16720 16721 /** 16722 * @param {SweetAlert} instance 16723 * @param {SweetAlertOptions} params 16724 */ 16725 const renderIcon = (instance, params) => { 16726 const innerParams = privateProps.innerParams.get(instance); 16727 const icon = getIcon(); 16728 if (!icon) { 16729 return; 16730 } 16731 16732 // if the given icon already rendered, apply the styling without re-rendering the icon 16733 if (innerParams && params.icon === innerParams.icon) { 16734 // Custom or default content 16735 setContent(icon, params); 16736 applyStyles(icon, params); 16737 return; 16738 } 16739 if (!params.icon && !params.iconHtml) { 16740 hide(icon); 16741 return; 16742 } 16743 if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) { 16744 error(`Unknown icon! Expected "success", "error", "warning", "info" or "question", got "${params.icon}"`); 16745 hide(icon); 16746 return; 16747 } 16748 show(icon); 16749 16750 // Custom or default content 16751 setContent(icon, params); 16752 applyStyles(icon, params); 16753 16754 // Animate icon 16755 addClass(icon, params.showClass && params.showClass.icon); 16756 }; 16757 16758 /** 16759 * @param {HTMLElement} icon 16760 * @param {SweetAlertOptions} params 16761 */ 16762 const applyStyles = (icon, params) => { 16763 for (const [iconType, iconClassName] of Object.entries(iconTypes)) { 16764 if (params.icon !== iconType) { 16765 removeClass(icon, iconClassName); 16766 } 16767 } 16768 addClass(icon, params.icon && iconTypes[params.icon]); 16769 16770 // Icon color 16771 setColor(icon, params); 16772 16773 // Success icon background color 16774 adjustSuccessIconBackgroundColor(); 16775 16776 // Custom class 16777 applyCustomClass(icon, params, 'icon'); 16778 }; 16779 16780 // Adjust success icon background color to match the popup background color 16781 const adjustSuccessIconBackgroundColor = () => { 16782 const popup = getPopup(); 16783 if (!popup) { 16784 return; 16785 } 16786 const popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color'); 16787 /** @type {NodeListOf<HTMLElement>} */ 16788 const successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix'); 16789 for (let i = 0; i < successIconParts.length; i++) { 16790 successIconParts[i].style.backgroundColor = popupBackgroundColor; 16791 } 16792 }; 16793 const successIconHtml = ` 16794 <div class="swal2-success-circular-line-left"></div> 16795 <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span> 16796 <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div> 16797 <div class="swal2-success-circular-line-right"></div> 16798`; 16799 const errorIconHtml = ` 16800 <span class="swal2-x-mark"> 16801 <span class="swal2-x-mark-line-left"></span> 16802 <span class="swal2-x-mark-line-right"></span> 16803 </span> 16804`; 16805 16806 /** 16807 * @param {HTMLElement} icon 16808 * @param {SweetAlertOptions} params 16809 */ 16810 const setContent = (icon, params) => { 16811 if (!params.icon && !params.iconHtml) { 16812 return; 16813 } 16814 let oldContent = icon.innerHTML; 16815 let newContent = ''; 16816 if (params.iconHtml) { 16817 newContent = iconContent(params.iconHtml); 16818 } else if (params.icon === 'success') { 16819 newContent = successIconHtml; 16820 oldContent = oldContent.replace(/ style=".*?"/g, ''); // undo adjustSuccessIconBackgroundColor() 16821 } else if (params.icon === 'error') { 16822 newContent = errorIconHtml; 16823 } else if (params.icon) { 16824 const defaultIconHtml = { 16825 question: '?', 16826 warning: '!', 16827 info: 'i' 16828 }; 16829 newContent = iconContent(defaultIconHtml[params.icon]); 16830 } 16831 if (oldContent.trim() !== newContent.trim()) { 16832 setInnerHtml(icon, newContent); 16833 } 16834 }; 16835 16836 /** 16837 * @param {HTMLElement} icon 16838 * @param {SweetAlertOptions} params 16839 */ 16840 const setColor = (icon, params) => { 16841 if (!params.iconColor) { 16842 return; 16843 } 16844 icon.style.color = params.iconColor; 16845 icon.style.borderColor = params.iconColor; 16846 for (const sel of ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']) { 16847 setStyle(icon, sel, 'background-color', params.iconColor); 16848 } 16849 setStyle(icon, '.swal2-success-ring', 'border-color', params.iconColor); 16850 }; 16851 16852 /** 16853 * @param {string} content 16854 * @returns {string} 16855 */ 16856 const iconContent = content => `<div class="${swalClasses['icon-content']}">${content}</div>`; 16857 16858 /** 16859 * @param {SweetAlert} instance 16860 * @param {SweetAlertOptions} params 16861 */ 16862 const renderImage = (instance, params) => { 16863 const image = getImage(); 16864 if (!image) { 16865 return; 16866 } 16867 if (!params.imageUrl) { 16868 hide(image); 16869 return; 16870 } 16871 show(image, ''); 16872 16873 // Src, alt 16874 image.setAttribute('src', params.imageUrl); 16875 image.setAttribute('alt', params.imageAlt || ''); 16876 16877 // Width, height 16878 applyNumericalStyle(image, 'width', params.imageWidth); 16879 applyNumericalStyle(image, 'height', params.imageHeight); 16880 16881 // Class 16882 image.className = swalClasses.image; 16883 applyCustomClass(image, params, 'image'); 16884 }; 16885 16886 /** 16887 * @param {SweetAlert} instance 16888 * @param {SweetAlertOptions} params 16889 */ 16890 const renderPopup = (instance, params) => { 16891 const container = getContainer(); 16892 const popup = getPopup(); 16893 if (!container || !popup) { 16894 return; 16895 } 16896 16897 // Width 16898 // https://github.com/sweetalert2/sweetalert2/issues/2170 16899 if (params.toast) { 16900 applyNumericalStyle(container, 'width', params.width); 16901 popup.style.width = '100%'; 16902 const loader = getLoader(); 16903 if (loader) { 16904 popup.insertBefore(loader, getIcon()); 16905 } 16906 } else { 16907 applyNumericalStyle(popup, 'width', params.width); 16908 } 16909 16910 // Padding 16911 applyNumericalStyle(popup, 'padding', params.padding); 16912 16913 // Color 16914 if (params.color) { 16915 popup.style.color = params.color; 16916 } 16917 16918 // Background 16919 if (params.background) { 16920 popup.style.background = params.background; 16921 } 16922 hide(getValidationMessage()); 16923 16924 // Classes 16925 addClasses$1(popup, params); 16926 }; 16927 16928 /** 16929 * @param {HTMLElement} popup 16930 * @param {SweetAlertOptions} params 16931 */ 16932 const addClasses$1 = (popup, params) => { 16933 const showClass = params.showClass || {}; 16934 // Default Class + showClass when updating Swal.update({}) 16935 popup.className = `${swalClasses.popup} ${isVisible$1(popup) ? showClass.popup : ''}`; 16936 if (params.toast) { 16937 addClass([document.documentElement, document.body], swalClasses['toast-shown']); 16938 addClass(popup, swalClasses.toast); 16939 } else { 16940 addClass(popup, swalClasses.modal); 16941 } 16942 16943 // Custom class 16944 applyCustomClass(popup, params, 'popup'); 16945 // TODO: remove in the next major 16946 if (typeof params.customClass === 'string') { 16947 addClass(popup, params.customClass); 16948 } 16949 16950 // Icon class (#1842) 16951 if (params.icon) { 16952 addClass(popup, swalClasses[`icon-${params.icon}`]); 16953 } 16954 }; 16955 16956 /** 16957 * @param {SweetAlert} instance 16958 * @param {SweetAlertOptions} params 16959 */ 16960 const renderProgressSteps = (instance, params) => { 16961 const progressStepsContainer = getProgressSteps(); 16962 if (!progressStepsContainer) { 16963 return; 16964 } 16965 const { 16966 progressSteps, 16967 currentProgressStep 16968 } = params; 16969 if (!progressSteps || progressSteps.length === 0 || currentProgressStep === undefined) { 16970 hide(progressStepsContainer); 16971 return; 16972 } 16973 show(progressStepsContainer); 16974 progressStepsContainer.textContent = ''; 16975 if (currentProgressStep >= progressSteps.length) { 16976 warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)'); 16977 } 16978 progressSteps.forEach((step, index) => { 16979 const stepEl = createStepElement(step); 16980 progressStepsContainer.appendChild(stepEl); 16981 if (index === currentProgressStep) { 16982 addClass(stepEl, swalClasses['active-progress-step']); 16983 } 16984 if (index !== progressSteps.length - 1) { 16985 const lineEl = createLineElement(params); 16986 progressStepsContainer.appendChild(lineEl); 16987 } 16988 }); 16989 }; 16990 16991 /** 16992 * @param {string} step 16993 * @returns {HTMLLIElement} 16994 */ 16995 const createStepElement = step => { 16996 const stepEl = document.createElement('li'); 16997 addClass(stepEl, swalClasses['progress-step']); 16998 setInnerHtml(stepEl, step); 16999 return stepEl; 17000 }; 17001 17002 /** 17003 * @param {SweetAlertOptions} params 17004 * @returns {HTMLLIElement} 17005 */ 17006 const createLineElement = params => { 17007 const lineEl = document.createElement('li'); 17008 addClass(lineEl, swalClasses['progress-step-line']); 17009 if (params.progressStepsDistance) { 17010 applyNumericalStyle(lineEl, 'width', params.progressStepsDistance); 17011 } 17012 return lineEl; 17013 }; 17014 17015 /** 17016 * @param {SweetAlert} instance 17017 * @param {SweetAlertOptions} params 17018 */ 17019 const renderTitle = (instance, params) => { 17020 const title = getTitle(); 17021 if (!title) { 17022 return; 17023 } 17024 showWhenInnerHtmlPresent(title); 17025 toggle(title, params.title || params.titleText, 'block'); 17026 if (params.title) { 17027 parseHtmlToContainer(params.title, title); 17028 } 17029 if (params.titleText) { 17030 title.innerText = params.titleText; 17031 } 17032 17033 // Custom class 17034 applyCustomClass(title, params, 'title'); 17035 }; 17036 17037 /** 17038 * @param {SweetAlert} instance 17039 * @param {SweetAlertOptions} params 17040 */ 17041 const render = (instance, params) => { 17042 renderPopup(instance, params); 17043 renderContainer(instance, params); 17044 renderProgressSteps(instance, params); 17045 renderIcon(instance, params); 17046 renderImage(instance, params); 17047 renderTitle(instance, params); 17048 renderCloseButton(instance, params); 17049 renderContent(instance, params); 17050 renderActions(instance, params); 17051 renderFooter(instance, params); 17052 const popup = getPopup(); 17053 if (typeof params.didRender === 'function' && popup) { 17054 params.didRender(popup); 17055 } 17056 globalState.eventEmitter.emit('didRender', popup); 17057 }; 17058 17059 /* 17060 * Global function to determine if SweetAlert2 popup is shown 17061 */ 17062 const isVisible = () => { 17063 return isVisible$1(getPopup()); 17064 }; 17065 17066 /* 17067 * Global function to click 'Confirm' button 17068 */ 17069 const clickConfirm = () => { 17070 var _dom$getConfirmButton; 17071 return (_dom$getConfirmButton = getConfirmButton()) === null || _dom$getConfirmButton === void 0 ? void 0 : _dom$getConfirmButton.click(); 17072 }; 17073 17074 /* 17075 * Global function to click 'Deny' button 17076 */ 17077 const clickDeny = () => { 17078 var _dom$getDenyButton; 17079 return (_dom$getDenyButton = getDenyButton()) === null || _dom$getDenyButton === void 0 ? void 0 : _dom$getDenyButton.click(); 17080 }; 17081 17082 /* 17083 * Global function to click 'Cancel' button 17084 */ 17085 const clickCancel = () => { 17086 var _dom$getCancelButton; 17087 return (_dom$getCancelButton = getCancelButton()) === null || _dom$getCancelButton === void 0 ? void 0 : _dom$getCancelButton.click(); 17088 }; 17089 17090 /** @typedef {'cancel' | 'backdrop' | 'close' | 'esc' | 'timer'} DismissReason */ 17091 17092 /** @type {Record<DismissReason, DismissReason>} */ 17093 const DismissReason = Object.freeze({ 17094 cancel: 'cancel', 17095 backdrop: 'backdrop', 17096 close: 'close', 17097 esc: 'esc', 17098 timer: 'timer' 17099 }); 17100 17101 /** 17102 * @param {GlobalState} globalState 17103 */ 17104 const removeKeydownHandler = globalState => { 17105 if (globalState.keydownTarget && globalState.keydownHandlerAdded) { 17106 globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { 17107 capture: globalState.keydownListenerCapture 17108 }); 17109 globalState.keydownHandlerAdded = false; 17110 } 17111 }; 17112 17113 /** 17114 * @param {GlobalState} globalState 17115 * @param {SweetAlertOptions} innerParams 17116 * @param {*} dismissWith 17117 */ 17118 const addKeydownHandler = (globalState, innerParams, dismissWith) => { 17119 removeKeydownHandler(globalState); 17120 if (!innerParams.toast) { 17121 globalState.keydownHandler = e => keydownHandler(innerParams, e, dismissWith); 17122 globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup(); 17123 globalState.keydownListenerCapture = innerParams.keydownListenerCapture; 17124 globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, { 17125 capture: globalState.keydownListenerCapture 17126 }); 17127 globalState.keydownHandlerAdded = true; 17128 } 17129 }; 17130 17131 /** 17132 * @param {number} index 17133 * @param {number} increment 17134 */ 17135 const setFocus = (index, increment) => { 17136 var _dom$getPopup; 17137 const focusableElements = getFocusableElements(); 17138 // search for visible elements and select the next possible match 17139 if (focusableElements.length) { 17140 index = index + increment; 17141 17142 // rollover to first item 17143 if (index === focusableElements.length) { 17144 index = 0; 17145 17146 // go to last item 17147 } else if (index === -1) { 17148 index = focusableElements.length - 1; 17149 } 17150 focusableElements[index].focus(); 17151 return; 17152 } 17153 // no visible focusable elements, focus the popup 17154 (_dom$getPopup = getPopup()) === null || _dom$getPopup === void 0 || _dom$getPopup.focus(); 17155 }; 17156 const arrowKeysNextButton = ['ArrowRight', 'ArrowDown']; 17157 const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp']; 17158 17159 /** 17160 * @param {SweetAlertOptions} innerParams 17161 * @param {KeyboardEvent} event 17162 * @param {Function} dismissWith 17163 */ 17164 const keydownHandler = (innerParams, event, dismissWith) => { 17165 if (!innerParams) { 17166 return; // This instance has already been destroyed 17167 } 17168 17169 // Ignore keydown during IME composition 17170 // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition 17171 // https://github.com/sweetalert2/sweetalert2/issues/720 17172 // https://github.com/sweetalert2/sweetalert2/issues/2406 17173 if (event.isComposing || event.keyCode === 229) { 17174 return; 17175 } 17176 if (innerParams.stopKeydownPropagation) { 17177 event.stopPropagation(); 17178 } 17179 17180 // ENTER 17181 if (event.key === 'Enter') { 17182 handleEnter(event, innerParams); 17183 } 17184 17185 // TAB 17186 else if (event.key === 'Tab') { 17187 handleTab(event); 17188 } 17189 17190 // ARROWS - switch focus between buttons 17191 else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(event.key)) { 17192 handleArrows(event.key); 17193 } 17194 17195 // ESC 17196 else if (event.key === 'Escape') { 17197 handleEsc(event, innerParams, dismissWith); 17198 } 17199 }; 17200 17201 /** 17202 * @param {KeyboardEvent} event 17203 * @param {SweetAlertOptions} innerParams 17204 */ 17205 const handleEnter = (event, innerParams) => { 17206 // https://github.com/sweetalert2/sweetalert2/issues/2386 17207 if (!callIfFunction(innerParams.allowEnterKey)) { 17208 return; 17209 } 17210 const input = getInput$1(getPopup(), innerParams.input); 17211 if (event.target && input && event.target instanceof HTMLElement && event.target.outerHTML === input.outerHTML) { 17212 if (['textarea', 'file'].includes(innerParams.input)) { 17213 return; // do not submit 17214 } 17215 clickConfirm(); 17216 event.preventDefault(); 17217 } 17218 }; 17219 17220 /** 17221 * @param {KeyboardEvent} event 17222 */ 17223 const handleTab = event => { 17224 const targetElement = event.target; 17225 const focusableElements = getFocusableElements(); 17226 let btnIndex = -1; 17227 for (let i = 0; i < focusableElements.length; i++) { 17228 if (targetElement === focusableElements[i]) { 17229 btnIndex = i; 17230 break; 17231 } 17232 } 17233 17234 // Cycle to the next button 17235 if (!event.shiftKey) { 17236 setFocus(btnIndex, 1); 17237 } 17238 17239 // Cycle to the prev button 17240 else { 17241 setFocus(btnIndex, -1); 17242 } 17243 event.stopPropagation(); 17244 event.preventDefault(); 17245 }; 17246 17247 /** 17248 * @param {string} key 17249 */ 17250 const handleArrows = key => { 17251 const actions = getActions(); 17252 const confirmButton = getConfirmButton(); 17253 const denyButton = getDenyButton(); 17254 const cancelButton = getCancelButton(); 17255 if (!actions || !confirmButton || !denyButton || !cancelButton) { 17256 return; 17257 } 17258 /** @type HTMLElement[] */ 17259 const buttons = [confirmButton, denyButton, cancelButton]; 17260 if (document.activeElement instanceof HTMLElement && !buttons.includes(document.activeElement)) { 17261 return; 17262 } 17263 const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling'; 17264 let buttonToFocus = document.activeElement; 17265 if (!buttonToFocus) { 17266 return; 17267 } 17268 for (let i = 0; i < actions.children.length; i++) { 17269 buttonToFocus = buttonToFocus[sibling]; 17270 if (!buttonToFocus) { 17271 return; 17272 } 17273 if (buttonToFocus instanceof HTMLButtonElement && isVisible$1(buttonToFocus)) { 17274 break; 17275 } 17276 } 17277 if (buttonToFocus instanceof HTMLButtonElement) { 17278 buttonToFocus.focus(); 17279 } 17280 }; 17281 17282 /** 17283 * @param {KeyboardEvent} event 17284 * @param {SweetAlertOptions} innerParams 17285 * @param {Function} dismissWith 17286 */ 17287 const handleEsc = (event, innerParams, dismissWith) => { 17288 if (callIfFunction(innerParams.allowEscapeKey)) { 17289 event.preventDefault(); 17290 dismissWith(DismissReason.esc); 17291 } 17292 }; 17293 17294 /** 17295 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has. 17296 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` 17297 * This is the approach that Babel will probably take to implement private methods/fields 17298 * https://github.com/tc39/proposal-private-methods 17299 * https://github.com/babel/babel/pull/7555 17300 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* 17301 * then we can use that language feature. 17302 */ 17303 17304 var privateMethods = { 17305 swalPromiseResolve: new WeakMap(), 17306 swalPromiseReject: new WeakMap() 17307 }; 17308 17309 // From https://developer.paciellogroup.com/blog/2018/06/the-current-state-of-modal-dialog-accessibility/ 17310 // Adding aria-hidden="true" to elements outside of the active modal dialog ensures that 17311 // elements not within the active modal dialog will not be surfaced if a user opens a screen 17312 // reader’s list of elements (headings, form controls, landmarks, etc.) in the document. 17313 17314 const setAriaHidden = () => { 17315 const container = getContainer(); 17316 const bodyChildren = Array.from(document.body.children); 17317 bodyChildren.forEach(el => { 17318 if (el.contains(container)) { 17319 return; 17320 } 17321 if (el.hasAttribute('aria-hidden')) { 17322 el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden') || ''); 17323 } 17324 el.setAttribute('aria-hidden', 'true'); 17325 }); 17326 }; 17327 const unsetAriaHidden = () => { 17328 const bodyChildren = Array.from(document.body.children); 17329 bodyChildren.forEach(el => { 17330 if (el.hasAttribute('data-previous-aria-hidden')) { 17331 el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden') || ''); 17332 el.removeAttribute('data-previous-aria-hidden'); 17333 } else { 17334 el.removeAttribute('aria-hidden'); 17335 } 17336 }); 17337 }; 17338 17339 // @ts-ignore 17340 const isSafariOrIOS = typeof window !== 'undefined' && !!window.GestureEvent; // true for Safari desktop + all iOS browsers https://stackoverflow.com/a/70585394 17341 17342 /** 17343 * Fix iOS scrolling 17344 * http://stackoverflow.com/q/39626302 17345 */ 17346 const iOSfix = () => { 17347 if (isSafariOrIOS && !hasClass(document.body, swalClasses.iosfix)) { 17348 const offset = document.body.scrollTop; 17349 document.body.style.top = `${offset * -1}px`; 17350 addClass(document.body, swalClasses.iosfix); 17351 lockBodyScroll(); 17352 } 17353 }; 17354 17355 /** 17356 * https://github.com/sweetalert2/sweetalert2/issues/1246 17357 */ 17358 const lockBodyScroll = () => { 17359 const container = getContainer(); 17360 if (!container) { 17361 return; 17362 } 17363 /** @type {boolean} */ 17364 let preventTouchMove; 17365 /** 17366 * @param {TouchEvent} event 17367 */ 17368 container.ontouchstart = event => { 17369 preventTouchMove = shouldPreventTouchMove(event); 17370 }; 17371 /** 17372 * @param {TouchEvent} event 17373 */ 17374 container.ontouchmove = event => { 17375 if (preventTouchMove) { 17376 event.preventDefault(); 17377 event.stopPropagation(); 17378 } 17379 }; 17380 }; 17381 17382 /** 17383 * @param {TouchEvent} event 17384 * @returns {boolean} 17385 */ 17386 const shouldPreventTouchMove = event => { 17387 const target = event.target; 17388 const container = getContainer(); 17389 const htmlContainer = getHtmlContainer(); 17390 if (!container || !htmlContainer) { 17391 return false; 17392 } 17393 if (isStylus(event) || isZoom(event)) { 17394 return false; 17395 } 17396 if (target === container) { 17397 return true; 17398 } 17399 if (!isScrollable(container) && target instanceof HTMLElement && target.tagName !== 'INPUT' && 17400 // #1603 17401 target.tagName !== 'TEXTAREA' && 17402 // #2266 17403 !(isScrollable(htmlContainer) && 17404 // #1944 17405 htmlContainer.contains(target))) { 17406 return true; 17407 } 17408 return false; 17409 }; 17410 17411 /** 17412 * https://github.com/sweetalert2/sweetalert2/issues/1786 17413 * 17414 * @param {*} event 17415 * @returns {boolean} 17416 */ 17417 const isStylus = event => { 17418 return event.touches && event.touches.length && event.touches[0].touchType === 'stylus'; 17419 }; 17420 17421 /** 17422 * https://github.com/sweetalert2/sweetalert2/issues/1891 17423 * 17424 * @param {TouchEvent} event 17425 * @returns {boolean} 17426 */ 17427 const isZoom = event => { 17428 return event.touches && event.touches.length > 1; 17429 }; 17430 const undoIOSfix = () => { 17431 if (hasClass(document.body, swalClasses.iosfix)) { 17432 const offset = parseInt(document.body.style.top, 10); 17433 removeClass(document.body, swalClasses.iosfix); 17434 document.body.style.top = ''; 17435 document.body.scrollTop = offset * -1; 17436 } 17437 }; 17438 17439 /** 17440 * Measure scrollbar width for padding body during modal show/hide 17441 * https://github.com/twbs/bootstrap/blob/master/js/src/modal.js 17442 * 17443 * @returns {number} 17444 */ 17445 const measureScrollbar = () => { 17446 const scrollDiv = document.createElement('div'); 17447 scrollDiv.className = swalClasses['scrollbar-measure']; 17448 document.body.appendChild(scrollDiv); 17449 const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 17450 document.body.removeChild(scrollDiv); 17451 return scrollbarWidth; 17452 }; 17453 17454 /** 17455 * Remember state in cases where opening and handling a modal will fiddle with it. 17456 * @type {number | null} 17457 */ 17458 let previousBodyPadding = null; 17459 17460 /** 17461 * @param {string} initialBodyOverflow 17462 */ 17463 const replaceScrollbarWithPadding = initialBodyOverflow => { 17464 // for queues, do not do this more than once 17465 if (previousBodyPadding !== null) { 17466 return; 17467 } 17468 // if the body has overflow 17469 if (document.body.scrollHeight > window.innerHeight || initialBodyOverflow === 'scroll' // https://github.com/sweetalert2/sweetalert2/issues/2663 17470 ) { 17471 // add padding so the content doesn't shift after removal of scrollbar 17472 previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right')); 17473 document.body.style.paddingRight = `${previousBodyPadding + measureScrollbar()}px`; 17474 } 17475 }; 17476 const undoReplaceScrollbarWithPadding = () => { 17477 if (previousBodyPadding !== null) { 17478 document.body.style.paddingRight = `${previousBodyPadding}px`; 17479 previousBodyPadding = null; 17480 } 17481 }; 17482 17483 /** 17484 * @param {SweetAlert} instance 17485 * @param {HTMLElement} container 17486 * @param {boolean} returnFocus 17487 * @param {Function} didClose 17488 */ 17489 function removePopupAndResetState(instance, container, returnFocus, didClose) { 17490 if (isToast()) { 17491 triggerDidCloseAndDispose(instance, didClose); 17492 } else { 17493 restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose)); 17494 removeKeydownHandler(globalState); 17495 } 17496 17497 // workaround for https://github.com/sweetalert2/sweetalert2/issues/2088 17498 // for some reason removing the container in Safari will scroll the document to bottom 17499 if (isSafariOrIOS) { 17500 container.setAttribute('style', 'display:none !important'); 17501 container.removeAttribute('class'); 17502 container.innerHTML = ''; 17503 } else { 17504 container.remove(); 17505 } 17506 if (isModal()) { 17507 undoReplaceScrollbarWithPadding(); 17508 undoIOSfix(); 17509 unsetAriaHidden(); 17510 } 17511 removeBodyClasses(); 17512 } 17513 17514 /** 17515 * Remove SweetAlert2 classes from body 17516 */ 17517 function removeBodyClasses() { 17518 removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]); 17519 } 17520 17521 /** 17522 * Instance method to close sweetAlert 17523 * 17524 * @param {any} resolveValue 17525 */ 17526 function close(resolveValue) { 17527 resolveValue = prepareResolveValue(resolveValue); 17528 const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this); 17529 const didClose = triggerClosePopup(this); 17530 if (this.isAwaitingPromise) { 17531 // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335 17532 if (!resolveValue.isDismissed) { 17533 handleAwaitingPromise(this); 17534 swalPromiseResolve(resolveValue); 17535 } 17536 } else if (didClose) { 17537 // Resolve Swal promise 17538 swalPromiseResolve(resolveValue); 17539 } 17540 } 17541 const triggerClosePopup = instance => { 17542 const popup = getPopup(); 17543 if (!popup) { 17544 return false; 17545 } 17546 const innerParams = privateProps.innerParams.get(instance); 17547 if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) { 17548 return false; 17549 } 17550 removeClass(popup, innerParams.showClass.popup); 17551 addClass(popup, innerParams.hideClass.popup); 17552 const backdrop = getContainer(); 17553 removeClass(backdrop, innerParams.showClass.backdrop); 17554 addClass(backdrop, innerParams.hideClass.backdrop); 17555 handlePopupAnimation(instance, popup, innerParams); 17556 return true; 17557 }; 17558 17559 /** 17560 * @param {any} error 17561 */ 17562 function rejectPromise(error) { 17563 const rejectPromise = privateMethods.swalPromiseReject.get(this); 17564 handleAwaitingPromise(this); 17565 if (rejectPromise) { 17566 // Reject Swal promise 17567 rejectPromise(error); 17568 } 17569 } 17570 17571 /** 17572 * @param {SweetAlert} instance 17573 */ 17574 const handleAwaitingPromise = instance => { 17575 if (instance.isAwaitingPromise) { 17576 delete instance.isAwaitingPromise; 17577 // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335 17578 if (!privateProps.innerParams.get(instance)) { 17579 instance._destroy(); 17580 } 17581 } 17582 }; 17583 17584 /** 17585 * @param {any} resolveValue 17586 * @returns {SweetAlertResult} 17587 */ 17588 const prepareResolveValue = resolveValue => { 17589 // When user calls Swal.close() 17590 if (typeof resolveValue === 'undefined') { 17591 return { 17592 isConfirmed: false, 17593 isDenied: false, 17594 isDismissed: true 17595 }; 17596 } 17597 return Object.assign({ 17598 isConfirmed: false, 17599 isDenied: false, 17600 isDismissed: false 17601 }, resolveValue); 17602 }; 17603 17604 /** 17605 * @param {SweetAlert} instance 17606 * @param {HTMLElement} popup 17607 * @param {SweetAlertOptions} innerParams 17608 */ 17609 const handlePopupAnimation = (instance, popup, innerParams) => { 17610 var _globalState$eventEmi; 17611 const container = getContainer(); 17612 // If animation is supported, animate 17613 const animationIsSupported = hasCssAnimation(popup); 17614 if (typeof innerParams.willClose === 'function') { 17615 innerParams.willClose(popup); 17616 } 17617 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit('willClose', popup); 17618 if (animationIsSupported) { 17619 animatePopup(instance, popup, container, innerParams.returnFocus, innerParams.didClose); 17620 } else { 17621 // Otherwise, remove immediately 17622 removePopupAndResetState(instance, container, innerParams.returnFocus, innerParams.didClose); 17623 } 17624 }; 17625 17626 /** 17627 * @param {SweetAlert} instance 17628 * @param {HTMLElement} popup 17629 * @param {HTMLElement} container 17630 * @param {boolean} returnFocus 17631 * @param {Function} didClose 17632 */ 17633 const animatePopup = (instance, popup, container, returnFocus, didClose) => { 17634 globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose); 17635 /** 17636 * @param {AnimationEvent | TransitionEvent} e 17637 */ 17638 const swalCloseAnimationFinished = function (e) { 17639 if (e.target === popup) { 17640 var _globalState$swalClos; 17641 (_globalState$swalClos = globalState.swalCloseEventFinishedCallback) === null || _globalState$swalClos === void 0 || _globalState$swalClos.call(globalState); 17642 delete globalState.swalCloseEventFinishedCallback; 17643 popup.removeEventListener('animationend', swalCloseAnimationFinished); 17644 popup.removeEventListener('transitionend', swalCloseAnimationFinished); 17645 } 17646 }; 17647 popup.addEventListener('animationend', swalCloseAnimationFinished); 17648 popup.addEventListener('transitionend', swalCloseAnimationFinished); 17649 }; 17650 17651 /** 17652 * @param {SweetAlert} instance 17653 * @param {Function} didClose 17654 */ 17655 const triggerDidCloseAndDispose = (instance, didClose) => { 17656 setTimeout(() => { 17657 var _globalState$eventEmi2; 17658 if (typeof didClose === 'function') { 17659 didClose.bind(instance.params)(); 17660 } 17661 (_globalState$eventEmi2 = globalState.eventEmitter) === null || _globalState$eventEmi2 === void 0 || _globalState$eventEmi2.emit('didClose'); 17662 // instance might have been destroyed already 17663 if (instance._destroy) { 17664 instance._destroy(); 17665 } 17666 }); 17667 }; 17668 17669 /** 17670 * Shows loader (spinner), this is useful with AJAX requests. 17671 * By default the loader be shown instead of the "Confirm" button. 17672 * 17673 * @param {HTMLButtonElement | null} [buttonToReplace] 17674 */ 17675 const showLoading = buttonToReplace => { 17676 let popup = getPopup(); 17677 if (!popup) { 17678 new Swal(); 17679 } 17680 popup = getPopup(); 17681 if (!popup) { 17682 return; 17683 } 17684 const loader = getLoader(); 17685 if (isToast()) { 17686 hide(getIcon()); 17687 } else { 17688 replaceButton(popup, buttonToReplace); 17689 } 17690 show(loader); 17691 popup.setAttribute('data-loading', 'true'); 17692 popup.setAttribute('aria-busy', 'true'); 17693 popup.focus(); 17694 }; 17695 17696 /** 17697 * @param {HTMLElement} popup 17698 * @param {HTMLButtonElement | null} [buttonToReplace] 17699 */ 17700 const replaceButton = (popup, buttonToReplace) => { 17701 const actions = getActions(); 17702 const loader = getLoader(); 17703 if (!actions || !loader) { 17704 return; 17705 } 17706 if (!buttonToReplace && isVisible$1(getConfirmButton())) { 17707 buttonToReplace = getConfirmButton(); 17708 } 17709 show(actions); 17710 if (buttonToReplace) { 17711 hide(buttonToReplace); 17712 loader.setAttribute('data-button-to-replace', buttonToReplace.className); 17713 actions.insertBefore(loader, buttonToReplace); 17714 } 17715 addClass([popup, actions], swalClasses.loading); 17716 }; 17717 17718 /** 17719 * @param {SweetAlert} instance 17720 * @param {SweetAlertOptions} params 17721 */ 17722 const handleInputOptionsAndValue = (instance, params) => { 17723 if (params.input === 'select' || params.input === 'radio') { 17724 handleInputOptions(instance, params); 17725 } else if (['text', 'email', 'number', 'tel', 'textarea'].some(i => i === params.input) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) { 17726 showLoading(getConfirmButton()); 17727 handleInputValue(instance, params); 17728 } 17729 }; 17730 17731 /** 17732 * @param {SweetAlert} instance 17733 * @param {SweetAlertOptions} innerParams 17734 * @returns {SweetAlertInputValue} 17735 */ 17736 const getInputValue = (instance, innerParams) => { 17737 const input = instance.getInput(); 17738 if (!input) { 17739 return null; 17740 } 17741 switch (innerParams.input) { 17742 case 'checkbox': 17743 return getCheckboxValue(input); 17744 case 'radio': 17745 return getRadioValue(input); 17746 case 'file': 17747 return getFileValue(input); 17748 default: 17749 return innerParams.inputAutoTrim ? input.value.trim() : input.value; 17750 } 17751 }; 17752 17753 /** 17754 * @param {HTMLInputElement} input 17755 * @returns {number} 17756 */ 17757 const getCheckboxValue = input => input.checked ? 1 : 0; 17758 17759 /** 17760 * @param {HTMLInputElement} input 17761 * @returns {string | null} 17762 */ 17763 const getRadioValue = input => input.checked ? input.value : null; 17764 17765 /** 17766 * @param {HTMLInputElement} input 17767 * @returns {FileList | File | null} 17768 */ 17769 const getFileValue = input => input.files && input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null; 17770 17771 /** 17772 * @param {SweetAlert} instance 17773 * @param {SweetAlertOptions} params 17774 */ 17775 const handleInputOptions = (instance, params) => { 17776 const popup = getPopup(); 17777 if (!popup) { 17778 return; 17779 } 17780 /** 17781 * @param {Record<string, any>} inputOptions 17782 */ 17783 const processInputOptions = inputOptions => { 17784 if (params.input === 'select') { 17785 populateSelectOptions(popup, formatInputOptions(inputOptions), params); 17786 } else if (params.input === 'radio') { 17787 populateRadioOptions(popup, formatInputOptions(inputOptions), params); 17788 } 17789 }; 17790 if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) { 17791 showLoading(getConfirmButton()); 17792 asPromise(params.inputOptions).then(inputOptions => { 17793 instance.hideLoading(); 17794 processInputOptions(inputOptions); 17795 }); 17796 } else if (typeof params.inputOptions === 'object') { 17797 processInputOptions(params.inputOptions); 17798 } else { 17799 error(`Unexpected type of inputOptions! Expected object, Map or Promise, got ${typeof params.inputOptions}`); 17800 } 17801 }; 17802 17803 /** 17804 * @param {SweetAlert} instance 17805 * @param {SweetAlertOptions} params 17806 */ 17807 const handleInputValue = (instance, params) => { 17808 const input = instance.getInput(); 17809 if (!input) { 17810 return; 17811 } 17812 hide(input); 17813 asPromise(params.inputValue).then(inputValue => { 17814 input.value = params.input === 'number' ? `${parseFloat(inputValue) || 0}` : `${inputValue}`; 17815 show(input); 17816 input.focus(); 17817 instance.hideLoading(); 17818 }).catch(err => { 17819 error(`Error in inputValue promise: ${err}`); 17820 input.value = ''; 17821 show(input); 17822 input.focus(); 17823 instance.hideLoading(); 17824 }); 17825 }; 17826 17827 /** 17828 * @param {HTMLElement} popup 17829 * @param {InputOptionFlattened[]} inputOptions 17830 * @param {SweetAlertOptions} params 17831 */ 17832 function populateSelectOptions(popup, inputOptions, params) { 17833 const select = getDirectChildByClass(popup, swalClasses.select); 17834 if (!select) { 17835 return; 17836 } 17837 /** 17838 * @param {HTMLElement} parent 17839 * @param {string} optionLabel 17840 * @param {string} optionValue 17841 */ 17842 const renderOption = (parent, optionLabel, optionValue) => { 17843 const option = document.createElement('option'); 17844 option.value = optionValue; 17845 setInnerHtml(option, optionLabel); 17846 option.selected = isSelected(optionValue, params.inputValue); 17847 parent.appendChild(option); 17848 }; 17849 inputOptions.forEach(inputOption => { 17850 const optionValue = inputOption[0]; 17851 const optionLabel = inputOption[1]; 17852 // <optgroup> spec: 17853 // https://www.w3.org/TR/html401/interact/forms.html#h-17.6 17854 // "...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)..." 17855 // check whether this is a <optgroup> 17856 if (Array.isArray(optionLabel)) { 17857 // if it is an array, then it is an <optgroup> 17858 const optgroup = document.createElement('optgroup'); 17859 optgroup.label = optionValue; 17860 optgroup.disabled = false; // not configurable for now 17861 select.appendChild(optgroup); 17862 optionLabel.forEach(o => renderOption(optgroup, o[1], o[0])); 17863 } else { 17864 // case of <option> 17865 renderOption(select, optionLabel, optionValue); 17866 } 17867 }); 17868 select.focus(); 17869 } 17870 17871 /** 17872 * @param {HTMLElement} popup 17873 * @param {InputOptionFlattened[]} inputOptions 17874 * @param {SweetAlertOptions} params 17875 */ 17876 function populateRadioOptions(popup, inputOptions, params) { 17877 const radio = getDirectChildByClass(popup, swalClasses.radio); 17878 if (!radio) { 17879 return; 17880 } 17881 inputOptions.forEach(inputOption => { 17882 const radioValue = inputOption[0]; 17883 const radioLabel = inputOption[1]; 17884 const radioInput = document.createElement('input'); 17885 const radioLabelElement = document.createElement('label'); 17886 radioInput.type = 'radio'; 17887 radioInput.name = swalClasses.radio; 17888 radioInput.value = radioValue; 17889 if (isSelected(radioValue, params.inputValue)) { 17890 radioInput.checked = true; 17891 } 17892 const label = document.createElement('span'); 17893 setInnerHtml(label, radioLabel); 17894 label.className = swalClasses.label; 17895 radioLabelElement.appendChild(radioInput); 17896 radioLabelElement.appendChild(label); 17897 radio.appendChild(radioLabelElement); 17898 }); 17899 const radios = radio.querySelectorAll('input'); 17900 if (radios.length) { 17901 radios[0].focus(); 17902 } 17903 } 17904 17905 /** 17906 * Converts `inputOptions` into an array of `[value, label]`s 17907 * 17908 * @param {Record<string, any>} inputOptions 17909 * @typedef {string[]} InputOptionFlattened 17910 * @returns {InputOptionFlattened[]} 17911 */ 17912 const formatInputOptions = inputOptions => { 17913 /** @type {InputOptionFlattened[]} */ 17914 const result = []; 17915 if (inputOptions instanceof Map) { 17916 inputOptions.forEach((value, key) => { 17917 let valueFormatted = value; 17918 if (typeof valueFormatted === 'object') { 17919 // case of <optgroup> 17920 valueFormatted = formatInputOptions(valueFormatted); 17921 } 17922 result.push([key, valueFormatted]); 17923 }); 17924 } else { 17925 Object.keys(inputOptions).forEach(key => { 17926 let valueFormatted = inputOptions[key]; 17927 if (typeof valueFormatted === 'object') { 17928 // case of <optgroup> 17929 valueFormatted = formatInputOptions(valueFormatted); 17930 } 17931 result.push([key, valueFormatted]); 17932 }); 17933 } 17934 return result; 17935 }; 17936 17937 /** 17938 * @param {string} optionValue 17939 * @param {SweetAlertInputValue} inputValue 17940 * @returns {boolean} 17941 */ 17942 const isSelected = (optionValue, inputValue) => { 17943 return !!inputValue && inputValue.toString() === optionValue.toString(); 17944 }; 17945 17946 /** 17947 * @param {SweetAlert} instance 17948 */ 17949 const handleConfirmButtonClick = instance => { 17950 const innerParams = privateProps.innerParams.get(instance); 17951 instance.disableButtons(); 17952 if (innerParams.input) { 17953 handleConfirmOrDenyWithInput(instance, 'confirm'); 17954 } else { 17955 confirm(instance, true); 17956 } 17957 }; 17958 17959 /** 17960 * @param {SweetAlert} instance 17961 */ 17962 const handleDenyButtonClick = instance => { 17963 const innerParams = privateProps.innerParams.get(instance); 17964 instance.disableButtons(); 17965 if (innerParams.returnInputValueOnDeny) { 17966 handleConfirmOrDenyWithInput(instance, 'deny'); 17967 } else { 17968 deny(instance, false); 17969 } 17970 }; 17971 17972 /** 17973 * @param {SweetAlert} instance 17974 * @param {Function} dismissWith 17975 */ 17976 const handleCancelButtonClick = (instance, dismissWith) => { 17977 instance.disableButtons(); 17978 dismissWith(DismissReason.cancel); 17979 }; 17980 17981 /** 17982 * @param {SweetAlert} instance 17983 * @param {'confirm' | 'deny'} type 17984 */ 17985 const handleConfirmOrDenyWithInput = (instance, type) => { 17986 const innerParams = privateProps.innerParams.get(instance); 17987 if (!innerParams.input) { 17988 error(`The "input" parameter is needed to be set when using returnInputValueOn${capitalizeFirstLetter(type)}`); 17989 return; 17990 } 17991 const input = instance.getInput(); 17992 const inputValue = getInputValue(instance, innerParams); 17993 if (innerParams.inputValidator) { 17994 handleInputValidator(instance, inputValue, type); 17995 } else if (input && !input.checkValidity()) { 17996 instance.enableButtons(); 17997 instance.showValidationMessage(innerParams.validationMessage || input.validationMessage); 17998 } else if (type === 'deny') { 17999 deny(instance, inputValue); 18000 } else { 18001 confirm(instance, inputValue); 18002 } 18003 }; 18004 18005 /** 18006 * @param {SweetAlert} instance 18007 * @param {SweetAlertInputValue} inputValue 18008 * @param {'confirm' | 'deny'} type 18009 */ 18010 const handleInputValidator = (instance, inputValue, type) => { 18011 const innerParams = privateProps.innerParams.get(instance); 18012 instance.disableInput(); 18013 const validationPromise = Promise.resolve().then(() => asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage))); 18014 validationPromise.then(validationMessage => { 18015 instance.enableButtons(); 18016 instance.enableInput(); 18017 if (validationMessage) { 18018 instance.showValidationMessage(validationMessage); 18019 } else if (type === 'deny') { 18020 deny(instance, inputValue); 18021 } else { 18022 confirm(instance, inputValue); 18023 } 18024 }); 18025 }; 18026 18027 /** 18028 * @param {SweetAlert} instance 18029 * @param {any} value 18030 */ 18031 const deny = (instance, value) => { 18032 const innerParams = privateProps.innerParams.get(instance || undefined); 18033 if (innerParams.showLoaderOnDeny) { 18034 showLoading(getDenyButton()); 18035 } 18036 if (innerParams.preDeny) { 18037 instance.isAwaitingPromise = true; // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received 18038 const preDenyPromise = Promise.resolve().then(() => asPromise(innerParams.preDeny(value, innerParams.validationMessage))); 18039 preDenyPromise.then(preDenyValue => { 18040 if (preDenyValue === false) { 18041 instance.hideLoading(); 18042 handleAwaitingPromise(instance); 18043 } else { 18044 instance.close({ 18045 isDenied: true, 18046 value: typeof preDenyValue === 'undefined' ? value : preDenyValue 18047 }); 18048 } 18049 }).catch(error => rejectWith(instance || undefined, error)); 18050 } else { 18051 instance.close({ 18052 isDenied: true, 18053 value 18054 }); 18055 } 18056 }; 18057 18058 /** 18059 * @param {SweetAlert} instance 18060 * @param {any} value 18061 */ 18062 const succeedWith = (instance, value) => { 18063 instance.close({ 18064 isConfirmed: true, 18065 value 18066 }); 18067 }; 18068 18069 /** 18070 * 18071 * @param {SweetAlert} instance 18072 * @param {string} error 18073 */ 18074 const rejectWith = (instance, error) => { 18075 instance.rejectPromise(error); 18076 }; 18077 18078 /** 18079 * 18080 * @param {SweetAlert} instance 18081 * @param {any} value 18082 */ 18083 const confirm = (instance, value) => { 18084 const innerParams = privateProps.innerParams.get(instance || undefined); 18085 if (innerParams.showLoaderOnConfirm) { 18086 showLoading(); 18087 } 18088 if (innerParams.preConfirm) { 18089 instance.resetValidationMessage(); 18090 instance.isAwaitingPromise = true; // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received 18091 const preConfirmPromise = Promise.resolve().then(() => asPromise(innerParams.preConfirm(value, innerParams.validationMessage))); 18092 preConfirmPromise.then(preConfirmValue => { 18093 if (isVisible$1(getValidationMessage()) || preConfirmValue === false) { 18094 instance.hideLoading(); 18095 handleAwaitingPromise(instance); 18096 } else { 18097 succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue); 18098 } 18099 }).catch(error => rejectWith(instance || undefined, error)); 18100 } else { 18101 succeedWith(instance, value); 18102 } 18103 }; 18104 18105 /** 18106 * Hides loader and shows back the button which was hidden by .showLoading() 18107 */ 18108 function hideLoading() { 18109 // do nothing if popup is closed 18110 const innerParams = privateProps.innerParams.get(this); 18111 if (!innerParams) { 18112 return; 18113 } 18114 const domCache = privateProps.domCache.get(this); 18115 hide(domCache.loader); 18116 if (isToast()) { 18117 if (innerParams.icon) { 18118 show(getIcon()); 18119 } 18120 } else { 18121 showRelatedButton(domCache); 18122 } 18123 removeClass([domCache.popup, domCache.actions], swalClasses.loading); 18124 domCache.popup.removeAttribute('aria-busy'); 18125 domCache.popup.removeAttribute('data-loading'); 18126 domCache.confirmButton.disabled = false; 18127 domCache.denyButton.disabled = false; 18128 domCache.cancelButton.disabled = false; 18129 } 18130 const showRelatedButton = domCache => { 18131 const buttonToReplace = domCache.popup.getElementsByClassName(domCache.loader.getAttribute('data-button-to-replace')); 18132 if (buttonToReplace.length) { 18133 show(buttonToReplace[0], 'inline-block'); 18134 } else if (allButtonsAreHidden()) { 18135 hide(domCache.actions); 18136 } 18137 }; 18138 18139 /** 18140 * Gets the input DOM node, this method works with input parameter. 18141 * 18142 * @returns {HTMLInputElement | null} 18143 */ 18144 function getInput() { 18145 const innerParams = privateProps.innerParams.get(this); 18146 const domCache = privateProps.domCache.get(this); 18147 if (!domCache) { 18148 return null; 18149 } 18150 return getInput$1(domCache.popup, innerParams.input); 18151 } 18152 18153 /** 18154 * @param {SweetAlert} instance 18155 * @param {string[]} buttons 18156 * @param {boolean} disabled 18157 */ 18158 function setButtonsDisabled(instance, buttons, disabled) { 18159 const domCache = privateProps.domCache.get(instance); 18160 buttons.forEach(button => { 18161 domCache[button].disabled = disabled; 18162 }); 18163 } 18164 18165 /** 18166 * @param {HTMLInputElement | null} input 18167 * @param {boolean} disabled 18168 */ 18169 function setInputDisabled(input, disabled) { 18170 const popup = getPopup(); 18171 if (!popup || !input) { 18172 return; 18173 } 18174 if (input.type === 'radio') { 18175 /** @type {NodeListOf<HTMLInputElement>} */ 18176 const radios = popup.querySelectorAll(`[name="${swalClasses.radio}"]`); 18177 for (let i = 0; i < radios.length; i++) { 18178 radios[i].disabled = disabled; 18179 } 18180 } else { 18181 input.disabled = disabled; 18182 } 18183 } 18184 18185 /** 18186 * Enable all the buttons 18187 * @this {SweetAlert} 18188 */ 18189 function enableButtons() { 18190 setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false); 18191 } 18192 18193 /** 18194 * Disable all the buttons 18195 * @this {SweetAlert} 18196 */ 18197 function disableButtons() { 18198 setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true); 18199 } 18200 18201 /** 18202 * Enable the input field 18203 * @this {SweetAlert} 18204 */ 18205 function enableInput() { 18206 setInputDisabled(this.getInput(), false); 18207 } 18208 18209 /** 18210 * Disable the input field 18211 * @this {SweetAlert} 18212 */ 18213 function disableInput() { 18214 setInputDisabled(this.getInput(), true); 18215 } 18216 18217 /** 18218 * Show block with validation message 18219 * 18220 * @param {string} error 18221 * @this {SweetAlert} 18222 */ 18223 function showValidationMessage(error) { 18224 const domCache = privateProps.domCache.get(this); 18225 const params = privateProps.innerParams.get(this); 18226 setInnerHtml(domCache.validationMessage, error); 18227 domCache.validationMessage.className = swalClasses['validation-message']; 18228 if (params.customClass && params.customClass.validationMessage) { 18229 addClass(domCache.validationMessage, params.customClass.validationMessage); 18230 } 18231 show(domCache.validationMessage); 18232 const input = this.getInput(); 18233 if (input) { 18234 input.setAttribute('aria-invalid', 'true'); 18235 input.setAttribute('aria-describedby', swalClasses['validation-message']); 18236 focusInput(input); 18237 addClass(input, swalClasses.inputerror); 18238 } 18239 } 18240 18241 /** 18242 * Hide block with validation message 18243 * 18244 * @this {SweetAlert} 18245 */ 18246 function resetValidationMessage() { 18247 const domCache = privateProps.domCache.get(this); 18248 if (domCache.validationMessage) { 18249 hide(domCache.validationMessage); 18250 } 18251 const input = this.getInput(); 18252 if (input) { 18253 input.removeAttribute('aria-invalid'); 18254 input.removeAttribute('aria-describedby'); 18255 removeClass(input, swalClasses.inputerror); 18256 } 18257 } 18258 18259 const defaultParams = { 18260 title: '', 18261 titleText: '', 18262 text: '', 18263 html: '', 18264 footer: '', 18265 icon: undefined, 18266 iconColor: undefined, 18267 iconHtml: undefined, 18268 template: undefined, 18269 toast: false, 18270 animation: true, 18271 showClass: { 18272 popup: 'swal2-show', 18273 backdrop: 'swal2-backdrop-show', 18274 icon: 'swal2-icon-show' 18275 }, 18276 hideClass: { 18277 popup: 'swal2-hide', 18278 backdrop: 'swal2-backdrop-hide', 18279 icon: 'swal2-icon-hide' 18280 }, 18281 customClass: {}, 18282 target: 'body', 18283 color: undefined, 18284 backdrop: true, 18285 heightAuto: true, 18286 allowOutsideClick: true, 18287 allowEscapeKey: true, 18288 allowEnterKey: true, 18289 stopKeydownPropagation: true, 18290 keydownListenerCapture: false, 18291 showConfirmButton: true, 18292 showDenyButton: false, 18293 showCancelButton: false, 18294 preConfirm: undefined, 18295 preDeny: undefined, 18296 confirmButtonText: 'OK', 18297 confirmButtonAriaLabel: '', 18298 confirmButtonColor: undefined, 18299 denyButtonText: 'No', 18300 denyButtonAriaLabel: '', 18301 denyButtonColor: undefined, 18302 cancelButtonText: 'Cancel', 18303 cancelButtonAriaLabel: '', 18304 cancelButtonColor: undefined, 18305 buttonsStyling: true, 18306 reverseButtons: false, 18307 focusConfirm: true, 18308 focusDeny: false, 18309 focusCancel: false, 18310 returnFocus: true, 18311 showCloseButton: false, 18312 closeButtonHtml: '×', 18313 closeButtonAriaLabel: 'Close this dialog', 18314 loaderHtml: '', 18315 showLoaderOnConfirm: false, 18316 showLoaderOnDeny: false, 18317 imageUrl: undefined, 18318 imageWidth: undefined, 18319 imageHeight: undefined, 18320 imageAlt: '', 18321 timer: undefined, 18322 timerProgressBar: false, 18323 width: undefined, 18324 padding: undefined, 18325 background: undefined, 18326 input: undefined, 18327 inputPlaceholder: '', 18328 inputLabel: '', 18329 inputValue: '', 18330 inputOptions: {}, 18331 inputAutoFocus: true, 18332 inputAutoTrim: true, 18333 inputAttributes: {}, 18334 inputValidator: undefined, 18335 returnInputValueOnDeny: false, 18336 validationMessage: undefined, 18337 grow: false, 18338 position: 'center', 18339 progressSteps: [], 18340 currentProgressStep: undefined, 18341 progressStepsDistance: undefined, 18342 willOpen: undefined, 18343 didOpen: undefined, 18344 didRender: undefined, 18345 willClose: undefined, 18346 didClose: undefined, 18347 didDestroy: undefined, 18348 scrollbarPadding: true 18349 }; 18350 const updatableParams = ['allowEscapeKey', 'allowOutsideClick', 'background', 'buttonsStyling', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonText', 'closeButtonAriaLabel', 'closeButtonHtml', 'color', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonText', 'currentProgressStep', 'customClass', 'denyButtonAriaLabel', 'denyButtonColor', 'denyButtonText', 'didClose', 'didDestroy', 'footer', 'hideClass', 'html', 'icon', 'iconColor', 'iconHtml', 'imageAlt', 'imageHeight', 'imageUrl', 'imageWidth', 'preConfirm', 'preDeny', 'progressSteps', 'returnFocus', 'reverseButtons', 'showCancelButton', 'showCloseButton', 'showConfirmButton', 'showDenyButton', 'text', 'title', 'titleText', 'willClose']; 18351 18352 /** @type {Record<string, string | undefined>} */ 18353 const deprecatedParams = { 18354 allowEnterKey: undefined 18355 }; 18356 const toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusDeny', 'focusCancel', 'returnFocus', 'heightAuto', 'keydownListenerCapture']; 18357 18358 /** 18359 * Is valid parameter 18360 * 18361 * @param {string} paramName 18362 * @returns {boolean} 18363 */ 18364 const isValidParameter = paramName => { 18365 return Object.prototype.hasOwnProperty.call(defaultParams, paramName); 18366 }; 18367 18368 /** 18369 * Is valid parameter for Swal.update() method 18370 * 18371 * @param {string} paramName 18372 * @returns {boolean} 18373 */ 18374 const isUpdatableParameter = paramName => { 18375 return updatableParams.indexOf(paramName) !== -1; 18376 }; 18377 18378 /** 18379 * Is deprecated parameter 18380 * 18381 * @param {string} paramName 18382 * @returns {string | undefined} 18383 */ 18384 const isDeprecatedParameter = paramName => { 18385 return deprecatedParams[paramName]; 18386 }; 18387 18388 /** 18389 * @param {string} param 18390 */ 18391 const checkIfParamIsValid = param => { 18392 if (!isValidParameter(param)) { 18393 warn(`Unknown parameter "${param}"`); 18394 } 18395 }; 18396 18397 /** 18398 * @param {string} param 18399 */ 18400 const checkIfToastParamIsValid = param => { 18401 if (toastIncompatibleParams.includes(param)) { 18402 warn(`The parameter "${param}" is incompatible with toasts`); 18403 } 18404 }; 18405 18406 /** 18407 * @param {string} param 18408 */ 18409 const checkIfParamIsDeprecated = param => { 18410 const isDeprecated = isDeprecatedParameter(param); 18411 if (isDeprecated) { 18412 warnAboutDeprecation(param, isDeprecated); 18413 } 18414 }; 18415 18416 /** 18417 * Show relevant warnings for given params 18418 * 18419 * @param {SweetAlertOptions} params 18420 */ 18421 const showWarningsForParams = params => { 18422 if (params.backdrop === false && params.allowOutsideClick) { 18423 warn('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'); 18424 } 18425 for (const param in params) { 18426 checkIfParamIsValid(param); 18427 if (params.toast) { 18428 checkIfToastParamIsValid(param); 18429 } 18430 checkIfParamIsDeprecated(param); 18431 } 18432 }; 18433 18434 /** 18435 * Updates popup parameters. 18436 * 18437 * @param {SweetAlertOptions} params 18438 */ 18439 function update(params) { 18440 const popup = getPopup(); 18441 const innerParams = privateProps.innerParams.get(this); 18442 if (!popup || hasClass(popup, innerParams.hideClass.popup)) { 18443 warn(`You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.`); 18444 return; 18445 } 18446 const validUpdatableParams = filterValidParams(params); 18447 const updatedParams = Object.assign({}, innerParams, validUpdatableParams); 18448 render(this, updatedParams); 18449 privateProps.innerParams.set(this, updatedParams); 18450 Object.defineProperties(this, { 18451 params: { 18452 value: Object.assign({}, this.params, params), 18453 writable: false, 18454 enumerable: true 18455 } 18456 }); 18457 } 18458 18459 /** 18460 * @param {SweetAlertOptions} params 18461 * @returns {SweetAlertOptions} 18462 */ 18463 const filterValidParams = params => { 18464 const validUpdatableParams = {}; 18465 Object.keys(params).forEach(param => { 18466 if (isUpdatableParameter(param)) { 18467 validUpdatableParams[param] = params[param]; 18468 } else { 18469 warn(`Invalid parameter to update: ${param}`); 18470 } 18471 }); 18472 return validUpdatableParams; 18473 }; 18474 18475 /** 18476 * Dispose the current SweetAlert2 instance 18477 */ 18478 function _destroy() { 18479 const domCache = privateProps.domCache.get(this); 18480 const innerParams = privateProps.innerParams.get(this); 18481 if (!innerParams) { 18482 disposeWeakMaps(this); // The WeakMaps might have been partly destroyed, we must recall it to dispose any remaining WeakMaps #2335 18483 return; // This instance has already been destroyed 18484 } 18485 18486 // Check if there is another Swal closing 18487 if (domCache.popup && globalState.swalCloseEventFinishedCallback) { 18488 globalState.swalCloseEventFinishedCallback(); 18489 delete globalState.swalCloseEventFinishedCallback; 18490 } 18491 if (typeof innerParams.didDestroy === 'function') { 18492 innerParams.didDestroy(); 18493 } 18494 globalState.eventEmitter.emit('didDestroy'); 18495 disposeSwal(this); 18496 } 18497 18498 /** 18499 * @param {SweetAlert} instance 18500 */ 18501 const disposeSwal = instance => { 18502 disposeWeakMaps(instance); 18503 // Unset this.params so GC will dispose it (#1569) 18504 delete instance.params; 18505 // Unset globalState props so GC will dispose globalState (#1569) 18506 delete globalState.keydownHandler; 18507 delete globalState.keydownTarget; 18508 // Unset currentInstance 18509 delete globalState.currentInstance; 18510 }; 18511 18512 /** 18513 * @param {SweetAlert} instance 18514 */ 18515 const disposeWeakMaps = instance => { 18516 // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335 18517 if (instance.isAwaitingPromise) { 18518 unsetWeakMaps(privateProps, instance); 18519 instance.isAwaitingPromise = true; 18520 } else { 18521 unsetWeakMaps(privateMethods, instance); 18522 unsetWeakMaps(privateProps, instance); 18523 delete instance.isAwaitingPromise; 18524 // Unset instance methods 18525 delete instance.disableButtons; 18526 delete instance.enableButtons; 18527 delete instance.getInput; 18528 delete instance.disableInput; 18529 delete instance.enableInput; 18530 delete instance.hideLoading; 18531 delete instance.disableLoading; 18532 delete instance.showValidationMessage; 18533 delete instance.resetValidationMessage; 18534 delete instance.close; 18535 delete instance.closePopup; 18536 delete instance.closeModal; 18537 delete instance.closeToast; 18538 delete instance.rejectPromise; 18539 delete instance.update; 18540 delete instance._destroy; 18541 } 18542 }; 18543 18544 /** 18545 * @param {object} obj 18546 * @param {SweetAlert} instance 18547 */ 18548 const unsetWeakMaps = (obj, instance) => { 18549 for (const i in obj) { 18550 obj[i].delete(instance); 18551 } 18552 }; 18553 18554 var instanceMethods = /*#__PURE__*/Object.freeze({ 18555 __proto__: null, 18556 _destroy: _destroy, 18557 close: close, 18558 closeModal: close, 18559 closePopup: close, 18560 closeToast: close, 18561 disableButtons: disableButtons, 18562 disableInput: disableInput, 18563 disableLoading: hideLoading, 18564 enableButtons: enableButtons, 18565 enableInput: enableInput, 18566 getInput: getInput, 18567 handleAwaitingPromise: handleAwaitingPromise, 18568 hideLoading: hideLoading, 18569 rejectPromise: rejectPromise, 18570 resetValidationMessage: resetValidationMessage, 18571 showValidationMessage: showValidationMessage, 18572 update: update 18573 }); 18574 18575 /** 18576 * @param {SweetAlertOptions} innerParams 18577 * @param {DomCache} domCache 18578 * @param {Function} dismissWith 18579 */ 18580 const handlePopupClick = (innerParams, domCache, dismissWith) => { 18581 if (innerParams.toast) { 18582 handleToastClick(innerParams, domCache, dismissWith); 18583 } else { 18584 // Ignore click events that had mousedown on the popup but mouseup on the container 18585 // This can happen when the user drags a slider 18586 handleModalMousedown(domCache); 18587 18588 // Ignore click events that had mousedown on the container but mouseup on the popup 18589 handleContainerMousedown(domCache); 18590 handleModalClick(innerParams, domCache, dismissWith); 18591 } 18592 }; 18593 18594 /** 18595 * @param {SweetAlertOptions} innerParams 18596 * @param {DomCache} domCache 18597 * @param {Function} dismissWith 18598 */ 18599 const handleToastClick = (innerParams, domCache, dismissWith) => { 18600 // Closing toast by internal click 18601 domCache.popup.onclick = () => { 18602 if (innerParams && (isAnyButtonShown(innerParams) || innerParams.timer || innerParams.input)) { 18603 return; 18604 } 18605 dismissWith(DismissReason.close); 18606 }; 18607 }; 18608 18609 /** 18610 * @param {SweetAlertOptions} innerParams 18611 * @returns {boolean} 18612 */ 18613 const isAnyButtonShown = innerParams => { 18614 return !!(innerParams.showConfirmButton || innerParams.showDenyButton || innerParams.showCancelButton || innerParams.showCloseButton); 18615 }; 18616 let ignoreOutsideClick = false; 18617 18618 /** 18619 * @param {DomCache} domCache 18620 */ 18621 const handleModalMousedown = domCache => { 18622 domCache.popup.onmousedown = () => { 18623 domCache.container.onmouseup = function (e) { 18624 domCache.container.onmouseup = () => {}; 18625 // We only check if the mouseup target is the container because usually it doesn't 18626 // have any other direct children aside of the popup 18627 if (e.target === domCache.container) { 18628 ignoreOutsideClick = true; 18629 } 18630 }; 18631 }; 18632 }; 18633 18634 /** 18635 * @param {DomCache} domCache 18636 */ 18637 const handleContainerMousedown = domCache => { 18638 domCache.container.onmousedown = e => { 18639 // prevent the modal text from being selected on double click on the container (allowOutsideClick: false) 18640 if (e.target === domCache.container) { 18641 e.preventDefault(); 18642 } 18643 domCache.popup.onmouseup = function (e) { 18644 domCache.popup.onmouseup = () => {}; 18645 // We also need to check if the mouseup target is a child of the popup 18646 if (e.target === domCache.popup || e.target instanceof HTMLElement && domCache.popup.contains(e.target)) { 18647 ignoreOutsideClick = true; 18648 } 18649 }; 18650 }; 18651 }; 18652 18653 /** 18654 * @param {SweetAlertOptions} innerParams 18655 * @param {DomCache} domCache 18656 * @param {Function} dismissWith 18657 */ 18658 const handleModalClick = (innerParams, domCache, dismissWith) => { 18659 domCache.container.onclick = e => { 18660 if (ignoreOutsideClick) { 18661 ignoreOutsideClick = false; 18662 return; 18663 } 18664 if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) { 18665 dismissWith(DismissReason.backdrop); 18666 } 18667 }; 18668 }; 18669 18670 const isJqueryElement = elem => typeof elem === 'object' && elem.jquery; 18671 const isElement = elem => elem instanceof Element || isJqueryElement(elem); 18672 const argsToParams = args => { 18673 const params = {}; 18674 if (typeof args[0] === 'object' && !isElement(args[0])) { 18675 Object.assign(params, args[0]); 18676 } else { 18677 ['title', 'html', 'icon'].forEach((name, index) => { 18678 const arg = args[index]; 18679 if (typeof arg === 'string' || isElement(arg)) { 18680 params[name] = arg; 18681 } else if (arg !== undefined) { 18682 error(`Unexpected type of ${name}! Expected "string" or "Element", got ${typeof arg}`); 18683 } 18684 }); 18685 } 18686 return params; 18687 }; 18688 18689 /** 18690 * Main method to create a new SweetAlert2 popup 18691 * 18692 * @param {...SweetAlertOptions} args 18693 * @returns {Promise<SweetAlertResult>} 18694 */ 18695 function fire() { 18696 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 18697 args[_key] = arguments[_key]; 18698 } 18699 return new this(...args); 18700 } 18701 18702 /** 18703 * Returns an extended version of `Swal` containing `params` as defaults. 18704 * Useful for reusing Swal configuration. 18705 * 18706 * For example: 18707 * 18708 * Before: 18709 * const textPromptOptions = { input: 'text', showCancelButton: true } 18710 * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' }) 18711 * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' }) 18712 * 18713 * After: 18714 * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true }) 18715 * const {value: firstName} = await TextPrompt('What is your first name?') 18716 * const {value: lastName} = await TextPrompt('What is your last name?') 18717 * 18718 * @param {SweetAlertOptions} mixinParams 18719 * @returns {SweetAlert} 18720 */ 18721 function mixin(mixinParams) { 18722 class MixinSwal extends this { 18723 _main(params, priorityMixinParams) { 18724 return super._main(params, Object.assign({}, mixinParams, priorityMixinParams)); 18725 } 18726 } 18727 // @ts-ignore 18728 return MixinSwal; 18729 } 18730 18731 /** 18732 * If `timer` parameter is set, returns number of milliseconds of timer remained. 18733 * Otherwise, returns undefined. 18734 * 18735 * @returns {number | undefined} 18736 */ 18737 const getTimerLeft = () => { 18738 return globalState.timeout && globalState.timeout.getTimerLeft(); 18739 }; 18740 18741 /** 18742 * Stop timer. Returns number of milliseconds of timer remained. 18743 * If `timer` parameter isn't set, returns undefined. 18744 * 18745 * @returns {number | undefined} 18746 */ 18747 const stopTimer = () => { 18748 if (globalState.timeout) { 18749 stopTimerProgressBar(); 18750 return globalState.timeout.stop(); 18751 } 18752 }; 18753 18754 /** 18755 * Resume timer. Returns number of milliseconds of timer remained. 18756 * If `timer` parameter isn't set, returns undefined. 18757 * 18758 * @returns {number | undefined} 18759 */ 18760 const resumeTimer = () => { 18761 if (globalState.timeout) { 18762 const remaining = globalState.timeout.start(); 18763 animateTimerProgressBar(remaining); 18764 return remaining; 18765 } 18766 }; 18767 18768 /** 18769 * Resume timer. Returns number of milliseconds of timer remained. 18770 * If `timer` parameter isn't set, returns undefined. 18771 * 18772 * @returns {number | undefined} 18773 */ 18774 const toggleTimer = () => { 18775 const timer = globalState.timeout; 18776 return timer && (timer.running ? stopTimer() : resumeTimer()); 18777 }; 18778 18779 /** 18780 * Increase timer. Returns number of milliseconds of an updated timer. 18781 * If `timer` parameter isn't set, returns undefined. 18782 * 18783 * @param {number} ms 18784 * @returns {number | undefined} 18785 */ 18786 const increaseTimer = ms => { 18787 if (globalState.timeout) { 18788 const remaining = globalState.timeout.increase(ms); 18789 animateTimerProgressBar(remaining, true); 18790 return remaining; 18791 } 18792 }; 18793 18794 /** 18795 * Check if timer is running. Returns true if timer is running 18796 * or false if timer is paused or stopped. 18797 * If `timer` parameter isn't set, returns undefined 18798 * 18799 * @returns {boolean} 18800 */ 18801 const isTimerRunning = () => { 18802 return !!(globalState.timeout && globalState.timeout.isRunning()); 18803 }; 18804 18805 let bodyClickListenerAdded = false; 18806 const clickHandlers = {}; 18807 18808 /** 18809 * @param {string} attr 18810 */ 18811 function bindClickHandler() { 18812 let attr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'data-swal-template'; 18813 clickHandlers[attr] = this; 18814 if (!bodyClickListenerAdded) { 18815 document.body.addEventListener('click', bodyClickListener); 18816 bodyClickListenerAdded = true; 18817 } 18818 } 18819 const bodyClickListener = event => { 18820 for (let el = event.target; el && el !== document; el = el.parentNode) { 18821 for (const attr in clickHandlers) { 18822 const template = el.getAttribute(attr); 18823 if (template) { 18824 clickHandlers[attr].fire({ 18825 template 18826 }); 18827 return; 18828 } 18829 } 18830 } 18831 }; 18832 18833 // Source: https://gist.github.com/mudge/5830382?permalink_comment_id=2691957#gistcomment-2691957 18834 18835 class EventEmitter { 18836 constructor() { 18837 /** @type {Events} */ 18838 this.events = {}; 18839 } 18840 18841 /** 18842 * @param {string} eventName 18843 * @returns {EventHandlers} 18844 */ 18845 _getHandlersByEventName(eventName) { 18846 if (typeof this.events[eventName] === 'undefined') { 18847 // not Set because we need to keep the FIFO order 18848 // https://github.com/sweetalert2/sweetalert2/pull/2763#discussion_r1748990334 18849 this.events[eventName] = []; 18850 } 18851 return this.events[eventName]; 18852 } 18853 18854 /** 18855 * @param {string} eventName 18856 * @param {EventHandler} eventHandler 18857 */ 18858 on(eventName, eventHandler) { 18859 const currentHandlers = this._getHandlersByEventName(eventName); 18860 if (!currentHandlers.includes(eventHandler)) { 18861 currentHandlers.push(eventHandler); 18862 } 18863 } 18864 18865 /** 18866 * @param {string} eventName 18867 * @param {EventHandler} eventHandler 18868 */ 18869 once(eventName, eventHandler) { 18870 var _this = this; 18871 /** 18872 * @param {Array} args 18873 */ 18874 const onceFn = function () { 18875 _this.removeListener(eventName, onceFn); 18876 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 18877 args[_key] = arguments[_key]; 18878 } 18879 eventHandler.apply(_this, args); 18880 }; 18881 this.on(eventName, onceFn); 18882 } 18883 18884 /** 18885 * @param {string} eventName 18886 * @param {Array} args 18887 */ 18888 emit(eventName) { 18889 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 18890 args[_key2 - 1] = arguments[_key2]; 18891 } 18892 this._getHandlersByEventName(eventName).forEach( 18893 /** 18894 * @param {EventHandler} eventHandler 18895 */ 18896 eventHandler => { 18897 try { 18898 eventHandler.apply(this, args); 18899 } catch (error) { 18900 console.error(error); 18901 } 18902 }); 18903 } 18904 18905 /** 18906 * @param {string} eventName 18907 * @param {EventHandler} eventHandler 18908 */ 18909 removeListener(eventName, eventHandler) { 18910 const currentHandlers = this._getHandlersByEventName(eventName); 18911 const index = currentHandlers.indexOf(eventHandler); 18912 if (index > -1) { 18913 currentHandlers.splice(index, 1); 18914 } 18915 } 18916 18917 /** 18918 * @param {string} eventName 18919 */ 18920 removeAllListeners(eventName) { 18921 if (this.events[eventName] !== undefined) { 18922 // https://github.com/sweetalert2/sweetalert2/pull/2763#discussion_r1749239222 18923 this.events[eventName].length = 0; 18924 } 18925 } 18926 reset() { 18927 this.events = {}; 18928 } 18929 } 18930 18931 globalState.eventEmitter = new EventEmitter(); 18932 18933 /** 18934 * @param {string} eventName 18935 * @param {EventHandler} eventHandler 18936 */ 18937 const on = (eventName, eventHandler) => { 18938 globalState.eventEmitter.on(eventName, eventHandler); 18939 }; 18940 18941 /** 18942 * @param {string} eventName 18943 * @param {EventHandler} eventHandler 18944 */ 18945 const once = (eventName, eventHandler) => { 18946 globalState.eventEmitter.once(eventName, eventHandler); 18947 }; 18948 18949 /** 18950 * @param {string} [eventName] 18951 * @param {EventHandler} [eventHandler] 18952 */ 18953 const off = (eventName, eventHandler) => { 18954 // Remove all handlers for all events 18955 if (!eventName) { 18956 globalState.eventEmitter.reset(); 18957 return; 18958 } 18959 if (eventHandler) { 18960 // Remove a specific handler 18961 globalState.eventEmitter.removeListener(eventName, eventHandler); 18962 } else { 18963 // Remove all handlers for a specific event 18964 globalState.eventEmitter.removeAllListeners(eventName); 18965 } 18966 }; 18967 18968 var staticMethods = /*#__PURE__*/Object.freeze({ 18969 __proto__: null, 18970 argsToParams: argsToParams, 18971 bindClickHandler: bindClickHandler, 18972 clickCancel: clickCancel, 18973 clickConfirm: clickConfirm, 18974 clickDeny: clickDeny, 18975 enableLoading: showLoading, 18976 fire: fire, 18977 getActions: getActions, 18978 getCancelButton: getCancelButton, 18979 getCloseButton: getCloseButton, 18980 getConfirmButton: getConfirmButton, 18981 getContainer: getContainer, 18982 getDenyButton: getDenyButton, 18983 getFocusableElements: getFocusableElements, 18984 getFooter: getFooter, 18985 getHtmlContainer: getHtmlContainer, 18986 getIcon: getIcon, 18987 getIconContent: getIconContent, 18988 getImage: getImage, 18989 getInputLabel: getInputLabel, 18990 getLoader: getLoader, 18991 getPopup: getPopup, 18992 getProgressSteps: getProgressSteps, 18993 getTimerLeft: getTimerLeft, 18994 getTimerProgressBar: getTimerProgressBar, 18995 getTitle: getTitle, 18996 getValidationMessage: getValidationMessage, 18997 increaseTimer: increaseTimer, 18998 isDeprecatedParameter: isDeprecatedParameter, 18999 isLoading: isLoading, 19000 isTimerRunning: isTimerRunning, 19001 isUpdatableParameter: isUpdatableParameter, 19002 isValidParameter: isValidParameter, 19003 isVisible: isVisible, 19004 mixin: mixin, 19005 off: off, 19006 on: on, 19007 once: once, 19008 resumeTimer: resumeTimer, 19009 showLoading: showLoading, 19010 stopTimer: stopTimer, 19011 toggleTimer: toggleTimer 19012 }); 19013 19014 class Timer { 19015 /** 19016 * @param {Function} callback 19017 * @param {number} delay 19018 */ 19019 constructor(callback, delay) { 19020 this.callback = callback; 19021 this.remaining = delay; 19022 this.running = false; 19023 this.start(); 19024 } 19025 19026 /** 19027 * @returns {number} 19028 */ 19029 start() { 19030 if (!this.running) { 19031 this.running = true; 19032 this.started = new Date(); 19033 this.id = setTimeout(this.callback, this.remaining); 19034 } 19035 return this.remaining; 19036 } 19037 19038 /** 19039 * @returns {number} 19040 */ 19041 stop() { 19042 if (this.started && this.running) { 19043 this.running = false; 19044 clearTimeout(this.id); 19045 this.remaining -= new Date().getTime() - this.started.getTime(); 19046 } 19047 return this.remaining; 19048 } 19049 19050 /** 19051 * @param {number} n 19052 * @returns {number} 19053 */ 19054 increase(n) { 19055 const running = this.running; 19056 if (running) { 19057 this.stop(); 19058 } 19059 this.remaining += n; 19060 if (running) { 19061 this.start(); 19062 } 19063 return this.remaining; 19064 } 19065 19066 /** 19067 * @returns {number} 19068 */ 19069 getTimerLeft() { 19070 if (this.running) { 19071 this.stop(); 19072 this.start(); 19073 } 19074 return this.remaining; 19075 } 19076 19077 /** 19078 * @returns {boolean} 19079 */ 19080 isRunning() { 19081 return this.running; 19082 } 19083 } 19084 19085 const swalStringParams = ['swal-title', 'swal-html', 'swal-footer']; 19086 19087 /** 19088 * @param {SweetAlertOptions} params 19089 * @returns {SweetAlertOptions} 19090 */ 19091 const getTemplateParams = params => { 19092 const template = typeof params.template === 'string' ? (/** @type {HTMLTemplateElement} */document.querySelector(params.template)) : params.template; 19093 if (!template) { 19094 return {}; 19095 } 19096 /** @type {DocumentFragment} */ 19097 const templateContent = template.content; 19098 showWarningsForElements(templateContent); 19099 const result = Object.assign(getSwalParams(templateContent), getSwalFunctionParams(templateContent), getSwalButtons(templateContent), getSwalImage(templateContent), getSwalIcon(templateContent), getSwalInput(templateContent), getSwalStringParams(templateContent, swalStringParams)); 19100 return result; 19101 }; 19102 19103 /** 19104 * @param {DocumentFragment} templateContent 19105 * @returns {Record<string, any>} 19106 */ 19107 const getSwalParams = templateContent => { 19108 /** @type {Record<string, any>} */ 19109 const result = {}; 19110 /** @type {HTMLElement[]} */ 19111 const swalParams = Array.from(templateContent.querySelectorAll('swal-param')); 19112 swalParams.forEach(param => { 19113 showWarningsForAttributes(param, ['name', 'value']); 19114 const paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name'); 19115 const value = param.getAttribute('value'); 19116 if (!paramName || !value) { 19117 return; 19118 } 19119 if (typeof defaultParams[paramName] === 'boolean') { 19120 result[paramName] = value !== 'false'; 19121 } else if (typeof defaultParams[paramName] === 'object') { 19122 result[paramName] = JSON.parse(value); 19123 } else { 19124 result[paramName] = value; 19125 } 19126 }); 19127 return result; 19128 }; 19129 19130 /** 19131 * @param {DocumentFragment} templateContent 19132 * @returns {Record<string, any>} 19133 */ 19134 const getSwalFunctionParams = templateContent => { 19135 /** @type {Record<string, any>} */ 19136 const result = {}; 19137 /** @type {HTMLElement[]} */ 19138 const swalFunctions = Array.from(templateContent.querySelectorAll('swal-function-param')); 19139 swalFunctions.forEach(param => { 19140 const paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name'); 19141 const value = param.getAttribute('value'); 19142 if (!paramName || !value) { 19143 return; 19144 } 19145 result[paramName] = new Function(`return ${value}`)(); 19146 }); 19147 return result; 19148 }; 19149 19150 /** 19151 * @param {DocumentFragment} templateContent 19152 * @returns {Record<string, any>} 19153 */ 19154 const getSwalButtons = templateContent => { 19155 /** @type {Record<string, any>} */ 19156 const result = {}; 19157 /** @type {HTMLElement[]} */ 19158 const swalButtons = Array.from(templateContent.querySelectorAll('swal-button')); 19159 swalButtons.forEach(button => { 19160 showWarningsForAttributes(button, ['type', 'color', 'aria-label']); 19161 const type = button.getAttribute('type'); 19162 if (!type || !['confirm', 'cancel', 'deny'].includes(type)) { 19163 return; 19164 } 19165 result[`${type}ButtonText`] = button.innerHTML; 19166 result[`show${capitalizeFirstLetter(type)}Button`] = true; 19167 if (button.hasAttribute('color')) { 19168 result[`${type}ButtonColor`] = button.getAttribute('color'); 19169 } 19170 if (button.hasAttribute('aria-label')) { 19171 result[`${type}ButtonAriaLabel`] = button.getAttribute('aria-label'); 19172 } 19173 }); 19174 return result; 19175 }; 19176 19177 /** 19178 * @param {DocumentFragment} templateContent 19179 * @returns {Pick<SweetAlertOptions, 'imageUrl' | 'imageWidth' | 'imageHeight' | 'imageAlt'>} 19180 */ 19181 const getSwalImage = templateContent => { 19182 const result = {}; 19183 /** @type {HTMLElement | null} */ 19184 const image = templateContent.querySelector('swal-image'); 19185 if (image) { 19186 showWarningsForAttributes(image, ['src', 'width', 'height', 'alt']); 19187 if (image.hasAttribute('src')) { 19188 result.imageUrl = image.getAttribute('src') || undefined; 19189 } 19190 if (image.hasAttribute('width')) { 19191 result.imageWidth = image.getAttribute('width') || undefined; 19192 } 19193 if (image.hasAttribute('height')) { 19194 result.imageHeight = image.getAttribute('height') || undefined; 19195 } 19196 if (image.hasAttribute('alt')) { 19197 result.imageAlt = image.getAttribute('alt') || undefined; 19198 } 19199 } 19200 return result; 19201 }; 19202 19203 /** 19204 * @param {DocumentFragment} templateContent 19205 * @returns {Record<string, any>} 19206 */ 19207 const getSwalIcon = templateContent => { 19208 const result = {}; 19209 /** @type {HTMLElement | null} */ 19210 const icon = templateContent.querySelector('swal-icon'); 19211 if (icon) { 19212 showWarningsForAttributes(icon, ['type', 'color']); 19213 if (icon.hasAttribute('type')) { 19214 result.icon = icon.getAttribute('type'); 19215 } 19216 if (icon.hasAttribute('color')) { 19217 result.iconColor = icon.getAttribute('color'); 19218 } 19219 result.iconHtml = icon.innerHTML; 19220 } 19221 return result; 19222 }; 19223 19224 /** 19225 * @param {DocumentFragment} templateContent 19226 * @returns {Record<string, any>} 19227 */ 19228 const getSwalInput = templateContent => { 19229 /** @type {Record<string, any>} */ 19230 const result = {}; 19231 /** @type {HTMLElement | null} */ 19232 const input = templateContent.querySelector('swal-input'); 19233 if (input) { 19234 showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']); 19235 result.input = input.getAttribute('type') || 'text'; 19236 if (input.hasAttribute('label')) { 19237 result.inputLabel = input.getAttribute('label'); 19238 } 19239 if (input.hasAttribute('placeholder')) { 19240 result.inputPlaceholder = input.getAttribute('placeholder'); 19241 } 19242 if (input.hasAttribute('value')) { 19243 result.inputValue = input.getAttribute('value'); 19244 } 19245 } 19246 /** @type {HTMLElement[]} */ 19247 const inputOptions = Array.from(templateContent.querySelectorAll('swal-input-option')); 19248 if (inputOptions.length) { 19249 result.inputOptions = {}; 19250 inputOptions.forEach(option => { 19251 showWarningsForAttributes(option, ['value']); 19252 const optionValue = option.getAttribute('value'); 19253 if (!optionValue) { 19254 return; 19255 } 19256 const optionName = option.innerHTML; 19257 result.inputOptions[optionValue] = optionName; 19258 }); 19259 } 19260 return result; 19261 }; 19262 19263 /** 19264 * @param {DocumentFragment} templateContent 19265 * @param {string[]} paramNames 19266 * @returns {Record<string, any>} 19267 */ 19268 const getSwalStringParams = (templateContent, paramNames) => { 19269 /** @type {Record<string, any>} */ 19270 const result = {}; 19271 for (const i in paramNames) { 19272 const paramName = paramNames[i]; 19273 /** @type {HTMLElement | null} */ 19274 const tag = templateContent.querySelector(paramName); 19275 if (tag) { 19276 showWarningsForAttributes(tag, []); 19277 result[paramName.replace(/^swal-/, '')] = tag.innerHTML.trim(); 19278 } 19279 } 19280 return result; 19281 }; 19282 19283 /** 19284 * @param {DocumentFragment} templateContent 19285 */ 19286 const showWarningsForElements = templateContent => { 19287 const allowedElements = swalStringParams.concat(['swal-param', 'swal-function-param', 'swal-button', 'swal-image', 'swal-icon', 'swal-input', 'swal-input-option']); 19288 Array.from(templateContent.children).forEach(el => { 19289 const tagName = el.tagName.toLowerCase(); 19290 if (!allowedElements.includes(tagName)) { 19291 warn(`Unrecognized element <${tagName}>`); 19292 } 19293 }); 19294 }; 19295 19296 /** 19297 * @param {HTMLElement} el 19298 * @param {string[]} allowedAttributes 19299 */ 19300 const showWarningsForAttributes = (el, allowedAttributes) => { 19301 Array.from(el.attributes).forEach(attribute => { 19302 if (allowedAttributes.indexOf(attribute.name) === -1) { 19303 warn([`Unrecognized attribute "${attribute.name}" on <${el.tagName.toLowerCase()}>.`, `${allowedAttributes.length ? `Allowed attributes are: ${allowedAttributes.join(', ')}` : 'To set the value, use HTML within the element.'}`]); 19304 } 19305 }); 19306 }; 19307 19308 const SHOW_CLASS_TIMEOUT = 10; 19309 19310 /** 19311 * Open popup, add necessary classes and styles, fix scrollbar 19312 * 19313 * @param {SweetAlertOptions} params 19314 */ 19315 const openPopup = params => { 19316 const container = getContainer(); 19317 const popup = getPopup(); 19318 if (typeof params.willOpen === 'function') { 19319 params.willOpen(popup); 19320 } 19321 globalState.eventEmitter.emit('willOpen', popup); 19322 const bodyStyles = window.getComputedStyle(document.body); 19323 const initialBodyOverflow = bodyStyles.overflowY; 19324 addClasses(container, popup, params); 19325 19326 // scrolling is 'hidden' until animation is done, after that 'auto' 19327 setTimeout(() => { 19328 setScrollingVisibility(container, popup); 19329 }, SHOW_CLASS_TIMEOUT); 19330 if (isModal()) { 19331 fixScrollContainer(container, params.scrollbarPadding, initialBodyOverflow); 19332 setAriaHidden(); 19333 } 19334 if (!isToast() && !globalState.previousActiveElement) { 19335 globalState.previousActiveElement = document.activeElement; 19336 } 19337 if (typeof params.didOpen === 'function') { 19338 setTimeout(() => params.didOpen(popup)); 19339 } 19340 globalState.eventEmitter.emit('didOpen', popup); 19341 removeClass(container, swalClasses['no-transition']); 19342 }; 19343 19344 /** 19345 * @param {AnimationEvent} event 19346 */ 19347 const swalOpenAnimationFinished = event => { 19348 const popup = getPopup(); 19349 if (event.target !== popup) { 19350 return; 19351 } 19352 const container = getContainer(); 19353 popup.removeEventListener('animationend', swalOpenAnimationFinished); 19354 popup.removeEventListener('transitionend', swalOpenAnimationFinished); 19355 container.style.overflowY = 'auto'; 19356 }; 19357 19358 /** 19359 * @param {HTMLElement} container 19360 * @param {HTMLElement} popup 19361 */ 19362 const setScrollingVisibility = (container, popup) => { 19363 if (hasCssAnimation(popup)) { 19364 container.style.overflowY = 'hidden'; 19365 popup.addEventListener('animationend', swalOpenAnimationFinished); 19366 popup.addEventListener('transitionend', swalOpenAnimationFinished); 19367 } else { 19368 container.style.overflowY = 'auto'; 19369 } 19370 }; 19371 19372 /** 19373 * @param {HTMLElement} container 19374 * @param {boolean} scrollbarPadding 19375 * @param {string} initialBodyOverflow 19376 */ 19377 const fixScrollContainer = (container, scrollbarPadding, initialBodyOverflow) => { 19378 iOSfix(); 19379 if (scrollbarPadding && initialBodyOverflow !== 'hidden') { 19380 replaceScrollbarWithPadding(initialBodyOverflow); 19381 } 19382 19383 // sweetalert2/issues/1247 19384 setTimeout(() => { 19385 container.scrollTop = 0; 19386 }); 19387 }; 19388 19389 /** 19390 * @param {HTMLElement} container 19391 * @param {HTMLElement} popup 19392 * @param {SweetAlertOptions} params 19393 */ 19394 const addClasses = (container, popup, params) => { 19395 addClass(container, params.showClass.backdrop); 19396 if (params.animation) { 19397 // this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059 19398 popup.style.setProperty('opacity', '0', 'important'); 19399 show(popup, 'grid'); 19400 setTimeout(() => { 19401 // Animate popup right after showing it 19402 addClass(popup, params.showClass.popup); 19403 // and remove the opacity workaround 19404 popup.style.removeProperty('opacity'); 19405 }, SHOW_CLASS_TIMEOUT); // 10ms in order to fix #2062 19406 } else { 19407 show(popup, 'grid'); 19408 } 19409 addClass([document.documentElement, document.body], swalClasses.shown); 19410 if (params.heightAuto && params.backdrop && !params.toast) { 19411 addClass([document.documentElement, document.body], swalClasses['height-auto']); 19412 } 19413 }; 19414 19415 var defaultInputValidators = { 19416 /** 19417 * @param {string} string 19418 * @param {string} [validationMessage] 19419 * @returns {Promise<string | void>} 19420 */ 19421 email: (string, validationMessage) => { 19422 return /^[a-zA-Z0-9.+_'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]+$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address'); 19423 }, 19424 /** 19425 * @param {string} string 19426 * @param {string} [validationMessage] 19427 * @returns {Promise<string | void>} 19428 */ 19429 url: (string, validationMessage) => { 19430 // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 and #2013 19431 return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL'); 19432 } 19433 }; 19434 19435 /** 19436 * @param {SweetAlertOptions} params 19437 */ 19438 function setDefaultInputValidators(params) { 19439 // Use default `inputValidator` for supported input types if not provided 19440 if (params.inputValidator) { 19441 return; 19442 } 19443 if (params.input === 'email') { 19444 params.inputValidator = defaultInputValidators['email']; 19445 } 19446 if (params.input === 'url') { 19447 params.inputValidator = defaultInputValidators['url']; 19448 } 19449 } 19450 19451 /** 19452 * @param {SweetAlertOptions} params 19453 */ 19454 function validateCustomTargetElement(params) { 19455 // Determine if the custom target element is valid 19456 if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) { 19457 warn('Target parameter is not valid, defaulting to "body"'); 19458 params.target = 'body'; 19459 } 19460 } 19461 19462 /** 19463 * Set type, text and actions on popup 19464 * 19465 * @param {SweetAlertOptions} params 19466 */ 19467 function setParameters(params) { 19468 setDefaultInputValidators(params); 19469 19470 // showLoaderOnConfirm && preConfirm 19471 if (params.showLoaderOnConfirm && !params.preConfirm) { 19472 warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\n' + 'https://sweetalert2.github.io/#ajax-request'); 19473 } 19474 validateCustomTargetElement(params); 19475 19476 // Replace newlines with <br> in title 19477 if (typeof params.title === 'string') { 19478 params.title = params.title.split('\n').join('<br />'); 19479 } 19480 init(params); 19481 } 19482 19483 /** @type {SweetAlert} */ 19484 let currentInstance; 19485 var _promise = /*#__PURE__*/new WeakMap(); 19486 class SweetAlert { 19487 /** 19488 * @param {...any} args 19489 * @this {SweetAlert} 19490 */ 19491 constructor() { 19492 /** 19493 * @type {Promise<SweetAlertResult>} 19494 */ 19495 _classPrivateFieldInitSpec(this, _promise, void 0); 19496 // Prevent run in Node env 19497 if (typeof window === 'undefined') { 19498 return; 19499 } 19500 currentInstance = this; 19501 19502 // @ts-ignore 19503 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 19504 args[_key] = arguments[_key]; 19505 } 19506 const outerParams = Object.freeze(this.constructor.argsToParams(args)); 19507 19508 /** @type {Readonly<SweetAlertOptions>} */ 19509 this.params = outerParams; 19510 19511 /** @type {boolean} */ 19512 this.isAwaitingPromise = false; 19513 _classPrivateFieldSet2(_promise, this, this._main(currentInstance.params)); 19514 } 19515 _main(userParams) { 19516 let mixinParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 19517 showWarningsForParams(Object.assign({}, mixinParams, userParams)); 19518 if (globalState.currentInstance) { 19519 const swalPromiseResolve = privateMethods.swalPromiseResolve.get(globalState.currentInstance); 19520 const { 19521 isAwaitingPromise 19522 } = globalState.currentInstance; 19523 globalState.currentInstance._destroy(); 19524 if (!isAwaitingPromise) { 19525 swalPromiseResolve({ 19526 isDismissed: true 19527 }); 19528 } 19529 if (isModal()) { 19530 unsetAriaHidden(); 19531 } 19532 } 19533 globalState.currentInstance = currentInstance; 19534 const innerParams = prepareParams(userParams, mixinParams); 19535 setParameters(innerParams); 19536 Object.freeze(innerParams); 19537 19538 // clear the previous timer 19539 if (globalState.timeout) { 19540 globalState.timeout.stop(); 19541 delete globalState.timeout; 19542 } 19543 19544 // clear the restore focus timeout 19545 clearTimeout(globalState.restoreFocusTimeout); 19546 const domCache = populateDomCache(currentInstance); 19547 render(currentInstance, innerParams); 19548 privateProps.innerParams.set(currentInstance, innerParams); 19549 return swalPromise(currentInstance, domCache, innerParams); 19550 } 19551 19552 // `catch` cannot be the name of a module export, so we define our thenable methods here instead 19553 then(onFulfilled) { 19554 return _classPrivateFieldGet2(_promise, this).then(onFulfilled); 19555 } 19556 finally(onFinally) { 19557 return _classPrivateFieldGet2(_promise, this).finally(onFinally); 19558 } 19559 } 19560 19561 /** 19562 * @param {SweetAlert} instance 19563 * @param {DomCache} domCache 19564 * @param {SweetAlertOptions} innerParams 19565 * @returns {Promise} 19566 */ 19567 const swalPromise = (instance, domCache, innerParams) => { 19568 return new Promise((resolve, reject) => { 19569 // functions to handle all closings/dismissals 19570 /** 19571 * @param {DismissReason} dismiss 19572 */ 19573 const dismissWith = dismiss => { 19574 instance.close({ 19575 isDismissed: true, 19576 dismiss 19577 }); 19578 }; 19579 privateMethods.swalPromiseResolve.set(instance, resolve); 19580 privateMethods.swalPromiseReject.set(instance, reject); 19581 domCache.confirmButton.onclick = () => { 19582 handleConfirmButtonClick(instance); 19583 }; 19584 domCache.denyButton.onclick = () => { 19585 handleDenyButtonClick(instance); 19586 }; 19587 domCache.cancelButton.onclick = () => { 19588 handleCancelButtonClick(instance, dismissWith); 19589 }; 19590 domCache.closeButton.onclick = () => { 19591 dismissWith(DismissReason.close); 19592 }; 19593 handlePopupClick(innerParams, domCache, dismissWith); 19594 addKeydownHandler(globalState, innerParams, dismissWith); 19595 handleInputOptionsAndValue(instance, innerParams); 19596 openPopup(innerParams); 19597 setupTimer(globalState, innerParams, dismissWith); 19598 initFocus(domCache, innerParams); 19599 19600 // Scroll container to top on open (#1247, #1946) 19601 setTimeout(() => { 19602 domCache.container.scrollTop = 0; 19603 }); 19604 }); 19605 }; 19606 19607 /** 19608 * @param {SweetAlertOptions} userParams 19609 * @param {SweetAlertOptions} mixinParams 19610 * @returns {SweetAlertOptions} 19611 */ 19612 const prepareParams = (userParams, mixinParams) => { 19613 const templateParams = getTemplateParams(userParams); 19614 const params = Object.assign({}, defaultParams, mixinParams, templateParams, userParams); // precedence is described in #2131 19615 params.showClass = Object.assign({}, defaultParams.showClass, params.showClass); 19616 params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass); 19617 if (params.animation === false) { 19618 params.showClass = { 19619 backdrop: 'swal2-noanimation' 19620 }; 19621 params.hideClass = {}; 19622 } 19623 return params; 19624 }; 19625 19626 /** 19627 * @param {SweetAlert} instance 19628 * @returns {DomCache} 19629 */ 19630 const populateDomCache = instance => { 19631 const domCache = { 19632 popup: getPopup(), 19633 container: getContainer(), 19634 actions: getActions(), 19635 confirmButton: getConfirmButton(), 19636 denyButton: getDenyButton(), 19637 cancelButton: getCancelButton(), 19638 loader: getLoader(), 19639 closeButton: getCloseButton(), 19640 validationMessage: getValidationMessage(), 19641 progressSteps: getProgressSteps() 19642 }; 19643 privateProps.domCache.set(instance, domCache); 19644 return domCache; 19645 }; 19646 19647 /** 19648 * @param {GlobalState} globalState 19649 * @param {SweetAlertOptions} innerParams 19650 * @param {Function} dismissWith 19651 */ 19652 const setupTimer = (globalState, innerParams, dismissWith) => { 19653 const timerProgressBar = getTimerProgressBar(); 19654 hide(timerProgressBar); 19655 if (innerParams.timer) { 19656 globalState.timeout = new Timer(() => { 19657 dismissWith('timer'); 19658 delete globalState.timeout; 19659 }, innerParams.timer); 19660 if (innerParams.timerProgressBar) { 19661 show(timerProgressBar); 19662 applyCustomClass(timerProgressBar, innerParams, 'timerProgressBar'); 19663 setTimeout(() => { 19664 if (globalState.timeout && globalState.timeout.running) { 19665 // timer can be already stopped or unset at this point 19666 animateTimerProgressBar(innerParams.timer); 19667 } 19668 }); 19669 } 19670 } 19671 }; 19672 19673 /** 19674 * Initialize focus in the popup: 19675 * 19676 * 1. If `toast` is `true`, don't steal focus from the document. 19677 * 2. Else if there is an [autofocus] element, focus it. 19678 * 3. Else if `focusConfirm` is `true` and confirm button is visible, focus it. 19679 * 4. Else if `focusDeny` is `true` and deny button is visible, focus it. 19680 * 5. Else if `focusCancel` is `true` and cancel button is visible, focus it. 19681 * 6. Else focus the first focusable element in a popup (if any). 19682 * 19683 * @param {DomCache} domCache 19684 * @param {SweetAlertOptions} innerParams 19685 */ 19686 const initFocus = (domCache, innerParams) => { 19687 if (innerParams.toast) { 19688 return; 19689 } 19690 // TODO: this is dumb, remove `allowEnterKey` param in the next major version 19691 if (!callIfFunction(innerParams.allowEnterKey)) { 19692 warnAboutDeprecation('allowEnterKey'); 19693 blurActiveElement(); 19694 return; 19695 } 19696 if (focusAutofocus(domCache)) { 19697 return; 19698 } 19699 if (focusButton(domCache, innerParams)) { 19700 return; 19701 } 19702 setFocus(-1, 1); 19703 }; 19704 19705 /** 19706 * @param {DomCache} domCache 19707 * @returns {boolean} 19708 */ 19709 const focusAutofocus = domCache => { 19710 const autofocusElements = Array.from(domCache.popup.querySelectorAll('[autofocus]')); 19711 for (const autofocusElement of autofocusElements) { 19712 if (autofocusElement instanceof HTMLElement && isVisible$1(autofocusElement)) { 19713 autofocusElement.focus(); 19714 return true; 19715 } 19716 } 19717 return false; 19718 }; 19719 19720 /** 19721 * @param {DomCache} domCache 19722 * @param {SweetAlertOptions} innerParams 19723 * @returns {boolean} 19724 */ 19725 const focusButton = (domCache, innerParams) => { 19726 if (innerParams.focusDeny && isVisible$1(domCache.denyButton)) { 19727 domCache.denyButton.focus(); 19728 return true; 19729 } 19730 if (innerParams.focusCancel && isVisible$1(domCache.cancelButton)) { 19731 domCache.cancelButton.focus(); 19732 return true; 19733 } 19734 if (innerParams.focusConfirm && isVisible$1(domCache.confirmButton)) { 19735 domCache.confirmButton.focus(); 19736 return true; 19737 } 19738 return false; 19739 }; 19740 const blurActiveElement = () => { 19741 if (document.activeElement instanceof HTMLElement && typeof document.activeElement.blur === 'function') { 19742 document.activeElement.blur(); 19743 } 19744 }; 19745 19746 // Dear russian users visiting russian sites. Let's have fun. 19747 if (typeof window !== 'undefined' && /^ru\b/.test(navigator.language) && location.host.match(/\.(ru|su|by|xn--p1ai)$/)) { 19748 const now = new Date(); 19749 const initiationDate = localStorage.getItem('swal-initiation'); 19750 if (!initiationDate) { 19751 localStorage.setItem('swal-initiation', `${now}`); 19752 } else if ((now.getTime() - Date.parse(initiationDate)) / (1000 * 60 * 60 * 24) > 3) { 19753 setTimeout(() => { 19754 document.body.style.pointerEvents = 'none'; 19755 const ukrainianAnthem = document.createElement('audio'); 19756 ukrainianAnthem.src = 'https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3'; 19757 ukrainianAnthem.loop = true; 19758 document.body.appendChild(ukrainianAnthem); 19759 setTimeout(() => { 19760 ukrainianAnthem.play().catch(() => { 19761 // ignore 19762 }); 19763 }, 2500); 19764 }, 500); 19765 } 19766 } 19767 19768 // Assign instance methods from src/instanceMethods/*.js to prototype 19769 SweetAlert.prototype.disableButtons = disableButtons; 19770 SweetAlert.prototype.enableButtons = enableButtons; 19771 SweetAlert.prototype.getInput = getInput; 19772 SweetAlert.prototype.disableInput = disableInput; 19773 SweetAlert.prototype.enableInput = enableInput; 19774 SweetAlert.prototype.hideLoading = hideLoading; 19775 SweetAlert.prototype.disableLoading = hideLoading; 19776 SweetAlert.prototype.showValidationMessage = showValidationMessage; 19777 SweetAlert.prototype.resetValidationMessage = resetValidationMessage; 19778 SweetAlert.prototype.close = close; 19779 SweetAlert.prototype.closePopup = close; 19780 SweetAlert.prototype.closeModal = close; 19781 SweetAlert.prototype.closeToast = close; 19782 SweetAlert.prototype.rejectPromise = rejectPromise; 19783 SweetAlert.prototype.update = update; 19784 SweetAlert.prototype._destroy = _destroy; 19785 19786 // Assign static methods from src/staticMethods/*.js to constructor 19787 Object.assign(SweetAlert, staticMethods); 19788 19789 // Proxy to instance methods to constructor, for now, for backwards compatibility 19790 Object.keys(instanceMethods).forEach(key => { 19791 /** 19792 * @param {...any} args 19793 * @returns {any | undefined} 19794 */ 19795 SweetAlert[key] = function () { 19796 if (currentInstance && currentInstance[key]) { 19797 return currentInstance[key](...arguments); 19798 } 19799 return null; 19800 }; 19801 }); 19802 SweetAlert.DismissReason = DismissReason; 19803 SweetAlert.version = '11.14.5'; 19804 19805 const Swal = SweetAlert; 19806 // @ts-ignore 19807 Swal.default = Swal; 19808 19809 return Swal; 19810 19811})); 19812if (typeof this !== 'undefined' && this.Sweetalert2){this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2} 19813"undefined"!=typeof document&&function(e,t){var n=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,".swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:\"top-start top top-end\" \"center-start center center-end\" \"bottom-start bottom-center bottom-end\";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:rgba(0,0,0,.4)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:hsl(0,0%,33%);font-family:inherit;font-size:1rem}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1))}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm){border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):focus-visible{box-shadow:0 0 0 3px rgba(112,102,224,.5)}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny){border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):focus-visible{box-shadow:0 0 0 3px rgba(220,55,65,.5)}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel){border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):focus-visible{box-shadow:0 0 0 3px rgba(110,120,129,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus-visible{box-shadow:0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-styled):focus-visible{outline:none}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em;text-align:center}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:rgba(0,0,0,.2)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em}div:where(.swal2-container) button:where(.swal2-close){z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:rgba(0,0,0,0);color:#ccc;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:none;background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus-visible{outline:none;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) .swal2-html-container{z-index:1;justify-content:center;margin:0;padding:1em 1.6em .3em;overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid hsl(0,0%,85%);border-radius:.1875em;background:rgba(0,0,0,0);box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:1px solid #b4dbed;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:#fff}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:rgba(0,0,0,0);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:#fff;color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:hsl(0,0%,94%);color:#666;font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:0.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:rgb(249.95234375,205.965625,167.74765625);color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:rgb(156.7033492823,224.2822966507,246.2966507177);color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:rgb(200.8064516129,217.9677419355,225.1935483871);color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(0.7)}45%{transform:scale(1.05)}80%{transform:scale(0.95)}100%{transform:scale(1)}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(0.5);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown) .swal2-container{position:static !important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}"); 19814 19815/***/ })
vendor: 7,278 bytes, lines 19815-19985
19815 19816 19817/******/ }); 19818/************************************************************************/ 19819/******/ // The module cache 19820/******/ var __webpack_module_cache__ = {}; 19821/******/ 19822/******/ // The require function 19823/******/ function __webpack_require__(moduleId) { 19824/******/ // Check if module is in cache 19825/******/ var cachedModule = __webpack_module_cache__[moduleId]; 19826/******/ if (cachedModule !== undefined) { 19827/******/ return cachedModule.exports; 19828/******/ } 19829/******/ // Create a new module (and put it into the cache) 19830/******/ var module = __webpack_module_cache__[moduleId] = { 19831/******/ // no module.id needed 19832/******/ // no module.loaded needed 19833/******/ exports: {} 19834/******/ }; 19835/******/ 19836/******/ // Execute the module function 19837/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 19838/******/ 19839/******/ // Return the exports of the module 19840/******/ return module.exports; 19841/******/ } 19842/******/ 19843/******/ // expose the modules object (__webpack_modules__) 19844/******/ __webpack_require__.m = __webpack_modules__; 19845/******/ 19846/************************************************************************/ 19847/******/ /* webpack/runtime/chunk loaded */ 19848/******/ (() => { 19849/******/ var deferred = []; 19850/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { 19851/******/ if(chunkIds) { 19852/******/ priority = priority || 0; 19853/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; 19854/******/ deferred[i] = [chunkIds, fn, priority]; 19855/******/ return; 19856/******/ } 19857/******/ var notFulfilled = Infinity; 19858/******/ for (var i = 0; i < deferred.length; i++) { 19859/******/ var [chunkIds, fn, priority] = deferred[i]; 19860/******/ var fulfilled = true; 19861/******/ for (var j = 0; j < chunkIds.length; j++) { 19862/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { 19863/******/ chunkIds.splice(j--, 1); 19864/******/ } else { 19865/******/ fulfilled = false; 19866/******/ if(priority < notFulfilled) notFulfilled = priority; 19867/******/ } 19868/******/ } 19869/******/ if(fulfilled) { 19870/******/ deferred.splice(i--, 1) 19871/******/ var r = fn(); 19872/******/ if (r !== undefined) result = r; 19873/******/ } 19874/******/ } 19875/******/ return result; 19876/******/ }; 19877/******/ })(); 19878/******/ 19879/******/ /* webpack/runtime/compat get default export */ 19880/******/ (() => { 19881/******/ // getDefaultExport function for compatibility with non-harmony modules 19882/******/ __webpack_require__.n = (module) => { 19883/******/ var getter = module && module.__esModule ? 19884/******/ () => (module['default']) : 19885/******/ () => (module); 19886/******/ __webpack_require__.d(getter, { a: getter }); 19887/******/ return getter; 19888/******/ }; 19889/******/ })(); 19890/******/ 19891/******/ /* webpack/runtime/define property getters */ 19892/******/ (() => { 19893/******/ // define getter functions for harmony exports 19894/******/ __webpack_require__.d = (exports, definition) => { 19895/******/ for(var key in definition) { 19896/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 19897/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 19898/******/ } 19899/******/ } 19900/******/ }; 19901/******/ })(); 19902/******/ 19903/******/ /* webpack/runtime/hasOwnProperty shorthand */ 19904/******/ (() => { 19905/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 19906/******/ })(); 19907/******/ 19908/******/ /* webpack/runtime/make namespace object */ 19909/******/ (() => { 19910/******/ // define __esModule on exports 19911/******/ __webpack_require__.r = (exports) => { 19912/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 19913/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 19914/******/ } 19915/******/ Object.defineProperty(exports, '__esModule', { value: true }); 19916/******/ }; 19917/******/ })(); 19918/******/ 19919/******/ /* webpack/runtime/jsonp chunk loading */ 19920/******/ (() => { 19921/******/ // no baseURI 19922/******/ 19923/******/ // object to store loaded and loading chunks 19924/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched 19925/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded 19926/******/ var installedChunks = { 19927/******/ "/themes/imaginatheme/js/app": 0, 19928/******/ "themes/imaginatheme/css/secondary": 0, 19929/******/ "themes/imaginatheme/css/app": 0 19930/******/ }; 19931/******/ 19932/******/ // no chunk on demand loading 19933/******/ 19934/******/ // no prefetching 19935/******/ 19936/******/ // no preloaded 19937/******/ 19938/******/ // no HMR 19939/******/ 19940/******/ // no HMR manifest 19941/******/ 19942/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); 19943/******/ 19944/******/ // install a JSONP callback for chunk loading 19945/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { 19946/******/ var [chunkIds, moreModules, runtime] = data; 19947/******/ // add "moreModules" to the modules object, 19948/******/ // then flag all "chunkIds" as loaded and fire callback 19949/******/ var moduleId, chunkId, i = 0; 19950/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { 19951/******/ for(moduleId in moreModules) { 19952/******/ if(__webpack_require__.o(moreModules, moduleId)) { 19953/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; 19954/******/ } 19955/******/ } 19956/******/ if(runtime) var result = runtime(__webpack_require__); 19957/******/ } 19958/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); 19959/******/ for(;i < chunkIds.length; i++) { 19960/******/ chunkId = chunkIds[i]; 19961/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { 19962/******/ installedChunks[chunkId][0](); 19963/******/ } 19964/******/ installedChunks[chunkId] = 0; 19965/******/ } 19966/******/ return __webpack_require__.O(result); 19967/******/ } 19968/******/ 19969/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; 19970/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); 19971/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); 19972/******/ })(); 19973/******/ 19974/************************************************************************/ 19975/******/ 19976/******/ // startup 19977/******/ // Load entry module and return exports 19978/******/ // This entry module depends on other loaded chunks and execution need to be delayed 19979/******/ __webpack_require__.O(undefined, ["themes/imaginatheme/css/secondary","themes/imaginatheme/css/app"], () => (__webpack_require__("./resources/js/main.js"))) 19980/******/ __webpack_require__.O(undefined, ["themes/imaginatheme/css/secondary","themes/imaginatheme/css/app"], () => (__webpack_require__("./resources/scss/main.scss"))) 19981/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["themes/imaginatheme/css/secondary","themes/imaginatheme/css/app"], () => (__webpack_require__("./resources/scss/secondary.scss"))) 19982/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); 19983/******/ 19984/******/ })() 19985;
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.