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