· 6 years ago · Oct 02, 2019, 08:04 PM
1/* Minification failed. Returning unminified contents.
2(10843,32-33): run-time error JS1013: Syntax error in regular expression: ;
3 */
4/*!
5 * jQuery JavaScript Library v3.2.1
6 * https://jquery.com/
7 *
8 * Includes Sizzle.js
9 * https://sizzlejs.com/
10 *
11 * Copyright JS Foundation and other contributors
12 * Released under the MIT license
13 * https://jquery.org/license
14 *
15 * Date: 2017-03-20T18:59Z
16 */
17( function( global, factory ) {
18
19 "use strict";
20
21 if ( typeof module === "object" && typeof module.exports === "object" ) {
22
23 // For CommonJS and CommonJS-like environments where a proper `window`
24 // is present, execute the factory and get jQuery.
25 // For environments that do not have a `window` with a `document`
26 // (such as Node.js), expose a factory as module.exports.
27 // This accentuates the need for the creation of a real `window`.
28 // e.g. var jQuery = require("jquery")(window);
29 // See ticket #14549 for more info.
30 module.exports = global.document ?
31 factory( global, true ) :
32 function( w ) {
33 if ( !w.document ) {
34 throw new Error( "jQuery requires a window with a document" );
35 }
36 return factory( w );
37 };
38 } else {
39 factory( global );
40 }
41
42// Pass this if window is not defined yet
43} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
44
45// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
46// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
47// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
48// enough that all such attempts are guarded in a try block.
49"use strict";
50
51var arr = [];
52
53var document = window.document;
54
55var getProto = Object.getPrototypeOf;
56
57var slice = arr.slice;
58
59var concat = arr.concat;
60
61var push = arr.push;
62
63var indexOf = arr.indexOf;
64
65var class2type = {};
66
67var toString = class2type.toString;
68
69var hasOwn = class2type.hasOwnProperty;
70
71var fnToString = hasOwn.toString;
72
73var ObjectFunctionString = fnToString.call( Object );
74
75var support = {};
76
77
78
79 function DOMEval( code, doc ) {
80 doc = doc || document;
81
82 var script = doc.createElement( "script" );
83
84 script.text = code;
85 doc.head.appendChild( script ).parentNode.removeChild( script );
86 }
87/* global Symbol */
88// Defining this global in .eslintrc.json would create a danger of using the global
89// unguarded in another place, it seems safer to define global only for this module
90
91
92
93var
94 version = "3.2.1",
95
96 // Define a local copy of jQuery
97 jQuery = function( selector, context ) {
98
99 // The jQuery object is actually just the init constructor 'enhanced'
100 // Need init if jQuery is called (just allow error to be thrown if not included)
101 return new jQuery.fn.init( selector, context );
102 },
103
104 // Support: Android <=4.0 only
105 // Make sure we trim BOM and NBSP
106 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
107
108 // Matches dashed string for camelizing
109 rmsPrefix = /^-ms-/,
110 rdashAlpha = /-([a-z])/g,
111
112 // Used by jQuery.camelCase as callback to replace()
113 fcamelCase = function( all, letter ) {
114 return letter.toUpperCase();
115 };
116
117jQuery.fn = jQuery.prototype = {
118
119 // The current version of jQuery being used
120 jquery: version,
121
122 constructor: jQuery,
123
124 // The default length of a jQuery object is 0
125 length: 0,
126
127 toArray: function() {
128 return slice.call( this );
129 },
130
131 // Get the Nth element in the matched element set OR
132 // Get the whole matched element set as a clean array
133 get: function( num ) {
134
135 // Return all the elements in a clean array
136 if ( num == null ) {
137 return slice.call( this );
138 }
139
140 // Return just the one element from the set
141 return num < 0 ? this[ num + this.length ] : this[ num ];
142 },
143
144 // Take an array of elements and push it onto the stack
145 // (returning the new matched element set)
146 pushStack: function( elems ) {
147
148 // Build a new jQuery matched element set
149 var ret = jQuery.merge( this.constructor(), elems );
150
151 // Add the old object onto the stack (as a reference)
152 ret.prevObject = this;
153
154 // Return the newly-formed element set
155 return ret;
156 },
157
158 // Execute a callback for every element in the matched set.
159 each: function( callback ) {
160 return jQuery.each( this, callback );
161 },
162
163 map: function( callback ) {
164 return this.pushStack( jQuery.map( this, function( elem, i ) {
165 return callback.call( elem, i, elem );
166 } ) );
167 },
168
169 slice: function() {
170 return this.pushStack( slice.apply( this, arguments ) );
171 },
172
173 first: function() {
174 return this.eq( 0 );
175 },
176
177 last: function() {
178 return this.eq( -1 );
179 },
180
181 eq: function( i ) {
182 var len = this.length,
183 j = +i + ( i < 0 ? len : 0 );
184 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
185 },
186
187 end: function() {
188 return this.prevObject || this.constructor();
189 },
190
191 // For internal use only.
192 // Behaves like an Array's method, not like a jQuery method.
193 push: push,
194 sort: arr.sort,
195 splice: arr.splice
196};
197
198jQuery.extend = jQuery.fn.extend = function() {
199 var options, name, src, copy, copyIsArray, clone,
200 target = arguments[ 0 ] || {},
201 i = 1,
202 length = arguments.length,
203 deep = false;
204
205 // Handle a deep copy situation
206 if ( typeof target === "boolean" ) {
207 deep = target;
208
209 // Skip the boolean and the target
210 target = arguments[ i ] || {};
211 i++;
212 }
213
214 // Handle case when target is a string or something (possible in deep copy)
215 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
216 target = {};
217 }
218
219 // Extend jQuery itself if only one argument is passed
220 if ( i === length ) {
221 target = this;
222 i--;
223 }
224
225 for ( ; i < length; i++ ) {
226
227 // Only deal with non-null/undefined values
228 if ( ( options = arguments[ i ] ) != null ) {
229
230 // Extend the base object
231 for ( name in options ) {
232 src = target[ name ];
233 copy = options[ name ];
234
235 // Prevent never-ending loop
236 if ( target === copy ) {
237 continue;
238 }
239
240 // Recurse if we're merging plain objects or arrays
241 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
242 ( copyIsArray = Array.isArray( copy ) ) ) ) {
243
244 if ( copyIsArray ) {
245 copyIsArray = false;
246 clone = src && Array.isArray( src ) ? src : [];
247
248 } else {
249 clone = src && jQuery.isPlainObject( src ) ? src : {};
250 }
251
252 // Never move original objects, clone them
253 target[ name ] = jQuery.extend( deep, clone, copy );
254
255 // Don't bring in undefined values
256 } else if ( copy !== undefined ) {
257 target[ name ] = copy;
258 }
259 }
260 }
261 }
262
263 // Return the modified object
264 return target;
265};
266
267jQuery.extend( {
268
269 // Unique for each copy of jQuery on the page
270 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
271
272 // Assume jQuery is ready without the ready module
273 isReady: true,
274
275 error: function( msg ) {
276 throw new Error( msg );
277 },
278
279 noop: function() {},
280
281 isFunction: function( obj ) {
282 return jQuery.type( obj ) === "function";
283 },
284
285 isWindow: function( obj ) {
286 return obj != null && obj === obj.window;
287 },
288
289 isNumeric: function( obj ) {
290
291 // As of jQuery 3.0, isNumeric is limited to
292 // strings and numbers (primitives or objects)
293 // that can be coerced to finite numbers (gh-2662)
294 var type = jQuery.type( obj );
295 return ( type === "number" || type === "string" ) &&
296
297 // parseFloat NaNs numeric-cast false positives ("")
298 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
299 // subtraction forces infinities to NaN
300 !isNaN( obj - parseFloat( obj ) );
301 },
302
303 isPlainObject: function( obj ) {
304 var proto, Ctor;
305
306 // Detect obvious negatives
307 // Use toString instead of jQuery.type to catch host objects
308 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
309 return false;
310 }
311
312 proto = getProto( obj );
313
314 // Objects with no prototype (e.g., `Object.create( null )`) are plain
315 if ( !proto ) {
316 return true;
317 }
318
319 // Objects with prototype are plain iff they were constructed by a global Object function
320 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
321 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
322 },
323
324 isEmptyObject: function( obj ) {
325
326 /* eslint-disable no-unused-vars */
327 // See https://github.com/eslint/eslint/issues/6125
328 var name;
329
330 for ( name in obj ) {
331 return false;
332 }
333 return true;
334 },
335
336 type: function( obj ) {
337 if ( obj == null ) {
338 return obj + "";
339 }
340
341 // Support: Android <=2.3 only (functionish RegExp)
342 return typeof obj === "object" || typeof obj === "function" ?
343 class2type[ toString.call( obj ) ] || "object" :
344 typeof obj;
345 },
346
347 // Evaluates a script in a global context
348 globalEval: function( code ) {
349 DOMEval( code );
350 },
351
352 // Convert dashed to camelCase; used by the css and data modules
353 // Support: IE <=9 - 11, Edge 12 - 13
354 // Microsoft forgot to hump their vendor prefix (#9572)
355 camelCase: function( string ) {
356 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
357 },
358
359 each: function( obj, callback ) {
360 var length, i = 0;
361
362 if ( isArrayLike( obj ) ) {
363 length = obj.length;
364 for ( ; i < length; i++ ) {
365 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
366 break;
367 }
368 }
369 } else {
370 for ( i in obj ) {
371 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
372 break;
373 }
374 }
375 }
376
377 return obj;
378 },
379
380 // Support: Android <=4.0 only
381 trim: function( text ) {
382 return text == null ?
383 "" :
384 ( text + "" ).replace( rtrim, "" );
385 },
386
387 // results is for internal usage only
388 makeArray: function( arr, results ) {
389 var ret = results || [];
390
391 if ( arr != null ) {
392 if ( isArrayLike( Object( arr ) ) ) {
393 jQuery.merge( ret,
394 typeof arr === "string" ?
395 [ arr ] : arr
396 );
397 } else {
398 push.call( ret, arr );
399 }
400 }
401
402 return ret;
403 },
404
405 inArray: function( elem, arr, i ) {
406 return arr == null ? -1 : indexOf.call( arr, elem, i );
407 },
408
409 // Support: Android <=4.0 only, PhantomJS 1 only
410 // push.apply(_, arraylike) throws on ancient WebKit
411 merge: function( first, second ) {
412 var len = +second.length,
413 j = 0,
414 i = first.length;
415
416 for ( ; j < len; j++ ) {
417 first[ i++ ] = second[ j ];
418 }
419
420 first.length = i;
421
422 return first;
423 },
424
425 grep: function( elems, callback, invert ) {
426 var callbackInverse,
427 matches = [],
428 i = 0,
429 length = elems.length,
430 callbackExpect = !invert;
431
432 // Go through the array, only saving the items
433 // that pass the validator function
434 for ( ; i < length; i++ ) {
435 callbackInverse = !callback( elems[ i ], i );
436 if ( callbackInverse !== callbackExpect ) {
437 matches.push( elems[ i ] );
438 }
439 }
440
441 return matches;
442 },
443
444 // arg is for internal usage only
445 map: function( elems, callback, arg ) {
446 var length, value,
447 i = 0,
448 ret = [];
449
450 // Go through the array, translating each of the items to their new values
451 if ( isArrayLike( elems ) ) {
452 length = elems.length;
453 for ( ; i < length; i++ ) {
454 value = callback( elems[ i ], i, arg );
455
456 if ( value != null ) {
457 ret.push( value );
458 }
459 }
460
461 // Go through every key on the object,
462 } else {
463 for ( i in elems ) {
464 value = callback( elems[ i ], i, arg );
465
466 if ( value != null ) {
467 ret.push( value );
468 }
469 }
470 }
471
472 // Flatten any nested arrays
473 return concat.apply( [], ret );
474 },
475
476 // A global GUID counter for objects
477 guid: 1,
478
479 // Bind a function to a context, optionally partially applying any
480 // arguments.
481 proxy: function( fn, context ) {
482 var tmp, args, proxy;
483
484 if ( typeof context === "string" ) {
485 tmp = fn[ context ];
486 context = fn;
487 fn = tmp;
488 }
489
490 // Quick check to determine if target is callable, in the spec
491 // this throws a TypeError, but we will just return undefined.
492 if ( !jQuery.isFunction( fn ) ) {
493 return undefined;
494 }
495
496 // Simulated bind
497 args = slice.call( arguments, 2 );
498 proxy = function() {
499 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
500 };
501
502 // Set the guid of unique handler to the same of original handler, so it can be removed
503 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
504
505 return proxy;
506 },
507
508 now: Date.now,
509
510 // jQuery.support is not used in Core but other projects attach their
511 // properties to it so it needs to exist.
512 support: support
513} );
514
515if ( typeof Symbol === "function" ) {
516 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
517}
518
519// Populate the class2type map
520jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
521function( i, name ) {
522 class2type[ "[object " + name + "]" ] = name.toLowerCase();
523} );
524
525function isArrayLike( obj ) {
526
527 // Support: real iOS 8.2 only (not reproducible in simulator)
528 // `in` check used to prevent JIT error (gh-2145)
529 // hasOwn isn't used here due to false negatives
530 // regarding Nodelist length in IE
531 var length = !!obj && "length" in obj && obj.length,
532 type = jQuery.type( obj );
533
534 if ( type === "function" || jQuery.isWindow( obj ) ) {
535 return false;
536 }
537
538 return type === "array" || length === 0 ||
539 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
540}
541var Sizzle =
542/*!
543 * Sizzle CSS Selector Engine v2.3.3
544 * https://sizzlejs.com/
545 *
546 * Copyright jQuery Foundation and other contributors
547 * Released under the MIT license
548 * http://jquery.org/license
549 *
550 * Date: 2016-08-08
551 */
552(function( window ) {
553
554var i,
555 support,
556 Expr,
557 getText,
558 isXML,
559 tokenize,
560 compile,
561 select,
562 outermostContext,
563 sortInput,
564 hasDuplicate,
565
566 // Local document vars
567 setDocument,
568 document,
569 docElem,
570 documentIsHTML,
571 rbuggyQSA,
572 rbuggyMatches,
573 matches,
574 contains,
575
576 // Instance-specific data
577 expando = "sizzle" + 1 * new Date(),
578 preferredDoc = window.document,
579 dirruns = 0,
580 done = 0,
581 classCache = createCache(),
582 tokenCache = createCache(),
583 compilerCache = createCache(),
584 sortOrder = function( a, b ) {
585 if ( a === b ) {
586 hasDuplicate = true;
587 }
588 return 0;
589 },
590
591 // Instance methods
592 hasOwn = ({}).hasOwnProperty,
593 arr = [],
594 pop = arr.pop,
595 push_native = arr.push,
596 push = arr.push,
597 slice = arr.slice,
598 // Use a stripped-down indexOf as it's faster than native
599 // https://jsperf.com/thor-indexof-vs-for/5
600 indexOf = function( list, elem ) {
601 var i = 0,
602 len = list.length;
603 for ( ; i < len; i++ ) {
604 if ( list[i] === elem ) {
605 return i;
606 }
607 }
608 return -1;
609 },
610
611 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
612
613 // Regular expressions
614
615 // http://www.w3.org/TR/css3-selectors/#whitespace
616 whitespace = "[\\x20\\t\\r\\n\\f]",
617
618 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
619 identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
620
621 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
622 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
623 // Operator (capture 2)
624 "*([*^$|!~]?=)" + whitespace +
625 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
626 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
627 "*\\]",
628
629 pseudos = ":(" + identifier + ")(?:\\((" +
630 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
631 // 1. quoted (capture 3; capture 4 or capture 5)
632 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
633 // 2. simple (capture 6)
634 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
635 // 3. anything else (capture 2)
636 ".*" +
637 ")\\)|)",
638
639 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
640 rwhitespace = new RegExp( whitespace + "+", "g" ),
641 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
642
643 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
644 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
645
646 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
647
648 rpseudo = new RegExp( pseudos ),
649 ridentifier = new RegExp( "^" + identifier + "$" ),
650
651 matchExpr = {
652 "ID": new RegExp( "^#(" + identifier + ")" ),
653 "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
654 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
655 "ATTR": new RegExp( "^" + attributes ),
656 "PSEUDO": new RegExp( "^" + pseudos ),
657 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
658 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
659 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
660 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
661 // For use in libraries implementing .is()
662 // We use this for POS matching in `select`
663 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
664 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
665 },
666
667 rinputs = /^(?:input|select|textarea|button)$/i,
668 rheader = /^h\d$/i,
669
670 rnative = /^[^{]+\{\s*\[native \w/,
671
672 // Easily-parseable/retrievable ID or TAG or CLASS selectors
673 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
674
675 rsibling = /[+~]/,
676
677 // CSS escapes
678 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
679 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
680 funescape = function( _, escaped, escapedWhitespace ) {
681 var high = "0x" + escaped - 0x10000;
682 // NaN means non-codepoint
683 // Support: Firefox<24
684 // Workaround erroneous numeric interpretation of +"0x"
685 return high !== high || escapedWhitespace ?
686 escaped :
687 high < 0 ?
688 // BMP codepoint
689 String.fromCharCode( high + 0x10000 ) :
690 // Supplemental Plane codepoint (surrogate pair)
691 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
692 },
693
694 // CSS string/identifier serialization
695 // https://drafts.csswg.org/cssom/#common-serializing-idioms
696 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
697 fcssescape = function( ch, asCodePoint ) {
698 if ( asCodePoint ) {
699
700 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
701 if ( ch === "\0" ) {
702 return "\uFFFD";
703 }
704
705 // Control characters and (dependent upon position) numbers get escaped as code points
706 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
707 }
708
709 // Other potentially-special ASCII characters get backslash-escaped
710 return "\\" + ch;
711 },
712
713 // Used for iframes
714 // See setDocument()
715 // Removing the function wrapper causes a "Permission Denied"
716 // error in IE
717 unloadHandler = function() {
718 setDocument();
719 },
720
721 disabledAncestor = addCombinator(
722 function( elem ) {
723 return elem.disabled === true && ("form" in elem || "label" in elem);
724 },
725 { dir: "parentNode", next: "legend" }
726 );
727
728// Optimize for push.apply( _, NodeList )
729try {
730 push.apply(
731 (arr = slice.call( preferredDoc.childNodes )),
732 preferredDoc.childNodes
733 );
734 // Support: Android<4.0
735 // Detect silently failing push.apply
736 arr[ preferredDoc.childNodes.length ].nodeType;
737} catch ( e ) {
738 push = { apply: arr.length ?
739
740 // Leverage slice if possible
741 function( target, els ) {
742 push_native.apply( target, slice.call(els) );
743 } :
744
745 // Support: IE<9
746 // Otherwise append directly
747 function( target, els ) {
748 var j = target.length,
749 i = 0;
750 // Can't trust NodeList.length
751 while ( (target[j++] = els[i++]) ) {}
752 target.length = j - 1;
753 }
754 };
755}
756
757function Sizzle( selector, context, results, seed ) {
758 var m, i, elem, nid, match, groups, newSelector,
759 newContext = context && context.ownerDocument,
760
761 // nodeType defaults to 9, since context defaults to document
762 nodeType = context ? context.nodeType : 9;
763
764 results = results || [];
765
766 // Return early from calls with invalid selector or context
767 if ( typeof selector !== "string" || !selector ||
768 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
769
770 return results;
771 }
772
773 // Try to shortcut find operations (as opposed to filters) in HTML documents
774 if ( !seed ) {
775
776 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
777 setDocument( context );
778 }
779 context = context || document;
780
781 if ( documentIsHTML ) {
782
783 // If the selector is sufficiently simple, try using a "get*By*" DOM method
784 // (excepting DocumentFragment context, where the methods don't exist)
785 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
786
787 // ID selector
788 if ( (m = match[1]) ) {
789
790 // Document context
791 if ( nodeType === 9 ) {
792 if ( (elem = context.getElementById( m )) ) {
793
794 // Support: IE, Opera, Webkit
795 // TODO: identify versions
796 // getElementById can match elements by name instead of ID
797 if ( elem.id === m ) {
798 results.push( elem );
799 return results;
800 }
801 } else {
802 return results;
803 }
804
805 // Element context
806 } else {
807
808 // Support: IE, Opera, Webkit
809 // TODO: identify versions
810 // getElementById can match elements by name instead of ID
811 if ( newContext && (elem = newContext.getElementById( m )) &&
812 contains( context, elem ) &&
813 elem.id === m ) {
814
815 results.push( elem );
816 return results;
817 }
818 }
819
820 // Type selector
821 } else if ( match[2] ) {
822 push.apply( results, context.getElementsByTagName( selector ) );
823 return results;
824
825 // Class selector
826 } else if ( (m = match[3]) && support.getElementsByClassName &&
827 context.getElementsByClassName ) {
828
829 push.apply( results, context.getElementsByClassName( m ) );
830 return results;
831 }
832 }
833
834 // Take advantage of querySelectorAll
835 if ( support.qsa &&
836 !compilerCache[ selector + " " ] &&
837 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
838
839 if ( nodeType !== 1 ) {
840 newContext = context;
841 newSelector = selector;
842
843 // qSA looks outside Element context, which is not what we want
844 // Thanks to Andrew Dupont for this workaround technique
845 // Support: IE <=8
846 // Exclude object elements
847 } else if ( context.nodeName.toLowerCase() !== "object" ) {
848
849 // Capture the context ID, setting it first if necessary
850 if ( (nid = context.getAttribute( "id" )) ) {
851 nid = nid.replace( rcssescape, fcssescape );
852 } else {
853 context.setAttribute( "id", (nid = expando) );
854 }
855
856 // Prefix every selector in the list
857 groups = tokenize( selector );
858 i = groups.length;
859 while ( i-- ) {
860 groups[i] = "#" + nid + " " + toSelector( groups[i] );
861 }
862 newSelector = groups.join( "," );
863
864 // Expand context for sibling selectors
865 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
866 context;
867 }
868
869 if ( newSelector ) {
870 try {
871 push.apply( results,
872 newContext.querySelectorAll( newSelector )
873 );
874 return results;
875 } catch ( qsaError ) {
876 } finally {
877 if ( nid === expando ) {
878 context.removeAttribute( "id" );
879 }
880 }
881 }
882 }
883 }
884 }
885
886 // All others
887 return select( selector.replace( rtrim, "$1" ), context, results, seed );
888}
889
890/**
891 * Create key-value caches of limited size
892 * @returns {function(string, object)} Returns the Object data after storing it on itself with
893 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
894 * deleting the oldest entry
895 */
896function createCache() {
897 var keys = [];
898
899 function cache( key, value ) {
900 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
901 if ( keys.push( key + " " ) > Expr.cacheLength ) {
902 // Only keep the most recent entries
903 delete cache[ keys.shift() ];
904 }
905 return (cache[ key + " " ] = value);
906 }
907 return cache;
908}
909
910/**
911 * Mark a function for special use by Sizzle
912 * @param {Function} fn The function to mark
913 */
914function markFunction( fn ) {
915 fn[ expando ] = true;
916 return fn;
917}
918
919/**
920 * Support testing using an element
921 * @param {Function} fn Passed the created element and returns a boolean result
922 */
923function assert( fn ) {
924 var el = document.createElement("fieldset");
925
926 try {
927 return !!fn( el );
928 } catch (e) {
929 return false;
930 } finally {
931 // Remove from its parent by default
932 if ( el.parentNode ) {
933 el.parentNode.removeChild( el );
934 }
935 // release memory in IE
936 el = null;
937 }
938}
939
940/**
941 * Adds the same handler for all of the specified attrs
942 * @param {String} attrs Pipe-separated list of attributes
943 * @param {Function} handler The method that will be applied
944 */
945function addHandle( attrs, handler ) {
946 var arr = attrs.split("|"),
947 i = arr.length;
948
949 while ( i-- ) {
950 Expr.attrHandle[ arr[i] ] = handler;
951 }
952}
953
954/**
955 * Checks document order of two siblings
956 * @param {Element} a
957 * @param {Element} b
958 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
959 */
960function siblingCheck( a, b ) {
961 var cur = b && a,
962 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
963 a.sourceIndex - b.sourceIndex;
964
965 // Use IE sourceIndex if available on both nodes
966 if ( diff ) {
967 return diff;
968 }
969
970 // Check if b follows a
971 if ( cur ) {
972 while ( (cur = cur.nextSibling) ) {
973 if ( cur === b ) {
974 return -1;
975 }
976 }
977 }
978
979 return a ? 1 : -1;
980}
981
982/**
983 * Returns a function to use in pseudos for input types
984 * @param {String} type
985 */
986function createInputPseudo( type ) {
987 return function( elem ) {
988 var name = elem.nodeName.toLowerCase();
989 return name === "input" && elem.type === type;
990 };
991}
992
993/**
994 * Returns a function to use in pseudos for buttons
995 * @param {String} type
996 */
997function createButtonPseudo( type ) {
998 return function( elem ) {
999 var name = elem.nodeName.toLowerCase();
1000 return (name === "input" || name === "button") && elem.type === type;
1001 };
1002}
1003
1004/**
1005 * Returns a function to use in pseudos for :enabled/:disabled
1006 * @param {Boolean} disabled true for :disabled; false for :enabled
1007 */
1008function createDisabledPseudo( disabled ) {
1009
1010 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
1011 return function( elem ) {
1012
1013 // Only certain elements can match :enabled or :disabled
1014 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
1015 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
1016 if ( "form" in elem ) {
1017
1018 // Check for inherited disabledness on relevant non-disabled elements:
1019 // * listed form-associated elements in a disabled fieldset
1020 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
1021 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
1022 // * option elements in a disabled optgroup
1023 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
1024 // All such elements have a "form" property.
1025 if ( elem.parentNode && elem.disabled === false ) {
1026
1027 // Option elements defer to a parent optgroup if present
1028 if ( "label" in elem ) {
1029 if ( "label" in elem.parentNode ) {
1030 return elem.parentNode.disabled === disabled;
1031 } else {
1032 return elem.disabled === disabled;
1033 }
1034 }
1035
1036 // Support: IE 6 - 11
1037 // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1038 return elem.isDisabled === disabled ||
1039
1040 // Where there is no isDisabled, check manually
1041 /* jshint -W018 */
1042 elem.isDisabled !== !disabled &&
1043 disabledAncestor( elem ) === disabled;
1044 }
1045
1046 return elem.disabled === disabled;
1047
1048 // Try to winnow out elements that can't be disabled before trusting the disabled property.
1049 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
1050 // even exist on them, let alone have a boolean value.
1051 } else if ( "label" in elem ) {
1052 return elem.disabled === disabled;
1053 }
1054
1055 // Remaining elements are neither :enabled nor :disabled
1056 return false;
1057 };
1058}
1059
1060/**
1061 * Returns a function to use in pseudos for positionals
1062 * @param {Function} fn
1063 */
1064function createPositionalPseudo( fn ) {
1065 return markFunction(function( argument ) {
1066 argument = +argument;
1067 return markFunction(function( seed, matches ) {
1068 var j,
1069 matchIndexes = fn( [], seed.length, argument ),
1070 i = matchIndexes.length;
1071
1072 // Match elements found at the specified indexes
1073 while ( i-- ) {
1074 if ( seed[ (j = matchIndexes[i]) ] ) {
1075 seed[j] = !(matches[j] = seed[j]);
1076 }
1077 }
1078 });
1079 });
1080}
1081
1082/**
1083 * Checks a node for validity as a Sizzle context
1084 * @param {Element|Object=} context
1085 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1086 */
1087function testContext( context ) {
1088 return context && typeof context.getElementsByTagName !== "undefined" && context;
1089}
1090
1091// Expose support vars for convenience
1092support = Sizzle.support = {};
1093
1094/**
1095 * Detects XML nodes
1096 * @param {Element|Object} elem An element or a document
1097 * @returns {Boolean} True iff elem is a non-HTML XML node
1098 */
1099isXML = Sizzle.isXML = function( elem ) {
1100 // documentElement is verified for cases where it doesn't yet exist
1101 // (such as loading iframes in IE - #4833)
1102 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1103 return documentElement ? documentElement.nodeName !== "HTML" : false;
1104};
1105
1106/**
1107 * Sets document-related variables once based on the current document
1108 * @param {Element|Object} [doc] An element or document object to use to set the document
1109 * @returns {Object} Returns the current document
1110 */
1111setDocument = Sizzle.setDocument = function( node ) {
1112 var hasCompare, subWindow,
1113 doc = node ? node.ownerDocument || node : preferredDoc;
1114
1115 // Return early if doc is invalid or already selected
1116 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1117 return document;
1118 }
1119
1120 // Update global variables
1121 document = doc;
1122 docElem = document.documentElement;
1123 documentIsHTML = !isXML( document );
1124
1125 // Support: IE 9-11, Edge
1126 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1127 if ( preferredDoc !== document &&
1128 (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
1129
1130 // Support: IE 11, Edge
1131 if ( subWindow.addEventListener ) {
1132 subWindow.addEventListener( "unload", unloadHandler, false );
1133
1134 // Support: IE 9 - 10 only
1135 } else if ( subWindow.attachEvent ) {
1136 subWindow.attachEvent( "onunload", unloadHandler );
1137 }
1138 }
1139
1140 /* Attributes
1141 ---------------------------------------------------------------------- */
1142
1143 // Support: IE<8
1144 // Verify that getAttribute really returns attributes and not properties
1145 // (excepting IE8 booleans)
1146 support.attributes = assert(function( el ) {
1147 el.className = "i";
1148 return !el.getAttribute("className");
1149 });
1150
1151 /* getElement(s)By*
1152 ---------------------------------------------------------------------- */
1153
1154 // Check if getElementsByTagName("*") returns only elements
1155 support.getElementsByTagName = assert(function( el ) {
1156 el.appendChild( document.createComment("") );
1157 return !el.getElementsByTagName("*").length;
1158 });
1159
1160 // Support: IE<9
1161 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1162
1163 // Support: IE<10
1164 // Check if getElementById returns elements by name
1165 // The broken getElementById methods don't pick up programmatically-set names,
1166 // so use a roundabout getElementsByName test
1167 support.getById = assert(function( el ) {
1168 docElem.appendChild( el ).id = expando;
1169 return !document.getElementsByName || !document.getElementsByName( expando ).length;
1170 });
1171
1172 // ID filter and find
1173 if ( support.getById ) {
1174 Expr.filter["ID"] = function( id ) {
1175 var attrId = id.replace( runescape, funescape );
1176 return function( elem ) {
1177 return elem.getAttribute("id") === attrId;
1178 };
1179 };
1180 Expr.find["ID"] = function( id, context ) {
1181 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1182 var elem = context.getElementById( id );
1183 return elem ? [ elem ] : [];
1184 }
1185 };
1186 } else {
1187 Expr.filter["ID"] = function( id ) {
1188 var attrId = id.replace( runescape, funescape );
1189 return function( elem ) {
1190 var node = typeof elem.getAttributeNode !== "undefined" &&
1191 elem.getAttributeNode("id");
1192 return node && node.value === attrId;
1193 };
1194 };
1195
1196 // Support: IE 6 - 7 only
1197 // getElementById is not reliable as a find shortcut
1198 Expr.find["ID"] = function( id, context ) {
1199 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1200 var node, i, elems,
1201 elem = context.getElementById( id );
1202
1203 if ( elem ) {
1204
1205 // Verify the id attribute
1206 node = elem.getAttributeNode("id");
1207 if ( node && node.value === id ) {
1208 return [ elem ];
1209 }
1210
1211 // Fall back on getElementsByName
1212 elems = context.getElementsByName( id );
1213 i = 0;
1214 while ( (elem = elems[i++]) ) {
1215 node = elem.getAttributeNode("id");
1216 if ( node && node.value === id ) {
1217 return [ elem ];
1218 }
1219 }
1220 }
1221
1222 return [];
1223 }
1224 };
1225 }
1226
1227 // Tag
1228 Expr.find["TAG"] = support.getElementsByTagName ?
1229 function( tag, context ) {
1230 if ( typeof context.getElementsByTagName !== "undefined" ) {
1231 return context.getElementsByTagName( tag );
1232
1233 // DocumentFragment nodes don't have gEBTN
1234 } else if ( support.qsa ) {
1235 return context.querySelectorAll( tag );
1236 }
1237 } :
1238
1239 function( tag, context ) {
1240 var elem,
1241 tmp = [],
1242 i = 0,
1243 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1244 results = context.getElementsByTagName( tag );
1245
1246 // Filter out possible comments
1247 if ( tag === "*" ) {
1248 while ( (elem = results[i++]) ) {
1249 if ( elem.nodeType === 1 ) {
1250 tmp.push( elem );
1251 }
1252 }
1253
1254 return tmp;
1255 }
1256 return results;
1257 };
1258
1259 // Class
1260 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1261 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1262 return context.getElementsByClassName( className );
1263 }
1264 };
1265
1266 /* QSA/matchesSelector
1267 ---------------------------------------------------------------------- */
1268
1269 // QSA and matchesSelector support
1270
1271 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1272 rbuggyMatches = [];
1273
1274 // qSa(:focus) reports false when true (Chrome 21)
1275 // We allow this because of a bug in IE8/9 that throws an error
1276 // whenever `document.activeElement` is accessed on an iframe
1277 // So, we allow :focus to pass through QSA all the time to avoid the IE error
1278 // See https://bugs.jquery.com/ticket/13378
1279 rbuggyQSA = [];
1280
1281 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
1282 // Build QSA regex
1283 // Regex strategy adopted from Diego Perini
1284 assert(function( el ) {
1285 // Select is set to empty string on purpose
1286 // This is to test IE's treatment of not explicitly
1287 // setting a boolean content attribute,
1288 // since its presence should be enough
1289 // https://bugs.jquery.com/ticket/12359
1290 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
1291 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1292 "<option selected=''></option></select>";
1293
1294 // Support: IE8, Opera 11-12.16
1295 // Nothing should be selected when empty strings follow ^= or $= or *=
1296 // The test attribute must be unknown in Opera but "safe" for WinRT
1297 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1298 if ( el.querySelectorAll("[msallowcapture^='']").length ) {
1299 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1300 }
1301
1302 // Support: IE8
1303 // Boolean attributes and "value" are not treated correctly
1304 if ( !el.querySelectorAll("[selected]").length ) {
1305 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1306 }
1307
1308 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1309 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1310 rbuggyQSA.push("~=");
1311 }
1312
1313 // Webkit/Opera - :checked should return selected option elements
1314 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1315 // IE8 throws error here and will not see later tests
1316 if ( !el.querySelectorAll(":checked").length ) {
1317 rbuggyQSA.push(":checked");
1318 }
1319
1320 // Support: Safari 8+, iOS 8+
1321 // https://bugs.webkit.org/show_bug.cgi?id=136851
1322 // In-page `selector#id sibling-combinator selector` fails
1323 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1324 rbuggyQSA.push(".#.+[+~]");
1325 }
1326 });
1327
1328 assert(function( el ) {
1329 el.innerHTML = "<a href='' disabled='disabled'></a>" +
1330 "<select disabled='disabled'><option/></select>";
1331
1332 // Support: Windows 8 Native Apps
1333 // The type and name attributes are restricted during .innerHTML assignment
1334 var input = document.createElement("input");
1335 input.setAttribute( "type", "hidden" );
1336 el.appendChild( input ).setAttribute( "name", "D" );
1337
1338 // Support: IE8
1339 // Enforce case-sensitivity of name attribute
1340 if ( el.querySelectorAll("[name=d]").length ) {
1341 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1342 }
1343
1344 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1345 // IE8 throws error here and will not see later tests
1346 if ( el.querySelectorAll(":enabled").length !== 2 ) {
1347 rbuggyQSA.push( ":enabled", ":disabled" );
1348 }
1349
1350 // Support: IE9-11+
1351 // IE's :disabled selector does not pick up the children of disabled fieldsets
1352 docElem.appendChild( el ).disabled = true;
1353 if ( el.querySelectorAll(":disabled").length !== 2 ) {
1354 rbuggyQSA.push( ":enabled", ":disabled" );
1355 }
1356
1357 // Opera 10-11 does not throw on post-comma invalid pseudos
1358 el.querySelectorAll("*,:x");
1359 rbuggyQSA.push(",.*:");
1360 });
1361 }
1362
1363 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1364 docElem.webkitMatchesSelector ||
1365 docElem.mozMatchesSelector ||
1366 docElem.oMatchesSelector ||
1367 docElem.msMatchesSelector) )) ) {
1368
1369 assert(function( el ) {
1370 // Check to see if it's possible to do matchesSelector
1371 // on a disconnected node (IE 9)
1372 support.disconnectedMatch = matches.call( el, "*" );
1373
1374 // This should fail with an exception
1375 // Gecko does not error, returns false instead
1376 matches.call( el, "[s!='']:x" );
1377 rbuggyMatches.push( "!=", pseudos );
1378 });
1379 }
1380
1381 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1382 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1383
1384 /* Contains
1385 ---------------------------------------------------------------------- */
1386 hasCompare = rnative.test( docElem.compareDocumentPosition );
1387
1388 // Element contains another
1389 // Purposefully self-exclusive
1390 // As in, an element does not contain itself
1391 contains = hasCompare || rnative.test( docElem.contains ) ?
1392 function( a, b ) {
1393 var adown = a.nodeType === 9 ? a.documentElement : a,
1394 bup = b && b.parentNode;
1395 return a === bup || !!( bup && bup.nodeType === 1 && (
1396 adown.contains ?
1397 adown.contains( bup ) :
1398 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1399 ));
1400 } :
1401 function( a, b ) {
1402 if ( b ) {
1403 while ( (b = b.parentNode) ) {
1404 if ( b === a ) {
1405 return true;
1406 }
1407 }
1408 }
1409 return false;
1410 };
1411
1412 /* Sorting
1413 ---------------------------------------------------------------------- */
1414
1415 // Document order sorting
1416 sortOrder = hasCompare ?
1417 function( a, b ) {
1418
1419 // Flag for duplicate removal
1420 if ( a === b ) {
1421 hasDuplicate = true;
1422 return 0;
1423 }
1424
1425 // Sort on method existence if only one input has compareDocumentPosition
1426 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1427 if ( compare ) {
1428 return compare;
1429 }
1430
1431 // Calculate position if both inputs belong to the same document
1432 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1433 a.compareDocumentPosition( b ) :
1434
1435 // Otherwise we know they are disconnected
1436 1;
1437
1438 // Disconnected nodes
1439 if ( compare & 1 ||
1440 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1441
1442 // Choose the first element that is related to our preferred document
1443 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1444 return -1;
1445 }
1446 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1447 return 1;
1448 }
1449
1450 // Maintain original order
1451 return sortInput ?
1452 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1453 0;
1454 }
1455
1456 return compare & 4 ? -1 : 1;
1457 } :
1458 function( a, b ) {
1459 // Exit early if the nodes are identical
1460 if ( a === b ) {
1461 hasDuplicate = true;
1462 return 0;
1463 }
1464
1465 var cur,
1466 i = 0,
1467 aup = a.parentNode,
1468 bup = b.parentNode,
1469 ap = [ a ],
1470 bp = [ b ];
1471
1472 // Parentless nodes are either documents or disconnected
1473 if ( !aup || !bup ) {
1474 return a === document ? -1 :
1475 b === document ? 1 :
1476 aup ? -1 :
1477 bup ? 1 :
1478 sortInput ?
1479 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1480 0;
1481
1482 // If the nodes are siblings, we can do a quick check
1483 } else if ( aup === bup ) {
1484 return siblingCheck( a, b );
1485 }
1486
1487 // Otherwise we need full lists of their ancestors for comparison
1488 cur = a;
1489 while ( (cur = cur.parentNode) ) {
1490 ap.unshift( cur );
1491 }
1492 cur = b;
1493 while ( (cur = cur.parentNode) ) {
1494 bp.unshift( cur );
1495 }
1496
1497 // Walk down the tree looking for a discrepancy
1498 while ( ap[i] === bp[i] ) {
1499 i++;
1500 }
1501
1502 return i ?
1503 // Do a sibling check if the nodes have a common ancestor
1504 siblingCheck( ap[i], bp[i] ) :
1505
1506 // Otherwise nodes in our document sort first
1507 ap[i] === preferredDoc ? -1 :
1508 bp[i] === preferredDoc ? 1 :
1509 0;
1510 };
1511
1512 return document;
1513};
1514
1515Sizzle.matches = function( expr, elements ) {
1516 return Sizzle( expr, null, null, elements );
1517};
1518
1519Sizzle.matchesSelector = function( elem, expr ) {
1520 // Set document vars if needed
1521 if ( ( elem.ownerDocument || elem ) !== document ) {
1522 setDocument( elem );
1523 }
1524
1525 // Make sure that attribute selectors are quoted
1526 expr = expr.replace( rattributeQuotes, "='$1']" );
1527
1528 if ( support.matchesSelector && documentIsHTML &&
1529 !compilerCache[ expr + " " ] &&
1530 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1531 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1532
1533 try {
1534 var ret = matches.call( elem, expr );
1535
1536 // IE 9's matchesSelector returns false on disconnected nodes
1537 if ( ret || support.disconnectedMatch ||
1538 // As well, disconnected nodes are said to be in a document
1539 // fragment in IE 9
1540 elem.document && elem.document.nodeType !== 11 ) {
1541 return ret;
1542 }
1543 } catch (e) {}
1544 }
1545
1546 return Sizzle( expr, document, null, [ elem ] ).length > 0;
1547};
1548
1549Sizzle.contains = function( context, elem ) {
1550 // Set document vars if needed
1551 if ( ( context.ownerDocument || context ) !== document ) {
1552 setDocument( context );
1553 }
1554 return contains( context, elem );
1555};
1556
1557Sizzle.attr = function( elem, name ) {
1558 // Set document vars if needed
1559 if ( ( elem.ownerDocument || elem ) !== document ) {
1560 setDocument( elem );
1561 }
1562
1563 var fn = Expr.attrHandle[ name.toLowerCase() ],
1564 // Don't get fooled by Object.prototype properties (jQuery #13807)
1565 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1566 fn( elem, name, !documentIsHTML ) :
1567 undefined;
1568
1569 return val !== undefined ?
1570 val :
1571 support.attributes || !documentIsHTML ?
1572 elem.getAttribute( name ) :
1573 (val = elem.getAttributeNode(name)) && val.specified ?
1574 val.value :
1575 null;
1576};
1577
1578Sizzle.escape = function( sel ) {
1579 return (sel + "").replace( rcssescape, fcssescape );
1580};
1581
1582Sizzle.error = function( msg ) {
1583 throw new Error( "Syntax error, unrecognized expression: " + msg );
1584};
1585
1586/**
1587 * Document sorting and removing duplicates
1588 * @param {ArrayLike} results
1589 */
1590Sizzle.uniqueSort = function( results ) {
1591 var elem,
1592 duplicates = [],
1593 j = 0,
1594 i = 0;
1595
1596 // Unless we *know* we can detect duplicates, assume their presence
1597 hasDuplicate = !support.detectDuplicates;
1598 sortInput = !support.sortStable && results.slice( 0 );
1599 results.sort( sortOrder );
1600
1601 if ( hasDuplicate ) {
1602 while ( (elem = results[i++]) ) {
1603 if ( elem === results[ i ] ) {
1604 j = duplicates.push( i );
1605 }
1606 }
1607 while ( j-- ) {
1608 results.splice( duplicates[ j ], 1 );
1609 }
1610 }
1611
1612 // Clear input after sorting to release objects
1613 // See https://github.com/jquery/sizzle/pull/225
1614 sortInput = null;
1615
1616 return results;
1617};
1618
1619/**
1620 * Utility function for retrieving the text value of an array of DOM nodes
1621 * @param {Array|Element} elem
1622 */
1623getText = Sizzle.getText = function( elem ) {
1624 var node,
1625 ret = "",
1626 i = 0,
1627 nodeType = elem.nodeType;
1628
1629 if ( !nodeType ) {
1630 // If no nodeType, this is expected to be an array
1631 while ( (node = elem[i++]) ) {
1632 // Do not traverse comment nodes
1633 ret += getText( node );
1634 }
1635 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1636 // Use textContent for elements
1637 // innerText usage removed for consistency of new lines (jQuery #11153)
1638 if ( typeof elem.textContent === "string" ) {
1639 return elem.textContent;
1640 } else {
1641 // Traverse its children
1642 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1643 ret += getText( elem );
1644 }
1645 }
1646 } else if ( nodeType === 3 || nodeType === 4 ) {
1647 return elem.nodeValue;
1648 }
1649 // Do not include comment or processing instruction nodes
1650
1651 return ret;
1652};
1653
1654Expr = Sizzle.selectors = {
1655
1656 // Can be adjusted by the user
1657 cacheLength: 50,
1658
1659 createPseudo: markFunction,
1660
1661 match: matchExpr,
1662
1663 attrHandle: {},
1664
1665 find: {},
1666
1667 relative: {
1668 ">": { dir: "parentNode", first: true },
1669 " ": { dir: "parentNode" },
1670 "+": { dir: "previousSibling", first: true },
1671 "~": { dir: "previousSibling" }
1672 },
1673
1674 preFilter: {
1675 "ATTR": function( match ) {
1676 match[1] = match[1].replace( runescape, funescape );
1677
1678 // Move the given value to match[3] whether quoted or unquoted
1679 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1680
1681 if ( match[2] === "~=" ) {
1682 match[3] = " " + match[3] + " ";
1683 }
1684
1685 return match.slice( 0, 4 );
1686 },
1687
1688 "CHILD": function( match ) {
1689 /* matches from matchExpr["CHILD"]
1690 1 type (only|nth|...)
1691 2 what (child|of-type)
1692 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1693 4 xn-component of xn+y argument ([+-]?\d*n|)
1694 5 sign of xn-component
1695 6 x of xn-component
1696 7 sign of y-component
1697 8 y of y-component
1698 */
1699 match[1] = match[1].toLowerCase();
1700
1701 if ( match[1].slice( 0, 3 ) === "nth" ) {
1702 // nth-* requires argument
1703 if ( !match[3] ) {
1704 Sizzle.error( match[0] );
1705 }
1706
1707 // numeric x and y parameters for Expr.filter.CHILD
1708 // remember that false/true cast respectively to 0/1
1709 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1710 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1711
1712 // other types prohibit arguments
1713 } else if ( match[3] ) {
1714 Sizzle.error( match[0] );
1715 }
1716
1717 return match;
1718 },
1719
1720 "PSEUDO": function( match ) {
1721 var excess,
1722 unquoted = !match[6] && match[2];
1723
1724 if ( matchExpr["CHILD"].test( match[0] ) ) {
1725 return null;
1726 }
1727
1728 // Accept quoted arguments as-is
1729 if ( match[3] ) {
1730 match[2] = match[4] || match[5] || "";
1731
1732 // Strip excess characters from unquoted arguments
1733 } else if ( unquoted && rpseudo.test( unquoted ) &&
1734 // Get excess from tokenize (recursively)
1735 (excess = tokenize( unquoted, true )) &&
1736 // advance to the next closing parenthesis
1737 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1738
1739 // excess is a negative index
1740 match[0] = match[0].slice( 0, excess );
1741 match[2] = unquoted.slice( 0, excess );
1742 }
1743
1744 // Return only captures needed by the pseudo filter method (type and argument)
1745 return match.slice( 0, 3 );
1746 }
1747 },
1748
1749 filter: {
1750
1751 "TAG": function( nodeNameSelector ) {
1752 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1753 return nodeNameSelector === "*" ?
1754 function() { return true; } :
1755 function( elem ) {
1756 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1757 };
1758 },
1759
1760 "CLASS": function( className ) {
1761 var pattern = classCache[ className + " " ];
1762
1763 return pattern ||
1764 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1765 classCache( className, function( elem ) {
1766 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1767 });
1768 },
1769
1770 "ATTR": function( name, operator, check ) {
1771 return function( elem ) {
1772 var result = Sizzle.attr( elem, name );
1773
1774 if ( result == null ) {
1775 return operator === "!=";
1776 }
1777 if ( !operator ) {
1778 return true;
1779 }
1780
1781 result += "";
1782
1783 return operator === "=" ? result === check :
1784 operator === "!=" ? result !== check :
1785 operator === "^=" ? check && result.indexOf( check ) === 0 :
1786 operator === "*=" ? check && result.indexOf( check ) > -1 :
1787 operator === "$=" ? check && result.slice( -check.length ) === check :
1788 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1789 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1790 false;
1791 };
1792 },
1793
1794 "CHILD": function( type, what, argument, first, last ) {
1795 var simple = type.slice( 0, 3 ) !== "nth",
1796 forward = type.slice( -4 ) !== "last",
1797 ofType = what === "of-type";
1798
1799 return first === 1 && last === 0 ?
1800
1801 // Shortcut for :nth-*(n)
1802 function( elem ) {
1803 return !!elem.parentNode;
1804 } :
1805
1806 function( elem, context, xml ) {
1807 var cache, uniqueCache, outerCache, node, nodeIndex, start,
1808 dir = simple !== forward ? "nextSibling" : "previousSibling",
1809 parent = elem.parentNode,
1810 name = ofType && elem.nodeName.toLowerCase(),
1811 useCache = !xml && !ofType,
1812 diff = false;
1813
1814 if ( parent ) {
1815
1816 // :(first|last|only)-(child|of-type)
1817 if ( simple ) {
1818 while ( dir ) {
1819 node = elem;
1820 while ( (node = node[ dir ]) ) {
1821 if ( ofType ?
1822 node.nodeName.toLowerCase() === name :
1823 node.nodeType === 1 ) {
1824
1825 return false;
1826 }
1827 }
1828 // Reverse direction for :only-* (if we haven't yet done so)
1829 start = dir = type === "only" && !start && "nextSibling";
1830 }
1831 return true;
1832 }
1833
1834 start = [ forward ? parent.firstChild : parent.lastChild ];
1835
1836 // non-xml :nth-child(...) stores cache data on `parent`
1837 if ( forward && useCache ) {
1838
1839 // Seek `elem` from a previously-cached index
1840
1841 // ...in a gzip-friendly way
1842 node = parent;
1843 outerCache = node[ expando ] || (node[ expando ] = {});
1844
1845 // Support: IE <9 only
1846 // Defend against cloned attroperties (jQuery gh-1709)
1847 uniqueCache = outerCache[ node.uniqueID ] ||
1848 (outerCache[ node.uniqueID ] = {});
1849
1850 cache = uniqueCache[ type ] || [];
1851 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1852 diff = nodeIndex && cache[ 2 ];
1853 node = nodeIndex && parent.childNodes[ nodeIndex ];
1854
1855 while ( (node = ++nodeIndex && node && node[ dir ] ||
1856
1857 // Fallback to seeking `elem` from the start
1858 (diff = nodeIndex = 0) || start.pop()) ) {
1859
1860 // When found, cache indexes on `parent` and break
1861 if ( node.nodeType === 1 && ++diff && node === elem ) {
1862 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1863 break;
1864 }
1865 }
1866
1867 } else {
1868 // Use previously-cached element index if available
1869 if ( useCache ) {
1870 // ...in a gzip-friendly way
1871 node = elem;
1872 outerCache = node[ expando ] || (node[ expando ] = {});
1873
1874 // Support: IE <9 only
1875 // Defend against cloned attroperties (jQuery gh-1709)
1876 uniqueCache = outerCache[ node.uniqueID ] ||
1877 (outerCache[ node.uniqueID ] = {});
1878
1879 cache = uniqueCache[ type ] || [];
1880 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1881 diff = nodeIndex;
1882 }
1883
1884 // xml :nth-child(...)
1885 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1886 if ( diff === false ) {
1887 // Use the same loop as above to seek `elem` from the start
1888 while ( (node = ++nodeIndex && node && node[ dir ] ||
1889 (diff = nodeIndex = 0) || start.pop()) ) {
1890
1891 if ( ( ofType ?
1892 node.nodeName.toLowerCase() === name :
1893 node.nodeType === 1 ) &&
1894 ++diff ) {
1895
1896 // Cache the index of each encountered element
1897 if ( useCache ) {
1898 outerCache = node[ expando ] || (node[ expando ] = {});
1899
1900 // Support: IE <9 only
1901 // Defend against cloned attroperties (jQuery gh-1709)
1902 uniqueCache = outerCache[ node.uniqueID ] ||
1903 (outerCache[ node.uniqueID ] = {});
1904
1905 uniqueCache[ type ] = [ dirruns, diff ];
1906 }
1907
1908 if ( node === elem ) {
1909 break;
1910 }
1911 }
1912 }
1913 }
1914 }
1915
1916 // Incorporate the offset, then check against cycle size
1917 diff -= last;
1918 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1919 }
1920 };
1921 },
1922
1923 "PSEUDO": function( pseudo, argument ) {
1924 // pseudo-class names are case-insensitive
1925 // http://www.w3.org/TR/selectors/#pseudo-classes
1926 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1927 // Remember that setFilters inherits from pseudos
1928 var args,
1929 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1930 Sizzle.error( "unsupported pseudo: " + pseudo );
1931
1932 // The user may use createPseudo to indicate that
1933 // arguments are needed to create the filter function
1934 // just as Sizzle does
1935 if ( fn[ expando ] ) {
1936 return fn( argument );
1937 }
1938
1939 // But maintain support for old signatures
1940 if ( fn.length > 1 ) {
1941 args = [ pseudo, pseudo, "", argument ];
1942 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1943 markFunction(function( seed, matches ) {
1944 var idx,
1945 matched = fn( seed, argument ),
1946 i = matched.length;
1947 while ( i-- ) {
1948 idx = indexOf( seed, matched[i] );
1949 seed[ idx ] = !( matches[ idx ] = matched[i] );
1950 }
1951 }) :
1952 function( elem ) {
1953 return fn( elem, 0, args );
1954 };
1955 }
1956
1957 return fn;
1958 }
1959 },
1960
1961 pseudos: {
1962 // Potentially complex pseudos
1963 "not": markFunction(function( selector ) {
1964 // Trim the selector passed to compile
1965 // to avoid treating leading and trailing
1966 // spaces as combinators
1967 var input = [],
1968 results = [],
1969 matcher = compile( selector.replace( rtrim, "$1" ) );
1970
1971 return matcher[ expando ] ?
1972 markFunction(function( seed, matches, context, xml ) {
1973 var elem,
1974 unmatched = matcher( seed, null, xml, [] ),
1975 i = seed.length;
1976
1977 // Match elements unmatched by `matcher`
1978 while ( i-- ) {
1979 if ( (elem = unmatched[i]) ) {
1980 seed[i] = !(matches[i] = elem);
1981 }
1982 }
1983 }) :
1984 function( elem, context, xml ) {
1985 input[0] = elem;
1986 matcher( input, null, xml, results );
1987 // Don't keep the element (issue #299)
1988 input[0] = null;
1989 return !results.pop();
1990 };
1991 }),
1992
1993 "has": markFunction(function( selector ) {
1994 return function( elem ) {
1995 return Sizzle( selector, elem ).length > 0;
1996 };
1997 }),
1998
1999 "contains": markFunction(function( text ) {
2000 text = text.replace( runescape, funescape );
2001 return function( elem ) {
2002 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
2003 };
2004 }),
2005
2006 // "Whether an element is represented by a :lang() selector
2007 // is based solely on the element's language value
2008 // being equal to the identifier C,
2009 // or beginning with the identifier C immediately followed by "-".
2010 // The matching of C against the element's language value is performed case-insensitively.
2011 // The identifier C does not have to be a valid language name."
2012 // http://www.w3.org/TR/selectors/#lang-pseudo
2013 "lang": markFunction( function( lang ) {
2014 // lang value must be a valid identifier
2015 if ( !ridentifier.test(lang || "") ) {
2016 Sizzle.error( "unsupported lang: " + lang );
2017 }
2018 lang = lang.replace( runescape, funescape ).toLowerCase();
2019 return function( elem ) {
2020 var elemLang;
2021 do {
2022 if ( (elemLang = documentIsHTML ?
2023 elem.lang :
2024 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
2025
2026 elemLang = elemLang.toLowerCase();
2027 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
2028 }
2029 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
2030 return false;
2031 };
2032 }),
2033
2034 // Miscellaneous
2035 "target": function( elem ) {
2036 var hash = window.location && window.location.hash;
2037 return hash && hash.slice( 1 ) === elem.id;
2038 },
2039
2040 "root": function( elem ) {
2041 return elem === docElem;
2042 },
2043
2044 "focus": function( elem ) {
2045 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
2046 },
2047
2048 // Boolean properties
2049 "enabled": createDisabledPseudo( false ),
2050 "disabled": createDisabledPseudo( true ),
2051
2052 "checked": function( elem ) {
2053 // In CSS3, :checked should return both checked and selected elements
2054 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2055 var nodeName = elem.nodeName.toLowerCase();
2056 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
2057 },
2058
2059 "selected": function( elem ) {
2060 // Accessing this property makes selected-by-default
2061 // options in Safari work properly
2062 if ( elem.parentNode ) {
2063 elem.parentNode.selectedIndex;
2064 }
2065
2066 return elem.selected === true;
2067 },
2068
2069 // Contents
2070 "empty": function( elem ) {
2071 // http://www.w3.org/TR/selectors/#empty-pseudo
2072 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2073 // but not by others (comment: 8; processing instruction: 7; etc.)
2074 // nodeType < 6 works because attributes (2) do not appear as children
2075 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2076 if ( elem.nodeType < 6 ) {
2077 return false;
2078 }
2079 }
2080 return true;
2081 },
2082
2083 "parent": function( elem ) {
2084 return !Expr.pseudos["empty"]( elem );
2085 },
2086
2087 // Element/input types
2088 "header": function( elem ) {
2089 return rheader.test( elem.nodeName );
2090 },
2091
2092 "input": function( elem ) {
2093 return rinputs.test( elem.nodeName );
2094 },
2095
2096 "button": function( elem ) {
2097 var name = elem.nodeName.toLowerCase();
2098 return name === "input" && elem.type === "button" || name === "button";
2099 },
2100
2101 "text": function( elem ) {
2102 var attr;
2103 return elem.nodeName.toLowerCase() === "input" &&
2104 elem.type === "text" &&
2105
2106 // Support: IE<8
2107 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2108 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2109 },
2110
2111 // Position-in-collection
2112 "first": createPositionalPseudo(function() {
2113 return [ 0 ];
2114 }),
2115
2116 "last": createPositionalPseudo(function( matchIndexes, length ) {
2117 return [ length - 1 ];
2118 }),
2119
2120 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2121 return [ argument < 0 ? argument + length : argument ];
2122 }),
2123
2124 "even": createPositionalPseudo(function( matchIndexes, length ) {
2125 var i = 0;
2126 for ( ; i < length; i += 2 ) {
2127 matchIndexes.push( i );
2128 }
2129 return matchIndexes;
2130 }),
2131
2132 "odd": createPositionalPseudo(function( matchIndexes, length ) {
2133 var i = 1;
2134 for ( ; i < length; i += 2 ) {
2135 matchIndexes.push( i );
2136 }
2137 return matchIndexes;
2138 }),
2139
2140 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2141 var i = argument < 0 ? argument + length : argument;
2142 for ( ; --i >= 0; ) {
2143 matchIndexes.push( i );
2144 }
2145 return matchIndexes;
2146 }),
2147
2148 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2149 var i = argument < 0 ? argument + length : argument;
2150 for ( ; ++i < length; ) {
2151 matchIndexes.push( i );
2152 }
2153 return matchIndexes;
2154 })
2155 }
2156};
2157
2158Expr.pseudos["nth"] = Expr.pseudos["eq"];
2159
2160// Add button/input type pseudos
2161for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2162 Expr.pseudos[ i ] = createInputPseudo( i );
2163}
2164for ( i in { submit: true, reset: true } ) {
2165 Expr.pseudos[ i ] = createButtonPseudo( i );
2166}
2167
2168// Easy API for creating new setFilters
2169function setFilters() {}
2170setFilters.prototype = Expr.filters = Expr.pseudos;
2171Expr.setFilters = new setFilters();
2172
2173tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2174 var matched, match, tokens, type,
2175 soFar, groups, preFilters,
2176 cached = tokenCache[ selector + " " ];
2177
2178 if ( cached ) {
2179 return parseOnly ? 0 : cached.slice( 0 );
2180 }
2181
2182 soFar = selector;
2183 groups = [];
2184 preFilters = Expr.preFilter;
2185
2186 while ( soFar ) {
2187
2188 // Comma and first run
2189 if ( !matched || (match = rcomma.exec( soFar )) ) {
2190 if ( match ) {
2191 // Don't consume trailing commas as valid
2192 soFar = soFar.slice( match[0].length ) || soFar;
2193 }
2194 groups.push( (tokens = []) );
2195 }
2196
2197 matched = false;
2198
2199 // Combinators
2200 if ( (match = rcombinators.exec( soFar )) ) {
2201 matched = match.shift();
2202 tokens.push({
2203 value: matched,
2204 // Cast descendant combinators to space
2205 type: match[0].replace( rtrim, " " )
2206 });
2207 soFar = soFar.slice( matched.length );
2208 }
2209
2210 // Filters
2211 for ( type in Expr.filter ) {
2212 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2213 (match = preFilters[ type ]( match ))) ) {
2214 matched = match.shift();
2215 tokens.push({
2216 value: matched,
2217 type: type,
2218 matches: match
2219 });
2220 soFar = soFar.slice( matched.length );
2221 }
2222 }
2223
2224 if ( !matched ) {
2225 break;
2226 }
2227 }
2228
2229 // Return the length of the invalid excess
2230 // if we're just parsing
2231 // Otherwise, throw an error or return tokens
2232 return parseOnly ?
2233 soFar.length :
2234 soFar ?
2235 Sizzle.error( selector ) :
2236 // Cache the tokens
2237 tokenCache( selector, groups ).slice( 0 );
2238};
2239
2240function toSelector( tokens ) {
2241 var i = 0,
2242 len = tokens.length,
2243 selector = "";
2244 for ( ; i < len; i++ ) {
2245 selector += tokens[i].value;
2246 }
2247 return selector;
2248}
2249
2250function addCombinator( matcher, combinator, base ) {
2251 var dir = combinator.dir,
2252 skip = combinator.next,
2253 key = skip || dir,
2254 checkNonElements = base && key === "parentNode",
2255 doneName = done++;
2256
2257 return combinator.first ?
2258 // Check against closest ancestor/preceding element
2259 function( elem, context, xml ) {
2260 while ( (elem = elem[ dir ]) ) {
2261 if ( elem.nodeType === 1 || checkNonElements ) {
2262 return matcher( elem, context, xml );
2263 }
2264 }
2265 return false;
2266 } :
2267
2268 // Check against all ancestor/preceding elements
2269 function( elem, context, xml ) {
2270 var oldCache, uniqueCache, outerCache,
2271 newCache = [ dirruns, doneName ];
2272
2273 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2274 if ( xml ) {
2275 while ( (elem = elem[ dir ]) ) {
2276 if ( elem.nodeType === 1 || checkNonElements ) {
2277 if ( matcher( elem, context, xml ) ) {
2278 return true;
2279 }
2280 }
2281 }
2282 } else {
2283 while ( (elem = elem[ dir ]) ) {
2284 if ( elem.nodeType === 1 || checkNonElements ) {
2285 outerCache = elem[ expando ] || (elem[ expando ] = {});
2286
2287 // Support: IE <9 only
2288 // Defend against cloned attroperties (jQuery gh-1709)
2289 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
2290
2291 if ( skip && skip === elem.nodeName.toLowerCase() ) {
2292 elem = elem[ dir ] || elem;
2293 } else if ( (oldCache = uniqueCache[ key ]) &&
2294 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2295
2296 // Assign to newCache so results back-propagate to previous elements
2297 return (newCache[ 2 ] = oldCache[ 2 ]);
2298 } else {
2299 // Reuse newcache so results back-propagate to previous elements
2300 uniqueCache[ key ] = newCache;
2301
2302 // A match means we're done; a fail means we have to keep checking
2303 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2304 return true;
2305 }
2306 }
2307 }
2308 }
2309 }
2310 return false;
2311 };
2312}
2313
2314function elementMatcher( matchers ) {
2315 return matchers.length > 1 ?
2316 function( elem, context, xml ) {
2317 var i = matchers.length;
2318 while ( i-- ) {
2319 if ( !matchers[i]( elem, context, xml ) ) {
2320 return false;
2321 }
2322 }
2323 return true;
2324 } :
2325 matchers[0];
2326}
2327
2328function multipleContexts( selector, contexts, results ) {
2329 var i = 0,
2330 len = contexts.length;
2331 for ( ; i < len; i++ ) {
2332 Sizzle( selector, contexts[i], results );
2333 }
2334 return results;
2335}
2336
2337function condense( unmatched, map, filter, context, xml ) {
2338 var elem,
2339 newUnmatched = [],
2340 i = 0,
2341 len = unmatched.length,
2342 mapped = map != null;
2343
2344 for ( ; i < len; i++ ) {
2345 if ( (elem = unmatched[i]) ) {
2346 if ( !filter || filter( elem, context, xml ) ) {
2347 newUnmatched.push( elem );
2348 if ( mapped ) {
2349 map.push( i );
2350 }
2351 }
2352 }
2353 }
2354
2355 return newUnmatched;
2356}
2357
2358function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2359 if ( postFilter && !postFilter[ expando ] ) {
2360 postFilter = setMatcher( postFilter );
2361 }
2362 if ( postFinder && !postFinder[ expando ] ) {
2363 postFinder = setMatcher( postFinder, postSelector );
2364 }
2365 return markFunction(function( seed, results, context, xml ) {
2366 var temp, i, elem,
2367 preMap = [],
2368 postMap = [],
2369 preexisting = results.length,
2370
2371 // Get initial elements from seed or context
2372 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2373
2374 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2375 matcherIn = preFilter && ( seed || !selector ) ?
2376 condense( elems, preMap, preFilter, context, xml ) :
2377 elems,
2378
2379 matcherOut = matcher ?
2380 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2381 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2382
2383 // ...intermediate processing is necessary
2384 [] :
2385
2386 // ...otherwise use results directly
2387 results :
2388 matcherIn;
2389
2390 // Find primary matches
2391 if ( matcher ) {
2392 matcher( matcherIn, matcherOut, context, xml );
2393 }
2394
2395 // Apply postFilter
2396 if ( postFilter ) {
2397 temp = condense( matcherOut, postMap );
2398 postFilter( temp, [], context, xml );
2399
2400 // Un-match failing elements by moving them back to matcherIn
2401 i = temp.length;
2402 while ( i-- ) {
2403 if ( (elem = temp[i]) ) {
2404 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2405 }
2406 }
2407 }
2408
2409 if ( seed ) {
2410 if ( postFinder || preFilter ) {
2411 if ( postFinder ) {
2412 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2413 temp = [];
2414 i = matcherOut.length;
2415 while ( i-- ) {
2416 if ( (elem = matcherOut[i]) ) {
2417 // Restore matcherIn since elem is not yet a final match
2418 temp.push( (matcherIn[i] = elem) );
2419 }
2420 }
2421 postFinder( null, (matcherOut = []), temp, xml );
2422 }
2423
2424 // Move matched elements from seed to results to keep them synchronized
2425 i = matcherOut.length;
2426 while ( i-- ) {
2427 if ( (elem = matcherOut[i]) &&
2428 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2429
2430 seed[temp] = !(results[temp] = elem);
2431 }
2432 }
2433 }
2434
2435 // Add elements to results, through postFinder if defined
2436 } else {
2437 matcherOut = condense(
2438 matcherOut === results ?
2439 matcherOut.splice( preexisting, matcherOut.length ) :
2440 matcherOut
2441 );
2442 if ( postFinder ) {
2443 postFinder( null, results, matcherOut, xml );
2444 } else {
2445 push.apply( results, matcherOut );
2446 }
2447 }
2448 });
2449}
2450
2451function matcherFromTokens( tokens ) {
2452 var checkContext, matcher, j,
2453 len = tokens.length,
2454 leadingRelative = Expr.relative[ tokens[0].type ],
2455 implicitRelative = leadingRelative || Expr.relative[" "],
2456 i = leadingRelative ? 1 : 0,
2457
2458 // The foundational matcher ensures that elements are reachable from top-level context(s)
2459 matchContext = addCombinator( function( elem ) {
2460 return elem === checkContext;
2461 }, implicitRelative, true ),
2462 matchAnyContext = addCombinator( function( elem ) {
2463 return indexOf( checkContext, elem ) > -1;
2464 }, implicitRelative, true ),
2465 matchers = [ function( elem, context, xml ) {
2466 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2467 (checkContext = context).nodeType ?
2468 matchContext( elem, context, xml ) :
2469 matchAnyContext( elem, context, xml ) );
2470 // Avoid hanging onto element (issue #299)
2471 checkContext = null;
2472 return ret;
2473 } ];
2474
2475 for ( ; i < len; i++ ) {
2476 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2477 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2478 } else {
2479 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2480
2481 // Return special upon seeing a positional matcher
2482 if ( matcher[ expando ] ) {
2483 // Find the next relative operator (if any) for proper handling
2484 j = ++i;
2485 for ( ; j < len; j++ ) {
2486 if ( Expr.relative[ tokens[j].type ] ) {
2487 break;
2488 }
2489 }
2490 return setMatcher(
2491 i > 1 && elementMatcher( matchers ),
2492 i > 1 && toSelector(
2493 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2494 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2495 ).replace( rtrim, "$1" ),
2496 matcher,
2497 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2498 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2499 j < len && toSelector( tokens )
2500 );
2501 }
2502 matchers.push( matcher );
2503 }
2504 }
2505
2506 return elementMatcher( matchers );
2507}
2508
2509function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2510 var bySet = setMatchers.length > 0,
2511 byElement = elementMatchers.length > 0,
2512 superMatcher = function( seed, context, xml, results, outermost ) {
2513 var elem, j, matcher,
2514 matchedCount = 0,
2515 i = "0",
2516 unmatched = seed && [],
2517 setMatched = [],
2518 contextBackup = outermostContext,
2519 // We must always have either seed elements or outermost context
2520 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2521 // Use integer dirruns iff this is the outermost matcher
2522 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2523 len = elems.length;
2524
2525 if ( outermost ) {
2526 outermostContext = context === document || context || outermost;
2527 }
2528
2529 // Add elements passing elementMatchers directly to results
2530 // Support: IE<9, Safari
2531 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2532 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2533 if ( byElement && elem ) {
2534 j = 0;
2535 if ( !context && elem.ownerDocument !== document ) {
2536 setDocument( elem );
2537 xml = !documentIsHTML;
2538 }
2539 while ( (matcher = elementMatchers[j++]) ) {
2540 if ( matcher( elem, context || document, xml) ) {
2541 results.push( elem );
2542 break;
2543 }
2544 }
2545 if ( outermost ) {
2546 dirruns = dirrunsUnique;
2547 }
2548 }
2549
2550 // Track unmatched elements for set filters
2551 if ( bySet ) {
2552 // They will have gone through all possible matchers
2553 if ( (elem = !matcher && elem) ) {
2554 matchedCount--;
2555 }
2556
2557 // Lengthen the array for every element, matched or not
2558 if ( seed ) {
2559 unmatched.push( elem );
2560 }
2561 }
2562 }
2563
2564 // `i` is now the count of elements visited above, and adding it to `matchedCount`
2565 // makes the latter nonnegative.
2566 matchedCount += i;
2567
2568 // Apply set filters to unmatched elements
2569 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2570 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2571 // no element matchers and no seed.
2572 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2573 // case, which will result in a "00" `matchedCount` that differs from `i` but is also
2574 // numerically zero.
2575 if ( bySet && i !== matchedCount ) {
2576 j = 0;
2577 while ( (matcher = setMatchers[j++]) ) {
2578 matcher( unmatched, setMatched, context, xml );
2579 }
2580
2581 if ( seed ) {
2582 // Reintegrate element matches to eliminate the need for sorting
2583 if ( matchedCount > 0 ) {
2584 while ( i-- ) {
2585 if ( !(unmatched[i] || setMatched[i]) ) {
2586 setMatched[i] = pop.call( results );
2587 }
2588 }
2589 }
2590
2591 // Discard index placeholder values to get only actual matches
2592 setMatched = condense( setMatched );
2593 }
2594
2595 // Add matches to results
2596 push.apply( results, setMatched );
2597
2598 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2599 if ( outermost && !seed && setMatched.length > 0 &&
2600 ( matchedCount + setMatchers.length ) > 1 ) {
2601
2602 Sizzle.uniqueSort( results );
2603 }
2604 }
2605
2606 // Override manipulation of globals by nested matchers
2607 if ( outermost ) {
2608 dirruns = dirrunsUnique;
2609 outermostContext = contextBackup;
2610 }
2611
2612 return unmatched;
2613 };
2614
2615 return bySet ?
2616 markFunction( superMatcher ) :
2617 superMatcher;
2618}
2619
2620compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2621 var i,
2622 setMatchers = [],
2623 elementMatchers = [],
2624 cached = compilerCache[ selector + " " ];
2625
2626 if ( !cached ) {
2627 // Generate a function of recursive functions that can be used to check each element
2628 if ( !match ) {
2629 match = tokenize( selector );
2630 }
2631 i = match.length;
2632 while ( i-- ) {
2633 cached = matcherFromTokens( match[i] );
2634 if ( cached[ expando ] ) {
2635 setMatchers.push( cached );
2636 } else {
2637 elementMatchers.push( cached );
2638 }
2639 }
2640
2641 // Cache the compiled function
2642 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2643
2644 // Save selector and tokenization
2645 cached.selector = selector;
2646 }
2647 return cached;
2648};
2649
2650/**
2651 * A low-level selection function that works with Sizzle's compiled
2652 * selector functions
2653 * @param {String|Function} selector A selector or a pre-compiled
2654 * selector function built with Sizzle.compile
2655 * @param {Element} context
2656 * @param {Array} [results]
2657 * @param {Array} [seed] A set of elements to match against
2658 */
2659select = Sizzle.select = function( selector, context, results, seed ) {
2660 var i, tokens, token, type, find,
2661 compiled = typeof selector === "function" && selector,
2662 match = !seed && tokenize( (selector = compiled.selector || selector) );
2663
2664 results = results || [];
2665
2666 // Try to minimize operations if there is only one selector in the list and no seed
2667 // (the latter of which guarantees us context)
2668 if ( match.length === 1 ) {
2669
2670 // Reduce context if the leading compound selector is an ID
2671 tokens = match[0] = match[0].slice( 0 );
2672 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2673 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
2674
2675 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2676 if ( !context ) {
2677 return results;
2678
2679 // Precompiled matchers will still verify ancestry, so step up a level
2680 } else if ( compiled ) {
2681 context = context.parentNode;
2682 }
2683
2684 selector = selector.slice( tokens.shift().value.length );
2685 }
2686
2687 // Fetch a seed set for right-to-left matching
2688 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2689 while ( i-- ) {
2690 token = tokens[i];
2691
2692 // Abort if we hit a combinator
2693 if ( Expr.relative[ (type = token.type) ] ) {
2694 break;
2695 }
2696 if ( (find = Expr.find[ type ]) ) {
2697 // Search, expanding context for leading sibling combinators
2698 if ( (seed = find(
2699 token.matches[0].replace( runescape, funescape ),
2700 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2701 )) ) {
2702
2703 // If seed is empty or no tokens remain, we can return early
2704 tokens.splice( i, 1 );
2705 selector = seed.length && toSelector( tokens );
2706 if ( !selector ) {
2707 push.apply( results, seed );
2708 return results;
2709 }
2710
2711 break;
2712 }
2713 }
2714 }
2715 }
2716
2717 // Compile and execute a filtering function if one is not provided
2718 // Provide `match` to avoid retokenization if we modified the selector above
2719 ( compiled || compile( selector, match ) )(
2720 seed,
2721 context,
2722 !documentIsHTML,
2723 results,
2724 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2725 );
2726 return results;
2727};
2728
2729// One-time assignments
2730
2731// Sort stability
2732support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2733
2734// Support: Chrome 14-35+
2735// Always assume duplicates if they aren't passed to the comparison function
2736support.detectDuplicates = !!hasDuplicate;
2737
2738// Initialize against the default document
2739setDocument();
2740
2741// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2742// Detached nodes confoundingly follow *each other*
2743support.sortDetached = assert(function( el ) {
2744 // Should return 1, but returns 4 (following)
2745 return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
2746});
2747
2748// Support: IE<8
2749// Prevent attribute/property "interpolation"
2750// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2751if ( !assert(function( el ) {
2752 el.innerHTML = "<a href='#'></a>";
2753 return el.firstChild.getAttribute("href") === "#" ;
2754}) ) {
2755 addHandle( "type|href|height|width", function( elem, name, isXML ) {
2756 if ( !isXML ) {
2757 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2758 }
2759 });
2760}
2761
2762// Support: IE<9
2763// Use defaultValue in place of getAttribute("value")
2764if ( !support.attributes || !assert(function( el ) {
2765 el.innerHTML = "<input/>";
2766 el.firstChild.setAttribute( "value", "" );
2767 return el.firstChild.getAttribute( "value" ) === "";
2768}) ) {
2769 addHandle( "value", function( elem, name, isXML ) {
2770 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2771 return elem.defaultValue;
2772 }
2773 });
2774}
2775
2776// Support: IE<9
2777// Use getAttributeNode to fetch booleans when getAttribute lies
2778if ( !assert(function( el ) {
2779 return el.getAttribute("disabled") == null;
2780}) ) {
2781 addHandle( booleans, function( elem, name, isXML ) {
2782 var val;
2783 if ( !isXML ) {
2784 return elem[ name ] === true ? name.toLowerCase() :
2785 (val = elem.getAttributeNode( name )) && val.specified ?
2786 val.value :
2787 null;
2788 }
2789 });
2790}
2791
2792return Sizzle;
2793
2794})( window );
2795
2796
2797
2798jQuery.find = Sizzle;
2799jQuery.expr = Sizzle.selectors;
2800
2801// Deprecated
2802jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2803jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
2804jQuery.text = Sizzle.getText;
2805jQuery.isXMLDoc = Sizzle.isXML;
2806jQuery.contains = Sizzle.contains;
2807jQuery.escapeSelector = Sizzle.escape;
2808
2809
2810
2811
2812var dir = function( elem, dir, until ) {
2813 var matched = [],
2814 truncate = until !== undefined;
2815
2816 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2817 if ( elem.nodeType === 1 ) {
2818 if ( truncate && jQuery( elem ).is( until ) ) {
2819 break;
2820 }
2821 matched.push( elem );
2822 }
2823 }
2824 return matched;
2825};
2826
2827
2828var siblings = function( n, elem ) {
2829 var matched = [];
2830
2831 for ( ; n; n = n.nextSibling ) {
2832 if ( n.nodeType === 1 && n !== elem ) {
2833 matched.push( n );
2834 }
2835 }
2836
2837 return matched;
2838};
2839
2840
2841var rneedsContext = jQuery.expr.match.needsContext;
2842
2843
2844
2845function nodeName( elem, name ) {
2846
2847 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
2848
2849};
2850var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
2851
2852
2853
2854var risSimple = /^.[^:#\[\.,]*$/;
2855
2856// Implement the identical functionality for filter and not
2857function winnow( elements, qualifier, not ) {
2858 if ( jQuery.isFunction( qualifier ) ) {
2859 return jQuery.grep( elements, function( elem, i ) {
2860 return !!qualifier.call( elem, i, elem ) !== not;
2861 } );
2862 }
2863
2864 // Single element
2865 if ( qualifier.nodeType ) {
2866 return jQuery.grep( elements, function( elem ) {
2867 return ( elem === qualifier ) !== not;
2868 } );
2869 }
2870
2871 // Arraylike of elements (jQuery, arguments, Array)
2872 if ( typeof qualifier !== "string" ) {
2873 return jQuery.grep( elements, function( elem ) {
2874 return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
2875 } );
2876 }
2877
2878 // Simple selector that can be filtered directly, removing non-Elements
2879 if ( risSimple.test( qualifier ) ) {
2880 return jQuery.filter( qualifier, elements, not );
2881 }
2882
2883 // Complex selector, compare the two sets, removing non-Elements
2884 qualifier = jQuery.filter( qualifier, elements );
2885 return jQuery.grep( elements, function( elem ) {
2886 return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
2887 } );
2888}
2889
2890jQuery.filter = function( expr, elems, not ) {
2891 var elem = elems[ 0 ];
2892
2893 if ( not ) {
2894 expr = ":not(" + expr + ")";
2895 }
2896
2897 if ( elems.length === 1 && elem.nodeType === 1 ) {
2898 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
2899 }
2900
2901 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2902 return elem.nodeType === 1;
2903 } ) );
2904};
2905
2906jQuery.fn.extend( {
2907 find: function( selector ) {
2908 var i, ret,
2909 len = this.length,
2910 self = this;
2911
2912 if ( typeof selector !== "string" ) {
2913 return this.pushStack( jQuery( selector ).filter( function() {
2914 for ( i = 0; i < len; i++ ) {
2915 if ( jQuery.contains( self[ i ], this ) ) {
2916 return true;
2917 }
2918 }
2919 } ) );
2920 }
2921
2922 ret = this.pushStack( [] );
2923
2924 for ( i = 0; i < len; i++ ) {
2925 jQuery.find( selector, self[ i ], ret );
2926 }
2927
2928 return len > 1 ? jQuery.uniqueSort( ret ) : ret;
2929 },
2930 filter: function( selector ) {
2931 return this.pushStack( winnow( this, selector || [], false ) );
2932 },
2933 not: function( selector ) {
2934 return this.pushStack( winnow( this, selector || [], true ) );
2935 },
2936 is: function( selector ) {
2937 return !!winnow(
2938 this,
2939
2940 // If this is a positional/relative selector, check membership in the returned set
2941 // so $("p:first").is("p:last") won't return true for a doc with two "p".
2942 typeof selector === "string" && rneedsContext.test( selector ) ?
2943 jQuery( selector ) :
2944 selector || [],
2945 false
2946 ).length;
2947 }
2948} );
2949
2950
2951// Initialize a jQuery object
2952
2953
2954// A central reference to the root jQuery(document)
2955var rootjQuery,
2956
2957 // A simple way to check for HTML strings
2958 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2959 // Strict HTML recognition (#11290: must start with <)
2960 // Shortcut simple #id case for speed
2961 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
2962
2963 init = jQuery.fn.init = function( selector, context, root ) {
2964 var match, elem;
2965
2966 // HANDLE: $(""), $(null), $(undefined), $(false)
2967 if ( !selector ) {
2968 return this;
2969 }
2970
2971 // Method init() accepts an alternate rootjQuery
2972 // so migrate can support jQuery.sub (gh-2101)
2973 root = root || rootjQuery;
2974
2975 // Handle HTML strings
2976 if ( typeof selector === "string" ) {
2977 if ( selector[ 0 ] === "<" &&
2978 selector[ selector.length - 1 ] === ">" &&
2979 selector.length >= 3 ) {
2980
2981 // Assume that strings that start and end with <> are HTML and skip the regex check
2982 match = [ null, selector, null ];
2983
2984 } else {
2985 match = rquickExpr.exec( selector );
2986 }
2987
2988 // Match html or make sure no context is specified for #id
2989 if ( match && ( match[ 1 ] || !context ) ) {
2990
2991 // HANDLE: $(html) -> $(array)
2992 if ( match[ 1 ] ) {
2993 context = context instanceof jQuery ? context[ 0 ] : context;
2994
2995 // Option to run scripts is true for back-compat
2996 // Intentionally let the error be thrown if parseHTML is not present
2997 jQuery.merge( this, jQuery.parseHTML(
2998 match[ 1 ],
2999 context && context.nodeType ? context.ownerDocument || context : document,
3000 true
3001 ) );
3002
3003 // HANDLE: $(html, props)
3004 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
3005 for ( match in context ) {
3006
3007 // Properties of context are called as methods if possible
3008 if ( jQuery.isFunction( this[ match ] ) ) {
3009 this[ match ]( context[ match ] );
3010
3011 // ...and otherwise set as attributes
3012 } else {
3013 this.attr( match, context[ match ] );
3014 }
3015 }
3016 }
3017
3018 return this;
3019
3020 // HANDLE: $(#id)
3021 } else {
3022 elem = document.getElementById( match[ 2 ] );
3023
3024 if ( elem ) {
3025
3026 // Inject the element directly into the jQuery object
3027 this[ 0 ] = elem;
3028 this.length = 1;
3029 }
3030 return this;
3031 }
3032
3033 // HANDLE: $(expr, $(...))
3034 } else if ( !context || context.jquery ) {
3035 return ( context || root ).find( selector );
3036
3037 // HANDLE: $(expr, context)
3038 // (which is just equivalent to: $(context).find(expr)
3039 } else {
3040 return this.constructor( context ).find( selector );
3041 }
3042
3043 // HANDLE: $(DOMElement)
3044 } else if ( selector.nodeType ) {
3045 this[ 0 ] = selector;
3046 this.length = 1;
3047 return this;
3048
3049 // HANDLE: $(function)
3050 // Shortcut for document ready
3051 } else if ( jQuery.isFunction( selector ) ) {
3052 return root.ready !== undefined ?
3053 root.ready( selector ) :
3054
3055 // Execute immediately if ready is not present
3056 selector( jQuery );
3057 }
3058
3059 return jQuery.makeArray( selector, this );
3060 };
3061
3062// Give the init function the jQuery prototype for later instantiation
3063init.prototype = jQuery.fn;
3064
3065// Initialize central reference
3066rootjQuery = jQuery( document );
3067
3068
3069var rparentsprev = /^(?:parents|prev(?:Until|All))/,
3070
3071 // Methods guaranteed to produce a unique set when starting from a unique set
3072 guaranteedUnique = {
3073 children: true,
3074 contents: true,
3075 next: true,
3076 prev: true
3077 };
3078
3079jQuery.fn.extend( {
3080 has: function( target ) {
3081 var targets = jQuery( target, this ),
3082 l = targets.length;
3083
3084 return this.filter( function() {
3085 var i = 0;
3086 for ( ; i < l; i++ ) {
3087 if ( jQuery.contains( this, targets[ i ] ) ) {
3088 return true;
3089 }
3090 }
3091 } );
3092 },
3093
3094 closest: function( selectors, context ) {
3095 var cur,
3096 i = 0,
3097 l = this.length,
3098 matched = [],
3099 targets = typeof selectors !== "string" && jQuery( selectors );
3100
3101 // Positional selectors never match, since there's no _selection_ context
3102 if ( !rneedsContext.test( selectors ) ) {
3103 for ( ; i < l; i++ ) {
3104 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
3105
3106 // Always skip document fragments
3107 if ( cur.nodeType < 11 && ( targets ?
3108 targets.index( cur ) > -1 :
3109
3110 // Don't pass non-elements to Sizzle
3111 cur.nodeType === 1 &&
3112 jQuery.find.matchesSelector( cur, selectors ) ) ) {
3113
3114 matched.push( cur );
3115 break;
3116 }
3117 }
3118 }
3119 }
3120
3121 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
3122 },
3123
3124 // Determine the position of an element within the set
3125 index: function( elem ) {
3126
3127 // No argument, return index in parent
3128 if ( !elem ) {
3129 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
3130 }
3131
3132 // Index in selector
3133 if ( typeof elem === "string" ) {
3134 return indexOf.call( jQuery( elem ), this[ 0 ] );
3135 }
3136
3137 // Locate the position of the desired element
3138 return indexOf.call( this,
3139
3140 // If it receives a jQuery object, the first element is used
3141 elem.jquery ? elem[ 0 ] : elem
3142 );
3143 },
3144
3145 add: function( selector, context ) {
3146 return this.pushStack(
3147 jQuery.uniqueSort(
3148 jQuery.merge( this.get(), jQuery( selector, context ) )
3149 )
3150 );
3151 },
3152
3153 addBack: function( selector ) {
3154 return this.add( selector == null ?
3155 this.prevObject : this.prevObject.filter( selector )
3156 );
3157 }
3158} );
3159
3160function sibling( cur, dir ) {
3161 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
3162 return cur;
3163}
3164
3165jQuery.each( {
3166 parent: function( elem ) {
3167 var parent = elem.parentNode;
3168 return parent && parent.nodeType !== 11 ? parent : null;
3169 },
3170 parents: function( elem ) {
3171 return dir( elem, "parentNode" );
3172 },
3173 parentsUntil: function( elem, i, until ) {
3174 return dir( elem, "parentNode", until );
3175 },
3176 next: function( elem ) {
3177 return sibling( elem, "nextSibling" );
3178 },
3179 prev: function( elem ) {
3180 return sibling( elem, "previousSibling" );
3181 },
3182 nextAll: function( elem ) {
3183 return dir( elem, "nextSibling" );
3184 },
3185 prevAll: function( elem ) {
3186 return dir( elem, "previousSibling" );
3187 },
3188 nextUntil: function( elem, i, until ) {
3189 return dir( elem, "nextSibling", until );
3190 },
3191 prevUntil: function( elem, i, until ) {
3192 return dir( elem, "previousSibling", until );
3193 },
3194 siblings: function( elem ) {
3195 return siblings( ( elem.parentNode || {} ).firstChild, elem );
3196 },
3197 children: function( elem ) {
3198 return siblings( elem.firstChild );
3199 },
3200 contents: function( elem ) {
3201 if ( nodeName( elem, "iframe" ) ) {
3202 return elem.contentDocument;
3203 }
3204
3205 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
3206 // Treat the template element as a regular one in browsers that
3207 // don't support it.
3208 if ( nodeName( elem, "template" ) ) {
3209 elem = elem.content || elem;
3210 }
3211
3212 return jQuery.merge( [], elem.childNodes );
3213 }
3214}, function( name, fn ) {
3215 jQuery.fn[ name ] = function( until, selector ) {
3216 var matched = jQuery.map( this, fn, until );
3217
3218 if ( name.slice( -5 ) !== "Until" ) {
3219 selector = until;
3220 }
3221
3222 if ( selector && typeof selector === "string" ) {
3223 matched = jQuery.filter( selector, matched );
3224 }
3225
3226 if ( this.length > 1 ) {
3227
3228 // Remove duplicates
3229 if ( !guaranteedUnique[ name ] ) {
3230 jQuery.uniqueSort( matched );
3231 }
3232
3233 // Reverse order for parents* and prev-derivatives
3234 if ( rparentsprev.test( name ) ) {
3235 matched.reverse();
3236 }
3237 }
3238
3239 return this.pushStack( matched );
3240 };
3241} );
3242var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
3243
3244
3245
3246// Convert String-formatted options into Object-formatted ones
3247function createOptions( options ) {
3248 var object = {};
3249 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
3250 object[ flag ] = true;
3251 } );
3252 return object;
3253}
3254
3255/*
3256 * Create a callback list using the following parameters:
3257 *
3258 * options: an optional list of space-separated options that will change how
3259 * the callback list behaves or a more traditional option object
3260 *
3261 * By default a callback list will act like an event callback list and can be
3262 * "fired" multiple times.
3263 *
3264 * Possible options:
3265 *
3266 * once: will ensure the callback list can only be fired once (like a Deferred)
3267 *
3268 * memory: will keep track of previous values and will call any callback added
3269 * after the list has been fired right away with the latest "memorized"
3270 * values (like a Deferred)
3271 *
3272 * unique: will ensure a callback can only be added once (no duplicate in the list)
3273 *
3274 * stopOnFalse: interrupt callings when a callback returns false
3275 *
3276 */
3277jQuery.Callbacks = function( options ) {
3278
3279 // Convert options from String-formatted to Object-formatted if needed
3280 // (we check in cache first)
3281 options = typeof options === "string" ?
3282 createOptions( options ) :
3283 jQuery.extend( {}, options );
3284
3285 var // Flag to know if list is currently firing
3286 firing,
3287
3288 // Last fire value for non-forgettable lists
3289 memory,
3290
3291 // Flag to know if list was already fired
3292 fired,
3293
3294 // Flag to prevent firing
3295 locked,
3296
3297 // Actual callback list
3298 list = [],
3299
3300 // Queue of execution data for repeatable lists
3301 queue = [],
3302
3303 // Index of currently firing callback (modified by add/remove as needed)
3304 firingIndex = -1,
3305
3306 // Fire callbacks
3307 fire = function() {
3308
3309 // Enforce single-firing
3310 locked = locked || options.once;
3311
3312 // Execute callbacks for all pending executions,
3313 // respecting firingIndex overrides and runtime changes
3314 fired = firing = true;
3315 for ( ; queue.length; firingIndex = -1 ) {
3316 memory = queue.shift();
3317 while ( ++firingIndex < list.length ) {
3318
3319 // Run callback and check for early termination
3320 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
3321 options.stopOnFalse ) {
3322
3323 // Jump to end and forget the data so .add doesn't re-fire
3324 firingIndex = list.length;
3325 memory = false;
3326 }
3327 }
3328 }
3329
3330 // Forget the data if we're done with it
3331 if ( !options.memory ) {
3332 memory = false;
3333 }
3334
3335 firing = false;
3336
3337 // Clean up if we're done firing for good
3338 if ( locked ) {
3339
3340 // Keep an empty list if we have data for future add calls
3341 if ( memory ) {
3342 list = [];
3343
3344 // Otherwise, this object is spent
3345 } else {
3346 list = "";
3347 }
3348 }
3349 },
3350
3351 // Actual Callbacks object
3352 self = {
3353
3354 // Add a callback or a collection of callbacks to the list
3355 add: function() {
3356 if ( list ) {
3357
3358 // If we have memory from a past run, we should fire after adding
3359 if ( memory && !firing ) {
3360 firingIndex = list.length - 1;
3361 queue.push( memory );
3362 }
3363
3364 ( function add( args ) {
3365 jQuery.each( args, function( _, arg ) {
3366 if ( jQuery.isFunction( arg ) ) {
3367 if ( !options.unique || !self.has( arg ) ) {
3368 list.push( arg );
3369 }
3370 } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
3371
3372 // Inspect recursively
3373 add( arg );
3374 }
3375 } );
3376 } )( arguments );
3377
3378 if ( memory && !firing ) {
3379 fire();
3380 }
3381 }
3382 return this;
3383 },
3384
3385 // Remove a callback from the list
3386 remove: function() {
3387 jQuery.each( arguments, function( _, arg ) {
3388 var index;
3389 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3390 list.splice( index, 1 );
3391
3392 // Handle firing indexes
3393 if ( index <= firingIndex ) {
3394 firingIndex--;
3395 }
3396 }
3397 } );
3398 return this;
3399 },
3400
3401 // Check if a given callback is in the list.
3402 // If no argument is given, return whether or not list has callbacks attached.
3403 has: function( fn ) {
3404 return fn ?
3405 jQuery.inArray( fn, list ) > -1 :
3406 list.length > 0;
3407 },
3408
3409 // Remove all callbacks from the list
3410 empty: function() {
3411 if ( list ) {
3412 list = [];
3413 }
3414 return this;
3415 },
3416
3417 // Disable .fire and .add
3418 // Abort any current/pending executions
3419 // Clear all callbacks and values
3420 disable: function() {
3421 locked = queue = [];
3422 list = memory = "";
3423 return this;
3424 },
3425 disabled: function() {
3426 return !list;
3427 },
3428
3429 // Disable .fire
3430 // Also disable .add unless we have memory (since it would have no effect)
3431 // Abort any pending executions
3432 lock: function() {
3433 locked = queue = [];
3434 if ( !memory && !firing ) {
3435 list = memory = "";
3436 }
3437 return this;
3438 },
3439 locked: function() {
3440 return !!locked;
3441 },
3442
3443 // Call all callbacks with the given context and arguments
3444 fireWith: function( context, args ) {
3445 if ( !locked ) {
3446 args = args || [];
3447 args = [ context, args.slice ? args.slice() : args ];
3448 queue.push( args );
3449 if ( !firing ) {
3450 fire();
3451 }
3452 }
3453 return this;
3454 },
3455
3456 // Call all the callbacks with the given arguments
3457 fire: function() {
3458 self.fireWith( this, arguments );
3459 return this;
3460 },
3461
3462 // To know if the callbacks have already been called at least once
3463 fired: function() {
3464 return !!fired;
3465 }
3466 };
3467
3468 return self;
3469};
3470
3471
3472function Identity( v ) {
3473 return v;
3474}
3475function Thrower( ex ) {
3476 throw ex;
3477}
3478
3479function adoptValue( value, resolve, reject, noValue ) {
3480 var method;
3481
3482 try {
3483
3484 // Check for promise aspect first to privilege synchronous behavior
3485 if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
3486 method.call( value ).done( resolve ).fail( reject );
3487
3488 // Other thenables
3489 } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
3490 method.call( value, resolve, reject );
3491
3492 // Other non-thenables
3493 } else {
3494
3495 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
3496 // * false: [ value ].slice( 0 ) => resolve( value )
3497 // * true: [ value ].slice( 1 ) => resolve()
3498 resolve.apply( undefined, [ value ].slice( noValue ) );
3499 }
3500
3501 // For Promises/A+, convert exceptions into rejections
3502 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
3503 // Deferred#then to conditionally suppress rejection.
3504 } catch ( value ) {
3505
3506 // Support: Android 4.0 only
3507 // Strict mode functions invoked without .call/.apply get global-object context
3508 reject.apply( undefined, [ value ] );
3509 }
3510}
3511
3512jQuery.extend( {
3513
3514 Deferred: function( func ) {
3515 var tuples = [
3516
3517 // action, add listener, callbacks,
3518 // ... .then handlers, argument index, [final state]
3519 [ "notify", "progress", jQuery.Callbacks( "memory" ),
3520 jQuery.Callbacks( "memory" ), 2 ],
3521 [ "resolve", "done", jQuery.Callbacks( "once memory" ),
3522 jQuery.Callbacks( "once memory" ), 0, "resolved" ],
3523 [ "reject", "fail", jQuery.Callbacks( "once memory" ),
3524 jQuery.Callbacks( "once memory" ), 1, "rejected" ]
3525 ],
3526 state = "pending",
3527 promise = {
3528 state: function() {
3529 return state;
3530 },
3531 always: function() {
3532 deferred.done( arguments ).fail( arguments );
3533 return this;
3534 },
3535 "catch": function( fn ) {
3536 return promise.then( null, fn );
3537 },
3538
3539 // Keep pipe for back-compat
3540 pipe: function( /* fnDone, fnFail, fnProgress */ ) {
3541 var fns = arguments;
3542
3543 return jQuery.Deferred( function( newDefer ) {
3544 jQuery.each( tuples, function( i, tuple ) {
3545
3546 // Map tuples (progress, done, fail) to arguments (done, fail, progress)
3547 var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
3548
3549 // deferred.progress(function() { bind to newDefer or newDefer.notify })
3550 // deferred.done(function() { bind to newDefer or newDefer.resolve })
3551 // deferred.fail(function() { bind to newDefer or newDefer.reject })
3552 deferred[ tuple[ 1 ] ]( function() {
3553 var returned = fn && fn.apply( this, arguments );
3554 if ( returned && jQuery.isFunction( returned.promise ) ) {
3555 returned.promise()
3556 .progress( newDefer.notify )
3557 .done( newDefer.resolve )
3558 .fail( newDefer.reject );
3559 } else {
3560 newDefer[ tuple[ 0 ] + "With" ](
3561 this,
3562 fn ? [ returned ] : arguments
3563 );
3564 }
3565 } );
3566 } );
3567 fns = null;
3568 } ).promise();
3569 },
3570 then: function( onFulfilled, onRejected, onProgress ) {
3571 var maxDepth = 0;
3572 function resolve( depth, deferred, handler, special ) {
3573 return function() {
3574 var that = this,
3575 args = arguments,
3576 mightThrow = function() {
3577 var returned, then;
3578
3579 // Support: Promises/A+ section 2.3.3.3.3
3580 // https://promisesaplus.com/#point-59
3581 // Ignore double-resolution attempts
3582 if ( depth < maxDepth ) {
3583 return;
3584 }
3585
3586 returned = handler.apply( that, args );
3587
3588 // Support: Promises/A+ section 2.3.1
3589 // https://promisesaplus.com/#point-48
3590 if ( returned === deferred.promise() ) {
3591 throw new TypeError( "Thenable self-resolution" );
3592 }
3593
3594 // Support: Promises/A+ sections 2.3.3.1, 3.5
3595 // https://promisesaplus.com/#point-54
3596 // https://promisesaplus.com/#point-75
3597 // Retrieve `then` only once
3598 then = returned &&
3599
3600 // Support: Promises/A+ section 2.3.4
3601 // https://promisesaplus.com/#point-64
3602 // Only check objects and functions for thenability
3603 ( typeof returned === "object" ||
3604 typeof returned === "function" ) &&
3605 returned.then;
3606
3607 // Handle a returned thenable
3608 if ( jQuery.isFunction( then ) ) {
3609
3610 // Special processors (notify) just wait for resolution
3611 if ( special ) {
3612 then.call(
3613 returned,
3614 resolve( maxDepth, deferred, Identity, special ),
3615 resolve( maxDepth, deferred, Thrower, special )
3616 );
3617
3618 // Normal processors (resolve) also hook into progress
3619 } else {
3620
3621 // ...and disregard older resolution values
3622 maxDepth++;
3623
3624 then.call(
3625 returned,
3626 resolve( maxDepth, deferred, Identity, special ),
3627 resolve( maxDepth, deferred, Thrower, special ),
3628 resolve( maxDepth, deferred, Identity,
3629 deferred.notifyWith )
3630 );
3631 }
3632
3633 // Handle all other returned values
3634 } else {
3635
3636 // Only substitute handlers pass on context
3637 // and multiple values (non-spec behavior)
3638 if ( handler !== Identity ) {
3639 that = undefined;
3640 args = [ returned ];
3641 }
3642
3643 // Process the value(s)
3644 // Default process is resolve
3645 ( special || deferred.resolveWith )( that, args );
3646 }
3647 },
3648
3649 // Only normal processors (resolve) catch and reject exceptions
3650 process = special ?
3651 mightThrow :
3652 function() {
3653 try {
3654 mightThrow();
3655 } catch ( e ) {
3656
3657 if ( jQuery.Deferred.exceptionHook ) {
3658 jQuery.Deferred.exceptionHook( e,
3659 process.stackTrace );
3660 }
3661
3662 // Support: Promises/A+ section 2.3.3.3.4.1
3663 // https://promisesaplus.com/#point-61
3664 // Ignore post-resolution exceptions
3665 if ( depth + 1 >= maxDepth ) {
3666
3667 // Only substitute handlers pass on context
3668 // and multiple values (non-spec behavior)
3669 if ( handler !== Thrower ) {
3670 that = undefined;
3671 args = [ e ];
3672 }
3673
3674 deferred.rejectWith( that, args );
3675 }
3676 }
3677 };
3678
3679 // Support: Promises/A+ section 2.3.3.3.1
3680 // https://promisesaplus.com/#point-57
3681 // Re-resolve promises immediately to dodge false rejection from
3682 // subsequent errors
3683 if ( depth ) {
3684 process();
3685 } else {
3686
3687 // Call an optional hook to record the stack, in case of exception
3688 // since it's otherwise lost when execution goes async
3689 if ( jQuery.Deferred.getStackHook ) {
3690 process.stackTrace = jQuery.Deferred.getStackHook();
3691 }
3692 window.setTimeout( process );
3693 }
3694 };
3695 }
3696
3697 return jQuery.Deferred( function( newDefer ) {
3698
3699 // progress_handlers.add( ... )
3700 tuples[ 0 ][ 3 ].add(
3701 resolve(
3702 0,
3703 newDefer,
3704 jQuery.isFunction( onProgress ) ?
3705 onProgress :
3706 Identity,
3707 newDefer.notifyWith
3708 )
3709 );
3710
3711 // fulfilled_handlers.add( ... )
3712 tuples[ 1 ][ 3 ].add(
3713 resolve(
3714 0,
3715 newDefer,
3716 jQuery.isFunction( onFulfilled ) ?
3717 onFulfilled :
3718 Identity
3719 )
3720 );
3721
3722 // rejected_handlers.add( ... )
3723 tuples[ 2 ][ 3 ].add(
3724 resolve(
3725 0,
3726 newDefer,
3727 jQuery.isFunction( onRejected ) ?
3728 onRejected :
3729 Thrower
3730 )
3731 );
3732 } ).promise();
3733 },
3734
3735 // Get a promise for this deferred
3736 // If obj is provided, the promise aspect is added to the object
3737 promise: function( obj ) {
3738 return obj != null ? jQuery.extend( obj, promise ) : promise;
3739 }
3740 },
3741 deferred = {};
3742
3743 // Add list-specific methods
3744 jQuery.each( tuples, function( i, tuple ) {
3745 var list = tuple[ 2 ],
3746 stateString = tuple[ 5 ];
3747
3748 // promise.progress = list.add
3749 // promise.done = list.add
3750 // promise.fail = list.add
3751 promise[ tuple[ 1 ] ] = list.add;
3752
3753 // Handle state
3754 if ( stateString ) {
3755 list.add(
3756 function() {
3757
3758 // state = "resolved" (i.e., fulfilled)
3759 // state = "rejected"
3760 state = stateString;
3761 },
3762
3763 // rejected_callbacks.disable
3764 // fulfilled_callbacks.disable
3765 tuples[ 3 - i ][ 2 ].disable,
3766
3767 // progress_callbacks.lock
3768 tuples[ 0 ][ 2 ].lock
3769 );
3770 }
3771
3772 // progress_handlers.fire
3773 // fulfilled_handlers.fire
3774 // rejected_handlers.fire
3775 list.add( tuple[ 3 ].fire );
3776
3777 // deferred.notify = function() { deferred.notifyWith(...) }
3778 // deferred.resolve = function() { deferred.resolveWith(...) }
3779 // deferred.reject = function() { deferred.rejectWith(...) }
3780 deferred[ tuple[ 0 ] ] = function() {
3781 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
3782 return this;
3783 };
3784
3785 // deferred.notifyWith = list.fireWith
3786 // deferred.resolveWith = list.fireWith
3787 // deferred.rejectWith = list.fireWith
3788 deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
3789 } );
3790
3791 // Make the deferred a promise
3792 promise.promise( deferred );
3793
3794 // Call given func if any
3795 if ( func ) {
3796 func.call( deferred, deferred );
3797 }
3798
3799 // All done!
3800 return deferred;
3801 },
3802
3803 // Deferred helper
3804 when: function( singleValue ) {
3805 var
3806
3807 // count of uncompleted subordinates
3808 remaining = arguments.length,
3809
3810 // count of unprocessed arguments
3811 i = remaining,
3812
3813 // subordinate fulfillment data
3814 resolveContexts = Array( i ),
3815 resolveValues = slice.call( arguments ),
3816
3817 // the master Deferred
3818 master = jQuery.Deferred(),
3819
3820 // subordinate callback factory
3821 updateFunc = function( i ) {
3822 return function( value ) {
3823 resolveContexts[ i ] = this;
3824 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3825 if ( !( --remaining ) ) {
3826 master.resolveWith( resolveContexts, resolveValues );
3827 }
3828 };
3829 };
3830
3831 // Single- and empty arguments are adopted like Promise.resolve
3832 if ( remaining <= 1 ) {
3833 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
3834 !remaining );
3835
3836 // Use .then() to unwrap secondary thenables (cf. gh-3000)
3837 if ( master.state() === "pending" ||
3838 jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
3839
3840 return master.then();
3841 }
3842 }
3843
3844 // Multiple arguments are aggregated like Promise.all array elements
3845 while ( i-- ) {
3846 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
3847 }
3848
3849 return master.promise();
3850 }
3851} );
3852
3853
3854// These usually indicate a programmer mistake during development,
3855// warn about them ASAP rather than swallowing them by default.
3856var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
3857
3858jQuery.Deferred.exceptionHook = function( error, stack ) {
3859
3860 // Support: IE 8 - 9 only
3861 // Console exists when dev tools are open, which can happen at any time
3862 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
3863 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
3864 }
3865};
3866
3867
3868
3869
3870jQuery.readyException = function( error ) {
3871 window.setTimeout( function() {
3872 throw error;
3873 } );
3874};
3875
3876
3877
3878
3879// The deferred used on DOM ready
3880var readyList = jQuery.Deferred();
3881
3882jQuery.fn.ready = function( fn ) {
3883
3884 readyList
3885 .then( fn )
3886
3887 // Wrap jQuery.readyException in a function so that the lookup
3888 // happens at the time of error handling instead of callback
3889 // registration.
3890 .catch( function( error ) {
3891 jQuery.readyException( error );
3892 } );
3893
3894 return this;
3895};
3896
3897jQuery.extend( {
3898
3899 // Is the DOM ready to be used? Set to true once it occurs.
3900 isReady: false,
3901
3902 // A counter to track how many items to wait for before
3903 // the ready event fires. See #6781
3904 readyWait: 1,
3905
3906 // Handle when the DOM is ready
3907 ready: function( wait ) {
3908
3909 // Abort if there are pending holds or we're already ready
3910 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3911 return;
3912 }
3913
3914 // Remember that the DOM is ready
3915 jQuery.isReady = true;
3916
3917 // If a normal DOM Ready event fired, decrement, and wait if need be
3918 if ( wait !== true && --jQuery.readyWait > 0 ) {
3919 return;
3920 }
3921
3922 // If there are functions bound, to execute
3923 readyList.resolveWith( document, [ jQuery ] );
3924 }
3925} );
3926
3927jQuery.ready.then = readyList.then;
3928
3929// The ready event handler and self cleanup method
3930function completed() {
3931 document.removeEventListener( "DOMContentLoaded", completed );
3932 window.removeEventListener( "load", completed );
3933 jQuery.ready();
3934}
3935
3936// Catch cases where $(document).ready() is called
3937// after the browser event has already occurred.
3938// Support: IE <=9 - 10 only
3939// Older IE sometimes signals "interactive" too soon
3940if ( document.readyState === "complete" ||
3941 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
3942
3943 // Handle it asynchronously to allow scripts the opportunity to delay ready
3944 window.setTimeout( jQuery.ready );
3945
3946} else {
3947
3948 // Use the handy event callback
3949 document.addEventListener( "DOMContentLoaded", completed );
3950
3951 // A fallback to window.onload, that will always work
3952 window.addEventListener( "load", completed );
3953}
3954
3955
3956
3957
3958// Multifunctional method to get and set values of a collection
3959// The value/s can optionally be executed if it's a function
3960var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3961 var i = 0,
3962 len = elems.length,
3963 bulk = key == null;
3964
3965 // Sets many values
3966 if ( jQuery.type( key ) === "object" ) {
3967 chainable = true;
3968 for ( i in key ) {
3969 access( elems, fn, i, key[ i ], true, emptyGet, raw );
3970 }
3971
3972 // Sets one value
3973 } else if ( value !== undefined ) {
3974 chainable = true;
3975
3976 if ( !jQuery.isFunction( value ) ) {
3977 raw = true;
3978 }
3979
3980 if ( bulk ) {
3981
3982 // Bulk operations run against the entire set
3983 if ( raw ) {
3984 fn.call( elems, value );
3985 fn = null;
3986
3987 // ...except when executing function values
3988 } else {
3989 bulk = fn;
3990 fn = function( elem, key, value ) {
3991 return bulk.call( jQuery( elem ), value );
3992 };
3993 }
3994 }
3995
3996 if ( fn ) {
3997 for ( ; i < len; i++ ) {
3998 fn(
3999 elems[ i ], key, raw ?
4000 value :
4001 value.call( elems[ i ], i, fn( elems[ i ], key ) )
4002 );
4003 }
4004 }
4005 }
4006
4007 if ( chainable ) {
4008 return elems;
4009 }
4010
4011 // Gets
4012 if ( bulk ) {
4013 return fn.call( elems );
4014 }
4015
4016 return len ? fn( elems[ 0 ], key ) : emptyGet;
4017};
4018var acceptData = function( owner ) {
4019
4020 // Accepts only:
4021 // - Node
4022 // - Node.ELEMENT_NODE
4023 // - Node.DOCUMENT_NODE
4024 // - Object
4025 // - Any
4026 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
4027};
4028
4029
4030
4031
4032function Data() {
4033 this.expando = jQuery.expando + Data.uid++;
4034}
4035
4036Data.uid = 1;
4037
4038Data.prototype = {
4039
4040 cache: function( owner ) {
4041
4042 // Check if the owner object already has a cache
4043 var value = owner[ this.expando ];
4044
4045 // If not, create one
4046 if ( !value ) {
4047 value = {};
4048
4049 // We can accept data for non-element nodes in modern browsers,
4050 // but we should not, see #8335.
4051 // Always return an empty object.
4052 if ( acceptData( owner ) ) {
4053
4054 // If it is a node unlikely to be stringify-ed or looped over
4055 // use plain assignment
4056 if ( owner.nodeType ) {
4057 owner[ this.expando ] = value;
4058
4059 // Otherwise secure it in a non-enumerable property
4060 // configurable must be true to allow the property to be
4061 // deleted when data is removed
4062 } else {
4063 Object.defineProperty( owner, this.expando, {
4064 value: value,
4065 configurable: true
4066 } );
4067 }
4068 }
4069 }
4070
4071 return value;
4072 },
4073 set: function( owner, data, value ) {
4074 var prop,
4075 cache = this.cache( owner );
4076
4077 // Handle: [ owner, key, value ] args
4078 // Always use camelCase key (gh-2257)
4079 if ( typeof data === "string" ) {
4080 cache[ jQuery.camelCase( data ) ] = value;
4081
4082 // Handle: [ owner, { properties } ] args
4083 } else {
4084
4085 // Copy the properties one-by-one to the cache object
4086 for ( prop in data ) {
4087 cache[ jQuery.camelCase( prop ) ] = data[ prop ];
4088 }
4089 }
4090 return cache;
4091 },
4092 get: function( owner, key ) {
4093 return key === undefined ?
4094 this.cache( owner ) :
4095
4096 // Always use camelCase key (gh-2257)
4097 owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
4098 },
4099 access: function( owner, key, value ) {
4100
4101 // In cases where either:
4102 //
4103 // 1. No key was specified
4104 // 2. A string key was specified, but no value provided
4105 //
4106 // Take the "read" path and allow the get method to determine
4107 // which value to return, respectively either:
4108 //
4109 // 1. The entire cache object
4110 // 2. The data stored at the key
4111 //
4112 if ( key === undefined ||
4113 ( ( key && typeof key === "string" ) && value === undefined ) ) {
4114
4115 return this.get( owner, key );
4116 }
4117
4118 // When the key is not a string, or both a key and value
4119 // are specified, set or extend (existing objects) with either:
4120 //
4121 // 1. An object of properties
4122 // 2. A key and value
4123 //
4124 this.set( owner, key, value );
4125
4126 // Since the "set" path can have two possible entry points
4127 // return the expected data based on which path was taken[*]
4128 return value !== undefined ? value : key;
4129 },
4130 remove: function( owner, key ) {
4131 var i,
4132 cache = owner[ this.expando ];
4133
4134 if ( cache === undefined ) {
4135 return;
4136 }
4137
4138 if ( key !== undefined ) {
4139
4140 // Support array or space separated string of keys
4141 if ( Array.isArray( key ) ) {
4142
4143 // If key is an array of keys...
4144 // We always set camelCase keys, so remove that.
4145 key = key.map( jQuery.camelCase );
4146 } else {
4147 key = jQuery.camelCase( key );
4148
4149 // If a key with the spaces exists, use it.
4150 // Otherwise, create an array by matching non-whitespace
4151 key = key in cache ?
4152 [ key ] :
4153 ( key.match( rnothtmlwhite ) || [] );
4154 }
4155
4156 i = key.length;
4157
4158 while ( i-- ) {
4159 delete cache[ key[ i ] ];
4160 }
4161 }
4162
4163 // Remove the expando if there's no more data
4164 if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
4165
4166 // Support: Chrome <=35 - 45
4167 // Webkit & Blink performance suffers when deleting properties
4168 // from DOM nodes, so set to undefined instead
4169 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
4170 if ( owner.nodeType ) {
4171 owner[ this.expando ] = undefined;
4172 } else {
4173 delete owner[ this.expando ];
4174 }
4175 }
4176 },
4177 hasData: function( owner ) {
4178 var cache = owner[ this.expando ];
4179 return cache !== undefined && !jQuery.isEmptyObject( cache );
4180 }
4181};
4182var dataPriv = new Data();
4183
4184var dataUser = new Data();
4185
4186
4187
4188// Implementation Summary
4189//
4190// 1. Enforce API surface and semantic compatibility with 1.9.x branch
4191// 2. Improve the module's maintainability by reducing the storage
4192// paths to a single mechanism.
4193// 3. Use the same single mechanism to support "private" and "user" data.
4194// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
4195// 5. Avoid exposing implementation details on user objects (eg. expando properties)
4196// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
4197
4198var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
4199 rmultiDash = /[A-Z]/g;
4200
4201function getData( data ) {
4202 if ( data === "true" ) {
4203 return true;
4204 }
4205
4206 if ( data === "false" ) {
4207 return false;
4208 }
4209
4210 if ( data === "null" ) {
4211 return null;
4212 }
4213
4214 // Only convert to a number if it doesn't change the string
4215 if ( data === +data + "" ) {
4216 return +data;
4217 }
4218
4219 if ( rbrace.test( data ) ) {
4220 return JSON.parse( data );
4221 }
4222
4223 return data;
4224}
4225
4226function dataAttr( elem, key, data ) {
4227 var name;
4228
4229 // If nothing was found internally, try to fetch any
4230 // data from the HTML5 data-* attribute
4231 if ( data === undefined && elem.nodeType === 1 ) {
4232 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
4233 data = elem.getAttribute( name );
4234
4235 if ( typeof data === "string" ) {
4236 try {
4237 data = getData( data );
4238 } catch ( e ) {}
4239
4240 // Make sure we set the data so it isn't changed later
4241 dataUser.set( elem, key, data );
4242 } else {
4243 data = undefined;
4244 }
4245 }
4246 return data;
4247}
4248
4249jQuery.extend( {
4250 hasData: function( elem ) {
4251 return dataUser.hasData( elem ) || dataPriv.hasData( elem );
4252 },
4253
4254 data: function( elem, name, data ) {
4255 return dataUser.access( elem, name, data );
4256 },
4257
4258 removeData: function( elem, name ) {
4259 dataUser.remove( elem, name );
4260 },
4261
4262 // TODO: Now that all calls to _data and _removeData have been replaced
4263 // with direct calls to dataPriv methods, these can be deprecated.
4264 _data: function( elem, name, data ) {
4265 return dataPriv.access( elem, name, data );
4266 },
4267
4268 _removeData: function( elem, name ) {
4269 dataPriv.remove( elem, name );
4270 }
4271} );
4272
4273jQuery.fn.extend( {
4274 data: function( key, value ) {
4275 var i, name, data,
4276 elem = this[ 0 ],
4277 attrs = elem && elem.attributes;
4278
4279 // Gets all values
4280 if ( key === undefined ) {
4281 if ( this.length ) {
4282 data = dataUser.get( elem );
4283
4284 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
4285 i = attrs.length;
4286 while ( i-- ) {
4287
4288 // Support: IE 11 only
4289 // The attrs elements can be null (#14894)
4290 if ( attrs[ i ] ) {
4291 name = attrs[ i ].name;
4292 if ( name.indexOf( "data-" ) === 0 ) {
4293 name = jQuery.camelCase( name.slice( 5 ) );
4294 dataAttr( elem, name, data[ name ] );
4295 }
4296 }
4297 }
4298 dataPriv.set( elem, "hasDataAttrs", true );
4299 }
4300 }
4301
4302 return data;
4303 }
4304
4305 // Sets multiple values
4306 if ( typeof key === "object" ) {
4307 return this.each( function() {
4308 dataUser.set( this, key );
4309 } );
4310 }
4311
4312 return access( this, function( value ) {
4313 var data;
4314
4315 // The calling jQuery object (element matches) is not empty
4316 // (and therefore has an element appears at this[ 0 ]) and the
4317 // `value` parameter was not undefined. An empty jQuery object
4318 // will result in `undefined` for elem = this[ 0 ] which will
4319 // throw an exception if an attempt to read a data cache is made.
4320 if ( elem && value === undefined ) {
4321
4322 // Attempt to get data from the cache
4323 // The key will always be camelCased in Data
4324 data = dataUser.get( elem, key );
4325 if ( data !== undefined ) {
4326 return data;
4327 }
4328
4329 // Attempt to "discover" the data in
4330 // HTML5 custom data-* attrs
4331 data = dataAttr( elem, key );
4332 if ( data !== undefined ) {
4333 return data;
4334 }
4335
4336 // We tried really hard, but the data doesn't exist.
4337 return;
4338 }
4339
4340 // Set the data...
4341 this.each( function() {
4342
4343 // We always store the camelCased key
4344 dataUser.set( this, key, value );
4345 } );
4346 }, null, value, arguments.length > 1, null, true );
4347 },
4348
4349 removeData: function( key ) {
4350 return this.each( function() {
4351 dataUser.remove( this, key );
4352 } );
4353 }
4354} );
4355
4356
4357jQuery.extend( {
4358 queue: function( elem, type, data ) {
4359 var queue;
4360
4361 if ( elem ) {
4362 type = ( type || "fx" ) + "queue";
4363 queue = dataPriv.get( elem, type );
4364
4365 // Speed up dequeue by getting out quickly if this is just a lookup
4366 if ( data ) {
4367 if ( !queue || Array.isArray( data ) ) {
4368 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
4369 } else {
4370 queue.push( data );
4371 }
4372 }
4373 return queue || [];
4374 }
4375 },
4376
4377 dequeue: function( elem, type ) {
4378 type = type || "fx";
4379
4380 var queue = jQuery.queue( elem, type ),
4381 startLength = queue.length,
4382 fn = queue.shift(),
4383 hooks = jQuery._queueHooks( elem, type ),
4384 next = function() {
4385 jQuery.dequeue( elem, type );
4386 };
4387
4388 // If the fx queue is dequeued, always remove the progress sentinel
4389 if ( fn === "inprogress" ) {
4390 fn = queue.shift();
4391 startLength--;
4392 }
4393
4394 if ( fn ) {
4395
4396 // Add a progress sentinel to prevent the fx queue from being
4397 // automatically dequeued
4398 if ( type === "fx" ) {
4399 queue.unshift( "inprogress" );
4400 }
4401
4402 // Clear up the last queue stop function
4403 delete hooks.stop;
4404 fn.call( elem, next, hooks );
4405 }
4406
4407 if ( !startLength && hooks ) {
4408 hooks.empty.fire();
4409 }
4410 },
4411
4412 // Not public - generate a queueHooks object, or return the current one
4413 _queueHooks: function( elem, type ) {
4414 var key = type + "queueHooks";
4415 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
4416 empty: jQuery.Callbacks( "once memory" ).add( function() {
4417 dataPriv.remove( elem, [ type + "queue", key ] );
4418 } )
4419 } );
4420 }
4421} );
4422
4423jQuery.fn.extend( {
4424 queue: function( type, data ) {
4425 var setter = 2;
4426
4427 if ( typeof type !== "string" ) {
4428 data = type;
4429 type = "fx";
4430 setter--;
4431 }
4432
4433 if ( arguments.length < setter ) {
4434 return jQuery.queue( this[ 0 ], type );
4435 }
4436
4437 return data === undefined ?
4438 this :
4439 this.each( function() {
4440 var queue = jQuery.queue( this, type, data );
4441
4442 // Ensure a hooks for this queue
4443 jQuery._queueHooks( this, type );
4444
4445 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
4446 jQuery.dequeue( this, type );
4447 }
4448 } );
4449 },
4450 dequeue: function( type ) {
4451 return this.each( function() {
4452 jQuery.dequeue( this, type );
4453 } );
4454 },
4455 clearQueue: function( type ) {
4456 return this.queue( type || "fx", [] );
4457 },
4458
4459 // Get a promise resolved when queues of a certain type
4460 // are emptied (fx is the type by default)
4461 promise: function( type, obj ) {
4462 var tmp,
4463 count = 1,
4464 defer = jQuery.Deferred(),
4465 elements = this,
4466 i = this.length,
4467 resolve = function() {
4468 if ( !( --count ) ) {
4469 defer.resolveWith( elements, [ elements ] );
4470 }
4471 };
4472
4473 if ( typeof type !== "string" ) {
4474 obj = type;
4475 type = undefined;
4476 }
4477 type = type || "fx";
4478
4479 while ( i-- ) {
4480 tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
4481 if ( tmp && tmp.empty ) {
4482 count++;
4483 tmp.empty.add( resolve );
4484 }
4485 }
4486 resolve();
4487 return defer.promise( obj );
4488 }
4489} );
4490var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
4491
4492var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
4493
4494
4495var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4496
4497var isHiddenWithinTree = function( elem, el ) {
4498
4499 // isHiddenWithinTree might be called from jQuery#filter function;
4500 // in that case, element will be second argument
4501 elem = el || elem;
4502
4503 // Inline style trumps all
4504 return elem.style.display === "none" ||
4505 elem.style.display === "" &&
4506
4507 // Otherwise, check computed style
4508 // Support: Firefox <=43 - 45
4509 // Disconnected elements can have computed display: none, so first confirm that elem is
4510 // in the document.
4511 jQuery.contains( elem.ownerDocument, elem ) &&
4512
4513 jQuery.css( elem, "display" ) === "none";
4514 };
4515
4516var swap = function( elem, options, callback, args ) {
4517 var ret, name,
4518 old = {};
4519
4520 // Remember the old values, and insert the new ones
4521 for ( name in options ) {
4522 old[ name ] = elem.style[ name ];
4523 elem.style[ name ] = options[ name ];
4524 }
4525
4526 ret = callback.apply( elem, args || [] );
4527
4528 // Revert the old values
4529 for ( name in options ) {
4530 elem.style[ name ] = old[ name ];
4531 }
4532
4533 return ret;
4534};
4535
4536
4537
4538
4539function adjustCSS( elem, prop, valueParts, tween ) {
4540 var adjusted,
4541 scale = 1,
4542 maxIterations = 20,
4543 currentValue = tween ?
4544 function() {
4545 return tween.cur();
4546 } :
4547 function() {
4548 return jQuery.css( elem, prop, "" );
4549 },
4550 initial = currentValue(),
4551 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4552
4553 // Starting value computation is required for potential unit mismatches
4554 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4555 rcssNum.exec( jQuery.css( elem, prop ) );
4556
4557 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4558
4559 // Trust units reported by jQuery.css
4560 unit = unit || initialInUnit[ 3 ];
4561
4562 // Make sure we update the tween properties later on
4563 valueParts = valueParts || [];
4564
4565 // Iteratively approximate from a nonzero starting point
4566 initialInUnit = +initial || 1;
4567
4568 do {
4569
4570 // If previous iteration zeroed out, double until we get *something*.
4571 // Use string for doubling so we don't accidentally see scale as unchanged below
4572 scale = scale || ".5";
4573
4574 // Adjust and apply
4575 initialInUnit = initialInUnit / scale;
4576 jQuery.style( elem, prop, initialInUnit + unit );
4577
4578 // Update scale, tolerating zero or NaN from tween.cur()
4579 // Break the loop if scale is unchanged or perfect, or if we've just had enough.
4580 } while (
4581 scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
4582 );
4583 }
4584
4585 if ( valueParts ) {
4586 initialInUnit = +initialInUnit || +initial || 0;
4587
4588 // Apply relative offset (+=/-=) if specified
4589 adjusted = valueParts[ 1 ] ?
4590 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
4591 +valueParts[ 2 ];
4592 if ( tween ) {
4593 tween.unit = unit;
4594 tween.start = initialInUnit;
4595 tween.end = adjusted;
4596 }
4597 }
4598 return adjusted;
4599}
4600
4601
4602var defaultDisplayMap = {};
4603
4604function getDefaultDisplay( elem ) {
4605 var temp,
4606 doc = elem.ownerDocument,
4607 nodeName = elem.nodeName,
4608 display = defaultDisplayMap[ nodeName ];
4609
4610 if ( display ) {
4611 return display;
4612 }
4613
4614 temp = doc.body.appendChild( doc.createElement( nodeName ) );
4615 display = jQuery.css( temp, "display" );
4616
4617 temp.parentNode.removeChild( temp );
4618
4619 if ( display === "none" ) {
4620 display = "block";
4621 }
4622 defaultDisplayMap[ nodeName ] = display;
4623
4624 return display;
4625}
4626
4627function showHide( elements, show ) {
4628 var display, elem,
4629 values = [],
4630 index = 0,
4631 length = elements.length;
4632
4633 // Determine new display value for elements that need to change
4634 for ( ; index < length; index++ ) {
4635 elem = elements[ index ];
4636 if ( !elem.style ) {
4637 continue;
4638 }
4639
4640 display = elem.style.display;
4641 if ( show ) {
4642
4643 // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
4644 // check is required in this first loop unless we have a nonempty display value (either
4645 // inline or about-to-be-restored)
4646 if ( display === "none" ) {
4647 values[ index ] = dataPriv.get( elem, "display" ) || null;
4648 if ( !values[ index ] ) {
4649 elem.style.display = "";
4650 }
4651 }
4652 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
4653 values[ index ] = getDefaultDisplay( elem );
4654 }
4655 } else {
4656 if ( display !== "none" ) {
4657 values[ index ] = "none";
4658
4659 // Remember what we're overwriting
4660 dataPriv.set( elem, "display", display );
4661 }
4662 }
4663 }
4664
4665 // Set the display of the elements in a second loop to avoid constant reflow
4666 for ( index = 0; index < length; index++ ) {
4667 if ( values[ index ] != null ) {
4668 elements[ index ].style.display = values[ index ];
4669 }
4670 }
4671
4672 return elements;
4673}
4674
4675jQuery.fn.extend( {
4676 show: function() {
4677 return showHide( this, true );
4678 },
4679 hide: function() {
4680 return showHide( this );
4681 },
4682 toggle: function( state ) {
4683 if ( typeof state === "boolean" ) {
4684 return state ? this.show() : this.hide();
4685 }
4686
4687 return this.each( function() {
4688 if ( isHiddenWithinTree( this ) ) {
4689 jQuery( this ).show();
4690 } else {
4691 jQuery( this ).hide();
4692 }
4693 } );
4694 }
4695} );
4696var rcheckableType = ( /^(?:checkbox|radio)$/i );
4697
4698var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
4699
4700var rscriptType = ( /^$|\/(?:java|ecma)script/i );
4701
4702
4703
4704// We have to close these tags to support XHTML (#13200)
4705var wrapMap = {
4706
4707 // Support: IE <=9 only
4708 option: [ 1, "<select multiple='multiple'>", "</select>" ],
4709
4710 // XHTML parsers do not magically insert elements in the
4711 // same way that tag soup parsers do. So we cannot shorten
4712 // this by omitting <tbody> or other required elements.
4713 thead: [ 1, "<table>", "</table>" ],
4714 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
4715 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4716 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4717
4718 _default: [ 0, "", "" ]
4719};
4720
4721// Support: IE <=9 only
4722wrapMap.optgroup = wrapMap.option;
4723
4724wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4725wrapMap.th = wrapMap.td;
4726
4727
4728function getAll( context, tag ) {
4729
4730 // Support: IE <=9 - 11 only
4731 // Use typeof to avoid zero-argument method invocation on host objects (#15151)
4732 var ret;
4733
4734 if ( typeof context.getElementsByTagName !== "undefined" ) {
4735 ret = context.getElementsByTagName( tag || "*" );
4736
4737 } else if ( typeof context.querySelectorAll !== "undefined" ) {
4738 ret = context.querySelectorAll( tag || "*" );
4739
4740 } else {
4741 ret = [];
4742 }
4743
4744 if ( tag === undefined || tag && nodeName( context, tag ) ) {
4745 return jQuery.merge( [ context ], ret );
4746 }
4747
4748 return ret;
4749}
4750
4751
4752// Mark scripts as having already been evaluated
4753function setGlobalEval( elems, refElements ) {
4754 var i = 0,
4755 l = elems.length;
4756
4757 for ( ; i < l; i++ ) {
4758 dataPriv.set(
4759 elems[ i ],
4760 "globalEval",
4761 !refElements || dataPriv.get( refElements[ i ], "globalEval" )
4762 );
4763 }
4764}
4765
4766
4767var rhtml = /<|&#?\w+;/;
4768
4769function buildFragment( elems, context, scripts, selection, ignored ) {
4770 var elem, tmp, tag, wrap, contains, j,
4771 fragment = context.createDocumentFragment(),
4772 nodes = [],
4773 i = 0,
4774 l = elems.length;
4775
4776 for ( ; i < l; i++ ) {
4777 elem = elems[ i ];
4778
4779 if ( elem || elem === 0 ) {
4780
4781 // Add nodes directly
4782 if ( jQuery.type( elem ) === "object" ) {
4783
4784 // Support: Android <=4.0 only, PhantomJS 1 only
4785 // push.apply(_, arraylike) throws on ancient WebKit
4786 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
4787
4788 // Convert non-html into a text node
4789 } else if ( !rhtml.test( elem ) ) {
4790 nodes.push( context.createTextNode( elem ) );
4791
4792 // Convert html into DOM nodes
4793 } else {
4794 tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
4795
4796 // Deserialize a standard representation
4797 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
4798 wrap = wrapMap[ tag ] || wrapMap._default;
4799 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
4800
4801 // Descend through wrappers to the right content
4802 j = wrap[ 0 ];
4803 while ( j-- ) {
4804 tmp = tmp.lastChild;
4805 }
4806
4807 // Support: Android <=4.0 only, PhantomJS 1 only
4808 // push.apply(_, arraylike) throws on ancient WebKit
4809 jQuery.merge( nodes, tmp.childNodes );
4810
4811 // Remember the top-level container
4812 tmp = fragment.firstChild;
4813
4814 // Ensure the created nodes are orphaned (#12392)
4815 tmp.textContent = "";
4816 }
4817 }
4818 }
4819
4820 // Remove wrapper from fragment
4821 fragment.textContent = "";
4822
4823 i = 0;
4824 while ( ( elem = nodes[ i++ ] ) ) {
4825
4826 // Skip elements already in the context collection (trac-4087)
4827 if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
4828 if ( ignored ) {
4829 ignored.push( elem );
4830 }
4831 continue;
4832 }
4833
4834 contains = jQuery.contains( elem.ownerDocument, elem );
4835
4836 // Append to fragment
4837 tmp = getAll( fragment.appendChild( elem ), "script" );
4838
4839 // Preserve script evaluation history
4840 if ( contains ) {
4841 setGlobalEval( tmp );
4842 }
4843
4844 // Capture executables
4845 if ( scripts ) {
4846 j = 0;
4847 while ( ( elem = tmp[ j++ ] ) ) {
4848 if ( rscriptType.test( elem.type || "" ) ) {
4849 scripts.push( elem );
4850 }
4851 }
4852 }
4853 }
4854
4855 return fragment;
4856}
4857
4858
4859( function() {
4860 var fragment = document.createDocumentFragment(),
4861 div = fragment.appendChild( document.createElement( "div" ) ),
4862 input = document.createElement( "input" );
4863
4864 // Support: Android 4.0 - 4.3 only
4865 // Check state lost if the name is set (#11217)
4866 // Support: Windows Web Apps (WWA)
4867 // `name` and `type` must use .setAttribute for WWA (#14901)
4868 input.setAttribute( "type", "radio" );
4869 input.setAttribute( "checked", "checked" );
4870 input.setAttribute( "name", "t" );
4871
4872 div.appendChild( input );
4873
4874 // Support: Android <=4.1 only
4875 // Older WebKit doesn't clone checked state correctly in fragments
4876 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4877
4878 // Support: IE <=11 only
4879 // Make sure textarea (and checkbox) defaultValue is properly cloned
4880 div.innerHTML = "<textarea>x</textarea>";
4881 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4882} )();
4883var documentElement = document.documentElement;
4884
4885
4886
4887var
4888 rkeyEvent = /^key/,
4889 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
4890 rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
4891
4892function returnTrue() {
4893 return true;
4894}
4895
4896function returnFalse() {
4897 return false;
4898}
4899
4900// Support: IE <=9 only
4901// See #13393 for more info
4902function safeActiveElement() {
4903 try {
4904 return document.activeElement;
4905 } catch ( err ) { }
4906}
4907
4908function on( elem, types, selector, data, fn, one ) {
4909 var origFn, type;
4910
4911 // Types can be a map of types/handlers
4912 if ( typeof types === "object" ) {
4913
4914 // ( types-Object, selector, data )
4915 if ( typeof selector !== "string" ) {
4916
4917 // ( types-Object, data )
4918 data = data || selector;
4919 selector = undefined;
4920 }
4921 for ( type in types ) {
4922 on( elem, type, selector, data, types[ type ], one );
4923 }
4924 return elem;
4925 }
4926
4927 if ( data == null && fn == null ) {
4928
4929 // ( types, fn )
4930 fn = selector;
4931 data = selector = undefined;
4932 } else if ( fn == null ) {
4933 if ( typeof selector === "string" ) {
4934
4935 // ( types, selector, fn )
4936 fn = data;
4937 data = undefined;
4938 } else {
4939
4940 // ( types, data, fn )
4941 fn = data;
4942 data = selector;
4943 selector = undefined;
4944 }
4945 }
4946 if ( fn === false ) {
4947 fn = returnFalse;
4948 } else if ( !fn ) {
4949 return elem;
4950 }
4951
4952 if ( one === 1 ) {
4953 origFn = fn;
4954 fn = function( event ) {
4955
4956 // Can use an empty set, since event contains the info
4957 jQuery().off( event );
4958 return origFn.apply( this, arguments );
4959 };
4960
4961 // Use same guid so caller can remove using origFn
4962 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
4963 }
4964 return elem.each( function() {
4965 jQuery.event.add( this, types, fn, data, selector );
4966 } );
4967}
4968
4969/*
4970 * Helper functions for managing events -- not part of the public interface.
4971 * Props to Dean Edwards' addEvent library for many of the ideas.
4972 */
4973jQuery.event = {
4974
4975 global: {},
4976
4977 add: function( elem, types, handler, data, selector ) {
4978
4979 var handleObjIn, eventHandle, tmp,
4980 events, t, handleObj,
4981 special, handlers, type, namespaces, origType,
4982 elemData = dataPriv.get( elem );
4983
4984 // Don't attach events to noData or text/comment nodes (but allow plain objects)
4985 if ( !elemData ) {
4986 return;
4987 }
4988
4989 // Caller can pass in an object of custom data in lieu of the handler
4990 if ( handler.handler ) {
4991 handleObjIn = handler;
4992 handler = handleObjIn.handler;
4993 selector = handleObjIn.selector;
4994 }
4995
4996 // Ensure that invalid selectors throw exceptions at attach time
4997 // Evaluate against documentElement in case elem is a non-element node (e.g., document)
4998 if ( selector ) {
4999 jQuery.find.matchesSelector( documentElement, selector );
5000 }
5001
5002 // Make sure that the handler has a unique ID, used to find/remove it later
5003 if ( !handler.guid ) {
5004 handler.guid = jQuery.guid++;
5005 }
5006
5007 // Init the element's event structure and main handler, if this is the first
5008 if ( !( events = elemData.events ) ) {
5009 events = elemData.events = {};
5010 }
5011 if ( !( eventHandle = elemData.handle ) ) {
5012 eventHandle = elemData.handle = function( e ) {
5013
5014 // Discard the second event of a jQuery.event.trigger() and
5015 // when an event is called after a page has unloaded
5016 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
5017 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
5018 };
5019 }
5020
5021 // Handle multiple events separated by a space
5022 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5023 t = types.length;
5024 while ( t-- ) {
5025 tmp = rtypenamespace.exec( types[ t ] ) || [];
5026 type = origType = tmp[ 1 ];
5027 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5028
5029 // There *must* be a type, no attaching namespace-only handlers
5030 if ( !type ) {
5031 continue;
5032 }
5033
5034 // If event changes its type, use the special event handlers for the changed type
5035 special = jQuery.event.special[ type ] || {};
5036
5037 // If selector defined, determine special event api type, otherwise given type
5038 type = ( selector ? special.delegateType : special.bindType ) || type;
5039
5040 // Update special based on newly reset type
5041 special = jQuery.event.special[ type ] || {};
5042
5043 // handleObj is passed to all event handlers
5044 handleObj = jQuery.extend( {
5045 type: type,
5046 origType: origType,
5047 data: data,
5048 handler: handler,
5049 guid: handler.guid,
5050 selector: selector,
5051 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
5052 namespace: namespaces.join( "." )
5053 }, handleObjIn );
5054
5055 // Init the event handler queue if we're the first
5056 if ( !( handlers = events[ type ] ) ) {
5057 handlers = events[ type ] = [];
5058 handlers.delegateCount = 0;
5059
5060 // Only use addEventListener if the special events handler returns false
5061 if ( !special.setup ||
5062 special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
5063
5064 if ( elem.addEventListener ) {
5065 elem.addEventListener( type, eventHandle );
5066 }
5067 }
5068 }
5069
5070 if ( special.add ) {
5071 special.add.call( elem, handleObj );
5072
5073 if ( !handleObj.handler.guid ) {
5074 handleObj.handler.guid = handler.guid;
5075 }
5076 }
5077
5078 // Add to the element's handler list, delegates in front
5079 if ( selector ) {
5080 handlers.splice( handlers.delegateCount++, 0, handleObj );
5081 } else {
5082 handlers.push( handleObj );
5083 }
5084
5085 // Keep track of which events have ever been used, for event optimization
5086 jQuery.event.global[ type ] = true;
5087 }
5088
5089 },
5090
5091 // Detach an event or set of events from an element
5092 remove: function( elem, types, handler, selector, mappedTypes ) {
5093
5094 var j, origCount, tmp,
5095 events, t, handleObj,
5096 special, handlers, type, namespaces, origType,
5097 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
5098
5099 if ( !elemData || !( events = elemData.events ) ) {
5100 return;
5101 }
5102
5103 // Once for each type.namespace in types; type may be omitted
5104 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5105 t = types.length;
5106 while ( t-- ) {
5107 tmp = rtypenamespace.exec( types[ t ] ) || [];
5108 type = origType = tmp[ 1 ];
5109 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5110
5111 // Unbind all events (on this namespace, if provided) for the element
5112 if ( !type ) {
5113 for ( type in events ) {
5114 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
5115 }
5116 continue;
5117 }
5118
5119 special = jQuery.event.special[ type ] || {};
5120 type = ( selector ? special.delegateType : special.bindType ) || type;
5121 handlers = events[ type ] || [];
5122 tmp = tmp[ 2 ] &&
5123 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
5124
5125 // Remove matching events
5126 origCount = j = handlers.length;
5127 while ( j-- ) {
5128 handleObj = handlers[ j ];
5129
5130 if ( ( mappedTypes || origType === handleObj.origType ) &&
5131 ( !handler || handler.guid === handleObj.guid ) &&
5132 ( !tmp || tmp.test( handleObj.namespace ) ) &&
5133 ( !selector || selector === handleObj.selector ||
5134 selector === "**" && handleObj.selector ) ) {
5135 handlers.splice( j, 1 );
5136
5137 if ( handleObj.selector ) {
5138 handlers.delegateCount--;
5139 }
5140 if ( special.remove ) {
5141 special.remove.call( elem, handleObj );
5142 }
5143 }
5144 }
5145
5146 // Remove generic event handler if we removed something and no more handlers exist
5147 // (avoids potential for endless recursion during removal of special event handlers)
5148 if ( origCount && !handlers.length ) {
5149 if ( !special.teardown ||
5150 special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
5151
5152 jQuery.removeEvent( elem, type, elemData.handle );
5153 }
5154
5155 delete events[ type ];
5156 }
5157 }
5158
5159 // Remove data and the expando if it's no longer used
5160 if ( jQuery.isEmptyObject( events ) ) {
5161 dataPriv.remove( elem, "handle events" );
5162 }
5163 },
5164
5165 dispatch: function( nativeEvent ) {
5166
5167 // Make a writable jQuery.Event from the native event object
5168 var event = jQuery.event.fix( nativeEvent );
5169
5170 var i, j, ret, matched, handleObj, handlerQueue,
5171 args = new Array( arguments.length ),
5172 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
5173 special = jQuery.event.special[ event.type ] || {};
5174
5175 // Use the fix-ed jQuery.Event rather than the (read-only) native event
5176 args[ 0 ] = event;
5177
5178 for ( i = 1; i < arguments.length; i++ ) {
5179 args[ i ] = arguments[ i ];
5180 }
5181
5182 event.delegateTarget = this;
5183
5184 // Call the preDispatch hook for the mapped type, and let it bail if desired
5185 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
5186 return;
5187 }
5188
5189 // Determine handlers
5190 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
5191
5192 // Run delegates first; they may want to stop propagation beneath us
5193 i = 0;
5194 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
5195 event.currentTarget = matched.elem;
5196
5197 j = 0;
5198 while ( ( handleObj = matched.handlers[ j++ ] ) &&
5199 !event.isImmediatePropagationStopped() ) {
5200
5201 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
5202 // a subset or equal to those in the bound event (both can have no namespace).
5203 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
5204
5205 event.handleObj = handleObj;
5206 event.data = handleObj.data;
5207
5208 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
5209 handleObj.handler ).apply( matched.elem, args );
5210
5211 if ( ret !== undefined ) {
5212 if ( ( event.result = ret ) === false ) {
5213 event.preventDefault();
5214 event.stopPropagation();
5215 }
5216 }
5217 }
5218 }
5219 }
5220
5221 // Call the postDispatch hook for the mapped type
5222 if ( special.postDispatch ) {
5223 special.postDispatch.call( this, event );
5224 }
5225
5226 return event.result;
5227 },
5228
5229 handlers: function( event, handlers ) {
5230 var i, handleObj, sel, matchedHandlers, matchedSelectors,
5231 handlerQueue = [],
5232 delegateCount = handlers.delegateCount,
5233 cur = event.target;
5234
5235 // Find delegate handlers
5236 if ( delegateCount &&
5237
5238 // Support: IE <=9
5239 // Black-hole SVG <use> instance trees (trac-13180)
5240 cur.nodeType &&
5241
5242 // Support: Firefox <=42
5243 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
5244 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
5245 // Support: IE 11 only
5246 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
5247 !( event.type === "click" && event.button >= 1 ) ) {
5248
5249 for ( ; cur !== this; cur = cur.parentNode || this ) {
5250
5251 // Don't check non-elements (#13208)
5252 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
5253 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
5254 matchedHandlers = [];
5255 matchedSelectors = {};
5256 for ( i = 0; i < delegateCount; i++ ) {
5257 handleObj = handlers[ i ];
5258
5259 // Don't conflict with Object.prototype properties (#13203)
5260 sel = handleObj.selector + " ";
5261
5262 if ( matchedSelectors[ sel ] === undefined ) {
5263 matchedSelectors[ sel ] = handleObj.needsContext ?
5264 jQuery( sel, this ).index( cur ) > -1 :
5265 jQuery.find( sel, this, null, [ cur ] ).length;
5266 }
5267 if ( matchedSelectors[ sel ] ) {
5268 matchedHandlers.push( handleObj );
5269 }
5270 }
5271 if ( matchedHandlers.length ) {
5272 handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
5273 }
5274 }
5275 }
5276 }
5277
5278 // Add the remaining (directly-bound) handlers
5279 cur = this;
5280 if ( delegateCount < handlers.length ) {
5281 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
5282 }
5283
5284 return handlerQueue;
5285 },
5286
5287 addProp: function( name, hook ) {
5288 Object.defineProperty( jQuery.Event.prototype, name, {
5289 enumerable: true,
5290 configurable: true,
5291
5292 get: jQuery.isFunction( hook ) ?
5293 function() {
5294 if ( this.originalEvent ) {
5295 return hook( this.originalEvent );
5296 }
5297 } :
5298 function() {
5299 if ( this.originalEvent ) {
5300 return this.originalEvent[ name ];
5301 }
5302 },
5303
5304 set: function( value ) {
5305 Object.defineProperty( this, name, {
5306 enumerable: true,
5307 configurable: true,
5308 writable: true,
5309 value: value
5310 } );
5311 }
5312 } );
5313 },
5314
5315 fix: function( originalEvent ) {
5316 return originalEvent[ jQuery.expando ] ?
5317 originalEvent :
5318 new jQuery.Event( originalEvent );
5319 },
5320
5321 special: {
5322 load: {
5323
5324 // Prevent triggered image.load events from bubbling to window.load
5325 noBubble: true
5326 },
5327 focus: {
5328
5329 // Fire native event if possible so blur/focus sequence is correct
5330 trigger: function() {
5331 if ( this !== safeActiveElement() && this.focus ) {
5332 this.focus();
5333 return false;
5334 }
5335 },
5336 delegateType: "focusin"
5337 },
5338 blur: {
5339 trigger: function() {
5340 if ( this === safeActiveElement() && this.blur ) {
5341 this.blur();
5342 return false;
5343 }
5344 },
5345 delegateType: "focusout"
5346 },
5347 click: {
5348
5349 // For checkbox, fire native event so checked state will be right
5350 trigger: function() {
5351 if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
5352 this.click();
5353 return false;
5354 }
5355 },
5356
5357 // For cross-browser consistency, don't fire native .click() on links
5358 _default: function( event ) {
5359 return nodeName( event.target, "a" );
5360 }
5361 },
5362
5363 beforeunload: {
5364 postDispatch: function( event ) {
5365
5366 // Support: Firefox 20+
5367 // Firefox doesn't alert if the returnValue field is not set.
5368 if ( event.result !== undefined && event.originalEvent ) {
5369 event.originalEvent.returnValue = event.result;
5370 }
5371 }
5372 }
5373 }
5374};
5375
5376jQuery.removeEvent = function( elem, type, handle ) {
5377
5378 // This "if" is needed for plain objects
5379 if ( elem.removeEventListener ) {
5380 elem.removeEventListener( type, handle );
5381 }
5382};
5383
5384jQuery.Event = function( src, props ) {
5385
5386 // Allow instantiation without the 'new' keyword
5387 if ( !( this instanceof jQuery.Event ) ) {
5388 return new jQuery.Event( src, props );
5389 }
5390
5391 // Event object
5392 if ( src && src.type ) {
5393 this.originalEvent = src;
5394 this.type = src.type;
5395
5396 // Events bubbling up the document may have been marked as prevented
5397 // by a handler lower down the tree; reflect the correct value.
5398 this.isDefaultPrevented = src.defaultPrevented ||
5399 src.defaultPrevented === undefined &&
5400
5401 // Support: Android <=2.3 only
5402 src.returnValue === false ?
5403 returnTrue :
5404 returnFalse;
5405
5406 // Create target properties
5407 // Support: Safari <=6 - 7 only
5408 // Target should not be a text node (#504, #13143)
5409 this.target = ( src.target && src.target.nodeType === 3 ) ?
5410 src.target.parentNode :
5411 src.target;
5412
5413 this.currentTarget = src.currentTarget;
5414 this.relatedTarget = src.relatedTarget;
5415
5416 // Event type
5417 } else {
5418 this.type = src;
5419 }
5420
5421 // Put explicitly provided properties onto the event object
5422 if ( props ) {
5423 jQuery.extend( this, props );
5424 }
5425
5426 // Create a timestamp if incoming event doesn't have one
5427 this.timeStamp = src && src.timeStamp || jQuery.now();
5428
5429 // Mark it as fixed
5430 this[ jQuery.expando ] = true;
5431};
5432
5433// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
5434// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
5435jQuery.Event.prototype = {
5436 constructor: jQuery.Event,
5437 isDefaultPrevented: returnFalse,
5438 isPropagationStopped: returnFalse,
5439 isImmediatePropagationStopped: returnFalse,
5440 isSimulated: false,
5441
5442 preventDefault: function() {
5443 var e = this.originalEvent;
5444
5445 this.isDefaultPrevented = returnTrue;
5446
5447 if ( e && !this.isSimulated ) {
5448 e.preventDefault();
5449 }
5450 },
5451 stopPropagation: function() {
5452 var e = this.originalEvent;
5453
5454 this.isPropagationStopped = returnTrue;
5455
5456 if ( e && !this.isSimulated ) {
5457 e.stopPropagation();
5458 }
5459 },
5460 stopImmediatePropagation: function() {
5461 var e = this.originalEvent;
5462
5463 this.isImmediatePropagationStopped = returnTrue;
5464
5465 if ( e && !this.isSimulated ) {
5466 e.stopImmediatePropagation();
5467 }
5468
5469 this.stopPropagation();
5470 }
5471};
5472
5473// Includes all common event props including KeyEvent and MouseEvent specific props
5474jQuery.each( {
5475 altKey: true,
5476 bubbles: true,
5477 cancelable: true,
5478 changedTouches: true,
5479 ctrlKey: true,
5480 detail: true,
5481 eventPhase: true,
5482 metaKey: true,
5483 pageX: true,
5484 pageY: true,
5485 shiftKey: true,
5486 view: true,
5487 "char": true,
5488 charCode: true,
5489 key: true,
5490 keyCode: true,
5491 button: true,
5492 buttons: true,
5493 clientX: true,
5494 clientY: true,
5495 offsetX: true,
5496 offsetY: true,
5497 pointerId: true,
5498 pointerType: true,
5499 screenX: true,
5500 screenY: true,
5501 targetTouches: true,
5502 toElement: true,
5503 touches: true,
5504
5505 which: function( event ) {
5506 var button = event.button;
5507
5508 // Add which for key events
5509 if ( event.which == null && rkeyEvent.test( event.type ) ) {
5510 return event.charCode != null ? event.charCode : event.keyCode;
5511 }
5512
5513 // Add which for click: 1 === left; 2 === middle; 3 === right
5514 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
5515 if ( button & 1 ) {
5516 return 1;
5517 }
5518
5519 if ( button & 2 ) {
5520 return 3;
5521 }
5522
5523 if ( button & 4 ) {
5524 return 2;
5525 }
5526
5527 return 0;
5528 }
5529
5530 return event.which;
5531 }
5532}, jQuery.event.addProp );
5533
5534// Create mouseenter/leave events using mouseover/out and event-time checks
5535// so that event delegation works in jQuery.
5536// Do the same for pointerenter/pointerleave and pointerover/pointerout
5537//
5538// Support: Safari 7 only
5539// Safari sends mouseenter too often; see:
5540// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
5541// for the description of the bug (it existed in older Chrome versions as well).
5542jQuery.each( {
5543 mouseenter: "mouseover",
5544 mouseleave: "mouseout",
5545 pointerenter: "pointerover",
5546 pointerleave: "pointerout"
5547}, function( orig, fix ) {
5548 jQuery.event.special[ orig ] = {
5549 delegateType: fix,
5550 bindType: fix,
5551
5552 handle: function( event ) {
5553 var ret,
5554 target = this,
5555 related = event.relatedTarget,
5556 handleObj = event.handleObj;
5557
5558 // For mouseenter/leave call the handler if related is outside the target.
5559 // NB: No relatedTarget if the mouse left/entered the browser window
5560 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
5561 event.type = handleObj.origType;
5562 ret = handleObj.handler.apply( this, arguments );
5563 event.type = fix;
5564 }
5565 return ret;
5566 }
5567 };
5568} );
5569
5570jQuery.fn.extend( {
5571
5572 on: function( types, selector, data, fn ) {
5573 return on( this, types, selector, data, fn );
5574 },
5575 one: function( types, selector, data, fn ) {
5576 return on( this, types, selector, data, fn, 1 );
5577 },
5578 off: function( types, selector, fn ) {
5579 var handleObj, type;
5580 if ( types && types.preventDefault && types.handleObj ) {
5581
5582 // ( event ) dispatched jQuery.Event
5583 handleObj = types.handleObj;
5584 jQuery( types.delegateTarget ).off(
5585 handleObj.namespace ?
5586 handleObj.origType + "." + handleObj.namespace :
5587 handleObj.origType,
5588 handleObj.selector,
5589 handleObj.handler
5590 );
5591 return this;
5592 }
5593 if ( typeof types === "object" ) {
5594
5595 // ( types-object [, selector] )
5596 for ( type in types ) {
5597 this.off( type, selector, types[ type ] );
5598 }
5599 return this;
5600 }
5601 if ( selector === false || typeof selector === "function" ) {
5602
5603 // ( types [, fn] )
5604 fn = selector;
5605 selector = undefined;
5606 }
5607 if ( fn === false ) {
5608 fn = returnFalse;
5609 }
5610 return this.each( function() {
5611 jQuery.event.remove( this, types, fn, selector );
5612 } );
5613 }
5614} );
5615
5616
5617var
5618
5619 /* eslint-disable max-len */
5620
5621 // See https://github.com/eslint/eslint/issues/3229
5622 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
5623
5624 /* eslint-enable */
5625
5626 // Support: IE <=10 - 11, Edge 12 - 13
5627 // In IE/Edge using regex groups here causes severe slowdowns.
5628 // See https://connect.microsoft.com/IE/feedback/details/1736512/
5629 rnoInnerhtml = /<script|<style|<link/i,
5630
5631 // checked="checked" or checked
5632 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5633 rscriptTypeMasked = /^true\/(.*)/,
5634 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
5635
5636// Prefer a tbody over its parent table for containing new rows
5637function manipulationTarget( elem, content ) {
5638 if ( nodeName( elem, "table" ) &&
5639 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5640
5641 return jQuery( ">tbody", elem )[ 0 ] || elem;
5642 }
5643
5644 return elem;
5645}
5646
5647// Replace/restore the type attribute of script elements for safe DOM manipulation
5648function disableScript( elem ) {
5649 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
5650 return elem;
5651}
5652function restoreScript( elem ) {
5653 var match = rscriptTypeMasked.exec( elem.type );
5654
5655 if ( match ) {
5656 elem.type = match[ 1 ];
5657 } else {
5658 elem.removeAttribute( "type" );
5659 }
5660
5661 return elem;
5662}
5663
5664function cloneCopyEvent( src, dest ) {
5665 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
5666
5667 if ( dest.nodeType !== 1 ) {
5668 return;
5669 }
5670
5671 // 1. Copy private data: events, handlers, etc.
5672 if ( dataPriv.hasData( src ) ) {
5673 pdataOld = dataPriv.access( src );
5674 pdataCur = dataPriv.set( dest, pdataOld );
5675 events = pdataOld.events;
5676
5677 if ( events ) {
5678 delete pdataCur.handle;
5679 pdataCur.events = {};
5680
5681 for ( type in events ) {
5682 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5683 jQuery.event.add( dest, type, events[ type ][ i ] );
5684 }
5685 }
5686 }
5687 }
5688
5689 // 2. Copy user data
5690 if ( dataUser.hasData( src ) ) {
5691 udataOld = dataUser.access( src );
5692 udataCur = jQuery.extend( {}, udataOld );
5693
5694 dataUser.set( dest, udataCur );
5695 }
5696}
5697
5698// Fix IE bugs, see support tests
5699function fixInput( src, dest ) {
5700 var nodeName = dest.nodeName.toLowerCase();
5701
5702 // Fails to persist the checked state of a cloned checkbox or radio button.
5703 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5704 dest.checked = src.checked;
5705
5706 // Fails to return the selected option to the default selected state when cloning options
5707 } else if ( nodeName === "input" || nodeName === "textarea" ) {
5708 dest.defaultValue = src.defaultValue;
5709 }
5710}
5711
5712function domManip( collection, args, callback, ignored ) {
5713
5714 // Flatten any nested arrays
5715 args = concat.apply( [], args );
5716
5717 var fragment, first, scripts, hasScripts, node, doc,
5718 i = 0,
5719 l = collection.length,
5720 iNoClone = l - 1,
5721 value = args[ 0 ],
5722 isFunction = jQuery.isFunction( value );
5723
5724 // We can't cloneNode fragments that contain checked, in WebKit
5725 if ( isFunction ||
5726 ( l > 1 && typeof value === "string" &&
5727 !support.checkClone && rchecked.test( value ) ) ) {
5728 return collection.each( function( index ) {
5729 var self = collection.eq( index );
5730 if ( isFunction ) {
5731 args[ 0 ] = value.call( this, index, self.html() );
5732 }
5733 domManip( self, args, callback, ignored );
5734 } );
5735 }
5736
5737 if ( l ) {
5738 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
5739 first = fragment.firstChild;
5740
5741 if ( fragment.childNodes.length === 1 ) {
5742 fragment = first;
5743 }
5744
5745 // Require either new content or an interest in ignored elements to invoke the callback
5746 if ( first || ignored ) {
5747 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5748 hasScripts = scripts.length;
5749
5750 // Use the original fragment for the last item
5751 // instead of the first because it can end up
5752 // being emptied incorrectly in certain situations (#8070).
5753 for ( ; i < l; i++ ) {
5754 node = fragment;
5755
5756 if ( i !== iNoClone ) {
5757 node = jQuery.clone( node, true, true );
5758
5759 // Keep references to cloned scripts for later restoration
5760 if ( hasScripts ) {
5761
5762 // Support: Android <=4.0 only, PhantomJS 1 only
5763 // push.apply(_, arraylike) throws on ancient WebKit
5764 jQuery.merge( scripts, getAll( node, "script" ) );
5765 }
5766 }
5767
5768 callback.call( collection[ i ], node, i );
5769 }
5770
5771 if ( hasScripts ) {
5772 doc = scripts[ scripts.length - 1 ].ownerDocument;
5773
5774 // Reenable scripts
5775 jQuery.map( scripts, restoreScript );
5776
5777 // Evaluate executable scripts on first document insertion
5778 for ( i = 0; i < hasScripts; i++ ) {
5779 node = scripts[ i ];
5780 if ( rscriptType.test( node.type || "" ) &&
5781 !dataPriv.access( node, "globalEval" ) &&
5782 jQuery.contains( doc, node ) ) {
5783
5784 if ( node.src ) {
5785
5786 // Optional AJAX dependency, but won't run scripts if not present
5787 if ( jQuery._evalUrl ) {
5788 jQuery._evalUrl( node.src );
5789 }
5790 } else {
5791 DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
5792 }
5793 }
5794 }
5795 }
5796 }
5797 }
5798
5799 return collection;
5800}
5801
5802function remove( elem, selector, keepData ) {
5803 var node,
5804 nodes = selector ? jQuery.filter( selector, elem ) : elem,
5805 i = 0;
5806
5807 for ( ; ( node = nodes[ i ] ) != null; i++ ) {
5808 if ( !keepData && node.nodeType === 1 ) {
5809 jQuery.cleanData( getAll( node ) );
5810 }
5811
5812 if ( node.parentNode ) {
5813 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
5814 setGlobalEval( getAll( node, "script" ) );
5815 }
5816 node.parentNode.removeChild( node );
5817 }
5818 }
5819
5820 return elem;
5821}
5822
5823jQuery.extend( {
5824 htmlPrefilter: function( html ) {
5825 return html.replace( rxhtmlTag, "<$1></$2>" );
5826 },
5827
5828 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5829 var i, l, srcElements, destElements,
5830 clone = elem.cloneNode( true ),
5831 inPage = jQuery.contains( elem.ownerDocument, elem );
5832
5833 // Fix IE cloning issues
5834 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
5835 !jQuery.isXMLDoc( elem ) ) {
5836
5837 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
5838 destElements = getAll( clone );
5839 srcElements = getAll( elem );
5840
5841 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5842 fixInput( srcElements[ i ], destElements[ i ] );
5843 }
5844 }
5845
5846 // Copy the events from the original to the clone
5847 if ( dataAndEvents ) {
5848 if ( deepDataAndEvents ) {
5849 srcElements = srcElements || getAll( elem );
5850 destElements = destElements || getAll( clone );
5851
5852 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5853 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
5854 }
5855 } else {
5856 cloneCopyEvent( elem, clone );
5857 }
5858 }
5859
5860 // Preserve script evaluation history
5861 destElements = getAll( clone, "script" );
5862 if ( destElements.length > 0 ) {
5863 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
5864 }
5865
5866 // Return the cloned set
5867 return clone;
5868 },
5869
5870 cleanData: function( elems ) {
5871 var data, elem, type,
5872 special = jQuery.event.special,
5873 i = 0;
5874
5875 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
5876 if ( acceptData( elem ) ) {
5877 if ( ( data = elem[ dataPriv.expando ] ) ) {
5878 if ( data.events ) {
5879 for ( type in data.events ) {
5880 if ( special[ type ] ) {
5881 jQuery.event.remove( elem, type );
5882
5883 // This is a shortcut to avoid jQuery.event.remove's overhead
5884 } else {
5885 jQuery.removeEvent( elem, type, data.handle );
5886 }
5887 }
5888 }
5889
5890 // Support: Chrome <=35 - 45+
5891 // Assign undefined instead of using delete, see Data#remove
5892 elem[ dataPriv.expando ] = undefined;
5893 }
5894 if ( elem[ dataUser.expando ] ) {
5895
5896 // Support: Chrome <=35 - 45+
5897 // Assign undefined instead of using delete, see Data#remove
5898 elem[ dataUser.expando ] = undefined;
5899 }
5900 }
5901 }
5902 }
5903} );
5904
5905jQuery.fn.extend( {
5906 detach: function( selector ) {
5907 return remove( this, selector, true );
5908 },
5909
5910 remove: function( selector ) {
5911 return remove( this, selector );
5912 },
5913
5914 text: function( value ) {
5915 return access( this, function( value ) {
5916 return value === undefined ?
5917 jQuery.text( this ) :
5918 this.empty().each( function() {
5919 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5920 this.textContent = value;
5921 }
5922 } );
5923 }, null, value, arguments.length );
5924 },
5925
5926 append: function() {
5927 return domManip( this, arguments, function( elem ) {
5928 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5929 var target = manipulationTarget( this, elem );
5930 target.appendChild( elem );
5931 }
5932 } );
5933 },
5934
5935 prepend: function() {
5936 return domManip( this, arguments, function( elem ) {
5937 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5938 var target = manipulationTarget( this, elem );
5939 target.insertBefore( elem, target.firstChild );
5940 }
5941 } );
5942 },
5943
5944 before: function() {
5945 return domManip( this, arguments, function( elem ) {
5946 if ( this.parentNode ) {
5947 this.parentNode.insertBefore( elem, this );
5948 }
5949 } );
5950 },
5951
5952 after: function() {
5953 return domManip( this, arguments, function( elem ) {
5954 if ( this.parentNode ) {
5955 this.parentNode.insertBefore( elem, this.nextSibling );
5956 }
5957 } );
5958 },
5959
5960 empty: function() {
5961 var elem,
5962 i = 0;
5963
5964 for ( ; ( elem = this[ i ] ) != null; i++ ) {
5965 if ( elem.nodeType === 1 ) {
5966
5967 // Prevent memory leaks
5968 jQuery.cleanData( getAll( elem, false ) );
5969
5970 // Remove any remaining nodes
5971 elem.textContent = "";
5972 }
5973 }
5974
5975 return this;
5976 },
5977
5978 clone: function( dataAndEvents, deepDataAndEvents ) {
5979 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5980 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5981
5982 return this.map( function() {
5983 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5984 } );
5985 },
5986
5987 html: function( value ) {
5988 return access( this, function( value ) {
5989 var elem = this[ 0 ] || {},
5990 i = 0,
5991 l = this.length;
5992
5993 if ( value === undefined && elem.nodeType === 1 ) {
5994 return elem.innerHTML;
5995 }
5996
5997 // See if we can take a shortcut and just use innerHTML
5998 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5999 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
6000
6001 value = jQuery.htmlPrefilter( value );
6002
6003 try {
6004 for ( ; i < l; i++ ) {
6005 elem = this[ i ] || {};
6006
6007 // Remove element nodes and prevent memory leaks
6008 if ( elem.nodeType === 1 ) {
6009 jQuery.cleanData( getAll( elem, false ) );
6010 elem.innerHTML = value;
6011 }
6012 }
6013
6014 elem = 0;
6015
6016 // If using innerHTML throws an exception, use the fallback method
6017 } catch ( e ) {}
6018 }
6019
6020 if ( elem ) {
6021 this.empty().append( value );
6022 }
6023 }, null, value, arguments.length );
6024 },
6025
6026 replaceWith: function() {
6027 var ignored = [];
6028
6029 // Make the changes, replacing each non-ignored context element with the new content
6030 return domManip( this, arguments, function( elem ) {
6031 var parent = this.parentNode;
6032
6033 if ( jQuery.inArray( this, ignored ) < 0 ) {
6034 jQuery.cleanData( getAll( this ) );
6035 if ( parent ) {
6036 parent.replaceChild( elem, this );
6037 }
6038 }
6039
6040 // Force callback invocation
6041 }, ignored );
6042 }
6043} );
6044
6045jQuery.each( {
6046 appendTo: "append",
6047 prependTo: "prepend",
6048 insertBefore: "before",
6049 insertAfter: "after",
6050 replaceAll: "replaceWith"
6051}, function( name, original ) {
6052 jQuery.fn[ name ] = function( selector ) {
6053 var elems,
6054 ret = [],
6055 insert = jQuery( selector ),
6056 last = insert.length - 1,
6057 i = 0;
6058
6059 for ( ; i <= last; i++ ) {
6060 elems = i === last ? this : this.clone( true );
6061 jQuery( insert[ i ] )[ original ]( elems );
6062
6063 // Support: Android <=4.0 only, PhantomJS 1 only
6064 // .get() because push.apply(_, arraylike) throws on ancient WebKit
6065 push.apply( ret, elems.get() );
6066 }
6067
6068 return this.pushStack( ret );
6069 };
6070} );
6071var rmargin = ( /^margin/ );
6072
6073var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6074
6075var getStyles = function( elem ) {
6076
6077 // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
6078 // IE throws on elements created in popups
6079 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
6080 var view = elem.ownerDocument.defaultView;
6081
6082 if ( !view || !view.opener ) {
6083 view = window;
6084 }
6085
6086 return view.getComputedStyle( elem );
6087 };
6088
6089
6090
6091( function() {
6092
6093 // Executing both pixelPosition & boxSizingReliable tests require only one layout
6094 // so they're executed at the same time to save the second computation.
6095 function computeStyleTests() {
6096
6097 // This is a singleton, we need to execute it only once
6098 if ( !div ) {
6099 return;
6100 }
6101
6102 div.style.cssText =
6103 "box-sizing:border-box;" +
6104 "position:relative;display:block;" +
6105 "margin:auto;border:1px;padding:1px;" +
6106 "top:1%;width:50%";
6107 div.innerHTML = "";
6108 documentElement.appendChild( container );
6109
6110 var divStyle = window.getComputedStyle( div );
6111 pixelPositionVal = divStyle.top !== "1%";
6112
6113 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
6114 reliableMarginLeftVal = divStyle.marginLeft === "2px";
6115 boxSizingReliableVal = divStyle.width === "4px";
6116
6117 // Support: Android 4.0 - 4.3 only
6118 // Some styles come back with percentage values, even though they shouldn't
6119 div.style.marginRight = "50%";
6120 pixelMarginRightVal = divStyle.marginRight === "4px";
6121
6122 documentElement.removeChild( container );
6123
6124 // Nullify the div so it wouldn't be stored in the memory and
6125 // it will also be a sign that checks already performed
6126 div = null;
6127 }
6128
6129 var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
6130 container = document.createElement( "div" ),
6131 div = document.createElement( "div" );
6132
6133 // Finish early in limited (non-browser) environments
6134 if ( !div.style ) {
6135 return;
6136 }
6137
6138 // Support: IE <=9 - 11 only
6139 // Style of cloned element affects source element cloned (#8908)
6140 div.style.backgroundClip = "content-box";
6141 div.cloneNode( true ).style.backgroundClip = "";
6142 support.clearCloneStyle = div.style.backgroundClip === "content-box";
6143
6144 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
6145 "padding:0;margin-top:1px;position:absolute";
6146 container.appendChild( div );
6147
6148 jQuery.extend( support, {
6149 pixelPosition: function() {
6150 computeStyleTests();
6151 return pixelPositionVal;
6152 },
6153 boxSizingReliable: function() {
6154 computeStyleTests();
6155 return boxSizingReliableVal;
6156 },
6157 pixelMarginRight: function() {
6158 computeStyleTests();
6159 return pixelMarginRightVal;
6160 },
6161 reliableMarginLeft: function() {
6162 computeStyleTests();
6163 return reliableMarginLeftVal;
6164 }
6165 } );
6166} )();
6167
6168
6169function curCSS( elem, name, computed ) {
6170 var width, minWidth, maxWidth, ret,
6171
6172 // Support: Firefox 51+
6173 // Retrieving style before computed somehow
6174 // fixes an issue with getting wrong values
6175 // on detached elements
6176 style = elem.style;
6177
6178 computed = computed || getStyles( elem );
6179
6180 // getPropertyValue is needed for:
6181 // .css('filter') (IE 9 only, #12537)
6182 // .css('--customProperty) (#3144)
6183 if ( computed ) {
6184 ret = computed.getPropertyValue( name ) || computed[ name ];
6185
6186 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
6187 ret = jQuery.style( elem, name );
6188 }
6189
6190 // A tribute to the "awesome hack by Dean Edwards"
6191 // Android Browser returns percentage for some values,
6192 // but width seems to be reliably pixels.
6193 // This is against the CSSOM draft spec:
6194 // https://drafts.csswg.org/cssom/#resolved-values
6195 if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
6196
6197 // Remember the original values
6198 width = style.width;
6199 minWidth = style.minWidth;
6200 maxWidth = style.maxWidth;
6201
6202 // Put in the new values to get a computed value out
6203 style.minWidth = style.maxWidth = style.width = ret;
6204 ret = computed.width;
6205
6206 // Revert the changed values
6207 style.width = width;
6208 style.minWidth = minWidth;
6209 style.maxWidth = maxWidth;
6210 }
6211 }
6212
6213 return ret !== undefined ?
6214
6215 // Support: IE <=9 - 11 only
6216 // IE returns zIndex value as an integer.
6217 ret + "" :
6218 ret;
6219}
6220
6221
6222function addGetHookIf( conditionFn, hookFn ) {
6223
6224 // Define the hook, we'll check on the first run if it's really needed.
6225 return {
6226 get: function() {
6227 if ( conditionFn() ) {
6228
6229 // Hook not needed (or it's not possible to use it due
6230 // to missing dependency), remove it.
6231 delete this.get;
6232 return;
6233 }
6234
6235 // Hook needed; redefine it so that the support test is not executed again.
6236 return ( this.get = hookFn ).apply( this, arguments );
6237 }
6238 };
6239}
6240
6241
6242var
6243
6244 // Swappable if display is none or starts with table
6245 // except "table", "table-cell", or "table-caption"
6246 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6247 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6248 rcustomProp = /^--/,
6249 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6250 cssNormalTransform = {
6251 letterSpacing: "0",
6252 fontWeight: "400"
6253 },
6254
6255 cssPrefixes = [ "Webkit", "Moz", "ms" ],
6256 emptyStyle = document.createElement( "div" ).style;
6257
6258// Return a css property mapped to a potentially vendor prefixed property
6259function vendorPropName( name ) {
6260
6261 // Shortcut for names that are not vendor prefixed
6262 if ( name in emptyStyle ) {
6263 return name;
6264 }
6265
6266 // Check for vendor prefixed names
6267 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
6268 i = cssPrefixes.length;
6269
6270 while ( i-- ) {
6271 name = cssPrefixes[ i ] + capName;
6272 if ( name in emptyStyle ) {
6273 return name;
6274 }
6275 }
6276}
6277
6278// Return a property mapped along what jQuery.cssProps suggests or to
6279// a vendor prefixed property.
6280function finalPropName( name ) {
6281 var ret = jQuery.cssProps[ name ];
6282 if ( !ret ) {
6283 ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
6284 }
6285 return ret;
6286}
6287
6288function setPositiveNumber( elem, value, subtract ) {
6289
6290 // Any relative (+/-) values have already been
6291 // normalized at this point
6292 var matches = rcssNum.exec( value );
6293 return matches ?
6294
6295 // Guard against undefined "subtract", e.g., when used as in cssHooks
6296 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
6297 value;
6298}
6299
6300function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
6301 var i,
6302 val = 0;
6303
6304 // If we already have the right measurement, avoid augmentation
6305 if ( extra === ( isBorderBox ? "border" : "content" ) ) {
6306 i = 4;
6307
6308 // Otherwise initialize for horizontal or vertical properties
6309 } else {
6310 i = name === "width" ? 1 : 0;
6311 }
6312
6313 for ( ; i < 4; i += 2 ) {
6314
6315 // Both box models exclude margin, so add it if we want it
6316 if ( extra === "margin" ) {
6317 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
6318 }
6319
6320 if ( isBorderBox ) {
6321
6322 // border-box includes padding, so remove it if we want content
6323 if ( extra === "content" ) {
6324 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6325 }
6326
6327 // At this point, extra isn't border nor margin, so remove border
6328 if ( extra !== "margin" ) {
6329 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6330 }
6331 } else {
6332
6333 // At this point, extra isn't content, so add padding
6334 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6335
6336 // At this point, extra isn't content nor padding, so add border
6337 if ( extra !== "padding" ) {
6338 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6339 }
6340 }
6341 }
6342
6343 return val;
6344}
6345
6346function getWidthOrHeight( elem, name, extra ) {
6347
6348 // Start with computed style
6349 var valueIsBorderBox,
6350 styles = getStyles( elem ),
6351 val = curCSS( elem, name, styles ),
6352 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6353
6354 // Computed unit is not pixels. Stop here and return.
6355 if ( rnumnonpx.test( val ) ) {
6356 return val;
6357 }
6358
6359 // Check for style in case a browser which returns unreliable values
6360 // for getComputedStyle silently falls back to the reliable elem.style
6361 valueIsBorderBox = isBorderBox &&
6362 ( support.boxSizingReliable() || val === elem.style[ name ] );
6363
6364 // Fall back to offsetWidth/Height when value is "auto"
6365 // This happens for inline elements with no explicit setting (gh-3571)
6366 if ( val === "auto" ) {
6367 val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
6368 }
6369
6370 // Normalize "", auto, and prepare for extra
6371 val = parseFloat( val ) || 0;
6372
6373 // Use the active box-sizing model to add/subtract irrelevant styles
6374 return ( val +
6375 augmentWidthOrHeight(
6376 elem,
6377 name,
6378 extra || ( isBorderBox ? "border" : "content" ),
6379 valueIsBorderBox,
6380 styles
6381 )
6382 ) + "px";
6383}
6384
6385jQuery.extend( {
6386
6387 // Add in style property hooks for overriding the default
6388 // behavior of getting and setting a style property
6389 cssHooks: {
6390 opacity: {
6391 get: function( elem, computed ) {
6392 if ( computed ) {
6393
6394 // We should always get a number back from opacity
6395 var ret = curCSS( elem, "opacity" );
6396 return ret === "" ? "1" : ret;
6397 }
6398 }
6399 }
6400 },
6401
6402 // Don't automatically add "px" to these possibly-unitless properties
6403 cssNumber: {
6404 "animationIterationCount": true,
6405 "columnCount": true,
6406 "fillOpacity": true,
6407 "flexGrow": true,
6408 "flexShrink": true,
6409 "fontWeight": true,
6410 "lineHeight": true,
6411 "opacity": true,
6412 "order": true,
6413 "orphans": true,
6414 "widows": true,
6415 "zIndex": true,
6416 "zoom": true
6417 },
6418
6419 // Add in properties whose names you wish to fix before
6420 // setting or getting the value
6421 cssProps: {
6422 "float": "cssFloat"
6423 },
6424
6425 // Get and set the style property on a DOM Node
6426 style: function( elem, name, value, extra ) {
6427
6428 // Don't set styles on text and comment nodes
6429 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6430 return;
6431 }
6432
6433 // Make sure that we're working with the right name
6434 var ret, type, hooks,
6435 origName = jQuery.camelCase( name ),
6436 isCustomProp = rcustomProp.test( name ),
6437 style = elem.style;
6438
6439 // Make sure that we're working with the right name. We don't
6440 // want to query the value if it is a CSS custom property
6441 // since they are user-defined.
6442 if ( !isCustomProp ) {
6443 name = finalPropName( origName );
6444 }
6445
6446 // Gets hook for the prefixed version, then unprefixed version
6447 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6448
6449 // Check if we're setting a value
6450 if ( value !== undefined ) {
6451 type = typeof value;
6452
6453 // Convert "+=" or "-=" to relative numbers (#7345)
6454 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
6455 value = adjustCSS( elem, name, ret );
6456
6457 // Fixes bug #9237
6458 type = "number";
6459 }
6460
6461 // Make sure that null and NaN values aren't set (#7116)
6462 if ( value == null || value !== value ) {
6463 return;
6464 }
6465
6466 // If a number was passed in, add the unit (except for certain CSS properties)
6467 if ( type === "number" ) {
6468 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
6469 }
6470
6471 // background-* props affect original clone's values
6472 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
6473 style[ name ] = "inherit";
6474 }
6475
6476 // If a hook was provided, use that value, otherwise just set the specified value
6477 if ( !hooks || !( "set" in hooks ) ||
6478 ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
6479
6480 if ( isCustomProp ) {
6481 style.setProperty( name, value );
6482 } else {
6483 style[ name ] = value;
6484 }
6485 }
6486
6487 } else {
6488
6489 // If a hook was provided get the non-computed value from there
6490 if ( hooks && "get" in hooks &&
6491 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
6492
6493 return ret;
6494 }
6495
6496 // Otherwise just get the value from the style object
6497 return style[ name ];
6498 }
6499 },
6500
6501 css: function( elem, name, extra, styles ) {
6502 var val, num, hooks,
6503 origName = jQuery.camelCase( name ),
6504 isCustomProp = rcustomProp.test( name );
6505
6506 // Make sure that we're working with the right name. We don't
6507 // want to modify the value if it is a CSS custom property
6508 // since they are user-defined.
6509 if ( !isCustomProp ) {
6510 name = finalPropName( origName );
6511 }
6512
6513 // Try prefixed name followed by the unprefixed name
6514 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6515
6516 // If a hook was provided get the computed value from there
6517 if ( hooks && "get" in hooks ) {
6518 val = hooks.get( elem, true, extra );
6519 }
6520
6521 // Otherwise, if a way to get the computed value exists, use that
6522 if ( val === undefined ) {
6523 val = curCSS( elem, name, styles );
6524 }
6525
6526 // Convert "normal" to computed value
6527 if ( val === "normal" && name in cssNormalTransform ) {
6528 val = cssNormalTransform[ name ];
6529 }
6530
6531 // Make numeric if forced or a qualifier was provided and val looks numeric
6532 if ( extra === "" || extra ) {
6533 num = parseFloat( val );
6534 return extra === true || isFinite( num ) ? num || 0 : val;
6535 }
6536
6537 return val;
6538 }
6539} );
6540
6541jQuery.each( [ "height", "width" ], function( i, name ) {
6542 jQuery.cssHooks[ name ] = {
6543 get: function( elem, computed, extra ) {
6544 if ( computed ) {
6545
6546 // Certain elements can have dimension info if we invisibly show them
6547 // but it must have a current display style that would benefit
6548 return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
6549
6550 // Support: Safari 8+
6551 // Table columns in Safari have non-zero offsetWidth & zero
6552 // getBoundingClientRect().width unless display is changed.
6553 // Support: IE <=11 only
6554 // Running getBoundingClientRect on a disconnected node
6555 // in IE throws an error.
6556 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
6557 swap( elem, cssShow, function() {
6558 return getWidthOrHeight( elem, name, extra );
6559 } ) :
6560 getWidthOrHeight( elem, name, extra );
6561 }
6562 },
6563
6564 set: function( elem, value, extra ) {
6565 var matches,
6566 styles = extra && getStyles( elem ),
6567 subtract = extra && augmentWidthOrHeight(
6568 elem,
6569 name,
6570 extra,
6571 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6572 styles
6573 );
6574
6575 // Convert to pixels if value adjustment is needed
6576 if ( subtract && ( matches = rcssNum.exec( value ) ) &&
6577 ( matches[ 3 ] || "px" ) !== "px" ) {
6578
6579 elem.style[ name ] = value;
6580 value = jQuery.css( elem, name );
6581 }
6582
6583 return setPositiveNumber( elem, value, subtract );
6584 }
6585 };
6586} );
6587
6588jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
6589 function( elem, computed ) {
6590 if ( computed ) {
6591 return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
6592 elem.getBoundingClientRect().left -
6593 swap( elem, { marginLeft: 0 }, function() {
6594 return elem.getBoundingClientRect().left;
6595 } )
6596 ) + "px";
6597 }
6598 }
6599);
6600
6601// These hooks are used by animate to expand properties
6602jQuery.each( {
6603 margin: "",
6604 padding: "",
6605 border: "Width"
6606}, function( prefix, suffix ) {
6607 jQuery.cssHooks[ prefix + suffix ] = {
6608 expand: function( value ) {
6609 var i = 0,
6610 expanded = {},
6611
6612 // Assumes a single number if not a string
6613 parts = typeof value === "string" ? value.split( " " ) : [ value ];
6614
6615 for ( ; i < 4; i++ ) {
6616 expanded[ prefix + cssExpand[ i ] + suffix ] =
6617 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6618 }
6619
6620 return expanded;
6621 }
6622 };
6623
6624 if ( !rmargin.test( prefix ) ) {
6625 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6626 }
6627} );
6628
6629jQuery.fn.extend( {
6630 css: function( name, value ) {
6631 return access( this, function( elem, name, value ) {
6632 var styles, len,
6633 map = {},
6634 i = 0;
6635
6636 if ( Array.isArray( name ) ) {
6637 styles = getStyles( elem );
6638 len = name.length;
6639
6640 for ( ; i < len; i++ ) {
6641 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6642 }
6643
6644 return map;
6645 }
6646
6647 return value !== undefined ?
6648 jQuery.style( elem, name, value ) :
6649 jQuery.css( elem, name );
6650 }, name, value, arguments.length > 1 );
6651 }
6652} );
6653
6654
6655function Tween( elem, options, prop, end, easing ) {
6656 return new Tween.prototype.init( elem, options, prop, end, easing );
6657}
6658jQuery.Tween = Tween;
6659
6660Tween.prototype = {
6661 constructor: Tween,
6662 init: function( elem, options, prop, end, easing, unit ) {
6663 this.elem = elem;
6664 this.prop = prop;
6665 this.easing = easing || jQuery.easing._default;
6666 this.options = options;
6667 this.start = this.now = this.cur();
6668 this.end = end;
6669 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
6670 },
6671 cur: function() {
6672 var hooks = Tween.propHooks[ this.prop ];
6673
6674 return hooks && hooks.get ?
6675 hooks.get( this ) :
6676 Tween.propHooks._default.get( this );
6677 },
6678 run: function( percent ) {
6679 var eased,
6680 hooks = Tween.propHooks[ this.prop ];
6681
6682 if ( this.options.duration ) {
6683 this.pos = eased = jQuery.easing[ this.easing ](
6684 percent, this.options.duration * percent, 0, 1, this.options.duration
6685 );
6686 } else {
6687 this.pos = eased = percent;
6688 }
6689 this.now = ( this.end - this.start ) * eased + this.start;
6690
6691 if ( this.options.step ) {
6692 this.options.step.call( this.elem, this.now, this );
6693 }
6694
6695 if ( hooks && hooks.set ) {
6696 hooks.set( this );
6697 } else {
6698 Tween.propHooks._default.set( this );
6699 }
6700 return this;
6701 }
6702};
6703
6704Tween.prototype.init.prototype = Tween.prototype;
6705
6706Tween.propHooks = {
6707 _default: {
6708 get: function( tween ) {
6709 var result;
6710
6711 // Use a property on the element directly when it is not a DOM element,
6712 // or when there is no matching style property that exists.
6713 if ( tween.elem.nodeType !== 1 ||
6714 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
6715 return tween.elem[ tween.prop ];
6716 }
6717
6718 // Passing an empty string as a 3rd parameter to .css will automatically
6719 // attempt a parseFloat and fallback to a string if the parse fails.
6720 // Simple values such as "10px" are parsed to Float;
6721 // complex values such as "rotate(1rad)" are returned as-is.
6722 result = jQuery.css( tween.elem, tween.prop, "" );
6723
6724 // Empty strings, null, undefined and "auto" are converted to 0.
6725 return !result || result === "auto" ? 0 : result;
6726 },
6727 set: function( tween ) {
6728
6729 // Use step hook for back compat.
6730 // Use cssHook if its there.
6731 // Use .style if available and use plain properties where available.
6732 if ( jQuery.fx.step[ tween.prop ] ) {
6733 jQuery.fx.step[ tween.prop ]( tween );
6734 } else if ( tween.elem.nodeType === 1 &&
6735 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
6736 jQuery.cssHooks[ tween.prop ] ) ) {
6737 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
6738 } else {
6739 tween.elem[ tween.prop ] = tween.now;
6740 }
6741 }
6742 }
6743};
6744
6745// Support: IE <=9 only
6746// Panic based approach to setting things on disconnected nodes
6747Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
6748 set: function( tween ) {
6749 if ( tween.elem.nodeType && tween.elem.parentNode ) {
6750 tween.elem[ tween.prop ] = tween.now;
6751 }
6752 }
6753};
6754
6755jQuery.easing = {
6756 linear: function( p ) {
6757 return p;
6758 },
6759 swing: function( p ) {
6760 return 0.5 - Math.cos( p * Math.PI ) / 2;
6761 },
6762 _default: "swing"
6763};
6764
6765jQuery.fx = Tween.prototype.init;
6766
6767// Back compat <1.8 extension point
6768jQuery.fx.step = {};
6769
6770
6771
6772
6773var
6774 fxNow, inProgress,
6775 rfxtypes = /^(?:toggle|show|hide)$/,
6776 rrun = /queueHooks$/;
6777
6778function schedule() {
6779 if ( inProgress ) {
6780 if ( document.hidden === false && window.requestAnimationFrame ) {
6781 window.requestAnimationFrame( schedule );
6782 } else {
6783 window.setTimeout( schedule, jQuery.fx.interval );
6784 }
6785
6786 jQuery.fx.tick();
6787 }
6788}
6789
6790// Animations created synchronously will run synchronously
6791function createFxNow() {
6792 window.setTimeout( function() {
6793 fxNow = undefined;
6794 } );
6795 return ( fxNow = jQuery.now() );
6796}
6797
6798// Generate parameters to create a standard animation
6799function genFx( type, includeWidth ) {
6800 var which,
6801 i = 0,
6802 attrs = { height: type };
6803
6804 // If we include width, step value is 1 to do all cssExpand values,
6805 // otherwise step value is 2 to skip over Left and Right
6806 includeWidth = includeWidth ? 1 : 0;
6807 for ( ; i < 4; i += 2 - includeWidth ) {
6808 which = cssExpand[ i ];
6809 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
6810 }
6811
6812 if ( includeWidth ) {
6813 attrs.opacity = attrs.width = type;
6814 }
6815
6816 return attrs;
6817}
6818
6819function createTween( value, prop, animation ) {
6820 var tween,
6821 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
6822 index = 0,
6823 length = collection.length;
6824 for ( ; index < length; index++ ) {
6825 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
6826
6827 // We're done with this property
6828 return tween;
6829 }
6830 }
6831}
6832
6833function defaultPrefilter( elem, props, opts ) {
6834 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
6835 isBox = "width" in props || "height" in props,
6836 anim = this,
6837 orig = {},
6838 style = elem.style,
6839 hidden = elem.nodeType && isHiddenWithinTree( elem ),
6840 dataShow = dataPriv.get( elem, "fxshow" );
6841
6842 // Queue-skipping animations hijack the fx hooks
6843 if ( !opts.queue ) {
6844 hooks = jQuery._queueHooks( elem, "fx" );
6845 if ( hooks.unqueued == null ) {
6846 hooks.unqueued = 0;
6847 oldfire = hooks.empty.fire;
6848 hooks.empty.fire = function() {
6849 if ( !hooks.unqueued ) {
6850 oldfire();
6851 }
6852 };
6853 }
6854 hooks.unqueued++;
6855
6856 anim.always( function() {
6857
6858 // Ensure the complete handler is called before this completes
6859 anim.always( function() {
6860 hooks.unqueued--;
6861 if ( !jQuery.queue( elem, "fx" ).length ) {
6862 hooks.empty.fire();
6863 }
6864 } );
6865 } );
6866 }
6867
6868 // Detect show/hide animations
6869 for ( prop in props ) {
6870 value = props[ prop ];
6871 if ( rfxtypes.test( value ) ) {
6872 delete props[ prop ];
6873 toggle = toggle || value === "toggle";
6874 if ( value === ( hidden ? "hide" : "show" ) ) {
6875
6876 // Pretend to be hidden if this is a "show" and
6877 // there is still data from a stopped show/hide
6878 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
6879 hidden = true;
6880
6881 // Ignore all other no-op show/hide data
6882 } else {
6883 continue;
6884 }
6885 }
6886 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
6887 }
6888 }
6889
6890 // Bail out if this is a no-op like .hide().hide()
6891 propTween = !jQuery.isEmptyObject( props );
6892 if ( !propTween && jQuery.isEmptyObject( orig ) ) {
6893 return;
6894 }
6895
6896 // Restrict "overflow" and "display" styles during box animations
6897 if ( isBox && elem.nodeType === 1 ) {
6898
6899 // Support: IE <=9 - 11, Edge 12 - 13
6900 // Record all 3 overflow attributes because IE does not infer the shorthand
6901 // from identically-valued overflowX and overflowY
6902 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
6903
6904 // Identify a display type, preferring old show/hide data over the CSS cascade
6905 restoreDisplay = dataShow && dataShow.display;
6906 if ( restoreDisplay == null ) {
6907 restoreDisplay = dataPriv.get( elem, "display" );
6908 }
6909 display = jQuery.css( elem, "display" );
6910 if ( display === "none" ) {
6911 if ( restoreDisplay ) {
6912 display = restoreDisplay;
6913 } else {
6914
6915 // Get nonempty value(s) by temporarily forcing visibility
6916 showHide( [ elem ], true );
6917 restoreDisplay = elem.style.display || restoreDisplay;
6918 display = jQuery.css( elem, "display" );
6919 showHide( [ elem ] );
6920 }
6921 }
6922
6923 // Animate inline elements as inline-block
6924 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
6925 if ( jQuery.css( elem, "float" ) === "none" ) {
6926
6927 // Restore the original display value at the end of pure show/hide animations
6928 if ( !propTween ) {
6929 anim.done( function() {
6930 style.display = restoreDisplay;
6931 } );
6932 if ( restoreDisplay == null ) {
6933 display = style.display;
6934 restoreDisplay = display === "none" ? "" : display;
6935 }
6936 }
6937 style.display = "inline-block";
6938 }
6939 }
6940 }
6941
6942 if ( opts.overflow ) {
6943 style.overflow = "hidden";
6944 anim.always( function() {
6945 style.overflow = opts.overflow[ 0 ];
6946 style.overflowX = opts.overflow[ 1 ];
6947 style.overflowY = opts.overflow[ 2 ];
6948 } );
6949 }
6950
6951 // Implement show/hide animations
6952 propTween = false;
6953 for ( prop in orig ) {
6954
6955 // General show/hide setup for this element animation
6956 if ( !propTween ) {
6957 if ( dataShow ) {
6958 if ( "hidden" in dataShow ) {
6959 hidden = dataShow.hidden;
6960 }
6961 } else {
6962 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
6963 }
6964
6965 // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
6966 if ( toggle ) {
6967 dataShow.hidden = !hidden;
6968 }
6969
6970 // Show elements before animating them
6971 if ( hidden ) {
6972 showHide( [ elem ], true );
6973 }
6974
6975 /* eslint-disable no-loop-func */
6976
6977 anim.done( function() {
6978
6979 /* eslint-enable no-loop-func */
6980
6981 // The final step of a "hide" animation is actually hiding the element
6982 if ( !hidden ) {
6983 showHide( [ elem ] );
6984 }
6985 dataPriv.remove( elem, "fxshow" );
6986 for ( prop in orig ) {
6987 jQuery.style( elem, prop, orig[ prop ] );
6988 }
6989 } );
6990 }
6991
6992 // Per-property setup
6993 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
6994 if ( !( prop in dataShow ) ) {
6995 dataShow[ prop ] = propTween.start;
6996 if ( hidden ) {
6997 propTween.end = propTween.start;
6998 propTween.start = 0;
6999 }
7000 }
7001 }
7002}
7003
7004function propFilter( props, specialEasing ) {
7005 var index, name, easing, value, hooks;
7006
7007 // camelCase, specialEasing and expand cssHook pass
7008 for ( index in props ) {
7009 name = jQuery.camelCase( index );
7010 easing = specialEasing[ name ];
7011 value = props[ index ];
7012 if ( Array.isArray( value ) ) {
7013 easing = value[ 1 ];
7014 value = props[ index ] = value[ 0 ];
7015 }
7016
7017 if ( index !== name ) {
7018 props[ name ] = value;
7019 delete props[ index ];
7020 }
7021
7022 hooks = jQuery.cssHooks[ name ];
7023 if ( hooks && "expand" in hooks ) {
7024 value = hooks.expand( value );
7025 delete props[ name ];
7026
7027 // Not quite $.extend, this won't overwrite existing keys.
7028 // Reusing 'index' because we have the correct "name"
7029 for ( index in value ) {
7030 if ( !( index in props ) ) {
7031 props[ index ] = value[ index ];
7032 specialEasing[ index ] = easing;
7033 }
7034 }
7035 } else {
7036 specialEasing[ name ] = easing;
7037 }
7038 }
7039}
7040
7041function Animation( elem, properties, options ) {
7042 var result,
7043 stopped,
7044 index = 0,
7045 length = Animation.prefilters.length,
7046 deferred = jQuery.Deferred().always( function() {
7047
7048 // Don't match elem in the :animated selector
7049 delete tick.elem;
7050 } ),
7051 tick = function() {
7052 if ( stopped ) {
7053 return false;
7054 }
7055 var currentTime = fxNow || createFxNow(),
7056 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7057
7058 // Support: Android 2.3 only
7059 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
7060 temp = remaining / animation.duration || 0,
7061 percent = 1 - temp,
7062 index = 0,
7063 length = animation.tweens.length;
7064
7065 for ( ; index < length; index++ ) {
7066 animation.tweens[ index ].run( percent );
7067 }
7068
7069 deferred.notifyWith( elem, [ animation, percent, remaining ] );
7070
7071 // If there's more to do, yield
7072 if ( percent < 1 && length ) {
7073 return remaining;
7074 }
7075
7076 // If this was an empty animation, synthesize a final progress notification
7077 if ( !length ) {
7078 deferred.notifyWith( elem, [ animation, 1, 0 ] );
7079 }
7080
7081 // Resolve the animation and report its conclusion
7082 deferred.resolveWith( elem, [ animation ] );
7083 return false;
7084 },
7085 animation = deferred.promise( {
7086 elem: elem,
7087 props: jQuery.extend( {}, properties ),
7088 opts: jQuery.extend( true, {
7089 specialEasing: {},
7090 easing: jQuery.easing._default
7091 }, options ),
7092 originalProperties: properties,
7093 originalOptions: options,
7094 startTime: fxNow || createFxNow(),
7095 duration: options.duration,
7096 tweens: [],
7097 createTween: function( prop, end ) {
7098 var tween = jQuery.Tween( elem, animation.opts, prop, end,
7099 animation.opts.specialEasing[ prop ] || animation.opts.easing );
7100 animation.tweens.push( tween );
7101 return tween;
7102 },
7103 stop: function( gotoEnd ) {
7104 var index = 0,
7105
7106 // If we are going to the end, we want to run all the tweens
7107 // otherwise we skip this part
7108 length = gotoEnd ? animation.tweens.length : 0;
7109 if ( stopped ) {
7110 return this;
7111 }
7112 stopped = true;
7113 for ( ; index < length; index++ ) {
7114 animation.tweens[ index ].run( 1 );
7115 }
7116
7117 // Resolve when we played the last frame; otherwise, reject
7118 if ( gotoEnd ) {
7119 deferred.notifyWith( elem, [ animation, 1, 0 ] );
7120 deferred.resolveWith( elem, [ animation, gotoEnd ] );
7121 } else {
7122 deferred.rejectWith( elem, [ animation, gotoEnd ] );
7123 }
7124 return this;
7125 }
7126 } ),
7127 props = animation.props;
7128
7129 propFilter( props, animation.opts.specialEasing );
7130
7131 for ( ; index < length; index++ ) {
7132 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
7133 if ( result ) {
7134 if ( jQuery.isFunction( result.stop ) ) {
7135 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
7136 jQuery.proxy( result.stop, result );
7137 }
7138 return result;
7139 }
7140 }
7141
7142 jQuery.map( props, createTween, animation );
7143
7144 if ( jQuery.isFunction( animation.opts.start ) ) {
7145 animation.opts.start.call( elem, animation );
7146 }
7147
7148 // Attach callbacks from options
7149 animation
7150 .progress( animation.opts.progress )
7151 .done( animation.opts.done, animation.opts.complete )
7152 .fail( animation.opts.fail )
7153 .always( animation.opts.always );
7154
7155 jQuery.fx.timer(
7156 jQuery.extend( tick, {
7157 elem: elem,
7158 anim: animation,
7159 queue: animation.opts.queue
7160 } )
7161 );
7162
7163 return animation;
7164}
7165
7166jQuery.Animation = jQuery.extend( Animation, {
7167
7168 tweeners: {
7169 "*": [ function( prop, value ) {
7170 var tween = this.createTween( prop, value );
7171 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
7172 return tween;
7173 } ]
7174 },
7175
7176 tweener: function( props, callback ) {
7177 if ( jQuery.isFunction( props ) ) {
7178 callback = props;
7179 props = [ "*" ];
7180 } else {
7181 props = props.match( rnothtmlwhite );
7182 }
7183
7184 var prop,
7185 index = 0,
7186 length = props.length;
7187
7188 for ( ; index < length; index++ ) {
7189 prop = props[ index ];
7190 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
7191 Animation.tweeners[ prop ].unshift( callback );
7192 }
7193 },
7194
7195 prefilters: [ defaultPrefilter ],
7196
7197 prefilter: function( callback, prepend ) {
7198 if ( prepend ) {
7199 Animation.prefilters.unshift( callback );
7200 } else {
7201 Animation.prefilters.push( callback );
7202 }
7203 }
7204} );
7205
7206jQuery.speed = function( speed, easing, fn ) {
7207 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
7208 complete: fn || !fn && easing ||
7209 jQuery.isFunction( speed ) && speed,
7210 duration: speed,
7211 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
7212 };
7213
7214 // Go to the end state if fx are off
7215 if ( jQuery.fx.off ) {
7216 opt.duration = 0;
7217
7218 } else {
7219 if ( typeof opt.duration !== "number" ) {
7220 if ( opt.duration in jQuery.fx.speeds ) {
7221 opt.duration = jQuery.fx.speeds[ opt.duration ];
7222
7223 } else {
7224 opt.duration = jQuery.fx.speeds._default;
7225 }
7226 }
7227 }
7228
7229 // Normalize opt.queue - true/undefined/null -> "fx"
7230 if ( opt.queue == null || opt.queue === true ) {
7231 opt.queue = "fx";
7232 }
7233
7234 // Queueing
7235 opt.old = opt.complete;
7236
7237 opt.complete = function() {
7238 if ( jQuery.isFunction( opt.old ) ) {
7239 opt.old.call( this );
7240 }
7241
7242 if ( opt.queue ) {
7243 jQuery.dequeue( this, opt.queue );
7244 }
7245 };
7246
7247 return opt;
7248};
7249
7250jQuery.fn.extend( {
7251 fadeTo: function( speed, to, easing, callback ) {
7252
7253 // Show any hidden elements after setting opacity to 0
7254 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
7255
7256 // Animate to the value specified
7257 .end().animate( { opacity: to }, speed, easing, callback );
7258 },
7259 animate: function( prop, speed, easing, callback ) {
7260 var empty = jQuery.isEmptyObject( prop ),
7261 optall = jQuery.speed( speed, easing, callback ),
7262 doAnimation = function() {
7263
7264 // Operate on a copy of prop so per-property easing won't be lost
7265 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
7266
7267 // Empty animations, or finishing resolves immediately
7268 if ( empty || dataPriv.get( this, "finish" ) ) {
7269 anim.stop( true );
7270 }
7271 };
7272 doAnimation.finish = doAnimation;
7273
7274 return empty || optall.queue === false ?
7275 this.each( doAnimation ) :
7276 this.queue( optall.queue, doAnimation );
7277 },
7278 stop: function( type, clearQueue, gotoEnd ) {
7279 var stopQueue = function( hooks ) {
7280 var stop = hooks.stop;
7281 delete hooks.stop;
7282 stop( gotoEnd );
7283 };
7284
7285 if ( typeof type !== "string" ) {
7286 gotoEnd = clearQueue;
7287 clearQueue = type;
7288 type = undefined;
7289 }
7290 if ( clearQueue && type !== false ) {
7291 this.queue( type || "fx", [] );
7292 }
7293
7294 return this.each( function() {
7295 var dequeue = true,
7296 index = type != null && type + "queueHooks",
7297 timers = jQuery.timers,
7298 data = dataPriv.get( this );
7299
7300 if ( index ) {
7301 if ( data[ index ] && data[ index ].stop ) {
7302 stopQueue( data[ index ] );
7303 }
7304 } else {
7305 for ( index in data ) {
7306 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
7307 stopQueue( data[ index ] );
7308 }
7309 }
7310 }
7311
7312 for ( index = timers.length; index--; ) {
7313 if ( timers[ index ].elem === this &&
7314 ( type == null || timers[ index ].queue === type ) ) {
7315
7316 timers[ index ].anim.stop( gotoEnd );
7317 dequeue = false;
7318 timers.splice( index, 1 );
7319 }
7320 }
7321
7322 // Start the next in the queue if the last step wasn't forced.
7323 // Timers currently will call their complete callbacks, which
7324 // will dequeue but only if they were gotoEnd.
7325 if ( dequeue || !gotoEnd ) {
7326 jQuery.dequeue( this, type );
7327 }
7328 } );
7329 },
7330 finish: function( type ) {
7331 if ( type !== false ) {
7332 type = type || "fx";
7333 }
7334 return this.each( function() {
7335 var index,
7336 data = dataPriv.get( this ),
7337 queue = data[ type + "queue" ],
7338 hooks = data[ type + "queueHooks" ],
7339 timers = jQuery.timers,
7340 length = queue ? queue.length : 0;
7341
7342 // Enable finishing flag on private data
7343 data.finish = true;
7344
7345 // Empty the queue first
7346 jQuery.queue( this, type, [] );
7347
7348 if ( hooks && hooks.stop ) {
7349 hooks.stop.call( this, true );
7350 }
7351
7352 // Look for any active animations, and finish them
7353 for ( index = timers.length; index--; ) {
7354 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
7355 timers[ index ].anim.stop( true );
7356 timers.splice( index, 1 );
7357 }
7358 }
7359
7360 // Look for any animations in the old queue and finish them
7361 for ( index = 0; index < length; index++ ) {
7362 if ( queue[ index ] && queue[ index ].finish ) {
7363 queue[ index ].finish.call( this );
7364 }
7365 }
7366
7367 // Turn off finishing flag
7368 delete data.finish;
7369 } );
7370 }
7371} );
7372
7373jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
7374 var cssFn = jQuery.fn[ name ];
7375 jQuery.fn[ name ] = function( speed, easing, callback ) {
7376 return speed == null || typeof speed === "boolean" ?
7377 cssFn.apply( this, arguments ) :
7378 this.animate( genFx( name, true ), speed, easing, callback );
7379 };
7380} );
7381
7382// Generate shortcuts for custom animations
7383jQuery.each( {
7384 slideDown: genFx( "show" ),
7385 slideUp: genFx( "hide" ),
7386 slideToggle: genFx( "toggle" ),
7387 fadeIn: { opacity: "show" },
7388 fadeOut: { opacity: "hide" },
7389 fadeToggle: { opacity: "toggle" }
7390}, function( name, props ) {
7391 jQuery.fn[ name ] = function( speed, easing, callback ) {
7392 return this.animate( props, speed, easing, callback );
7393 };
7394} );
7395
7396jQuery.timers = [];
7397jQuery.fx.tick = function() {
7398 var timer,
7399 i = 0,
7400 timers = jQuery.timers;
7401
7402 fxNow = jQuery.now();
7403
7404 for ( ; i < timers.length; i++ ) {
7405 timer = timers[ i ];
7406
7407 // Run the timer and safely remove it when done (allowing for external removal)
7408 if ( !timer() && timers[ i ] === timer ) {
7409 timers.splice( i--, 1 );
7410 }
7411 }
7412
7413 if ( !timers.length ) {
7414 jQuery.fx.stop();
7415 }
7416 fxNow = undefined;
7417};
7418
7419jQuery.fx.timer = function( timer ) {
7420 jQuery.timers.push( timer );
7421 jQuery.fx.start();
7422};
7423
7424jQuery.fx.interval = 13;
7425jQuery.fx.start = function() {
7426 if ( inProgress ) {
7427 return;
7428 }
7429
7430 inProgress = true;
7431 schedule();
7432};
7433
7434jQuery.fx.stop = function() {
7435 inProgress = null;
7436};
7437
7438jQuery.fx.speeds = {
7439 slow: 600,
7440 fast: 200,
7441
7442 // Default speed
7443 _default: 400
7444};
7445
7446
7447// Based off of the plugin by Clint Helfers, with permission.
7448// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
7449jQuery.fn.delay = function( time, type ) {
7450 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7451 type = type || "fx";
7452
7453 return this.queue( type, function( next, hooks ) {
7454 var timeout = window.setTimeout( next, time );
7455 hooks.stop = function() {
7456 window.clearTimeout( timeout );
7457 };
7458 } );
7459};
7460
7461
7462( function() {
7463 var input = document.createElement( "input" ),
7464 select = document.createElement( "select" ),
7465 opt = select.appendChild( document.createElement( "option" ) );
7466
7467 input.type = "checkbox";
7468
7469 // Support: Android <=4.3 only
7470 // Default value for a checkbox should be "on"
7471 support.checkOn = input.value !== "";
7472
7473 // Support: IE <=11 only
7474 // Must access selectedIndex to make default options select
7475 support.optSelected = opt.selected;
7476
7477 // Support: IE <=11 only
7478 // An input loses its value after becoming a radio
7479 input = document.createElement( "input" );
7480 input.value = "t";
7481 input.type = "radio";
7482 support.radioValue = input.value === "t";
7483} )();
7484
7485
7486var boolHook,
7487 attrHandle = jQuery.expr.attrHandle;
7488
7489jQuery.fn.extend( {
7490 attr: function( name, value ) {
7491 return access( this, jQuery.attr, name, value, arguments.length > 1 );
7492 },
7493
7494 removeAttr: function( name ) {
7495 return this.each( function() {
7496 jQuery.removeAttr( this, name );
7497 } );
7498 }
7499} );
7500
7501jQuery.extend( {
7502 attr: function( elem, name, value ) {
7503 var ret, hooks,
7504 nType = elem.nodeType;
7505
7506 // Don't get/set attributes on text, comment and attribute nodes
7507 if ( nType === 3 || nType === 8 || nType === 2 ) {
7508 return;
7509 }
7510
7511 // Fallback to prop when attributes are not supported
7512 if ( typeof elem.getAttribute === "undefined" ) {
7513 return jQuery.prop( elem, name, value );
7514 }
7515
7516 // Attribute hooks are determined by the lowercase version
7517 // Grab necessary hook if one is defined
7518 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7519 hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
7520 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
7521 }
7522
7523 if ( value !== undefined ) {
7524 if ( value === null ) {
7525 jQuery.removeAttr( elem, name );
7526 return;
7527 }
7528
7529 if ( hooks && "set" in hooks &&
7530 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7531 return ret;
7532 }
7533
7534 elem.setAttribute( name, value + "" );
7535 return value;
7536 }
7537
7538 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7539 return ret;
7540 }
7541
7542 ret = jQuery.find.attr( elem, name );
7543
7544 // Non-existent attributes return null, we normalize to undefined
7545 return ret == null ? undefined : ret;
7546 },
7547
7548 attrHooks: {
7549 type: {
7550 set: function( elem, value ) {
7551 if ( !support.radioValue && value === "radio" &&
7552 nodeName( elem, "input" ) ) {
7553 var val = elem.value;
7554 elem.setAttribute( "type", value );
7555 if ( val ) {
7556 elem.value = val;
7557 }
7558 return value;
7559 }
7560 }
7561 }
7562 },
7563
7564 removeAttr: function( elem, value ) {
7565 var name,
7566 i = 0,
7567
7568 // Attribute names can contain non-HTML whitespace characters
7569 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
7570 attrNames = value && value.match( rnothtmlwhite );
7571
7572 if ( attrNames && elem.nodeType === 1 ) {
7573 while ( ( name = attrNames[ i++ ] ) ) {
7574 elem.removeAttribute( name );
7575 }
7576 }
7577 }
7578} );
7579
7580// Hooks for boolean attributes
7581boolHook = {
7582 set: function( elem, value, name ) {
7583 if ( value === false ) {
7584
7585 // Remove boolean attributes when set to false
7586 jQuery.removeAttr( elem, name );
7587 } else {
7588 elem.setAttribute( name, name );
7589 }
7590 return name;
7591 }
7592};
7593
7594jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
7595 var getter = attrHandle[ name ] || jQuery.find.attr;
7596
7597 attrHandle[ name ] = function( elem, name, isXML ) {
7598 var ret, handle,
7599 lowercaseName = name.toLowerCase();
7600
7601 if ( !isXML ) {
7602
7603 // Avoid an infinite loop by temporarily removing this function from the getter
7604 handle = attrHandle[ lowercaseName ];
7605 attrHandle[ lowercaseName ] = ret;
7606 ret = getter( elem, name, isXML ) != null ?
7607 lowercaseName :
7608 null;
7609 attrHandle[ lowercaseName ] = handle;
7610 }
7611 return ret;
7612 };
7613} );
7614
7615
7616
7617
7618var rfocusable = /^(?:input|select|textarea|button)$/i,
7619 rclickable = /^(?:a|area)$/i;
7620
7621jQuery.fn.extend( {
7622 prop: function( name, value ) {
7623 return access( this, jQuery.prop, name, value, arguments.length > 1 );
7624 },
7625
7626 removeProp: function( name ) {
7627 return this.each( function() {
7628 delete this[ jQuery.propFix[ name ] || name ];
7629 } );
7630 }
7631} );
7632
7633jQuery.extend( {
7634 prop: function( elem, name, value ) {
7635 var ret, hooks,
7636 nType = elem.nodeType;
7637
7638 // Don't get/set properties on text, comment and attribute nodes
7639 if ( nType === 3 || nType === 8 || nType === 2 ) {
7640 return;
7641 }
7642
7643 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7644
7645 // Fix name and attach hooks
7646 name = jQuery.propFix[ name ] || name;
7647 hooks = jQuery.propHooks[ name ];
7648 }
7649
7650 if ( value !== undefined ) {
7651 if ( hooks && "set" in hooks &&
7652 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7653 return ret;
7654 }
7655
7656 return ( elem[ name ] = value );
7657 }
7658
7659 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7660 return ret;
7661 }
7662
7663 return elem[ name ];
7664 },
7665
7666 propHooks: {
7667 tabIndex: {
7668 get: function( elem ) {
7669
7670 // Support: IE <=9 - 11 only
7671 // elem.tabIndex doesn't always return the
7672 // correct value when it hasn't been explicitly set
7673 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
7674 // Use proper attribute retrieval(#12072)
7675 var tabindex = jQuery.find.attr( elem, "tabindex" );
7676
7677 if ( tabindex ) {
7678 return parseInt( tabindex, 10 );
7679 }
7680
7681 if (
7682 rfocusable.test( elem.nodeName ) ||
7683 rclickable.test( elem.nodeName ) &&
7684 elem.href
7685 ) {
7686 return 0;
7687 }
7688
7689 return -1;
7690 }
7691 }
7692 },
7693
7694 propFix: {
7695 "for": "htmlFor",
7696 "class": "className"
7697 }
7698} );
7699
7700// Support: IE <=11 only
7701// Accessing the selectedIndex property
7702// forces the browser to respect setting selected
7703// on the option
7704// The getter ensures a default option is selected
7705// when in an optgroup
7706// eslint rule "no-unused-expressions" is disabled for this code
7707// since it considers such accessions noop
7708if ( !support.optSelected ) {
7709 jQuery.propHooks.selected = {
7710 get: function( elem ) {
7711
7712 /* eslint no-unused-expressions: "off" */
7713
7714 var parent = elem.parentNode;
7715 if ( parent && parent.parentNode ) {
7716 parent.parentNode.selectedIndex;
7717 }
7718 return null;
7719 },
7720 set: function( elem ) {
7721
7722 /* eslint no-unused-expressions: "off" */
7723
7724 var parent = elem.parentNode;
7725 if ( parent ) {
7726 parent.selectedIndex;
7727
7728 if ( parent.parentNode ) {
7729 parent.parentNode.selectedIndex;
7730 }
7731 }
7732 }
7733 };
7734}
7735
7736jQuery.each( [
7737 "tabIndex",
7738 "readOnly",
7739 "maxLength",
7740 "cellSpacing",
7741 "cellPadding",
7742 "rowSpan",
7743 "colSpan",
7744 "useMap",
7745 "frameBorder",
7746 "contentEditable"
7747], function() {
7748 jQuery.propFix[ this.toLowerCase() ] = this;
7749} );
7750
7751
7752
7753
7754 // Strip and collapse whitespace according to HTML spec
7755 // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
7756 function stripAndCollapse( value ) {
7757 var tokens = value.match( rnothtmlwhite ) || [];
7758 return tokens.join( " " );
7759 }
7760
7761
7762function getClass( elem ) {
7763 return elem.getAttribute && elem.getAttribute( "class" ) || "";
7764}
7765
7766jQuery.fn.extend( {
7767 addClass: function( value ) {
7768 var classes, elem, cur, curValue, clazz, j, finalValue,
7769 i = 0;
7770
7771 if ( jQuery.isFunction( value ) ) {
7772 return this.each( function( j ) {
7773 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
7774 } );
7775 }
7776
7777 if ( typeof value === "string" && value ) {
7778 classes = value.match( rnothtmlwhite ) || [];
7779
7780 while ( ( elem = this[ i++ ] ) ) {
7781 curValue = getClass( elem );
7782 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7783
7784 if ( cur ) {
7785 j = 0;
7786 while ( ( clazz = classes[ j++ ] ) ) {
7787 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
7788 cur += clazz + " ";
7789 }
7790 }
7791
7792 // Only assign if different to avoid unneeded rendering.
7793 finalValue = stripAndCollapse( cur );
7794 if ( curValue !== finalValue ) {
7795 elem.setAttribute( "class", finalValue );
7796 }
7797 }
7798 }
7799 }
7800
7801 return this;
7802 },
7803
7804 removeClass: function( value ) {
7805 var classes, elem, cur, curValue, clazz, j, finalValue,
7806 i = 0;
7807
7808 if ( jQuery.isFunction( value ) ) {
7809 return this.each( function( j ) {
7810 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
7811 } );
7812 }
7813
7814 if ( !arguments.length ) {
7815 return this.attr( "class", "" );
7816 }
7817
7818 if ( typeof value === "string" && value ) {
7819 classes = value.match( rnothtmlwhite ) || [];
7820
7821 while ( ( elem = this[ i++ ] ) ) {
7822 curValue = getClass( elem );
7823
7824 // This expression is here for better compressibility (see addClass)
7825 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7826
7827 if ( cur ) {
7828 j = 0;
7829 while ( ( clazz = classes[ j++ ] ) ) {
7830
7831 // Remove *all* instances
7832 while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
7833 cur = cur.replace( " " + clazz + " ", " " );
7834 }
7835 }
7836
7837 // Only assign if different to avoid unneeded rendering.
7838 finalValue = stripAndCollapse( cur );
7839 if ( curValue !== finalValue ) {
7840 elem.setAttribute( "class", finalValue );
7841 }
7842 }
7843 }
7844 }
7845
7846 return this;
7847 },
7848
7849 toggleClass: function( value, stateVal ) {
7850 var type = typeof value;
7851
7852 if ( typeof stateVal === "boolean" && type === "string" ) {
7853 return stateVal ? this.addClass( value ) : this.removeClass( value );
7854 }
7855
7856 if ( jQuery.isFunction( value ) ) {
7857 return this.each( function( i ) {
7858 jQuery( this ).toggleClass(
7859 value.call( this, i, getClass( this ), stateVal ),
7860 stateVal
7861 );
7862 } );
7863 }
7864
7865 return this.each( function() {
7866 var className, i, self, classNames;
7867
7868 if ( type === "string" ) {
7869
7870 // Toggle individual class names
7871 i = 0;
7872 self = jQuery( this );
7873 classNames = value.match( rnothtmlwhite ) || [];
7874
7875 while ( ( className = classNames[ i++ ] ) ) {
7876
7877 // Check each className given, space separated list
7878 if ( self.hasClass( className ) ) {
7879 self.removeClass( className );
7880 } else {
7881 self.addClass( className );
7882 }
7883 }
7884
7885 // Toggle whole class name
7886 } else if ( value === undefined || type === "boolean" ) {
7887 className = getClass( this );
7888 if ( className ) {
7889
7890 // Store className if set
7891 dataPriv.set( this, "__className__", className );
7892 }
7893
7894 // If the element has a class name or if we're passed `false`,
7895 // then remove the whole classname (if there was one, the above saved it).
7896 // Otherwise bring back whatever was previously saved (if anything),
7897 // falling back to the empty string if nothing was stored.
7898 if ( this.setAttribute ) {
7899 this.setAttribute( "class",
7900 className || value === false ?
7901 "" :
7902 dataPriv.get( this, "__className__" ) || ""
7903 );
7904 }
7905 }
7906 } );
7907 },
7908
7909 hasClass: function( selector ) {
7910 var className, elem,
7911 i = 0;
7912
7913 className = " " + selector + " ";
7914 while ( ( elem = this[ i++ ] ) ) {
7915 if ( elem.nodeType === 1 &&
7916 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
7917 return true;
7918 }
7919 }
7920
7921 return false;
7922 }
7923} );
7924
7925
7926
7927
7928var rreturn = /\r/g;
7929
7930jQuery.fn.extend( {
7931 val: function( value ) {
7932 var hooks, ret, isFunction,
7933 elem = this[ 0 ];
7934
7935 if ( !arguments.length ) {
7936 if ( elem ) {
7937 hooks = jQuery.valHooks[ elem.type ] ||
7938 jQuery.valHooks[ elem.nodeName.toLowerCase() ];
7939
7940 if ( hooks &&
7941 "get" in hooks &&
7942 ( ret = hooks.get( elem, "value" ) ) !== undefined
7943 ) {
7944 return ret;
7945 }
7946
7947 ret = elem.value;
7948
7949 // Handle most common string cases
7950 if ( typeof ret === "string" ) {
7951 return ret.replace( rreturn, "" );
7952 }
7953
7954 // Handle cases where value is null/undef or number
7955 return ret == null ? "" : ret;
7956 }
7957
7958 return;
7959 }
7960
7961 isFunction = jQuery.isFunction( value );
7962
7963 return this.each( function( i ) {
7964 var val;
7965
7966 if ( this.nodeType !== 1 ) {
7967 return;
7968 }
7969
7970 if ( isFunction ) {
7971 val = value.call( this, i, jQuery( this ).val() );
7972 } else {
7973 val = value;
7974 }
7975
7976 // Treat null/undefined as ""; convert numbers to string
7977 if ( val == null ) {
7978 val = "";
7979
7980 } else if ( typeof val === "number" ) {
7981 val += "";
7982
7983 } else if ( Array.isArray( val ) ) {
7984 val = jQuery.map( val, function( value ) {
7985 return value == null ? "" : value + "";
7986 } );
7987 }
7988
7989 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
7990
7991 // If set returns undefined, fall back to normal setting
7992 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
7993 this.value = val;
7994 }
7995 } );
7996 }
7997} );
7998
7999jQuery.extend( {
8000 valHooks: {
8001 option: {
8002 get: function( elem ) {
8003
8004 var val = jQuery.find.attr( elem, "value" );
8005 return val != null ?
8006 val :
8007
8008 // Support: IE <=10 - 11 only
8009 // option.text throws exceptions (#14686, #14858)
8010 // Strip and collapse whitespace
8011 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
8012 stripAndCollapse( jQuery.text( elem ) );
8013 }
8014 },
8015 select: {
8016 get: function( elem ) {
8017 var value, option, i,
8018 options = elem.options,
8019 index = elem.selectedIndex,
8020 one = elem.type === "select-one",
8021 values = one ? null : [],
8022 max = one ? index + 1 : options.length;
8023
8024 if ( index < 0 ) {
8025 i = max;
8026
8027 } else {
8028 i = one ? index : 0;
8029 }
8030
8031 // Loop through all the selected options
8032 for ( ; i < max; i++ ) {
8033 option = options[ i ];
8034
8035 // Support: IE <=9 only
8036 // IE8-9 doesn't update selected after form reset (#2551)
8037 if ( ( option.selected || i === index ) &&
8038
8039 // Don't return options that are disabled or in a disabled optgroup
8040 !option.disabled &&
8041 ( !option.parentNode.disabled ||
8042 !nodeName( option.parentNode, "optgroup" ) ) ) {
8043
8044 // Get the specific value for the option
8045 value = jQuery( option ).val();
8046
8047 // We don't need an array for one selects
8048 if ( one ) {
8049 return value;
8050 }
8051
8052 // Multi-Selects return an array
8053 values.push( value );
8054 }
8055 }
8056
8057 return values;
8058 },
8059
8060 set: function( elem, value ) {
8061 var optionSet, option,
8062 options = elem.options,
8063 values = jQuery.makeArray( value ),
8064 i = options.length;
8065
8066 while ( i-- ) {
8067 option = options[ i ];
8068
8069 /* eslint-disable no-cond-assign */
8070
8071 if ( option.selected =
8072 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
8073 ) {
8074 optionSet = true;
8075 }
8076
8077 /* eslint-enable no-cond-assign */
8078 }
8079
8080 // Force browsers to behave consistently when non-matching value is set
8081 if ( !optionSet ) {
8082 elem.selectedIndex = -1;
8083 }
8084 return values;
8085 }
8086 }
8087 }
8088} );
8089
8090// Radios and checkboxes getter/setter
8091jQuery.each( [ "radio", "checkbox" ], function() {
8092 jQuery.valHooks[ this ] = {
8093 set: function( elem, value ) {
8094 if ( Array.isArray( value ) ) {
8095 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
8096 }
8097 }
8098 };
8099 if ( !support.checkOn ) {
8100 jQuery.valHooks[ this ].get = function( elem ) {
8101 return elem.getAttribute( "value" ) === null ? "on" : elem.value;
8102 };
8103 }
8104} );
8105
8106
8107
8108
8109// Return jQuery for attributes-only inclusion
8110
8111
8112var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
8113
8114jQuery.extend( jQuery.event, {
8115
8116 trigger: function( event, data, elem, onlyHandlers ) {
8117
8118 var i, cur, tmp, bubbleType, ontype, handle, special,
8119 eventPath = [ elem || document ],
8120 type = hasOwn.call( event, "type" ) ? event.type : event,
8121 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
8122
8123 cur = tmp = elem = elem || document;
8124
8125 // Don't do events on text and comment nodes
8126 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
8127 return;
8128 }
8129
8130 // focus/blur morphs to focusin/out; ensure we're not firing them right now
8131 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
8132 return;
8133 }
8134
8135 if ( type.indexOf( "." ) > -1 ) {
8136
8137 // Namespaced trigger; create a regexp to match event type in handle()
8138 namespaces = type.split( "." );
8139 type = namespaces.shift();
8140 namespaces.sort();
8141 }
8142 ontype = type.indexOf( ":" ) < 0 && "on" + type;
8143
8144 // Caller can pass in a jQuery.Event object, Object, or just an event type string
8145 event = event[ jQuery.expando ] ?
8146 event :
8147 new jQuery.Event( type, typeof event === "object" && event );
8148
8149 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
8150 event.isTrigger = onlyHandlers ? 2 : 3;
8151 event.namespace = namespaces.join( "." );
8152 event.rnamespace = event.namespace ?
8153 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
8154 null;
8155
8156 // Clean up the event in case it is being reused
8157 event.result = undefined;
8158 if ( !event.target ) {
8159 event.target = elem;
8160 }
8161
8162 // Clone any incoming data and prepend the event, creating the handler arg list
8163 data = data == null ?
8164 [ event ] :
8165 jQuery.makeArray( data, [ event ] );
8166
8167 // Allow special events to draw outside the lines
8168 special = jQuery.event.special[ type ] || {};
8169 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
8170 return;
8171 }
8172
8173 // Determine event propagation path in advance, per W3C events spec (#9951)
8174 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
8175 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
8176
8177 bubbleType = special.delegateType || type;
8178 if ( !rfocusMorph.test( bubbleType + type ) ) {
8179 cur = cur.parentNode;
8180 }
8181 for ( ; cur; cur = cur.parentNode ) {
8182 eventPath.push( cur );
8183 tmp = cur;
8184 }
8185
8186 // Only add window if we got to document (e.g., not plain obj or detached DOM)
8187 if ( tmp === ( elem.ownerDocument || document ) ) {
8188 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
8189 }
8190 }
8191
8192 // Fire handlers on the event path
8193 i = 0;
8194 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
8195
8196 event.type = i > 1 ?
8197 bubbleType :
8198 special.bindType || type;
8199
8200 // jQuery handler
8201 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
8202 dataPriv.get( cur, "handle" );
8203 if ( handle ) {
8204 handle.apply( cur, data );
8205 }
8206
8207 // Native handler
8208 handle = ontype && cur[ ontype ];
8209 if ( handle && handle.apply && acceptData( cur ) ) {
8210 event.result = handle.apply( cur, data );
8211 if ( event.result === false ) {
8212 event.preventDefault();
8213 }
8214 }
8215 }
8216 event.type = type;
8217
8218 // If nobody prevented the default action, do it now
8219 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
8220
8221 if ( ( !special._default ||
8222 special._default.apply( eventPath.pop(), data ) === false ) &&
8223 acceptData( elem ) ) {
8224
8225 // Call a native DOM method on the target with the same name as the event.
8226 // Don't do default actions on window, that's where global variables be (#6170)
8227 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
8228
8229 // Don't re-trigger an onFOO event when we call its FOO() method
8230 tmp = elem[ ontype ];
8231
8232 if ( tmp ) {
8233 elem[ ontype ] = null;
8234 }
8235
8236 // Prevent re-triggering of the same event, since we already bubbled it above
8237 jQuery.event.triggered = type;
8238 elem[ type ]();
8239 jQuery.event.triggered = undefined;
8240
8241 if ( tmp ) {
8242 elem[ ontype ] = tmp;
8243 }
8244 }
8245 }
8246 }
8247
8248 return event.result;
8249 },
8250
8251 // Piggyback on a donor event to simulate a different one
8252 // Used only for `focus(in | out)` events
8253 simulate: function( type, elem, event ) {
8254 var e = jQuery.extend(
8255 new jQuery.Event(),
8256 event,
8257 {
8258 type: type,
8259 isSimulated: true
8260 }
8261 );
8262
8263 jQuery.event.trigger( e, null, elem );
8264 }
8265
8266} );
8267
8268jQuery.fn.extend( {
8269
8270 trigger: function( type, data ) {
8271 return this.each( function() {
8272 jQuery.event.trigger( type, data, this );
8273 } );
8274 },
8275 triggerHandler: function( type, data ) {
8276 var elem = this[ 0 ];
8277 if ( elem ) {
8278 return jQuery.event.trigger( type, data, elem, true );
8279 }
8280 }
8281} );
8282
8283
8284jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
8285 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
8286 "change select submit keydown keypress keyup contextmenu" ).split( " " ),
8287 function( i, name ) {
8288
8289 // Handle event binding
8290 jQuery.fn[ name ] = function( data, fn ) {
8291 return arguments.length > 0 ?
8292 this.on( name, null, data, fn ) :
8293 this.trigger( name );
8294 };
8295} );
8296
8297jQuery.fn.extend( {
8298 hover: function( fnOver, fnOut ) {
8299 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
8300 }
8301} );
8302
8303
8304
8305
8306support.focusin = "onfocusin" in window;
8307
8308
8309// Support: Firefox <=44
8310// Firefox doesn't have focus(in | out) events
8311// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
8312//
8313// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
8314// focus(in | out) events fire after focus & blur events,
8315// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
8316// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
8317if ( !support.focusin ) {
8318 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
8319
8320 // Attach a single capturing handler on the document while someone wants focusin/focusout
8321 var handler = function( event ) {
8322 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
8323 };
8324
8325 jQuery.event.special[ fix ] = {
8326 setup: function() {
8327 var doc = this.ownerDocument || this,
8328 attaches = dataPriv.access( doc, fix );
8329
8330 if ( !attaches ) {
8331 doc.addEventListener( orig, handler, true );
8332 }
8333 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8334 },
8335 teardown: function() {
8336 var doc = this.ownerDocument || this,
8337 attaches = dataPriv.access( doc, fix ) - 1;
8338
8339 if ( !attaches ) {
8340 doc.removeEventListener( orig, handler, true );
8341 dataPriv.remove( doc, fix );
8342
8343 } else {
8344 dataPriv.access( doc, fix, attaches );
8345 }
8346 }
8347 };
8348 } );
8349}
8350var location = window.location;
8351
8352var nonce = jQuery.now();
8353
8354var rquery = ( /\?/ );
8355
8356
8357
8358// Cross-browser xml parsing
8359jQuery.parseXML = function( data ) {
8360 var xml;
8361 if ( !data || typeof data !== "string" ) {
8362 return null;
8363 }
8364
8365 // Support: IE 9 - 11 only
8366 // IE throws on parseFromString with invalid input.
8367 try {
8368 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8369 } catch ( e ) {
8370 xml = undefined;
8371 }
8372
8373 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
8374 jQuery.error( "Invalid XML: " + data );
8375 }
8376 return xml;
8377};
8378
8379
8380var
8381 rbracket = /\[\]$/,
8382 rCRLF = /\r?\n/g,
8383 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
8384 rsubmittable = /^(?:input|select|textarea|keygen)/i;
8385
8386function buildParams( prefix, obj, traditional, add ) {
8387 var name;
8388
8389 if ( Array.isArray( obj ) ) {
8390
8391 // Serialize array item.
8392 jQuery.each( obj, function( i, v ) {
8393 if ( traditional || rbracket.test( prefix ) ) {
8394
8395 // Treat each array item as a scalar.
8396 add( prefix, v );
8397
8398 } else {
8399
8400 // Item is non-scalar (array or object), encode its numeric index.
8401 buildParams(
8402 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
8403 v,
8404 traditional,
8405 add
8406 );
8407 }
8408 } );
8409
8410 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
8411
8412 // Serialize object item.
8413 for ( name in obj ) {
8414 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8415 }
8416
8417 } else {
8418
8419 // Serialize scalar item.
8420 add( prefix, obj );
8421 }
8422}
8423
8424// Serialize an array of form elements or a set of
8425// key/values into a query string
8426jQuery.param = function( a, traditional ) {
8427 var prefix,
8428 s = [],
8429 add = function( key, valueOrFunction ) {
8430
8431 // If value is a function, invoke it and use its return value
8432 var value = jQuery.isFunction( valueOrFunction ) ?
8433 valueOrFunction() :
8434 valueOrFunction;
8435
8436 s[ s.length ] = encodeURIComponent( key ) + "=" +
8437 encodeURIComponent( value == null ? "" : value );
8438 };
8439
8440 // If an array was passed in, assume that it is an array of form elements.
8441 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8442
8443 // Serialize the form elements
8444 jQuery.each( a, function() {
8445 add( this.name, this.value );
8446 } );
8447
8448 } else {
8449
8450 // If traditional, encode the "old" way (the way 1.3.2 or older
8451 // did it), otherwise encode params recursively.
8452 for ( prefix in a ) {
8453 buildParams( prefix, a[ prefix ], traditional, add );
8454 }
8455 }
8456
8457 // Return the resulting serialization
8458 return s.join( "&" );
8459};
8460
8461jQuery.fn.extend( {
8462 serialize: function() {
8463 return jQuery.param( this.serializeArray() );
8464 },
8465 serializeArray: function() {
8466 return this.map( function() {
8467
8468 // Can add propHook for "elements" to filter or add form elements
8469 var elements = jQuery.prop( this, "elements" );
8470 return elements ? jQuery.makeArray( elements ) : this;
8471 } )
8472 .filter( function() {
8473 var type = this.type;
8474
8475 // Use .is( ":disabled" ) so that fieldset[disabled] works
8476 return this.name && !jQuery( this ).is( ":disabled" ) &&
8477 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8478 ( this.checked || !rcheckableType.test( type ) );
8479 } )
8480 .map( function( i, elem ) {
8481 var val = jQuery( this ).val();
8482
8483 if ( val == null ) {
8484 return null;
8485 }
8486
8487 if ( Array.isArray( val ) ) {
8488 return jQuery.map( val, function( val ) {
8489 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8490 } );
8491 }
8492
8493 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8494 } ).get();
8495 }
8496} );
8497
8498
8499var
8500 r20 = /%20/g,
8501 rhash = /#.*$/,
8502 rantiCache = /([?&])_=[^&]*/,
8503 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
8504
8505 // #7653, #8125, #8152: local protocol detection
8506 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
8507 rnoContent = /^(?:GET|HEAD)$/,
8508 rprotocol = /^\/\//,
8509
8510 /* Prefilters
8511 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
8512 * 2) These are called:
8513 * - BEFORE asking for a transport
8514 * - AFTER param serialization (s.data is a string if s.processData is true)
8515 * 3) key is the dataType
8516 * 4) the catchall symbol "*" can be used
8517 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
8518 */
8519 prefilters = {},
8520
8521 /* Transports bindings
8522 * 1) key is the dataType
8523 * 2) the catchall symbol "*" can be used
8524 * 3) selection will start with transport dataType and THEN go to "*" if needed
8525 */
8526 transports = {},
8527
8528 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
8529 allTypes = "*/".concat( "*" ),
8530
8531 // Anchor tag for parsing the document origin
8532 originAnchor = document.createElement( "a" );
8533 originAnchor.href = location.href;
8534
8535// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
8536function addToPrefiltersOrTransports( structure ) {
8537
8538 // dataTypeExpression is optional and defaults to "*"
8539 return function( dataTypeExpression, func ) {
8540
8541 if ( typeof dataTypeExpression !== "string" ) {
8542 func = dataTypeExpression;
8543 dataTypeExpression = "*";
8544 }
8545
8546 var dataType,
8547 i = 0,
8548 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
8549
8550 if ( jQuery.isFunction( func ) ) {
8551
8552 // For each dataType in the dataTypeExpression
8553 while ( ( dataType = dataTypes[ i++ ] ) ) {
8554
8555 // Prepend if requested
8556 if ( dataType[ 0 ] === "+" ) {
8557 dataType = dataType.slice( 1 ) || "*";
8558 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
8559
8560 // Otherwise append
8561 } else {
8562 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
8563 }
8564 }
8565 }
8566 };
8567}
8568
8569// Base inspection function for prefilters and transports
8570function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
8571
8572 var inspected = {},
8573 seekingTransport = ( structure === transports );
8574
8575 function inspect( dataType ) {
8576 var selected;
8577 inspected[ dataType ] = true;
8578 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
8579 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
8580 if ( typeof dataTypeOrTransport === "string" &&
8581 !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
8582
8583 options.dataTypes.unshift( dataTypeOrTransport );
8584 inspect( dataTypeOrTransport );
8585 return false;
8586 } else if ( seekingTransport ) {
8587 return !( selected = dataTypeOrTransport );
8588 }
8589 } );
8590 return selected;
8591 }
8592
8593 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
8594}
8595
8596// A special extend for ajax options
8597// that takes "flat" options (not to be deep extended)
8598// Fixes #9887
8599function ajaxExtend( target, src ) {
8600 var key, deep,
8601 flatOptions = jQuery.ajaxSettings.flatOptions || {};
8602
8603 for ( key in src ) {
8604 if ( src[ key ] !== undefined ) {
8605 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
8606 }
8607 }
8608 if ( deep ) {
8609 jQuery.extend( true, target, deep );
8610 }
8611
8612 return target;
8613}
8614
8615/* Handles responses to an ajax request:
8616 * - finds the right dataType (mediates between content-type and expected dataType)
8617 * - returns the corresponding response
8618 */
8619function ajaxHandleResponses( s, jqXHR, responses ) {
8620
8621 var ct, type, finalDataType, firstDataType,
8622 contents = s.contents,
8623 dataTypes = s.dataTypes;
8624
8625 // Remove auto dataType and get content-type in the process
8626 while ( dataTypes[ 0 ] === "*" ) {
8627 dataTypes.shift();
8628 if ( ct === undefined ) {
8629 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
8630 }
8631 }
8632
8633 // Check if we're dealing with a known content-type
8634 if ( ct ) {
8635 for ( type in contents ) {
8636 if ( contents[ type ] && contents[ type ].test( ct ) ) {
8637 dataTypes.unshift( type );
8638 break;
8639 }
8640 }
8641 }
8642
8643 // Check to see if we have a response for the expected dataType
8644 if ( dataTypes[ 0 ] in responses ) {
8645 finalDataType = dataTypes[ 0 ];
8646 } else {
8647
8648 // Try convertible dataTypes
8649 for ( type in responses ) {
8650 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
8651 finalDataType = type;
8652 break;
8653 }
8654 if ( !firstDataType ) {
8655 firstDataType = type;
8656 }
8657 }
8658
8659 // Or just use first one
8660 finalDataType = finalDataType || firstDataType;
8661 }
8662
8663 // If we found a dataType
8664 // We add the dataType to the list if needed
8665 // and return the corresponding response
8666 if ( finalDataType ) {
8667 if ( finalDataType !== dataTypes[ 0 ] ) {
8668 dataTypes.unshift( finalDataType );
8669 }
8670 return responses[ finalDataType ];
8671 }
8672}
8673
8674/* Chain conversions given the request and the original response
8675 * Also sets the responseXXX fields on the jqXHR instance
8676 */
8677function ajaxConvert( s, response, jqXHR, isSuccess ) {
8678 var conv2, current, conv, tmp, prev,
8679 converters = {},
8680
8681 // Work with a copy of dataTypes in case we need to modify it for conversion
8682 dataTypes = s.dataTypes.slice();
8683
8684 // Create converters map with lowercased keys
8685 if ( dataTypes[ 1 ] ) {
8686 for ( conv in s.converters ) {
8687 converters[ conv.toLowerCase() ] = s.converters[ conv ];
8688 }
8689 }
8690
8691 current = dataTypes.shift();
8692
8693 // Convert to each sequential dataType
8694 while ( current ) {
8695
8696 if ( s.responseFields[ current ] ) {
8697 jqXHR[ s.responseFields[ current ] ] = response;
8698 }
8699
8700 // Apply the dataFilter if provided
8701 if ( !prev && isSuccess && s.dataFilter ) {
8702 response = s.dataFilter( response, s.dataType );
8703 }
8704
8705 prev = current;
8706 current = dataTypes.shift();
8707
8708 if ( current ) {
8709
8710 // There's only work to do if current dataType is non-auto
8711 if ( current === "*" ) {
8712
8713 current = prev;
8714
8715 // Convert response if prev dataType is non-auto and differs from current
8716 } else if ( prev !== "*" && prev !== current ) {
8717
8718 // Seek a direct converter
8719 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
8720
8721 // If none found, seek a pair
8722 if ( !conv ) {
8723 for ( conv2 in converters ) {
8724
8725 // If conv2 outputs current
8726 tmp = conv2.split( " " );
8727 if ( tmp[ 1 ] === current ) {
8728
8729 // If prev can be converted to accepted input
8730 conv = converters[ prev + " " + tmp[ 0 ] ] ||
8731 converters[ "* " + tmp[ 0 ] ];
8732 if ( conv ) {
8733
8734 // Condense equivalence converters
8735 if ( conv === true ) {
8736 conv = converters[ conv2 ];
8737
8738 // Otherwise, insert the intermediate dataType
8739 } else if ( converters[ conv2 ] !== true ) {
8740 current = tmp[ 0 ];
8741 dataTypes.unshift( tmp[ 1 ] );
8742 }
8743 break;
8744 }
8745 }
8746 }
8747 }
8748
8749 // Apply converter (if not an equivalence)
8750 if ( conv !== true ) {
8751
8752 // Unless errors are allowed to bubble, catch and return them
8753 if ( conv && s.throws ) {
8754 response = conv( response );
8755 } else {
8756 try {
8757 response = conv( response );
8758 } catch ( e ) {
8759 return {
8760 state: "parsererror",
8761 error: conv ? e : "No conversion from " + prev + " to " + current
8762 };
8763 }
8764 }
8765 }
8766 }
8767 }
8768 }
8769
8770 return { state: "success", data: response };
8771}
8772
8773jQuery.extend( {
8774
8775 // Counter for holding the number of active queries
8776 active: 0,
8777
8778 // Last-Modified header cache for next request
8779 lastModified: {},
8780 etag: {},
8781
8782 ajaxSettings: {
8783 url: location.href,
8784 type: "GET",
8785 isLocal: rlocalProtocol.test( location.protocol ),
8786 global: true,
8787 processData: true,
8788 async: true,
8789 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
8790
8791 /*
8792 timeout: 0,
8793 data: null,
8794 dataType: null,
8795 username: null,
8796 password: null,
8797 cache: null,
8798 throws: false,
8799 traditional: false,
8800 headers: {},
8801 */
8802
8803 accepts: {
8804 "*": allTypes,
8805 text: "text/plain",
8806 html: "text/html",
8807 xml: "application/xml, text/xml",
8808 json: "application/json, text/javascript"
8809 },
8810
8811 contents: {
8812 xml: /\bxml\b/,
8813 html: /\bhtml/,
8814 json: /\bjson\b/
8815 },
8816
8817 responseFields: {
8818 xml: "responseXML",
8819 text: "responseText",
8820 json: "responseJSON"
8821 },
8822
8823 // Data converters
8824 // Keys separate source (or catchall "*") and destination types with a single space
8825 converters: {
8826
8827 // Convert anything to text
8828 "* text": String,
8829
8830 // Text to html (true = no transformation)
8831 "text html": true,
8832
8833 // Evaluate text as a json expression
8834 "text json": JSON.parse,
8835
8836 // Parse text as xml
8837 "text xml": jQuery.parseXML
8838 },
8839
8840 // For options that shouldn't be deep extended:
8841 // you can add your own custom options here if
8842 // and when you create one that shouldn't be
8843 // deep extended (see ajaxExtend)
8844 flatOptions: {
8845 url: true,
8846 context: true
8847 }
8848 },
8849
8850 // Creates a full fledged settings object into target
8851 // with both ajaxSettings and settings fields.
8852 // If target is omitted, writes into ajaxSettings.
8853 ajaxSetup: function( target, settings ) {
8854 return settings ?
8855
8856 // Building a settings object
8857 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
8858
8859 // Extending ajaxSettings
8860 ajaxExtend( jQuery.ajaxSettings, target );
8861 },
8862
8863 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
8864 ajaxTransport: addToPrefiltersOrTransports( transports ),
8865
8866 // Main method
8867 ajax: function( url, options ) {
8868
8869 // If url is an object, simulate pre-1.5 signature
8870 if ( typeof url === "object" ) {
8871 options = url;
8872 url = undefined;
8873 }
8874
8875 // Force options to be an object
8876 options = options || {};
8877
8878 var transport,
8879
8880 // URL without anti-cache param
8881 cacheURL,
8882
8883 // Response headers
8884 responseHeadersString,
8885 responseHeaders,
8886
8887 // timeout handle
8888 timeoutTimer,
8889
8890 // Url cleanup var
8891 urlAnchor,
8892
8893 // Request state (becomes false upon send and true upon completion)
8894 completed,
8895
8896 // To know if global events are to be dispatched
8897 fireGlobals,
8898
8899 // Loop variable
8900 i,
8901
8902 // uncached part of the url
8903 uncached,
8904
8905 // Create the final options object
8906 s = jQuery.ajaxSetup( {}, options ),
8907
8908 // Callbacks context
8909 callbackContext = s.context || s,
8910
8911 // Context for global events is callbackContext if it is a DOM node or jQuery collection
8912 globalEventContext = s.context &&
8913 ( callbackContext.nodeType || callbackContext.jquery ) ?
8914 jQuery( callbackContext ) :
8915 jQuery.event,
8916
8917 // Deferreds
8918 deferred = jQuery.Deferred(),
8919 completeDeferred = jQuery.Callbacks( "once memory" ),
8920
8921 // Status-dependent callbacks
8922 statusCode = s.statusCode || {},
8923
8924 // Headers (they are sent all at once)
8925 requestHeaders = {},
8926 requestHeadersNames = {},
8927
8928 // Default abort message
8929 strAbort = "canceled",
8930
8931 // Fake xhr
8932 jqXHR = {
8933 readyState: 0,
8934
8935 // Builds headers hashtable if needed
8936 getResponseHeader: function( key ) {
8937 var match;
8938 if ( completed ) {
8939 if ( !responseHeaders ) {
8940 responseHeaders = {};
8941 while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
8942 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
8943 }
8944 }
8945 match = responseHeaders[ key.toLowerCase() ];
8946 }
8947 return match == null ? null : match;
8948 },
8949
8950 // Raw string
8951 getAllResponseHeaders: function() {
8952 return completed ? responseHeadersString : null;
8953 },
8954
8955 // Caches the header
8956 setRequestHeader: function( name, value ) {
8957 if ( completed == null ) {
8958 name = requestHeadersNames[ name.toLowerCase() ] =
8959 requestHeadersNames[ name.toLowerCase() ] || name;
8960 requestHeaders[ name ] = value;
8961 }
8962 return this;
8963 },
8964
8965 // Overrides response content-type header
8966 overrideMimeType: function( type ) {
8967 if ( completed == null ) {
8968 s.mimeType = type;
8969 }
8970 return this;
8971 },
8972
8973 // Status-dependent callbacks
8974 statusCode: function( map ) {
8975 var code;
8976 if ( map ) {
8977 if ( completed ) {
8978
8979 // Execute the appropriate callbacks
8980 jqXHR.always( map[ jqXHR.status ] );
8981 } else {
8982
8983 // Lazy-add the new callbacks in a way that preserves old ones
8984 for ( code in map ) {
8985 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
8986 }
8987 }
8988 }
8989 return this;
8990 },
8991
8992 // Cancel the request
8993 abort: function( statusText ) {
8994 var finalText = statusText || strAbort;
8995 if ( transport ) {
8996 transport.abort( finalText );
8997 }
8998 done( 0, finalText );
8999 return this;
9000 }
9001 };
9002
9003 // Attach deferreds
9004 deferred.promise( jqXHR );
9005
9006 // Add protocol if not provided (prefilters might expect it)
9007 // Handle falsy url in the settings object (#10093: consistency with old signature)
9008 // We also use the url parameter if available
9009 s.url = ( ( url || s.url || location.href ) + "" )
9010 .replace( rprotocol, location.protocol + "//" );
9011
9012 // Alias method option to type as per ticket #12004
9013 s.type = options.method || options.type || s.method || s.type;
9014
9015 // Extract dataTypes list
9016 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
9017
9018 // A cross-domain request is in order when the origin doesn't match the current origin.
9019 if ( s.crossDomain == null ) {
9020 urlAnchor = document.createElement( "a" );
9021
9022 // Support: IE <=8 - 11, Edge 12 - 13
9023 // IE throws exception on accessing the href property if url is malformed,
9024 // e.g. http://example.com:80x/
9025 try {
9026 urlAnchor.href = s.url;
9027
9028 // Support: IE <=8 - 11 only
9029 // Anchor's host property isn't correctly set when s.url is relative
9030 urlAnchor.href = urlAnchor.href;
9031 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
9032 urlAnchor.protocol + "//" + urlAnchor.host;
9033 } catch ( e ) {
9034
9035 // If there is an error parsing the URL, assume it is crossDomain,
9036 // it can be rejected by the transport if it is invalid
9037 s.crossDomain = true;
9038 }
9039 }
9040
9041 // Convert data if not already a string
9042 if ( s.data && s.processData && typeof s.data !== "string" ) {
9043 s.data = jQuery.param( s.data, s.traditional );
9044 }
9045
9046 // Apply prefilters
9047 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
9048
9049 // If request was aborted inside a prefilter, stop there
9050 if ( completed ) {
9051 return jqXHR;
9052 }
9053
9054 // We can fire global events as of now if asked to
9055 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
9056 fireGlobals = jQuery.event && s.global;
9057
9058 // Watch for a new set of requests
9059 if ( fireGlobals && jQuery.active++ === 0 ) {
9060 jQuery.event.trigger( "ajaxStart" );
9061 }
9062
9063 // Uppercase the type
9064 s.type = s.type.toUpperCase();
9065
9066 // Determine if request has content
9067 s.hasContent = !rnoContent.test( s.type );
9068
9069 // Save the URL in case we're toying with the If-Modified-Since
9070 // and/or If-None-Match header later on
9071 // Remove hash to simplify url manipulation
9072 cacheURL = s.url.replace( rhash, "" );
9073
9074 // More options handling for requests with no content
9075 if ( !s.hasContent ) {
9076
9077 // Remember the hash so we can put it back
9078 uncached = s.url.slice( cacheURL.length );
9079
9080 // If data is available, append data to url
9081 if ( s.data ) {
9082 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
9083
9084 // #9682: remove data so that it's not used in an eventual retry
9085 delete s.data;
9086 }
9087
9088 // Add or update anti-cache param if needed
9089 if ( s.cache === false ) {
9090 cacheURL = cacheURL.replace( rantiCache, "$1" );
9091 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
9092 }
9093
9094 // Put hash and anti-cache on the URL that will be requested (gh-1732)
9095 s.url = cacheURL + uncached;
9096
9097 // Change '%20' to '+' if this is encoded form body content (gh-2658)
9098 } else if ( s.data && s.processData &&
9099 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
9100 s.data = s.data.replace( r20, "+" );
9101 }
9102
9103 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9104 if ( s.ifModified ) {
9105 if ( jQuery.lastModified[ cacheURL ] ) {
9106 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
9107 }
9108 if ( jQuery.etag[ cacheURL ] ) {
9109 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
9110 }
9111 }
9112
9113 // Set the correct header, if data is being sent
9114 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
9115 jqXHR.setRequestHeader( "Content-Type", s.contentType );
9116 }
9117
9118 // Set the Accepts header for the server, depending on the dataType
9119 jqXHR.setRequestHeader(
9120 "Accept",
9121 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
9122 s.accepts[ s.dataTypes[ 0 ] ] +
9123 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
9124 s.accepts[ "*" ]
9125 );
9126
9127 // Check for headers option
9128 for ( i in s.headers ) {
9129 jqXHR.setRequestHeader( i, s.headers[ i ] );
9130 }
9131
9132 // Allow custom headers/mimetypes and early abort
9133 if ( s.beforeSend &&
9134 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
9135
9136 // Abort if not done already and return
9137 return jqXHR.abort();
9138 }
9139
9140 // Aborting is no longer a cancellation
9141 strAbort = "abort";
9142
9143 // Install callbacks on deferreds
9144 completeDeferred.add( s.complete );
9145 jqXHR.done( s.success );
9146 jqXHR.fail( s.error );
9147
9148 // Get transport
9149 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
9150
9151 // If no transport, we auto-abort
9152 if ( !transport ) {
9153 done( -1, "No Transport" );
9154 } else {
9155 jqXHR.readyState = 1;
9156
9157 // Send global event
9158 if ( fireGlobals ) {
9159 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
9160 }
9161
9162 // If request was aborted inside ajaxSend, stop there
9163 if ( completed ) {
9164 return jqXHR;
9165 }
9166
9167 // Timeout
9168 if ( s.async && s.timeout > 0 ) {
9169 timeoutTimer = window.setTimeout( function() {
9170 jqXHR.abort( "timeout" );
9171 }, s.timeout );
9172 }
9173
9174 try {
9175 completed = false;
9176 transport.send( requestHeaders, done );
9177 } catch ( e ) {
9178
9179 // Rethrow post-completion exceptions
9180 if ( completed ) {
9181 throw e;
9182 }
9183
9184 // Propagate others as results
9185 done( -1, e );
9186 }
9187 }
9188
9189 // Callback for when everything is done
9190 function done( status, nativeStatusText, responses, headers ) {
9191 var isSuccess, success, error, response, modified,
9192 statusText = nativeStatusText;
9193
9194 // Ignore repeat invocations
9195 if ( completed ) {
9196 return;
9197 }
9198
9199 completed = true;
9200
9201 // Clear timeout if it exists
9202 if ( timeoutTimer ) {
9203 window.clearTimeout( timeoutTimer );
9204 }
9205
9206 // Dereference transport for early garbage collection
9207 // (no matter how long the jqXHR object will be used)
9208 transport = undefined;
9209
9210 // Cache response headers
9211 responseHeadersString = headers || "";
9212
9213 // Set readyState
9214 jqXHR.readyState = status > 0 ? 4 : 0;
9215
9216 // Determine if successful
9217 isSuccess = status >= 200 && status < 300 || status === 304;
9218
9219 // Get response data
9220 if ( responses ) {
9221 response = ajaxHandleResponses( s, jqXHR, responses );
9222 }
9223
9224 // Convert no matter what (that way responseXXX fields are always set)
9225 response = ajaxConvert( s, response, jqXHR, isSuccess );
9226
9227 // If successful, handle type chaining
9228 if ( isSuccess ) {
9229
9230 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9231 if ( s.ifModified ) {
9232 modified = jqXHR.getResponseHeader( "Last-Modified" );
9233 if ( modified ) {
9234 jQuery.lastModified[ cacheURL ] = modified;
9235 }
9236 modified = jqXHR.getResponseHeader( "etag" );
9237 if ( modified ) {
9238 jQuery.etag[ cacheURL ] = modified;
9239 }
9240 }
9241
9242 // if no content
9243 if ( status === 204 || s.type === "HEAD" ) {
9244 statusText = "nocontent";
9245
9246 // if not modified
9247 } else if ( status === 304 ) {
9248 statusText = "notmodified";
9249
9250 // If we have data, let's convert it
9251 } else {
9252 statusText = response.state;
9253 success = response.data;
9254 error = response.error;
9255 isSuccess = !error;
9256 }
9257 } else {
9258
9259 // Extract error from statusText and normalize for non-aborts
9260 error = statusText;
9261 if ( status || !statusText ) {
9262 statusText = "error";
9263 if ( status < 0 ) {
9264 status = 0;
9265 }
9266 }
9267 }
9268
9269 // Set data for the fake xhr object
9270 jqXHR.status = status;
9271 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
9272
9273 // Success/Error
9274 if ( isSuccess ) {
9275 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
9276 } else {
9277 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
9278 }
9279
9280 // Status-dependent callbacks
9281 jqXHR.statusCode( statusCode );
9282 statusCode = undefined;
9283
9284 if ( fireGlobals ) {
9285 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
9286 [ jqXHR, s, isSuccess ? success : error ] );
9287 }
9288
9289 // Complete
9290 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
9291
9292 if ( fireGlobals ) {
9293 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
9294
9295 // Handle the global AJAX counter
9296 if ( !( --jQuery.active ) ) {
9297 jQuery.event.trigger( "ajaxStop" );
9298 }
9299 }
9300 }
9301
9302 return jqXHR;
9303 },
9304
9305 getJSON: function( url, data, callback ) {
9306 return jQuery.get( url, data, callback, "json" );
9307 },
9308
9309 getScript: function( url, callback ) {
9310 return jQuery.get( url, undefined, callback, "script" );
9311 }
9312} );
9313
9314jQuery.each( [ "get", "post" ], function( i, method ) {
9315 jQuery[ method ] = function( url, data, callback, type ) {
9316
9317 // Shift arguments if data argument was omitted
9318 if ( jQuery.isFunction( data ) ) {
9319 type = type || callback;
9320 callback = data;
9321 data = undefined;
9322 }
9323
9324 // The url can be an options object (which then must have .url)
9325 return jQuery.ajax( jQuery.extend( {
9326 url: url,
9327 type: method,
9328 dataType: type,
9329 data: data,
9330 success: callback
9331 }, jQuery.isPlainObject( url ) && url ) );
9332 };
9333} );
9334
9335
9336jQuery._evalUrl = function( url ) {
9337 return jQuery.ajax( {
9338 url: url,
9339
9340 // Make this explicit, since user can override this through ajaxSetup (#11264)
9341 type: "GET",
9342 dataType: "script",
9343 cache: true,
9344 async: false,
9345 global: false,
9346 "throws": true
9347 } );
9348};
9349
9350
9351jQuery.fn.extend( {
9352 wrapAll: function( html ) {
9353 var wrap;
9354
9355 if ( this[ 0 ] ) {
9356 if ( jQuery.isFunction( html ) ) {
9357 html = html.call( this[ 0 ] );
9358 }
9359
9360 // The elements to wrap the target around
9361 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
9362
9363 if ( this[ 0 ].parentNode ) {
9364 wrap.insertBefore( this[ 0 ] );
9365 }
9366
9367 wrap.map( function() {
9368 var elem = this;
9369
9370 while ( elem.firstElementChild ) {
9371 elem = elem.firstElementChild;
9372 }
9373
9374 return elem;
9375 } ).append( this );
9376 }
9377
9378 return this;
9379 },
9380
9381 wrapInner: function( html ) {
9382 if ( jQuery.isFunction( html ) ) {
9383 return this.each( function( i ) {
9384 jQuery( this ).wrapInner( html.call( this, i ) );
9385 } );
9386 }
9387
9388 return this.each( function() {
9389 var self = jQuery( this ),
9390 contents = self.contents();
9391
9392 if ( contents.length ) {
9393 contents.wrapAll( html );
9394
9395 } else {
9396 self.append( html );
9397 }
9398 } );
9399 },
9400
9401 wrap: function( html ) {
9402 var isFunction = jQuery.isFunction( html );
9403
9404 return this.each( function( i ) {
9405 jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
9406 } );
9407 },
9408
9409 unwrap: function( selector ) {
9410 this.parent( selector ).not( "body" ).each( function() {
9411 jQuery( this ).replaceWith( this.childNodes );
9412 } );
9413 return this;
9414 }
9415} );
9416
9417
9418jQuery.expr.pseudos.hidden = function( elem ) {
9419 return !jQuery.expr.pseudos.visible( elem );
9420};
9421jQuery.expr.pseudos.visible = function( elem ) {
9422 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
9423};
9424
9425
9426
9427
9428jQuery.ajaxSettings.xhr = function() {
9429 try {
9430 return new window.XMLHttpRequest();
9431 } catch ( e ) {}
9432};
9433
9434var xhrSuccessStatus = {
9435
9436 // File protocol always yields status code 0, assume 200
9437 0: 200,
9438
9439 // Support: IE <=9 only
9440 // #1450: sometimes IE returns 1223 when it should be 204
9441 1223: 204
9442 },
9443 xhrSupported = jQuery.ajaxSettings.xhr();
9444
9445support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
9446support.ajax = xhrSupported = !!xhrSupported;
9447
9448jQuery.ajaxTransport( function( options ) {
9449 var callback, errorCallback;
9450
9451 // Cross domain only allowed if supported through XMLHttpRequest
9452 if ( support.cors || xhrSupported && !options.crossDomain ) {
9453 return {
9454 send: function( headers, complete ) {
9455 var i,
9456 xhr = options.xhr();
9457
9458 xhr.open(
9459 options.type,
9460 options.url,
9461 options.async,
9462 options.username,
9463 options.password
9464 );
9465
9466 // Apply custom fields if provided
9467 if ( options.xhrFields ) {
9468 for ( i in options.xhrFields ) {
9469 xhr[ i ] = options.xhrFields[ i ];
9470 }
9471 }
9472
9473 // Override mime type if needed
9474 if ( options.mimeType && xhr.overrideMimeType ) {
9475 xhr.overrideMimeType( options.mimeType );
9476 }
9477
9478 // X-Requested-With header
9479 // For cross-domain requests, seeing as conditions for a preflight are
9480 // akin to a jigsaw puzzle, we simply never set it to be sure.
9481 // (it can always be set on a per-request basis or even using ajaxSetup)
9482 // For same-domain requests, won't change header if already provided.
9483 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
9484 headers[ "X-Requested-With" ] = "XMLHttpRequest";
9485 }
9486
9487 // Set headers
9488 for ( i in headers ) {
9489 xhr.setRequestHeader( i, headers[ i ] );
9490 }
9491
9492 // Callback
9493 callback = function( type ) {
9494 return function() {
9495 if ( callback ) {
9496 callback = errorCallback = xhr.onload =
9497 xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
9498
9499 if ( type === "abort" ) {
9500 xhr.abort();
9501 } else if ( type === "error" ) {
9502
9503 // Support: IE <=9 only
9504 // On a manual native abort, IE9 throws
9505 // errors on any property access that is not readyState
9506 if ( typeof xhr.status !== "number" ) {
9507 complete( 0, "error" );
9508 } else {
9509 complete(
9510
9511 // File: protocol always yields status 0; see #8605, #14207
9512 xhr.status,
9513 xhr.statusText
9514 );
9515 }
9516 } else {
9517 complete(
9518 xhrSuccessStatus[ xhr.status ] || xhr.status,
9519 xhr.statusText,
9520
9521 // Support: IE <=9 only
9522 // IE9 has no XHR2 but throws on binary (trac-11426)
9523 // For XHR2 non-text, let the caller handle it (gh-2498)
9524 ( xhr.responseType || "text" ) !== "text" ||
9525 typeof xhr.responseText !== "string" ?
9526 { binary: xhr.response } :
9527 { text: xhr.responseText },
9528 xhr.getAllResponseHeaders()
9529 );
9530 }
9531 }
9532 };
9533 };
9534
9535 // Listen to events
9536 xhr.onload = callback();
9537 errorCallback = xhr.onerror = callback( "error" );
9538
9539 // Support: IE 9 only
9540 // Use onreadystatechange to replace onabort
9541 // to handle uncaught aborts
9542 if ( xhr.onabort !== undefined ) {
9543 xhr.onabort = errorCallback;
9544 } else {
9545 xhr.onreadystatechange = function() {
9546
9547 // Check readyState before timeout as it changes
9548 if ( xhr.readyState === 4 ) {
9549
9550 // Allow onerror to be called first,
9551 // but that will not handle a native abort
9552 // Also, save errorCallback to a variable
9553 // as xhr.onerror cannot be accessed
9554 window.setTimeout( function() {
9555 if ( callback ) {
9556 errorCallback();
9557 }
9558 } );
9559 }
9560 };
9561 }
9562
9563 // Create the abort callback
9564 callback = callback( "abort" );
9565
9566 try {
9567
9568 // Do send the request (this may raise an exception)
9569 xhr.send( options.hasContent && options.data || null );
9570 } catch ( e ) {
9571
9572 // #14683: Only rethrow if this hasn't been notified as an error yet
9573 if ( callback ) {
9574 throw e;
9575 }
9576 }
9577 },
9578
9579 abort: function() {
9580 if ( callback ) {
9581 callback();
9582 }
9583 }
9584 };
9585 }
9586} );
9587
9588
9589
9590
9591// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
9592jQuery.ajaxPrefilter( function( s ) {
9593 if ( s.crossDomain ) {
9594 s.contents.script = false;
9595 }
9596} );
9597
9598// Install script dataType
9599jQuery.ajaxSetup( {
9600 accepts: {
9601 script: "text/javascript, application/javascript, " +
9602 "application/ecmascript, application/x-ecmascript"
9603 },
9604 contents: {
9605 script: /\b(?:java|ecma)script\b/
9606 },
9607 converters: {
9608 "text script": function( text ) {
9609 jQuery.globalEval( text );
9610 return text;
9611 }
9612 }
9613} );
9614
9615// Handle cache's special case and crossDomain
9616jQuery.ajaxPrefilter( "script", function( s ) {
9617 if ( s.cache === undefined ) {
9618 s.cache = false;
9619 }
9620 if ( s.crossDomain ) {
9621 s.type = "GET";
9622 }
9623} );
9624
9625// Bind script tag hack transport
9626jQuery.ajaxTransport( "script", function( s ) {
9627
9628 // This transport only deals with cross domain requests
9629 if ( s.crossDomain ) {
9630 var script, callback;
9631 return {
9632 send: function( _, complete ) {
9633 script = jQuery( "<script>" ).prop( {
9634 charset: s.scriptCharset,
9635 src: s.url
9636 } ).on(
9637 "load error",
9638 callback = function( evt ) {
9639 script.remove();
9640 callback = null;
9641 if ( evt ) {
9642 complete( evt.type === "error" ? 404 : 200, evt.type );
9643 }
9644 }
9645 );
9646
9647 // Use native DOM manipulation to avoid our domManip AJAX trickery
9648 document.head.appendChild( script[ 0 ] );
9649 },
9650 abort: function() {
9651 if ( callback ) {
9652 callback();
9653 }
9654 }
9655 };
9656 }
9657} );
9658
9659
9660
9661
9662var oldCallbacks = [],
9663 rjsonp = /(=)\?(?=&|$)|\?\?/;
9664
9665// Default jsonp settings
9666jQuery.ajaxSetup( {
9667 jsonp: "callback",
9668 jsonpCallback: function() {
9669 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
9670 this[ callback ] = true;
9671 return callback;
9672 }
9673} );
9674
9675// Detect, normalize options and install callbacks for jsonp requests
9676jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
9677
9678 var callbackName, overwritten, responseContainer,
9679 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
9680 "url" :
9681 typeof s.data === "string" &&
9682 ( s.contentType || "" )
9683 .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
9684 rjsonp.test( s.data ) && "data"
9685 );
9686
9687 // Handle iff the expected data type is "jsonp" or we have a parameter to set
9688 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
9689
9690 // Get callback name, remembering preexisting value associated with it
9691 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
9692 s.jsonpCallback() :
9693 s.jsonpCallback;
9694
9695 // Insert callback into url or form data
9696 if ( jsonProp ) {
9697 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
9698 } else if ( s.jsonp !== false ) {
9699 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
9700 }
9701
9702 // Use data converter to retrieve json after script execution
9703 s.converters[ "script json" ] = function() {
9704 if ( !responseContainer ) {
9705 jQuery.error( callbackName + " was not called" );
9706 }
9707 return responseContainer[ 0 ];
9708 };
9709
9710 // Force json dataType
9711 s.dataTypes[ 0 ] = "json";
9712
9713 // Install callback
9714 overwritten = window[ callbackName ];
9715 window[ callbackName ] = function() {
9716 responseContainer = arguments;
9717 };
9718
9719 // Clean-up function (fires after converters)
9720 jqXHR.always( function() {
9721
9722 // If previous value didn't exist - remove it
9723 if ( overwritten === undefined ) {
9724 jQuery( window ).removeProp( callbackName );
9725
9726 // Otherwise restore preexisting value
9727 } else {
9728 window[ callbackName ] = overwritten;
9729 }
9730
9731 // Save back as free
9732 if ( s[ callbackName ] ) {
9733
9734 // Make sure that re-using the options doesn't screw things around
9735 s.jsonpCallback = originalSettings.jsonpCallback;
9736
9737 // Save the callback name for future use
9738 oldCallbacks.push( callbackName );
9739 }
9740
9741 // Call if it was a function and we have a response
9742 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
9743 overwritten( responseContainer[ 0 ] );
9744 }
9745
9746 responseContainer = overwritten = undefined;
9747 } );
9748
9749 // Delegate to script
9750 return "script";
9751 }
9752} );
9753
9754
9755
9756
9757// Support: Safari 8 only
9758// In Safari 8 documents created via document.implementation.createHTMLDocument
9759// collapse sibling forms: the second one becomes a child of the first one.
9760// Because of that, this security measure has to be disabled in Safari 8.
9761// https://bugs.webkit.org/show_bug.cgi?id=137337
9762support.createHTMLDocument = ( function() {
9763 var body = document.implementation.createHTMLDocument( "" ).body;
9764 body.innerHTML = "<form></form><form></form>";
9765 return body.childNodes.length === 2;
9766} )();
9767
9768
9769// Argument "data" should be string of html
9770// context (optional): If specified, the fragment will be created in this context,
9771// defaults to document
9772// keepScripts (optional): If true, will include scripts passed in the html string
9773jQuery.parseHTML = function( data, context, keepScripts ) {
9774 if ( typeof data !== "string" ) {
9775 return [];
9776 }
9777 if ( typeof context === "boolean" ) {
9778 keepScripts = context;
9779 context = false;
9780 }
9781
9782 var base, parsed, scripts;
9783
9784 if ( !context ) {
9785
9786 // Stop scripts or inline event handlers from being executed immediately
9787 // by using document.implementation
9788 if ( support.createHTMLDocument ) {
9789 context = document.implementation.createHTMLDocument( "" );
9790
9791 // Set the base href for the created document
9792 // so any parsed elements with URLs
9793 // are based on the document's URL (gh-2965)
9794 base = context.createElement( "base" );
9795 base.href = document.location.href;
9796 context.head.appendChild( base );
9797 } else {
9798 context = document;
9799 }
9800 }
9801
9802 parsed = rsingleTag.exec( data );
9803 scripts = !keepScripts && [];
9804
9805 // Single tag
9806 if ( parsed ) {
9807 return [ context.createElement( parsed[ 1 ] ) ];
9808 }
9809
9810 parsed = buildFragment( [ data ], context, scripts );
9811
9812 if ( scripts && scripts.length ) {
9813 jQuery( scripts ).remove();
9814 }
9815
9816 return jQuery.merge( [], parsed.childNodes );
9817};
9818
9819
9820/**
9821 * Load a url into a page
9822 */
9823jQuery.fn.load = function( url, params, callback ) {
9824 var selector, type, response,
9825 self = this,
9826 off = url.indexOf( " " );
9827
9828 if ( off > -1 ) {
9829 selector = stripAndCollapse( url.slice( off ) );
9830 url = url.slice( 0, off );
9831 }
9832
9833 // If it's a function
9834 if ( jQuery.isFunction( params ) ) {
9835
9836 // We assume that it's the callback
9837 callback = params;
9838 params = undefined;
9839
9840 // Otherwise, build a param string
9841 } else if ( params && typeof params === "object" ) {
9842 type = "POST";
9843 }
9844
9845 // If we have elements to modify, make the request
9846 if ( self.length > 0 ) {
9847 jQuery.ajax( {
9848 url: url,
9849
9850 // If "type" variable is undefined, then "GET" method will be used.
9851 // Make value of this field explicit since
9852 // user can override it through ajaxSetup method
9853 type: type || "GET",
9854 dataType: "html",
9855 data: params
9856 } ).done( function( responseText ) {
9857
9858 // Save response for use in complete callback
9859 response = arguments;
9860
9861 self.html( selector ?
9862
9863 // If a selector was specified, locate the right elements in a dummy div
9864 // Exclude scripts to avoid IE 'Permission Denied' errors
9865 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
9866
9867 // Otherwise use the full result
9868 responseText );
9869
9870 // If the request succeeds, this function gets "data", "status", "jqXHR"
9871 // but they are ignored because response was set above.
9872 // If it fails, this function gets "jqXHR", "status", "error"
9873 } ).always( callback && function( jqXHR, status ) {
9874 self.each( function() {
9875 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
9876 } );
9877 } );
9878 }
9879
9880 return this;
9881};
9882
9883
9884
9885
9886// Attach a bunch of functions for handling common AJAX events
9887jQuery.each( [
9888 "ajaxStart",
9889 "ajaxStop",
9890 "ajaxComplete",
9891 "ajaxError",
9892 "ajaxSuccess",
9893 "ajaxSend"
9894], function( i, type ) {
9895 jQuery.fn[ type ] = function( fn ) {
9896 return this.on( type, fn );
9897 };
9898} );
9899
9900
9901
9902
9903jQuery.expr.pseudos.animated = function( elem ) {
9904 return jQuery.grep( jQuery.timers, function( fn ) {
9905 return elem === fn.elem;
9906 } ).length;
9907};
9908
9909
9910
9911
9912jQuery.offset = {
9913 setOffset: function( elem, options, i ) {
9914 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
9915 position = jQuery.css( elem, "position" ),
9916 curElem = jQuery( elem ),
9917 props = {};
9918
9919 // Set position first, in-case top/left are set even on static elem
9920 if ( position === "static" ) {
9921 elem.style.position = "relative";
9922 }
9923
9924 curOffset = curElem.offset();
9925 curCSSTop = jQuery.css( elem, "top" );
9926 curCSSLeft = jQuery.css( elem, "left" );
9927 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
9928 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
9929
9930 // Need to be able to calculate position if either
9931 // top or left is auto and position is either absolute or fixed
9932 if ( calculatePosition ) {
9933 curPosition = curElem.position();
9934 curTop = curPosition.top;
9935 curLeft = curPosition.left;
9936
9937 } else {
9938 curTop = parseFloat( curCSSTop ) || 0;
9939 curLeft = parseFloat( curCSSLeft ) || 0;
9940 }
9941
9942 if ( jQuery.isFunction( options ) ) {
9943
9944 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
9945 options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
9946 }
9947
9948 if ( options.top != null ) {
9949 props.top = ( options.top - curOffset.top ) + curTop;
9950 }
9951 if ( options.left != null ) {
9952 props.left = ( options.left - curOffset.left ) + curLeft;
9953 }
9954
9955 if ( "using" in options ) {
9956 options.using.call( elem, props );
9957
9958 } else {
9959 curElem.css( props );
9960 }
9961 }
9962};
9963
9964jQuery.fn.extend( {
9965 offset: function( options ) {
9966
9967 // Preserve chaining for setter
9968 if ( arguments.length ) {
9969 return options === undefined ?
9970 this :
9971 this.each( function( i ) {
9972 jQuery.offset.setOffset( this, options, i );
9973 } );
9974 }
9975
9976 var doc, docElem, rect, win,
9977 elem = this[ 0 ];
9978
9979 if ( !elem ) {
9980 return;
9981 }
9982
9983 // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
9984 // Support: IE <=11 only
9985 // Running getBoundingClientRect on a
9986 // disconnected node in IE throws an error
9987 if ( !elem.getClientRects().length ) {
9988 return { top: 0, left: 0 };
9989 }
9990
9991 rect = elem.getBoundingClientRect();
9992
9993 doc = elem.ownerDocument;
9994 docElem = doc.documentElement;
9995 win = doc.defaultView;
9996
9997 return {
9998 top: rect.top + win.pageYOffset - docElem.clientTop,
9999 left: rect.left + win.pageXOffset - docElem.clientLeft
10000 };
10001 },
10002
10003 position: function() {
10004 if ( !this[ 0 ] ) {
10005 return;
10006 }
10007
10008 var offsetParent, offset,
10009 elem = this[ 0 ],
10010 parentOffset = { top: 0, left: 0 };
10011
10012 // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
10013 // because it is its only offset parent
10014 if ( jQuery.css( elem, "position" ) === "fixed" ) {
10015
10016 // Assume getBoundingClientRect is there when computed position is fixed
10017 offset = elem.getBoundingClientRect();
10018
10019 } else {
10020
10021 // Get *real* offsetParent
10022 offsetParent = this.offsetParent();
10023
10024 // Get correct offsets
10025 offset = this.offset();
10026 if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
10027 parentOffset = offsetParent.offset();
10028 }
10029
10030 // Add offsetParent borders
10031 parentOffset = {
10032 top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
10033 left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
10034 };
10035 }
10036
10037 // Subtract parent offsets and element margins
10038 return {
10039 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
10040 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
10041 };
10042 },
10043
10044 // This method will return documentElement in the following cases:
10045 // 1) For the element inside the iframe without offsetParent, this method will return
10046 // documentElement of the parent window
10047 // 2) For the hidden or detached element
10048 // 3) For body or html element, i.e. in case of the html node - it will return itself
10049 //
10050 // but those exceptions were never presented as a real life use-cases
10051 // and might be considered as more preferable results.
10052 //
10053 // This logic, however, is not guaranteed and can change at any point in the future
10054 offsetParent: function() {
10055 return this.map( function() {
10056 var offsetParent = this.offsetParent;
10057
10058 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
10059 offsetParent = offsetParent.offsetParent;
10060 }
10061
10062 return offsetParent || documentElement;
10063 } );
10064 }
10065} );
10066
10067// Create scrollLeft and scrollTop methods
10068jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
10069 var top = "pageYOffset" === prop;
10070
10071 jQuery.fn[ method ] = function( val ) {
10072 return access( this, function( elem, method, val ) {
10073
10074 // Coalesce documents and windows
10075 var win;
10076 if ( jQuery.isWindow( elem ) ) {
10077 win = elem;
10078 } else if ( elem.nodeType === 9 ) {
10079 win = elem.defaultView;
10080 }
10081
10082 if ( val === undefined ) {
10083 return win ? win[ prop ] : elem[ method ];
10084 }
10085
10086 if ( win ) {
10087 win.scrollTo(
10088 !top ? val : win.pageXOffset,
10089 top ? val : win.pageYOffset
10090 );
10091
10092 } else {
10093 elem[ method ] = val;
10094 }
10095 }, method, val, arguments.length );
10096 };
10097} );
10098
10099// Support: Safari <=7 - 9.1, Chrome <=37 - 49
10100// Add the top/left cssHooks using jQuery.fn.position
10101// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
10102// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
10103// getComputedStyle returns percent when specified for top/left/bottom/right;
10104// rather than make the css module depend on the offset module, just check for it here
10105jQuery.each( [ "top", "left" ], function( i, prop ) {
10106 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
10107 function( elem, computed ) {
10108 if ( computed ) {
10109 computed = curCSS( elem, prop );
10110
10111 // If curCSS returns percentage, fallback to offset
10112 return rnumnonpx.test( computed ) ?
10113 jQuery( elem ).position()[ prop ] + "px" :
10114 computed;
10115 }
10116 }
10117 );
10118} );
10119
10120
10121// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
10122jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10123 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
10124 function( defaultExtra, funcName ) {
10125
10126 // Margin is only for outerHeight, outerWidth
10127 jQuery.fn[ funcName ] = function( margin, value ) {
10128 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
10129 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
10130
10131 return access( this, function( elem, type, value ) {
10132 var doc;
10133
10134 if ( jQuery.isWindow( elem ) ) {
10135
10136 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
10137 return funcName.indexOf( "outer" ) === 0 ?
10138 elem[ "inner" + name ] :
10139 elem.document.documentElement[ "client" + name ];
10140 }
10141
10142 // Get document width or height
10143 if ( elem.nodeType === 9 ) {
10144 doc = elem.documentElement;
10145
10146 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
10147 // whichever is greatest
10148 return Math.max(
10149 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
10150 elem.body[ "offset" + name ], doc[ "offset" + name ],
10151 doc[ "client" + name ]
10152 );
10153 }
10154
10155 return value === undefined ?
10156
10157 // Get width or height on the element, requesting but not forcing parseFloat
10158 jQuery.css( elem, type, extra ) :
10159
10160 // Set width or height on the element
10161 jQuery.style( elem, type, value, extra );
10162 }, type, chainable ? margin : undefined, chainable );
10163 };
10164 } );
10165} );
10166
10167
10168jQuery.fn.extend( {
10169
10170 bind: function( types, data, fn ) {
10171 return this.on( types, null, data, fn );
10172 },
10173 unbind: function( types, fn ) {
10174 return this.off( types, null, fn );
10175 },
10176
10177 delegate: function( selector, types, data, fn ) {
10178 return this.on( types, selector, data, fn );
10179 },
10180 undelegate: function( selector, types, fn ) {
10181
10182 // ( namespace ) or ( selector, types [, fn] )
10183 return arguments.length === 1 ?
10184 this.off( selector, "**" ) :
10185 this.off( types, selector || "**", fn );
10186 }
10187} );
10188
10189jQuery.holdReady = function( hold ) {
10190 if ( hold ) {
10191 jQuery.readyWait++;
10192 } else {
10193 jQuery.ready( true );
10194 }
10195};
10196jQuery.isArray = Array.isArray;
10197jQuery.parseJSON = JSON.parse;
10198jQuery.nodeName = nodeName;
10199
10200
10201
10202
10203// Register as a named AMD module, since jQuery can be concatenated with other
10204// files that may use define, but not via a proper concatenation script that
10205// understands anonymous AMD modules. A named AMD is safest and most robust
10206// way to register. Lowercase jquery is used because AMD module names are
10207// derived from file names, and jQuery is normally delivered in a lowercase
10208// file name. Do this after creating the global so that if an AMD module wants
10209// to call noConflict to hide this version of jQuery, it will work.
10210
10211// Note that for maximum portability, libraries that are not jQuery should
10212// declare themselves as anonymous modules, and avoid setting a global if an
10213// AMD loader is present. jQuery is a special case. For more information, see
10214// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
10215
10216if ( typeof define === "function" && define.amd ) {
10217 define( "jquery", [], function() {
10218 return jQuery;
10219 } );
10220}
10221
10222
10223
10224
10225var
10226
10227 // Map over jQuery in case of overwrite
10228 _jQuery = window.jQuery,
10229
10230 // Map over the $ in case of overwrite
10231 _$ = window.$;
10232
10233jQuery.noConflict = function( deep ) {
10234 if ( window.$ === jQuery ) {
10235 window.$ = _$;
10236 }
10237
10238 if ( deep && window.jQuery === jQuery ) {
10239 window.jQuery = _jQuery;
10240 }
10241
10242 return jQuery;
10243};
10244
10245// Expose jQuery and $ identifiers, even in AMD
10246// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
10247// and CommonJS for browser emulators (#13566)
10248if ( !noGlobal ) {
10249 window.jQuery = window.$ = jQuery;
10250}
10251
10252
10253
10254
10255return jQuery;
10256} );
10257;
10258Array.prototype.equals = function (other) {
10259 if (!Array.isArray(other) || this.length != other.length) {
10260 return false;
10261 }
10262 for (var i = 0; i < this.length; i++) {
10263 if (Array.isArray(this[i])) {
10264 if (!this[i].equals(other[i])) {
10265 return false;
10266 }
10267 }
10268 else if (this[i] != other[i]) {
10269 return false;
10270 }
10271 }
10272 return true;
10273};
10274var virtualKeyboardDetector = function (inputStart, inputEnd, blacklist) {
10275 if (blacklist === void 0) { blacklist = ['Shift']; }
10276 var func = function (ele, callback) {
10277 var timeout = null;
10278 var buffer = [];
10279 var handler = function (event) {
10280 var target = $(event.target);
10281 if (buffer.length || event.key == inputStart) {
10282 //if (target.is('input') || target.parent('input').length > 0) {
10283 event.preventDefault();
10284 //}
10285 event.stopPropagation();
10286 if (event.key == inputStart) {
10287 buffer = [];
10288 }
10289 // cancel the current timeout
10290 timeout && clearTimeout(timeout);
10291 // register the timeout to cancel if we don't type another key
10292 timeout = setTimeout(function () {
10293 buffer = [];
10294 }, 300);
10295 if (blacklist.indexOf(event.key) == -1) {
10296 buffer.push(event.key);
10297 var inputEndLength = buffer.length - inputEnd.length;
10298 if (buffer.slice(inputEndLength).equals(inputEnd)) {
10299 callback(buffer.slice(1, inputEndLength).join(''));
10300 buffer = [];
10301 }
10302 }
10303 }
10304 };
10305 ele.addEventListener('keydown', handler);
10306 return {
10307 destroy: function () {
10308 ele.removeEventListener('keydown', handler);
10309 }
10310 };
10311 };
10312 return func;
10313};
10314var wristbandDetector = virtualKeyboardDetector(';', ['?']);
10315//# sourceMappingURL=wristband.js.map;
10316var linq = {
10317 EqualityComparer: function (a, b) {
10318 return a === b || a.valueOf() === b.valueOf();
10319 },
10320 SortComparer: function (a, b) {
10321 if (a === b) return 0;
10322 if (a === null) return -1;
10323 if (b === null) return 1;
10324 if (typeof a == 'string') return a.toString().localeCompare(b.toString());
10325 return a.valueOf() - b.valueOf();
10326 },
10327 Predicate: function () {
10328 return true;
10329 },
10330 Selector: function (t) {
10331 return t;
10332 }
10333};
10334(function () {
10335 'use strict';
10336
10337 var global = global;
10338 var window = window || global;
10339
10340 Array.prototype.select = Array.prototype.map || function (selector, context) {
10341 context = context || window;
10342 var arr = [];
10343 var l = this.length;
10344 for (var i = 0; i < l; i++)
10345 arr.push(Selector.call(context, this[i], i, this));
10346 return arr;
10347 };
10348
10349}());
10350(function () {
10351 'use strict';
10352
10353 Array.prototype.selectMany = function (selector, resSelector) {
10354 resSelector = resSelector || function (i, res) {
10355 return res;
10356 };
10357 return this.aggregate(function (a, b) {
10358 return a.concat(selector(b).select(function (res) {
10359 return resSelector(b, res);
10360 }));
10361 }, []);
10362 };
10363
10364}());
10365(function () {
10366 'use strict';
10367
10368 Array.prototype.take = function (c) {
10369 return this.slice(0, c);
10370 };
10371
10372}());
10373(function () {
10374 'use strict';
10375
10376 Array.prototype.skip = Array.prototype.slice;
10377
10378}());
10379(function () {
10380 'use strict';
10381
10382 Array.prototype.first = function (predicate, def) {
10383 var l = this.length;
10384 if (!predicate) return l ? this[0] : def == null ? null : def;
10385 for (var i = 0; i < l; i++) {
10386 if (predicate(this[i], i, this))
10387 return this[i];
10388 }
10389
10390 return def == null ? null : def;
10391 };
10392
10393}());
10394
10395(function () {
10396 'use strict';
10397
10398 Array.prototype.last = function (predicate, def) {
10399 var l = this.length;
10400 if (!predicate) return l ? this[l - 1] : def == null ? null : def;
10401 while (l-- > 0) {
10402 if (predicate(this[l], l, this))
10403 return this[l];
10404 }
10405
10406 return def == null ? null : def;
10407 };
10408
10409}());
10410(function () {
10411 'use strict';
10412
10413 Array.prototype.union = function (arr) {
10414 return this.concat(arr).distinct();
10415 };
10416
10417}());
10418(function () {
10419 'use strict';
10420
10421 Array.prototype.intersect = function (arr, comparer) {
10422 comparer = comparer || linq.EqualityComparer;
10423 return this.distinct(comparer).where(function (t) {
10424 return arr.contains(t, comparer);
10425 });
10426 };
10427
10428}());
10429(function () {
10430 'use strict';
10431
10432 Array.prototype.except = function (arr, comparer) {
10433 if (!(arr instanceof Array)) arr = [arr];
10434 comparer = comparer || linq.EqualityComparer;
10435 var l = this.length;
10436 var res = [];
10437 for (var i = 0; i < l; i++) {
10438 var k = arr.length;
10439 var t = false;
10440 while (k-- > 0) {
10441 if (comparer(this[i], arr[k]) === true) {
10442 t = true;
10443 break;
10444 }
10445 }
10446 if (!t) res.push(this[i]);
10447 }
10448 return res;
10449 };
10450
10451}());
10452(function () {
10453 'use strict';
10454
10455 Array.prototype.distinct = function (comparer) {
10456 var arr = [];
10457 var l = this.length;
10458 for (var i = 0; i < l; i++) {
10459 if (!arr.contains(this[i], comparer))
10460 arr.push(this[i]);
10461 }
10462 return arr;
10463 };
10464
10465}());
10466(function () {
10467 'use strict';
10468
10469 Array.prototype.zip = function (arr, selector) {
10470 return this
10471 .take(Math.min(this.length, arr.length))
10472 .select(function (t, i) {
10473 return selector(t, arr[i]);
10474 });
10475 };
10476
10477}());
10478
10479(function () {
10480 'use strict';
10481
10482 Array.prototype.indexOf = Array.prototype.indexOf || function (o, index) {
10483 var l = this.length;
10484 for (var i = Math.max(Math.min(index, l), 0) || 0; i < l; i++)
10485 if (this[i] === o) return i;
10486 return -1;
10487 };
10488
10489}());
10490(function () {
10491 'use strict';
10492
10493 Array.prototype.lastIndexOf = Array.prototype.lastIndexOf || function (o, index) {
10494 var l = Math.max(Math.min(index || this.length, this.length), 0);
10495 while (l-- > 0)
10496 if (this[l] === o) return l;
10497 return -1;
10498 };
10499
10500}());
10501(function () {
10502 'use strict';
10503
10504 Array.prototype.remove = function (item) {
10505 var i = this.indexOf(item);
10506 if (i != -1)
10507 this.splice(i, 1);
10508 };
10509
10510}());
10511(function () {
10512 'use strict';
10513
10514 Array.prototype.removeAll = function (predicate) {
10515 var item;
10516 var i = 0;
10517 while ((item = this.first(predicate)) != null) {
10518 i++;
10519 this.remove(item);
10520 }
10521
10522 return i;
10523 };
10524
10525}());
10526(function () {
10527 'use strict';
10528
10529 Array.prototype.orderBy = function (selector, comparer) {
10530 comparer = comparer || linq.SortComparer;
10531 var arr = this.slice(0);
10532 var fn = function (a, b) {
10533 return comparer(selector(a), selector(b));
10534 };
10535
10536 arr.thenBy = function (selector, comparer) {
10537 comparer = comparer || linq.SortComparer;
10538 return arr.orderBy(linq.Selector, function (a, b) {
10539 var res = fn(a, b);
10540 return res === 0 ? comparer(selector(a), selector(b)) : res;
10541 });
10542 };
10543
10544 arr.thenByDescending = function (selector, comparer) {
10545 comparer = comparer || linq.SortComparer;
10546 return arr.orderBy(linq.Selector, function (a, b) {
10547 var res = fn(a, b);
10548 return res === 0 ? -comparer(selector(a), selector(b)) : res;
10549 });
10550 };
10551
10552 return arr.sort(fn);
10553 };
10554
10555}());
10556(function () {
10557 'use strict';
10558
10559 Array.prototype.orderByDescending = function (selector, comparer) {
10560 comparer = comparer || linq.SortComparer;
10561 return this.orderBy(linq.Selector, function (a, b) {
10562 return -comparer(a, b);
10563 });
10564 };
10565
10566}());
10567(function () {
10568 'use strict';
10569
10570 Array.prototype.innerJoin = function (arr, outer, inner, result, comparer) {
10571 comparer = comparer || linq.EqualityComparer;
10572 var res = [];
10573
10574 this.forEach(function (t) {
10575 arr.where(function (u) {
10576 return comparer(outer(t), inner(u));
10577 })
10578 .forEach(function (u) {
10579 res.push(result(t, u));
10580 });
10581 });
10582
10583 return res;
10584 };
10585
10586}());
10587(function () {
10588 'use strict';
10589
10590 Array.prototype.groupJoin = function (arr, outer, inner, result, comparer) {
10591 comparer = comparer || linq.EqualityComparer;
10592 return this
10593 .select(function (t) {
10594 var key = outer(t);
10595 return {
10596 outer: t,
10597 inner: arr.where(function (u) {
10598 return comparer(key, inner(u));
10599 }),
10600 key: key
10601 };
10602 })
10603 .select(function (t) {
10604 t.inner.key = t.key;
10605 return result(t.outer, t.inner);
10606 });
10607 };
10608
10609}());
10610(function () {
10611 'use strict';
10612
10613 Array.prototype.groupBy = function (selector, comparer) {
10614 var grp = [];
10615 var l = this.length;
10616 comparer = comparer || linq.EqualityComparer;
10617 selector = selector || linq.Selector;
10618
10619 for (var i = 0; i < l; i++) {
10620 var k = selector(this[i]);
10621 var g = grp.first(function (u) {
10622 return comparer(u.key, k);
10623 });
10624
10625 if (!g) {
10626 g = [];
10627 g.key = k;
10628 grp.push(g);
10629 }
10630
10631 g.push(this[i]);
10632 }
10633 return grp;
10634 };
10635
10636}());
10637
10638(function () {
10639 'use strict';
10640
10641 Array.prototype.toDictionary = function (keySelector, valueSelector) {
10642 var o = {};
10643 var l = this.length;
10644 while (l-- > 0) {
10645 var key = keySelector(this[l]);
10646 if (key == null || key === '') continue;
10647 o[key] = valueSelector(this[l]);
10648 }
10649 return o;
10650 };
10651
10652}());
10653(function () {
10654 'use strict';
10655
10656 Array.prototype.aggregate = Array.prototype.reduce || function (func, seed) {
10657 var arr = this.slice(0);
10658 var l = this.length;
10659 if (seed == null) seed = arr.shift();
10660
10661 for (var i = 0; i < l; i++)
10662 seed = func(seed, arr[i], i, this);
10663
10664 return seed;
10665 };
10666
10667}());
10668(function () {
10669 'use strict';
10670
10671 Array.prototype.min = function (s) {
10672 s = s || linq.Selector;
10673 var l = this.length;
10674 var min = s(this[0]);
10675 while (l-- > 0)
10676 if (s(this[l]) < min) min = s(this[l]);
10677 return min;
10678 };
10679
10680}());
10681(function () {
10682 'use strict';
10683
10684 Array.prototype.max = function (s) {
10685 s = s || linq.Selector;
10686 var l = this.length;
10687 var max = s(this[0]);
10688 while (l-- > 0)
10689 if (s(this[l]) > max) max = s(this[l]);
10690 return max;
10691 };
10692
10693}());
10694(function () {
10695 'use strict';
10696
10697 Array.prototype.sum = function (s) {
10698 s = s || linq.Selector;
10699 var l = this.length;
10700 var sum = 0;
10701 while (l-- > 0) sum += s(this[l]);
10702 return sum;
10703 };
10704
10705}());
10706(function () {
10707 'use strict';
10708
10709 var global = global;
10710 var window = window || global;
10711
10712 Array.prototype.where = Array.prototype.filter || function (predicate, context) {
10713 context = context || window;
10714 var arr = [];
10715 var l = this.length;
10716 for (var i = 0; i < l; i++)
10717 if (Predicate.call(context, this[i], i, this) === true) arr.push(this[i]);
10718 return arr;
10719 };
10720
10721}());
10722(function () {
10723 'use strict';
10724
10725 var global = global;
10726 var window = window || global;
10727
10728 Array.prototype.any = function (predicate, context) {
10729 context = context || window;
10730 predicate = predicate || linq.Predicate;
10731 var f = this.some || function (p, c) {
10732 var l = this.length;
10733 if (!p) return l > 0;
10734 while (l-- > 0)
10735 if (p.call(c, this[l], l, this) === true) return true;
10736 return false;
10737 };
10738 return f.apply(this, [predicate, context]);
10739 };
10740
10741}());
10742(function () {
10743 'use strict';
10744
10745 var global = global;
10746 var window = window || global;
10747
10748 Array.prototype.all = function (predicate, context) {
10749 context = context || window;
10750 predicate = predicate || linq.Predicate;
10751 var f = this.every || function (p, c) {
10752 return this.length == this.where(p, c).length;
10753 };
10754 return f.apply(this, [predicate, context]);
10755 };
10756
10757}());
10758
10759(function () {
10760 'use strict';
10761
10762 Array.prototype.takeWhile = function (predicate) {
10763 predicate = predicate || linq.Predicate;
10764 var l = this.length;
10765 var arr = [];
10766 for (var i = 0; i < l && predicate(this[i], i) === true; i++)
10767 arr.push(this[i]);
10768
10769 return arr;
10770 };
10771
10772}());
10773(function () {
10774 'use strict';
10775
10776 Array.prototype.skipWhile = function (predicate) {
10777 predicate = predicate || linq.Predicate;
10778 var l = this.length;
10779 var i = 0;
10780 for (i = 0; i < l; i++)
10781 if (predicate(this[i], i) === false) break;
10782
10783 return this.skip(i);
10784 };
10785
10786}());
10787(function () {
10788 'use strict';
10789
10790 Array.prototype.contains = function (o, comparer) {
10791 comparer = comparer || linq.EqualityComparer;
10792 var l = this.length;
10793 while (l-- > 0)
10794 if (comparer(this[l], o) === true) return true;
10795 return false;
10796 };
10797
10798}());
10799(function () {
10800 'use strict';
10801
10802 var global = global;
10803 var window = window || global;
10804
10805 Array.prototype.forEach = Array.prototype.forEach || function (callback, context) {
10806 context = context || window;
10807 var l = this.length;
10808 for (var i = 0; i < l; i++)
10809 callback.call(context, this[i], i, this);
10810 };
10811
10812}());
10813(function () {
10814 'use strict';
10815
10816 Array.prototype.defaultIfEmpty = function (val) {
10817 return this.length === 0 ? [val === null ? null : val] : this;
10818 };
10819
10820}());
10821(function () {
10822 'use strict';
10823
10824 Array.range = function (start, count) {
10825 var arr = [];
10826 while (count-- > 0) {
10827 arr.push(start++);
10828 }
10829 return arr;
10830 };
10831
10832}());;
10833(function (main) {
10834 'use strict';
10835
10836 /**
10837 * Parse or format dates
10838 * @class fecha
10839 */
10840 var fecha = {};
10841 var token = /d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
10842 var twoDigits = /\d\d?/;
10843 var threeDigits = /\d{3}/;
10844 var fourDigits = /\d{4}/;
10845 var word = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
10846 var literal = /\[([^]*?)\]/gm;
10847 var noop = function () {
10848 };
10849
10850 function shorten(arr, sLen) {
10851 var newArr = [];
10852 for (var i = 0, len = arr.length; i < len; i++) {
10853 newArr.push(arr[i].substr(0, sLen));
10854 }
10855 return newArr;
10856 }
10857
10858 function monthUpdate(arrName) {
10859 return function (d, v, i18n) {
10860 var index = i18n[arrName].indexOf(v.charAt(0).toUpperCase() + v.substr(1).toLowerCase());
10861 if (~index) {
10862 d.month = index;
10863 }
10864 };
10865 }
10866
10867 function pad(val, len) {
10868 val = String(val);
10869 len = len || 2;
10870 while (val.length < len) {
10871 val = '0' + val;
10872 }
10873 return val;
10874 }
10875
10876 var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
10877 var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
10878 var monthNamesShort = shorten(monthNames, 3);
10879 var dayNamesShort = shorten(dayNames, 3);
10880 fecha.i18n = {
10881 dayNamesShort: dayNamesShort,
10882 dayNames: dayNames,
10883 monthNamesShort: monthNamesShort,
10884 monthNames: monthNames,
10885 amPm: ['am', 'pm'],
10886 DoFn: function DoFn(D) {
10887 return D + ['th', 'st', 'nd', 'rd'][D % 10 > 3 ? 0 : (D - D % 10 !== 10) * D % 10];
10888 }
10889 };
10890
10891 var formatFlags = {
10892 D: function(dateObj) {
10893 return dateObj.getDate();
10894 },
10895 DD: function(dateObj) {
10896 return pad(dateObj.getDate());
10897 },
10898 Do: function(dateObj, i18n) {
10899 return i18n.DoFn(dateObj.getDate());
10900 },
10901 d: function(dateObj) {
10902 return dateObj.getDay();
10903 },
10904 dd: function(dateObj) {
10905 return pad(dateObj.getDay());
10906 },
10907 ddd: function(dateObj, i18n) {
10908 return i18n.dayNamesShort[dateObj.getDay()];
10909 },
10910 dddd: function(dateObj, i18n) {
10911 return i18n.dayNames[dateObj.getDay()];
10912 },
10913 M: function(dateObj) {
10914 return dateObj.getMonth() + 1;
10915 },
10916 MM: function(dateObj) {
10917 return pad(dateObj.getMonth() + 1);
10918 },
10919 MMM: function(dateObj, i18n) {
10920 return i18n.monthNamesShort[dateObj.getMonth()];
10921 },
10922 MMMM: function(dateObj, i18n) {
10923 return i18n.monthNames[dateObj.getMonth()];
10924 },
10925 YY: function(dateObj) {
10926 return String(dateObj.getFullYear()).substr(2);
10927 },
10928 YYYY: function(dateObj) {
10929 return dateObj.getFullYear();
10930 },
10931 h: function(dateObj) {
10932 return dateObj.getHours() % 12 || 12;
10933 },
10934 hh: function(dateObj) {
10935 return pad(dateObj.getHours() % 12 || 12);
10936 },
10937 H: function(dateObj) {
10938 return dateObj.getHours();
10939 },
10940 HH: function(dateObj) {
10941 return pad(dateObj.getHours());
10942 },
10943 m: function(dateObj) {
10944 return dateObj.getMinutes();
10945 },
10946 mm: function(dateObj) {
10947 return pad(dateObj.getMinutes());
10948 },
10949 s: function(dateObj) {
10950 return dateObj.getSeconds();
10951 },
10952 ss: function(dateObj) {
10953 return pad(dateObj.getSeconds());
10954 },
10955 S: function(dateObj) {
10956 return Math.round(dateObj.getMilliseconds() / 100);
10957 },
10958 SS: function(dateObj) {
10959 return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
10960 },
10961 SSS: function(dateObj) {
10962 return pad(dateObj.getMilliseconds(), 3);
10963 },
10964 a: function(dateObj, i18n) {
10965 return dateObj.getHours() < 12 ? i18n.amPm[0] : i18n.amPm[1];
10966 },
10967 A: function(dateObj, i18n) {
10968 return dateObj.getHours() < 12 ? i18n.amPm[0].toUpperCase() : i18n.amPm[1].toUpperCase();
10969 },
10970 ZZ: function(dateObj) {
10971 var o = dateObj.getTimezoneOffset();
10972 return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
10973 }
10974 };
10975
10976 var parseFlags = {
10977 D: [twoDigits, function (d, v) {
10978 d.day = v;
10979 }],
10980 Do: [new RegExp(twoDigits.source + word.source), function (d, v) {
10981 d.day = parseInt(v, 10);
10982 }],
10983 M: [twoDigits, function (d, v) {
10984 d.month = v - 1;
10985 }],
10986 YY: [twoDigits, function (d, v) {
10987 var da = new Date(), cent = +('' + da.getFullYear()).substr(0, 2);
10988 d.year = '' + (v > 68 ? cent - 1 : cent) + v;
10989 }],
10990 h: [twoDigits, function (d, v) {
10991 d.hour = v;
10992 }],
10993 m: [twoDigits, function (d, v) {
10994 d.minute = v;
10995 }],
10996 s: [twoDigits, function (d, v) {
10997 d.second = v;
10998 }],
10999 YYYY: [fourDigits, function (d, v) {
11000 d.year = v;
11001 }],
11002 S: [/\d/, function (d, v) {
11003 d.millisecond = v * 100;
11004 }],
11005 SS: [/\d{2}/, function (d, v) {
11006 d.millisecond = v * 10;
11007 }],
11008 SSS: [threeDigits, function (d, v) {
11009 d.millisecond = v;
11010 }],
11011 d: [twoDigits, noop],
11012 ddd: [word, noop],
11013 MMM: [word, monthUpdate('monthNamesShort')],
11014 MMMM: [word, monthUpdate('monthNames')],
11015 a: [word, function (d, v, i18n) {
11016 var val = v.toLowerCase();
11017 if (val === i18n.amPm[0]) {
11018 d.isPm = false;
11019 } else if (val === i18n.amPm[1]) {
11020 d.isPm = true;
11021 }
11022 }],
11023 ZZ: [/([\+\-]\d\d:?\d\d|Z)/, function (d, v) {
11024 if (v === 'Z') v = '+00:00';
11025 var parts = (v + '').match(/([\+\-]|\d\d)/gi), minutes;
11026
11027 if (parts) {
11028 minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
11029 d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
11030 }
11031 }]
11032 };
11033 parseFlags.dd = parseFlags.d;
11034 parseFlags.dddd = parseFlags.ddd;
11035 parseFlags.DD = parseFlags.D;
11036 parseFlags.mm = parseFlags.m;
11037 parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
11038 parseFlags.MM = parseFlags.M;
11039 parseFlags.ss = parseFlags.s;
11040 parseFlags.A = parseFlags.a;
11041
11042
11043 // Some common format strings
11044 fecha.masks = {
11045 default: 'ddd MMM DD YYYY HH:mm:ss',
11046 shortDate: 'M/D/YY',
11047 mediumDate: 'MMM D, YYYY',
11048 longDate: 'MMMM D, YYYY',
11049 fullDate: 'dddd, MMMM D, YYYY',
11050 shortTime: 'HH:mm',
11051 mediumTime: 'HH:mm:ss',
11052 longTime: 'HH:mm:ss.SSS'
11053 };
11054
11055 /***
11056 * Format a date
11057 * @method format
11058 * @param {Date|number} dateObj
11059 * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
11060 */
11061 fecha.format = function (dateObj, mask, i18nSettings) {
11062 var i18n = i18nSettings || fecha.i18n;
11063
11064 if (typeof dateObj === 'number') {
11065 dateObj = new Date(dateObj);
11066 }
11067
11068 if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
11069 throw new Error('Invalid Date in fecha.format');
11070 }
11071
11072 mask = fecha.masks[mask] || mask || fecha.masks['default'];
11073
11074 var literals = [];
11075
11076 // Make literals inactive by replacing them with ??
11077 mask = mask.replace(literal, function($0, $1) {
11078 literals.push($1);
11079 return '??';
11080 });
11081 // Apply formatting rules
11082 mask = mask.replace(token, function ($0) {
11083 return $0 in formatFlags ? formatFlags[$0](dateObj, i18n) : $0.slice(1, $0.length - 1);
11084 });
11085 // Inline literal values back into the formatted value
11086 return mask.replace(/\?\?/g, function() {
11087 return literals.shift();
11088 });
11089 };
11090
11091 /**
11092 * Parse a date string into an object, changes - into /
11093 * @method parse
11094 * @param {string} dateStr Date string
11095 * @param {string} format Date parse format
11096 * @returns {Date|boolean}
11097 */
11098 fecha.parse = function (dateStr, format, i18nSettings) {
11099 var i18n = i18nSettings || fecha.i18n;
11100
11101 if (typeof format !== 'string') {
11102 throw new Error('Invalid format in fecha.parse');
11103 }
11104
11105 format = fecha.masks[format] || format;
11106
11107 // Avoid regular expression denial of service, fail early for really long strings
11108 // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
11109 if (dateStr.length > 1000) {
11110 return false;
11111 }
11112
11113 var isValid = true;
11114 var dateInfo = {};
11115 format.replace(token, function ($0) {
11116 if (parseFlags[$0]) {
11117 var info = parseFlags[$0];
11118 var index = dateStr.search(info[0]);
11119 if (!~index) {
11120 isValid = false;
11121 } else {
11122 dateStr.replace(info[0], function (result) {
11123 info[1](dateInfo, result, i18n);
11124 dateStr = dateStr.substr(index + result.length);
11125 return result;
11126 });
11127 }
11128 }
11129
11130 return parseFlags[$0] ? '' : $0.slice(1, $0.length - 1);
11131 });
11132
11133 if (!isValid) {
11134 return false;
11135 }
11136
11137 var today = new Date();
11138 if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
11139 dateInfo.hour = +dateInfo.hour + 12;
11140 } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
11141 dateInfo.hour = 0;
11142 }
11143
11144 var date;
11145 if (dateInfo.timezoneOffset != null) {
11146 dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
11147 date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
11148 dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
11149 } else {
11150 date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
11151 dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
11152 }
11153 return date;
11154 };
11155
11156 /* istanbul ignore next */
11157 if (typeof module !== 'undefined' && module.exports) {
11158 module.exports = fecha;
11159 } else if (typeof define === 'function' && define.amd) {
11160 define(function () {
11161 return fecha;
11162 });
11163 } else {
11164 main.fecha = fecha;
11165 }
11166})(this);
11167;
11168Object.defineProperties(Date.prototype, {
11169 'year': {
11170 get: function () {
11171 return this.getFullYear();
11172 }
11173 },
11174 'month': {
11175 get: function () {
11176 return this.getMonth();
11177 }
11178 },
11179 'day': {
11180 get: function () {
11181 return this.getDay();
11182 }
11183 },
11184 'date': {
11185 get: function () {
11186 return this.getDate();
11187 }
11188 },
11189 'hours': {
11190 get: function () {
11191 return this.getHours();
11192 }
11193 },
11194 'minutes': {
11195 get: function () {
11196 return this.getMinutes();
11197 }
11198 },
11199 'seconds': {
11200 get: function () {
11201 return this.getSeconds();
11202 }
11203 }
11204});
11205Date.prototype.add = function (years, months, days, hours, minutes, seconds) {
11206 return new Date(this.year + years, this.month + months, this.date + days, this.hours + hours, this.minutes + minutes, this.seconds + seconds);
11207};
11208Date.prototype.format = function (format, i18nSettings) {
11209 return fecha.format(this, format, i18nSettings);
11210};
11211['Years', 'Months', 'Days', 'Hours', 'Minutes', 'Seconds'].forEach(function (it, idx) {
11212 Date.prototype['add' + it] = function (val) {
11213 var args = [0, 0, 0, 0, 0];
11214 args.splice(idx, 0, val);
11215 return Date.prototype.add.apply(this, args);
11216 };
11217});
11218//# sourceMappingURL=date-manipulation.js.map;
11219/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return v.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=b&&b.split("/"),p=t.map,q=p&&p["*"]||{};if(a){for(a=a.split("/"),g=a.length-1,t.nodeIdCompat&&x.test(a[g])&&(a[g]=a[g].replace(x,"")),"."===a[0].charAt(0)&&o&&(n=o.slice(0,o.length-1),a=n.concat(a)),k=0;k<a.length;k++)if("."===(m=a[k]))a.splice(k,1),k-=1;else if(".."===m){if(0===k||1===k&&".."===a[2]||".."===a[k-1])continue;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((o||q)&&p){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),o)for(l=o.length;l>0;l-=1)if((e=p[o.slice(0,l).join("/")])&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=w.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),o.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){r[a]=b}}function j(a){if(e(s,a)){var c=s[a];delete s[a],u[a]=!0,n.apply(b,c)}if(!e(r,a)&&!e(u,a))throw new Error("No "+a);return r[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return a?k(a):[]}function m(a){return function(){return t&&t.config&&t.config[a]||{}}}var n,o,p,q,r={},s={},t={},u={},v=Object.prototype.hasOwnProperty,w=[].slice,x=/\.js$/;p=function(a,b){var c,d=k(a),e=d[0],g=b[1];return a=d[1],e&&(e=f(e,g),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(g)):f(a,g):(a=f(a,g),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},q={require:function(a){return g(a)},exports:function(a){var b=r[a];return void 0!==b?b:r[a]={}},module:function(a){return{id:a,uri:"",exports:r[a],config:m(a)}}},n=function(a,c,d,f){var h,k,m,n,o,t,v,w=[],x=typeof d;if(f=f||a,t=l(f),"undefined"===x||"function"===x){for(c=!c.length&&d.length?["require","exports","module"]:c,o=0;o<c.length;o+=1)if(n=p(c[o],t),"require"===(k=n.f))w[o]=q.require(a);else if("exports"===k)w[o]=q.exports(a),v=!0;else if("module"===k)h=w[o]=q.module(a);else if(e(r,k)||e(s,k)||e(u,k))w[o]=j(k);else{if(!n.p)throw new Error(a+" missing "+k);n.p.load(n.n,g(f,!0),i(k),{}),w[o]=r[k]}m=d?d.apply(r[a],w):void 0,a&&(h&&h.exports!==b&&h.exports!==r[a]?r[a]=h.exports:m===b&&v||(r[a]=m))}else a&&(r[a]=d)},a=c=o=function(a,c,d,e,f){if("string"==typeof a)return q[a]?q[a](c):j(p(a,l(c)).f);if(!a.splice){if(t=a,t.deps&&o(t.deps,t.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?n(b,a,c,d):setTimeout(function(){n(b,a,c,d)},4),o},o.config=function(a){return o(a)},a._defined=r,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(r,a)||e(s,a)||(s[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){"function"==typeof b[d]&&("constructor"!==d&&c.push(d))}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){return Array.prototype.unshift.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;c<d;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;c<a;c++){b+=Math.floor(36*Math.random()).toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return(e!==f||"hidden"!==f&&"visible"!==f)&&("scroll"===e||"scroll"===f||(d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth))},c.escapeMarkup=function(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){b.find(".select2-results").append(a)},c.prototype.sort=function(a){return this.options.get("sorter")(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()});b.$results.find(".select2-results__option[aria-selected]").each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):h-g<0&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");if("true"===c.attr("aria-selected"))return void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{}));d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id,a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2");a(".select2.select2-container--open").each(function(){var b=a(this);this!=d[0]&&b.data("element").select2("close")})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){b.find(".selection").append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},d.prototype.selectionContainer=function(){return a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>')},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id;if(b.length>1||c)return a.call(this,b);this.clear();var d=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(d)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||c.which!=b.DELETE&&c.which!=b.BACKSPACE||this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">×</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){if(a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented(),a.which===c.BACKSPACE&&""===e.$search.val()){var b=e.$searchContainer.prev(".select2-selection__choice");if(b.length>0){var d=b.data("data");e.searchRemoveChoice(d),a.preventDefault()}}});var f=document.documentMode,g=f&&f<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(g)return void e.$selection.off("input.search input.searchcheck");e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{a=.75*(this.$search.val().length+1)+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),null!=c.id?d+="-"+c.id.toString():d+="-"+a.generateChars(4),d},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple")){if(a.selected=!1,c(a.element).is("option"))return a.element.selected=!1,void this.$element.trigger("change");this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})}},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this;this.$element.children().each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),void 0!==a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(null!=(b=c.data(a[0],"data")))return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){return this.options.get("matcher")(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0);if((i.text||"").toUpperCase()===(b.term||"").toUpperCase()||j)return!f&&(a.data=g,void c(a))}if(f)return!0;var k=e.createTag(b);if(null!=k){var l=e.option(k);l.attr("data-select2-tag",!0),e.addOptions([l]),e.insertTag(g,k)}a.results=g,c(a)}var e=this;if(this._removeOldTags(),null==b.term||null!=b.page)return void a.call(this,b,c);a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){this._lastTag;this.$element.find("option[data-select2-tag]").each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b);if(!g.$element.find("option").filter(function(){return a(this).val()===c.id}).length){var d=g.option(c);d.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([d])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){if(b.term=b.term||"",b.term.length<this.minimumInputLength)return void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){if(b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength)return void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;if(d.maximumSelectionLength>0&&f>=d.maximumSelectionLength)return void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}});a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()||e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){e.showSearch(a)?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){e.$results.offset().top+e.$results.outerHeight(!1)+50>=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1)&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id;this.$container.parents().filter(b.hasScroll).off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return!(a(c.data.results)<this.minimumResultsForSearch)&&b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){return"Please enter "+(a.minimum-a.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}return D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(a){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(a){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var O=k.loadPath(this.defaults.amdLanguageBase+"en"),P=new k(l.language);P.extend(O),l.translations=P}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){null==c(d,e.children[g])&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var h=b(e.text).toUpperCase(),i=b(d.term).toUpperCase();return h.indexOf(i)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)},new D}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h<i;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if("object"==typeof(b=b||{}))return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});;