· 6 years ago · Oct 11, 2019, 12:09 AM
1/******/ (function(modules) { // webpackBootstrap
2/******/ // The module cache
3/******/ var installedModules = {};
4/******/
5/******/ // The require function
6/******/ function __webpack_require__(moduleId) {
7/******/
8/******/ // Check if module is in cache
9/******/ if(installedModules[moduleId]) {
10/******/ return installedModules[moduleId].exports;
11/******/ }
12/******/ // Create a new module (and put it into the cache)
13/******/ var module = installedModules[moduleId] = {
14/******/ i: moduleId,
15/******/ l: false,
16/******/ exports: {}
17/******/ };
18/******/
19/******/ // Execute the module function
20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21/******/
22/******/ // Flag the module as loaded
23/******/ module.l = true;
24/******/
25/******/ // Return the exports of the module
26/******/ return module.exports;
27/******/ }
28/******/
29/******/
30/******/ // expose the modules object (__webpack_modules__)
31/******/ __webpack_require__.m = modules;
32/******/
33/******/ // expose the module cache
34/******/ __webpack_require__.c = installedModules;
35/******/
36/******/ // define getter function for harmony exports
37/******/ __webpack_require__.d = function(exports, name, getter) {
38/******/ if(!__webpack_require__.o(exports, name)) {
39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40/******/ }
41/******/ };
42/******/
43/******/ // define __esModule on exports
44/******/ __webpack_require__.r = function(exports) {
45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47/******/ }
48/******/ Object.defineProperty(exports, '__esModule', { value: true });
49/******/ };
50/******/
51/******/ // create a fake namespace object
52/******/ // mode & 1: value is a module id, require it
53/******/ // mode & 2: merge all properties of value into the ns
54/******/ // mode & 4: return value when already ns object
55/******/ // mode & 8|1: behave like require
56/******/ __webpack_require__.t = function(value, mode) {
57/******/ if(mode & 1) value = __webpack_require__(value);
58/******/ if(mode & 8) return value;
59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60/******/ var ns = Object.create(null);
61/******/ __webpack_require__.r(ns);
62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64/******/ return ns;
65/******/ };
66/******/
67/******/ // getDefaultExport function for compatibility with non-harmony modules
68/******/ __webpack_require__.n = function(module) {
69/******/ var getter = module && module.__esModule ?
70/******/ function getDefault() { return module['default']; } :
71/******/ function getModuleExports() { return module; };
72/******/ __webpack_require__.d(getter, 'a', getter);
73/******/ return getter;
74/******/ };
75/******/
76/******/ // Object.prototype.hasOwnProperty.call
77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78/******/
79/******/ // __webpack_public_path__
80/******/ __webpack_require__.p = "/";
81/******/
82/******/
83/******/ // Load entry module and return exports
84/******/ return __webpack_require__(__webpack_require__.s = 1);
85/******/ })
86/************************************************************************/
87/******/ ({
88
89/***/ "./node_modules/jquery/dist/jquery.js":
90/*!********************************************!*\
91 !*** ./node_modules/jquery/dist/jquery.js ***!
92 \********************************************/
93/*! no static exports found */
94/***/ (function(module, exports, __webpack_require__) {
95
96var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
97 * jQuery JavaScript Library v3.4.1
98 * https://jquery.com/
99 *
100 * Includes Sizzle.js
101 * https://sizzlejs.com/
102 *
103 * Copyright JS Foundation and other contributors
104 * Released under the MIT license
105 * https://jquery.org/license
106 *
107 * Date: 2019-05-01T21:04Z
108 */
109( function( global, factory ) {
110
111 "use strict";
112
113 if ( true && typeof module.exports === "object" ) {
114
115 // For CommonJS and CommonJS-like environments where a proper `window`
116 // is present, execute the factory and get jQuery.
117 // For environments that do not have a `window` with a `document`
118 // (such as Node.js), expose a factory as module.exports.
119 // This accentuates the need for the creation of a real `window`.
120 // e.g. var jQuery = require("jquery")(window);
121 // See ticket #14549 for more info.
122 module.exports = global.document ?
123 factory( global, true ) :
124 function( w ) {
125 if ( !w.document ) {
126 throw new Error( "jQuery requires a window with a document" );
127 }
128 return factory( w );
129 };
130 } else {
131 factory( global );
132 }
133
134// Pass this if window is not defined yet
135} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
136
137// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
138// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
139// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
140// enough that all such attempts are guarded in a try block.
141"use strict";
142
143var arr = [];
144
145var document = window.document;
146
147var getProto = Object.getPrototypeOf;
148
149var slice = arr.slice;
150
151var concat = arr.concat;
152
153var push = arr.push;
154
155var indexOf = arr.indexOf;
156
157var class2type = {};
158
159var toString = class2type.toString;
160
161var hasOwn = class2type.hasOwnProperty;
162
163var fnToString = hasOwn.toString;
164
165var ObjectFunctionString = fnToString.call( Object );
166
167var support = {};
168
169var isFunction = function isFunction( obj ) {
170
171 // Support: Chrome <=57, Firefox <=52
172 // In some browsers, typeof returns "function" for HTML <object> elements
173 // (i.e., `typeof document.createElement( "object" ) === "function"`).
174 // We don't want to classify *any* DOM node as a function.
175 return typeof obj === "function" && typeof obj.nodeType !== "number";
176 };
177
178
179var isWindow = function isWindow( obj ) {
180 return obj != null && obj === obj.window;
181 };
182
183
184
185
186 var preservedScriptAttributes = {
187 type: true,
188 src: true,
189 nonce: true,
190 noModule: true
191 };
192
193 function DOMEval( code, node, doc ) {
194 doc = doc || document;
195
196 var i, val,
197 script = doc.createElement( "script" );
198
199 script.text = code;
200 if ( node ) {
201 for ( i in preservedScriptAttributes ) {
202
203 // Support: Firefox 64+, Edge 18+
204 // Some browsers don't support the "nonce" property on scripts.
205 // On the other hand, just using `getAttribute` is not enough as
206 // the `nonce` attribute is reset to an empty string whenever it
207 // becomes browsing-context connected.
208 // See https://github.com/whatwg/html/issues/2369
209 // See https://html.spec.whatwg.org/#nonce-attributes
210 // The `node.getAttribute` check was added for the sake of
211 // `jQuery.globalEval` so that it can fake a nonce-containing node
212 // via an object.
213 val = node[ i ] || node.getAttribute && node.getAttribute( i );
214 if ( val ) {
215 script.setAttribute( i, val );
216 }
217 }
218 }
219 doc.head.appendChild( script ).parentNode.removeChild( script );
220 }
221
222
223function toType( obj ) {
224 if ( obj == null ) {
225 return obj + "";
226 }
227
228 // Support: Android <=2.3 only (functionish RegExp)
229 return typeof obj === "object" || typeof obj === "function" ?
230 class2type[ toString.call( obj ) ] || "object" :
231 typeof obj;
232}
233/* global Symbol */
234// Defining this global in .eslintrc.json would create a danger of using the global
235// unguarded in another place, it seems safer to define global only for this module
236
237
238
239var
240 version = "3.4.1",
241
242 // Define a local copy of jQuery
243 jQuery = function( selector, context ) {
244
245 // The jQuery object is actually just the init constructor 'enhanced'
246 // Need init if jQuery is called (just allow error to be thrown if not included)
247 return new jQuery.fn.init( selector, context );
248 },
249
250 // Support: Android <=4.0 only
251 // Make sure we trim BOM and NBSP
252 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
253
254jQuery.fn = jQuery.prototype = {
255
256 // The current version of jQuery being used
257 jquery: version,
258
259 constructor: jQuery,
260
261 // The default length of a jQuery object is 0
262 length: 0,
263
264 toArray: function() {
265 return slice.call( this );
266 },
267
268 // Get the Nth element in the matched element set OR
269 // Get the whole matched element set as a clean array
270 get: function( num ) {
271
272 // Return all the elements in a clean array
273 if ( num == null ) {
274 return slice.call( this );
275 }
276
277 // Return just the one element from the set
278 return num < 0 ? this[ num + this.length ] : this[ num ];
279 },
280
281 // Take an array of elements and push it onto the stack
282 // (returning the new matched element set)
283 pushStack: function( elems ) {
284
285 // Build a new jQuery matched element set
286 var ret = jQuery.merge( this.constructor(), elems );
287
288 // Add the old object onto the stack (as a reference)
289 ret.prevObject = this;
290
291 // Return the newly-formed element set
292 return ret;
293 },
294
295 // Execute a callback for every element in the matched set.
296 each: function( callback ) {
297 return jQuery.each( this, callback );
298 },
299
300 map: function( callback ) {
301 return this.pushStack( jQuery.map( this, function( elem, i ) {
302 return callback.call( elem, i, elem );
303 } ) );
304 },
305
306 slice: function() {
307 return this.pushStack( slice.apply( this, arguments ) );
308 },
309
310 first: function() {
311 return this.eq( 0 );
312 },
313
314 last: function() {
315 return this.eq( -1 );
316 },
317
318 eq: function( i ) {
319 var len = this.length,
320 j = +i + ( i < 0 ? len : 0 );
321 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
322 },
323
324 end: function() {
325 return this.prevObject || this.constructor();
326 },
327
328 // For internal use only.
329 // Behaves like an Array's method, not like a jQuery method.
330 push: push,
331 sort: arr.sort,
332 splice: arr.splice
333};
334
335jQuery.extend = jQuery.fn.extend = function() {
336 var options, name, src, copy, copyIsArray, clone,
337 target = arguments[ 0 ] || {},
338 i = 1,
339 length = arguments.length,
340 deep = false;
341
342 // Handle a deep copy situation
343 if ( typeof target === "boolean" ) {
344 deep = target;
345
346 // Skip the boolean and the target
347 target = arguments[ i ] || {};
348 i++;
349 }
350
351 // Handle case when target is a string or something (possible in deep copy)
352 if ( typeof target !== "object" && !isFunction( target ) ) {
353 target = {};
354 }
355
356 // Extend jQuery itself if only one argument is passed
357 if ( i === length ) {
358 target = this;
359 i--;
360 }
361
362 for ( ; i < length; i++ ) {
363
364 // Only deal with non-null/undefined values
365 if ( ( options = arguments[ i ] ) != null ) {
366
367 // Extend the base object
368 for ( name in options ) {
369 copy = options[ name ];
370
371 // Prevent Object.prototype pollution
372 // Prevent never-ending loop
373 if ( name === "__proto__" || target === copy ) {
374 continue;
375 }
376
377 // Recurse if we're merging plain objects or arrays
378 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
379 ( copyIsArray = Array.isArray( copy ) ) ) ) {
380 src = target[ name ];
381
382 // Ensure proper type for the source value
383 if ( copyIsArray && !Array.isArray( src ) ) {
384 clone = [];
385 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
386 clone = {};
387 } else {
388 clone = src;
389 }
390 copyIsArray = false;
391
392 // Never move original objects, clone them
393 target[ name ] = jQuery.extend( deep, clone, copy );
394
395 // Don't bring in undefined values
396 } else if ( copy !== undefined ) {
397 target[ name ] = copy;
398 }
399 }
400 }
401 }
402
403 // Return the modified object
404 return target;
405};
406
407jQuery.extend( {
408
409 // Unique for each copy of jQuery on the page
410 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
411
412 // Assume jQuery is ready without the ready module
413 isReady: true,
414
415 error: function( msg ) {
416 throw new Error( msg );
417 },
418
419 noop: function() {},
420
421 isPlainObject: function( obj ) {
422 var proto, Ctor;
423
424 // Detect obvious negatives
425 // Use toString instead of jQuery.type to catch host objects
426 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
427 return false;
428 }
429
430 proto = getProto( obj );
431
432 // Objects with no prototype (e.g., `Object.create( null )`) are plain
433 if ( !proto ) {
434 return true;
435 }
436
437 // Objects with prototype are plain iff they were constructed by a global Object function
438 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
439 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
440 },
441
442 isEmptyObject: function( obj ) {
443 var name;
444
445 for ( name in obj ) {
446 return false;
447 }
448 return true;
449 },
450
451 // Evaluates a script in a global context
452 globalEval: function( code, options ) {
453 DOMEval( code, { nonce: options && options.nonce } );
454 },
455
456 each: function( obj, callback ) {
457 var length, i = 0;
458
459 if ( isArrayLike( obj ) ) {
460 length = obj.length;
461 for ( ; i < length; i++ ) {
462 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
463 break;
464 }
465 }
466 } else {
467 for ( i in obj ) {
468 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
469 break;
470 }
471 }
472 }
473
474 return obj;
475 },
476
477 // Support: Android <=4.0 only
478 trim: function( text ) {
479 return text == null ?
480 "" :
481 ( text + "" ).replace( rtrim, "" );
482 },
483
484 // results is for internal usage only
485 makeArray: function( arr, results ) {
486 var ret = results || [];
487
488 if ( arr != null ) {
489 if ( isArrayLike( Object( arr ) ) ) {
490 jQuery.merge( ret,
491 typeof arr === "string" ?
492 [ arr ] : arr
493 );
494 } else {
495 push.call( ret, arr );
496 }
497 }
498
499 return ret;
500 },
501
502 inArray: function( elem, arr, i ) {
503 return arr == null ? -1 : indexOf.call( arr, elem, i );
504 },
505
506 // Support: Android <=4.0 only, PhantomJS 1 only
507 // push.apply(_, arraylike) throws on ancient WebKit
508 merge: function( first, second ) {
509 var len = +second.length,
510 j = 0,
511 i = first.length;
512
513 for ( ; j < len; j++ ) {
514 first[ i++ ] = second[ j ];
515 }
516
517 first.length = i;
518
519 return first;
520 },
521
522 grep: function( elems, callback, invert ) {
523 var callbackInverse,
524 matches = [],
525 i = 0,
526 length = elems.length,
527 callbackExpect = !invert;
528
529 // Go through the array, only saving the items
530 // that pass the validator function
531 for ( ; i < length; i++ ) {
532 callbackInverse = !callback( elems[ i ], i );
533 if ( callbackInverse !== callbackExpect ) {
534 matches.push( elems[ i ] );
535 }
536 }
537
538 return matches;
539 },
540
541 // arg is for internal usage only
542 map: function( elems, callback, arg ) {
543 var length, value,
544 i = 0,
545 ret = [];
546
547 // Go through the array, translating each of the items to their new values
548 if ( isArrayLike( elems ) ) {
549 length = elems.length;
550 for ( ; i < length; i++ ) {
551 value = callback( elems[ i ], i, arg );
552
553 if ( value != null ) {
554 ret.push( value );
555 }
556 }
557
558 // Go through every key on the object,
559 } else {
560 for ( i in elems ) {
561 value = callback( elems[ i ], i, arg );
562
563 if ( value != null ) {
564 ret.push( value );
565 }
566 }
567 }
568
569 // Flatten any nested arrays
570 return concat.apply( [], ret );
571 },
572
573 // A global GUID counter for objects
574 guid: 1,
575
576 // jQuery.support is not used in Core but other projects attach their
577 // properties to it so it needs to exist.
578 support: support
579} );
580
581if ( typeof Symbol === "function" ) {
582 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
583}
584
585// Populate the class2type map
586jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
587function( i, name ) {
588 class2type[ "[object " + name + "]" ] = name.toLowerCase();
589} );
590
591function isArrayLike( obj ) {
592
593 // Support: real iOS 8.2 only (not reproducible in simulator)
594 // `in` check used to prevent JIT error (gh-2145)
595 // hasOwn isn't used here due to false negatives
596 // regarding Nodelist length in IE
597 var length = !!obj && "length" in obj && obj.length,
598 type = toType( obj );
599
600 if ( isFunction( obj ) || isWindow( obj ) ) {
601 return false;
602 }
603
604 return type === "array" || length === 0 ||
605 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
606}
607var Sizzle =
608/*!
609 * Sizzle CSS Selector Engine v2.3.4
610 * https://sizzlejs.com/
611 *
612 * Copyright JS Foundation and other contributors
613 * Released under the MIT license
614 * https://js.foundation/
615 *
616 * Date: 2019-04-08
617 */
618(function( window ) {
619
620var i,
621 support,
622 Expr,
623 getText,
624 isXML,
625 tokenize,
626 compile,
627 select,
628 outermostContext,
629 sortInput,
630 hasDuplicate,
631
632 // Local document vars
633 setDocument,
634 document,
635 docElem,
636 documentIsHTML,
637 rbuggyQSA,
638 rbuggyMatches,
639 matches,
640 contains,
641
642 // Instance-specific data
643 expando = "sizzle" + 1 * new Date(),
644 preferredDoc = window.document,
645 dirruns = 0,
646 done = 0,
647 classCache = createCache(),
648 tokenCache = createCache(),
649 compilerCache = createCache(),
650 nonnativeSelectorCache = createCache(),
651 sortOrder = function( a, b ) {
652 if ( a === b ) {
653 hasDuplicate = true;
654 }
655 return 0;
656 },
657
658 // Instance methods
659 hasOwn = ({}).hasOwnProperty,
660 arr = [],
661 pop = arr.pop,
662 push_native = arr.push,
663 push = arr.push,
664 slice = arr.slice,
665 // Use a stripped-down indexOf as it's faster than native
666 // https://jsperf.com/thor-indexof-vs-for/5
667 indexOf = function( list, elem ) {
668 var i = 0,
669 len = list.length;
670 for ( ; i < len; i++ ) {
671 if ( list[i] === elem ) {
672 return i;
673 }
674 }
675 return -1;
676 },
677
678 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
679
680 // Regular expressions
681
682 // http://www.w3.org/TR/css3-selectors/#whitespace
683 whitespace = "[\\x20\\t\\r\\n\\f]",
684
685 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
686 identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
687
688 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
689 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
690 // Operator (capture 2)
691 "*([*^$|!~]?=)" + whitespace +
692 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
693 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
694 "*\\]",
695
696 pseudos = ":(" + identifier + ")(?:\\((" +
697 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
698 // 1. quoted (capture 3; capture 4 or capture 5)
699 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
700 // 2. simple (capture 6)
701 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
702 // 3. anything else (capture 2)
703 ".*" +
704 ")\\)|)",
705
706 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
707 rwhitespace = new RegExp( whitespace + "+", "g" ),
708 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
709
710 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
711 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
712 rdescend = new RegExp( whitespace + "|>" ),
713
714 rpseudo = new RegExp( pseudos ),
715 ridentifier = new RegExp( "^" + identifier + "$" ),
716
717 matchExpr = {
718 "ID": new RegExp( "^#(" + identifier + ")" ),
719 "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
720 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
721 "ATTR": new RegExp( "^" + attributes ),
722 "PSEUDO": new RegExp( "^" + pseudos ),
723 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
724 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
725 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
726 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
727 // For use in libraries implementing .is()
728 // We use this for POS matching in `select`
729 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
730 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
731 },
732
733 rhtml = /HTML$/i,
734 rinputs = /^(?:input|select|textarea|button)$/i,
735 rheader = /^h\d$/i,
736
737 rnative = /^[^{]+\{\s*\[native \w/,
738
739 // Easily-parseable/retrievable ID or TAG or CLASS selectors
740 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
741
742 rsibling = /[+~]/,
743
744 // CSS escapes
745 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
746 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
747 funescape = function( _, escaped, escapedWhitespace ) {
748 var high = "0x" + escaped - 0x10000;
749 // NaN means non-codepoint
750 // Support: Firefox<24
751 // Workaround erroneous numeric interpretation of +"0x"
752 return high !== high || escapedWhitespace ?
753 escaped :
754 high < 0 ?
755 // BMP codepoint
756 String.fromCharCode( high + 0x10000 ) :
757 // Supplemental Plane codepoint (surrogate pair)
758 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
759 },
760
761 // CSS string/identifier serialization
762 // https://drafts.csswg.org/cssom/#common-serializing-idioms
763 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
764 fcssescape = function( ch, asCodePoint ) {
765 if ( asCodePoint ) {
766
767 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
768 if ( ch === "\0" ) {
769 return "\uFFFD";
770 }
771
772 // Control characters and (dependent upon position) numbers get escaped as code points
773 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
774 }
775
776 // Other potentially-special ASCII characters get backslash-escaped
777 return "\\" + ch;
778 },
779
780 // Used for iframes
781 // See setDocument()
782 // Removing the function wrapper causes a "Permission Denied"
783 // error in IE
784 unloadHandler = function() {
785 setDocument();
786 },
787
788 inDisabledFieldset = addCombinator(
789 function( elem ) {
790 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
791 },
792 { dir: "parentNode", next: "legend" }
793 );
794
795// Optimize for push.apply( _, NodeList )
796try {
797 push.apply(
798 (arr = slice.call( preferredDoc.childNodes )),
799 preferredDoc.childNodes
800 );
801 // Support: Android<4.0
802 // Detect silently failing push.apply
803 arr[ preferredDoc.childNodes.length ].nodeType;
804} catch ( e ) {
805 push = { apply: arr.length ?
806
807 // Leverage slice if possible
808 function( target, els ) {
809 push_native.apply( target, slice.call(els) );
810 } :
811
812 // Support: IE<9
813 // Otherwise append directly
814 function( target, els ) {
815 var j = target.length,
816 i = 0;
817 // Can't trust NodeList.length
818 while ( (target[j++] = els[i++]) ) {}
819 target.length = j - 1;
820 }
821 };
822}
823
824function Sizzle( selector, context, results, seed ) {
825 var m, i, elem, nid, match, groups, newSelector,
826 newContext = context && context.ownerDocument,
827
828 // nodeType defaults to 9, since context defaults to document
829 nodeType = context ? context.nodeType : 9;
830
831 results = results || [];
832
833 // Return early from calls with invalid selector or context
834 if ( typeof selector !== "string" || !selector ||
835 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
836
837 return results;
838 }
839
840 // Try to shortcut find operations (as opposed to filters) in HTML documents
841 if ( !seed ) {
842
843 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
844 setDocument( context );
845 }
846 context = context || document;
847
848 if ( documentIsHTML ) {
849
850 // If the selector is sufficiently simple, try using a "get*By*" DOM method
851 // (excepting DocumentFragment context, where the methods don't exist)
852 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
853
854 // ID selector
855 if ( (m = match[1]) ) {
856
857 // Document context
858 if ( nodeType === 9 ) {
859 if ( (elem = context.getElementById( m )) ) {
860
861 // Support: IE, Opera, Webkit
862 // TODO: identify versions
863 // getElementById can match elements by name instead of ID
864 if ( elem.id === m ) {
865 results.push( elem );
866 return results;
867 }
868 } else {
869 return results;
870 }
871
872 // Element context
873 } else {
874
875 // Support: IE, Opera, Webkit
876 // TODO: identify versions
877 // getElementById can match elements by name instead of ID
878 if ( newContext && (elem = newContext.getElementById( m )) &&
879 contains( context, elem ) &&
880 elem.id === m ) {
881
882 results.push( elem );
883 return results;
884 }
885 }
886
887 // Type selector
888 } else if ( match[2] ) {
889 push.apply( results, context.getElementsByTagName( selector ) );
890 return results;
891
892 // Class selector
893 } else if ( (m = match[3]) && support.getElementsByClassName &&
894 context.getElementsByClassName ) {
895
896 push.apply( results, context.getElementsByClassName( m ) );
897 return results;
898 }
899 }
900
901 // Take advantage of querySelectorAll
902 if ( support.qsa &&
903 !nonnativeSelectorCache[ selector + " " ] &&
904 (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
905
906 // Support: IE 8 only
907 // Exclude object elements
908 (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
909
910 newSelector = selector;
911 newContext = context;
912
913 // qSA considers elements outside a scoping root when evaluating child or
914 // descendant combinators, which is not what we want.
915 // In such cases, we work around the behavior by prefixing every selector in the
916 // list with an ID selector referencing the scope context.
917 // Thanks to Andrew Dupont for this technique.
918 if ( nodeType === 1 && rdescend.test( selector ) ) {
919
920 // Capture the context ID, setting it first if necessary
921 if ( (nid = context.getAttribute( "id" )) ) {
922 nid = nid.replace( rcssescape, fcssescape );
923 } else {
924 context.setAttribute( "id", (nid = expando) );
925 }
926
927 // Prefix every selector in the list
928 groups = tokenize( selector );
929 i = groups.length;
930 while ( i-- ) {
931 groups[i] = "#" + nid + " " + toSelector( groups[i] );
932 }
933 newSelector = groups.join( "," );
934
935 // Expand context for sibling selectors
936 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
937 context;
938 }
939
940 try {
941 push.apply( results,
942 newContext.querySelectorAll( newSelector )
943 );
944 return results;
945 } catch ( qsaError ) {
946 nonnativeSelectorCache( selector, true );
947 } finally {
948 if ( nid === expando ) {
949 context.removeAttribute( "id" );
950 }
951 }
952 }
953 }
954 }
955
956 // All others
957 return select( selector.replace( rtrim, "$1" ), context, results, seed );
958}
959
960/**
961 * Create key-value caches of limited size
962 * @returns {function(string, object)} Returns the Object data after storing it on itself with
963 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
964 * deleting the oldest entry
965 */
966function createCache() {
967 var keys = [];
968
969 function cache( key, value ) {
970 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
971 if ( keys.push( key + " " ) > Expr.cacheLength ) {
972 // Only keep the most recent entries
973 delete cache[ keys.shift() ];
974 }
975 return (cache[ key + " " ] = value);
976 }
977 return cache;
978}
979
980/**
981 * Mark a function for special use by Sizzle
982 * @param {Function} fn The function to mark
983 */
984function markFunction( fn ) {
985 fn[ expando ] = true;
986 return fn;
987}
988
989/**
990 * Support testing using an element
991 * @param {Function} fn Passed the created element and returns a boolean result
992 */
993function assert( fn ) {
994 var el = document.createElement("fieldset");
995
996 try {
997 return !!fn( el );
998 } catch (e) {
999 return false;
1000 } finally {
1001 // Remove from its parent by default
1002 if ( el.parentNode ) {
1003 el.parentNode.removeChild( el );
1004 }
1005 // release memory in IE
1006 el = null;
1007 }
1008}
1009
1010/**
1011 * Adds the same handler for all of the specified attrs
1012 * @param {String} attrs Pipe-separated list of attributes
1013 * @param {Function} handler The method that will be applied
1014 */
1015function addHandle( attrs, handler ) {
1016 var arr = attrs.split("|"),
1017 i = arr.length;
1018
1019 while ( i-- ) {
1020 Expr.attrHandle[ arr[i] ] = handler;
1021 }
1022}
1023
1024/**
1025 * Checks document order of two siblings
1026 * @param {Element} a
1027 * @param {Element} b
1028 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
1029 */
1030function siblingCheck( a, b ) {
1031 var cur = b && a,
1032 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
1033 a.sourceIndex - b.sourceIndex;
1034
1035 // Use IE sourceIndex if available on both nodes
1036 if ( diff ) {
1037 return diff;
1038 }
1039
1040 // Check if b follows a
1041 if ( cur ) {
1042 while ( (cur = cur.nextSibling) ) {
1043 if ( cur === b ) {
1044 return -1;
1045 }
1046 }
1047 }
1048
1049 return a ? 1 : -1;
1050}
1051
1052/**
1053 * Returns a function to use in pseudos for input types
1054 * @param {String} type
1055 */
1056function createInputPseudo( type ) {
1057 return function( elem ) {
1058 var name = elem.nodeName.toLowerCase();
1059 return name === "input" && elem.type === type;
1060 };
1061}
1062
1063/**
1064 * Returns a function to use in pseudos for buttons
1065 * @param {String} type
1066 */
1067function createButtonPseudo( type ) {
1068 return function( elem ) {
1069 var name = elem.nodeName.toLowerCase();
1070 return (name === "input" || name === "button") && elem.type === type;
1071 };
1072}
1073
1074/**
1075 * Returns a function to use in pseudos for :enabled/:disabled
1076 * @param {Boolean} disabled true for :disabled; false for :enabled
1077 */
1078function createDisabledPseudo( disabled ) {
1079
1080 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
1081 return function( elem ) {
1082
1083 // Only certain elements can match :enabled or :disabled
1084 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
1085 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
1086 if ( "form" in elem ) {
1087
1088 // Check for inherited disabledness on relevant non-disabled elements:
1089 // * listed form-associated elements in a disabled fieldset
1090 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
1091 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
1092 // * option elements in a disabled optgroup
1093 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
1094 // All such elements have a "form" property.
1095 if ( elem.parentNode && elem.disabled === false ) {
1096
1097 // Option elements defer to a parent optgroup if present
1098 if ( "label" in elem ) {
1099 if ( "label" in elem.parentNode ) {
1100 return elem.parentNode.disabled === disabled;
1101 } else {
1102 return elem.disabled === disabled;
1103 }
1104 }
1105
1106 // Support: IE 6 - 11
1107 // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1108 return elem.isDisabled === disabled ||
1109
1110 // Where there is no isDisabled, check manually
1111 /* jshint -W018 */
1112 elem.isDisabled !== !disabled &&
1113 inDisabledFieldset( elem ) === disabled;
1114 }
1115
1116 return elem.disabled === disabled;
1117
1118 // Try to winnow out elements that can't be disabled before trusting the disabled property.
1119 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
1120 // even exist on them, let alone have a boolean value.
1121 } else if ( "label" in elem ) {
1122 return elem.disabled === disabled;
1123 }
1124
1125 // Remaining elements are neither :enabled nor :disabled
1126 return false;
1127 };
1128}
1129
1130/**
1131 * Returns a function to use in pseudos for positionals
1132 * @param {Function} fn
1133 */
1134function createPositionalPseudo( fn ) {
1135 return markFunction(function( argument ) {
1136 argument = +argument;
1137 return markFunction(function( seed, matches ) {
1138 var j,
1139 matchIndexes = fn( [], seed.length, argument ),
1140 i = matchIndexes.length;
1141
1142 // Match elements found at the specified indexes
1143 while ( i-- ) {
1144 if ( seed[ (j = matchIndexes[i]) ] ) {
1145 seed[j] = !(matches[j] = seed[j]);
1146 }
1147 }
1148 });
1149 });
1150}
1151
1152/**
1153 * Checks a node for validity as a Sizzle context
1154 * @param {Element|Object=} context
1155 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1156 */
1157function testContext( context ) {
1158 return context && typeof context.getElementsByTagName !== "undefined" && context;
1159}
1160
1161// Expose support vars for convenience
1162support = Sizzle.support = {};
1163
1164/**
1165 * Detects XML nodes
1166 * @param {Element|Object} elem An element or a document
1167 * @returns {Boolean} True iff elem is a non-HTML XML node
1168 */
1169isXML = Sizzle.isXML = function( elem ) {
1170 var namespace = elem.namespaceURI,
1171 docElem = (elem.ownerDocument || elem).documentElement;
1172
1173 // Support: IE <=8
1174 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
1175 // https://bugs.jquery.com/ticket/4833
1176 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
1177};
1178
1179/**
1180 * Sets document-related variables once based on the current document
1181 * @param {Element|Object} [doc] An element or document object to use to set the document
1182 * @returns {Object} Returns the current document
1183 */
1184setDocument = Sizzle.setDocument = function( node ) {
1185 var hasCompare, subWindow,
1186 doc = node ? node.ownerDocument || node : preferredDoc;
1187
1188 // Return early if doc is invalid or already selected
1189 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1190 return document;
1191 }
1192
1193 // Update global variables
1194 document = doc;
1195 docElem = document.documentElement;
1196 documentIsHTML = !isXML( document );
1197
1198 // Support: IE 9-11, Edge
1199 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1200 if ( preferredDoc !== document &&
1201 (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
1202
1203 // Support: IE 11, Edge
1204 if ( subWindow.addEventListener ) {
1205 subWindow.addEventListener( "unload", unloadHandler, false );
1206
1207 // Support: IE 9 - 10 only
1208 } else if ( subWindow.attachEvent ) {
1209 subWindow.attachEvent( "onunload", unloadHandler );
1210 }
1211 }
1212
1213 /* Attributes
1214 ---------------------------------------------------------------------- */
1215
1216 // Support: IE<8
1217 // Verify that getAttribute really returns attributes and not properties
1218 // (excepting IE8 booleans)
1219 support.attributes = assert(function( el ) {
1220 el.className = "i";
1221 return !el.getAttribute("className");
1222 });
1223
1224 /* getElement(s)By*
1225 ---------------------------------------------------------------------- */
1226
1227 // Check if getElementsByTagName("*") returns only elements
1228 support.getElementsByTagName = assert(function( el ) {
1229 el.appendChild( document.createComment("") );
1230 return !el.getElementsByTagName("*").length;
1231 });
1232
1233 // Support: IE<9
1234 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1235
1236 // Support: IE<10
1237 // Check if getElementById returns elements by name
1238 // The broken getElementById methods don't pick up programmatically-set names,
1239 // so use a roundabout getElementsByName test
1240 support.getById = assert(function( el ) {
1241 docElem.appendChild( el ).id = expando;
1242 return !document.getElementsByName || !document.getElementsByName( expando ).length;
1243 });
1244
1245 // ID filter and find
1246 if ( support.getById ) {
1247 Expr.filter["ID"] = function( id ) {
1248 var attrId = id.replace( runescape, funescape );
1249 return function( elem ) {
1250 return elem.getAttribute("id") === attrId;
1251 };
1252 };
1253 Expr.find["ID"] = function( id, context ) {
1254 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1255 var elem = context.getElementById( id );
1256 return elem ? [ elem ] : [];
1257 }
1258 };
1259 } else {
1260 Expr.filter["ID"] = function( id ) {
1261 var attrId = id.replace( runescape, funescape );
1262 return function( elem ) {
1263 var node = typeof elem.getAttributeNode !== "undefined" &&
1264 elem.getAttributeNode("id");
1265 return node && node.value === attrId;
1266 };
1267 };
1268
1269 // Support: IE 6 - 7 only
1270 // getElementById is not reliable as a find shortcut
1271 Expr.find["ID"] = function( id, context ) {
1272 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1273 var node, i, elems,
1274 elem = context.getElementById( id );
1275
1276 if ( elem ) {
1277
1278 // Verify the id attribute
1279 node = elem.getAttributeNode("id");
1280 if ( node && node.value === id ) {
1281 return [ elem ];
1282 }
1283
1284 // Fall back on getElementsByName
1285 elems = context.getElementsByName( id );
1286 i = 0;
1287 while ( (elem = elems[i++]) ) {
1288 node = elem.getAttributeNode("id");
1289 if ( node && node.value === id ) {
1290 return [ elem ];
1291 }
1292 }
1293 }
1294
1295 return [];
1296 }
1297 };
1298 }
1299
1300 // Tag
1301 Expr.find["TAG"] = support.getElementsByTagName ?
1302 function( tag, context ) {
1303 if ( typeof context.getElementsByTagName !== "undefined" ) {
1304 return context.getElementsByTagName( tag );
1305
1306 // DocumentFragment nodes don't have gEBTN
1307 } else if ( support.qsa ) {
1308 return context.querySelectorAll( tag );
1309 }
1310 } :
1311
1312 function( tag, context ) {
1313 var elem,
1314 tmp = [],
1315 i = 0,
1316 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1317 results = context.getElementsByTagName( tag );
1318
1319 // Filter out possible comments
1320 if ( tag === "*" ) {
1321 while ( (elem = results[i++]) ) {
1322 if ( elem.nodeType === 1 ) {
1323 tmp.push( elem );
1324 }
1325 }
1326
1327 return tmp;
1328 }
1329 return results;
1330 };
1331
1332 // Class
1333 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1334 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1335 return context.getElementsByClassName( className );
1336 }
1337 };
1338
1339 /* QSA/matchesSelector
1340 ---------------------------------------------------------------------- */
1341
1342 // QSA and matchesSelector support
1343
1344 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1345 rbuggyMatches = [];
1346
1347 // qSa(:focus) reports false when true (Chrome 21)
1348 // We allow this because of a bug in IE8/9 that throws an error
1349 // whenever `document.activeElement` is accessed on an iframe
1350 // So, we allow :focus to pass through QSA all the time to avoid the IE error
1351 // See https://bugs.jquery.com/ticket/13378
1352 rbuggyQSA = [];
1353
1354 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
1355 // Build QSA regex
1356 // Regex strategy adopted from Diego Perini
1357 assert(function( el ) {
1358 // Select is set to empty string on purpose
1359 // This is to test IE's treatment of not explicitly
1360 // setting a boolean content attribute,
1361 // since its presence should be enough
1362 // https://bugs.jquery.com/ticket/12359
1363 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
1364 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1365 "<option selected=''></option></select>";
1366
1367 // Support: IE8, Opera 11-12.16
1368 // Nothing should be selected when empty strings follow ^= or $= or *=
1369 // The test attribute must be unknown in Opera but "safe" for WinRT
1370 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1371 if ( el.querySelectorAll("[msallowcapture^='']").length ) {
1372 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1373 }
1374
1375 // Support: IE8
1376 // Boolean attributes and "value" are not treated correctly
1377 if ( !el.querySelectorAll("[selected]").length ) {
1378 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1379 }
1380
1381 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1382 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1383 rbuggyQSA.push("~=");
1384 }
1385
1386 // Webkit/Opera - :checked should return selected option elements
1387 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1388 // IE8 throws error here and will not see later tests
1389 if ( !el.querySelectorAll(":checked").length ) {
1390 rbuggyQSA.push(":checked");
1391 }
1392
1393 // Support: Safari 8+, iOS 8+
1394 // https://bugs.webkit.org/show_bug.cgi?id=136851
1395 // In-page `selector#id sibling-combinator selector` fails
1396 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1397 rbuggyQSA.push(".#.+[+~]");
1398 }
1399 });
1400
1401 assert(function( el ) {
1402 el.innerHTML = "<a href='' disabled='disabled'></a>" +
1403 "<select disabled='disabled'><option/></select>";
1404
1405 // Support: Windows 8 Native Apps
1406 // The type and name attributes are restricted during .innerHTML assignment
1407 var input = document.createElement("input");
1408 input.setAttribute( "type", "hidden" );
1409 el.appendChild( input ).setAttribute( "name", "D" );
1410
1411 // Support: IE8
1412 // Enforce case-sensitivity of name attribute
1413 if ( el.querySelectorAll("[name=d]").length ) {
1414 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1415 }
1416
1417 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1418 // IE8 throws error here and will not see later tests
1419 if ( el.querySelectorAll(":enabled").length !== 2 ) {
1420 rbuggyQSA.push( ":enabled", ":disabled" );
1421 }
1422
1423 // Support: IE9-11+
1424 // IE's :disabled selector does not pick up the children of disabled fieldsets
1425 docElem.appendChild( el ).disabled = true;
1426 if ( el.querySelectorAll(":disabled").length !== 2 ) {
1427 rbuggyQSA.push( ":enabled", ":disabled" );
1428 }
1429
1430 // Opera 10-11 does not throw on post-comma invalid pseudos
1431 el.querySelectorAll("*,:x");
1432 rbuggyQSA.push(",.*:");
1433 });
1434 }
1435
1436 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1437 docElem.webkitMatchesSelector ||
1438 docElem.mozMatchesSelector ||
1439 docElem.oMatchesSelector ||
1440 docElem.msMatchesSelector) )) ) {
1441
1442 assert(function( el ) {
1443 // Check to see if it's possible to do matchesSelector
1444 // on a disconnected node (IE 9)
1445 support.disconnectedMatch = matches.call( el, "*" );
1446
1447 // This should fail with an exception
1448 // Gecko does not error, returns false instead
1449 matches.call( el, "[s!='']:x" );
1450 rbuggyMatches.push( "!=", pseudos );
1451 });
1452 }
1453
1454 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1455 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1456
1457 /* Contains
1458 ---------------------------------------------------------------------- */
1459 hasCompare = rnative.test( docElem.compareDocumentPosition );
1460
1461 // Element contains another
1462 // Purposefully self-exclusive
1463 // As in, an element does not contain itself
1464 contains = hasCompare || rnative.test( docElem.contains ) ?
1465 function( a, b ) {
1466 var adown = a.nodeType === 9 ? a.documentElement : a,
1467 bup = b && b.parentNode;
1468 return a === bup || !!( bup && bup.nodeType === 1 && (
1469 adown.contains ?
1470 adown.contains( bup ) :
1471 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1472 ));
1473 } :
1474 function( a, b ) {
1475 if ( b ) {
1476 while ( (b = b.parentNode) ) {
1477 if ( b === a ) {
1478 return true;
1479 }
1480 }
1481 }
1482 return false;
1483 };
1484
1485 /* Sorting
1486 ---------------------------------------------------------------------- */
1487
1488 // Document order sorting
1489 sortOrder = hasCompare ?
1490 function( a, b ) {
1491
1492 // Flag for duplicate removal
1493 if ( a === b ) {
1494 hasDuplicate = true;
1495 return 0;
1496 }
1497
1498 // Sort on method existence if only one input has compareDocumentPosition
1499 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1500 if ( compare ) {
1501 return compare;
1502 }
1503
1504 // Calculate position if both inputs belong to the same document
1505 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1506 a.compareDocumentPosition( b ) :
1507
1508 // Otherwise we know they are disconnected
1509 1;
1510
1511 // Disconnected nodes
1512 if ( compare & 1 ||
1513 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1514
1515 // Choose the first element that is related to our preferred document
1516 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1517 return -1;
1518 }
1519 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1520 return 1;
1521 }
1522
1523 // Maintain original order
1524 return sortInput ?
1525 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1526 0;
1527 }
1528
1529 return compare & 4 ? -1 : 1;
1530 } :
1531 function( a, b ) {
1532 // Exit early if the nodes are identical
1533 if ( a === b ) {
1534 hasDuplicate = true;
1535 return 0;
1536 }
1537
1538 var cur,
1539 i = 0,
1540 aup = a.parentNode,
1541 bup = b.parentNode,
1542 ap = [ a ],
1543 bp = [ b ];
1544
1545 // Parentless nodes are either documents or disconnected
1546 if ( !aup || !bup ) {
1547 return a === document ? -1 :
1548 b === document ? 1 :
1549 aup ? -1 :
1550 bup ? 1 :
1551 sortInput ?
1552 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1553 0;
1554
1555 // If the nodes are siblings, we can do a quick check
1556 } else if ( aup === bup ) {
1557 return siblingCheck( a, b );
1558 }
1559
1560 // Otherwise we need full lists of their ancestors for comparison
1561 cur = a;
1562 while ( (cur = cur.parentNode) ) {
1563 ap.unshift( cur );
1564 }
1565 cur = b;
1566 while ( (cur = cur.parentNode) ) {
1567 bp.unshift( cur );
1568 }
1569
1570 // Walk down the tree looking for a discrepancy
1571 while ( ap[i] === bp[i] ) {
1572 i++;
1573 }
1574
1575 return i ?
1576 // Do a sibling check if the nodes have a common ancestor
1577 siblingCheck( ap[i], bp[i] ) :
1578
1579 // Otherwise nodes in our document sort first
1580 ap[i] === preferredDoc ? -1 :
1581 bp[i] === preferredDoc ? 1 :
1582 0;
1583 };
1584
1585 return document;
1586};
1587
1588Sizzle.matches = function( expr, elements ) {
1589 return Sizzle( expr, null, null, elements );
1590};
1591
1592Sizzle.matchesSelector = function( elem, expr ) {
1593 // Set document vars if needed
1594 if ( ( elem.ownerDocument || elem ) !== document ) {
1595 setDocument( elem );
1596 }
1597
1598 if ( support.matchesSelector && documentIsHTML &&
1599 !nonnativeSelectorCache[ expr + " " ] &&
1600 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1601 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1602
1603 try {
1604 var ret = matches.call( elem, expr );
1605
1606 // IE 9's matchesSelector returns false on disconnected nodes
1607 if ( ret || support.disconnectedMatch ||
1608 // As well, disconnected nodes are said to be in a document
1609 // fragment in IE 9
1610 elem.document && elem.document.nodeType !== 11 ) {
1611 return ret;
1612 }
1613 } catch (e) {
1614 nonnativeSelectorCache( expr, true );
1615 }
1616 }
1617
1618 return Sizzle( expr, document, null, [ elem ] ).length > 0;
1619};
1620
1621Sizzle.contains = function( context, elem ) {
1622 // Set document vars if needed
1623 if ( ( context.ownerDocument || context ) !== document ) {
1624 setDocument( context );
1625 }
1626 return contains( context, elem );
1627};
1628
1629Sizzle.attr = function( elem, name ) {
1630 // Set document vars if needed
1631 if ( ( elem.ownerDocument || elem ) !== document ) {
1632 setDocument( elem );
1633 }
1634
1635 var fn = Expr.attrHandle[ name.toLowerCase() ],
1636 // Don't get fooled by Object.prototype properties (jQuery #13807)
1637 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1638 fn( elem, name, !documentIsHTML ) :
1639 undefined;
1640
1641 return val !== undefined ?
1642 val :
1643 support.attributes || !documentIsHTML ?
1644 elem.getAttribute( name ) :
1645 (val = elem.getAttributeNode(name)) && val.specified ?
1646 val.value :
1647 null;
1648};
1649
1650Sizzle.escape = function( sel ) {
1651 return (sel + "").replace( rcssescape, fcssescape );
1652};
1653
1654Sizzle.error = function( msg ) {
1655 throw new Error( "Syntax error, unrecognized expression: " + msg );
1656};
1657
1658/**
1659 * Document sorting and removing duplicates
1660 * @param {ArrayLike} results
1661 */
1662Sizzle.uniqueSort = function( results ) {
1663 var elem,
1664 duplicates = [],
1665 j = 0,
1666 i = 0;
1667
1668 // Unless we *know* we can detect duplicates, assume their presence
1669 hasDuplicate = !support.detectDuplicates;
1670 sortInput = !support.sortStable && results.slice( 0 );
1671 results.sort( sortOrder );
1672
1673 if ( hasDuplicate ) {
1674 while ( (elem = results[i++]) ) {
1675 if ( elem === results[ i ] ) {
1676 j = duplicates.push( i );
1677 }
1678 }
1679 while ( j-- ) {
1680 results.splice( duplicates[ j ], 1 );
1681 }
1682 }
1683
1684 // Clear input after sorting to release objects
1685 // See https://github.com/jquery/sizzle/pull/225
1686 sortInput = null;
1687
1688 return results;
1689};
1690
1691/**
1692 * Utility function for retrieving the text value of an array of DOM nodes
1693 * @param {Array|Element} elem
1694 */
1695getText = Sizzle.getText = function( elem ) {
1696 var node,
1697 ret = "",
1698 i = 0,
1699 nodeType = elem.nodeType;
1700
1701 if ( !nodeType ) {
1702 // If no nodeType, this is expected to be an array
1703 while ( (node = elem[i++]) ) {
1704 // Do not traverse comment nodes
1705 ret += getText( node );
1706 }
1707 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1708 // Use textContent for elements
1709 // innerText usage removed for consistency of new lines (jQuery #11153)
1710 if ( typeof elem.textContent === "string" ) {
1711 return elem.textContent;
1712 } else {
1713 // Traverse its children
1714 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1715 ret += getText( elem );
1716 }
1717 }
1718 } else if ( nodeType === 3 || nodeType === 4 ) {
1719 return elem.nodeValue;
1720 }
1721 // Do not include comment or processing instruction nodes
1722
1723 return ret;
1724};
1725
1726Expr = Sizzle.selectors = {
1727
1728 // Can be adjusted by the user
1729 cacheLength: 50,
1730
1731 createPseudo: markFunction,
1732
1733 match: matchExpr,
1734
1735 attrHandle: {},
1736
1737 find: {},
1738
1739 relative: {
1740 ">": { dir: "parentNode", first: true },
1741 " ": { dir: "parentNode" },
1742 "+": { dir: "previousSibling", first: true },
1743 "~": { dir: "previousSibling" }
1744 },
1745
1746 preFilter: {
1747 "ATTR": function( match ) {
1748 match[1] = match[1].replace( runescape, funescape );
1749
1750 // Move the given value to match[3] whether quoted or unquoted
1751 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1752
1753 if ( match[2] === "~=" ) {
1754 match[3] = " " + match[3] + " ";
1755 }
1756
1757 return match.slice( 0, 4 );
1758 },
1759
1760 "CHILD": function( match ) {
1761 /* matches from matchExpr["CHILD"]
1762 1 type (only|nth|...)
1763 2 what (child|of-type)
1764 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1765 4 xn-component of xn+y argument ([+-]?\d*n|)
1766 5 sign of xn-component
1767 6 x of xn-component
1768 7 sign of y-component
1769 8 y of y-component
1770 */
1771 match[1] = match[1].toLowerCase();
1772
1773 if ( match[1].slice( 0, 3 ) === "nth" ) {
1774 // nth-* requires argument
1775 if ( !match[3] ) {
1776 Sizzle.error( match[0] );
1777 }
1778
1779 // numeric x and y parameters for Expr.filter.CHILD
1780 // remember that false/true cast respectively to 0/1
1781 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1782 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1783
1784 // other types prohibit arguments
1785 } else if ( match[3] ) {
1786 Sizzle.error( match[0] );
1787 }
1788
1789 return match;
1790 },
1791
1792 "PSEUDO": function( match ) {
1793 var excess,
1794 unquoted = !match[6] && match[2];
1795
1796 if ( matchExpr["CHILD"].test( match[0] ) ) {
1797 return null;
1798 }
1799
1800 // Accept quoted arguments as-is
1801 if ( match[3] ) {
1802 match[2] = match[4] || match[5] || "";
1803
1804 // Strip excess characters from unquoted arguments
1805 } else if ( unquoted && rpseudo.test( unquoted ) &&
1806 // Get excess from tokenize (recursively)
1807 (excess = tokenize( unquoted, true )) &&
1808 // advance to the next closing parenthesis
1809 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1810
1811 // excess is a negative index
1812 match[0] = match[0].slice( 0, excess );
1813 match[2] = unquoted.slice( 0, excess );
1814 }
1815
1816 // Return only captures needed by the pseudo filter method (type and argument)
1817 return match.slice( 0, 3 );
1818 }
1819 },
1820
1821 filter: {
1822
1823 "TAG": function( nodeNameSelector ) {
1824 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1825 return nodeNameSelector === "*" ?
1826 function() { return true; } :
1827 function( elem ) {
1828 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1829 };
1830 },
1831
1832 "CLASS": function( className ) {
1833 var pattern = classCache[ className + " " ];
1834
1835 return pattern ||
1836 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1837 classCache( className, function( elem ) {
1838 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1839 });
1840 },
1841
1842 "ATTR": function( name, operator, check ) {
1843 return function( elem ) {
1844 var result = Sizzle.attr( elem, name );
1845
1846 if ( result == null ) {
1847 return operator === "!=";
1848 }
1849 if ( !operator ) {
1850 return true;
1851 }
1852
1853 result += "";
1854
1855 return operator === "=" ? result === check :
1856 operator === "!=" ? result !== check :
1857 operator === "^=" ? check && result.indexOf( check ) === 0 :
1858 operator === "*=" ? check && result.indexOf( check ) > -1 :
1859 operator === "$=" ? check && result.slice( -check.length ) === check :
1860 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1861 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1862 false;
1863 };
1864 },
1865
1866 "CHILD": function( type, what, argument, first, last ) {
1867 var simple = type.slice( 0, 3 ) !== "nth",
1868 forward = type.slice( -4 ) !== "last",
1869 ofType = what === "of-type";
1870
1871 return first === 1 && last === 0 ?
1872
1873 // Shortcut for :nth-*(n)
1874 function( elem ) {
1875 return !!elem.parentNode;
1876 } :
1877
1878 function( elem, context, xml ) {
1879 var cache, uniqueCache, outerCache, node, nodeIndex, start,
1880 dir = simple !== forward ? "nextSibling" : "previousSibling",
1881 parent = elem.parentNode,
1882 name = ofType && elem.nodeName.toLowerCase(),
1883 useCache = !xml && !ofType,
1884 diff = false;
1885
1886 if ( parent ) {
1887
1888 // :(first|last|only)-(child|of-type)
1889 if ( simple ) {
1890 while ( dir ) {
1891 node = elem;
1892 while ( (node = node[ dir ]) ) {
1893 if ( ofType ?
1894 node.nodeName.toLowerCase() === name :
1895 node.nodeType === 1 ) {
1896
1897 return false;
1898 }
1899 }
1900 // Reverse direction for :only-* (if we haven't yet done so)
1901 start = dir = type === "only" && !start && "nextSibling";
1902 }
1903 return true;
1904 }
1905
1906 start = [ forward ? parent.firstChild : parent.lastChild ];
1907
1908 // non-xml :nth-child(...) stores cache data on `parent`
1909 if ( forward && useCache ) {
1910
1911 // Seek `elem` from a previously-cached index
1912
1913 // ...in a gzip-friendly way
1914 node = parent;
1915 outerCache = node[ expando ] || (node[ expando ] = {});
1916
1917 // Support: IE <9 only
1918 // Defend against cloned attroperties (jQuery gh-1709)
1919 uniqueCache = outerCache[ node.uniqueID ] ||
1920 (outerCache[ node.uniqueID ] = {});
1921
1922 cache = uniqueCache[ type ] || [];
1923 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1924 diff = nodeIndex && cache[ 2 ];
1925 node = nodeIndex && parent.childNodes[ nodeIndex ];
1926
1927 while ( (node = ++nodeIndex && node && node[ dir ] ||
1928
1929 // Fallback to seeking `elem` from the start
1930 (diff = nodeIndex = 0) || start.pop()) ) {
1931
1932 // When found, cache indexes on `parent` and break
1933 if ( node.nodeType === 1 && ++diff && node === elem ) {
1934 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1935 break;
1936 }
1937 }
1938
1939 } else {
1940 // Use previously-cached element index if available
1941 if ( useCache ) {
1942 // ...in a gzip-friendly way
1943 node = elem;
1944 outerCache = node[ expando ] || (node[ expando ] = {});
1945
1946 // Support: IE <9 only
1947 // Defend against cloned attroperties (jQuery gh-1709)
1948 uniqueCache = outerCache[ node.uniqueID ] ||
1949 (outerCache[ node.uniqueID ] = {});
1950
1951 cache = uniqueCache[ type ] || [];
1952 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1953 diff = nodeIndex;
1954 }
1955
1956 // xml :nth-child(...)
1957 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1958 if ( diff === false ) {
1959 // Use the same loop as above to seek `elem` from the start
1960 while ( (node = ++nodeIndex && node && node[ dir ] ||
1961 (diff = nodeIndex = 0) || start.pop()) ) {
1962
1963 if ( ( ofType ?
1964 node.nodeName.toLowerCase() === name :
1965 node.nodeType === 1 ) &&
1966 ++diff ) {
1967
1968 // Cache the index of each encountered element
1969 if ( useCache ) {
1970 outerCache = node[ expando ] || (node[ expando ] = {});
1971
1972 // Support: IE <9 only
1973 // Defend against cloned attroperties (jQuery gh-1709)
1974 uniqueCache = outerCache[ node.uniqueID ] ||
1975 (outerCache[ node.uniqueID ] = {});
1976
1977 uniqueCache[ type ] = [ dirruns, diff ];
1978 }
1979
1980 if ( node === elem ) {
1981 break;
1982 }
1983 }
1984 }
1985 }
1986 }
1987
1988 // Incorporate the offset, then check against cycle size
1989 diff -= last;
1990 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1991 }
1992 };
1993 },
1994
1995 "PSEUDO": function( pseudo, argument ) {
1996 // pseudo-class names are case-insensitive
1997 // http://www.w3.org/TR/selectors/#pseudo-classes
1998 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1999 // Remember that setFilters inherits from pseudos
2000 var args,
2001 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
2002 Sizzle.error( "unsupported pseudo: " + pseudo );
2003
2004 // The user may use createPseudo to indicate that
2005 // arguments are needed to create the filter function
2006 // just as Sizzle does
2007 if ( fn[ expando ] ) {
2008 return fn( argument );
2009 }
2010
2011 // But maintain support for old signatures
2012 if ( fn.length > 1 ) {
2013 args = [ pseudo, pseudo, "", argument ];
2014 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
2015 markFunction(function( seed, matches ) {
2016 var idx,
2017 matched = fn( seed, argument ),
2018 i = matched.length;
2019 while ( i-- ) {
2020 idx = indexOf( seed, matched[i] );
2021 seed[ idx ] = !( matches[ idx ] = matched[i] );
2022 }
2023 }) :
2024 function( elem ) {
2025 return fn( elem, 0, args );
2026 };
2027 }
2028
2029 return fn;
2030 }
2031 },
2032
2033 pseudos: {
2034 // Potentially complex pseudos
2035 "not": markFunction(function( selector ) {
2036 // Trim the selector passed to compile
2037 // to avoid treating leading and trailing
2038 // spaces as combinators
2039 var input = [],
2040 results = [],
2041 matcher = compile( selector.replace( rtrim, "$1" ) );
2042
2043 return matcher[ expando ] ?
2044 markFunction(function( seed, matches, context, xml ) {
2045 var elem,
2046 unmatched = matcher( seed, null, xml, [] ),
2047 i = seed.length;
2048
2049 // Match elements unmatched by `matcher`
2050 while ( i-- ) {
2051 if ( (elem = unmatched[i]) ) {
2052 seed[i] = !(matches[i] = elem);
2053 }
2054 }
2055 }) :
2056 function( elem, context, xml ) {
2057 input[0] = elem;
2058 matcher( input, null, xml, results );
2059 // Don't keep the element (issue #299)
2060 input[0] = null;
2061 return !results.pop();
2062 };
2063 }),
2064
2065 "has": markFunction(function( selector ) {
2066 return function( elem ) {
2067 return Sizzle( selector, elem ).length > 0;
2068 };
2069 }),
2070
2071 "contains": markFunction(function( text ) {
2072 text = text.replace( runescape, funescape );
2073 return function( elem ) {
2074 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
2075 };
2076 }),
2077
2078 // "Whether an element is represented by a :lang() selector
2079 // is based solely on the element's language value
2080 // being equal to the identifier C,
2081 // or beginning with the identifier C immediately followed by "-".
2082 // The matching of C against the element's language value is performed case-insensitively.
2083 // The identifier C does not have to be a valid language name."
2084 // http://www.w3.org/TR/selectors/#lang-pseudo
2085 "lang": markFunction( function( lang ) {
2086 // lang value must be a valid identifier
2087 if ( !ridentifier.test(lang || "") ) {
2088 Sizzle.error( "unsupported lang: " + lang );
2089 }
2090 lang = lang.replace( runescape, funescape ).toLowerCase();
2091 return function( elem ) {
2092 var elemLang;
2093 do {
2094 if ( (elemLang = documentIsHTML ?
2095 elem.lang :
2096 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
2097
2098 elemLang = elemLang.toLowerCase();
2099 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
2100 }
2101 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
2102 return false;
2103 };
2104 }),
2105
2106 // Miscellaneous
2107 "target": function( elem ) {
2108 var hash = window.location && window.location.hash;
2109 return hash && hash.slice( 1 ) === elem.id;
2110 },
2111
2112 "root": function( elem ) {
2113 return elem === docElem;
2114 },
2115
2116 "focus": function( elem ) {
2117 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
2118 },
2119
2120 // Boolean properties
2121 "enabled": createDisabledPseudo( false ),
2122 "disabled": createDisabledPseudo( true ),
2123
2124 "checked": function( elem ) {
2125 // In CSS3, :checked should return both checked and selected elements
2126 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2127 var nodeName = elem.nodeName.toLowerCase();
2128 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
2129 },
2130
2131 "selected": function( elem ) {
2132 // Accessing this property makes selected-by-default
2133 // options in Safari work properly
2134 if ( elem.parentNode ) {
2135 elem.parentNode.selectedIndex;
2136 }
2137
2138 return elem.selected === true;
2139 },
2140
2141 // Contents
2142 "empty": function( elem ) {
2143 // http://www.w3.org/TR/selectors/#empty-pseudo
2144 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2145 // but not by others (comment: 8; processing instruction: 7; etc.)
2146 // nodeType < 6 works because attributes (2) do not appear as children
2147 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2148 if ( elem.nodeType < 6 ) {
2149 return false;
2150 }
2151 }
2152 return true;
2153 },
2154
2155 "parent": function( elem ) {
2156 return !Expr.pseudos["empty"]( elem );
2157 },
2158
2159 // Element/input types
2160 "header": function( elem ) {
2161 return rheader.test( elem.nodeName );
2162 },
2163
2164 "input": function( elem ) {
2165 return rinputs.test( elem.nodeName );
2166 },
2167
2168 "button": function( elem ) {
2169 var name = elem.nodeName.toLowerCase();
2170 return name === "input" && elem.type === "button" || name === "button";
2171 },
2172
2173 "text": function( elem ) {
2174 var attr;
2175 return elem.nodeName.toLowerCase() === "input" &&
2176 elem.type === "text" &&
2177
2178 // Support: IE<8
2179 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2180 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2181 },
2182
2183 // Position-in-collection
2184 "first": createPositionalPseudo(function() {
2185 return [ 0 ];
2186 }),
2187
2188 "last": createPositionalPseudo(function( matchIndexes, length ) {
2189 return [ length - 1 ];
2190 }),
2191
2192 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2193 return [ argument < 0 ? argument + length : argument ];
2194 }),
2195
2196 "even": createPositionalPseudo(function( matchIndexes, length ) {
2197 var i = 0;
2198 for ( ; i < length; i += 2 ) {
2199 matchIndexes.push( i );
2200 }
2201 return matchIndexes;
2202 }),
2203
2204 "odd": createPositionalPseudo(function( matchIndexes, length ) {
2205 var i = 1;
2206 for ( ; i < length; i += 2 ) {
2207 matchIndexes.push( i );
2208 }
2209 return matchIndexes;
2210 }),
2211
2212 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2213 var i = argument < 0 ?
2214 argument + length :
2215 argument > length ?
2216 length :
2217 argument;
2218 for ( ; --i >= 0; ) {
2219 matchIndexes.push( i );
2220 }
2221 return matchIndexes;
2222 }),
2223
2224 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2225 var i = argument < 0 ? argument + length : argument;
2226 for ( ; ++i < length; ) {
2227 matchIndexes.push( i );
2228 }
2229 return matchIndexes;
2230 })
2231 }
2232};
2233
2234Expr.pseudos["nth"] = Expr.pseudos["eq"];
2235
2236// Add button/input type pseudos
2237for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2238 Expr.pseudos[ i ] = createInputPseudo( i );
2239}
2240for ( i in { submit: true, reset: true } ) {
2241 Expr.pseudos[ i ] = createButtonPseudo( i );
2242}
2243
2244// Easy API for creating new setFilters
2245function setFilters() {}
2246setFilters.prototype = Expr.filters = Expr.pseudos;
2247Expr.setFilters = new setFilters();
2248
2249tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2250 var matched, match, tokens, type,
2251 soFar, groups, preFilters,
2252 cached = tokenCache[ selector + " " ];
2253
2254 if ( cached ) {
2255 return parseOnly ? 0 : cached.slice( 0 );
2256 }
2257
2258 soFar = selector;
2259 groups = [];
2260 preFilters = Expr.preFilter;
2261
2262 while ( soFar ) {
2263
2264 // Comma and first run
2265 if ( !matched || (match = rcomma.exec( soFar )) ) {
2266 if ( match ) {
2267 // Don't consume trailing commas as valid
2268 soFar = soFar.slice( match[0].length ) || soFar;
2269 }
2270 groups.push( (tokens = []) );
2271 }
2272
2273 matched = false;
2274
2275 // Combinators
2276 if ( (match = rcombinators.exec( soFar )) ) {
2277 matched = match.shift();
2278 tokens.push({
2279 value: matched,
2280 // Cast descendant combinators to space
2281 type: match[0].replace( rtrim, " " )
2282 });
2283 soFar = soFar.slice( matched.length );
2284 }
2285
2286 // Filters
2287 for ( type in Expr.filter ) {
2288 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2289 (match = preFilters[ type ]( match ))) ) {
2290 matched = match.shift();
2291 tokens.push({
2292 value: matched,
2293 type: type,
2294 matches: match
2295 });
2296 soFar = soFar.slice( matched.length );
2297 }
2298 }
2299
2300 if ( !matched ) {
2301 break;
2302 }
2303 }
2304
2305 // Return the length of the invalid excess
2306 // if we're just parsing
2307 // Otherwise, throw an error or return tokens
2308 return parseOnly ?
2309 soFar.length :
2310 soFar ?
2311 Sizzle.error( selector ) :
2312 // Cache the tokens
2313 tokenCache( selector, groups ).slice( 0 );
2314};
2315
2316function toSelector( tokens ) {
2317 var i = 0,
2318 len = tokens.length,
2319 selector = "";
2320 for ( ; i < len; i++ ) {
2321 selector += tokens[i].value;
2322 }
2323 return selector;
2324}
2325
2326function addCombinator( matcher, combinator, base ) {
2327 var dir = combinator.dir,
2328 skip = combinator.next,
2329 key = skip || dir,
2330 checkNonElements = base && key === "parentNode",
2331 doneName = done++;
2332
2333 return combinator.first ?
2334 // Check against closest ancestor/preceding element
2335 function( elem, context, xml ) {
2336 while ( (elem = elem[ dir ]) ) {
2337 if ( elem.nodeType === 1 || checkNonElements ) {
2338 return matcher( elem, context, xml );
2339 }
2340 }
2341 return false;
2342 } :
2343
2344 // Check against all ancestor/preceding elements
2345 function( elem, context, xml ) {
2346 var oldCache, uniqueCache, outerCache,
2347 newCache = [ dirruns, doneName ];
2348
2349 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2350 if ( xml ) {
2351 while ( (elem = elem[ dir ]) ) {
2352 if ( elem.nodeType === 1 || checkNonElements ) {
2353 if ( matcher( elem, context, xml ) ) {
2354 return true;
2355 }
2356 }
2357 }
2358 } else {
2359 while ( (elem = elem[ dir ]) ) {
2360 if ( elem.nodeType === 1 || checkNonElements ) {
2361 outerCache = elem[ expando ] || (elem[ expando ] = {});
2362
2363 // Support: IE <9 only
2364 // Defend against cloned attroperties (jQuery gh-1709)
2365 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
2366
2367 if ( skip && skip === elem.nodeName.toLowerCase() ) {
2368 elem = elem[ dir ] || elem;
2369 } else if ( (oldCache = uniqueCache[ key ]) &&
2370 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2371
2372 // Assign to newCache so results back-propagate to previous elements
2373 return (newCache[ 2 ] = oldCache[ 2 ]);
2374 } else {
2375 // Reuse newcache so results back-propagate to previous elements
2376 uniqueCache[ key ] = newCache;
2377
2378 // A match means we're done; a fail means we have to keep checking
2379 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2380 return true;
2381 }
2382 }
2383 }
2384 }
2385 }
2386 return false;
2387 };
2388}
2389
2390function elementMatcher( matchers ) {
2391 return matchers.length > 1 ?
2392 function( elem, context, xml ) {
2393 var i = matchers.length;
2394 while ( i-- ) {
2395 if ( !matchers[i]( elem, context, xml ) ) {
2396 return false;
2397 }
2398 }
2399 return true;
2400 } :
2401 matchers[0];
2402}
2403
2404function multipleContexts( selector, contexts, results ) {
2405 var i = 0,
2406 len = contexts.length;
2407 for ( ; i < len; i++ ) {
2408 Sizzle( selector, contexts[i], results );
2409 }
2410 return results;
2411}
2412
2413function condense( unmatched, map, filter, context, xml ) {
2414 var elem,
2415 newUnmatched = [],
2416 i = 0,
2417 len = unmatched.length,
2418 mapped = map != null;
2419
2420 for ( ; i < len; i++ ) {
2421 if ( (elem = unmatched[i]) ) {
2422 if ( !filter || filter( elem, context, xml ) ) {
2423 newUnmatched.push( elem );
2424 if ( mapped ) {
2425 map.push( i );
2426 }
2427 }
2428 }
2429 }
2430
2431 return newUnmatched;
2432}
2433
2434function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2435 if ( postFilter && !postFilter[ expando ] ) {
2436 postFilter = setMatcher( postFilter );
2437 }
2438 if ( postFinder && !postFinder[ expando ] ) {
2439 postFinder = setMatcher( postFinder, postSelector );
2440 }
2441 return markFunction(function( seed, results, context, xml ) {
2442 var temp, i, elem,
2443 preMap = [],
2444 postMap = [],
2445 preexisting = results.length,
2446
2447 // Get initial elements from seed or context
2448 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2449
2450 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2451 matcherIn = preFilter && ( seed || !selector ) ?
2452 condense( elems, preMap, preFilter, context, xml ) :
2453 elems,
2454
2455 matcherOut = matcher ?
2456 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2457 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2458
2459 // ...intermediate processing is necessary
2460 [] :
2461
2462 // ...otherwise use results directly
2463 results :
2464 matcherIn;
2465
2466 // Find primary matches
2467 if ( matcher ) {
2468 matcher( matcherIn, matcherOut, context, xml );
2469 }
2470
2471 // Apply postFilter
2472 if ( postFilter ) {
2473 temp = condense( matcherOut, postMap );
2474 postFilter( temp, [], context, xml );
2475
2476 // Un-match failing elements by moving them back to matcherIn
2477 i = temp.length;
2478 while ( i-- ) {
2479 if ( (elem = temp[i]) ) {
2480 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2481 }
2482 }
2483 }
2484
2485 if ( seed ) {
2486 if ( postFinder || preFilter ) {
2487 if ( postFinder ) {
2488 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2489 temp = [];
2490 i = matcherOut.length;
2491 while ( i-- ) {
2492 if ( (elem = matcherOut[i]) ) {
2493 // Restore matcherIn since elem is not yet a final match
2494 temp.push( (matcherIn[i] = elem) );
2495 }
2496 }
2497 postFinder( null, (matcherOut = []), temp, xml );
2498 }
2499
2500 // Move matched elements from seed to results to keep them synchronized
2501 i = matcherOut.length;
2502 while ( i-- ) {
2503 if ( (elem = matcherOut[i]) &&
2504 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2505
2506 seed[temp] = !(results[temp] = elem);
2507 }
2508 }
2509 }
2510
2511 // Add elements to results, through postFinder if defined
2512 } else {
2513 matcherOut = condense(
2514 matcherOut === results ?
2515 matcherOut.splice( preexisting, matcherOut.length ) :
2516 matcherOut
2517 );
2518 if ( postFinder ) {
2519 postFinder( null, results, matcherOut, xml );
2520 } else {
2521 push.apply( results, matcherOut );
2522 }
2523 }
2524 });
2525}
2526
2527function matcherFromTokens( tokens ) {
2528 var checkContext, matcher, j,
2529 len = tokens.length,
2530 leadingRelative = Expr.relative[ tokens[0].type ],
2531 implicitRelative = leadingRelative || Expr.relative[" "],
2532 i = leadingRelative ? 1 : 0,
2533
2534 // The foundational matcher ensures that elements are reachable from top-level context(s)
2535 matchContext = addCombinator( function( elem ) {
2536 return elem === checkContext;
2537 }, implicitRelative, true ),
2538 matchAnyContext = addCombinator( function( elem ) {
2539 return indexOf( checkContext, elem ) > -1;
2540 }, implicitRelative, true ),
2541 matchers = [ function( elem, context, xml ) {
2542 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2543 (checkContext = context).nodeType ?
2544 matchContext( elem, context, xml ) :
2545 matchAnyContext( elem, context, xml ) );
2546 // Avoid hanging onto element (issue #299)
2547 checkContext = null;
2548 return ret;
2549 } ];
2550
2551 for ( ; i < len; i++ ) {
2552 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2553 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2554 } else {
2555 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2556
2557 // Return special upon seeing a positional matcher
2558 if ( matcher[ expando ] ) {
2559 // Find the next relative operator (if any) for proper handling
2560 j = ++i;
2561 for ( ; j < len; j++ ) {
2562 if ( Expr.relative[ tokens[j].type ] ) {
2563 break;
2564 }
2565 }
2566 return setMatcher(
2567 i > 1 && elementMatcher( matchers ),
2568 i > 1 && toSelector(
2569 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2570 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2571 ).replace( rtrim, "$1" ),
2572 matcher,
2573 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2574 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2575 j < len && toSelector( tokens )
2576 );
2577 }
2578 matchers.push( matcher );
2579 }
2580 }
2581
2582 return elementMatcher( matchers );
2583}
2584
2585function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2586 var bySet = setMatchers.length > 0,
2587 byElement = elementMatchers.length > 0,
2588 superMatcher = function( seed, context, xml, results, outermost ) {
2589 var elem, j, matcher,
2590 matchedCount = 0,
2591 i = "0",
2592 unmatched = seed && [],
2593 setMatched = [],
2594 contextBackup = outermostContext,
2595 // We must always have either seed elements or outermost context
2596 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2597 // Use integer dirruns iff this is the outermost matcher
2598 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2599 len = elems.length;
2600
2601 if ( outermost ) {
2602 outermostContext = context === document || context || outermost;
2603 }
2604
2605 // Add elements passing elementMatchers directly to results
2606 // Support: IE<9, Safari
2607 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2608 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2609 if ( byElement && elem ) {
2610 j = 0;
2611 if ( !context && elem.ownerDocument !== document ) {
2612 setDocument( elem );
2613 xml = !documentIsHTML;
2614 }
2615 while ( (matcher = elementMatchers[j++]) ) {
2616 if ( matcher( elem, context || document, xml) ) {
2617 results.push( elem );
2618 break;
2619 }
2620 }
2621 if ( outermost ) {
2622 dirruns = dirrunsUnique;
2623 }
2624 }
2625
2626 // Track unmatched elements for set filters
2627 if ( bySet ) {
2628 // They will have gone through all possible matchers
2629 if ( (elem = !matcher && elem) ) {
2630 matchedCount--;
2631 }
2632
2633 // Lengthen the array for every element, matched or not
2634 if ( seed ) {
2635 unmatched.push( elem );
2636 }
2637 }
2638 }
2639
2640 // `i` is now the count of elements visited above, and adding it to `matchedCount`
2641 // makes the latter nonnegative.
2642 matchedCount += i;
2643
2644 // Apply set filters to unmatched elements
2645 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2646 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2647 // no element matchers and no seed.
2648 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2649 // case, which will result in a "00" `matchedCount` that differs from `i` but is also
2650 // numerically zero.
2651 if ( bySet && i !== matchedCount ) {
2652 j = 0;
2653 while ( (matcher = setMatchers[j++]) ) {
2654 matcher( unmatched, setMatched, context, xml );
2655 }
2656
2657 if ( seed ) {
2658 // Reintegrate element matches to eliminate the need for sorting
2659 if ( matchedCount > 0 ) {
2660 while ( i-- ) {
2661 if ( !(unmatched[i] || setMatched[i]) ) {
2662 setMatched[i] = pop.call( results );
2663 }
2664 }
2665 }
2666
2667 // Discard index placeholder values to get only actual matches
2668 setMatched = condense( setMatched );
2669 }
2670
2671 // Add matches to results
2672 push.apply( results, setMatched );
2673
2674 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2675 if ( outermost && !seed && setMatched.length > 0 &&
2676 ( matchedCount + setMatchers.length ) > 1 ) {
2677
2678 Sizzle.uniqueSort( results );
2679 }
2680 }
2681
2682 // Override manipulation of globals by nested matchers
2683 if ( outermost ) {
2684 dirruns = dirrunsUnique;
2685 outermostContext = contextBackup;
2686 }
2687
2688 return unmatched;
2689 };
2690
2691 return bySet ?
2692 markFunction( superMatcher ) :
2693 superMatcher;
2694}
2695
2696compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2697 var i,
2698 setMatchers = [],
2699 elementMatchers = [],
2700 cached = compilerCache[ selector + " " ];
2701
2702 if ( !cached ) {
2703 // Generate a function of recursive functions that can be used to check each element
2704 if ( !match ) {
2705 match = tokenize( selector );
2706 }
2707 i = match.length;
2708 while ( i-- ) {
2709 cached = matcherFromTokens( match[i] );
2710 if ( cached[ expando ] ) {
2711 setMatchers.push( cached );
2712 } else {
2713 elementMatchers.push( cached );
2714 }
2715 }
2716
2717 // Cache the compiled function
2718 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2719
2720 // Save selector and tokenization
2721 cached.selector = selector;
2722 }
2723 return cached;
2724};
2725
2726/**
2727 * A low-level selection function that works with Sizzle's compiled
2728 * selector functions
2729 * @param {String|Function} selector A selector or a pre-compiled
2730 * selector function built with Sizzle.compile
2731 * @param {Element} context
2732 * @param {Array} [results]
2733 * @param {Array} [seed] A set of elements to match against
2734 */
2735select = Sizzle.select = function( selector, context, results, seed ) {
2736 var i, tokens, token, type, find,
2737 compiled = typeof selector === "function" && selector,
2738 match = !seed && tokenize( (selector = compiled.selector || selector) );
2739
2740 results = results || [];
2741
2742 // Try to minimize operations if there is only one selector in the list and no seed
2743 // (the latter of which guarantees us context)
2744 if ( match.length === 1 ) {
2745
2746 // Reduce context if the leading compound selector is an ID
2747 tokens = match[0] = match[0].slice( 0 );
2748 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2749 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
2750
2751 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2752 if ( !context ) {
2753 return results;
2754
2755 // Precompiled matchers will still verify ancestry, so step up a level
2756 } else if ( compiled ) {
2757 context = context.parentNode;
2758 }
2759
2760 selector = selector.slice( tokens.shift().value.length );
2761 }
2762
2763 // Fetch a seed set for right-to-left matching
2764 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2765 while ( i-- ) {
2766 token = tokens[i];
2767
2768 // Abort if we hit a combinator
2769 if ( Expr.relative[ (type = token.type) ] ) {
2770 break;
2771 }
2772 if ( (find = Expr.find[ type ]) ) {
2773 // Search, expanding context for leading sibling combinators
2774 if ( (seed = find(
2775 token.matches[0].replace( runescape, funescape ),
2776 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2777 )) ) {
2778
2779 // If seed is empty or no tokens remain, we can return early
2780 tokens.splice( i, 1 );
2781 selector = seed.length && toSelector( tokens );
2782 if ( !selector ) {
2783 push.apply( results, seed );
2784 return results;
2785 }
2786
2787 break;
2788 }
2789 }
2790 }
2791 }
2792
2793 // Compile and execute a filtering function if one is not provided
2794 // Provide `match` to avoid retokenization if we modified the selector above
2795 ( compiled || compile( selector, match ) )(
2796 seed,
2797 context,
2798 !documentIsHTML,
2799 results,
2800 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2801 );
2802 return results;
2803};
2804
2805// One-time assignments
2806
2807// Sort stability
2808support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2809
2810// Support: Chrome 14-35+
2811// Always assume duplicates if they aren't passed to the comparison function
2812support.detectDuplicates = !!hasDuplicate;
2813
2814// Initialize against the default document
2815setDocument();
2816
2817// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2818// Detached nodes confoundingly follow *each other*
2819support.sortDetached = assert(function( el ) {
2820 // Should return 1, but returns 4 (following)
2821 return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
2822});
2823
2824// Support: IE<8
2825// Prevent attribute/property "interpolation"
2826// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2827if ( !assert(function( el ) {
2828 el.innerHTML = "<a href='#'></a>";
2829 return el.firstChild.getAttribute("href") === "#" ;
2830}) ) {
2831 addHandle( "type|href|height|width", function( elem, name, isXML ) {
2832 if ( !isXML ) {
2833 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2834 }
2835 });
2836}
2837
2838// Support: IE<9
2839// Use defaultValue in place of getAttribute("value")
2840if ( !support.attributes || !assert(function( el ) {
2841 el.innerHTML = "<input/>";
2842 el.firstChild.setAttribute( "value", "" );
2843 return el.firstChild.getAttribute( "value" ) === "";
2844}) ) {
2845 addHandle( "value", function( elem, name, isXML ) {
2846 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2847 return elem.defaultValue;
2848 }
2849 });
2850}
2851
2852// Support: IE<9
2853// Use getAttributeNode to fetch booleans when getAttribute lies
2854if ( !assert(function( el ) {
2855 return el.getAttribute("disabled") == null;
2856}) ) {
2857 addHandle( booleans, function( elem, name, isXML ) {
2858 var val;
2859 if ( !isXML ) {
2860 return elem[ name ] === true ? name.toLowerCase() :
2861 (val = elem.getAttributeNode( name )) && val.specified ?
2862 val.value :
2863 null;
2864 }
2865 });
2866}
2867
2868return Sizzle;
2869
2870})( window );
2871
2872
2873
2874jQuery.find = Sizzle;
2875jQuery.expr = Sizzle.selectors;
2876
2877// Deprecated
2878jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2879jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
2880jQuery.text = Sizzle.getText;
2881jQuery.isXMLDoc = Sizzle.isXML;
2882jQuery.contains = Sizzle.contains;
2883jQuery.escapeSelector = Sizzle.escape;
2884
2885
2886
2887
2888var dir = function( elem, dir, until ) {
2889 var matched = [],
2890 truncate = until !== undefined;
2891
2892 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2893 if ( elem.nodeType === 1 ) {
2894 if ( truncate && jQuery( elem ).is( until ) ) {
2895 break;
2896 }
2897 matched.push( elem );
2898 }
2899 }
2900 return matched;
2901};
2902
2903
2904var siblings = function( n, elem ) {
2905 var matched = [];
2906
2907 for ( ; n; n = n.nextSibling ) {
2908 if ( n.nodeType === 1 && n !== elem ) {
2909 matched.push( n );
2910 }
2911 }
2912
2913 return matched;
2914};
2915
2916
2917var rneedsContext = jQuery.expr.match.needsContext;
2918
2919
2920
2921function nodeName( elem, name ) {
2922
2923 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
2924
2925};
2926var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
2927
2928
2929
2930// Implement the identical functionality for filter and not
2931function winnow( elements, qualifier, not ) {
2932 if ( isFunction( qualifier ) ) {
2933 return jQuery.grep( elements, function( elem, i ) {
2934 return !!qualifier.call( elem, i, elem ) !== not;
2935 } );
2936 }
2937
2938 // Single element
2939 if ( qualifier.nodeType ) {
2940 return jQuery.grep( elements, function( elem ) {
2941 return ( elem === qualifier ) !== not;
2942 } );
2943 }
2944
2945 // Arraylike of elements (jQuery, arguments, Array)
2946 if ( typeof qualifier !== "string" ) {
2947 return jQuery.grep( elements, function( elem ) {
2948 return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
2949 } );
2950 }
2951
2952 // Filtered directly for both simple and complex selectors
2953 return jQuery.filter( qualifier, elements, not );
2954}
2955
2956jQuery.filter = function( expr, elems, not ) {
2957 var elem = elems[ 0 ];
2958
2959 if ( not ) {
2960 expr = ":not(" + expr + ")";
2961 }
2962
2963 if ( elems.length === 1 && elem.nodeType === 1 ) {
2964 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
2965 }
2966
2967 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2968 return elem.nodeType === 1;
2969 } ) );
2970};
2971
2972jQuery.fn.extend( {
2973 find: function( selector ) {
2974 var i, ret,
2975 len = this.length,
2976 self = this;
2977
2978 if ( typeof selector !== "string" ) {
2979 return this.pushStack( jQuery( selector ).filter( function() {
2980 for ( i = 0; i < len; i++ ) {
2981 if ( jQuery.contains( self[ i ], this ) ) {
2982 return true;
2983 }
2984 }
2985 } ) );
2986 }
2987
2988 ret = this.pushStack( [] );
2989
2990 for ( i = 0; i < len; i++ ) {
2991 jQuery.find( selector, self[ i ], ret );
2992 }
2993
2994 return len > 1 ? jQuery.uniqueSort( ret ) : ret;
2995 },
2996 filter: function( selector ) {
2997 return this.pushStack( winnow( this, selector || [], false ) );
2998 },
2999 not: function( selector ) {
3000 return this.pushStack( winnow( this, selector || [], true ) );
3001 },
3002 is: function( selector ) {
3003 return !!winnow(
3004 this,
3005
3006 // If this is a positional/relative selector, check membership in the returned set
3007 // so $("p:first").is("p:last") won't return true for a doc with two "p".
3008 typeof selector === "string" && rneedsContext.test( selector ) ?
3009 jQuery( selector ) :
3010 selector || [],
3011 false
3012 ).length;
3013 }
3014} );
3015
3016
3017// Initialize a jQuery object
3018
3019
3020// A central reference to the root jQuery(document)
3021var rootjQuery,
3022
3023 // A simple way to check for HTML strings
3024 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
3025 // Strict HTML recognition (#11290: must start with <)
3026 // Shortcut simple #id case for speed
3027 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
3028
3029 init = jQuery.fn.init = function( selector, context, root ) {
3030 var match, elem;
3031
3032 // HANDLE: $(""), $(null), $(undefined), $(false)
3033 if ( !selector ) {
3034 return this;
3035 }
3036
3037 // Method init() accepts an alternate rootjQuery
3038 // so migrate can support jQuery.sub (gh-2101)
3039 root = root || rootjQuery;
3040
3041 // Handle HTML strings
3042 if ( typeof selector === "string" ) {
3043 if ( selector[ 0 ] === "<" &&
3044 selector[ selector.length - 1 ] === ">" &&
3045 selector.length >= 3 ) {
3046
3047 // Assume that strings that start and end with <> are HTML and skip the regex check
3048 match = [ null, selector, null ];
3049
3050 } else {
3051 match = rquickExpr.exec( selector );
3052 }
3053
3054 // Match html or make sure no context is specified for #id
3055 if ( match && ( match[ 1 ] || !context ) ) {
3056
3057 // HANDLE: $(html) -> $(array)
3058 if ( match[ 1 ] ) {
3059 context = context instanceof jQuery ? context[ 0 ] : context;
3060
3061 // Option to run scripts is true for back-compat
3062 // Intentionally let the error be thrown if parseHTML is not present
3063 jQuery.merge( this, jQuery.parseHTML(
3064 match[ 1 ],
3065 context && context.nodeType ? context.ownerDocument || context : document,
3066 true
3067 ) );
3068
3069 // HANDLE: $(html, props)
3070 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
3071 for ( match in context ) {
3072
3073 // Properties of context are called as methods if possible
3074 if ( isFunction( this[ match ] ) ) {
3075 this[ match ]( context[ match ] );
3076
3077 // ...and otherwise set as attributes
3078 } else {
3079 this.attr( match, context[ match ] );
3080 }
3081 }
3082 }
3083
3084 return this;
3085
3086 // HANDLE: $(#id)
3087 } else {
3088 elem = document.getElementById( match[ 2 ] );
3089
3090 if ( elem ) {
3091
3092 // Inject the element directly into the jQuery object
3093 this[ 0 ] = elem;
3094 this.length = 1;
3095 }
3096 return this;
3097 }
3098
3099 // HANDLE: $(expr, $(...))
3100 } else if ( !context || context.jquery ) {
3101 return ( context || root ).find( selector );
3102
3103 // HANDLE: $(expr, context)
3104 // (which is just equivalent to: $(context).find(expr)
3105 } else {
3106 return this.constructor( context ).find( selector );
3107 }
3108
3109 // HANDLE: $(DOMElement)
3110 } else if ( selector.nodeType ) {
3111 this[ 0 ] = selector;
3112 this.length = 1;
3113 return this;
3114
3115 // HANDLE: $(function)
3116 // Shortcut for document ready
3117 } else if ( isFunction( selector ) ) {
3118 return root.ready !== undefined ?
3119 root.ready( selector ) :
3120
3121 // Execute immediately if ready is not present
3122 selector( jQuery );
3123 }
3124
3125 return jQuery.makeArray( selector, this );
3126 };
3127
3128// Give the init function the jQuery prototype for later instantiation
3129init.prototype = jQuery.fn;
3130
3131// Initialize central reference
3132rootjQuery = jQuery( document );
3133
3134
3135var rparentsprev = /^(?:parents|prev(?:Until|All))/,
3136
3137 // Methods guaranteed to produce a unique set when starting from a unique set
3138 guaranteedUnique = {
3139 children: true,
3140 contents: true,
3141 next: true,
3142 prev: true
3143 };
3144
3145jQuery.fn.extend( {
3146 has: function( target ) {
3147 var targets = jQuery( target, this ),
3148 l = targets.length;
3149
3150 return this.filter( function() {
3151 var i = 0;
3152 for ( ; i < l; i++ ) {
3153 if ( jQuery.contains( this, targets[ i ] ) ) {
3154 return true;
3155 }
3156 }
3157 } );
3158 },
3159
3160 closest: function( selectors, context ) {
3161 var cur,
3162 i = 0,
3163 l = this.length,
3164 matched = [],
3165 targets = typeof selectors !== "string" && jQuery( selectors );
3166
3167 // Positional selectors never match, since there's no _selection_ context
3168 if ( !rneedsContext.test( selectors ) ) {
3169 for ( ; i < l; i++ ) {
3170 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
3171
3172 // Always skip document fragments
3173 if ( cur.nodeType < 11 && ( targets ?
3174 targets.index( cur ) > -1 :
3175
3176 // Don't pass non-elements to Sizzle
3177 cur.nodeType === 1 &&
3178 jQuery.find.matchesSelector( cur, selectors ) ) ) {
3179
3180 matched.push( cur );
3181 break;
3182 }
3183 }
3184 }
3185 }
3186
3187 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
3188 },
3189
3190 // Determine the position of an element within the set
3191 index: function( elem ) {
3192
3193 // No argument, return index in parent
3194 if ( !elem ) {
3195 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
3196 }
3197
3198 // Index in selector
3199 if ( typeof elem === "string" ) {
3200 return indexOf.call( jQuery( elem ), this[ 0 ] );
3201 }
3202
3203 // Locate the position of the desired element
3204 return indexOf.call( this,
3205
3206 // If it receives a jQuery object, the first element is used
3207 elem.jquery ? elem[ 0 ] : elem
3208 );
3209 },
3210
3211 add: function( selector, context ) {
3212 return this.pushStack(
3213 jQuery.uniqueSort(
3214 jQuery.merge( this.get(), jQuery( selector, context ) )
3215 )
3216 );
3217 },
3218
3219 addBack: function( selector ) {
3220 return this.add( selector == null ?
3221 this.prevObject : this.prevObject.filter( selector )
3222 );
3223 }
3224} );
3225
3226function sibling( cur, dir ) {
3227 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
3228 return cur;
3229}
3230
3231jQuery.each( {
3232 parent: function( elem ) {
3233 var parent = elem.parentNode;
3234 return parent && parent.nodeType !== 11 ? parent : null;
3235 },
3236 parents: function( elem ) {
3237 return dir( elem, "parentNode" );
3238 },
3239 parentsUntil: function( elem, i, until ) {
3240 return dir( elem, "parentNode", until );
3241 },
3242 next: function( elem ) {
3243 return sibling( elem, "nextSibling" );
3244 },
3245 prev: function( elem ) {
3246 return sibling( elem, "previousSibling" );
3247 },
3248 nextAll: function( elem ) {
3249 return dir( elem, "nextSibling" );
3250 },
3251 prevAll: function( elem ) {
3252 return dir( elem, "previousSibling" );
3253 },
3254 nextUntil: function( elem, i, until ) {
3255 return dir( elem, "nextSibling", until );
3256 },
3257 prevUntil: function( elem, i, until ) {
3258 return dir( elem, "previousSibling", until );
3259 },
3260 siblings: function( elem ) {
3261 return siblings( ( elem.parentNode || {} ).firstChild, elem );
3262 },
3263 children: function( elem ) {
3264 return siblings( elem.firstChild );
3265 },
3266 contents: function( elem ) {
3267 if ( typeof elem.contentDocument !== "undefined" ) {
3268 return elem.contentDocument;
3269 }
3270
3271 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
3272 // Treat the template element as a regular one in browsers that
3273 // don't support it.
3274 if ( nodeName( elem, "template" ) ) {
3275 elem = elem.content || elem;
3276 }
3277
3278 return jQuery.merge( [], elem.childNodes );
3279 }
3280}, function( name, fn ) {
3281 jQuery.fn[ name ] = function( until, selector ) {
3282 var matched = jQuery.map( this, fn, until );
3283
3284 if ( name.slice( -5 ) !== "Until" ) {
3285 selector = until;
3286 }
3287
3288 if ( selector && typeof selector === "string" ) {
3289 matched = jQuery.filter( selector, matched );
3290 }
3291
3292 if ( this.length > 1 ) {
3293
3294 // Remove duplicates
3295 if ( !guaranteedUnique[ name ] ) {
3296 jQuery.uniqueSort( matched );
3297 }
3298
3299 // Reverse order for parents* and prev-derivatives
3300 if ( rparentsprev.test( name ) ) {
3301 matched.reverse();
3302 }
3303 }
3304
3305 return this.pushStack( matched );
3306 };
3307} );
3308var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
3309
3310
3311
3312// Convert String-formatted options into Object-formatted ones
3313function createOptions( options ) {
3314 var object = {};
3315 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
3316 object[ flag ] = true;
3317 } );
3318 return object;
3319}
3320
3321/*
3322 * Create a callback list using the following parameters:
3323 *
3324 * options: an optional list of space-separated options that will change how
3325 * the callback list behaves or a more traditional option object
3326 *
3327 * By default a callback list will act like an event callback list and can be
3328 * "fired" multiple times.
3329 *
3330 * Possible options:
3331 *
3332 * once: will ensure the callback list can only be fired once (like a Deferred)
3333 *
3334 * memory: will keep track of previous values and will call any callback added
3335 * after the list has been fired right away with the latest "memorized"
3336 * values (like a Deferred)
3337 *
3338 * unique: will ensure a callback can only be added once (no duplicate in the list)
3339 *
3340 * stopOnFalse: interrupt callings when a callback returns false
3341 *
3342 */
3343jQuery.Callbacks = function( options ) {
3344
3345 // Convert options from String-formatted to Object-formatted if needed
3346 // (we check in cache first)
3347 options = typeof options === "string" ?
3348 createOptions( options ) :
3349 jQuery.extend( {}, options );
3350
3351 var // Flag to know if list is currently firing
3352 firing,
3353
3354 // Last fire value for non-forgettable lists
3355 memory,
3356
3357 // Flag to know if list was already fired
3358 fired,
3359
3360 // Flag to prevent firing
3361 locked,
3362
3363 // Actual callback list
3364 list = [],
3365
3366 // Queue of execution data for repeatable lists
3367 queue = [],
3368
3369 // Index of currently firing callback (modified by add/remove as needed)
3370 firingIndex = -1,
3371
3372 // Fire callbacks
3373 fire = function() {
3374
3375 // Enforce single-firing
3376 locked = locked || options.once;
3377
3378 // Execute callbacks for all pending executions,
3379 // respecting firingIndex overrides and runtime changes
3380 fired = firing = true;
3381 for ( ; queue.length; firingIndex = -1 ) {
3382 memory = queue.shift();
3383 while ( ++firingIndex < list.length ) {
3384
3385 // Run callback and check for early termination
3386 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
3387 options.stopOnFalse ) {
3388
3389 // Jump to end and forget the data so .add doesn't re-fire
3390 firingIndex = list.length;
3391 memory = false;
3392 }
3393 }
3394 }
3395
3396 // Forget the data if we're done with it
3397 if ( !options.memory ) {
3398 memory = false;
3399 }
3400
3401 firing = false;
3402
3403 // Clean up if we're done firing for good
3404 if ( locked ) {
3405
3406 // Keep an empty list if we have data for future add calls
3407 if ( memory ) {
3408 list = [];
3409
3410 // Otherwise, this object is spent
3411 } else {
3412 list = "";
3413 }
3414 }
3415 },
3416
3417 // Actual Callbacks object
3418 self = {
3419
3420 // Add a callback or a collection of callbacks to the list
3421 add: function() {
3422 if ( list ) {
3423
3424 // If we have memory from a past run, we should fire after adding
3425 if ( memory && !firing ) {
3426 firingIndex = list.length - 1;
3427 queue.push( memory );
3428 }
3429
3430 ( function add( args ) {
3431 jQuery.each( args, function( _, arg ) {
3432 if ( isFunction( arg ) ) {
3433 if ( !options.unique || !self.has( arg ) ) {
3434 list.push( arg );
3435 }
3436 } else if ( arg && arg.length && toType( arg ) !== "string" ) {
3437
3438 // Inspect recursively
3439 add( arg );
3440 }
3441 } );
3442 } )( arguments );
3443
3444 if ( memory && !firing ) {
3445 fire();
3446 }
3447 }
3448 return this;
3449 },
3450
3451 // Remove a callback from the list
3452 remove: function() {
3453 jQuery.each( arguments, function( _, arg ) {
3454 var index;
3455 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3456 list.splice( index, 1 );
3457
3458 // Handle firing indexes
3459 if ( index <= firingIndex ) {
3460 firingIndex--;
3461 }
3462 }
3463 } );
3464 return this;
3465 },
3466
3467 // Check if a given callback is in the list.
3468 // If no argument is given, return whether or not list has callbacks attached.
3469 has: function( fn ) {
3470 return fn ?
3471 jQuery.inArray( fn, list ) > -1 :
3472 list.length > 0;
3473 },
3474
3475 // Remove all callbacks from the list
3476 empty: function() {
3477 if ( list ) {
3478 list = [];
3479 }
3480 return this;
3481 },
3482
3483 // Disable .fire and .add
3484 // Abort any current/pending executions
3485 // Clear all callbacks and values
3486 disable: function() {
3487 locked = queue = [];
3488 list = memory = "";
3489 return this;
3490 },
3491 disabled: function() {
3492 return !list;
3493 },
3494
3495 // Disable .fire
3496 // Also disable .add unless we have memory (since it would have no effect)
3497 // Abort any pending executions
3498 lock: function() {
3499 locked = queue = [];
3500 if ( !memory && !firing ) {
3501 list = memory = "";
3502 }
3503 return this;
3504 },
3505 locked: function() {
3506 return !!locked;
3507 },
3508
3509 // Call all callbacks with the given context and arguments
3510 fireWith: function( context, args ) {
3511 if ( !locked ) {
3512 args = args || [];
3513 args = [ context, args.slice ? args.slice() : args ];
3514 queue.push( args );
3515 if ( !firing ) {
3516 fire();
3517 }
3518 }
3519 return this;
3520 },
3521
3522 // Call all the callbacks with the given arguments
3523 fire: function() {
3524 self.fireWith( this, arguments );
3525 return this;
3526 },
3527
3528 // To know if the callbacks have already been called at least once
3529 fired: function() {
3530 return !!fired;
3531 }
3532 };
3533
3534 return self;
3535};
3536
3537
3538function Identity( v ) {
3539 return v;
3540}
3541function Thrower( ex ) {
3542 throw ex;
3543}
3544
3545function adoptValue( value, resolve, reject, noValue ) {
3546 var method;
3547
3548 try {
3549
3550 // Check for promise aspect first to privilege synchronous behavior
3551 if ( value && isFunction( ( method = value.promise ) ) ) {
3552 method.call( value ).done( resolve ).fail( reject );
3553
3554 // Other thenables
3555 } else if ( value && isFunction( ( method = value.then ) ) ) {
3556 method.call( value, resolve, reject );
3557
3558 // Other non-thenables
3559 } else {
3560
3561 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
3562 // * false: [ value ].slice( 0 ) => resolve( value )
3563 // * true: [ value ].slice( 1 ) => resolve()
3564 resolve.apply( undefined, [ value ].slice( noValue ) );
3565 }
3566
3567 // For Promises/A+, convert exceptions into rejections
3568 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
3569 // Deferred#then to conditionally suppress rejection.
3570 } catch ( value ) {
3571
3572 // Support: Android 4.0 only
3573 // Strict mode functions invoked without .call/.apply get global-object context
3574 reject.apply( undefined, [ value ] );
3575 }
3576}
3577
3578jQuery.extend( {
3579
3580 Deferred: function( func ) {
3581 var tuples = [
3582
3583 // action, add listener, callbacks,
3584 // ... .then handlers, argument index, [final state]
3585 [ "notify", "progress", jQuery.Callbacks( "memory" ),
3586 jQuery.Callbacks( "memory" ), 2 ],
3587 [ "resolve", "done", jQuery.Callbacks( "once memory" ),
3588 jQuery.Callbacks( "once memory" ), 0, "resolved" ],
3589 [ "reject", "fail", jQuery.Callbacks( "once memory" ),
3590 jQuery.Callbacks( "once memory" ), 1, "rejected" ]
3591 ],
3592 state = "pending",
3593 promise = {
3594 state: function() {
3595 return state;
3596 },
3597 always: function() {
3598 deferred.done( arguments ).fail( arguments );
3599 return this;
3600 },
3601 "catch": function( fn ) {
3602 return promise.then( null, fn );
3603 },
3604
3605 // Keep pipe for back-compat
3606 pipe: function( /* fnDone, fnFail, fnProgress */ ) {
3607 var fns = arguments;
3608
3609 return jQuery.Deferred( function( newDefer ) {
3610 jQuery.each( tuples, function( i, tuple ) {
3611
3612 // Map tuples (progress, done, fail) to arguments (done, fail, progress)
3613 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
3614
3615 // deferred.progress(function() { bind to newDefer or newDefer.notify })
3616 // deferred.done(function() { bind to newDefer or newDefer.resolve })
3617 // deferred.fail(function() { bind to newDefer or newDefer.reject })
3618 deferred[ tuple[ 1 ] ]( function() {
3619 var returned = fn && fn.apply( this, arguments );
3620 if ( returned && isFunction( returned.promise ) ) {
3621 returned.promise()
3622 .progress( newDefer.notify )
3623 .done( newDefer.resolve )
3624 .fail( newDefer.reject );
3625 } else {
3626 newDefer[ tuple[ 0 ] + "With" ](
3627 this,
3628 fn ? [ returned ] : arguments
3629 );
3630 }
3631 } );
3632 } );
3633 fns = null;
3634 } ).promise();
3635 },
3636 then: function( onFulfilled, onRejected, onProgress ) {
3637 var maxDepth = 0;
3638 function resolve( depth, deferred, handler, special ) {
3639 return function() {
3640 var that = this,
3641 args = arguments,
3642 mightThrow = function() {
3643 var returned, then;
3644
3645 // Support: Promises/A+ section 2.3.3.3.3
3646 // https://promisesaplus.com/#point-59
3647 // Ignore double-resolution attempts
3648 if ( depth < maxDepth ) {
3649 return;
3650 }
3651
3652 returned = handler.apply( that, args );
3653
3654 // Support: Promises/A+ section 2.3.1
3655 // https://promisesaplus.com/#point-48
3656 if ( returned === deferred.promise() ) {
3657 throw new TypeError( "Thenable self-resolution" );
3658 }
3659
3660 // Support: Promises/A+ sections 2.3.3.1, 3.5
3661 // https://promisesaplus.com/#point-54
3662 // https://promisesaplus.com/#point-75
3663 // Retrieve `then` only once
3664 then = returned &&
3665
3666 // Support: Promises/A+ section 2.3.4
3667 // https://promisesaplus.com/#point-64
3668 // Only check objects and functions for thenability
3669 ( typeof returned === "object" ||
3670 typeof returned === "function" ) &&
3671 returned.then;
3672
3673 // Handle a returned thenable
3674 if ( isFunction( then ) ) {
3675
3676 // Special processors (notify) just wait for resolution
3677 if ( special ) {
3678 then.call(
3679 returned,
3680 resolve( maxDepth, deferred, Identity, special ),
3681 resolve( maxDepth, deferred, Thrower, special )
3682 );
3683
3684 // Normal processors (resolve) also hook into progress
3685 } else {
3686
3687 // ...and disregard older resolution values
3688 maxDepth++;
3689
3690 then.call(
3691 returned,
3692 resolve( maxDepth, deferred, Identity, special ),
3693 resolve( maxDepth, deferred, Thrower, special ),
3694 resolve( maxDepth, deferred, Identity,
3695 deferred.notifyWith )
3696 );
3697 }
3698
3699 // Handle all other returned values
3700 } else {
3701
3702 // Only substitute handlers pass on context
3703 // and multiple values (non-spec behavior)
3704 if ( handler !== Identity ) {
3705 that = undefined;
3706 args = [ returned ];
3707 }
3708
3709 // Process the value(s)
3710 // Default process is resolve
3711 ( special || deferred.resolveWith )( that, args );
3712 }
3713 },
3714
3715 // Only normal processors (resolve) catch and reject exceptions
3716 process = special ?
3717 mightThrow :
3718 function() {
3719 try {
3720 mightThrow();
3721 } catch ( e ) {
3722
3723 if ( jQuery.Deferred.exceptionHook ) {
3724 jQuery.Deferred.exceptionHook( e,
3725 process.stackTrace );
3726 }
3727
3728 // Support: Promises/A+ section 2.3.3.3.4.1
3729 // https://promisesaplus.com/#point-61
3730 // Ignore post-resolution exceptions
3731 if ( depth + 1 >= maxDepth ) {
3732
3733 // Only substitute handlers pass on context
3734 // and multiple values (non-spec behavior)
3735 if ( handler !== Thrower ) {
3736 that = undefined;
3737 args = [ e ];
3738 }
3739
3740 deferred.rejectWith( that, args );
3741 }
3742 }
3743 };
3744
3745 // Support: Promises/A+ section 2.3.3.3.1
3746 // https://promisesaplus.com/#point-57
3747 // Re-resolve promises immediately to dodge false rejection from
3748 // subsequent errors
3749 if ( depth ) {
3750 process();
3751 } else {
3752
3753 // Call an optional hook to record the stack, in case of exception
3754 // since it's otherwise lost when execution goes async
3755 if ( jQuery.Deferred.getStackHook ) {
3756 process.stackTrace = jQuery.Deferred.getStackHook();
3757 }
3758 window.setTimeout( process );
3759 }
3760 };
3761 }
3762
3763 return jQuery.Deferred( function( newDefer ) {
3764
3765 // progress_handlers.add( ... )
3766 tuples[ 0 ][ 3 ].add(
3767 resolve(
3768 0,
3769 newDefer,
3770 isFunction( onProgress ) ?
3771 onProgress :
3772 Identity,
3773 newDefer.notifyWith
3774 )
3775 );
3776
3777 // fulfilled_handlers.add( ... )
3778 tuples[ 1 ][ 3 ].add(
3779 resolve(
3780 0,
3781 newDefer,
3782 isFunction( onFulfilled ) ?
3783 onFulfilled :
3784 Identity
3785 )
3786 );
3787
3788 // rejected_handlers.add( ... )
3789 tuples[ 2 ][ 3 ].add(
3790 resolve(
3791 0,
3792 newDefer,
3793 isFunction( onRejected ) ?
3794 onRejected :
3795 Thrower
3796 )
3797 );
3798 } ).promise();
3799 },
3800
3801 // Get a promise for this deferred
3802 // If obj is provided, the promise aspect is added to the object
3803 promise: function( obj ) {
3804 return obj != null ? jQuery.extend( obj, promise ) : promise;
3805 }
3806 },
3807 deferred = {};
3808
3809 // Add list-specific methods
3810 jQuery.each( tuples, function( i, tuple ) {
3811 var list = tuple[ 2 ],
3812 stateString = tuple[ 5 ];
3813
3814 // promise.progress = list.add
3815 // promise.done = list.add
3816 // promise.fail = list.add
3817 promise[ tuple[ 1 ] ] = list.add;
3818
3819 // Handle state
3820 if ( stateString ) {
3821 list.add(
3822 function() {
3823
3824 // state = "resolved" (i.e., fulfilled)
3825 // state = "rejected"
3826 state = stateString;
3827 },
3828
3829 // rejected_callbacks.disable
3830 // fulfilled_callbacks.disable
3831 tuples[ 3 - i ][ 2 ].disable,
3832
3833 // rejected_handlers.disable
3834 // fulfilled_handlers.disable
3835 tuples[ 3 - i ][ 3 ].disable,
3836
3837 // progress_callbacks.lock
3838 tuples[ 0 ][ 2 ].lock,
3839
3840 // progress_handlers.lock
3841 tuples[ 0 ][ 3 ].lock
3842 );
3843 }
3844
3845 // progress_handlers.fire
3846 // fulfilled_handlers.fire
3847 // rejected_handlers.fire
3848 list.add( tuple[ 3 ].fire );
3849
3850 // deferred.notify = function() { deferred.notifyWith(...) }
3851 // deferred.resolve = function() { deferred.resolveWith(...) }
3852 // deferred.reject = function() { deferred.rejectWith(...) }
3853 deferred[ tuple[ 0 ] ] = function() {
3854 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
3855 return this;
3856 };
3857
3858 // deferred.notifyWith = list.fireWith
3859 // deferred.resolveWith = list.fireWith
3860 // deferred.rejectWith = list.fireWith
3861 deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
3862 } );
3863
3864 // Make the deferred a promise
3865 promise.promise( deferred );
3866
3867 // Call given func if any
3868 if ( func ) {
3869 func.call( deferred, deferred );
3870 }
3871
3872 // All done!
3873 return deferred;
3874 },
3875
3876 // Deferred helper
3877 when: function( singleValue ) {
3878 var
3879
3880 // count of uncompleted subordinates
3881 remaining = arguments.length,
3882
3883 // count of unprocessed arguments
3884 i = remaining,
3885
3886 // subordinate fulfillment data
3887 resolveContexts = Array( i ),
3888 resolveValues = slice.call( arguments ),
3889
3890 // the master Deferred
3891 master = jQuery.Deferred(),
3892
3893 // subordinate callback factory
3894 updateFunc = function( i ) {
3895 return function( value ) {
3896 resolveContexts[ i ] = this;
3897 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3898 if ( !( --remaining ) ) {
3899 master.resolveWith( resolveContexts, resolveValues );
3900 }
3901 };
3902 };
3903
3904 // Single- and empty arguments are adopted like Promise.resolve
3905 if ( remaining <= 1 ) {
3906 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
3907 !remaining );
3908
3909 // Use .then() to unwrap secondary thenables (cf. gh-3000)
3910 if ( master.state() === "pending" ||
3911 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
3912
3913 return master.then();
3914 }
3915 }
3916
3917 // Multiple arguments are aggregated like Promise.all array elements
3918 while ( i-- ) {
3919 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
3920 }
3921
3922 return master.promise();
3923 }
3924} );
3925
3926
3927// These usually indicate a programmer mistake during development,
3928// warn about them ASAP rather than swallowing them by default.
3929var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
3930
3931jQuery.Deferred.exceptionHook = function( error, stack ) {
3932
3933 // Support: IE 8 - 9 only
3934 // Console exists when dev tools are open, which can happen at any time
3935 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
3936 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
3937 }
3938};
3939
3940
3941
3942
3943jQuery.readyException = function( error ) {
3944 window.setTimeout( function() {
3945 throw error;
3946 } );
3947};
3948
3949
3950
3951
3952// The deferred used on DOM ready
3953var readyList = jQuery.Deferred();
3954
3955jQuery.fn.ready = function( fn ) {
3956
3957 readyList
3958 .then( fn )
3959
3960 // Wrap jQuery.readyException in a function so that the lookup
3961 // happens at the time of error handling instead of callback
3962 // registration.
3963 .catch( function( error ) {
3964 jQuery.readyException( error );
3965 } );
3966
3967 return this;
3968};
3969
3970jQuery.extend( {
3971
3972 // Is the DOM ready to be used? Set to true once it occurs.
3973 isReady: false,
3974
3975 // A counter to track how many items to wait for before
3976 // the ready event fires. See #6781
3977 readyWait: 1,
3978
3979 // Handle when the DOM is ready
3980 ready: function( wait ) {
3981
3982 // Abort if there are pending holds or we're already ready
3983 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3984 return;
3985 }
3986
3987 // Remember that the DOM is ready
3988 jQuery.isReady = true;
3989
3990 // If a normal DOM Ready event fired, decrement, and wait if need be
3991 if ( wait !== true && --jQuery.readyWait > 0 ) {
3992 return;
3993 }
3994
3995 // If there are functions bound, to execute
3996 readyList.resolveWith( document, [ jQuery ] );
3997 }
3998} );
3999
4000jQuery.ready.then = readyList.then;
4001
4002// The ready event handler and self cleanup method
4003function completed() {
4004 document.removeEventListener( "DOMContentLoaded", completed );
4005 window.removeEventListener( "load", completed );
4006 jQuery.ready();
4007}
4008
4009// Catch cases where $(document).ready() is called
4010// after the browser event has already occurred.
4011// Support: IE <=9 - 10 only
4012// Older IE sometimes signals "interactive" too soon
4013if ( document.readyState === "complete" ||
4014 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
4015
4016 // Handle it asynchronously to allow scripts the opportunity to delay ready
4017 window.setTimeout( jQuery.ready );
4018
4019} else {
4020
4021 // Use the handy event callback
4022 document.addEventListener( "DOMContentLoaded", completed );
4023
4024 // A fallback to window.onload, that will always work
4025 window.addEventListener( "load", completed );
4026}
4027
4028
4029
4030
4031// Multifunctional method to get and set values of a collection
4032// The value/s can optionally be executed if it's a function
4033var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
4034 var i = 0,
4035 len = elems.length,
4036 bulk = key == null;
4037
4038 // Sets many values
4039 if ( toType( key ) === "object" ) {
4040 chainable = true;
4041 for ( i in key ) {
4042 access( elems, fn, i, key[ i ], true, emptyGet, raw );
4043 }
4044
4045 // Sets one value
4046 } else if ( value !== undefined ) {
4047 chainable = true;
4048
4049 if ( !isFunction( value ) ) {
4050 raw = true;
4051 }
4052
4053 if ( bulk ) {
4054
4055 // Bulk operations run against the entire set
4056 if ( raw ) {
4057 fn.call( elems, value );
4058 fn = null;
4059
4060 // ...except when executing function values
4061 } else {
4062 bulk = fn;
4063 fn = function( elem, key, value ) {
4064 return bulk.call( jQuery( elem ), value );
4065 };
4066 }
4067 }
4068
4069 if ( fn ) {
4070 for ( ; i < len; i++ ) {
4071 fn(
4072 elems[ i ], key, raw ?
4073 value :
4074 value.call( elems[ i ], i, fn( elems[ i ], key ) )
4075 );
4076 }
4077 }
4078 }
4079
4080 if ( chainable ) {
4081 return elems;
4082 }
4083
4084 // Gets
4085 if ( bulk ) {
4086 return fn.call( elems );
4087 }
4088
4089 return len ? fn( elems[ 0 ], key ) : emptyGet;
4090};
4091
4092
4093// Matches dashed string for camelizing
4094var rmsPrefix = /^-ms-/,
4095 rdashAlpha = /-([a-z])/g;
4096
4097// Used by camelCase as callback to replace()
4098function fcamelCase( all, letter ) {
4099 return letter.toUpperCase();
4100}
4101
4102// Convert dashed to camelCase; used by the css and data modules
4103// Support: IE <=9 - 11, Edge 12 - 15
4104// Microsoft forgot to hump their vendor prefix (#9572)
4105function camelCase( string ) {
4106 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
4107}
4108var acceptData = function( owner ) {
4109
4110 // Accepts only:
4111 // - Node
4112 // - Node.ELEMENT_NODE
4113 // - Node.DOCUMENT_NODE
4114 // - Object
4115 // - Any
4116 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
4117};
4118
4119
4120
4121
4122function Data() {
4123 this.expando = jQuery.expando + Data.uid++;
4124}
4125
4126Data.uid = 1;
4127
4128Data.prototype = {
4129
4130 cache: function( owner ) {
4131
4132 // Check if the owner object already has a cache
4133 var value = owner[ this.expando ];
4134
4135 // If not, create one
4136 if ( !value ) {
4137 value = {};
4138
4139 // We can accept data for non-element nodes in modern browsers,
4140 // but we should not, see #8335.
4141 // Always return an empty object.
4142 if ( acceptData( owner ) ) {
4143
4144 // If it is a node unlikely to be stringify-ed or looped over
4145 // use plain assignment
4146 if ( owner.nodeType ) {
4147 owner[ this.expando ] = value;
4148
4149 // Otherwise secure it in a non-enumerable property
4150 // configurable must be true to allow the property to be
4151 // deleted when data is removed
4152 } else {
4153 Object.defineProperty( owner, this.expando, {
4154 value: value,
4155 configurable: true
4156 } );
4157 }
4158 }
4159 }
4160
4161 return value;
4162 },
4163 set: function( owner, data, value ) {
4164 var prop,
4165 cache = this.cache( owner );
4166
4167 // Handle: [ owner, key, value ] args
4168 // Always use camelCase key (gh-2257)
4169 if ( typeof data === "string" ) {
4170 cache[ camelCase( data ) ] = value;
4171
4172 // Handle: [ owner, { properties } ] args
4173 } else {
4174
4175 // Copy the properties one-by-one to the cache object
4176 for ( prop in data ) {
4177 cache[ camelCase( prop ) ] = data[ prop ];
4178 }
4179 }
4180 return cache;
4181 },
4182 get: function( owner, key ) {
4183 return key === undefined ?
4184 this.cache( owner ) :
4185
4186 // Always use camelCase key (gh-2257)
4187 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
4188 },
4189 access: function( owner, key, value ) {
4190
4191 // In cases where either:
4192 //
4193 // 1. No key was specified
4194 // 2. A string key was specified, but no value provided
4195 //
4196 // Take the "read" path and allow the get method to determine
4197 // which value to return, respectively either:
4198 //
4199 // 1. The entire cache object
4200 // 2. The data stored at the key
4201 //
4202 if ( key === undefined ||
4203 ( ( key && typeof key === "string" ) && value === undefined ) ) {
4204
4205 return this.get( owner, key );
4206 }
4207
4208 // When the key is not a string, or both a key and value
4209 // are specified, set or extend (existing objects) with either:
4210 //
4211 // 1. An object of properties
4212 // 2. A key and value
4213 //
4214 this.set( owner, key, value );
4215
4216 // Since the "set" path can have two possible entry points
4217 // return the expected data based on which path was taken[*]
4218 return value !== undefined ? value : key;
4219 },
4220 remove: function( owner, key ) {
4221 var i,
4222 cache = owner[ this.expando ];
4223
4224 if ( cache === undefined ) {
4225 return;
4226 }
4227
4228 if ( key !== undefined ) {
4229
4230 // Support array or space separated string of keys
4231 if ( Array.isArray( key ) ) {
4232
4233 // If key is an array of keys...
4234 // We always set camelCase keys, so remove that.
4235 key = key.map( camelCase );
4236 } else {
4237 key = camelCase( key );
4238
4239 // If a key with the spaces exists, use it.
4240 // Otherwise, create an array by matching non-whitespace
4241 key = key in cache ?
4242 [ key ] :
4243 ( key.match( rnothtmlwhite ) || [] );
4244 }
4245
4246 i = key.length;
4247
4248 while ( i-- ) {
4249 delete cache[ key[ i ] ];
4250 }
4251 }
4252
4253 // Remove the expando if there's no more data
4254 if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
4255
4256 // Support: Chrome <=35 - 45
4257 // Webkit & Blink performance suffers when deleting properties
4258 // from DOM nodes, so set to undefined instead
4259 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
4260 if ( owner.nodeType ) {
4261 owner[ this.expando ] = undefined;
4262 } else {
4263 delete owner[ this.expando ];
4264 }
4265 }
4266 },
4267 hasData: function( owner ) {
4268 var cache = owner[ this.expando ];
4269 return cache !== undefined && !jQuery.isEmptyObject( cache );
4270 }
4271};
4272var dataPriv = new Data();
4273
4274var dataUser = new Data();
4275
4276
4277
4278// Implementation Summary
4279//
4280// 1. Enforce API surface and semantic compatibility with 1.9.x branch
4281// 2. Improve the module's maintainability by reducing the storage
4282// paths to a single mechanism.
4283// 3. Use the same single mechanism to support "private" and "user" data.
4284// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
4285// 5. Avoid exposing implementation details on user objects (eg. expando properties)
4286// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
4287
4288var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
4289 rmultiDash = /[A-Z]/g;
4290
4291function getData( data ) {
4292 if ( data === "true" ) {
4293 return true;
4294 }
4295
4296 if ( data === "false" ) {
4297 return false;
4298 }
4299
4300 if ( data === "null" ) {
4301 return null;
4302 }
4303
4304 // Only convert to a number if it doesn't change the string
4305 if ( data === +data + "" ) {
4306 return +data;
4307 }
4308
4309 if ( rbrace.test( data ) ) {
4310 return JSON.parse( data );
4311 }
4312
4313 return data;
4314}
4315
4316function dataAttr( elem, key, data ) {
4317 var name;
4318
4319 // If nothing was found internally, try to fetch any
4320 // data from the HTML5 data-* attribute
4321 if ( data === undefined && elem.nodeType === 1 ) {
4322 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
4323 data = elem.getAttribute( name );
4324
4325 if ( typeof data === "string" ) {
4326 try {
4327 data = getData( data );
4328 } catch ( e ) {}
4329
4330 // Make sure we set the data so it isn't changed later
4331 dataUser.set( elem, key, data );
4332 } else {
4333 data = undefined;
4334 }
4335 }
4336 return data;
4337}
4338
4339jQuery.extend( {
4340 hasData: function( elem ) {
4341 return dataUser.hasData( elem ) || dataPriv.hasData( elem );
4342 },
4343
4344 data: function( elem, name, data ) {
4345 return dataUser.access( elem, name, data );
4346 },
4347
4348 removeData: function( elem, name ) {
4349 dataUser.remove( elem, name );
4350 },
4351
4352 // TODO: Now that all calls to _data and _removeData have been replaced
4353 // with direct calls to dataPriv methods, these can be deprecated.
4354 _data: function( elem, name, data ) {
4355 return dataPriv.access( elem, name, data );
4356 },
4357
4358 _removeData: function( elem, name ) {
4359 dataPriv.remove( elem, name );
4360 }
4361} );
4362
4363jQuery.fn.extend( {
4364 data: function( key, value ) {
4365 var i, name, data,
4366 elem = this[ 0 ],
4367 attrs = elem && elem.attributes;
4368
4369 // Gets all values
4370 if ( key === undefined ) {
4371 if ( this.length ) {
4372 data = dataUser.get( elem );
4373
4374 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
4375 i = attrs.length;
4376 while ( i-- ) {
4377
4378 // Support: IE 11 only
4379 // The attrs elements can be null (#14894)
4380 if ( attrs[ i ] ) {
4381 name = attrs[ i ].name;
4382 if ( name.indexOf( "data-" ) === 0 ) {
4383 name = camelCase( name.slice( 5 ) );
4384 dataAttr( elem, name, data[ name ] );
4385 }
4386 }
4387 }
4388 dataPriv.set( elem, "hasDataAttrs", true );
4389 }
4390 }
4391
4392 return data;
4393 }
4394
4395 // Sets multiple values
4396 if ( typeof key === "object" ) {
4397 return this.each( function() {
4398 dataUser.set( this, key );
4399 } );
4400 }
4401
4402 return access( this, function( value ) {
4403 var data;
4404
4405 // The calling jQuery object (element matches) is not empty
4406 // (and therefore has an element appears at this[ 0 ]) and the
4407 // `value` parameter was not undefined. An empty jQuery object
4408 // will result in `undefined` for elem = this[ 0 ] which will
4409 // throw an exception if an attempt to read a data cache is made.
4410 if ( elem && value === undefined ) {
4411
4412 // Attempt to get data from the cache
4413 // The key will always be camelCased in Data
4414 data = dataUser.get( elem, key );
4415 if ( data !== undefined ) {
4416 return data;
4417 }
4418
4419 // Attempt to "discover" the data in
4420 // HTML5 custom data-* attrs
4421 data = dataAttr( elem, key );
4422 if ( data !== undefined ) {
4423 return data;
4424 }
4425
4426 // We tried really hard, but the data doesn't exist.
4427 return;
4428 }
4429
4430 // Set the data...
4431 this.each( function() {
4432
4433 // We always store the camelCased key
4434 dataUser.set( this, key, value );
4435 } );
4436 }, null, value, arguments.length > 1, null, true );
4437 },
4438
4439 removeData: function( key ) {
4440 return this.each( function() {
4441 dataUser.remove( this, key );
4442 } );
4443 }
4444} );
4445
4446
4447jQuery.extend( {
4448 queue: function( elem, type, data ) {
4449 var queue;
4450
4451 if ( elem ) {
4452 type = ( type || "fx" ) + "queue";
4453 queue = dataPriv.get( elem, type );
4454
4455 // Speed up dequeue by getting out quickly if this is just a lookup
4456 if ( data ) {
4457 if ( !queue || Array.isArray( data ) ) {
4458 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
4459 } else {
4460 queue.push( data );
4461 }
4462 }
4463 return queue || [];
4464 }
4465 },
4466
4467 dequeue: function( elem, type ) {
4468 type = type || "fx";
4469
4470 var queue = jQuery.queue( elem, type ),
4471 startLength = queue.length,
4472 fn = queue.shift(),
4473 hooks = jQuery._queueHooks( elem, type ),
4474 next = function() {
4475 jQuery.dequeue( elem, type );
4476 };
4477
4478 // If the fx queue is dequeued, always remove the progress sentinel
4479 if ( fn === "inprogress" ) {
4480 fn = queue.shift();
4481 startLength--;
4482 }
4483
4484 if ( fn ) {
4485
4486 // Add a progress sentinel to prevent the fx queue from being
4487 // automatically dequeued
4488 if ( type === "fx" ) {
4489 queue.unshift( "inprogress" );
4490 }
4491
4492 // Clear up the last queue stop function
4493 delete hooks.stop;
4494 fn.call( elem, next, hooks );
4495 }
4496
4497 if ( !startLength && hooks ) {
4498 hooks.empty.fire();
4499 }
4500 },
4501
4502 // Not public - generate a queueHooks object, or return the current one
4503 _queueHooks: function( elem, type ) {
4504 var key = type + "queueHooks";
4505 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
4506 empty: jQuery.Callbacks( "once memory" ).add( function() {
4507 dataPriv.remove( elem, [ type + "queue", key ] );
4508 } )
4509 } );
4510 }
4511} );
4512
4513jQuery.fn.extend( {
4514 queue: function( type, data ) {
4515 var setter = 2;
4516
4517 if ( typeof type !== "string" ) {
4518 data = type;
4519 type = "fx";
4520 setter--;
4521 }
4522
4523 if ( arguments.length < setter ) {
4524 return jQuery.queue( this[ 0 ], type );
4525 }
4526
4527 return data === undefined ?
4528 this :
4529 this.each( function() {
4530 var queue = jQuery.queue( this, type, data );
4531
4532 // Ensure a hooks for this queue
4533 jQuery._queueHooks( this, type );
4534
4535 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
4536 jQuery.dequeue( this, type );
4537 }
4538 } );
4539 },
4540 dequeue: function( type ) {
4541 return this.each( function() {
4542 jQuery.dequeue( this, type );
4543 } );
4544 },
4545 clearQueue: function( type ) {
4546 return this.queue( type || "fx", [] );
4547 },
4548
4549 // Get a promise resolved when queues of a certain type
4550 // are emptied (fx is the type by default)
4551 promise: function( type, obj ) {
4552 var tmp,
4553 count = 1,
4554 defer = jQuery.Deferred(),
4555 elements = this,
4556 i = this.length,
4557 resolve = function() {
4558 if ( !( --count ) ) {
4559 defer.resolveWith( elements, [ elements ] );
4560 }
4561 };
4562
4563 if ( typeof type !== "string" ) {
4564 obj = type;
4565 type = undefined;
4566 }
4567 type = type || "fx";
4568
4569 while ( i-- ) {
4570 tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
4571 if ( tmp && tmp.empty ) {
4572 count++;
4573 tmp.empty.add( resolve );
4574 }
4575 }
4576 resolve();
4577 return defer.promise( obj );
4578 }
4579} );
4580var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
4581
4582var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
4583
4584
4585var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4586
4587var documentElement = document.documentElement;
4588
4589
4590
4591 var isAttached = function( elem ) {
4592 return jQuery.contains( elem.ownerDocument, elem );
4593 },
4594 composed = { composed: true };
4595
4596 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
4597 // Check attachment across shadow DOM boundaries when possible (gh-3504)
4598 // Support: iOS 10.0-10.2 only
4599 // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
4600 // leading to errors. We need to check for `getRootNode`.
4601 if ( documentElement.getRootNode ) {
4602 isAttached = function( elem ) {
4603 return jQuery.contains( elem.ownerDocument, elem ) ||
4604 elem.getRootNode( composed ) === elem.ownerDocument;
4605 };
4606 }
4607var isHiddenWithinTree = function( elem, el ) {
4608
4609 // isHiddenWithinTree might be called from jQuery#filter function;
4610 // in that case, element will be second argument
4611 elem = el || elem;
4612
4613 // Inline style trumps all
4614 return elem.style.display === "none" ||
4615 elem.style.display === "" &&
4616
4617 // Otherwise, check computed style
4618 // Support: Firefox <=43 - 45
4619 // Disconnected elements can have computed display: none, so first confirm that elem is
4620 // in the document.
4621 isAttached( elem ) &&
4622
4623 jQuery.css( elem, "display" ) === "none";
4624 };
4625
4626var swap = function( elem, options, callback, args ) {
4627 var ret, name,
4628 old = {};
4629
4630 // Remember the old values, and insert the new ones
4631 for ( name in options ) {
4632 old[ name ] = elem.style[ name ];
4633 elem.style[ name ] = options[ name ];
4634 }
4635
4636 ret = callback.apply( elem, args || [] );
4637
4638 // Revert the old values
4639 for ( name in options ) {
4640 elem.style[ name ] = old[ name ];
4641 }
4642
4643 return ret;
4644};
4645
4646
4647
4648
4649function adjustCSS( elem, prop, valueParts, tween ) {
4650 var adjusted, scale,
4651 maxIterations = 20,
4652 currentValue = tween ?
4653 function() {
4654 return tween.cur();
4655 } :
4656 function() {
4657 return jQuery.css( elem, prop, "" );
4658 },
4659 initial = currentValue(),
4660 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4661
4662 // Starting value computation is required for potential unit mismatches
4663 initialInUnit = elem.nodeType &&
4664 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4665 rcssNum.exec( jQuery.css( elem, prop ) );
4666
4667 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4668
4669 // Support: Firefox <=54
4670 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
4671 initial = initial / 2;
4672
4673 // Trust units reported by jQuery.css
4674 unit = unit || initialInUnit[ 3 ];
4675
4676 // Iteratively approximate from a nonzero starting point
4677 initialInUnit = +initial || 1;
4678
4679 while ( maxIterations-- ) {
4680
4681 // Evaluate and update our best guess (doubling guesses that zero out).
4682 // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
4683 jQuery.style( elem, prop, initialInUnit + unit );
4684 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
4685 maxIterations = 0;
4686 }
4687 initialInUnit = initialInUnit / scale;
4688
4689 }
4690
4691 initialInUnit = initialInUnit * 2;
4692 jQuery.style( elem, prop, initialInUnit + unit );
4693
4694 // Make sure we update the tween properties later on
4695 valueParts = valueParts || [];
4696 }
4697
4698 if ( valueParts ) {
4699 initialInUnit = +initialInUnit || +initial || 0;
4700
4701 // Apply relative offset (+=/-=) if specified
4702 adjusted = valueParts[ 1 ] ?
4703 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
4704 +valueParts[ 2 ];
4705 if ( tween ) {
4706 tween.unit = unit;
4707 tween.start = initialInUnit;
4708 tween.end = adjusted;
4709 }
4710 }
4711 return adjusted;
4712}
4713
4714
4715var defaultDisplayMap = {};
4716
4717function getDefaultDisplay( elem ) {
4718 var temp,
4719 doc = elem.ownerDocument,
4720 nodeName = elem.nodeName,
4721 display = defaultDisplayMap[ nodeName ];
4722
4723 if ( display ) {
4724 return display;
4725 }
4726
4727 temp = doc.body.appendChild( doc.createElement( nodeName ) );
4728 display = jQuery.css( temp, "display" );
4729
4730 temp.parentNode.removeChild( temp );
4731
4732 if ( display === "none" ) {
4733 display = "block";
4734 }
4735 defaultDisplayMap[ nodeName ] = display;
4736
4737 return display;
4738}
4739
4740function showHide( elements, show ) {
4741 var display, elem,
4742 values = [],
4743 index = 0,
4744 length = elements.length;
4745
4746 // Determine new display value for elements that need to change
4747 for ( ; index < length; index++ ) {
4748 elem = elements[ index ];
4749 if ( !elem.style ) {
4750 continue;
4751 }
4752
4753 display = elem.style.display;
4754 if ( show ) {
4755
4756 // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
4757 // check is required in this first loop unless we have a nonempty display value (either
4758 // inline or about-to-be-restored)
4759 if ( display === "none" ) {
4760 values[ index ] = dataPriv.get( elem, "display" ) || null;
4761 if ( !values[ index ] ) {
4762 elem.style.display = "";
4763 }
4764 }
4765 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
4766 values[ index ] = getDefaultDisplay( elem );
4767 }
4768 } else {
4769 if ( display !== "none" ) {
4770 values[ index ] = "none";
4771
4772 // Remember what we're overwriting
4773 dataPriv.set( elem, "display", display );
4774 }
4775 }
4776 }
4777
4778 // Set the display of the elements in a second loop to avoid constant reflow
4779 for ( index = 0; index < length; index++ ) {
4780 if ( values[ index ] != null ) {
4781 elements[ index ].style.display = values[ index ];
4782 }
4783 }
4784
4785 return elements;
4786}
4787
4788jQuery.fn.extend( {
4789 show: function() {
4790 return showHide( this, true );
4791 },
4792 hide: function() {
4793 return showHide( this );
4794 },
4795 toggle: function( state ) {
4796 if ( typeof state === "boolean" ) {
4797 return state ? this.show() : this.hide();
4798 }
4799
4800 return this.each( function() {
4801 if ( isHiddenWithinTree( this ) ) {
4802 jQuery( this ).show();
4803 } else {
4804 jQuery( this ).hide();
4805 }
4806 } );
4807 }
4808} );
4809var rcheckableType = ( /^(?:checkbox|radio)$/i );
4810
4811var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
4812
4813var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4814
4815
4816
4817// We have to close these tags to support XHTML (#13200)
4818var wrapMap = {
4819
4820 // Support: IE <=9 only
4821 option: [ 1, "<select multiple='multiple'>", "</select>" ],
4822
4823 // XHTML parsers do not magically insert elements in the
4824 // same way that tag soup parsers do. So we cannot shorten
4825 // this by omitting <tbody> or other required elements.
4826 thead: [ 1, "<table>", "</table>" ],
4827 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
4828 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4829 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4830
4831 _default: [ 0, "", "" ]
4832};
4833
4834// Support: IE <=9 only
4835wrapMap.optgroup = wrapMap.option;
4836
4837wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4838wrapMap.th = wrapMap.td;
4839
4840
4841function getAll( context, tag ) {
4842
4843 // Support: IE <=9 - 11 only
4844 // Use typeof to avoid zero-argument method invocation on host objects (#15151)
4845 var ret;
4846
4847 if ( typeof context.getElementsByTagName !== "undefined" ) {
4848 ret = context.getElementsByTagName( tag || "*" );
4849
4850 } else if ( typeof context.querySelectorAll !== "undefined" ) {
4851 ret = context.querySelectorAll( tag || "*" );
4852
4853 } else {
4854 ret = [];
4855 }
4856
4857 if ( tag === undefined || tag && nodeName( context, tag ) ) {
4858 return jQuery.merge( [ context ], ret );
4859 }
4860
4861 return ret;
4862}
4863
4864
4865// Mark scripts as having already been evaluated
4866function setGlobalEval( elems, refElements ) {
4867 var i = 0,
4868 l = elems.length;
4869
4870 for ( ; i < l; i++ ) {
4871 dataPriv.set(
4872 elems[ i ],
4873 "globalEval",
4874 !refElements || dataPriv.get( refElements[ i ], "globalEval" )
4875 );
4876 }
4877}
4878
4879
4880var rhtml = /<|&#?\w+;/;
4881
4882function buildFragment( elems, context, scripts, selection, ignored ) {
4883 var elem, tmp, tag, wrap, attached, j,
4884 fragment = context.createDocumentFragment(),
4885 nodes = [],
4886 i = 0,
4887 l = elems.length;
4888
4889 for ( ; i < l; i++ ) {
4890 elem = elems[ i ];
4891
4892 if ( elem || elem === 0 ) {
4893
4894 // Add nodes directly
4895 if ( toType( elem ) === "object" ) {
4896
4897 // Support: Android <=4.0 only, PhantomJS 1 only
4898 // push.apply(_, arraylike) throws on ancient WebKit
4899 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
4900
4901 // Convert non-html into a text node
4902 } else if ( !rhtml.test( elem ) ) {
4903 nodes.push( context.createTextNode( elem ) );
4904
4905 // Convert html into DOM nodes
4906 } else {
4907 tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
4908
4909 // Deserialize a standard representation
4910 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
4911 wrap = wrapMap[ tag ] || wrapMap._default;
4912 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
4913
4914 // Descend through wrappers to the right content
4915 j = wrap[ 0 ];
4916 while ( j-- ) {
4917 tmp = tmp.lastChild;
4918 }
4919
4920 // Support: Android <=4.0 only, PhantomJS 1 only
4921 // push.apply(_, arraylike) throws on ancient WebKit
4922 jQuery.merge( nodes, tmp.childNodes );
4923
4924 // Remember the top-level container
4925 tmp = fragment.firstChild;
4926
4927 // Ensure the created nodes are orphaned (#12392)
4928 tmp.textContent = "";
4929 }
4930 }
4931 }
4932
4933 // Remove wrapper from fragment
4934 fragment.textContent = "";
4935
4936 i = 0;
4937 while ( ( elem = nodes[ i++ ] ) ) {
4938
4939 // Skip elements already in the context collection (trac-4087)
4940 if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
4941 if ( ignored ) {
4942 ignored.push( elem );
4943 }
4944 continue;
4945 }
4946
4947 attached = isAttached( elem );
4948
4949 // Append to fragment
4950 tmp = getAll( fragment.appendChild( elem ), "script" );
4951
4952 // Preserve script evaluation history
4953 if ( attached ) {
4954 setGlobalEval( tmp );
4955 }
4956
4957 // Capture executables
4958 if ( scripts ) {
4959 j = 0;
4960 while ( ( elem = tmp[ j++ ] ) ) {
4961 if ( rscriptType.test( elem.type || "" ) ) {
4962 scripts.push( elem );
4963 }
4964 }
4965 }
4966 }
4967
4968 return fragment;
4969}
4970
4971
4972( function() {
4973 var fragment = document.createDocumentFragment(),
4974 div = fragment.appendChild( document.createElement( "div" ) ),
4975 input = document.createElement( "input" );
4976
4977 // Support: Android 4.0 - 4.3 only
4978 // Check state lost if the name is set (#11217)
4979 // Support: Windows Web Apps (WWA)
4980 // `name` and `type` must use .setAttribute for WWA (#14901)
4981 input.setAttribute( "type", "radio" );
4982 input.setAttribute( "checked", "checked" );
4983 input.setAttribute( "name", "t" );
4984
4985 div.appendChild( input );
4986
4987 // Support: Android <=4.1 only
4988 // Older WebKit doesn't clone checked state correctly in fragments
4989 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4990
4991 // Support: IE <=11 only
4992 // Make sure textarea (and checkbox) defaultValue is properly cloned
4993 div.innerHTML = "<textarea>x</textarea>";
4994 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4995} )();
4996
4997
4998var
4999 rkeyEvent = /^key/,
5000 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
5001 rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
5002
5003function returnTrue() {
5004 return true;
5005}
5006
5007function returnFalse() {
5008 return false;
5009}
5010
5011// Support: IE <=9 - 11+
5012// focus() and blur() are asynchronous, except when they are no-op.
5013// So expect focus to be synchronous when the element is already active,
5014// and blur to be synchronous when the element is not already active.
5015// (focus and blur are always synchronous in other supported browsers,
5016// this just defines when we can count on it).
5017function expectSync( elem, type ) {
5018 return ( elem === safeActiveElement() ) === ( type === "focus" );
5019}
5020
5021// Support: IE <=9 only
5022// Accessing document.activeElement can throw unexpectedly
5023// https://bugs.jquery.com/ticket/13393
5024function safeActiveElement() {
5025 try {
5026 return document.activeElement;
5027 } catch ( err ) { }
5028}
5029
5030function on( elem, types, selector, data, fn, one ) {
5031 var origFn, type;
5032
5033 // Types can be a map of types/handlers
5034 if ( typeof types === "object" ) {
5035
5036 // ( types-Object, selector, data )
5037 if ( typeof selector !== "string" ) {
5038
5039 // ( types-Object, data )
5040 data = data || selector;
5041 selector = undefined;
5042 }
5043 for ( type in types ) {
5044 on( elem, type, selector, data, types[ type ], one );
5045 }
5046 return elem;
5047 }
5048
5049 if ( data == null && fn == null ) {
5050
5051 // ( types, fn )
5052 fn = selector;
5053 data = selector = undefined;
5054 } else if ( fn == null ) {
5055 if ( typeof selector === "string" ) {
5056
5057 // ( types, selector, fn )
5058 fn = data;
5059 data = undefined;
5060 } else {
5061
5062 // ( types, data, fn )
5063 fn = data;
5064 data = selector;
5065 selector = undefined;
5066 }
5067 }
5068 if ( fn === false ) {
5069 fn = returnFalse;
5070 } else if ( !fn ) {
5071 return elem;
5072 }
5073
5074 if ( one === 1 ) {
5075 origFn = fn;
5076 fn = function( event ) {
5077
5078 // Can use an empty set, since event contains the info
5079 jQuery().off( event );
5080 return origFn.apply( this, arguments );
5081 };
5082
5083 // Use same guid so caller can remove using origFn
5084 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
5085 }
5086 return elem.each( function() {
5087 jQuery.event.add( this, types, fn, data, selector );
5088 } );
5089}
5090
5091/*
5092 * Helper functions for managing events -- not part of the public interface.
5093 * Props to Dean Edwards' addEvent library for many of the ideas.
5094 */
5095jQuery.event = {
5096
5097 global: {},
5098
5099 add: function( elem, types, handler, data, selector ) {
5100
5101 var handleObjIn, eventHandle, tmp,
5102 events, t, handleObj,
5103 special, handlers, type, namespaces, origType,
5104 elemData = dataPriv.get( elem );
5105
5106 // Don't attach events to noData or text/comment nodes (but allow plain objects)
5107 if ( !elemData ) {
5108 return;
5109 }
5110
5111 // Caller can pass in an object of custom data in lieu of the handler
5112 if ( handler.handler ) {
5113 handleObjIn = handler;
5114 handler = handleObjIn.handler;
5115 selector = handleObjIn.selector;
5116 }
5117
5118 // Ensure that invalid selectors throw exceptions at attach time
5119 // Evaluate against documentElement in case elem is a non-element node (e.g., document)
5120 if ( selector ) {
5121 jQuery.find.matchesSelector( documentElement, selector );
5122 }
5123
5124 // Make sure that the handler has a unique ID, used to find/remove it later
5125 if ( !handler.guid ) {
5126 handler.guid = jQuery.guid++;
5127 }
5128
5129 // Init the element's event structure and main handler, if this is the first
5130 if ( !( events = elemData.events ) ) {
5131 events = elemData.events = {};
5132 }
5133 if ( !( eventHandle = elemData.handle ) ) {
5134 eventHandle = elemData.handle = function( e ) {
5135
5136 // Discard the second event of a jQuery.event.trigger() and
5137 // when an event is called after a page has unloaded
5138 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
5139 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
5140 };
5141 }
5142
5143 // Handle multiple events separated by a space
5144 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5145 t = types.length;
5146 while ( t-- ) {
5147 tmp = rtypenamespace.exec( types[ t ] ) || [];
5148 type = origType = tmp[ 1 ];
5149 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5150
5151 // There *must* be a type, no attaching namespace-only handlers
5152 if ( !type ) {
5153 continue;
5154 }
5155
5156 // If event changes its type, use the special event handlers for the changed type
5157 special = jQuery.event.special[ type ] || {};
5158
5159 // If selector defined, determine special event api type, otherwise given type
5160 type = ( selector ? special.delegateType : special.bindType ) || type;
5161
5162 // Update special based on newly reset type
5163 special = jQuery.event.special[ type ] || {};
5164
5165 // handleObj is passed to all event handlers
5166 handleObj = jQuery.extend( {
5167 type: type,
5168 origType: origType,
5169 data: data,
5170 handler: handler,
5171 guid: handler.guid,
5172 selector: selector,
5173 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
5174 namespace: namespaces.join( "." )
5175 }, handleObjIn );
5176
5177 // Init the event handler queue if we're the first
5178 if ( !( handlers = events[ type ] ) ) {
5179 handlers = events[ type ] = [];
5180 handlers.delegateCount = 0;
5181
5182 // Only use addEventListener if the special events handler returns false
5183 if ( !special.setup ||
5184 special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
5185
5186 if ( elem.addEventListener ) {
5187 elem.addEventListener( type, eventHandle );
5188 }
5189 }
5190 }
5191
5192 if ( special.add ) {
5193 special.add.call( elem, handleObj );
5194
5195 if ( !handleObj.handler.guid ) {
5196 handleObj.handler.guid = handler.guid;
5197 }
5198 }
5199
5200 // Add to the element's handler list, delegates in front
5201 if ( selector ) {
5202 handlers.splice( handlers.delegateCount++, 0, handleObj );
5203 } else {
5204 handlers.push( handleObj );
5205 }
5206
5207 // Keep track of which events have ever been used, for event optimization
5208 jQuery.event.global[ type ] = true;
5209 }
5210
5211 },
5212
5213 // Detach an event or set of events from an element
5214 remove: function( elem, types, handler, selector, mappedTypes ) {
5215
5216 var j, origCount, tmp,
5217 events, t, handleObj,
5218 special, handlers, type, namespaces, origType,
5219 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
5220
5221 if ( !elemData || !( events = elemData.events ) ) {
5222 return;
5223 }
5224
5225 // Once for each type.namespace in types; type may be omitted
5226 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5227 t = types.length;
5228 while ( t-- ) {
5229 tmp = rtypenamespace.exec( types[ t ] ) || [];
5230 type = origType = tmp[ 1 ];
5231 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5232
5233 // Unbind all events (on this namespace, if provided) for the element
5234 if ( !type ) {
5235 for ( type in events ) {
5236 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
5237 }
5238 continue;
5239 }
5240
5241 special = jQuery.event.special[ type ] || {};
5242 type = ( selector ? special.delegateType : special.bindType ) || type;
5243 handlers = events[ type ] || [];
5244 tmp = tmp[ 2 ] &&
5245 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
5246
5247 // Remove matching events
5248 origCount = j = handlers.length;
5249 while ( j-- ) {
5250 handleObj = handlers[ j ];
5251
5252 if ( ( mappedTypes || origType === handleObj.origType ) &&
5253 ( !handler || handler.guid === handleObj.guid ) &&
5254 ( !tmp || tmp.test( handleObj.namespace ) ) &&
5255 ( !selector || selector === handleObj.selector ||
5256 selector === "**" && handleObj.selector ) ) {
5257 handlers.splice( j, 1 );
5258
5259 if ( handleObj.selector ) {
5260 handlers.delegateCount--;
5261 }
5262 if ( special.remove ) {
5263 special.remove.call( elem, handleObj );
5264 }
5265 }
5266 }
5267
5268 // Remove generic event handler if we removed something and no more handlers exist
5269 // (avoids potential for endless recursion during removal of special event handlers)
5270 if ( origCount && !handlers.length ) {
5271 if ( !special.teardown ||
5272 special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
5273
5274 jQuery.removeEvent( elem, type, elemData.handle );
5275 }
5276
5277 delete events[ type ];
5278 }
5279 }
5280
5281 // Remove data and the expando if it's no longer used
5282 if ( jQuery.isEmptyObject( events ) ) {
5283 dataPriv.remove( elem, "handle events" );
5284 }
5285 },
5286
5287 dispatch: function( nativeEvent ) {
5288
5289 // Make a writable jQuery.Event from the native event object
5290 var event = jQuery.event.fix( nativeEvent );
5291
5292 var i, j, ret, matched, handleObj, handlerQueue,
5293 args = new Array( arguments.length ),
5294 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
5295 special = jQuery.event.special[ event.type ] || {};
5296
5297 // Use the fix-ed jQuery.Event rather than the (read-only) native event
5298 args[ 0 ] = event;
5299
5300 for ( i = 1; i < arguments.length; i++ ) {
5301 args[ i ] = arguments[ i ];
5302 }
5303
5304 event.delegateTarget = this;
5305
5306 // Call the preDispatch hook for the mapped type, and let it bail if desired
5307 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
5308 return;
5309 }
5310
5311 // Determine handlers
5312 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
5313
5314 // Run delegates first; they may want to stop propagation beneath us
5315 i = 0;
5316 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
5317 event.currentTarget = matched.elem;
5318
5319 j = 0;
5320 while ( ( handleObj = matched.handlers[ j++ ] ) &&
5321 !event.isImmediatePropagationStopped() ) {
5322
5323 // If the event is namespaced, then each handler is only invoked if it is
5324 // specially universal or its namespaces are a superset of the event's.
5325 if ( !event.rnamespace || handleObj.namespace === false ||
5326 event.rnamespace.test( handleObj.namespace ) ) {
5327
5328 event.handleObj = handleObj;
5329 event.data = handleObj.data;
5330
5331 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
5332 handleObj.handler ).apply( matched.elem, args );
5333
5334 if ( ret !== undefined ) {
5335 if ( ( event.result = ret ) === false ) {
5336 event.preventDefault();
5337 event.stopPropagation();
5338 }
5339 }
5340 }
5341 }
5342 }
5343
5344 // Call the postDispatch hook for the mapped type
5345 if ( special.postDispatch ) {
5346 special.postDispatch.call( this, event );
5347 }
5348
5349 return event.result;
5350 },
5351
5352 handlers: function( event, handlers ) {
5353 var i, handleObj, sel, matchedHandlers, matchedSelectors,
5354 handlerQueue = [],
5355 delegateCount = handlers.delegateCount,
5356 cur = event.target;
5357
5358 // Find delegate handlers
5359 if ( delegateCount &&
5360
5361 // Support: IE <=9
5362 // Black-hole SVG <use> instance trees (trac-13180)
5363 cur.nodeType &&
5364
5365 // Support: Firefox <=42
5366 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
5367 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
5368 // Support: IE 11 only
5369 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
5370 !( event.type === "click" && event.button >= 1 ) ) {
5371
5372 for ( ; cur !== this; cur = cur.parentNode || this ) {
5373
5374 // Don't check non-elements (#13208)
5375 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
5376 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
5377 matchedHandlers = [];
5378 matchedSelectors = {};
5379 for ( i = 0; i < delegateCount; i++ ) {
5380 handleObj = handlers[ i ];
5381
5382 // Don't conflict with Object.prototype properties (#13203)
5383 sel = handleObj.selector + " ";
5384
5385 if ( matchedSelectors[ sel ] === undefined ) {
5386 matchedSelectors[ sel ] = handleObj.needsContext ?
5387 jQuery( sel, this ).index( cur ) > -1 :
5388 jQuery.find( sel, this, null, [ cur ] ).length;
5389 }
5390 if ( matchedSelectors[ sel ] ) {
5391 matchedHandlers.push( handleObj );
5392 }
5393 }
5394 if ( matchedHandlers.length ) {
5395 handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
5396 }
5397 }
5398 }
5399 }
5400
5401 // Add the remaining (directly-bound) handlers
5402 cur = this;
5403 if ( delegateCount < handlers.length ) {
5404 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
5405 }
5406
5407 return handlerQueue;
5408 },
5409
5410 addProp: function( name, hook ) {
5411 Object.defineProperty( jQuery.Event.prototype, name, {
5412 enumerable: true,
5413 configurable: true,
5414
5415 get: isFunction( hook ) ?
5416 function() {
5417 if ( this.originalEvent ) {
5418 return hook( this.originalEvent );
5419 }
5420 } :
5421 function() {
5422 if ( this.originalEvent ) {
5423 return this.originalEvent[ name ];
5424 }
5425 },
5426
5427 set: function( value ) {
5428 Object.defineProperty( this, name, {
5429 enumerable: true,
5430 configurable: true,
5431 writable: true,
5432 value: value
5433 } );
5434 }
5435 } );
5436 },
5437
5438 fix: function( originalEvent ) {
5439 return originalEvent[ jQuery.expando ] ?
5440 originalEvent :
5441 new jQuery.Event( originalEvent );
5442 },
5443
5444 special: {
5445 load: {
5446
5447 // Prevent triggered image.load events from bubbling to window.load
5448 noBubble: true
5449 },
5450 click: {
5451
5452 // Utilize native event to ensure correct state for checkable inputs
5453 setup: function( data ) {
5454
5455 // For mutual compressibility with _default, replace `this` access with a local var.
5456 // `|| data` is dead code meant only to preserve the variable through minification.
5457 var el = this || data;
5458
5459 // Claim the first handler
5460 if ( rcheckableType.test( el.type ) &&
5461 el.click && nodeName( el, "input" ) ) {
5462
5463 // dataPriv.set( el, "click", ... )
5464 leverageNative( el, "click", returnTrue );
5465 }
5466
5467 // Return false to allow normal processing in the caller
5468 return false;
5469 },
5470 trigger: function( data ) {
5471
5472 // For mutual compressibility with _default, replace `this` access with a local var.
5473 // `|| data` is dead code meant only to preserve the variable through minification.
5474 var el = this || data;
5475
5476 // Force setup before triggering a click
5477 if ( rcheckableType.test( el.type ) &&
5478 el.click && nodeName( el, "input" ) ) {
5479
5480 leverageNative( el, "click" );
5481 }
5482
5483 // Return non-false to allow normal event-path propagation
5484 return true;
5485 },
5486
5487 // For cross-browser consistency, suppress native .click() on links
5488 // Also prevent it if we're currently inside a leveraged native-event stack
5489 _default: function( event ) {
5490 var target = event.target;
5491 return rcheckableType.test( target.type ) &&
5492 target.click && nodeName( target, "input" ) &&
5493 dataPriv.get( target, "click" ) ||
5494 nodeName( target, "a" );
5495 }
5496 },
5497
5498 beforeunload: {
5499 postDispatch: function( event ) {
5500
5501 // Support: Firefox 20+
5502 // Firefox doesn't alert if the returnValue field is not set.
5503 if ( event.result !== undefined && event.originalEvent ) {
5504 event.originalEvent.returnValue = event.result;
5505 }
5506 }
5507 }
5508 }
5509};
5510
5511// Ensure the presence of an event listener that handles manually-triggered
5512// synthetic events by interrupting progress until reinvoked in response to
5513// *native* events that it fires directly, ensuring that state changes have
5514// already occurred before other listeners are invoked.
5515function leverageNative( el, type, expectSync ) {
5516
5517 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
5518 if ( !expectSync ) {
5519 if ( dataPriv.get( el, type ) === undefined ) {
5520 jQuery.event.add( el, type, returnTrue );
5521 }
5522 return;
5523 }
5524
5525 // Register the controller as a special universal handler for all event namespaces
5526 dataPriv.set( el, type, false );
5527 jQuery.event.add( el, type, {
5528 namespace: false,
5529 handler: function( event ) {
5530 var notAsync, result,
5531 saved = dataPriv.get( this, type );
5532
5533 if ( ( event.isTrigger & 1 ) && this[ type ] ) {
5534
5535 // Interrupt processing of the outer synthetic .trigger()ed event
5536 // Saved data should be false in such cases, but might be a leftover capture object
5537 // from an async native handler (gh-4350)
5538 if ( !saved.length ) {
5539
5540 // Store arguments for use when handling the inner native event
5541 // There will always be at least one argument (an event object), so this array
5542 // will not be confused with a leftover capture object.
5543 saved = slice.call( arguments );
5544 dataPriv.set( this, type, saved );
5545
5546 // Trigger the native event and capture its result
5547 // Support: IE <=9 - 11+
5548 // focus() and blur() are asynchronous
5549 notAsync = expectSync( this, type );
5550 this[ type ]();
5551 result = dataPriv.get( this, type );
5552 if ( saved !== result || notAsync ) {
5553 dataPriv.set( this, type, false );
5554 } else {
5555 result = {};
5556 }
5557 if ( saved !== result ) {
5558
5559 // Cancel the outer synthetic event
5560 event.stopImmediatePropagation();
5561 event.preventDefault();
5562 return result.value;
5563 }
5564
5565 // If this is an inner synthetic event for an event with a bubbling surrogate
5566 // (focus or blur), assume that the surrogate already propagated from triggering the
5567 // native event and prevent that from happening again here.
5568 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
5569 // bubbling surrogate propagates *after* the non-bubbling base), but that seems
5570 // less bad than duplication.
5571 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
5572 event.stopPropagation();
5573 }
5574
5575 // If this is a native event triggered above, everything is now in order
5576 // Fire an inner synthetic event with the original arguments
5577 } else if ( saved.length ) {
5578
5579 // ...and capture the result
5580 dataPriv.set( this, type, {
5581 value: jQuery.event.trigger(
5582
5583 // Support: IE <=9 - 11+
5584 // Extend with the prototype to reset the above stopImmediatePropagation()
5585 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
5586 saved.slice( 1 ),
5587 this
5588 )
5589 } );
5590
5591 // Abort handling of the native event
5592 event.stopImmediatePropagation();
5593 }
5594 }
5595 } );
5596}
5597
5598jQuery.removeEvent = function( elem, type, handle ) {
5599
5600 // This "if" is needed for plain objects
5601 if ( elem.removeEventListener ) {
5602 elem.removeEventListener( type, handle );
5603 }
5604};
5605
5606jQuery.Event = function( src, props ) {
5607
5608 // Allow instantiation without the 'new' keyword
5609 if ( !( this instanceof jQuery.Event ) ) {
5610 return new jQuery.Event( src, props );
5611 }
5612
5613 // Event object
5614 if ( src && src.type ) {
5615 this.originalEvent = src;
5616 this.type = src.type;
5617
5618 // Events bubbling up the document may have been marked as prevented
5619 // by a handler lower down the tree; reflect the correct value.
5620 this.isDefaultPrevented = src.defaultPrevented ||
5621 src.defaultPrevented === undefined &&
5622
5623 // Support: Android <=2.3 only
5624 src.returnValue === false ?
5625 returnTrue :
5626 returnFalse;
5627
5628 // Create target properties
5629 // Support: Safari <=6 - 7 only
5630 // Target should not be a text node (#504, #13143)
5631 this.target = ( src.target && src.target.nodeType === 3 ) ?
5632 src.target.parentNode :
5633 src.target;
5634
5635 this.currentTarget = src.currentTarget;
5636 this.relatedTarget = src.relatedTarget;
5637
5638 // Event type
5639 } else {
5640 this.type = src;
5641 }
5642
5643 // Put explicitly provided properties onto the event object
5644 if ( props ) {
5645 jQuery.extend( this, props );
5646 }
5647
5648 // Create a timestamp if incoming event doesn't have one
5649 this.timeStamp = src && src.timeStamp || Date.now();
5650
5651 // Mark it as fixed
5652 this[ jQuery.expando ] = true;
5653};
5654
5655// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
5656// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
5657jQuery.Event.prototype = {
5658 constructor: jQuery.Event,
5659 isDefaultPrevented: returnFalse,
5660 isPropagationStopped: returnFalse,
5661 isImmediatePropagationStopped: returnFalse,
5662 isSimulated: false,
5663
5664 preventDefault: function() {
5665 var e = this.originalEvent;
5666
5667 this.isDefaultPrevented = returnTrue;
5668
5669 if ( e && !this.isSimulated ) {
5670 e.preventDefault();
5671 }
5672 },
5673 stopPropagation: function() {
5674 var e = this.originalEvent;
5675
5676 this.isPropagationStopped = returnTrue;
5677
5678 if ( e && !this.isSimulated ) {
5679 e.stopPropagation();
5680 }
5681 },
5682 stopImmediatePropagation: function() {
5683 var e = this.originalEvent;
5684
5685 this.isImmediatePropagationStopped = returnTrue;
5686
5687 if ( e && !this.isSimulated ) {
5688 e.stopImmediatePropagation();
5689 }
5690
5691 this.stopPropagation();
5692 }
5693};
5694
5695// Includes all common event props including KeyEvent and MouseEvent specific props
5696jQuery.each( {
5697 altKey: true,
5698 bubbles: true,
5699 cancelable: true,
5700 changedTouches: true,
5701 ctrlKey: true,
5702 detail: true,
5703 eventPhase: true,
5704 metaKey: true,
5705 pageX: true,
5706 pageY: true,
5707 shiftKey: true,
5708 view: true,
5709 "char": true,
5710 code: true,
5711 charCode: true,
5712 key: true,
5713 keyCode: true,
5714 button: true,
5715 buttons: true,
5716 clientX: true,
5717 clientY: true,
5718 offsetX: true,
5719 offsetY: true,
5720 pointerId: true,
5721 pointerType: true,
5722 screenX: true,
5723 screenY: true,
5724 targetTouches: true,
5725 toElement: true,
5726 touches: true,
5727
5728 which: function( event ) {
5729 var button = event.button;
5730
5731 // Add which for key events
5732 if ( event.which == null && rkeyEvent.test( event.type ) ) {
5733 return event.charCode != null ? event.charCode : event.keyCode;
5734 }
5735
5736 // Add which for click: 1 === left; 2 === middle; 3 === right
5737 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
5738 if ( button & 1 ) {
5739 return 1;
5740 }
5741
5742 if ( button & 2 ) {
5743 return 3;
5744 }
5745
5746 if ( button & 4 ) {
5747 return 2;
5748 }
5749
5750 return 0;
5751 }
5752
5753 return event.which;
5754 }
5755}, jQuery.event.addProp );
5756
5757jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
5758 jQuery.event.special[ type ] = {
5759
5760 // Utilize native event if possible so blur/focus sequence is correct
5761 setup: function() {
5762
5763 // Claim the first handler
5764 // dataPriv.set( this, "focus", ... )
5765 // dataPriv.set( this, "blur", ... )
5766 leverageNative( this, type, expectSync );
5767
5768 // Return false to allow normal processing in the caller
5769 return false;
5770 },
5771 trigger: function() {
5772
5773 // Force setup before trigger
5774 leverageNative( this, type );
5775
5776 // Return non-false to allow normal event-path propagation
5777 return true;
5778 },
5779
5780 delegateType: delegateType
5781 };
5782} );
5783
5784// Create mouseenter/leave events using mouseover/out and event-time checks
5785// so that event delegation works in jQuery.
5786// Do the same for pointerenter/pointerleave and pointerover/pointerout
5787//
5788// Support: Safari 7 only
5789// Safari sends mouseenter too often; see:
5790// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
5791// for the description of the bug (it existed in older Chrome versions as well).
5792jQuery.each( {
5793 mouseenter: "mouseover",
5794 mouseleave: "mouseout",
5795 pointerenter: "pointerover",
5796 pointerleave: "pointerout"
5797}, function( orig, fix ) {
5798 jQuery.event.special[ orig ] = {
5799 delegateType: fix,
5800 bindType: fix,
5801
5802 handle: function( event ) {
5803 var ret,
5804 target = this,
5805 related = event.relatedTarget,
5806 handleObj = event.handleObj;
5807
5808 // For mouseenter/leave call the handler if related is outside the target.
5809 // NB: No relatedTarget if the mouse left/entered the browser window
5810 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
5811 event.type = handleObj.origType;
5812 ret = handleObj.handler.apply( this, arguments );
5813 event.type = fix;
5814 }
5815 return ret;
5816 }
5817 };
5818} );
5819
5820jQuery.fn.extend( {
5821
5822 on: function( types, selector, data, fn ) {
5823 return on( this, types, selector, data, fn );
5824 },
5825 one: function( types, selector, data, fn ) {
5826 return on( this, types, selector, data, fn, 1 );
5827 },
5828 off: function( types, selector, fn ) {
5829 var handleObj, type;
5830 if ( types && types.preventDefault && types.handleObj ) {
5831
5832 // ( event ) dispatched jQuery.Event
5833 handleObj = types.handleObj;
5834 jQuery( types.delegateTarget ).off(
5835 handleObj.namespace ?
5836 handleObj.origType + "." + handleObj.namespace :
5837 handleObj.origType,
5838 handleObj.selector,
5839 handleObj.handler
5840 );
5841 return this;
5842 }
5843 if ( typeof types === "object" ) {
5844
5845 // ( types-object [, selector] )
5846 for ( type in types ) {
5847 this.off( type, selector, types[ type ] );
5848 }
5849 return this;
5850 }
5851 if ( selector === false || typeof selector === "function" ) {
5852
5853 // ( types [, fn] )
5854 fn = selector;
5855 selector = undefined;
5856 }
5857 if ( fn === false ) {
5858 fn = returnFalse;
5859 }
5860 return this.each( function() {
5861 jQuery.event.remove( this, types, fn, selector );
5862 } );
5863 }
5864} );
5865
5866
5867var
5868
5869 /* eslint-disable max-len */
5870
5871 // See https://github.com/eslint/eslint/issues/3229
5872 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
5873
5874 /* eslint-enable */
5875
5876 // Support: IE <=10 - 11, Edge 12 - 13 only
5877 // In IE/Edge using regex groups here causes severe slowdowns.
5878 // See https://connect.microsoft.com/IE/feedback/details/1736512/
5879 rnoInnerhtml = /<script|<style|<link/i,
5880
5881 // checked="checked" or checked
5882 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5883 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
5884
5885// Prefer a tbody over its parent table for containing new rows
5886function manipulationTarget( elem, content ) {
5887 if ( nodeName( elem, "table" ) &&
5888 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5889
5890 return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
5891 }
5892
5893 return elem;
5894}
5895
5896// Replace/restore the type attribute of script elements for safe DOM manipulation
5897function disableScript( elem ) {
5898 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
5899 return elem;
5900}
5901function restoreScript( elem ) {
5902 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
5903 elem.type = elem.type.slice( 5 );
5904 } else {
5905 elem.removeAttribute( "type" );
5906 }
5907
5908 return elem;
5909}
5910
5911function cloneCopyEvent( src, dest ) {
5912 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
5913
5914 if ( dest.nodeType !== 1 ) {
5915 return;
5916 }
5917
5918 // 1. Copy private data: events, handlers, etc.
5919 if ( dataPriv.hasData( src ) ) {
5920 pdataOld = dataPriv.access( src );
5921 pdataCur = dataPriv.set( dest, pdataOld );
5922 events = pdataOld.events;
5923
5924 if ( events ) {
5925 delete pdataCur.handle;
5926 pdataCur.events = {};
5927
5928 for ( type in events ) {
5929 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5930 jQuery.event.add( dest, type, events[ type ][ i ] );
5931 }
5932 }
5933 }
5934 }
5935
5936 // 2. Copy user data
5937 if ( dataUser.hasData( src ) ) {
5938 udataOld = dataUser.access( src );
5939 udataCur = jQuery.extend( {}, udataOld );
5940
5941 dataUser.set( dest, udataCur );
5942 }
5943}
5944
5945// Fix IE bugs, see support tests
5946function fixInput( src, dest ) {
5947 var nodeName = dest.nodeName.toLowerCase();
5948
5949 // Fails to persist the checked state of a cloned checkbox or radio button.
5950 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5951 dest.checked = src.checked;
5952
5953 // Fails to return the selected option to the default selected state when cloning options
5954 } else if ( nodeName === "input" || nodeName === "textarea" ) {
5955 dest.defaultValue = src.defaultValue;
5956 }
5957}
5958
5959function domManip( collection, args, callback, ignored ) {
5960
5961 // Flatten any nested arrays
5962 args = concat.apply( [], args );
5963
5964 var fragment, first, scripts, hasScripts, node, doc,
5965 i = 0,
5966 l = collection.length,
5967 iNoClone = l - 1,
5968 value = args[ 0 ],
5969 valueIsFunction = isFunction( value );
5970
5971 // We can't cloneNode fragments that contain checked, in WebKit
5972 if ( valueIsFunction ||
5973 ( l > 1 && typeof value === "string" &&
5974 !support.checkClone && rchecked.test( value ) ) ) {
5975 return collection.each( function( index ) {
5976 var self = collection.eq( index );
5977 if ( valueIsFunction ) {
5978 args[ 0 ] = value.call( this, index, self.html() );
5979 }
5980 domManip( self, args, callback, ignored );
5981 } );
5982 }
5983
5984 if ( l ) {
5985 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
5986 first = fragment.firstChild;
5987
5988 if ( fragment.childNodes.length === 1 ) {
5989 fragment = first;
5990 }
5991
5992 // Require either new content or an interest in ignored elements to invoke the callback
5993 if ( first || ignored ) {
5994 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5995 hasScripts = scripts.length;
5996
5997 // Use the original fragment for the last item
5998 // instead of the first because it can end up
5999 // being emptied incorrectly in certain situations (#8070).
6000 for ( ; i < l; i++ ) {
6001 node = fragment;
6002
6003 if ( i !== iNoClone ) {
6004 node = jQuery.clone( node, true, true );
6005
6006 // Keep references to cloned scripts for later restoration
6007 if ( hasScripts ) {
6008
6009 // Support: Android <=4.0 only, PhantomJS 1 only
6010 // push.apply(_, arraylike) throws on ancient WebKit
6011 jQuery.merge( scripts, getAll( node, "script" ) );
6012 }
6013 }
6014
6015 callback.call( collection[ i ], node, i );
6016 }
6017
6018 if ( hasScripts ) {
6019 doc = scripts[ scripts.length - 1 ].ownerDocument;
6020
6021 // Reenable scripts
6022 jQuery.map( scripts, restoreScript );
6023
6024 // Evaluate executable scripts on first document insertion
6025 for ( i = 0; i < hasScripts; i++ ) {
6026 node = scripts[ i ];
6027 if ( rscriptType.test( node.type || "" ) &&
6028 !dataPriv.access( node, "globalEval" ) &&
6029 jQuery.contains( doc, node ) ) {
6030
6031 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
6032
6033 // Optional AJAX dependency, but won't run scripts if not present
6034 if ( jQuery._evalUrl && !node.noModule ) {
6035 jQuery._evalUrl( node.src, {
6036 nonce: node.nonce || node.getAttribute( "nonce" )
6037 } );
6038 }
6039 } else {
6040 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
6041 }
6042 }
6043 }
6044 }
6045 }
6046 }
6047
6048 return collection;
6049}
6050
6051function remove( elem, selector, keepData ) {
6052 var node,
6053 nodes = selector ? jQuery.filter( selector, elem ) : elem,
6054 i = 0;
6055
6056 for ( ; ( node = nodes[ i ] ) != null; i++ ) {
6057 if ( !keepData && node.nodeType === 1 ) {
6058 jQuery.cleanData( getAll( node ) );
6059 }
6060
6061 if ( node.parentNode ) {
6062 if ( keepData && isAttached( node ) ) {
6063 setGlobalEval( getAll( node, "script" ) );
6064 }
6065 node.parentNode.removeChild( node );
6066 }
6067 }
6068
6069 return elem;
6070}
6071
6072jQuery.extend( {
6073 htmlPrefilter: function( html ) {
6074 return html.replace( rxhtmlTag, "<$1></$2>" );
6075 },
6076
6077 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
6078 var i, l, srcElements, destElements,
6079 clone = elem.cloneNode( true ),
6080 inPage = isAttached( elem );
6081
6082 // Fix IE cloning issues
6083 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
6084 !jQuery.isXMLDoc( elem ) ) {
6085
6086 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
6087 destElements = getAll( clone );
6088 srcElements = getAll( elem );
6089
6090 for ( i = 0, l = srcElements.length; i < l; i++ ) {
6091 fixInput( srcElements[ i ], destElements[ i ] );
6092 }
6093 }
6094
6095 // Copy the events from the original to the clone
6096 if ( dataAndEvents ) {
6097 if ( deepDataAndEvents ) {
6098 srcElements = srcElements || getAll( elem );
6099 destElements = destElements || getAll( clone );
6100
6101 for ( i = 0, l = srcElements.length; i < l; i++ ) {
6102 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
6103 }
6104 } else {
6105 cloneCopyEvent( elem, clone );
6106 }
6107 }
6108
6109 // Preserve script evaluation history
6110 destElements = getAll( clone, "script" );
6111 if ( destElements.length > 0 ) {
6112 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
6113 }
6114
6115 // Return the cloned set
6116 return clone;
6117 },
6118
6119 cleanData: function( elems ) {
6120 var data, elem, type,
6121 special = jQuery.event.special,
6122 i = 0;
6123
6124 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
6125 if ( acceptData( elem ) ) {
6126 if ( ( data = elem[ dataPriv.expando ] ) ) {
6127 if ( data.events ) {
6128 for ( type in data.events ) {
6129 if ( special[ type ] ) {
6130 jQuery.event.remove( elem, type );
6131
6132 // This is a shortcut to avoid jQuery.event.remove's overhead
6133 } else {
6134 jQuery.removeEvent( elem, type, data.handle );
6135 }
6136 }
6137 }
6138
6139 // Support: Chrome <=35 - 45+
6140 // Assign undefined instead of using delete, see Data#remove
6141 elem[ dataPriv.expando ] = undefined;
6142 }
6143 if ( elem[ dataUser.expando ] ) {
6144
6145 // Support: Chrome <=35 - 45+
6146 // Assign undefined instead of using delete, see Data#remove
6147 elem[ dataUser.expando ] = undefined;
6148 }
6149 }
6150 }
6151 }
6152} );
6153
6154jQuery.fn.extend( {
6155 detach: function( selector ) {
6156 return remove( this, selector, true );
6157 },
6158
6159 remove: function( selector ) {
6160 return remove( this, selector );
6161 },
6162
6163 text: function( value ) {
6164 return access( this, function( value ) {
6165 return value === undefined ?
6166 jQuery.text( this ) :
6167 this.empty().each( function() {
6168 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6169 this.textContent = value;
6170 }
6171 } );
6172 }, null, value, arguments.length );
6173 },
6174
6175 append: function() {
6176 return domManip( this, arguments, function( elem ) {
6177 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6178 var target = manipulationTarget( this, elem );
6179 target.appendChild( elem );
6180 }
6181 } );
6182 },
6183
6184 prepend: function() {
6185 return domManip( this, arguments, function( elem ) {
6186 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6187 var target = manipulationTarget( this, elem );
6188 target.insertBefore( elem, target.firstChild );
6189 }
6190 } );
6191 },
6192
6193 before: function() {
6194 return domManip( this, arguments, function( elem ) {
6195 if ( this.parentNode ) {
6196 this.parentNode.insertBefore( elem, this );
6197 }
6198 } );
6199 },
6200
6201 after: function() {
6202 return domManip( this, arguments, function( elem ) {
6203 if ( this.parentNode ) {
6204 this.parentNode.insertBefore( elem, this.nextSibling );
6205 }
6206 } );
6207 },
6208
6209 empty: function() {
6210 var elem,
6211 i = 0;
6212
6213 for ( ; ( elem = this[ i ] ) != null; i++ ) {
6214 if ( elem.nodeType === 1 ) {
6215
6216 // Prevent memory leaks
6217 jQuery.cleanData( getAll( elem, false ) );
6218
6219 // Remove any remaining nodes
6220 elem.textContent = "";
6221 }
6222 }
6223
6224 return this;
6225 },
6226
6227 clone: function( dataAndEvents, deepDataAndEvents ) {
6228 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
6229 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
6230
6231 return this.map( function() {
6232 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
6233 } );
6234 },
6235
6236 html: function( value ) {
6237 return access( this, function( value ) {
6238 var elem = this[ 0 ] || {},
6239 i = 0,
6240 l = this.length;
6241
6242 if ( value === undefined && elem.nodeType === 1 ) {
6243 return elem.innerHTML;
6244 }
6245
6246 // See if we can take a shortcut and just use innerHTML
6247 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
6248 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
6249
6250 value = jQuery.htmlPrefilter( value );
6251
6252 try {
6253 for ( ; i < l; i++ ) {
6254 elem = this[ i ] || {};
6255
6256 // Remove element nodes and prevent memory leaks
6257 if ( elem.nodeType === 1 ) {
6258 jQuery.cleanData( getAll( elem, false ) );
6259 elem.innerHTML = value;
6260 }
6261 }
6262
6263 elem = 0;
6264
6265 // If using innerHTML throws an exception, use the fallback method
6266 } catch ( e ) {}
6267 }
6268
6269 if ( elem ) {
6270 this.empty().append( value );
6271 }
6272 }, null, value, arguments.length );
6273 },
6274
6275 replaceWith: function() {
6276 var ignored = [];
6277
6278 // Make the changes, replacing each non-ignored context element with the new content
6279 return domManip( this, arguments, function( elem ) {
6280 var parent = this.parentNode;
6281
6282 if ( jQuery.inArray( this, ignored ) < 0 ) {
6283 jQuery.cleanData( getAll( this ) );
6284 if ( parent ) {
6285 parent.replaceChild( elem, this );
6286 }
6287 }
6288
6289 // Force callback invocation
6290 }, ignored );
6291 }
6292} );
6293
6294jQuery.each( {
6295 appendTo: "append",
6296 prependTo: "prepend",
6297 insertBefore: "before",
6298 insertAfter: "after",
6299 replaceAll: "replaceWith"
6300}, function( name, original ) {
6301 jQuery.fn[ name ] = function( selector ) {
6302 var elems,
6303 ret = [],
6304 insert = jQuery( selector ),
6305 last = insert.length - 1,
6306 i = 0;
6307
6308 for ( ; i <= last; i++ ) {
6309 elems = i === last ? this : this.clone( true );
6310 jQuery( insert[ i ] )[ original ]( elems );
6311
6312 // Support: Android <=4.0 only, PhantomJS 1 only
6313 // .get() because push.apply(_, arraylike) throws on ancient WebKit
6314 push.apply( ret, elems.get() );
6315 }
6316
6317 return this.pushStack( ret );
6318 };
6319} );
6320var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6321
6322var getStyles = function( elem ) {
6323
6324 // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
6325 // IE throws on elements created in popups
6326 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
6327 var view = elem.ownerDocument.defaultView;
6328
6329 if ( !view || !view.opener ) {
6330 view = window;
6331 }
6332
6333 return view.getComputedStyle( elem );
6334 };
6335
6336var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6337
6338
6339
6340( function() {
6341
6342 // Executing both pixelPosition & boxSizingReliable tests require only one layout
6343 // so they're executed at the same time to save the second computation.
6344 function computeStyleTests() {
6345
6346 // This is a singleton, we need to execute it only once
6347 if ( !div ) {
6348 return;
6349 }
6350
6351 container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
6352 "margin-top:1px;padding:0;border:0";
6353 div.style.cssText =
6354 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
6355 "margin:auto;border:1px;padding:1px;" +
6356 "width:60%;top:1%";
6357 documentElement.appendChild( container ).appendChild( div );
6358
6359 var divStyle = window.getComputedStyle( div );
6360 pixelPositionVal = divStyle.top !== "1%";
6361
6362 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
6363 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
6364
6365 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
6366 // Some styles come back with percentage values, even though they shouldn't
6367 div.style.right = "60%";
6368 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
6369
6370 // Support: IE 9 - 11 only
6371 // Detect misreporting of content dimensions for box-sizing:border-box elements
6372 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
6373
6374 // Support: IE 9 only
6375 // Detect overflow:scroll screwiness (gh-3699)
6376 // Support: Chrome <=64
6377 // Don't get tricked when zoom affects offsetWidth (gh-4029)
6378 div.style.position = "absolute";
6379 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
6380
6381 documentElement.removeChild( container );
6382
6383 // Nullify the div so it wouldn't be stored in the memory and
6384 // it will also be a sign that checks already performed
6385 div = null;
6386 }
6387
6388 function roundPixelMeasures( measure ) {
6389 return Math.round( parseFloat( measure ) );
6390 }
6391
6392 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
6393 reliableMarginLeftVal,
6394 container = document.createElement( "div" ),
6395 div = document.createElement( "div" );
6396
6397 // Finish early in limited (non-browser) environments
6398 if ( !div.style ) {
6399 return;
6400 }
6401
6402 // Support: IE <=9 - 11 only
6403 // Style of cloned element affects source element cloned (#8908)
6404 div.style.backgroundClip = "content-box";
6405 div.cloneNode( true ).style.backgroundClip = "";
6406 support.clearCloneStyle = div.style.backgroundClip === "content-box";
6407
6408 jQuery.extend( support, {
6409 boxSizingReliable: function() {
6410 computeStyleTests();
6411 return boxSizingReliableVal;
6412 },
6413 pixelBoxStyles: function() {
6414 computeStyleTests();
6415 return pixelBoxStylesVal;
6416 },
6417 pixelPosition: function() {
6418 computeStyleTests();
6419 return pixelPositionVal;
6420 },
6421 reliableMarginLeft: function() {
6422 computeStyleTests();
6423 return reliableMarginLeftVal;
6424 },
6425 scrollboxSize: function() {
6426 computeStyleTests();
6427 return scrollboxSizeVal;
6428 }
6429 } );
6430} )();
6431
6432
6433function curCSS( elem, name, computed ) {
6434 var width, minWidth, maxWidth, ret,
6435
6436 // Support: Firefox 51+
6437 // Retrieving style before computed somehow
6438 // fixes an issue with getting wrong values
6439 // on detached elements
6440 style = elem.style;
6441
6442 computed = computed || getStyles( elem );
6443
6444 // getPropertyValue is needed for:
6445 // .css('filter') (IE 9 only, #12537)
6446 // .css('--customProperty) (#3144)
6447 if ( computed ) {
6448 ret = computed.getPropertyValue( name ) || computed[ name ];
6449
6450 if ( ret === "" && !isAttached( elem ) ) {
6451 ret = jQuery.style( elem, name );
6452 }
6453
6454 // A tribute to the "awesome hack by Dean Edwards"
6455 // Android Browser returns percentage for some values,
6456 // but width seems to be reliably pixels.
6457 // This is against the CSSOM draft spec:
6458 // https://drafts.csswg.org/cssom/#resolved-values
6459 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
6460
6461 // Remember the original values
6462 width = style.width;
6463 minWidth = style.minWidth;
6464 maxWidth = style.maxWidth;
6465
6466 // Put in the new values to get a computed value out
6467 style.minWidth = style.maxWidth = style.width = ret;
6468 ret = computed.width;
6469
6470 // Revert the changed values
6471 style.width = width;
6472 style.minWidth = minWidth;
6473 style.maxWidth = maxWidth;
6474 }
6475 }
6476
6477 return ret !== undefined ?
6478
6479 // Support: IE <=9 - 11 only
6480 // IE returns zIndex value as an integer.
6481 ret + "" :
6482 ret;
6483}
6484
6485
6486function addGetHookIf( conditionFn, hookFn ) {
6487
6488 // Define the hook, we'll check on the first run if it's really needed.
6489 return {
6490 get: function() {
6491 if ( conditionFn() ) {
6492
6493 // Hook not needed (or it's not possible to use it due
6494 // to missing dependency), remove it.
6495 delete this.get;
6496 return;
6497 }
6498
6499 // Hook needed; redefine it so that the support test is not executed again.
6500 return ( this.get = hookFn ).apply( this, arguments );
6501 }
6502 };
6503}
6504
6505
6506var cssPrefixes = [ "Webkit", "Moz", "ms" ],
6507 emptyStyle = document.createElement( "div" ).style,
6508 vendorProps = {};
6509
6510// Return a vendor-prefixed property or undefined
6511function vendorPropName( name ) {
6512
6513 // Check for vendor prefixed names
6514 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
6515 i = cssPrefixes.length;
6516
6517 while ( i-- ) {
6518 name = cssPrefixes[ i ] + capName;
6519 if ( name in emptyStyle ) {
6520 return name;
6521 }
6522 }
6523}
6524
6525// Return a potentially-mapped jQuery.cssProps or vendor prefixed property
6526function finalPropName( name ) {
6527 var final = jQuery.cssProps[ name ] || vendorProps[ name ];
6528
6529 if ( final ) {
6530 return final;
6531 }
6532 if ( name in emptyStyle ) {
6533 return name;
6534 }
6535 return vendorProps[ name ] = vendorPropName( name ) || name;
6536}
6537
6538
6539var
6540
6541 // Swappable if display is none or starts with table
6542 // except "table", "table-cell", or "table-caption"
6543 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6544 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6545 rcustomProp = /^--/,
6546 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6547 cssNormalTransform = {
6548 letterSpacing: "0",
6549 fontWeight: "400"
6550 };
6551
6552function setPositiveNumber( elem, value, subtract ) {
6553
6554 // Any relative (+/-) values have already been
6555 // normalized at this point
6556 var matches = rcssNum.exec( value );
6557 return matches ?
6558
6559 // Guard against undefined "subtract", e.g., when used as in cssHooks
6560 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
6561 value;
6562}
6563
6564function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
6565 var i = dimension === "width" ? 1 : 0,
6566 extra = 0,
6567 delta = 0;
6568
6569 // Adjustment may not be necessary
6570 if ( box === ( isBorderBox ? "border" : "content" ) ) {
6571 return 0;
6572 }
6573
6574 for ( ; i < 4; i += 2 ) {
6575
6576 // Both box models exclude margin
6577 if ( box === "margin" ) {
6578 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6579 }
6580
6581 // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
6582 if ( !isBorderBox ) {
6583
6584 // Add padding
6585 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6586
6587 // For "border" or "margin", add border
6588 if ( box !== "padding" ) {
6589 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6590
6591 // But still keep track of it otherwise
6592 } else {
6593 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6594 }
6595
6596 // If we get here with a border-box (content + padding + border), we're seeking "content" or
6597 // "padding" or "margin"
6598 } else {
6599
6600 // For "content", subtract padding
6601 if ( box === "content" ) {
6602 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6603 }
6604
6605 // For "content" or "padding", subtract border
6606 if ( box !== "margin" ) {
6607 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6608 }
6609 }
6610 }
6611
6612 // Account for positive content-box scroll gutter when requested by providing computedVal
6613 if ( !isBorderBox && computedVal >= 0 ) {
6614
6615 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
6616 // Assuming integer scroll gutter, subtract the rest and round down
6617 delta += Math.max( 0, Math.ceil(
6618 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6619 computedVal -
6620 delta -
6621 extra -
6622 0.5
6623
6624 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
6625 // Use an explicit zero to avoid NaN (gh-3964)
6626 ) ) || 0;
6627 }
6628
6629 return delta;
6630}
6631
6632function getWidthOrHeight( elem, dimension, extra ) {
6633
6634 // Start with computed style
6635 var styles = getStyles( elem ),
6636
6637 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
6638 // Fake content-box until we know it's needed to know the true value.
6639 boxSizingNeeded = !support.boxSizingReliable() || extra,
6640 isBorderBox = boxSizingNeeded &&
6641 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6642 valueIsBorderBox = isBorderBox,
6643
6644 val = curCSS( elem, dimension, styles ),
6645 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
6646
6647 // Support: Firefox <=54
6648 // Return a confounding non-pixel value or feign ignorance, as appropriate.
6649 if ( rnumnonpx.test( val ) ) {
6650 if ( !extra ) {
6651 return val;
6652 }
6653 val = "auto";
6654 }
6655
6656
6657 // Fall back to offsetWidth/offsetHeight when value is "auto"
6658 // This happens for inline elements with no explicit setting (gh-3571)
6659 // Support: Android <=4.1 - 4.3 only
6660 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
6661 // Support: IE 9-11 only
6662 // Also use offsetWidth/offsetHeight for when box sizing is unreliable
6663 // We use getClientRects() to check for hidden/disconnected.
6664 // In those cases, the computed value can be trusted to be border-box
6665 if ( ( !support.boxSizingReliable() && isBorderBox ||
6666 val === "auto" ||
6667 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
6668 elem.getClientRects().length ) {
6669
6670 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6671
6672 // Where available, offsetWidth/offsetHeight approximate border box dimensions.
6673 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
6674 // retrieved value as a content box dimension.
6675 valueIsBorderBox = offsetProp in elem;
6676 if ( valueIsBorderBox ) {
6677 val = elem[ offsetProp ];
6678 }
6679 }
6680
6681 // Normalize "" and auto
6682 val = parseFloat( val ) || 0;
6683
6684 // Adjust for the element's box model
6685 return ( val +
6686 boxModelAdjustment(
6687 elem,
6688 dimension,
6689 extra || ( isBorderBox ? "border" : "content" ),
6690 valueIsBorderBox,
6691 styles,
6692
6693 // Provide the current computed size to request scroll gutter calculation (gh-3589)
6694 val
6695 )
6696 ) + "px";
6697}
6698
6699jQuery.extend( {
6700
6701 // Add in style property hooks for overriding the default
6702 // behavior of getting and setting a style property
6703 cssHooks: {
6704 opacity: {
6705 get: function( elem, computed ) {
6706 if ( computed ) {
6707
6708 // We should always get a number back from opacity
6709 var ret = curCSS( elem, "opacity" );
6710 return ret === "" ? "1" : ret;
6711 }
6712 }
6713 }
6714 },
6715
6716 // Don't automatically add "px" to these possibly-unitless properties
6717 cssNumber: {
6718 "animationIterationCount": true,
6719 "columnCount": true,
6720 "fillOpacity": true,
6721 "flexGrow": true,
6722 "flexShrink": true,
6723 "fontWeight": true,
6724 "gridArea": true,
6725 "gridColumn": true,
6726 "gridColumnEnd": true,
6727 "gridColumnStart": true,
6728 "gridRow": true,
6729 "gridRowEnd": true,
6730 "gridRowStart": true,
6731 "lineHeight": true,
6732 "opacity": true,
6733 "order": true,
6734 "orphans": true,
6735 "widows": true,
6736 "zIndex": true,
6737 "zoom": true
6738 },
6739
6740 // Add in properties whose names you wish to fix before
6741 // setting or getting the value
6742 cssProps: {},
6743
6744 // Get and set the style property on a DOM Node
6745 style: function( elem, name, value, extra ) {
6746
6747 // Don't set styles on text and comment nodes
6748 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6749 return;
6750 }
6751
6752 // Make sure that we're working with the right name
6753 var ret, type, hooks,
6754 origName = camelCase( name ),
6755 isCustomProp = rcustomProp.test( name ),
6756 style = elem.style;
6757
6758 // Make sure that we're working with the right name. We don't
6759 // want to query the value if it is a CSS custom property
6760 // since they are user-defined.
6761 if ( !isCustomProp ) {
6762 name = finalPropName( origName );
6763 }
6764
6765 // Gets hook for the prefixed version, then unprefixed version
6766 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6767
6768 // Check if we're setting a value
6769 if ( value !== undefined ) {
6770 type = typeof value;
6771
6772 // Convert "+=" or "-=" to relative numbers (#7345)
6773 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
6774 value = adjustCSS( elem, name, ret );
6775
6776 // Fixes bug #9237
6777 type = "number";
6778 }
6779
6780 // Make sure that null and NaN values aren't set (#7116)
6781 if ( value == null || value !== value ) {
6782 return;
6783 }
6784
6785 // If a number was passed in, add the unit (except for certain CSS properties)
6786 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
6787 // "px" to a few hardcoded values.
6788 if ( type === "number" && !isCustomProp ) {
6789 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
6790 }
6791
6792 // background-* props affect original clone's values
6793 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
6794 style[ name ] = "inherit";
6795 }
6796
6797 // If a hook was provided, use that value, otherwise just set the specified value
6798 if ( !hooks || !( "set" in hooks ) ||
6799 ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
6800
6801 if ( isCustomProp ) {
6802 style.setProperty( name, value );
6803 } else {
6804 style[ name ] = value;
6805 }
6806 }
6807
6808 } else {
6809
6810 // If a hook was provided get the non-computed value from there
6811 if ( hooks && "get" in hooks &&
6812 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
6813
6814 return ret;
6815 }
6816
6817 // Otherwise just get the value from the style object
6818 return style[ name ];
6819 }
6820 },
6821
6822 css: function( elem, name, extra, styles ) {
6823 var val, num, hooks,
6824 origName = camelCase( name ),
6825 isCustomProp = rcustomProp.test( name );
6826
6827 // Make sure that we're working with the right name. We don't
6828 // want to modify the value if it is a CSS custom property
6829 // since they are user-defined.
6830 if ( !isCustomProp ) {
6831 name = finalPropName( origName );
6832 }
6833
6834 // Try prefixed name followed by the unprefixed name
6835 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6836
6837 // If a hook was provided get the computed value from there
6838 if ( hooks && "get" in hooks ) {
6839 val = hooks.get( elem, true, extra );
6840 }
6841
6842 // Otherwise, if a way to get the computed value exists, use that
6843 if ( val === undefined ) {
6844 val = curCSS( elem, name, styles );
6845 }
6846
6847 // Convert "normal" to computed value
6848 if ( val === "normal" && name in cssNormalTransform ) {
6849 val = cssNormalTransform[ name ];
6850 }
6851
6852 // Make numeric if forced or a qualifier was provided and val looks numeric
6853 if ( extra === "" || extra ) {
6854 num = parseFloat( val );
6855 return extra === true || isFinite( num ) ? num || 0 : val;
6856 }
6857
6858 return val;
6859 }
6860} );
6861
6862jQuery.each( [ "height", "width" ], function( i, dimension ) {
6863 jQuery.cssHooks[ dimension ] = {
6864 get: function( elem, computed, extra ) {
6865 if ( computed ) {
6866
6867 // Certain elements can have dimension info if we invisibly show them
6868 // but it must have a current display style that would benefit
6869 return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
6870
6871 // Support: Safari 8+
6872 // Table columns in Safari have non-zero offsetWidth & zero
6873 // getBoundingClientRect().width unless display is changed.
6874 // Support: IE <=11 only
6875 // Running getBoundingClientRect on a disconnected node
6876 // in IE throws an error.
6877 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
6878 swap( elem, cssShow, function() {
6879 return getWidthOrHeight( elem, dimension, extra );
6880 } ) :
6881 getWidthOrHeight( elem, dimension, extra );
6882 }
6883 },
6884
6885 set: function( elem, value, extra ) {
6886 var matches,
6887 styles = getStyles( elem ),
6888
6889 // Only read styles.position if the test has a chance to fail
6890 // to avoid forcing a reflow.
6891 scrollboxSizeBuggy = !support.scrollboxSize() &&
6892 styles.position === "absolute",
6893
6894 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
6895 boxSizingNeeded = scrollboxSizeBuggy || extra,
6896 isBorderBox = boxSizingNeeded &&
6897 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6898 subtract = extra ?
6899 boxModelAdjustment(
6900 elem,
6901 dimension,
6902 extra,
6903 isBorderBox,
6904 styles
6905 ) :
6906 0;
6907
6908 // Account for unreliable border-box dimensions by comparing offset* to computed and
6909 // faking a content-box to get border and padding (gh-3699)
6910 if ( isBorderBox && scrollboxSizeBuggy ) {
6911 subtract -= Math.ceil(
6912 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6913 parseFloat( styles[ dimension ] ) -
6914 boxModelAdjustment( elem, dimension, "border", false, styles ) -
6915 0.5
6916 );
6917 }
6918
6919 // Convert to pixels if value adjustment is needed
6920 if ( subtract && ( matches = rcssNum.exec( value ) ) &&
6921 ( matches[ 3 ] || "px" ) !== "px" ) {
6922
6923 elem.style[ dimension ] = value;
6924 value = jQuery.css( elem, dimension );
6925 }
6926
6927 return setPositiveNumber( elem, value, subtract );
6928 }
6929 };
6930} );
6931
6932jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
6933 function( elem, computed ) {
6934 if ( computed ) {
6935 return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
6936 elem.getBoundingClientRect().left -
6937 swap( elem, { marginLeft: 0 }, function() {
6938 return elem.getBoundingClientRect().left;
6939 } )
6940 ) + "px";
6941 }
6942 }
6943);
6944
6945// These hooks are used by animate to expand properties
6946jQuery.each( {
6947 margin: "",
6948 padding: "",
6949 border: "Width"
6950}, function( prefix, suffix ) {
6951 jQuery.cssHooks[ prefix + suffix ] = {
6952 expand: function( value ) {
6953 var i = 0,
6954 expanded = {},
6955
6956 // Assumes a single number if not a string
6957 parts = typeof value === "string" ? value.split( " " ) : [ value ];
6958
6959 for ( ; i < 4; i++ ) {
6960 expanded[ prefix + cssExpand[ i ] + suffix ] =
6961 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6962 }
6963
6964 return expanded;
6965 }
6966 };
6967
6968 if ( prefix !== "margin" ) {
6969 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6970 }
6971} );
6972
6973jQuery.fn.extend( {
6974 css: function( name, value ) {
6975 return access( this, function( elem, name, value ) {
6976 var styles, len,
6977 map = {},
6978 i = 0;
6979
6980 if ( Array.isArray( name ) ) {
6981 styles = getStyles( elem );
6982 len = name.length;
6983
6984 for ( ; i < len; i++ ) {
6985 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6986 }
6987
6988 return map;
6989 }
6990
6991 return value !== undefined ?
6992 jQuery.style( elem, name, value ) :
6993 jQuery.css( elem, name );
6994 }, name, value, arguments.length > 1 );
6995 }
6996} );
6997
6998
6999function Tween( elem, options, prop, end, easing ) {
7000 return new Tween.prototype.init( elem, options, prop, end, easing );
7001}
7002jQuery.Tween = Tween;
7003
7004Tween.prototype = {
7005 constructor: Tween,
7006 init: function( elem, options, prop, end, easing, unit ) {
7007 this.elem = elem;
7008 this.prop = prop;
7009 this.easing = easing || jQuery.easing._default;
7010 this.options = options;
7011 this.start = this.now = this.cur();
7012 this.end = end;
7013 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
7014 },
7015 cur: function() {
7016 var hooks = Tween.propHooks[ this.prop ];
7017
7018 return hooks && hooks.get ?
7019 hooks.get( this ) :
7020 Tween.propHooks._default.get( this );
7021 },
7022 run: function( percent ) {
7023 var eased,
7024 hooks = Tween.propHooks[ this.prop ];
7025
7026 if ( this.options.duration ) {
7027 this.pos = eased = jQuery.easing[ this.easing ](
7028 percent, this.options.duration * percent, 0, 1, this.options.duration
7029 );
7030 } else {
7031 this.pos = eased = percent;
7032 }
7033 this.now = ( this.end - this.start ) * eased + this.start;
7034
7035 if ( this.options.step ) {
7036 this.options.step.call( this.elem, this.now, this );
7037 }
7038
7039 if ( hooks && hooks.set ) {
7040 hooks.set( this );
7041 } else {
7042 Tween.propHooks._default.set( this );
7043 }
7044 return this;
7045 }
7046};
7047
7048Tween.prototype.init.prototype = Tween.prototype;
7049
7050Tween.propHooks = {
7051 _default: {
7052 get: function( tween ) {
7053 var result;
7054
7055 // Use a property on the element directly when it is not a DOM element,
7056 // or when there is no matching style property that exists.
7057 if ( tween.elem.nodeType !== 1 ||
7058 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
7059 return tween.elem[ tween.prop ];
7060 }
7061
7062 // Passing an empty string as a 3rd parameter to .css will automatically
7063 // attempt a parseFloat and fallback to a string if the parse fails.
7064 // Simple values such as "10px" are parsed to Float;
7065 // complex values such as "rotate(1rad)" are returned as-is.
7066 result = jQuery.css( tween.elem, tween.prop, "" );
7067
7068 // Empty strings, null, undefined and "auto" are converted to 0.
7069 return !result || result === "auto" ? 0 : result;
7070 },
7071 set: function( tween ) {
7072
7073 // Use step hook for back compat.
7074 // Use cssHook if its there.
7075 // Use .style if available and use plain properties where available.
7076 if ( jQuery.fx.step[ tween.prop ] ) {
7077 jQuery.fx.step[ tween.prop ]( tween );
7078 } else if ( tween.elem.nodeType === 1 && (
7079 jQuery.cssHooks[ tween.prop ] ||
7080 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
7081 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
7082 } else {
7083 tween.elem[ tween.prop ] = tween.now;
7084 }
7085 }
7086 }
7087};
7088
7089// Support: IE <=9 only
7090// Panic based approach to setting things on disconnected nodes
7091Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
7092 set: function( tween ) {
7093 if ( tween.elem.nodeType && tween.elem.parentNode ) {
7094 tween.elem[ tween.prop ] = tween.now;
7095 }
7096 }
7097};
7098
7099jQuery.easing = {
7100 linear: function( p ) {
7101 return p;
7102 },
7103 swing: function( p ) {
7104 return 0.5 - Math.cos( p * Math.PI ) / 2;
7105 },
7106 _default: "swing"
7107};
7108
7109jQuery.fx = Tween.prototype.init;
7110
7111// Back compat <1.8 extension point
7112jQuery.fx.step = {};
7113
7114
7115
7116
7117var
7118 fxNow, inProgress,
7119 rfxtypes = /^(?:toggle|show|hide)$/,
7120 rrun = /queueHooks$/;
7121
7122function schedule() {
7123 if ( inProgress ) {
7124 if ( document.hidden === false && window.requestAnimationFrame ) {
7125 window.requestAnimationFrame( schedule );
7126 } else {
7127 window.setTimeout( schedule, jQuery.fx.interval );
7128 }
7129
7130 jQuery.fx.tick();
7131 }
7132}
7133
7134// Animations created synchronously will run synchronously
7135function createFxNow() {
7136 window.setTimeout( function() {
7137 fxNow = undefined;
7138 } );
7139 return ( fxNow = Date.now() );
7140}
7141
7142// Generate parameters to create a standard animation
7143function genFx( type, includeWidth ) {
7144 var which,
7145 i = 0,
7146 attrs = { height: type };
7147
7148 // If we include width, step value is 1 to do all cssExpand values,
7149 // otherwise step value is 2 to skip over Left and Right
7150 includeWidth = includeWidth ? 1 : 0;
7151 for ( ; i < 4; i += 2 - includeWidth ) {
7152 which = cssExpand[ i ];
7153 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
7154 }
7155
7156 if ( includeWidth ) {
7157 attrs.opacity = attrs.width = type;
7158 }
7159
7160 return attrs;
7161}
7162
7163function createTween( value, prop, animation ) {
7164 var tween,
7165 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
7166 index = 0,
7167 length = collection.length;
7168 for ( ; index < length; index++ ) {
7169 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
7170
7171 // We're done with this property
7172 return tween;
7173 }
7174 }
7175}
7176
7177function defaultPrefilter( elem, props, opts ) {
7178 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
7179 isBox = "width" in props || "height" in props,
7180 anim = this,
7181 orig = {},
7182 style = elem.style,
7183 hidden = elem.nodeType && isHiddenWithinTree( elem ),
7184 dataShow = dataPriv.get( elem, "fxshow" );
7185
7186 // Queue-skipping animations hijack the fx hooks
7187 if ( !opts.queue ) {
7188 hooks = jQuery._queueHooks( elem, "fx" );
7189 if ( hooks.unqueued == null ) {
7190 hooks.unqueued = 0;
7191 oldfire = hooks.empty.fire;
7192 hooks.empty.fire = function() {
7193 if ( !hooks.unqueued ) {
7194 oldfire();
7195 }
7196 };
7197 }
7198 hooks.unqueued++;
7199
7200 anim.always( function() {
7201
7202 // Ensure the complete handler is called before this completes
7203 anim.always( function() {
7204 hooks.unqueued--;
7205 if ( !jQuery.queue( elem, "fx" ).length ) {
7206 hooks.empty.fire();
7207 }
7208 } );
7209 } );
7210 }
7211
7212 // Detect show/hide animations
7213 for ( prop in props ) {
7214 value = props[ prop ];
7215 if ( rfxtypes.test( value ) ) {
7216 delete props[ prop ];
7217 toggle = toggle || value === "toggle";
7218 if ( value === ( hidden ? "hide" : "show" ) ) {
7219
7220 // Pretend to be hidden if this is a "show" and
7221 // there is still data from a stopped show/hide
7222 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
7223 hidden = true;
7224
7225 // Ignore all other no-op show/hide data
7226 } else {
7227 continue;
7228 }
7229 }
7230 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
7231 }
7232 }
7233
7234 // Bail out if this is a no-op like .hide().hide()
7235 propTween = !jQuery.isEmptyObject( props );
7236 if ( !propTween && jQuery.isEmptyObject( orig ) ) {
7237 return;
7238 }
7239
7240 // Restrict "overflow" and "display" styles during box animations
7241 if ( isBox && elem.nodeType === 1 ) {
7242
7243 // Support: IE <=9 - 11, Edge 12 - 15
7244 // Record all 3 overflow attributes because IE does not infer the shorthand
7245 // from identically-valued overflowX and overflowY and Edge just mirrors
7246 // the overflowX value there.
7247 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
7248
7249 // Identify a display type, preferring old show/hide data over the CSS cascade
7250 restoreDisplay = dataShow && dataShow.display;
7251 if ( restoreDisplay == null ) {
7252 restoreDisplay = dataPriv.get( elem, "display" );
7253 }
7254 display = jQuery.css( elem, "display" );
7255 if ( display === "none" ) {
7256 if ( restoreDisplay ) {
7257 display = restoreDisplay;
7258 } else {
7259
7260 // Get nonempty value(s) by temporarily forcing visibility
7261 showHide( [ elem ], true );
7262 restoreDisplay = elem.style.display || restoreDisplay;
7263 display = jQuery.css( elem, "display" );
7264 showHide( [ elem ] );
7265 }
7266 }
7267
7268 // Animate inline elements as inline-block
7269 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
7270 if ( jQuery.css( elem, "float" ) === "none" ) {
7271
7272 // Restore the original display value at the end of pure show/hide animations
7273 if ( !propTween ) {
7274 anim.done( function() {
7275 style.display = restoreDisplay;
7276 } );
7277 if ( restoreDisplay == null ) {
7278 display = style.display;
7279 restoreDisplay = display === "none" ? "" : display;
7280 }
7281 }
7282 style.display = "inline-block";
7283 }
7284 }
7285 }
7286
7287 if ( opts.overflow ) {
7288 style.overflow = "hidden";
7289 anim.always( function() {
7290 style.overflow = opts.overflow[ 0 ];
7291 style.overflowX = opts.overflow[ 1 ];
7292 style.overflowY = opts.overflow[ 2 ];
7293 } );
7294 }
7295
7296 // Implement show/hide animations
7297 propTween = false;
7298 for ( prop in orig ) {
7299
7300 // General show/hide setup for this element animation
7301 if ( !propTween ) {
7302 if ( dataShow ) {
7303 if ( "hidden" in dataShow ) {
7304 hidden = dataShow.hidden;
7305 }
7306 } else {
7307 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
7308 }
7309
7310 // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
7311 if ( toggle ) {
7312 dataShow.hidden = !hidden;
7313 }
7314
7315 // Show elements before animating them
7316 if ( hidden ) {
7317 showHide( [ elem ], true );
7318 }
7319
7320 /* eslint-disable no-loop-func */
7321
7322 anim.done( function() {
7323
7324 /* eslint-enable no-loop-func */
7325
7326 // The final step of a "hide" animation is actually hiding the element
7327 if ( !hidden ) {
7328 showHide( [ elem ] );
7329 }
7330 dataPriv.remove( elem, "fxshow" );
7331 for ( prop in orig ) {
7332 jQuery.style( elem, prop, orig[ prop ] );
7333 }
7334 } );
7335 }
7336
7337 // Per-property setup
7338 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
7339 if ( !( prop in dataShow ) ) {
7340 dataShow[ prop ] = propTween.start;
7341 if ( hidden ) {
7342 propTween.end = propTween.start;
7343 propTween.start = 0;
7344 }
7345 }
7346 }
7347}
7348
7349function propFilter( props, specialEasing ) {
7350 var index, name, easing, value, hooks;
7351
7352 // camelCase, specialEasing and expand cssHook pass
7353 for ( index in props ) {
7354 name = camelCase( index );
7355 easing = specialEasing[ name ];
7356 value = props[ index ];
7357 if ( Array.isArray( value ) ) {
7358 easing = value[ 1 ];
7359 value = props[ index ] = value[ 0 ];
7360 }
7361
7362 if ( index !== name ) {
7363 props[ name ] = value;
7364 delete props[ index ];
7365 }
7366
7367 hooks = jQuery.cssHooks[ name ];
7368 if ( hooks && "expand" in hooks ) {
7369 value = hooks.expand( value );
7370 delete props[ name ];
7371
7372 // Not quite $.extend, this won't overwrite existing keys.
7373 // Reusing 'index' because we have the correct "name"
7374 for ( index in value ) {
7375 if ( !( index in props ) ) {
7376 props[ index ] = value[ index ];
7377 specialEasing[ index ] = easing;
7378 }
7379 }
7380 } else {
7381 specialEasing[ name ] = easing;
7382 }
7383 }
7384}
7385
7386function Animation( elem, properties, options ) {
7387 var result,
7388 stopped,
7389 index = 0,
7390 length = Animation.prefilters.length,
7391 deferred = jQuery.Deferred().always( function() {
7392
7393 // Don't match elem in the :animated selector
7394 delete tick.elem;
7395 } ),
7396 tick = function() {
7397 if ( stopped ) {
7398 return false;
7399 }
7400 var currentTime = fxNow || createFxNow(),
7401 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7402
7403 // Support: Android 2.3 only
7404 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
7405 temp = remaining / animation.duration || 0,
7406 percent = 1 - temp,
7407 index = 0,
7408 length = animation.tweens.length;
7409
7410 for ( ; index < length; index++ ) {
7411 animation.tweens[ index ].run( percent );
7412 }
7413
7414 deferred.notifyWith( elem, [ animation, percent, remaining ] );
7415
7416 // If there's more to do, yield
7417 if ( percent < 1 && length ) {
7418 return remaining;
7419 }
7420
7421 // If this was an empty animation, synthesize a final progress notification
7422 if ( !length ) {
7423 deferred.notifyWith( elem, [ animation, 1, 0 ] );
7424 }
7425
7426 // Resolve the animation and report its conclusion
7427 deferred.resolveWith( elem, [ animation ] );
7428 return false;
7429 },
7430 animation = deferred.promise( {
7431 elem: elem,
7432 props: jQuery.extend( {}, properties ),
7433 opts: jQuery.extend( true, {
7434 specialEasing: {},
7435 easing: jQuery.easing._default
7436 }, options ),
7437 originalProperties: properties,
7438 originalOptions: options,
7439 startTime: fxNow || createFxNow(),
7440 duration: options.duration,
7441 tweens: [],
7442 createTween: function( prop, end ) {
7443 var tween = jQuery.Tween( elem, animation.opts, prop, end,
7444 animation.opts.specialEasing[ prop ] || animation.opts.easing );
7445 animation.tweens.push( tween );
7446 return tween;
7447 },
7448 stop: function( gotoEnd ) {
7449 var index = 0,
7450
7451 // If we are going to the end, we want to run all the tweens
7452 // otherwise we skip this part
7453 length = gotoEnd ? animation.tweens.length : 0;
7454 if ( stopped ) {
7455 return this;
7456 }
7457 stopped = true;
7458 for ( ; index < length; index++ ) {
7459 animation.tweens[ index ].run( 1 );
7460 }
7461
7462 // Resolve when we played the last frame; otherwise, reject
7463 if ( gotoEnd ) {
7464 deferred.notifyWith( elem, [ animation, 1, 0 ] );
7465 deferred.resolveWith( elem, [ animation, gotoEnd ] );
7466 } else {
7467 deferred.rejectWith( elem, [ animation, gotoEnd ] );
7468 }
7469 return this;
7470 }
7471 } ),
7472 props = animation.props;
7473
7474 propFilter( props, animation.opts.specialEasing );
7475
7476 for ( ; index < length; index++ ) {
7477 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
7478 if ( result ) {
7479 if ( isFunction( result.stop ) ) {
7480 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
7481 result.stop.bind( result );
7482 }
7483 return result;
7484 }
7485 }
7486
7487 jQuery.map( props, createTween, animation );
7488
7489 if ( isFunction( animation.opts.start ) ) {
7490 animation.opts.start.call( elem, animation );
7491 }
7492
7493 // Attach callbacks from options
7494 animation
7495 .progress( animation.opts.progress )
7496 .done( animation.opts.done, animation.opts.complete )
7497 .fail( animation.opts.fail )
7498 .always( animation.opts.always );
7499
7500 jQuery.fx.timer(
7501 jQuery.extend( tick, {
7502 elem: elem,
7503 anim: animation,
7504 queue: animation.opts.queue
7505 } )
7506 );
7507
7508 return animation;
7509}
7510
7511jQuery.Animation = jQuery.extend( Animation, {
7512
7513 tweeners: {
7514 "*": [ function( prop, value ) {
7515 var tween = this.createTween( prop, value );
7516 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
7517 return tween;
7518 } ]
7519 },
7520
7521 tweener: function( props, callback ) {
7522 if ( isFunction( props ) ) {
7523 callback = props;
7524 props = [ "*" ];
7525 } else {
7526 props = props.match( rnothtmlwhite );
7527 }
7528
7529 var prop,
7530 index = 0,
7531 length = props.length;
7532
7533 for ( ; index < length; index++ ) {
7534 prop = props[ index ];
7535 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
7536 Animation.tweeners[ prop ].unshift( callback );
7537 }
7538 },
7539
7540 prefilters: [ defaultPrefilter ],
7541
7542 prefilter: function( callback, prepend ) {
7543 if ( prepend ) {
7544 Animation.prefilters.unshift( callback );
7545 } else {
7546 Animation.prefilters.push( callback );
7547 }
7548 }
7549} );
7550
7551jQuery.speed = function( speed, easing, fn ) {
7552 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
7553 complete: fn || !fn && easing ||
7554 isFunction( speed ) && speed,
7555 duration: speed,
7556 easing: fn && easing || easing && !isFunction( easing ) && easing
7557 };
7558
7559 // Go to the end state if fx are off
7560 if ( jQuery.fx.off ) {
7561 opt.duration = 0;
7562
7563 } else {
7564 if ( typeof opt.duration !== "number" ) {
7565 if ( opt.duration in jQuery.fx.speeds ) {
7566 opt.duration = jQuery.fx.speeds[ opt.duration ];
7567
7568 } else {
7569 opt.duration = jQuery.fx.speeds._default;
7570 }
7571 }
7572 }
7573
7574 // Normalize opt.queue - true/undefined/null -> "fx"
7575 if ( opt.queue == null || opt.queue === true ) {
7576 opt.queue = "fx";
7577 }
7578
7579 // Queueing
7580 opt.old = opt.complete;
7581
7582 opt.complete = function() {
7583 if ( isFunction( opt.old ) ) {
7584 opt.old.call( this );
7585 }
7586
7587 if ( opt.queue ) {
7588 jQuery.dequeue( this, opt.queue );
7589 }
7590 };
7591
7592 return opt;
7593};
7594
7595jQuery.fn.extend( {
7596 fadeTo: function( speed, to, easing, callback ) {
7597
7598 // Show any hidden elements after setting opacity to 0
7599 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
7600
7601 // Animate to the value specified
7602 .end().animate( { opacity: to }, speed, easing, callback );
7603 },
7604 animate: function( prop, speed, easing, callback ) {
7605 var empty = jQuery.isEmptyObject( prop ),
7606 optall = jQuery.speed( speed, easing, callback ),
7607 doAnimation = function() {
7608
7609 // Operate on a copy of prop so per-property easing won't be lost
7610 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
7611
7612 // Empty animations, or finishing resolves immediately
7613 if ( empty || dataPriv.get( this, "finish" ) ) {
7614 anim.stop( true );
7615 }
7616 };
7617 doAnimation.finish = doAnimation;
7618
7619 return empty || optall.queue === false ?
7620 this.each( doAnimation ) :
7621 this.queue( optall.queue, doAnimation );
7622 },
7623 stop: function( type, clearQueue, gotoEnd ) {
7624 var stopQueue = function( hooks ) {
7625 var stop = hooks.stop;
7626 delete hooks.stop;
7627 stop( gotoEnd );
7628 };
7629
7630 if ( typeof type !== "string" ) {
7631 gotoEnd = clearQueue;
7632 clearQueue = type;
7633 type = undefined;
7634 }
7635 if ( clearQueue && type !== false ) {
7636 this.queue( type || "fx", [] );
7637 }
7638
7639 return this.each( function() {
7640 var dequeue = true,
7641 index = type != null && type + "queueHooks",
7642 timers = jQuery.timers,
7643 data = dataPriv.get( this );
7644
7645 if ( index ) {
7646 if ( data[ index ] && data[ index ].stop ) {
7647 stopQueue( data[ index ] );
7648 }
7649 } else {
7650 for ( index in data ) {
7651 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
7652 stopQueue( data[ index ] );
7653 }
7654 }
7655 }
7656
7657 for ( index = timers.length; index--; ) {
7658 if ( timers[ index ].elem === this &&
7659 ( type == null || timers[ index ].queue === type ) ) {
7660
7661 timers[ index ].anim.stop( gotoEnd );
7662 dequeue = false;
7663 timers.splice( index, 1 );
7664 }
7665 }
7666
7667 // Start the next in the queue if the last step wasn't forced.
7668 // Timers currently will call their complete callbacks, which
7669 // will dequeue but only if they were gotoEnd.
7670 if ( dequeue || !gotoEnd ) {
7671 jQuery.dequeue( this, type );
7672 }
7673 } );
7674 },
7675 finish: function( type ) {
7676 if ( type !== false ) {
7677 type = type || "fx";
7678 }
7679 return this.each( function() {
7680 var index,
7681 data = dataPriv.get( this ),
7682 queue = data[ type + "queue" ],
7683 hooks = data[ type + "queueHooks" ],
7684 timers = jQuery.timers,
7685 length = queue ? queue.length : 0;
7686
7687 // Enable finishing flag on private data
7688 data.finish = true;
7689
7690 // Empty the queue first
7691 jQuery.queue( this, type, [] );
7692
7693 if ( hooks && hooks.stop ) {
7694 hooks.stop.call( this, true );
7695 }
7696
7697 // Look for any active animations, and finish them
7698 for ( index = timers.length; index--; ) {
7699 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
7700 timers[ index ].anim.stop( true );
7701 timers.splice( index, 1 );
7702 }
7703 }
7704
7705 // Look for any animations in the old queue and finish them
7706 for ( index = 0; index < length; index++ ) {
7707 if ( queue[ index ] && queue[ index ].finish ) {
7708 queue[ index ].finish.call( this );
7709 }
7710 }
7711
7712 // Turn off finishing flag
7713 delete data.finish;
7714 } );
7715 }
7716} );
7717
7718jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
7719 var cssFn = jQuery.fn[ name ];
7720 jQuery.fn[ name ] = function( speed, easing, callback ) {
7721 return speed == null || typeof speed === "boolean" ?
7722 cssFn.apply( this, arguments ) :
7723 this.animate( genFx( name, true ), speed, easing, callback );
7724 };
7725} );
7726
7727// Generate shortcuts for custom animations
7728jQuery.each( {
7729 slideDown: genFx( "show" ),
7730 slideUp: genFx( "hide" ),
7731 slideToggle: genFx( "toggle" ),
7732 fadeIn: { opacity: "show" },
7733 fadeOut: { opacity: "hide" },
7734 fadeToggle: { opacity: "toggle" }
7735}, function( name, props ) {
7736 jQuery.fn[ name ] = function( speed, easing, callback ) {
7737 return this.animate( props, speed, easing, callback );
7738 };
7739} );
7740
7741jQuery.timers = [];
7742jQuery.fx.tick = function() {
7743 var timer,
7744 i = 0,
7745 timers = jQuery.timers;
7746
7747 fxNow = Date.now();
7748
7749 for ( ; i < timers.length; i++ ) {
7750 timer = timers[ i ];
7751
7752 // Run the timer and safely remove it when done (allowing for external removal)
7753 if ( !timer() && timers[ i ] === timer ) {
7754 timers.splice( i--, 1 );
7755 }
7756 }
7757
7758 if ( !timers.length ) {
7759 jQuery.fx.stop();
7760 }
7761 fxNow = undefined;
7762};
7763
7764jQuery.fx.timer = function( timer ) {
7765 jQuery.timers.push( timer );
7766 jQuery.fx.start();
7767};
7768
7769jQuery.fx.interval = 13;
7770jQuery.fx.start = function() {
7771 if ( inProgress ) {
7772 return;
7773 }
7774
7775 inProgress = true;
7776 schedule();
7777};
7778
7779jQuery.fx.stop = function() {
7780 inProgress = null;
7781};
7782
7783jQuery.fx.speeds = {
7784 slow: 600,
7785 fast: 200,
7786
7787 // Default speed
7788 _default: 400
7789};
7790
7791
7792// Based off of the plugin by Clint Helfers, with permission.
7793// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
7794jQuery.fn.delay = function( time, type ) {
7795 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7796 type = type || "fx";
7797
7798 return this.queue( type, function( next, hooks ) {
7799 var timeout = window.setTimeout( next, time );
7800 hooks.stop = function() {
7801 window.clearTimeout( timeout );
7802 };
7803 } );
7804};
7805
7806
7807( function() {
7808 var input = document.createElement( "input" ),
7809 select = document.createElement( "select" ),
7810 opt = select.appendChild( document.createElement( "option" ) );
7811
7812 input.type = "checkbox";
7813
7814 // Support: Android <=4.3 only
7815 // Default value for a checkbox should be "on"
7816 support.checkOn = input.value !== "";
7817
7818 // Support: IE <=11 only
7819 // Must access selectedIndex to make default options select
7820 support.optSelected = opt.selected;
7821
7822 // Support: IE <=11 only
7823 // An input loses its value after becoming a radio
7824 input = document.createElement( "input" );
7825 input.value = "t";
7826 input.type = "radio";
7827 support.radioValue = input.value === "t";
7828} )();
7829
7830
7831var boolHook,
7832 attrHandle = jQuery.expr.attrHandle;
7833
7834jQuery.fn.extend( {
7835 attr: function( name, value ) {
7836 return access( this, jQuery.attr, name, value, arguments.length > 1 );
7837 },
7838
7839 removeAttr: function( name ) {
7840 return this.each( function() {
7841 jQuery.removeAttr( this, name );
7842 } );
7843 }
7844} );
7845
7846jQuery.extend( {
7847 attr: function( elem, name, value ) {
7848 var ret, hooks,
7849 nType = elem.nodeType;
7850
7851 // Don't get/set attributes on text, comment and attribute nodes
7852 if ( nType === 3 || nType === 8 || nType === 2 ) {
7853 return;
7854 }
7855
7856 // Fallback to prop when attributes are not supported
7857 if ( typeof elem.getAttribute === "undefined" ) {
7858 return jQuery.prop( elem, name, value );
7859 }
7860
7861 // Attribute hooks are determined by the lowercase version
7862 // Grab necessary hook if one is defined
7863 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7864 hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
7865 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
7866 }
7867
7868 if ( value !== undefined ) {
7869 if ( value === null ) {
7870 jQuery.removeAttr( elem, name );
7871 return;
7872 }
7873
7874 if ( hooks && "set" in hooks &&
7875 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7876 return ret;
7877 }
7878
7879 elem.setAttribute( name, value + "" );
7880 return value;
7881 }
7882
7883 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7884 return ret;
7885 }
7886
7887 ret = jQuery.find.attr( elem, name );
7888
7889 // Non-existent attributes return null, we normalize to undefined
7890 return ret == null ? undefined : ret;
7891 },
7892
7893 attrHooks: {
7894 type: {
7895 set: function( elem, value ) {
7896 if ( !support.radioValue && value === "radio" &&
7897 nodeName( elem, "input" ) ) {
7898 var val = elem.value;
7899 elem.setAttribute( "type", value );
7900 if ( val ) {
7901 elem.value = val;
7902 }
7903 return value;
7904 }
7905 }
7906 }
7907 },
7908
7909 removeAttr: function( elem, value ) {
7910 var name,
7911 i = 0,
7912
7913 // Attribute names can contain non-HTML whitespace characters
7914 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
7915 attrNames = value && value.match( rnothtmlwhite );
7916
7917 if ( attrNames && elem.nodeType === 1 ) {
7918 while ( ( name = attrNames[ i++ ] ) ) {
7919 elem.removeAttribute( name );
7920 }
7921 }
7922 }
7923} );
7924
7925// Hooks for boolean attributes
7926boolHook = {
7927 set: function( elem, value, name ) {
7928 if ( value === false ) {
7929
7930 // Remove boolean attributes when set to false
7931 jQuery.removeAttr( elem, name );
7932 } else {
7933 elem.setAttribute( name, name );
7934 }
7935 return name;
7936 }
7937};
7938
7939jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
7940 var getter = attrHandle[ name ] || jQuery.find.attr;
7941
7942 attrHandle[ name ] = function( elem, name, isXML ) {
7943 var ret, handle,
7944 lowercaseName = name.toLowerCase();
7945
7946 if ( !isXML ) {
7947
7948 // Avoid an infinite loop by temporarily removing this function from the getter
7949 handle = attrHandle[ lowercaseName ];
7950 attrHandle[ lowercaseName ] = ret;
7951 ret = getter( elem, name, isXML ) != null ?
7952 lowercaseName :
7953 null;
7954 attrHandle[ lowercaseName ] = handle;
7955 }
7956 return ret;
7957 };
7958} );
7959
7960
7961
7962
7963var rfocusable = /^(?:input|select|textarea|button)$/i,
7964 rclickable = /^(?:a|area)$/i;
7965
7966jQuery.fn.extend( {
7967 prop: function( name, value ) {
7968 return access( this, jQuery.prop, name, value, arguments.length > 1 );
7969 },
7970
7971 removeProp: function( name ) {
7972 return this.each( function() {
7973 delete this[ jQuery.propFix[ name ] || name ];
7974 } );
7975 }
7976} );
7977
7978jQuery.extend( {
7979 prop: function( elem, name, value ) {
7980 var ret, hooks,
7981 nType = elem.nodeType;
7982
7983 // Don't get/set properties on text, comment and attribute nodes
7984 if ( nType === 3 || nType === 8 || nType === 2 ) {
7985 return;
7986 }
7987
7988 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7989
7990 // Fix name and attach hooks
7991 name = jQuery.propFix[ name ] || name;
7992 hooks = jQuery.propHooks[ name ];
7993 }
7994
7995 if ( value !== undefined ) {
7996 if ( hooks && "set" in hooks &&
7997 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7998 return ret;
7999 }
8000
8001 return ( elem[ name ] = value );
8002 }
8003
8004 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
8005 return ret;
8006 }
8007
8008 return elem[ name ];
8009 },
8010
8011 propHooks: {
8012 tabIndex: {
8013 get: function( elem ) {
8014
8015 // Support: IE <=9 - 11 only
8016 // elem.tabIndex doesn't always return the
8017 // correct value when it hasn't been explicitly set
8018 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
8019 // Use proper attribute retrieval(#12072)
8020 var tabindex = jQuery.find.attr( elem, "tabindex" );
8021
8022 if ( tabindex ) {
8023 return parseInt( tabindex, 10 );
8024 }
8025
8026 if (
8027 rfocusable.test( elem.nodeName ) ||
8028 rclickable.test( elem.nodeName ) &&
8029 elem.href
8030 ) {
8031 return 0;
8032 }
8033
8034 return -1;
8035 }
8036 }
8037 },
8038
8039 propFix: {
8040 "for": "htmlFor",
8041 "class": "className"
8042 }
8043} );
8044
8045// Support: IE <=11 only
8046// Accessing the selectedIndex property
8047// forces the browser to respect setting selected
8048// on the option
8049// The getter ensures a default option is selected
8050// when in an optgroup
8051// eslint rule "no-unused-expressions" is disabled for this code
8052// since it considers such accessions noop
8053if ( !support.optSelected ) {
8054 jQuery.propHooks.selected = {
8055 get: function( elem ) {
8056
8057 /* eslint no-unused-expressions: "off" */
8058
8059 var parent = elem.parentNode;
8060 if ( parent && parent.parentNode ) {
8061 parent.parentNode.selectedIndex;
8062 }
8063 return null;
8064 },
8065 set: function( elem ) {
8066
8067 /* eslint no-unused-expressions: "off" */
8068
8069 var parent = elem.parentNode;
8070 if ( parent ) {
8071 parent.selectedIndex;
8072
8073 if ( parent.parentNode ) {
8074 parent.parentNode.selectedIndex;
8075 }
8076 }
8077 }
8078 };
8079}
8080
8081jQuery.each( [
8082 "tabIndex",
8083 "readOnly",
8084 "maxLength",
8085 "cellSpacing",
8086 "cellPadding",
8087 "rowSpan",
8088 "colSpan",
8089 "useMap",
8090 "frameBorder",
8091 "contentEditable"
8092], function() {
8093 jQuery.propFix[ this.toLowerCase() ] = this;
8094} );
8095
8096
8097
8098
8099 // Strip and collapse whitespace according to HTML spec
8100 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
8101 function stripAndCollapse( value ) {
8102 var tokens = value.match( rnothtmlwhite ) || [];
8103 return tokens.join( " " );
8104 }
8105
8106
8107function getClass( elem ) {
8108 return elem.getAttribute && elem.getAttribute( "class" ) || "";
8109}
8110
8111function classesToArray( value ) {
8112 if ( Array.isArray( value ) ) {
8113 return value;
8114 }
8115 if ( typeof value === "string" ) {
8116 return value.match( rnothtmlwhite ) || [];
8117 }
8118 return [];
8119}
8120
8121jQuery.fn.extend( {
8122 addClass: function( value ) {
8123 var classes, elem, cur, curValue, clazz, j, finalValue,
8124 i = 0;
8125
8126 if ( isFunction( value ) ) {
8127 return this.each( function( j ) {
8128 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
8129 } );
8130 }
8131
8132 classes = classesToArray( value );
8133
8134 if ( classes.length ) {
8135 while ( ( elem = this[ i++ ] ) ) {
8136 curValue = getClass( elem );
8137 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
8138
8139 if ( cur ) {
8140 j = 0;
8141 while ( ( clazz = classes[ j++ ] ) ) {
8142 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
8143 cur += clazz + " ";
8144 }
8145 }
8146
8147 // Only assign if different to avoid unneeded rendering.
8148 finalValue = stripAndCollapse( cur );
8149 if ( curValue !== finalValue ) {
8150 elem.setAttribute( "class", finalValue );
8151 }
8152 }
8153 }
8154 }
8155
8156 return this;
8157 },
8158
8159 removeClass: function( value ) {
8160 var classes, elem, cur, curValue, clazz, j, finalValue,
8161 i = 0;
8162
8163 if ( isFunction( value ) ) {
8164 return this.each( function( j ) {
8165 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
8166 } );
8167 }
8168
8169 if ( !arguments.length ) {
8170 return this.attr( "class", "" );
8171 }
8172
8173 classes = classesToArray( value );
8174
8175 if ( classes.length ) {
8176 while ( ( elem = this[ i++ ] ) ) {
8177 curValue = getClass( elem );
8178
8179 // This expression is here for better compressibility (see addClass)
8180 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
8181
8182 if ( cur ) {
8183 j = 0;
8184 while ( ( clazz = classes[ j++ ] ) ) {
8185
8186 // Remove *all* instances
8187 while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
8188 cur = cur.replace( " " + clazz + " ", " " );
8189 }
8190 }
8191
8192 // Only assign if different to avoid unneeded rendering.
8193 finalValue = stripAndCollapse( cur );
8194 if ( curValue !== finalValue ) {
8195 elem.setAttribute( "class", finalValue );
8196 }
8197 }
8198 }
8199 }
8200
8201 return this;
8202 },
8203
8204 toggleClass: function( value, stateVal ) {
8205 var type = typeof value,
8206 isValidValue = type === "string" || Array.isArray( value );
8207
8208 if ( typeof stateVal === "boolean" && isValidValue ) {
8209 return stateVal ? this.addClass( value ) : this.removeClass( value );
8210 }
8211
8212 if ( isFunction( value ) ) {
8213 return this.each( function( i ) {
8214 jQuery( this ).toggleClass(
8215 value.call( this, i, getClass( this ), stateVal ),
8216 stateVal
8217 );
8218 } );
8219 }
8220
8221 return this.each( function() {
8222 var className, i, self, classNames;
8223
8224 if ( isValidValue ) {
8225
8226 // Toggle individual class names
8227 i = 0;
8228 self = jQuery( this );
8229 classNames = classesToArray( value );
8230
8231 while ( ( className = classNames[ i++ ] ) ) {
8232
8233 // Check each className given, space separated list
8234 if ( self.hasClass( className ) ) {
8235 self.removeClass( className );
8236 } else {
8237 self.addClass( className );
8238 }
8239 }
8240
8241 // Toggle whole class name
8242 } else if ( value === undefined || type === "boolean" ) {
8243 className = getClass( this );
8244 if ( className ) {
8245
8246 // Store className if set
8247 dataPriv.set( this, "__className__", className );
8248 }
8249
8250 // If the element has a class name or if we're passed `false`,
8251 // then remove the whole classname (if there was one, the above saved it).
8252 // Otherwise bring back whatever was previously saved (if anything),
8253 // falling back to the empty string if nothing was stored.
8254 if ( this.setAttribute ) {
8255 this.setAttribute( "class",
8256 className || value === false ?
8257 "" :
8258 dataPriv.get( this, "__className__" ) || ""
8259 );
8260 }
8261 }
8262 } );
8263 },
8264
8265 hasClass: function( selector ) {
8266 var className, elem,
8267 i = 0;
8268
8269 className = " " + selector + " ";
8270 while ( ( elem = this[ i++ ] ) ) {
8271 if ( elem.nodeType === 1 &&
8272 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
8273 return true;
8274 }
8275 }
8276
8277 return false;
8278 }
8279} );
8280
8281
8282
8283
8284var rreturn = /\r/g;
8285
8286jQuery.fn.extend( {
8287 val: function( value ) {
8288 var hooks, ret, valueIsFunction,
8289 elem = this[ 0 ];
8290
8291 if ( !arguments.length ) {
8292 if ( elem ) {
8293 hooks = jQuery.valHooks[ elem.type ] ||
8294 jQuery.valHooks[ elem.nodeName.toLowerCase() ];
8295
8296 if ( hooks &&
8297 "get" in hooks &&
8298 ( ret = hooks.get( elem, "value" ) ) !== undefined
8299 ) {
8300 return ret;
8301 }
8302
8303 ret = elem.value;
8304
8305 // Handle most common string cases
8306 if ( typeof ret === "string" ) {
8307 return ret.replace( rreturn, "" );
8308 }
8309
8310 // Handle cases where value is null/undef or number
8311 return ret == null ? "" : ret;
8312 }
8313
8314 return;
8315 }
8316
8317 valueIsFunction = isFunction( value );
8318
8319 return this.each( function( i ) {
8320 var val;
8321
8322 if ( this.nodeType !== 1 ) {
8323 return;
8324 }
8325
8326 if ( valueIsFunction ) {
8327 val = value.call( this, i, jQuery( this ).val() );
8328 } else {
8329 val = value;
8330 }
8331
8332 // Treat null/undefined as ""; convert numbers to string
8333 if ( val == null ) {
8334 val = "";
8335
8336 } else if ( typeof val === "number" ) {
8337 val += "";
8338
8339 } else if ( Array.isArray( val ) ) {
8340 val = jQuery.map( val, function( value ) {
8341 return value == null ? "" : value + "";
8342 } );
8343 }
8344
8345 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
8346
8347 // If set returns undefined, fall back to normal setting
8348 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
8349 this.value = val;
8350 }
8351 } );
8352 }
8353} );
8354
8355jQuery.extend( {
8356 valHooks: {
8357 option: {
8358 get: function( elem ) {
8359
8360 var val = jQuery.find.attr( elem, "value" );
8361 return val != null ?
8362 val :
8363
8364 // Support: IE <=10 - 11 only
8365 // option.text throws exceptions (#14686, #14858)
8366 // Strip and collapse whitespace
8367 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
8368 stripAndCollapse( jQuery.text( elem ) );
8369 }
8370 },
8371 select: {
8372 get: function( elem ) {
8373 var value, option, i,
8374 options = elem.options,
8375 index = elem.selectedIndex,
8376 one = elem.type === "select-one",
8377 values = one ? null : [],
8378 max = one ? index + 1 : options.length;
8379
8380 if ( index < 0 ) {
8381 i = max;
8382
8383 } else {
8384 i = one ? index : 0;
8385 }
8386
8387 // Loop through all the selected options
8388 for ( ; i < max; i++ ) {
8389 option = options[ i ];
8390
8391 // Support: IE <=9 only
8392 // IE8-9 doesn't update selected after form reset (#2551)
8393 if ( ( option.selected || i === index ) &&
8394
8395 // Don't return options that are disabled or in a disabled optgroup
8396 !option.disabled &&
8397 ( !option.parentNode.disabled ||
8398 !nodeName( option.parentNode, "optgroup" ) ) ) {
8399
8400 // Get the specific value for the option
8401 value = jQuery( option ).val();
8402
8403 // We don't need an array for one selects
8404 if ( one ) {
8405 return value;
8406 }
8407
8408 // Multi-Selects return an array
8409 values.push( value );
8410 }
8411 }
8412
8413 return values;
8414 },
8415
8416 set: function( elem, value ) {
8417 var optionSet, option,
8418 options = elem.options,
8419 values = jQuery.makeArray( value ),
8420 i = options.length;
8421
8422 while ( i-- ) {
8423 option = options[ i ];
8424
8425 /* eslint-disable no-cond-assign */
8426
8427 if ( option.selected =
8428 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
8429 ) {
8430 optionSet = true;
8431 }
8432
8433 /* eslint-enable no-cond-assign */
8434 }
8435
8436 // Force browsers to behave consistently when non-matching value is set
8437 if ( !optionSet ) {
8438 elem.selectedIndex = -1;
8439 }
8440 return values;
8441 }
8442 }
8443 }
8444} );
8445
8446// Radios and checkboxes getter/setter
8447jQuery.each( [ "radio", "checkbox" ], function() {
8448 jQuery.valHooks[ this ] = {
8449 set: function( elem, value ) {
8450 if ( Array.isArray( value ) ) {
8451 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
8452 }
8453 }
8454 };
8455 if ( !support.checkOn ) {
8456 jQuery.valHooks[ this ].get = function( elem ) {
8457 return elem.getAttribute( "value" ) === null ? "on" : elem.value;
8458 };
8459 }
8460} );
8461
8462
8463
8464
8465// Return jQuery for attributes-only inclusion
8466
8467
8468support.focusin = "onfocusin" in window;
8469
8470
8471var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
8472 stopPropagationCallback = function( e ) {
8473 e.stopPropagation();
8474 };
8475
8476jQuery.extend( jQuery.event, {
8477
8478 trigger: function( event, data, elem, onlyHandlers ) {
8479
8480 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
8481 eventPath = [ elem || document ],
8482 type = hasOwn.call( event, "type" ) ? event.type : event,
8483 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
8484
8485 cur = lastElement = tmp = elem = elem || document;
8486
8487 // Don't do events on text and comment nodes
8488 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
8489 return;
8490 }
8491
8492 // focus/blur morphs to focusin/out; ensure we're not firing them right now
8493 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
8494 return;
8495 }
8496
8497 if ( type.indexOf( "." ) > -1 ) {
8498
8499 // Namespaced trigger; create a regexp to match event type in handle()
8500 namespaces = type.split( "." );
8501 type = namespaces.shift();
8502 namespaces.sort();
8503 }
8504 ontype = type.indexOf( ":" ) < 0 && "on" + type;
8505
8506 // Caller can pass in a jQuery.Event object, Object, or just an event type string
8507 event = event[ jQuery.expando ] ?
8508 event :
8509 new jQuery.Event( type, typeof event === "object" && event );
8510
8511 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
8512 event.isTrigger = onlyHandlers ? 2 : 3;
8513 event.namespace = namespaces.join( "." );
8514 event.rnamespace = event.namespace ?
8515 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
8516 null;
8517
8518 // Clean up the event in case it is being reused
8519 event.result = undefined;
8520 if ( !event.target ) {
8521 event.target = elem;
8522 }
8523
8524 // Clone any incoming data and prepend the event, creating the handler arg list
8525 data = data == null ?
8526 [ event ] :
8527 jQuery.makeArray( data, [ event ] );
8528
8529 // Allow special events to draw outside the lines
8530 special = jQuery.event.special[ type ] || {};
8531 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
8532 return;
8533 }
8534
8535 // Determine event propagation path in advance, per W3C events spec (#9951)
8536 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
8537 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
8538
8539 bubbleType = special.delegateType || type;
8540 if ( !rfocusMorph.test( bubbleType + type ) ) {
8541 cur = cur.parentNode;
8542 }
8543 for ( ; cur; cur = cur.parentNode ) {
8544 eventPath.push( cur );
8545 tmp = cur;
8546 }
8547
8548 // Only add window if we got to document (e.g., not plain obj or detached DOM)
8549 if ( tmp === ( elem.ownerDocument || document ) ) {
8550 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
8551 }
8552 }
8553
8554 // Fire handlers on the event path
8555 i = 0;
8556 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
8557 lastElement = cur;
8558 event.type = i > 1 ?
8559 bubbleType :
8560 special.bindType || type;
8561
8562 // jQuery handler
8563 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
8564 dataPriv.get( cur, "handle" );
8565 if ( handle ) {
8566 handle.apply( cur, data );
8567 }
8568
8569 // Native handler
8570 handle = ontype && cur[ ontype ];
8571 if ( handle && handle.apply && acceptData( cur ) ) {
8572 event.result = handle.apply( cur, data );
8573 if ( event.result === false ) {
8574 event.preventDefault();
8575 }
8576 }
8577 }
8578 event.type = type;
8579
8580 // If nobody prevented the default action, do it now
8581 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
8582
8583 if ( ( !special._default ||
8584 special._default.apply( eventPath.pop(), data ) === false ) &&
8585 acceptData( elem ) ) {
8586
8587 // Call a native DOM method on the target with the same name as the event.
8588 // Don't do default actions on window, that's where global variables be (#6170)
8589 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
8590
8591 // Don't re-trigger an onFOO event when we call its FOO() method
8592 tmp = elem[ ontype ];
8593
8594 if ( tmp ) {
8595 elem[ ontype ] = null;
8596 }
8597
8598 // Prevent re-triggering of the same event, since we already bubbled it above
8599 jQuery.event.triggered = type;
8600
8601 if ( event.isPropagationStopped() ) {
8602 lastElement.addEventListener( type, stopPropagationCallback );
8603 }
8604
8605 elem[ type ]();
8606
8607 if ( event.isPropagationStopped() ) {
8608 lastElement.removeEventListener( type, stopPropagationCallback );
8609 }
8610
8611 jQuery.event.triggered = undefined;
8612
8613 if ( tmp ) {
8614 elem[ ontype ] = tmp;
8615 }
8616 }
8617 }
8618 }
8619
8620 return event.result;
8621 },
8622
8623 // Piggyback on a donor event to simulate a different one
8624 // Used only for `focus(in | out)` events
8625 simulate: function( type, elem, event ) {
8626 var e = jQuery.extend(
8627 new jQuery.Event(),
8628 event,
8629 {
8630 type: type,
8631 isSimulated: true
8632 }
8633 );
8634
8635 jQuery.event.trigger( e, null, elem );
8636 }
8637
8638} );
8639
8640jQuery.fn.extend( {
8641
8642 trigger: function( type, data ) {
8643 return this.each( function() {
8644 jQuery.event.trigger( type, data, this );
8645 } );
8646 },
8647 triggerHandler: function( type, data ) {
8648 var elem = this[ 0 ];
8649 if ( elem ) {
8650 return jQuery.event.trigger( type, data, elem, true );
8651 }
8652 }
8653} );
8654
8655
8656// Support: Firefox <=44
8657// Firefox doesn't have focus(in | out) events
8658// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
8659//
8660// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
8661// focus(in | out) events fire after focus & blur events,
8662// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
8663// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
8664if ( !support.focusin ) {
8665 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
8666
8667 // Attach a single capturing handler on the document while someone wants focusin/focusout
8668 var handler = function( event ) {
8669 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
8670 };
8671
8672 jQuery.event.special[ fix ] = {
8673 setup: function() {
8674 var doc = this.ownerDocument || this,
8675 attaches = dataPriv.access( doc, fix );
8676
8677 if ( !attaches ) {
8678 doc.addEventListener( orig, handler, true );
8679 }
8680 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8681 },
8682 teardown: function() {
8683 var doc = this.ownerDocument || this,
8684 attaches = dataPriv.access( doc, fix ) - 1;
8685
8686 if ( !attaches ) {
8687 doc.removeEventListener( orig, handler, true );
8688 dataPriv.remove( doc, fix );
8689
8690 } else {
8691 dataPriv.access( doc, fix, attaches );
8692 }
8693 }
8694 };
8695 } );
8696}
8697var location = window.location;
8698
8699var nonce = Date.now();
8700
8701var rquery = ( /\?/ );
8702
8703
8704
8705// Cross-browser xml parsing
8706jQuery.parseXML = function( data ) {
8707 var xml;
8708 if ( !data || typeof data !== "string" ) {
8709 return null;
8710 }
8711
8712 // Support: IE 9 - 11 only
8713 // IE throws on parseFromString with invalid input.
8714 try {
8715 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8716 } catch ( e ) {
8717 xml = undefined;
8718 }
8719
8720 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
8721 jQuery.error( "Invalid XML: " + data );
8722 }
8723 return xml;
8724};
8725
8726
8727var
8728 rbracket = /\[\]$/,
8729 rCRLF = /\r?\n/g,
8730 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
8731 rsubmittable = /^(?:input|select|textarea|keygen)/i;
8732
8733function buildParams( prefix, obj, traditional, add ) {
8734 var name;
8735
8736 if ( Array.isArray( obj ) ) {
8737
8738 // Serialize array item.
8739 jQuery.each( obj, function( i, v ) {
8740 if ( traditional || rbracket.test( prefix ) ) {
8741
8742 // Treat each array item as a scalar.
8743 add( prefix, v );
8744
8745 } else {
8746
8747 // Item is non-scalar (array or object), encode its numeric index.
8748 buildParams(
8749 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
8750 v,
8751 traditional,
8752 add
8753 );
8754 }
8755 } );
8756
8757 } else if ( !traditional && toType( obj ) === "object" ) {
8758
8759 // Serialize object item.
8760 for ( name in obj ) {
8761 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8762 }
8763
8764 } else {
8765
8766 // Serialize scalar item.
8767 add( prefix, obj );
8768 }
8769}
8770
8771// Serialize an array of form elements or a set of
8772// key/values into a query string
8773jQuery.param = function( a, traditional ) {
8774 var prefix,
8775 s = [],
8776 add = function( key, valueOrFunction ) {
8777
8778 // If value is a function, invoke it and use its return value
8779 var value = isFunction( valueOrFunction ) ?
8780 valueOrFunction() :
8781 valueOrFunction;
8782
8783 s[ s.length ] = encodeURIComponent( key ) + "=" +
8784 encodeURIComponent( value == null ? "" : value );
8785 };
8786
8787 if ( a == null ) {
8788 return "";
8789 }
8790
8791 // If an array was passed in, assume that it is an array of form elements.
8792 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8793
8794 // Serialize the form elements
8795 jQuery.each( a, function() {
8796 add( this.name, this.value );
8797 } );
8798
8799 } else {
8800
8801 // If traditional, encode the "old" way (the way 1.3.2 or older
8802 // did it), otherwise encode params recursively.
8803 for ( prefix in a ) {
8804 buildParams( prefix, a[ prefix ], traditional, add );
8805 }
8806 }
8807
8808 // Return the resulting serialization
8809 return s.join( "&" );
8810};
8811
8812jQuery.fn.extend( {
8813 serialize: function() {
8814 return jQuery.param( this.serializeArray() );
8815 },
8816 serializeArray: function() {
8817 return this.map( function() {
8818
8819 // Can add propHook for "elements" to filter or add form elements
8820 var elements = jQuery.prop( this, "elements" );
8821 return elements ? jQuery.makeArray( elements ) : this;
8822 } )
8823 .filter( function() {
8824 var type = this.type;
8825
8826 // Use .is( ":disabled" ) so that fieldset[disabled] works
8827 return this.name && !jQuery( this ).is( ":disabled" ) &&
8828 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8829 ( this.checked || !rcheckableType.test( type ) );
8830 } )
8831 .map( function( i, elem ) {
8832 var val = jQuery( this ).val();
8833
8834 if ( val == null ) {
8835 return null;
8836 }
8837
8838 if ( Array.isArray( val ) ) {
8839 return jQuery.map( val, function( val ) {
8840 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8841 } );
8842 }
8843
8844 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8845 } ).get();
8846 }
8847} );
8848
8849
8850var
8851 r20 = /%20/g,
8852 rhash = /#.*$/,
8853 rantiCache = /([?&])_=[^&]*/,
8854 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
8855
8856 // #7653, #8125, #8152: local protocol detection
8857 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
8858 rnoContent = /^(?:GET|HEAD)$/,
8859 rprotocol = /^\/\//,
8860
8861 /* Prefilters
8862 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
8863 * 2) These are called:
8864 * - BEFORE asking for a transport
8865 * - AFTER param serialization (s.data is a string if s.processData is true)
8866 * 3) key is the dataType
8867 * 4) the catchall symbol "*" can be used
8868 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
8869 */
8870 prefilters = {},
8871
8872 /* Transports bindings
8873 * 1) key is the dataType
8874 * 2) the catchall symbol "*" can be used
8875 * 3) selection will start with transport dataType and THEN go to "*" if needed
8876 */
8877 transports = {},
8878
8879 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
8880 allTypes = "*/".concat( "*" ),
8881
8882 // Anchor tag for parsing the document origin
8883 originAnchor = document.createElement( "a" );
8884 originAnchor.href = location.href;
8885
8886// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
8887function addToPrefiltersOrTransports( structure ) {
8888
8889 // dataTypeExpression is optional and defaults to "*"
8890 return function( dataTypeExpression, func ) {
8891
8892 if ( typeof dataTypeExpression !== "string" ) {
8893 func = dataTypeExpression;
8894 dataTypeExpression = "*";
8895 }
8896
8897 var dataType,
8898 i = 0,
8899 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
8900
8901 if ( isFunction( func ) ) {
8902
8903 // For each dataType in the dataTypeExpression
8904 while ( ( dataType = dataTypes[ i++ ] ) ) {
8905
8906 // Prepend if requested
8907 if ( dataType[ 0 ] === "+" ) {
8908 dataType = dataType.slice( 1 ) || "*";
8909 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
8910
8911 // Otherwise append
8912 } else {
8913 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
8914 }
8915 }
8916 }
8917 };
8918}
8919
8920// Base inspection function for prefilters and transports
8921function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
8922
8923 var inspected = {},
8924 seekingTransport = ( structure === transports );
8925
8926 function inspect( dataType ) {
8927 var selected;
8928 inspected[ dataType ] = true;
8929 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
8930 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
8931 if ( typeof dataTypeOrTransport === "string" &&
8932 !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
8933
8934 options.dataTypes.unshift( dataTypeOrTransport );
8935 inspect( dataTypeOrTransport );
8936 return false;
8937 } else if ( seekingTransport ) {
8938 return !( selected = dataTypeOrTransport );
8939 }
8940 } );
8941 return selected;
8942 }
8943
8944 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
8945}
8946
8947// A special extend for ajax options
8948// that takes "flat" options (not to be deep extended)
8949// Fixes #9887
8950function ajaxExtend( target, src ) {
8951 var key, deep,
8952 flatOptions = jQuery.ajaxSettings.flatOptions || {};
8953
8954 for ( key in src ) {
8955 if ( src[ key ] !== undefined ) {
8956 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
8957 }
8958 }
8959 if ( deep ) {
8960 jQuery.extend( true, target, deep );
8961 }
8962
8963 return target;
8964}
8965
8966/* Handles responses to an ajax request:
8967 * - finds the right dataType (mediates between content-type and expected dataType)
8968 * - returns the corresponding response
8969 */
8970function ajaxHandleResponses( s, jqXHR, responses ) {
8971
8972 var ct, type, finalDataType, firstDataType,
8973 contents = s.contents,
8974 dataTypes = s.dataTypes;
8975
8976 // Remove auto dataType and get content-type in the process
8977 while ( dataTypes[ 0 ] === "*" ) {
8978 dataTypes.shift();
8979 if ( ct === undefined ) {
8980 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
8981 }
8982 }
8983
8984 // Check if we're dealing with a known content-type
8985 if ( ct ) {
8986 for ( type in contents ) {
8987 if ( contents[ type ] && contents[ type ].test( ct ) ) {
8988 dataTypes.unshift( type );
8989 break;
8990 }
8991 }
8992 }
8993
8994 // Check to see if we have a response for the expected dataType
8995 if ( dataTypes[ 0 ] in responses ) {
8996 finalDataType = dataTypes[ 0 ];
8997 } else {
8998
8999 // Try convertible dataTypes
9000 for ( type in responses ) {
9001 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
9002 finalDataType = type;
9003 break;
9004 }
9005 if ( !firstDataType ) {
9006 firstDataType = type;
9007 }
9008 }
9009
9010 // Or just use first one
9011 finalDataType = finalDataType || firstDataType;
9012 }
9013
9014 // If we found a dataType
9015 // We add the dataType to the list if needed
9016 // and return the corresponding response
9017 if ( finalDataType ) {
9018 if ( finalDataType !== dataTypes[ 0 ] ) {
9019 dataTypes.unshift( finalDataType );
9020 }
9021 return responses[ finalDataType ];
9022 }
9023}
9024
9025/* Chain conversions given the request and the original response
9026 * Also sets the responseXXX fields on the jqXHR instance
9027 */
9028function ajaxConvert( s, response, jqXHR, isSuccess ) {
9029 var conv2, current, conv, tmp, prev,
9030 converters = {},
9031
9032 // Work with a copy of dataTypes in case we need to modify it for conversion
9033 dataTypes = s.dataTypes.slice();
9034
9035 // Create converters map with lowercased keys
9036 if ( dataTypes[ 1 ] ) {
9037 for ( conv in s.converters ) {
9038 converters[ conv.toLowerCase() ] = s.converters[ conv ];
9039 }
9040 }
9041
9042 current = dataTypes.shift();
9043
9044 // Convert to each sequential dataType
9045 while ( current ) {
9046
9047 if ( s.responseFields[ current ] ) {
9048 jqXHR[ s.responseFields[ current ] ] = response;
9049 }
9050
9051 // Apply the dataFilter if provided
9052 if ( !prev && isSuccess && s.dataFilter ) {
9053 response = s.dataFilter( response, s.dataType );
9054 }
9055
9056 prev = current;
9057 current = dataTypes.shift();
9058
9059 if ( current ) {
9060
9061 // There's only work to do if current dataType is non-auto
9062 if ( current === "*" ) {
9063
9064 current = prev;
9065
9066 // Convert response if prev dataType is non-auto and differs from current
9067 } else if ( prev !== "*" && prev !== current ) {
9068
9069 // Seek a direct converter
9070 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
9071
9072 // If none found, seek a pair
9073 if ( !conv ) {
9074 for ( conv2 in converters ) {
9075
9076 // If conv2 outputs current
9077 tmp = conv2.split( " " );
9078 if ( tmp[ 1 ] === current ) {
9079
9080 // If prev can be converted to accepted input
9081 conv = converters[ prev + " " + tmp[ 0 ] ] ||
9082 converters[ "* " + tmp[ 0 ] ];
9083 if ( conv ) {
9084
9085 // Condense equivalence converters
9086 if ( conv === true ) {
9087 conv = converters[ conv2 ];
9088
9089 // Otherwise, insert the intermediate dataType
9090 } else if ( converters[ conv2 ] !== true ) {
9091 current = tmp[ 0 ];
9092 dataTypes.unshift( tmp[ 1 ] );
9093 }
9094 break;
9095 }
9096 }
9097 }
9098 }
9099
9100 // Apply converter (if not an equivalence)
9101 if ( conv !== true ) {
9102
9103 // Unless errors are allowed to bubble, catch and return them
9104 if ( conv && s.throws ) {
9105 response = conv( response );
9106 } else {
9107 try {
9108 response = conv( response );
9109 } catch ( e ) {
9110 return {
9111 state: "parsererror",
9112 error: conv ? e : "No conversion from " + prev + " to " + current
9113 };
9114 }
9115 }
9116 }
9117 }
9118 }
9119 }
9120
9121 return { state: "success", data: response };
9122}
9123
9124jQuery.extend( {
9125
9126 // Counter for holding the number of active queries
9127 active: 0,
9128
9129 // Last-Modified header cache for next request
9130 lastModified: {},
9131 etag: {},
9132
9133 ajaxSettings: {
9134 url: location.href,
9135 type: "GET",
9136 isLocal: rlocalProtocol.test( location.protocol ),
9137 global: true,
9138 processData: true,
9139 async: true,
9140 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
9141
9142 /*
9143 timeout: 0,
9144 data: null,
9145 dataType: null,
9146 username: null,
9147 password: null,
9148 cache: null,
9149 throws: false,
9150 traditional: false,
9151 headers: {},
9152 */
9153
9154 accepts: {
9155 "*": allTypes,
9156 text: "text/plain",
9157 html: "text/html",
9158 xml: "application/xml, text/xml",
9159 json: "application/json, text/javascript"
9160 },
9161
9162 contents: {
9163 xml: /\bxml\b/,
9164 html: /\bhtml/,
9165 json: /\bjson\b/
9166 },
9167
9168 responseFields: {
9169 xml: "responseXML",
9170 text: "responseText",
9171 json: "responseJSON"
9172 },
9173
9174 // Data converters
9175 // Keys separate source (or catchall "*") and destination types with a single space
9176 converters: {
9177
9178 // Convert anything to text
9179 "* text": String,
9180
9181 // Text to html (true = no transformation)
9182 "text html": true,
9183
9184 // Evaluate text as a json expression
9185 "text json": JSON.parse,
9186
9187 // Parse text as xml
9188 "text xml": jQuery.parseXML
9189 },
9190
9191 // For options that shouldn't be deep extended:
9192 // you can add your own custom options here if
9193 // and when you create one that shouldn't be
9194 // deep extended (see ajaxExtend)
9195 flatOptions: {
9196 url: true,
9197 context: true
9198 }
9199 },
9200
9201 // Creates a full fledged settings object into target
9202 // with both ajaxSettings and settings fields.
9203 // If target is omitted, writes into ajaxSettings.
9204 ajaxSetup: function( target, settings ) {
9205 return settings ?
9206
9207 // Building a settings object
9208 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
9209
9210 // Extending ajaxSettings
9211 ajaxExtend( jQuery.ajaxSettings, target );
9212 },
9213
9214 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
9215 ajaxTransport: addToPrefiltersOrTransports( transports ),
9216
9217 // Main method
9218 ajax: function( url, options ) {
9219
9220 // If url is an object, simulate pre-1.5 signature
9221 if ( typeof url === "object" ) {
9222 options = url;
9223 url = undefined;
9224 }
9225
9226 // Force options to be an object
9227 options = options || {};
9228
9229 var transport,
9230
9231 // URL without anti-cache param
9232 cacheURL,
9233
9234 // Response headers
9235 responseHeadersString,
9236 responseHeaders,
9237
9238 // timeout handle
9239 timeoutTimer,
9240
9241 // Url cleanup var
9242 urlAnchor,
9243
9244 // Request state (becomes false upon send and true upon completion)
9245 completed,
9246
9247 // To know if global events are to be dispatched
9248 fireGlobals,
9249
9250 // Loop variable
9251 i,
9252
9253 // uncached part of the url
9254 uncached,
9255
9256 // Create the final options object
9257 s = jQuery.ajaxSetup( {}, options ),
9258
9259 // Callbacks context
9260 callbackContext = s.context || s,
9261
9262 // Context for global events is callbackContext if it is a DOM node or jQuery collection
9263 globalEventContext = s.context &&
9264 ( callbackContext.nodeType || callbackContext.jquery ) ?
9265 jQuery( callbackContext ) :
9266 jQuery.event,
9267
9268 // Deferreds
9269 deferred = jQuery.Deferred(),
9270 completeDeferred = jQuery.Callbacks( "once memory" ),
9271
9272 // Status-dependent callbacks
9273 statusCode = s.statusCode || {},
9274
9275 // Headers (they are sent all at once)
9276 requestHeaders = {},
9277 requestHeadersNames = {},
9278
9279 // Default abort message
9280 strAbort = "canceled",
9281
9282 // Fake xhr
9283 jqXHR = {
9284 readyState: 0,
9285
9286 // Builds headers hashtable if needed
9287 getResponseHeader: function( key ) {
9288 var match;
9289 if ( completed ) {
9290 if ( !responseHeaders ) {
9291 responseHeaders = {};
9292 while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
9293 responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
9294 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
9295 .concat( match[ 2 ] );
9296 }
9297 }
9298 match = responseHeaders[ key.toLowerCase() + " " ];
9299 }
9300 return match == null ? null : match.join( ", " );
9301 },
9302
9303 // Raw string
9304 getAllResponseHeaders: function() {
9305 return completed ? responseHeadersString : null;
9306 },
9307
9308 // Caches the header
9309 setRequestHeader: function( name, value ) {
9310 if ( completed == null ) {
9311 name = requestHeadersNames[ name.toLowerCase() ] =
9312 requestHeadersNames[ name.toLowerCase() ] || name;
9313 requestHeaders[ name ] = value;
9314 }
9315 return this;
9316 },
9317
9318 // Overrides response content-type header
9319 overrideMimeType: function( type ) {
9320 if ( completed == null ) {
9321 s.mimeType = type;
9322 }
9323 return this;
9324 },
9325
9326 // Status-dependent callbacks
9327 statusCode: function( map ) {
9328 var code;
9329 if ( map ) {
9330 if ( completed ) {
9331
9332 // Execute the appropriate callbacks
9333 jqXHR.always( map[ jqXHR.status ] );
9334 } else {
9335
9336 // Lazy-add the new callbacks in a way that preserves old ones
9337 for ( code in map ) {
9338 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
9339 }
9340 }
9341 }
9342 return this;
9343 },
9344
9345 // Cancel the request
9346 abort: function( statusText ) {
9347 var finalText = statusText || strAbort;
9348 if ( transport ) {
9349 transport.abort( finalText );
9350 }
9351 done( 0, finalText );
9352 return this;
9353 }
9354 };
9355
9356 // Attach deferreds
9357 deferred.promise( jqXHR );
9358
9359 // Add protocol if not provided (prefilters might expect it)
9360 // Handle falsy url in the settings object (#10093: consistency with old signature)
9361 // We also use the url parameter if available
9362 s.url = ( ( url || s.url || location.href ) + "" )
9363 .replace( rprotocol, location.protocol + "//" );
9364
9365 // Alias method option to type as per ticket #12004
9366 s.type = options.method || options.type || s.method || s.type;
9367
9368 // Extract dataTypes list
9369 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
9370
9371 // A cross-domain request is in order when the origin doesn't match the current origin.
9372 if ( s.crossDomain == null ) {
9373 urlAnchor = document.createElement( "a" );
9374
9375 // Support: IE <=8 - 11, Edge 12 - 15
9376 // IE throws exception on accessing the href property if url is malformed,
9377 // e.g. http://example.com:80x/
9378 try {
9379 urlAnchor.href = s.url;
9380
9381 // Support: IE <=8 - 11 only
9382 // Anchor's host property isn't correctly set when s.url is relative
9383 urlAnchor.href = urlAnchor.href;
9384 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
9385 urlAnchor.protocol + "//" + urlAnchor.host;
9386 } catch ( e ) {
9387
9388 // If there is an error parsing the URL, assume it is crossDomain,
9389 // it can be rejected by the transport if it is invalid
9390 s.crossDomain = true;
9391 }
9392 }
9393
9394 // Convert data if not already a string
9395 if ( s.data && s.processData && typeof s.data !== "string" ) {
9396 s.data = jQuery.param( s.data, s.traditional );
9397 }
9398
9399 // Apply prefilters
9400 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
9401
9402 // If request was aborted inside a prefilter, stop there
9403 if ( completed ) {
9404 return jqXHR;
9405 }
9406
9407 // We can fire global events as of now if asked to
9408 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
9409 fireGlobals = jQuery.event && s.global;
9410
9411 // Watch for a new set of requests
9412 if ( fireGlobals && jQuery.active++ === 0 ) {
9413 jQuery.event.trigger( "ajaxStart" );
9414 }
9415
9416 // Uppercase the type
9417 s.type = s.type.toUpperCase();
9418
9419 // Determine if request has content
9420 s.hasContent = !rnoContent.test( s.type );
9421
9422 // Save the URL in case we're toying with the If-Modified-Since
9423 // and/or If-None-Match header later on
9424 // Remove hash to simplify url manipulation
9425 cacheURL = s.url.replace( rhash, "" );
9426
9427 // More options handling for requests with no content
9428 if ( !s.hasContent ) {
9429
9430 // Remember the hash so we can put it back
9431 uncached = s.url.slice( cacheURL.length );
9432
9433 // If data is available and should be processed, append data to url
9434 if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
9435 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
9436
9437 // #9682: remove data so that it's not used in an eventual retry
9438 delete s.data;
9439 }
9440
9441 // Add or update anti-cache param if needed
9442 if ( s.cache === false ) {
9443 cacheURL = cacheURL.replace( rantiCache, "$1" );
9444 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
9445 }
9446
9447 // Put hash and anti-cache on the URL that will be requested (gh-1732)
9448 s.url = cacheURL + uncached;
9449
9450 // Change '%20' to '+' if this is encoded form body content (gh-2658)
9451 } else if ( s.data && s.processData &&
9452 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
9453 s.data = s.data.replace( r20, "+" );
9454 }
9455
9456 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9457 if ( s.ifModified ) {
9458 if ( jQuery.lastModified[ cacheURL ] ) {
9459 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
9460 }
9461 if ( jQuery.etag[ cacheURL ] ) {
9462 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
9463 }
9464 }
9465
9466 // Set the correct header, if data is being sent
9467 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
9468 jqXHR.setRequestHeader( "Content-Type", s.contentType );
9469 }
9470
9471 // Set the Accepts header for the server, depending on the dataType
9472 jqXHR.setRequestHeader(
9473 "Accept",
9474 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
9475 s.accepts[ s.dataTypes[ 0 ] ] +
9476 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
9477 s.accepts[ "*" ]
9478 );
9479
9480 // Check for headers option
9481 for ( i in s.headers ) {
9482 jqXHR.setRequestHeader( i, s.headers[ i ] );
9483 }
9484
9485 // Allow custom headers/mimetypes and early abort
9486 if ( s.beforeSend &&
9487 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
9488
9489 // Abort if not done already and return
9490 return jqXHR.abort();
9491 }
9492
9493 // Aborting is no longer a cancellation
9494 strAbort = "abort";
9495
9496 // Install callbacks on deferreds
9497 completeDeferred.add( s.complete );
9498 jqXHR.done( s.success );
9499 jqXHR.fail( s.error );
9500
9501 // Get transport
9502 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
9503
9504 // If no transport, we auto-abort
9505 if ( !transport ) {
9506 done( -1, "No Transport" );
9507 } else {
9508 jqXHR.readyState = 1;
9509
9510 // Send global event
9511 if ( fireGlobals ) {
9512 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
9513 }
9514
9515 // If request was aborted inside ajaxSend, stop there
9516 if ( completed ) {
9517 return jqXHR;
9518 }
9519
9520 // Timeout
9521 if ( s.async && s.timeout > 0 ) {
9522 timeoutTimer = window.setTimeout( function() {
9523 jqXHR.abort( "timeout" );
9524 }, s.timeout );
9525 }
9526
9527 try {
9528 completed = false;
9529 transport.send( requestHeaders, done );
9530 } catch ( e ) {
9531
9532 // Rethrow post-completion exceptions
9533 if ( completed ) {
9534 throw e;
9535 }
9536
9537 // Propagate others as results
9538 done( -1, e );
9539 }
9540 }
9541
9542 // Callback for when everything is done
9543 function done( status, nativeStatusText, responses, headers ) {
9544 var isSuccess, success, error, response, modified,
9545 statusText = nativeStatusText;
9546
9547 // Ignore repeat invocations
9548 if ( completed ) {
9549 return;
9550 }
9551
9552 completed = true;
9553
9554 // Clear timeout if it exists
9555 if ( timeoutTimer ) {
9556 window.clearTimeout( timeoutTimer );
9557 }
9558
9559 // Dereference transport for early garbage collection
9560 // (no matter how long the jqXHR object will be used)
9561 transport = undefined;
9562
9563 // Cache response headers
9564 responseHeadersString = headers || "";
9565
9566 // Set readyState
9567 jqXHR.readyState = status > 0 ? 4 : 0;
9568
9569 // Determine if successful
9570 isSuccess = status >= 200 && status < 300 || status === 304;
9571
9572 // Get response data
9573 if ( responses ) {
9574 response = ajaxHandleResponses( s, jqXHR, responses );
9575 }
9576
9577 // Convert no matter what (that way responseXXX fields are always set)
9578 response = ajaxConvert( s, response, jqXHR, isSuccess );
9579
9580 // If successful, handle type chaining
9581 if ( isSuccess ) {
9582
9583 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9584 if ( s.ifModified ) {
9585 modified = jqXHR.getResponseHeader( "Last-Modified" );
9586 if ( modified ) {
9587 jQuery.lastModified[ cacheURL ] = modified;
9588 }
9589 modified = jqXHR.getResponseHeader( "etag" );
9590 if ( modified ) {
9591 jQuery.etag[ cacheURL ] = modified;
9592 }
9593 }
9594
9595 // if no content
9596 if ( status === 204 || s.type === "HEAD" ) {
9597 statusText = "nocontent";
9598
9599 // if not modified
9600 } else if ( status === 304 ) {
9601 statusText = "notmodified";
9602
9603 // If we have data, let's convert it
9604 } else {
9605 statusText = response.state;
9606 success = response.data;
9607 error = response.error;
9608 isSuccess = !error;
9609 }
9610 } else {
9611
9612 // Extract error from statusText and normalize for non-aborts
9613 error = statusText;
9614 if ( status || !statusText ) {
9615 statusText = "error";
9616 if ( status < 0 ) {
9617 status = 0;
9618 }
9619 }
9620 }
9621
9622 // Set data for the fake xhr object
9623 jqXHR.status = status;
9624 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
9625
9626 // Success/Error
9627 if ( isSuccess ) {
9628 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
9629 } else {
9630 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
9631 }
9632
9633 // Status-dependent callbacks
9634 jqXHR.statusCode( statusCode );
9635 statusCode = undefined;
9636
9637 if ( fireGlobals ) {
9638 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
9639 [ jqXHR, s, isSuccess ? success : error ] );
9640 }
9641
9642 // Complete
9643 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
9644
9645 if ( fireGlobals ) {
9646 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
9647
9648 // Handle the global AJAX counter
9649 if ( !( --jQuery.active ) ) {
9650 jQuery.event.trigger( "ajaxStop" );
9651 }
9652 }
9653 }
9654
9655 return jqXHR;
9656 },
9657
9658 getJSON: function( url, data, callback ) {
9659 return jQuery.get( url, data, callback, "json" );
9660 },
9661
9662 getScript: function( url, callback ) {
9663 return jQuery.get( url, undefined, callback, "script" );
9664 }
9665} );
9666
9667jQuery.each( [ "get", "post" ], function( i, method ) {
9668 jQuery[ method ] = function( url, data, callback, type ) {
9669
9670 // Shift arguments if data argument was omitted
9671 if ( isFunction( data ) ) {
9672 type = type || callback;
9673 callback = data;
9674 data = undefined;
9675 }
9676
9677 // The url can be an options object (which then must have .url)
9678 return jQuery.ajax( jQuery.extend( {
9679 url: url,
9680 type: method,
9681 dataType: type,
9682 data: data,
9683 success: callback
9684 }, jQuery.isPlainObject( url ) && url ) );
9685 };
9686} );
9687
9688
9689jQuery._evalUrl = function( url, options ) {
9690 return jQuery.ajax( {
9691 url: url,
9692
9693 // Make this explicit, since user can override this through ajaxSetup (#11264)
9694 type: "GET",
9695 dataType: "script",
9696 cache: true,
9697 async: false,
9698 global: false,
9699
9700 // Only evaluate the response if it is successful (gh-4126)
9701 // dataFilter is not invoked for failure responses, so using it instead
9702 // of the default converter is kludgy but it works.
9703 converters: {
9704 "text script": function() {}
9705 },
9706 dataFilter: function( response ) {
9707 jQuery.globalEval( response, options );
9708 }
9709 } );
9710};
9711
9712
9713jQuery.fn.extend( {
9714 wrapAll: function( html ) {
9715 var wrap;
9716
9717 if ( this[ 0 ] ) {
9718 if ( isFunction( html ) ) {
9719 html = html.call( this[ 0 ] );
9720 }
9721
9722 // The elements to wrap the target around
9723 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
9724
9725 if ( this[ 0 ].parentNode ) {
9726 wrap.insertBefore( this[ 0 ] );
9727 }
9728
9729 wrap.map( function() {
9730 var elem = this;
9731
9732 while ( elem.firstElementChild ) {
9733 elem = elem.firstElementChild;
9734 }
9735
9736 return elem;
9737 } ).append( this );
9738 }
9739
9740 return this;
9741 },
9742
9743 wrapInner: function( html ) {
9744 if ( isFunction( html ) ) {
9745 return this.each( function( i ) {
9746 jQuery( this ).wrapInner( html.call( this, i ) );
9747 } );
9748 }
9749
9750 return this.each( function() {
9751 var self = jQuery( this ),
9752 contents = self.contents();
9753
9754 if ( contents.length ) {
9755 contents.wrapAll( html );
9756
9757 } else {
9758 self.append( html );
9759 }
9760 } );
9761 },
9762
9763 wrap: function( html ) {
9764 var htmlIsFunction = isFunction( html );
9765
9766 return this.each( function( i ) {
9767 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
9768 } );
9769 },
9770
9771 unwrap: function( selector ) {
9772 this.parent( selector ).not( "body" ).each( function() {
9773 jQuery( this ).replaceWith( this.childNodes );
9774 } );
9775 return this;
9776 }
9777} );
9778
9779
9780jQuery.expr.pseudos.hidden = function( elem ) {
9781 return !jQuery.expr.pseudos.visible( elem );
9782};
9783jQuery.expr.pseudos.visible = function( elem ) {
9784 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
9785};
9786
9787
9788
9789
9790jQuery.ajaxSettings.xhr = function() {
9791 try {
9792 return new window.XMLHttpRequest();
9793 } catch ( e ) {}
9794};
9795
9796var xhrSuccessStatus = {
9797
9798 // File protocol always yields status code 0, assume 200
9799 0: 200,
9800
9801 // Support: IE <=9 only
9802 // #1450: sometimes IE returns 1223 when it should be 204
9803 1223: 204
9804 },
9805 xhrSupported = jQuery.ajaxSettings.xhr();
9806
9807support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
9808support.ajax = xhrSupported = !!xhrSupported;
9809
9810jQuery.ajaxTransport( function( options ) {
9811 var callback, errorCallback;
9812
9813 // Cross domain only allowed if supported through XMLHttpRequest
9814 if ( support.cors || xhrSupported && !options.crossDomain ) {
9815 return {
9816 send: function( headers, complete ) {
9817 var i,
9818 xhr = options.xhr();
9819
9820 xhr.open(
9821 options.type,
9822 options.url,
9823 options.async,
9824 options.username,
9825 options.password
9826 );
9827
9828 // Apply custom fields if provided
9829 if ( options.xhrFields ) {
9830 for ( i in options.xhrFields ) {
9831 xhr[ i ] = options.xhrFields[ i ];
9832 }
9833 }
9834
9835 // Override mime type if needed
9836 if ( options.mimeType && xhr.overrideMimeType ) {
9837 xhr.overrideMimeType( options.mimeType );
9838 }
9839
9840 // X-Requested-With header
9841 // For cross-domain requests, seeing as conditions for a preflight are
9842 // akin to a jigsaw puzzle, we simply never set it to be sure.
9843 // (it can always be set on a per-request basis or even using ajaxSetup)
9844 // For same-domain requests, won't change header if already provided.
9845 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
9846 headers[ "X-Requested-With" ] = "XMLHttpRequest";
9847 }
9848
9849 // Set headers
9850 for ( i in headers ) {
9851 xhr.setRequestHeader( i, headers[ i ] );
9852 }
9853
9854 // Callback
9855 callback = function( type ) {
9856 return function() {
9857 if ( callback ) {
9858 callback = errorCallback = xhr.onload =
9859 xhr.onerror = xhr.onabort = xhr.ontimeout =
9860 xhr.onreadystatechange = null;
9861
9862 if ( type === "abort" ) {
9863 xhr.abort();
9864 } else if ( type === "error" ) {
9865
9866 // Support: IE <=9 only
9867 // On a manual native abort, IE9 throws
9868 // errors on any property access that is not readyState
9869 if ( typeof xhr.status !== "number" ) {
9870 complete( 0, "error" );
9871 } else {
9872 complete(
9873
9874 // File: protocol always yields status 0; see #8605, #14207
9875 xhr.status,
9876 xhr.statusText
9877 );
9878 }
9879 } else {
9880 complete(
9881 xhrSuccessStatus[ xhr.status ] || xhr.status,
9882 xhr.statusText,
9883
9884 // Support: IE <=9 only
9885 // IE9 has no XHR2 but throws on binary (trac-11426)
9886 // For XHR2 non-text, let the caller handle it (gh-2498)
9887 ( xhr.responseType || "text" ) !== "text" ||
9888 typeof xhr.responseText !== "string" ?
9889 { binary: xhr.response } :
9890 { text: xhr.responseText },
9891 xhr.getAllResponseHeaders()
9892 );
9893 }
9894 }
9895 };
9896 };
9897
9898 // Listen to events
9899 xhr.onload = callback();
9900 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
9901
9902 // Support: IE 9 only
9903 // Use onreadystatechange to replace onabort
9904 // to handle uncaught aborts
9905 if ( xhr.onabort !== undefined ) {
9906 xhr.onabort = errorCallback;
9907 } else {
9908 xhr.onreadystatechange = function() {
9909
9910 // Check readyState before timeout as it changes
9911 if ( xhr.readyState === 4 ) {
9912
9913 // Allow onerror to be called first,
9914 // but that will not handle a native abort
9915 // Also, save errorCallback to a variable
9916 // as xhr.onerror cannot be accessed
9917 window.setTimeout( function() {
9918 if ( callback ) {
9919 errorCallback();
9920 }
9921 } );
9922 }
9923 };
9924 }
9925
9926 // Create the abort callback
9927 callback = callback( "abort" );
9928
9929 try {
9930
9931 // Do send the request (this may raise an exception)
9932 xhr.send( options.hasContent && options.data || null );
9933 } catch ( e ) {
9934
9935 // #14683: Only rethrow if this hasn't been notified as an error yet
9936 if ( callback ) {
9937 throw e;
9938 }
9939 }
9940 },
9941
9942 abort: function() {
9943 if ( callback ) {
9944 callback();
9945 }
9946 }
9947 };
9948 }
9949} );
9950
9951
9952
9953
9954// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
9955jQuery.ajaxPrefilter( function( s ) {
9956 if ( s.crossDomain ) {
9957 s.contents.script = false;
9958 }
9959} );
9960
9961// Install script dataType
9962jQuery.ajaxSetup( {
9963 accepts: {
9964 script: "text/javascript, application/javascript, " +
9965 "application/ecmascript, application/x-ecmascript"
9966 },
9967 contents: {
9968 script: /\b(?:java|ecma)script\b/
9969 },
9970 converters: {
9971 "text script": function( text ) {
9972 jQuery.globalEval( text );
9973 return text;
9974 }
9975 }
9976} );
9977
9978// Handle cache's special case and crossDomain
9979jQuery.ajaxPrefilter( "script", function( s ) {
9980 if ( s.cache === undefined ) {
9981 s.cache = false;
9982 }
9983 if ( s.crossDomain ) {
9984 s.type = "GET";
9985 }
9986} );
9987
9988// Bind script tag hack transport
9989jQuery.ajaxTransport( "script", function( s ) {
9990
9991 // This transport only deals with cross domain or forced-by-attrs requests
9992 if ( s.crossDomain || s.scriptAttrs ) {
9993 var script, callback;
9994 return {
9995 send: function( _, complete ) {
9996 script = jQuery( "<script>" )
9997 .attr( s.scriptAttrs || {} )
9998 .prop( { charset: s.scriptCharset, src: s.url } )
9999 .on( "load error", callback = function( evt ) {
10000 script.remove();
10001 callback = null;
10002 if ( evt ) {
10003 complete( evt.type === "error" ? 404 : 200, evt.type );
10004 }
10005 } );
10006
10007 // Use native DOM manipulation to avoid our domManip AJAX trickery
10008 document.head.appendChild( script[ 0 ] );
10009 },
10010 abort: function() {
10011 if ( callback ) {
10012 callback();
10013 }
10014 }
10015 };
10016 }
10017} );
10018
10019
10020
10021
10022var oldCallbacks = [],
10023 rjsonp = /(=)\?(?=&|$)|\?\?/;
10024
10025// Default jsonp settings
10026jQuery.ajaxSetup( {
10027 jsonp: "callback",
10028 jsonpCallback: function() {
10029 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
10030 this[ callback ] = true;
10031 return callback;
10032 }
10033} );
10034
10035// Detect, normalize options and install callbacks for jsonp requests
10036jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
10037
10038 var callbackName, overwritten, responseContainer,
10039 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
10040 "url" :
10041 typeof s.data === "string" &&
10042 ( s.contentType || "" )
10043 .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
10044 rjsonp.test( s.data ) && "data"
10045 );
10046
10047 // Handle iff the expected data type is "jsonp" or we have a parameter to set
10048 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
10049
10050 // Get callback name, remembering preexisting value associated with it
10051 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
10052 s.jsonpCallback() :
10053 s.jsonpCallback;
10054
10055 // Insert callback into url or form data
10056 if ( jsonProp ) {
10057 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
10058 } else if ( s.jsonp !== false ) {
10059 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
10060 }
10061
10062 // Use data converter to retrieve json after script execution
10063 s.converters[ "script json" ] = function() {
10064 if ( !responseContainer ) {
10065 jQuery.error( callbackName + " was not called" );
10066 }
10067 return responseContainer[ 0 ];
10068 };
10069
10070 // Force json dataType
10071 s.dataTypes[ 0 ] = "json";
10072
10073 // Install callback
10074 overwritten = window[ callbackName ];
10075 window[ callbackName ] = function() {
10076 responseContainer = arguments;
10077 };
10078
10079 // Clean-up function (fires after converters)
10080 jqXHR.always( function() {
10081
10082 // If previous value didn't exist - remove it
10083 if ( overwritten === undefined ) {
10084 jQuery( window ).removeProp( callbackName );
10085
10086 // Otherwise restore preexisting value
10087 } else {
10088 window[ callbackName ] = overwritten;
10089 }
10090
10091 // Save back as free
10092 if ( s[ callbackName ] ) {
10093
10094 // Make sure that re-using the options doesn't screw things around
10095 s.jsonpCallback = originalSettings.jsonpCallback;
10096
10097 // Save the callback name for future use
10098 oldCallbacks.push( callbackName );
10099 }
10100
10101 // Call if it was a function and we have a response
10102 if ( responseContainer && isFunction( overwritten ) ) {
10103 overwritten( responseContainer[ 0 ] );
10104 }
10105
10106 responseContainer = overwritten = undefined;
10107 } );
10108
10109 // Delegate to script
10110 return "script";
10111 }
10112} );
10113
10114
10115
10116
10117// Support: Safari 8 only
10118// In Safari 8 documents created via document.implementation.createHTMLDocument
10119// collapse sibling forms: the second one becomes a child of the first one.
10120// Because of that, this security measure has to be disabled in Safari 8.
10121// https://bugs.webkit.org/show_bug.cgi?id=137337
10122support.createHTMLDocument = ( function() {
10123 var body = document.implementation.createHTMLDocument( "" ).body;
10124 body.innerHTML = "<form></form><form></form>";
10125 return body.childNodes.length === 2;
10126} )();
10127
10128
10129// Argument "data" should be string of html
10130// context (optional): If specified, the fragment will be created in this context,
10131// defaults to document
10132// keepScripts (optional): If true, will include scripts passed in the html string
10133jQuery.parseHTML = function( data, context, keepScripts ) {
10134 if ( typeof data !== "string" ) {
10135 return [];
10136 }
10137 if ( typeof context === "boolean" ) {
10138 keepScripts = context;
10139 context = false;
10140 }
10141
10142 var base, parsed, scripts;
10143
10144 if ( !context ) {
10145
10146 // Stop scripts or inline event handlers from being executed immediately
10147 // by using document.implementation
10148 if ( support.createHTMLDocument ) {
10149 context = document.implementation.createHTMLDocument( "" );
10150
10151 // Set the base href for the created document
10152 // so any parsed elements with URLs
10153 // are based on the document's URL (gh-2965)
10154 base = context.createElement( "base" );
10155 base.href = document.location.href;
10156 context.head.appendChild( base );
10157 } else {
10158 context = document;
10159 }
10160 }
10161
10162 parsed = rsingleTag.exec( data );
10163 scripts = !keepScripts && [];
10164
10165 // Single tag
10166 if ( parsed ) {
10167 return [ context.createElement( parsed[ 1 ] ) ];
10168 }
10169
10170 parsed = buildFragment( [ data ], context, scripts );
10171
10172 if ( scripts && scripts.length ) {
10173 jQuery( scripts ).remove();
10174 }
10175
10176 return jQuery.merge( [], parsed.childNodes );
10177};
10178
10179
10180/**
10181 * Load a url into a page
10182 */
10183jQuery.fn.load = function( url, params, callback ) {
10184 var selector, type, response,
10185 self = this,
10186 off = url.indexOf( " " );
10187
10188 if ( off > -1 ) {
10189 selector = stripAndCollapse( url.slice( off ) );
10190 url = url.slice( 0, off );
10191 }
10192
10193 // If it's a function
10194 if ( isFunction( params ) ) {
10195
10196 // We assume that it's the callback
10197 callback = params;
10198 params = undefined;
10199
10200 // Otherwise, build a param string
10201 } else if ( params && typeof params === "object" ) {
10202 type = "POST";
10203 }
10204
10205 // If we have elements to modify, make the request
10206 if ( self.length > 0 ) {
10207 jQuery.ajax( {
10208 url: url,
10209
10210 // If "type" variable is undefined, then "GET" method will be used.
10211 // Make value of this field explicit since
10212 // user can override it through ajaxSetup method
10213 type: type || "GET",
10214 dataType: "html",
10215 data: params
10216 } ).done( function( responseText ) {
10217
10218 // Save response for use in complete callback
10219 response = arguments;
10220
10221 self.html( selector ?
10222
10223 // If a selector was specified, locate the right elements in a dummy div
10224 // Exclude scripts to avoid IE 'Permission Denied' errors
10225 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
10226
10227 // Otherwise use the full result
10228 responseText );
10229
10230 // If the request succeeds, this function gets "data", "status", "jqXHR"
10231 // but they are ignored because response was set above.
10232 // If it fails, this function gets "jqXHR", "status", "error"
10233 } ).always( callback && function( jqXHR, status ) {
10234 self.each( function() {
10235 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
10236 } );
10237 } );
10238 }
10239
10240 return this;
10241};
10242
10243
10244
10245
10246// Attach a bunch of functions for handling common AJAX events
10247jQuery.each( [
10248 "ajaxStart",
10249 "ajaxStop",
10250 "ajaxComplete",
10251 "ajaxError",
10252 "ajaxSuccess",
10253 "ajaxSend"
10254], function( i, type ) {
10255 jQuery.fn[ type ] = function( fn ) {
10256 return this.on( type, fn );
10257 };
10258} );
10259
10260
10261
10262
10263jQuery.expr.pseudos.animated = function( elem ) {
10264 return jQuery.grep( jQuery.timers, function( fn ) {
10265 return elem === fn.elem;
10266 } ).length;
10267};
10268
10269
10270
10271
10272jQuery.offset = {
10273 setOffset: function( elem, options, i ) {
10274 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
10275 position = jQuery.css( elem, "position" ),
10276 curElem = jQuery( elem ),
10277 props = {};
10278
10279 // Set position first, in-case top/left are set even on static elem
10280 if ( position === "static" ) {
10281 elem.style.position = "relative";
10282 }
10283
10284 curOffset = curElem.offset();
10285 curCSSTop = jQuery.css( elem, "top" );
10286 curCSSLeft = jQuery.css( elem, "left" );
10287 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
10288 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
10289
10290 // Need to be able to calculate position if either
10291 // top or left is auto and position is either absolute or fixed
10292 if ( calculatePosition ) {
10293 curPosition = curElem.position();
10294 curTop = curPosition.top;
10295 curLeft = curPosition.left;
10296
10297 } else {
10298 curTop = parseFloat( curCSSTop ) || 0;
10299 curLeft = parseFloat( curCSSLeft ) || 0;
10300 }
10301
10302 if ( isFunction( options ) ) {
10303
10304 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
10305 options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
10306 }
10307
10308 if ( options.top != null ) {
10309 props.top = ( options.top - curOffset.top ) + curTop;
10310 }
10311 if ( options.left != null ) {
10312 props.left = ( options.left - curOffset.left ) + curLeft;
10313 }
10314
10315 if ( "using" in options ) {
10316 options.using.call( elem, props );
10317
10318 } else {
10319 curElem.css( props );
10320 }
10321 }
10322};
10323
10324jQuery.fn.extend( {
10325
10326 // offset() relates an element's border box to the document origin
10327 offset: function( options ) {
10328
10329 // Preserve chaining for setter
10330 if ( arguments.length ) {
10331 return options === undefined ?
10332 this :
10333 this.each( function( i ) {
10334 jQuery.offset.setOffset( this, options, i );
10335 } );
10336 }
10337
10338 var rect, win,
10339 elem = this[ 0 ];
10340
10341 if ( !elem ) {
10342 return;
10343 }
10344
10345 // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
10346 // Support: IE <=11 only
10347 // Running getBoundingClientRect on a
10348 // disconnected node in IE throws an error
10349 if ( !elem.getClientRects().length ) {
10350 return { top: 0, left: 0 };
10351 }
10352
10353 // Get document-relative position by adding viewport scroll to viewport-relative gBCR
10354 rect = elem.getBoundingClientRect();
10355 win = elem.ownerDocument.defaultView;
10356 return {
10357 top: rect.top + win.pageYOffset,
10358 left: rect.left + win.pageXOffset
10359 };
10360 },
10361
10362 // position() relates an element's margin box to its offset parent's padding box
10363 // This corresponds to the behavior of CSS absolute positioning
10364 position: function() {
10365 if ( !this[ 0 ] ) {
10366 return;
10367 }
10368
10369 var offsetParent, offset, doc,
10370 elem = this[ 0 ],
10371 parentOffset = { top: 0, left: 0 };
10372
10373 // position:fixed elements are offset from the viewport, which itself always has zero offset
10374 if ( jQuery.css( elem, "position" ) === "fixed" ) {
10375
10376 // Assume position:fixed implies availability of getBoundingClientRect
10377 offset = elem.getBoundingClientRect();
10378
10379 } else {
10380 offset = this.offset();
10381
10382 // Account for the *real* offset parent, which can be the document or its root element
10383 // when a statically positioned element is identified
10384 doc = elem.ownerDocument;
10385 offsetParent = elem.offsetParent || doc.documentElement;
10386 while ( offsetParent &&
10387 ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
10388 jQuery.css( offsetParent, "position" ) === "static" ) {
10389
10390 offsetParent = offsetParent.parentNode;
10391 }
10392 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
10393
10394 // Incorporate borders into its offset, since they are outside its content origin
10395 parentOffset = jQuery( offsetParent ).offset();
10396 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
10397 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
10398 }
10399 }
10400
10401 // Subtract parent offsets and element margins
10402 return {
10403 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
10404 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
10405 };
10406 },
10407
10408 // This method will return documentElement in the following cases:
10409 // 1) For the element inside the iframe without offsetParent, this method will return
10410 // documentElement of the parent window
10411 // 2) For the hidden or detached element
10412 // 3) For body or html element, i.e. in case of the html node - it will return itself
10413 //
10414 // but those exceptions were never presented as a real life use-cases
10415 // and might be considered as more preferable results.
10416 //
10417 // This logic, however, is not guaranteed and can change at any point in the future
10418 offsetParent: function() {
10419 return this.map( function() {
10420 var offsetParent = this.offsetParent;
10421
10422 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
10423 offsetParent = offsetParent.offsetParent;
10424 }
10425
10426 return offsetParent || documentElement;
10427 } );
10428 }
10429} );
10430
10431// Create scrollLeft and scrollTop methods
10432jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
10433 var top = "pageYOffset" === prop;
10434
10435 jQuery.fn[ method ] = function( val ) {
10436 return access( this, function( elem, method, val ) {
10437
10438 // Coalesce documents and windows
10439 var win;
10440 if ( isWindow( elem ) ) {
10441 win = elem;
10442 } else if ( elem.nodeType === 9 ) {
10443 win = elem.defaultView;
10444 }
10445
10446 if ( val === undefined ) {
10447 return win ? win[ prop ] : elem[ method ];
10448 }
10449
10450 if ( win ) {
10451 win.scrollTo(
10452 !top ? val : win.pageXOffset,
10453 top ? val : win.pageYOffset
10454 );
10455
10456 } else {
10457 elem[ method ] = val;
10458 }
10459 }, method, val, arguments.length );
10460 };
10461} );
10462
10463// Support: Safari <=7 - 9.1, Chrome <=37 - 49
10464// Add the top/left cssHooks using jQuery.fn.position
10465// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
10466// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
10467// getComputedStyle returns percent when specified for top/left/bottom/right;
10468// rather than make the css module depend on the offset module, just check for it here
10469jQuery.each( [ "top", "left" ], function( i, prop ) {
10470 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
10471 function( elem, computed ) {
10472 if ( computed ) {
10473 computed = curCSS( elem, prop );
10474
10475 // If curCSS returns percentage, fallback to offset
10476 return rnumnonpx.test( computed ) ?
10477 jQuery( elem ).position()[ prop ] + "px" :
10478 computed;
10479 }
10480 }
10481 );
10482} );
10483
10484
10485// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
10486jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10487 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
10488 function( defaultExtra, funcName ) {
10489
10490 // Margin is only for outerHeight, outerWidth
10491 jQuery.fn[ funcName ] = function( margin, value ) {
10492 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
10493 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
10494
10495 return access( this, function( elem, type, value ) {
10496 var doc;
10497
10498 if ( isWindow( elem ) ) {
10499
10500 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
10501 return funcName.indexOf( "outer" ) === 0 ?
10502 elem[ "inner" + name ] :
10503 elem.document.documentElement[ "client" + name ];
10504 }
10505
10506 // Get document width or height
10507 if ( elem.nodeType === 9 ) {
10508 doc = elem.documentElement;
10509
10510 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
10511 // whichever is greatest
10512 return Math.max(
10513 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
10514 elem.body[ "offset" + name ], doc[ "offset" + name ],
10515 doc[ "client" + name ]
10516 );
10517 }
10518
10519 return value === undefined ?
10520
10521 // Get width or height on the element, requesting but not forcing parseFloat
10522 jQuery.css( elem, type, extra ) :
10523
10524 // Set width or height on the element
10525 jQuery.style( elem, type, value, extra );
10526 }, type, chainable ? margin : undefined, chainable );
10527 };
10528 } );
10529} );
10530
10531
10532jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
10533 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
10534 "change select submit keydown keypress keyup contextmenu" ).split( " " ),
10535 function( i, name ) {
10536
10537 // Handle event binding
10538 jQuery.fn[ name ] = function( data, fn ) {
10539 return arguments.length > 0 ?
10540 this.on( name, null, data, fn ) :
10541 this.trigger( name );
10542 };
10543} );
10544
10545jQuery.fn.extend( {
10546 hover: function( fnOver, fnOut ) {
10547 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10548 }
10549} );
10550
10551
10552
10553
10554jQuery.fn.extend( {
10555
10556 bind: function( types, data, fn ) {
10557 return this.on( types, null, data, fn );
10558 },
10559 unbind: function( types, fn ) {
10560 return this.off( types, null, fn );
10561 },
10562
10563 delegate: function( selector, types, data, fn ) {
10564 return this.on( types, selector, data, fn );
10565 },
10566 undelegate: function( selector, types, fn ) {
10567
10568 // ( namespace ) or ( selector, types [, fn] )
10569 return arguments.length === 1 ?
10570 this.off( selector, "**" ) :
10571 this.off( types, selector || "**", fn );
10572 }
10573} );
10574
10575// Bind a function to a context, optionally partially applying any
10576// arguments.
10577// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
10578// However, it is not slated for removal any time soon
10579jQuery.proxy = function( fn, context ) {
10580 var tmp, args, proxy;
10581
10582 if ( typeof context === "string" ) {
10583 tmp = fn[ context ];
10584 context = fn;
10585 fn = tmp;
10586 }
10587
10588 // Quick check to determine if target is callable, in the spec
10589 // this throws a TypeError, but we will just return undefined.
10590 if ( !isFunction( fn ) ) {
10591 return undefined;
10592 }
10593
10594 // Simulated bind
10595 args = slice.call( arguments, 2 );
10596 proxy = function() {
10597 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
10598 };
10599
10600 // Set the guid of unique handler to the same of original handler, so it can be removed
10601 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
10602
10603 return proxy;
10604};
10605
10606jQuery.holdReady = function( hold ) {
10607 if ( hold ) {
10608 jQuery.readyWait++;
10609 } else {
10610 jQuery.ready( true );
10611 }
10612};
10613jQuery.isArray = Array.isArray;
10614jQuery.parseJSON = JSON.parse;
10615jQuery.nodeName = nodeName;
10616jQuery.isFunction = isFunction;
10617jQuery.isWindow = isWindow;
10618jQuery.camelCase = camelCase;
10619jQuery.type = toType;
10620
10621jQuery.now = Date.now;
10622
10623jQuery.isNumeric = function( obj ) {
10624
10625 // As of jQuery 3.0, isNumeric is limited to
10626 // strings and numbers (primitives or objects)
10627 // that can be coerced to finite numbers (gh-2662)
10628 var type = jQuery.type( obj );
10629 return ( type === "number" || type === "string" ) &&
10630
10631 // parseFloat NaNs numeric-cast false positives ("")
10632 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
10633 // subtraction forces infinities to NaN
10634 !isNaN( obj - parseFloat( obj ) );
10635};
10636
10637
10638
10639
10640// Register as a named AMD module, since jQuery can be concatenated with other
10641// files that may use define, but not via a proper concatenation script that
10642// understands anonymous AMD modules. A named AMD is safest and most robust
10643// way to register. Lowercase jquery is used because AMD module names are
10644// derived from file names, and jQuery is normally delivered in a lowercase
10645// file name. Do this after creating the global so that if an AMD module wants
10646// to call noConflict to hide this version of jQuery, it will work.
10647
10648// Note that for maximum portability, libraries that are not jQuery should
10649// declare themselves as anonymous modules, and avoid setting a global if an
10650// AMD loader is present. jQuery is a special case. For more information, see
10651// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
10652
10653if ( true ) {
10654 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
10655 return jQuery;
10656 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
10657 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
10658}
10659
10660
10661
10662
10663var
10664
10665 // Map over jQuery in case of overwrite
10666 _jQuery = window.jQuery,
10667
10668 // Map over the $ in case of overwrite
10669 _$ = window.$;
10670
10671jQuery.noConflict = function( deep ) {
10672 if ( window.$ === jQuery ) {
10673 window.$ = _$;
10674 }
10675
10676 if ( deep && window.jQuery === jQuery ) {
10677 window.jQuery = _jQuery;
10678 }
10679
10680 return jQuery;
10681};
10682
10683// Expose jQuery and $ identifiers, even in AMD
10684// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
10685// and CommonJS for browser emulators (#13566)
10686if ( !noGlobal ) {
10687 window.jQuery = window.$ = jQuery;
10688}
10689
10690
10691
10692
10693return jQuery;
10694} );
10695
10696
10697/***/ }),
10698
10699/***/ "./node_modules/select2/dist/js/select2.js":
10700/*!*************************************************!*\
10701 !*** ./node_modules/select2/dist/js/select2.js ***!
10702 \*************************************************/
10703/*! no static exports found */
10704/***/ (function(module, exports, __webpack_require__) {
10705
10706var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;var require;/*!
10707 * Select2 4.0.10
10708 * https://select2.github.io
10709 *
10710 * Released under the MIT license
10711 * https://github.com/select2/select2/blob/master/LICENSE.md
10712 */
10713;(function (factory) {
10714 if (true) {
10715 // AMD. Register as an anonymous module.
10716 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
10717 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
10718 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
10719 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
10720 } else {}
10721} (function (jQuery) {
10722 // This is needed so we can catch the AMD loader configuration and use it
10723 // The inner file should be wrapped (by `banner.start.js`) in a function that
10724 // returns the AMD loader references.
10725 var S2 =(function () {
10726 // Restore the Select2 AMD loader so it can be used
10727 // Needed mostly in the language files, where the loader is not inserted
10728 if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
10729 var S2 = jQuery.fn.select2.amd;
10730 }
10731var S2;(function () { if (!S2 || !S2.requirejs) {
10732if (!S2) { S2 = {}; } else { require = S2; }
10733/**
10734 * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
10735 * Released under MIT license, http://github.com/requirejs/almond/LICENSE
10736 */
10737//Going sloppy to avoid 'use strict' string cost, but strict practices should
10738//be followed.
10739/*global setTimeout: false */
10740
10741var requirejs, require, define;
10742(function (undef) {
10743 var main, req, makeMap, handlers,
10744 defined = {},
10745 waiting = {},
10746 config = {},
10747 defining = {},
10748 hasOwn = Object.prototype.hasOwnProperty,
10749 aps = [].slice,
10750 jsSuffixRegExp = /\.js$/;
10751
10752 function hasProp(obj, prop) {
10753 return hasOwn.call(obj, prop);
10754 }
10755
10756 /**
10757 * Given a relative module name, like ./something, normalize it to
10758 * a real name that can be mapped to a path.
10759 * @param {String} name the relative name
10760 * @param {String} baseName a real name that the name arg is relative
10761 * to.
10762 * @returns {String} normalized name
10763 */
10764 function normalize(name, baseName) {
10765 var nameParts, nameSegment, mapValue, foundMap, lastIndex,
10766 foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
10767 baseParts = baseName && baseName.split("/"),
10768 map = config.map,
10769 starMap = (map && map['*']) || {};
10770
10771 //Adjust any relative paths.
10772 if (name) {
10773 name = name.split('/');
10774 lastIndex = name.length - 1;
10775
10776 // If wanting node ID compatibility, strip .js from end
10777 // of IDs. Have to do this here, and not in nameToUrl
10778 // because node allows either .js or non .js to map
10779 // to same file.
10780 if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
10781 name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
10782 }
10783
10784 // Starts with a '.' so need the baseName
10785 if (name[0].charAt(0) === '.' && baseParts) {
10786 //Convert baseName to array, and lop off the last part,
10787 //so that . matches that 'directory' and not name of the baseName's
10788 //module. For instance, baseName of 'one/two/three', maps to
10789 //'one/two/three.js', but we want the directory, 'one/two' for
10790 //this normalization.
10791 normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
10792 name = normalizedBaseParts.concat(name);
10793 }
10794
10795 //start trimDots
10796 for (i = 0; i < name.length; i++) {
10797 part = name[i];
10798 if (part === '.') {
10799 name.splice(i, 1);
10800 i -= 1;
10801 } else if (part === '..') {
10802 // If at the start, or previous value is still ..,
10803 // keep them so that when converted to a path it may
10804 // still work when converted to a path, even though
10805 // as an ID it is less than ideal. In larger point
10806 // releases, may be better to just kick out an error.
10807 if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
10808 continue;
10809 } else if (i > 0) {
10810 name.splice(i - 1, 2);
10811 i -= 2;
10812 }
10813 }
10814 }
10815 //end trimDots
10816
10817 name = name.join('/');
10818 }
10819
10820 //Apply map config if available.
10821 if ((baseParts || starMap) && map) {
10822 nameParts = name.split('/');
10823
10824 for (i = nameParts.length; i > 0; i -= 1) {
10825 nameSegment = nameParts.slice(0, i).join("/");
10826
10827 if (baseParts) {
10828 //Find the longest baseName segment match in the config.
10829 //So, do joins on the biggest to smallest lengths of baseParts.
10830 for (j = baseParts.length; j > 0; j -= 1) {
10831 mapValue = map[baseParts.slice(0, j).join('/')];
10832
10833 //baseName segment has config, find if it has one for
10834 //this name.
10835 if (mapValue) {
10836 mapValue = mapValue[nameSegment];
10837 if (mapValue) {
10838 //Match, update name to the new value.
10839 foundMap = mapValue;
10840 foundI = i;
10841 break;
10842 }
10843 }
10844 }
10845 }
10846
10847 if (foundMap) {
10848 break;
10849 }
10850
10851 //Check for a star map match, but just hold on to it,
10852 //if there is a shorter segment match later in a matching
10853 //config, then favor over this star map.
10854 if (!foundStarMap && starMap && starMap[nameSegment]) {
10855 foundStarMap = starMap[nameSegment];
10856 starI = i;
10857 }
10858 }
10859
10860 if (!foundMap && foundStarMap) {
10861 foundMap = foundStarMap;
10862 foundI = starI;
10863 }
10864
10865 if (foundMap) {
10866 nameParts.splice(0, foundI, foundMap);
10867 name = nameParts.join('/');
10868 }
10869 }
10870
10871 return name;
10872 }
10873
10874 function makeRequire(relName, forceSync) {
10875 return function () {
10876 //A version of a require function that passes a moduleName
10877 //value for items that may need to
10878 //look up paths relative to the moduleName
10879 var args = aps.call(arguments, 0);
10880
10881 //If first arg is not require('string'), and there is only
10882 //one arg, it is the array form without a callback. Insert
10883 //a null so that the following concat is correct.
10884 if (typeof args[0] !== 'string' && args.length === 1) {
10885 args.push(null);
10886 }
10887 return req.apply(undef, args.concat([relName, forceSync]));
10888 };
10889 }
10890
10891 function makeNormalize(relName) {
10892 return function (name) {
10893 return normalize(name, relName);
10894 };
10895 }
10896
10897 function makeLoad(depName) {
10898 return function (value) {
10899 defined[depName] = value;
10900 };
10901 }
10902
10903 function callDep(name) {
10904 if (hasProp(waiting, name)) {
10905 var args = waiting[name];
10906 delete waiting[name];
10907 defining[name] = true;
10908 main.apply(undef, args);
10909 }
10910
10911 if (!hasProp(defined, name) && !hasProp(defining, name)) {
10912 throw new Error('No ' + name);
10913 }
10914 return defined[name];
10915 }
10916
10917 //Turns a plugin!resource to [plugin, resource]
10918 //with the plugin being undefined if the name
10919 //did not have a plugin prefix.
10920 function splitPrefix(name) {
10921 var prefix,
10922 index = name ? name.indexOf('!') : -1;
10923 if (index > -1) {
10924 prefix = name.substring(0, index);
10925 name = name.substring(index + 1, name.length);
10926 }
10927 return [prefix, name];
10928 }
10929
10930 //Creates a parts array for a relName where first part is plugin ID,
10931 //second part is resource ID. Assumes relName has already been normalized.
10932 function makeRelParts(relName) {
10933 return relName ? splitPrefix(relName) : [];
10934 }
10935
10936 /**
10937 * Makes a name map, normalizing the name, and using a plugin
10938 * for normalization if necessary. Grabs a ref to plugin
10939 * too, as an optimization.
10940 */
10941 makeMap = function (name, relParts) {
10942 var plugin,
10943 parts = splitPrefix(name),
10944 prefix = parts[0],
10945 relResourceName = relParts[1];
10946
10947 name = parts[1];
10948
10949 if (prefix) {
10950 prefix = normalize(prefix, relResourceName);
10951 plugin = callDep(prefix);
10952 }
10953
10954 //Normalize according
10955 if (prefix) {
10956 if (plugin && plugin.normalize) {
10957 name = plugin.normalize(name, makeNormalize(relResourceName));
10958 } else {
10959 name = normalize(name, relResourceName);
10960 }
10961 } else {
10962 name = normalize(name, relResourceName);
10963 parts = splitPrefix(name);
10964 prefix = parts[0];
10965 name = parts[1];
10966 if (prefix) {
10967 plugin = callDep(prefix);
10968 }
10969 }
10970
10971 //Using ridiculous property names for space reasons
10972 return {
10973 f: prefix ? prefix + '!' + name : name, //fullName
10974 n: name,
10975 pr: prefix,
10976 p: plugin
10977 };
10978 };
10979
10980 function makeConfig(name) {
10981 return function () {
10982 return (config && config.config && config.config[name]) || {};
10983 };
10984 }
10985
10986 handlers = {
10987 require: function (name) {
10988 return makeRequire(name);
10989 },
10990 exports: function (name) {
10991 var e = defined[name];
10992 if (typeof e !== 'undefined') {
10993 return e;
10994 } else {
10995 return (defined[name] = {});
10996 }
10997 },
10998 module: function (name) {
10999 return {
11000 id: name,
11001 uri: '',
11002 exports: defined[name],
11003 config: makeConfig(name)
11004 };
11005 }
11006 };
11007
11008 main = function (name, deps, callback, relName) {
11009 var cjsModule, depName, ret, map, i, relParts,
11010 args = [],
11011 callbackType = typeof callback,
11012 usingExports;
11013
11014 //Use name if no relName
11015 relName = relName || name;
11016 relParts = makeRelParts(relName);
11017
11018 //Call the callback to define the module, if necessary.
11019 if (callbackType === 'undefined' || callbackType === 'function') {
11020 //Pull out the defined dependencies and pass the ordered
11021 //values to the callback.
11022 //Default to [require, exports, module] if no deps
11023 deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
11024 for (i = 0; i < deps.length; i += 1) {
11025 map = makeMap(deps[i], relParts);
11026 depName = map.f;
11027
11028 //Fast path CommonJS standard dependencies.
11029 if (depName === "require") {
11030 args[i] = handlers.require(name);
11031 } else if (depName === "exports") {
11032 //CommonJS module spec 1.1
11033 args[i] = handlers.exports(name);
11034 usingExports = true;
11035 } else if (depName === "module") {
11036 //CommonJS module spec 1.1
11037 cjsModule = args[i] = handlers.module(name);
11038 } else if (hasProp(defined, depName) ||
11039 hasProp(waiting, depName) ||
11040 hasProp(defining, depName)) {
11041 args[i] = callDep(depName);
11042 } else if (map.p) {
11043 map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
11044 args[i] = defined[depName];
11045 } else {
11046 throw new Error(name + ' missing ' + depName);
11047 }
11048 }
11049
11050 ret = callback ? callback.apply(defined[name], args) : undefined;
11051
11052 if (name) {
11053 //If setting exports via "module" is in play,
11054 //favor that over return value and exports. After that,
11055 //favor a non-undefined return value over exports use.
11056 if (cjsModule && cjsModule.exports !== undef &&
11057 cjsModule.exports !== defined[name]) {
11058 defined[name] = cjsModule.exports;
11059 } else if (ret !== undef || !usingExports) {
11060 //Use the return value from the function.
11061 defined[name] = ret;
11062 }
11063 }
11064 } else if (name) {
11065 //May just be an object definition for the module. Only
11066 //worry about defining if have a module name.
11067 defined[name] = callback;
11068 }
11069 };
11070
11071 requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
11072 if (typeof deps === "string") {
11073 if (handlers[deps]) {
11074 //callback in this case is really relName
11075 return handlers[deps](callback);
11076 }
11077 //Just return the module wanted. In this scenario, the
11078 //deps arg is the module name, and second arg (if passed)
11079 //is just the relName.
11080 //Normalize module name, if it contains . or ..
11081 return callDep(makeMap(deps, makeRelParts(callback)).f);
11082 } else if (!deps.splice) {
11083 //deps is a config object, not an array.
11084 config = deps;
11085 if (config.deps) {
11086 req(config.deps, config.callback);
11087 }
11088 if (!callback) {
11089 return;
11090 }
11091
11092 if (callback.splice) {
11093 //callback is an array, which means it is a dependency list.
11094 //Adjust args if there are dependencies
11095 deps = callback;
11096 callback = relName;
11097 relName = null;
11098 } else {
11099 deps = undef;
11100 }
11101 }
11102
11103 //Support require(['a'])
11104 callback = callback || function () {};
11105
11106 //If relName is a function, it is an errback handler,
11107 //so remove it.
11108 if (typeof relName === 'function') {
11109 relName = forceSync;
11110 forceSync = alt;
11111 }
11112
11113 //Simulate async callback;
11114 if (forceSync) {
11115 main(undef, deps, callback, relName);
11116 } else {
11117 //Using a non-zero value because of concern for what old browsers
11118 //do, and latest browsers "upgrade" to 4 if lower value is used:
11119 //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
11120 //If want a value immediately, use require('id') instead -- something
11121 //that works in almond on the global level, but not guaranteed and
11122 //unlikely to work in other AMD implementations.
11123 setTimeout(function () {
11124 main(undef, deps, callback, relName);
11125 }, 4);
11126 }
11127
11128 return req;
11129 };
11130
11131 /**
11132 * Just drops the config on the floor, but returns req in case
11133 * the config return value is used.
11134 */
11135 req.config = function (cfg) {
11136 return req(cfg);
11137 };
11138
11139 /**
11140 * Expose module registry for debugging and tooling
11141 */
11142 requirejs._defined = defined;
11143
11144 define = function (name, deps, callback) {
11145 if (typeof name !== 'string') {
11146 throw new Error('See almond README: incorrect module build, no module name');
11147 }
11148
11149 //This module may not have dependencies
11150 if (!deps.splice) {
11151 //deps is not an array, so probably means
11152 //an object literal or factory function for
11153 //the value. Adjust args.
11154 callback = deps;
11155 deps = [];
11156 }
11157
11158 if (!hasProp(defined, name) && !hasProp(waiting, name)) {
11159 waiting[name] = [name, deps, callback];
11160 }
11161 };
11162
11163 define.amd = {
11164 jQuery: true
11165 };
11166}());
11167
11168S2.requirejs = requirejs;S2.require = require;S2.define = define;
11169}
11170}());
11171S2.define("almond", function(){});
11172
11173/* global jQuery:false, $:false */
11174S2.define('jquery',[],function () {
11175 var _$ = jQuery || $;
11176
11177 if (_$ == null && console && console.error) {
11178 console.error(
11179 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
11180 'found. Make sure that you are including jQuery before Select2 on your ' +
11181 'web page.'
11182 );
11183 }
11184
11185 return _$;
11186});
11187
11188S2.define('select2/utils',[
11189 'jquery'
11190], function ($) {
11191 var Utils = {};
11192
11193 Utils.Extend = function (ChildClass, SuperClass) {
11194 var __hasProp = {}.hasOwnProperty;
11195
11196 function BaseConstructor () {
11197 this.constructor = ChildClass;
11198 }
11199
11200 for (var key in SuperClass) {
11201 if (__hasProp.call(SuperClass, key)) {
11202 ChildClass[key] = SuperClass[key];
11203 }
11204 }
11205
11206 BaseConstructor.prototype = SuperClass.prototype;
11207 ChildClass.prototype = new BaseConstructor();
11208 ChildClass.__super__ = SuperClass.prototype;
11209
11210 return ChildClass;
11211 };
11212
11213 function getMethods (theClass) {
11214 var proto = theClass.prototype;
11215
11216 var methods = [];
11217
11218 for (var methodName in proto) {
11219 var m = proto[methodName];
11220
11221 if (typeof m !== 'function') {
11222 continue;
11223 }
11224
11225 if (methodName === 'constructor') {
11226 continue;
11227 }
11228
11229 methods.push(methodName);
11230 }
11231
11232 return methods;
11233 }
11234
11235 Utils.Decorate = function (SuperClass, DecoratorClass) {
11236 var decoratedMethods = getMethods(DecoratorClass);
11237 var superMethods = getMethods(SuperClass);
11238
11239 function DecoratedClass () {
11240 var unshift = Array.prototype.unshift;
11241
11242 var argCount = DecoratorClass.prototype.constructor.length;
11243
11244 var calledConstructor = SuperClass.prototype.constructor;
11245
11246 if (argCount > 0) {
11247 unshift.call(arguments, SuperClass.prototype.constructor);
11248
11249 calledConstructor = DecoratorClass.prototype.constructor;
11250 }
11251
11252 calledConstructor.apply(this, arguments);
11253 }
11254
11255 DecoratorClass.displayName = SuperClass.displayName;
11256
11257 function ctr () {
11258 this.constructor = DecoratedClass;
11259 }
11260
11261 DecoratedClass.prototype = new ctr();
11262
11263 for (var m = 0; m < superMethods.length; m++) {
11264 var superMethod = superMethods[m];
11265
11266 DecoratedClass.prototype[superMethod] =
11267 SuperClass.prototype[superMethod];
11268 }
11269
11270 var calledMethod = function (methodName) {
11271 // Stub out the original method if it's not decorating an actual method
11272 var originalMethod = function () {};
11273
11274 if (methodName in DecoratedClass.prototype) {
11275 originalMethod = DecoratedClass.prototype[methodName];
11276 }
11277
11278 var decoratedMethod = DecoratorClass.prototype[methodName];
11279
11280 return function () {
11281 var unshift = Array.prototype.unshift;
11282
11283 unshift.call(arguments, originalMethod);
11284
11285 return decoratedMethod.apply(this, arguments);
11286 };
11287 };
11288
11289 for (var d = 0; d < decoratedMethods.length; d++) {
11290 var decoratedMethod = decoratedMethods[d];
11291
11292 DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
11293 }
11294
11295 return DecoratedClass;
11296 };
11297
11298 var Observable = function () {
11299 this.listeners = {};
11300 };
11301
11302 Observable.prototype.on = function (event, callback) {
11303 this.listeners = this.listeners || {};
11304
11305 if (event in this.listeners) {
11306 this.listeners[event].push(callback);
11307 } else {
11308 this.listeners[event] = [callback];
11309 }
11310 };
11311
11312 Observable.prototype.trigger = function (event) {
11313 var slice = Array.prototype.slice;
11314 var params = slice.call(arguments, 1);
11315
11316 this.listeners = this.listeners || {};
11317
11318 // Params should always come in as an array
11319 if (params == null) {
11320 params = [];
11321 }
11322
11323 // If there are no arguments to the event, use a temporary object
11324 if (params.length === 0) {
11325 params.push({});
11326 }
11327
11328 // Set the `_type` of the first object to the event
11329 params[0]._type = event;
11330
11331 if (event in this.listeners) {
11332 this.invoke(this.listeners[event], slice.call(arguments, 1));
11333 }
11334
11335 if ('*' in this.listeners) {
11336 this.invoke(this.listeners['*'], arguments);
11337 }
11338 };
11339
11340 Observable.prototype.invoke = function (listeners, params) {
11341 for (var i = 0, len = listeners.length; i < len; i++) {
11342 listeners[i].apply(this, params);
11343 }
11344 };
11345
11346 Utils.Observable = Observable;
11347
11348 Utils.generateChars = function (length) {
11349 var chars = '';
11350
11351 for (var i = 0; i < length; i++) {
11352 var randomChar = Math.floor(Math.random() * 36);
11353 chars += randomChar.toString(36);
11354 }
11355
11356 return chars;
11357 };
11358
11359 Utils.bind = function (func, context) {
11360 return function () {
11361 func.apply(context, arguments);
11362 };
11363 };
11364
11365 Utils._convertData = function (data) {
11366 for (var originalKey in data) {
11367 var keys = originalKey.split('-');
11368
11369 var dataLevel = data;
11370
11371 if (keys.length === 1) {
11372 continue;
11373 }
11374
11375 for (var k = 0; k < keys.length; k++) {
11376 var key = keys[k];
11377
11378 // Lowercase the first letter
11379 // By default, dash-separated becomes camelCase
11380 key = key.substring(0, 1).toLowerCase() + key.substring(1);
11381
11382 if (!(key in dataLevel)) {
11383 dataLevel[key] = {};
11384 }
11385
11386 if (k == keys.length - 1) {
11387 dataLevel[key] = data[originalKey];
11388 }
11389
11390 dataLevel = dataLevel[key];
11391 }
11392
11393 delete data[originalKey];
11394 }
11395
11396 return data;
11397 };
11398
11399 Utils.hasScroll = function (index, el) {
11400 // Adapted from the function created by @ShadowScripter
11401 // and adapted by @BillBarry on the Stack Exchange Code Review website.
11402 // The original code can be found at
11403 // http://codereview.stackexchange.com/q/13338
11404 // and was designed to be used with the Sizzle selector engine.
11405
11406 var $el = $(el);
11407 var overflowX = el.style.overflowX;
11408 var overflowY = el.style.overflowY;
11409
11410 //Check both x and y declarations
11411 if (overflowX === overflowY &&
11412 (overflowY === 'hidden' || overflowY === 'visible')) {
11413 return false;
11414 }
11415
11416 if (overflowX === 'scroll' || overflowY === 'scroll') {
11417 return true;
11418 }
11419
11420 return ($el.innerHeight() < el.scrollHeight ||
11421 $el.innerWidth() < el.scrollWidth);
11422 };
11423
11424 Utils.escapeMarkup = function (markup) {
11425 var replaceMap = {
11426 '\\': '\',
11427 '&': '&',
11428 '<': '<',
11429 '>': '>',
11430 '"': '"',
11431 '\'': ''',
11432 '/': '/'
11433 };
11434
11435 // Do not try to escape the markup if it's not a string
11436 if (typeof markup !== 'string') {
11437 return markup;
11438 }
11439
11440 return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
11441 return replaceMap[match];
11442 });
11443 };
11444
11445 // Append an array of jQuery nodes to a given element.
11446 Utils.appendMany = function ($element, $nodes) {
11447 // jQuery 1.7.x does not support $.fn.append() with an array
11448 // Fall back to a jQuery object collection using $.fn.add()
11449 if ($.fn.jquery.substr(0, 3) === '1.7') {
11450 var $jqNodes = $();
11451
11452 $.map($nodes, function (node) {
11453 $jqNodes = $jqNodes.add(node);
11454 });
11455
11456 $nodes = $jqNodes;
11457 }
11458
11459 $element.append($nodes);
11460 };
11461
11462 // Cache objects in Utils.__cache instead of $.data (see #4346)
11463 Utils.__cache = {};
11464
11465 var id = 0;
11466 Utils.GetUniqueElementId = function (element) {
11467 // Get a unique element Id. If element has no id,
11468 // creates a new unique number, stores it in the id
11469 // attribute and returns the new id.
11470 // If an id already exists, it simply returns it.
11471
11472 var select2Id = element.getAttribute('data-select2-id');
11473 if (select2Id == null) {
11474 // If element has id, use it.
11475 if (element.id) {
11476 select2Id = element.id;
11477 element.setAttribute('data-select2-id', select2Id);
11478 } else {
11479 element.setAttribute('data-select2-id', ++id);
11480 select2Id = id.toString();
11481 }
11482 }
11483 return select2Id;
11484 };
11485
11486 Utils.StoreData = function (element, name, value) {
11487 // Stores an item in the cache for a specified element.
11488 // name is the cache key.
11489 var id = Utils.GetUniqueElementId(element);
11490 if (!Utils.__cache[id]) {
11491 Utils.__cache[id] = {};
11492 }
11493
11494 Utils.__cache[id][name] = value;
11495 };
11496
11497 Utils.GetData = function (element, name) {
11498 // Retrieves a value from the cache by its key (name)
11499 // name is optional. If no name specified, return
11500 // all cache items for the specified element.
11501 // and for a specified element.
11502 var id = Utils.GetUniqueElementId(element);
11503 if (name) {
11504 if (Utils.__cache[id]) {
11505 if (Utils.__cache[id][name] != null) {
11506 return Utils.__cache[id][name];
11507 }
11508 return $(element).data(name); // Fallback to HTML5 data attribs.
11509 }
11510 return $(element).data(name); // Fallback to HTML5 data attribs.
11511 } else {
11512 return Utils.__cache[id];
11513 }
11514 };
11515
11516 Utils.RemoveData = function (element) {
11517 // Removes all cached items for a specified element.
11518 var id = Utils.GetUniqueElementId(element);
11519 if (Utils.__cache[id] != null) {
11520 delete Utils.__cache[id];
11521 }
11522
11523 element.removeAttribute('data-select2-id');
11524 };
11525
11526 return Utils;
11527});
11528
11529S2.define('select2/results',[
11530 'jquery',
11531 './utils'
11532], function ($, Utils) {
11533 function Results ($element, options, dataAdapter) {
11534 this.$element = $element;
11535 this.data = dataAdapter;
11536 this.options = options;
11537
11538 Results.__super__.constructor.call(this);
11539 }
11540
11541 Utils.Extend(Results, Utils.Observable);
11542
11543 Results.prototype.render = function () {
11544 var $results = $(
11545 '<ul class="select2-results__options" role="listbox"></ul>'
11546 );
11547
11548 if (this.options.get('multiple')) {
11549 $results.attr('aria-multiselectable', 'true');
11550 }
11551
11552 this.$results = $results;
11553
11554 return $results;
11555 };
11556
11557 Results.prototype.clear = function () {
11558 this.$results.empty();
11559 };
11560
11561 Results.prototype.displayMessage = function (params) {
11562 var escapeMarkup = this.options.get('escapeMarkup');
11563
11564 this.clear();
11565 this.hideLoading();
11566
11567 var $message = $(
11568 '<li role="alert" aria-live="assertive"' +
11569 ' class="select2-results__option"></li>'
11570 );
11571
11572 var message = this.options.get('translations').get(params.message);
11573
11574 $message.append(
11575 escapeMarkup(
11576 message(params.args)
11577 )
11578 );
11579
11580 $message[0].className += ' select2-results__message';
11581
11582 this.$results.append($message);
11583 };
11584
11585 Results.prototype.hideMessages = function () {
11586 this.$results.find('.select2-results__message').remove();
11587 };
11588
11589 Results.prototype.append = function (data) {
11590 this.hideLoading();
11591
11592 var $options = [];
11593
11594 if (data.results == null || data.results.length === 0) {
11595 if (this.$results.children().length === 0) {
11596 this.trigger('results:message', {
11597 message: 'noResults'
11598 });
11599 }
11600
11601 return;
11602 }
11603
11604 data.results = this.sort(data.results);
11605
11606 for (var d = 0; d < data.results.length; d++) {
11607 var item = data.results[d];
11608
11609 var $option = this.option(item);
11610
11611 $options.push($option);
11612 }
11613
11614 this.$results.append($options);
11615 };
11616
11617 Results.prototype.position = function ($results, $dropdown) {
11618 var $resultsContainer = $dropdown.find('.select2-results');
11619 $resultsContainer.append($results);
11620 };
11621
11622 Results.prototype.sort = function (data) {
11623 var sorter = this.options.get('sorter');
11624
11625 return sorter(data);
11626 };
11627
11628 Results.prototype.highlightFirstItem = function () {
11629 var $options = this.$results
11630 .find('.select2-results__option[aria-selected]');
11631
11632 var $selected = $options.filter('[aria-selected=true]');
11633
11634 // Check if there are any selected options
11635 if ($selected.length > 0) {
11636 // If there are selected options, highlight the first
11637 $selected.first().trigger('mouseenter');
11638 } else {
11639 // If there are no selected options, highlight the first option
11640 // in the dropdown
11641 $options.first().trigger('mouseenter');
11642 }
11643
11644 this.ensureHighlightVisible();
11645 };
11646
11647 Results.prototype.setClasses = function () {
11648 var self = this;
11649
11650 this.data.current(function (selected) {
11651 var selectedIds = $.map(selected, function (s) {
11652 return s.id.toString();
11653 });
11654
11655 var $options = self.$results
11656 .find('.select2-results__option[aria-selected]');
11657
11658 $options.each(function () {
11659 var $option = $(this);
11660
11661 var item = Utils.GetData(this, 'data');
11662
11663 // id needs to be converted to a string when comparing
11664 var id = '' + item.id;
11665
11666 if ((item.element != null && item.element.selected) ||
11667 (item.element == null && $.inArray(id, selectedIds) > -1)) {
11668 $option.attr('aria-selected', 'true');
11669 } else {
11670 $option.attr('aria-selected', 'false');
11671 }
11672 });
11673
11674 });
11675 };
11676
11677 Results.prototype.showLoading = function (params) {
11678 this.hideLoading();
11679
11680 var loadingMore = this.options.get('translations').get('searching');
11681
11682 var loading = {
11683 disabled: true,
11684 loading: true,
11685 text: loadingMore(params)
11686 };
11687 var $loading = this.option(loading);
11688 $loading.className += ' loading-results';
11689
11690 this.$results.prepend($loading);
11691 };
11692
11693 Results.prototype.hideLoading = function () {
11694 this.$results.find('.loading-results').remove();
11695 };
11696
11697 Results.prototype.option = function (data) {
11698 var option = document.createElement('li');
11699 option.className = 'select2-results__option';
11700
11701 var attrs = {
11702 'role': 'option',
11703 'aria-selected': 'false'
11704 };
11705
11706 var matches = window.Element.prototype.matches ||
11707 window.Element.prototype.msMatchesSelector ||
11708 window.Element.prototype.webkitMatchesSelector;
11709
11710 if ((data.element != null && matches.call(data.element, ':disabled')) ||
11711 (data.element == null && data.disabled)) {
11712 delete attrs['aria-selected'];
11713 attrs['aria-disabled'] = 'true';
11714 }
11715
11716 if (data.id == null) {
11717 delete attrs['aria-selected'];
11718 }
11719
11720 if (data._resultId != null) {
11721 option.id = data._resultId;
11722 }
11723
11724 if (data.title) {
11725 option.title = data.title;
11726 }
11727
11728 if (data.children) {
11729 attrs.role = 'group';
11730 attrs['aria-label'] = data.text;
11731 delete attrs['aria-selected'];
11732 }
11733
11734 for (var attr in attrs) {
11735 var val = attrs[attr];
11736
11737 option.setAttribute(attr, val);
11738 }
11739
11740 if (data.children) {
11741 var $option = $(option);
11742
11743 var label = document.createElement('strong');
11744 label.className = 'select2-results__group';
11745
11746 var $label = $(label);
11747 this.template(data, label);
11748
11749 var $children = [];
11750
11751 for (var c = 0; c < data.children.length; c++) {
11752 var child = data.children[c];
11753
11754 var $child = this.option(child);
11755
11756 $children.push($child);
11757 }
11758
11759 var $childrenContainer = $('<ul></ul>', {
11760 'class': 'select2-results__options select2-results__options--nested'
11761 });
11762
11763 $childrenContainer.append($children);
11764
11765 $option.append(label);
11766 $option.append($childrenContainer);
11767 } else {
11768 this.template(data, option);
11769 }
11770
11771 Utils.StoreData(option, 'data', data);
11772
11773 return option;
11774 };
11775
11776 Results.prototype.bind = function (container, $container) {
11777 var self = this;
11778
11779 var id = container.id + '-results';
11780
11781 this.$results.attr('id', id);
11782
11783 container.on('results:all', function (params) {
11784 self.clear();
11785 self.append(params.data);
11786
11787 if (container.isOpen()) {
11788 self.setClasses();
11789 self.highlightFirstItem();
11790 }
11791 });
11792
11793 container.on('results:append', function (params) {
11794 self.append(params.data);
11795
11796 if (container.isOpen()) {
11797 self.setClasses();
11798 }
11799 });
11800
11801 container.on('query', function (params) {
11802 self.hideMessages();
11803 self.showLoading(params);
11804 });
11805
11806 container.on('select', function () {
11807 if (!container.isOpen()) {
11808 return;
11809 }
11810
11811 self.setClasses();
11812
11813 if (self.options.get('scrollAfterSelect')) {
11814 self.highlightFirstItem();
11815 }
11816 });
11817
11818 container.on('unselect', function () {
11819 if (!container.isOpen()) {
11820 return;
11821 }
11822
11823 self.setClasses();
11824
11825 if (self.options.get('scrollAfterSelect')) {
11826 self.highlightFirstItem();
11827 }
11828 });
11829
11830 container.on('open', function () {
11831 // When the dropdown is open, aria-expended="true"
11832 self.$results.attr('aria-expanded', 'true');
11833 self.$results.attr('aria-hidden', 'false');
11834
11835 self.setClasses();
11836 self.ensureHighlightVisible();
11837 });
11838
11839 container.on('close', function () {
11840 // When the dropdown is closed, aria-expended="false"
11841 self.$results.attr('aria-expanded', 'false');
11842 self.$results.attr('aria-hidden', 'true');
11843 self.$results.removeAttr('aria-activedescendant');
11844 });
11845
11846 container.on('results:toggle', function () {
11847 var $highlighted = self.getHighlightedResults();
11848
11849 if ($highlighted.length === 0) {
11850 return;
11851 }
11852
11853 $highlighted.trigger('mouseup');
11854 });
11855
11856 container.on('results:select', function () {
11857 var $highlighted = self.getHighlightedResults();
11858
11859 if ($highlighted.length === 0) {
11860 return;
11861 }
11862
11863 var data = Utils.GetData($highlighted[0], 'data');
11864
11865 if ($highlighted.attr('aria-selected') == 'true') {
11866 self.trigger('close', {});
11867 } else {
11868 self.trigger('select', {
11869 data: data
11870 });
11871 }
11872 });
11873
11874 container.on('results:previous', function () {
11875 var $highlighted = self.getHighlightedResults();
11876
11877 var $options = self.$results.find('[aria-selected]');
11878
11879 var currentIndex = $options.index($highlighted);
11880
11881 // If we are already at the top, don't move further
11882 // If no options, currentIndex will be -1
11883 if (currentIndex <= 0) {
11884 return;
11885 }
11886
11887 var nextIndex = currentIndex - 1;
11888
11889 // If none are highlighted, highlight the first
11890 if ($highlighted.length === 0) {
11891 nextIndex = 0;
11892 }
11893
11894 var $next = $options.eq(nextIndex);
11895
11896 $next.trigger('mouseenter');
11897
11898 var currentOffset = self.$results.offset().top;
11899 var nextTop = $next.offset().top;
11900 var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
11901
11902 if (nextIndex === 0) {
11903 self.$results.scrollTop(0);
11904 } else if (nextTop - currentOffset < 0) {
11905 self.$results.scrollTop(nextOffset);
11906 }
11907 });
11908
11909 container.on('results:next', function () {
11910 var $highlighted = self.getHighlightedResults();
11911
11912 var $options = self.$results.find('[aria-selected]');
11913
11914 var currentIndex = $options.index($highlighted);
11915
11916 var nextIndex = currentIndex + 1;
11917
11918 // If we are at the last option, stay there
11919 if (nextIndex >= $options.length) {
11920 return;
11921 }
11922
11923 var $next = $options.eq(nextIndex);
11924
11925 $next.trigger('mouseenter');
11926
11927 var currentOffset = self.$results.offset().top +
11928 self.$results.outerHeight(false);
11929 var nextBottom = $next.offset().top + $next.outerHeight(false);
11930 var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
11931
11932 if (nextIndex === 0) {
11933 self.$results.scrollTop(0);
11934 } else if (nextBottom > currentOffset) {
11935 self.$results.scrollTop(nextOffset);
11936 }
11937 });
11938
11939 container.on('results:focus', function (params) {
11940 params.element.addClass('select2-results__option--highlighted');
11941 });
11942
11943 container.on('results:message', function (params) {
11944 self.displayMessage(params);
11945 });
11946
11947 if ($.fn.mousewheel) {
11948 this.$results.on('mousewheel', function (e) {
11949 var top = self.$results.scrollTop();
11950
11951 var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
11952
11953 var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
11954 var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
11955
11956 if (isAtTop) {
11957 self.$results.scrollTop(0);
11958
11959 e.preventDefault();
11960 e.stopPropagation();
11961 } else if (isAtBottom) {
11962 self.$results.scrollTop(
11963 self.$results.get(0).scrollHeight - self.$results.height()
11964 );
11965
11966 e.preventDefault();
11967 e.stopPropagation();
11968 }
11969 });
11970 }
11971
11972 this.$results.on('mouseup', '.select2-results__option[aria-selected]',
11973 function (evt) {
11974 var $this = $(this);
11975
11976 var data = Utils.GetData(this, 'data');
11977
11978 if ($this.attr('aria-selected') === 'true') {
11979 if (self.options.get('multiple')) {
11980 self.trigger('unselect', {
11981 originalEvent: evt,
11982 data: data
11983 });
11984 } else {
11985 self.trigger('close', {});
11986 }
11987
11988 return;
11989 }
11990
11991 self.trigger('select', {
11992 originalEvent: evt,
11993 data: data
11994 });
11995 });
11996
11997 this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
11998 function (evt) {
11999 var data = Utils.GetData(this, 'data');
12000
12001 self.getHighlightedResults()
12002 .removeClass('select2-results__option--highlighted');
12003
12004 self.trigger('results:focus', {
12005 data: data,
12006 element: $(this)
12007 });
12008 });
12009 };
12010
12011 Results.prototype.getHighlightedResults = function () {
12012 var $highlighted = this.$results
12013 .find('.select2-results__option--highlighted');
12014
12015 return $highlighted;
12016 };
12017
12018 Results.prototype.destroy = function () {
12019 this.$results.remove();
12020 };
12021
12022 Results.prototype.ensureHighlightVisible = function () {
12023 var $highlighted = this.getHighlightedResults();
12024
12025 if ($highlighted.length === 0) {
12026 return;
12027 }
12028
12029 var $options = this.$results.find('[aria-selected]');
12030
12031 var currentIndex = $options.index($highlighted);
12032
12033 var currentOffset = this.$results.offset().top;
12034 var nextTop = $highlighted.offset().top;
12035 var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
12036
12037 var offsetDelta = nextTop - currentOffset;
12038 nextOffset -= $highlighted.outerHeight(false) * 2;
12039
12040 if (currentIndex <= 2) {
12041 this.$results.scrollTop(0);
12042 } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
12043 this.$results.scrollTop(nextOffset);
12044 }
12045 };
12046
12047 Results.prototype.template = function (result, container) {
12048 var template = this.options.get('templateResult');
12049 var escapeMarkup = this.options.get('escapeMarkup');
12050
12051 var content = template(result, container);
12052
12053 if (content == null) {
12054 container.style.display = 'none';
12055 } else if (typeof content === 'string') {
12056 container.innerHTML = escapeMarkup(content);
12057 } else {
12058 $(container).append(content);
12059 }
12060 };
12061
12062 return Results;
12063});
12064
12065S2.define('select2/keys',[
12066
12067], function () {
12068 var KEYS = {
12069 BACKSPACE: 8,
12070 TAB: 9,
12071 ENTER: 13,
12072 SHIFT: 16,
12073 CTRL: 17,
12074 ALT: 18,
12075 ESC: 27,
12076 SPACE: 32,
12077 PAGE_UP: 33,
12078 PAGE_DOWN: 34,
12079 END: 35,
12080 HOME: 36,
12081 LEFT: 37,
12082 UP: 38,
12083 RIGHT: 39,
12084 DOWN: 40,
12085 DELETE: 46
12086 };
12087
12088 return KEYS;
12089});
12090
12091S2.define('select2/selection/base',[
12092 'jquery',
12093 '../utils',
12094 '../keys'
12095], function ($, Utils, KEYS) {
12096 function BaseSelection ($element, options) {
12097 this.$element = $element;
12098 this.options = options;
12099
12100 BaseSelection.__super__.constructor.call(this);
12101 }
12102
12103 Utils.Extend(BaseSelection, Utils.Observable);
12104
12105 BaseSelection.prototype.render = function () {
12106 var $selection = $(
12107 '<span class="select2-selection" role="combobox" ' +
12108 ' aria-haspopup="true" aria-expanded="false">' +
12109 '</span>'
12110 );
12111
12112 this._tabindex = 0;
12113
12114 if (Utils.GetData(this.$element[0], 'old-tabindex') != null) {
12115 this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex');
12116 } else if (this.$element.attr('tabindex') != null) {
12117 this._tabindex = this.$element.attr('tabindex');
12118 }
12119
12120 $selection.attr('title', this.$element.attr('title'));
12121 $selection.attr('tabindex', this._tabindex);
12122 $selection.attr('aria-disabled', 'false');
12123
12124 this.$selection = $selection;
12125
12126 return $selection;
12127 };
12128
12129 BaseSelection.prototype.bind = function (container, $container) {
12130 var self = this;
12131
12132 var resultsId = container.id + '-results';
12133
12134 this.container = container;
12135
12136 this.$selection.on('focus', function (evt) {
12137 self.trigger('focus', evt);
12138 });
12139
12140 this.$selection.on('blur', function (evt) {
12141 self._handleBlur(evt);
12142 });
12143
12144 this.$selection.on('keydown', function (evt) {
12145 self.trigger('keypress', evt);
12146
12147 if (evt.which === KEYS.SPACE) {
12148 evt.preventDefault();
12149 }
12150 });
12151
12152 container.on('results:focus', function (params) {
12153 self.$selection.attr('aria-activedescendant', params.data._resultId);
12154 });
12155
12156 container.on('selection:update', function (params) {
12157 self.update(params.data);
12158 });
12159
12160 container.on('open', function () {
12161 // When the dropdown is open, aria-expanded="true"
12162 self.$selection.attr('aria-expanded', 'true');
12163 self.$selection.attr('aria-owns', resultsId);
12164
12165 self._attachCloseHandler(container);
12166 });
12167
12168 container.on('close', function () {
12169 // When the dropdown is closed, aria-expanded="false"
12170 self.$selection.attr('aria-expanded', 'false');
12171 self.$selection.removeAttr('aria-activedescendant');
12172 self.$selection.removeAttr('aria-owns');
12173
12174 self.$selection.trigger('focus');
12175
12176 self._detachCloseHandler(container);
12177 });
12178
12179 container.on('enable', function () {
12180 self.$selection.attr('tabindex', self._tabindex);
12181 self.$selection.attr('aria-disabled', 'false');
12182 });
12183
12184 container.on('disable', function () {
12185 self.$selection.attr('tabindex', '-1');
12186 self.$selection.attr('aria-disabled', 'true');
12187 });
12188 };
12189
12190 BaseSelection.prototype._handleBlur = function (evt) {
12191 var self = this;
12192
12193 // This needs to be delayed as the active element is the body when the tab
12194 // key is pressed, possibly along with others.
12195 window.setTimeout(function () {
12196 // Don't trigger `blur` if the focus is still in the selection
12197 if (
12198 (document.activeElement == self.$selection[0]) ||
12199 ($.contains(self.$selection[0], document.activeElement))
12200 ) {
12201 return;
12202 }
12203
12204 self.trigger('blur', evt);
12205 }, 1);
12206 };
12207
12208 BaseSelection.prototype._attachCloseHandler = function (container) {
12209
12210 $(document.body).on('mousedown.select2.' + container.id, function (e) {
12211 var $target = $(e.target);
12212
12213 var $select = $target.closest('.select2');
12214
12215 var $all = $('.select2.select2-container--open');
12216
12217 $all.each(function () {
12218 if (this == $select[0]) {
12219 return;
12220 }
12221
12222 var $element = Utils.GetData(this, 'element');
12223
12224 $element.select2('close');
12225 });
12226 });
12227 };
12228
12229 BaseSelection.prototype._detachCloseHandler = function (container) {
12230 $(document.body).off('mousedown.select2.' + container.id);
12231 };
12232
12233 BaseSelection.prototype.position = function ($selection, $container) {
12234 var $selectionContainer = $container.find('.selection');
12235 $selectionContainer.append($selection);
12236 };
12237
12238 BaseSelection.prototype.destroy = function () {
12239 this._detachCloseHandler(this.container);
12240 };
12241
12242 BaseSelection.prototype.update = function (data) {
12243 throw new Error('The `update` method must be defined in child classes.');
12244 };
12245
12246 return BaseSelection;
12247});
12248
12249S2.define('select2/selection/single',[
12250 'jquery',
12251 './base',
12252 '../utils',
12253 '../keys'
12254], function ($, BaseSelection, Utils, KEYS) {
12255 function SingleSelection () {
12256 SingleSelection.__super__.constructor.apply(this, arguments);
12257 }
12258
12259 Utils.Extend(SingleSelection, BaseSelection);
12260
12261 SingleSelection.prototype.render = function () {
12262 var $selection = SingleSelection.__super__.render.call(this);
12263
12264 $selection.addClass('select2-selection--single');
12265
12266 $selection.html(
12267 '<span class="select2-selection__rendered"></span>' +
12268 '<span class="select2-selection__arrow" role="presentation">' +
12269 '<b role="presentation"></b>' +
12270 '</span>'
12271 );
12272
12273 return $selection;
12274 };
12275
12276 SingleSelection.prototype.bind = function (container, $container) {
12277 var self = this;
12278
12279 SingleSelection.__super__.bind.apply(this, arguments);
12280
12281 var id = container.id + '-container';
12282
12283 this.$selection.find('.select2-selection__rendered')
12284 .attr('id', id)
12285 .attr('role', 'textbox')
12286 .attr('aria-readonly', 'true');
12287 this.$selection.attr('aria-labelledby', id);
12288
12289 this.$selection.on('mousedown', function (evt) {
12290 // Only respond to left clicks
12291 if (evt.which !== 1) {
12292 return;
12293 }
12294
12295 self.trigger('toggle', {
12296 originalEvent: evt
12297 });
12298 });
12299
12300 this.$selection.on('focus', function (evt) {
12301 // User focuses on the container
12302 });
12303
12304 this.$selection.on('blur', function (evt) {
12305 // User exits the container
12306 });
12307
12308 container.on('focus', function (evt) {
12309 if (!container.isOpen()) {
12310 self.$selection.trigger('focus');
12311 }
12312 });
12313 };
12314
12315 SingleSelection.prototype.clear = function () {
12316 var $rendered = this.$selection.find('.select2-selection__rendered');
12317 $rendered.empty();
12318 $rendered.removeAttr('title'); // clear tooltip on empty
12319 };
12320
12321 SingleSelection.prototype.display = function (data, container) {
12322 var template = this.options.get('templateSelection');
12323 var escapeMarkup = this.options.get('escapeMarkup');
12324
12325 return escapeMarkup(template(data, container));
12326 };
12327
12328 SingleSelection.prototype.selectionContainer = function () {
12329 return $('<span></span>');
12330 };
12331
12332 SingleSelection.prototype.update = function (data) {
12333 if (data.length === 0) {
12334 this.clear();
12335 return;
12336 }
12337
12338 var selection = data[0];
12339
12340 var $rendered = this.$selection.find('.select2-selection__rendered');
12341 var formatted = this.display(selection, $rendered);
12342
12343 $rendered.empty().append(formatted);
12344
12345 var title = selection.title || selection.text;
12346
12347 if (title) {
12348 $rendered.attr('title', title);
12349 } else {
12350 $rendered.removeAttr('title');
12351 }
12352 };
12353
12354 return SingleSelection;
12355});
12356
12357S2.define('select2/selection/multiple',[
12358 'jquery',
12359 './base',
12360 '../utils'
12361], function ($, BaseSelection, Utils) {
12362 function MultipleSelection ($element, options) {
12363 MultipleSelection.__super__.constructor.apply(this, arguments);
12364 }
12365
12366 Utils.Extend(MultipleSelection, BaseSelection);
12367
12368 MultipleSelection.prototype.render = function () {
12369 var $selection = MultipleSelection.__super__.render.call(this);
12370
12371 $selection.addClass('select2-selection--multiple');
12372
12373 $selection.html(
12374 '<ul class="select2-selection__rendered"></ul>'
12375 );
12376
12377 return $selection;
12378 };
12379
12380 MultipleSelection.prototype.bind = function (container, $container) {
12381 var self = this;
12382
12383 MultipleSelection.__super__.bind.apply(this, arguments);
12384
12385 this.$selection.on('click', function (evt) {
12386 self.trigger('toggle', {
12387 originalEvent: evt
12388 });
12389 });
12390
12391 this.$selection.on(
12392 'click',
12393 '.select2-selection__choice__remove',
12394 function (evt) {
12395 // Ignore the event if it is disabled
12396 if (self.options.get('disabled')) {
12397 return;
12398 }
12399
12400 var $remove = $(this);
12401 var $selection = $remove.parent();
12402
12403 var data = Utils.GetData($selection[0], 'data');
12404
12405 self.trigger('unselect', {
12406 originalEvent: evt,
12407 data: data
12408 });
12409 }
12410 );
12411 };
12412
12413 MultipleSelection.prototype.clear = function () {
12414 var $rendered = this.$selection.find('.select2-selection__rendered');
12415 $rendered.empty();
12416 $rendered.removeAttr('title');
12417 };
12418
12419 MultipleSelection.prototype.display = function (data, container) {
12420 var template = this.options.get('templateSelection');
12421 var escapeMarkup = this.options.get('escapeMarkup');
12422
12423 return escapeMarkup(template(data, container));
12424 };
12425
12426 MultipleSelection.prototype.selectionContainer = function () {
12427 var $container = $(
12428 '<li class="select2-selection__choice">' +
12429 '<span class="select2-selection__choice__remove" role="presentation">' +
12430 '×' +
12431 '</span>' +
12432 '</li>'
12433 );
12434
12435 return $container;
12436 };
12437
12438 MultipleSelection.prototype.update = function (data) {
12439 this.clear();
12440
12441 if (data.length === 0) {
12442 return;
12443 }
12444
12445 var $selections = [];
12446
12447 for (var d = 0; d < data.length; d++) {
12448 var selection = data[d];
12449
12450 var $selection = this.selectionContainer();
12451 var formatted = this.display(selection, $selection);
12452
12453 $selection.append(formatted);
12454
12455 var title = selection.title || selection.text;
12456
12457 if (title) {
12458 $selection.attr('title', title);
12459 }
12460
12461 Utils.StoreData($selection[0], 'data', selection);
12462
12463 $selections.push($selection);
12464 }
12465
12466 var $rendered = this.$selection.find('.select2-selection__rendered');
12467
12468 Utils.appendMany($rendered, $selections);
12469 };
12470
12471 return MultipleSelection;
12472});
12473
12474S2.define('select2/selection/placeholder',[
12475 '../utils'
12476], function (Utils) {
12477 function Placeholder (decorated, $element, options) {
12478 this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
12479
12480 decorated.call(this, $element, options);
12481 }
12482
12483 Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
12484 if (typeof placeholder === 'string') {
12485 placeholder = {
12486 id: '',
12487 text: placeholder
12488 };
12489 }
12490
12491 return placeholder;
12492 };
12493
12494 Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
12495 var $placeholder = this.selectionContainer();
12496
12497 $placeholder.html(this.display(placeholder));
12498 $placeholder.addClass('select2-selection__placeholder')
12499 .removeClass('select2-selection__choice');
12500
12501 return $placeholder;
12502 };
12503
12504 Placeholder.prototype.update = function (decorated, data) {
12505 var singlePlaceholder = (
12506 data.length == 1 && data[0].id != this.placeholder.id
12507 );
12508 var multipleSelections = data.length > 1;
12509
12510 if (multipleSelections || singlePlaceholder) {
12511 return decorated.call(this, data);
12512 }
12513
12514 this.clear();
12515
12516 var $placeholder = this.createPlaceholder(this.placeholder);
12517
12518 this.$selection.find('.select2-selection__rendered').append($placeholder);
12519 };
12520
12521 return Placeholder;
12522});
12523
12524S2.define('select2/selection/allowClear',[
12525 'jquery',
12526 '../keys',
12527 '../utils'
12528], function ($, KEYS, Utils) {
12529 function AllowClear () { }
12530
12531 AllowClear.prototype.bind = function (decorated, container, $container) {
12532 var self = this;
12533
12534 decorated.call(this, container, $container);
12535
12536 if (this.placeholder == null) {
12537 if (this.options.get('debug') && window.console && console.error) {
12538 console.error(
12539 'Select2: The `allowClear` option should be used in combination ' +
12540 'with the `placeholder` option.'
12541 );
12542 }
12543 }
12544
12545 this.$selection.on('mousedown', '.select2-selection__clear',
12546 function (evt) {
12547 self._handleClear(evt);
12548 });
12549
12550 container.on('keypress', function (evt) {
12551 self._handleKeyboardClear(evt, container);
12552 });
12553 };
12554
12555 AllowClear.prototype._handleClear = function (_, evt) {
12556 // Ignore the event if it is disabled
12557 if (this.options.get('disabled')) {
12558 return;
12559 }
12560
12561 var $clear = this.$selection.find('.select2-selection__clear');
12562
12563 // Ignore the event if nothing has been selected
12564 if ($clear.length === 0) {
12565 return;
12566 }
12567
12568 evt.stopPropagation();
12569
12570 var data = Utils.GetData($clear[0], 'data');
12571
12572 var previousVal = this.$element.val();
12573 this.$element.val(this.placeholder.id);
12574
12575 var unselectData = {
12576 data: data
12577 };
12578 this.trigger('clear', unselectData);
12579 if (unselectData.prevented) {
12580 this.$element.val(previousVal);
12581 return;
12582 }
12583
12584 for (var d = 0; d < data.length; d++) {
12585 unselectData = {
12586 data: data[d]
12587 };
12588
12589 // Trigger the `unselect` event, so people can prevent it from being
12590 // cleared.
12591 this.trigger('unselect', unselectData);
12592
12593 // If the event was prevented, don't clear it out.
12594 if (unselectData.prevented) {
12595 this.$element.val(previousVal);
12596 return;
12597 }
12598 }
12599
12600 this.$element.trigger('change');
12601
12602 this.trigger('toggle', {});
12603 };
12604
12605 AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
12606 if (container.isOpen()) {
12607 return;
12608 }
12609
12610 if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
12611 this._handleClear(evt);
12612 }
12613 };
12614
12615 AllowClear.prototype.update = function (decorated, data) {
12616 decorated.call(this, data);
12617
12618 if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
12619 data.length === 0) {
12620 return;
12621 }
12622
12623 var removeAll = this.options.get('translations').get('removeAllItems');
12624
12625 var $remove = $(
12626 '<span class="select2-selection__clear" title="' + removeAll() +'">' +
12627 '×' +
12628 '</span>'
12629 );
12630 Utils.StoreData($remove[0], 'data', data);
12631
12632 this.$selection.find('.select2-selection__rendered').prepend($remove);
12633 };
12634
12635 return AllowClear;
12636});
12637
12638S2.define('select2/selection/search',[
12639 'jquery',
12640 '../utils',
12641 '../keys'
12642], function ($, Utils, KEYS) {
12643 function Search (decorated, $element, options) {
12644 decorated.call(this, $element, options);
12645 }
12646
12647 Search.prototype.render = function (decorated) {
12648 var $search = $(
12649 '<li class="select2-search select2-search--inline">' +
12650 '<input class="select2-search__field" type="search" tabindex="-1"' +
12651 ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
12652 ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' +
12653 '</li>'
12654 );
12655
12656 this.$searchContainer = $search;
12657 this.$search = $search.find('input');
12658
12659 var $rendered = decorated.call(this);
12660
12661 this._transferTabIndex();
12662
12663 return $rendered;
12664 };
12665
12666 Search.prototype.bind = function (decorated, container, $container) {
12667 var self = this;
12668
12669 var resultsId = container.id + '-results';
12670
12671 decorated.call(this, container, $container);
12672
12673 container.on('open', function () {
12674 self.$search.attr('aria-controls', resultsId);
12675 self.$search.trigger('focus');
12676 });
12677
12678 container.on('close', function () {
12679 self.$search.val('');
12680 self.$search.removeAttr('aria-controls');
12681 self.$search.removeAttr('aria-activedescendant');
12682 self.$search.trigger('focus');
12683 });
12684
12685 container.on('enable', function () {
12686 self.$search.prop('disabled', false);
12687
12688 self._transferTabIndex();
12689 });
12690
12691 container.on('disable', function () {
12692 self.$search.prop('disabled', true);
12693 });
12694
12695 container.on('focus', function (evt) {
12696 self.$search.trigger('focus');
12697 });
12698
12699 container.on('results:focus', function (params) {
12700 if (params.data._resultId) {
12701 self.$search.attr('aria-activedescendant', params.data._resultId);
12702 } else {
12703 self.$search.removeAttr('aria-activedescendant');
12704 }
12705 });
12706
12707 this.$selection.on('focusin', '.select2-search--inline', function (evt) {
12708 self.trigger('focus', evt);
12709 });
12710
12711 this.$selection.on('focusout', '.select2-search--inline', function (evt) {
12712 self._handleBlur(evt);
12713 });
12714
12715 this.$selection.on('keydown', '.select2-search--inline', function (evt) {
12716 evt.stopPropagation();
12717
12718 self.trigger('keypress', evt);
12719
12720 self._keyUpPrevented = evt.isDefaultPrevented();
12721
12722 var key = evt.which;
12723
12724 if (key === KEYS.BACKSPACE && self.$search.val() === '') {
12725 var $previousChoice = self.$searchContainer
12726 .prev('.select2-selection__choice');
12727
12728 if ($previousChoice.length > 0) {
12729 var item = Utils.GetData($previousChoice[0], 'data');
12730
12731 self.searchRemoveChoice(item);
12732
12733 evt.preventDefault();
12734 }
12735 }
12736 });
12737
12738 this.$selection.on('click', '.select2-search--inline', function (evt) {
12739 if (self.$search.val()) {
12740 evt.stopPropagation();
12741 }
12742 });
12743
12744 // Try to detect the IE version should the `documentMode` property that
12745 // is stored on the document. This is only implemented in IE and is
12746 // slightly cleaner than doing a user agent check.
12747 // This property is not available in Edge, but Edge also doesn't have
12748 // this bug.
12749 var msie = document.documentMode;
12750 var disableInputEvents = msie && msie <= 11;
12751
12752 // Workaround for browsers which do not support the `input` event
12753 // This will prevent double-triggering of events for browsers which support
12754 // both the `keyup` and `input` events.
12755 this.$selection.on(
12756 'input.searchcheck',
12757 '.select2-search--inline',
12758 function (evt) {
12759 // IE will trigger the `input` event when a placeholder is used on a
12760 // search box. To get around this issue, we are forced to ignore all
12761 // `input` events in IE and keep using `keyup`.
12762 if (disableInputEvents) {
12763 self.$selection.off('input.search input.searchcheck');
12764 return;
12765 }
12766
12767 // Unbind the duplicated `keyup` event
12768 self.$selection.off('keyup.search');
12769 }
12770 );
12771
12772 this.$selection.on(
12773 'keyup.search input.search',
12774 '.select2-search--inline',
12775 function (evt) {
12776 // IE will trigger the `input` event when a placeholder is used on a
12777 // search box. To get around this issue, we are forced to ignore all
12778 // `input` events in IE and keep using `keyup`.
12779 if (disableInputEvents && evt.type === 'input') {
12780 self.$selection.off('input.search input.searchcheck');
12781 return;
12782 }
12783
12784 var key = evt.which;
12785
12786 // We can freely ignore events from modifier keys
12787 if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
12788 return;
12789 }
12790
12791 // Tabbing will be handled during the `keydown` phase
12792 if (key == KEYS.TAB) {
12793 return;
12794 }
12795
12796 self.handleSearch(evt);
12797 }
12798 );
12799 };
12800
12801 /**
12802 * This method will transfer the tabindex attribute from the rendered
12803 * selection to the search box. This allows for the search box to be used as
12804 * the primary focus instead of the selection container.
12805 *
12806 * @private
12807 */
12808 Search.prototype._transferTabIndex = function (decorated) {
12809 this.$search.attr('tabindex', this.$selection.attr('tabindex'));
12810 this.$selection.attr('tabindex', '-1');
12811 };
12812
12813 Search.prototype.createPlaceholder = function (decorated, placeholder) {
12814 this.$search.attr('placeholder', placeholder.text);
12815 };
12816
12817 Search.prototype.update = function (decorated, data) {
12818 var searchHadFocus = this.$search[0] == document.activeElement;
12819
12820 this.$search.attr('placeholder', '');
12821
12822 decorated.call(this, data);
12823
12824 this.$selection.find('.select2-selection__rendered')
12825 .append(this.$searchContainer);
12826
12827 this.resizeSearch();
12828 if (searchHadFocus) {
12829 this.$search.trigger('focus');
12830 }
12831 };
12832
12833 Search.prototype.handleSearch = function () {
12834 this.resizeSearch();
12835
12836 if (!this._keyUpPrevented) {
12837 var input = this.$search.val();
12838
12839 this.trigger('query', {
12840 term: input
12841 });
12842 }
12843
12844 this._keyUpPrevented = false;
12845 };
12846
12847 Search.prototype.searchRemoveChoice = function (decorated, item) {
12848 this.trigger('unselect', {
12849 data: item
12850 });
12851
12852 this.$search.val(item.text);
12853 this.handleSearch();
12854 };
12855
12856 Search.prototype.resizeSearch = function () {
12857 this.$search.css('width', '25px');
12858
12859 var width = '';
12860
12861 if (this.$search.attr('placeholder') !== '') {
12862 width = this.$selection.find('.select2-selection__rendered').width();
12863 } else {
12864 var minimumWidth = this.$search.val().length + 1;
12865
12866 width = (minimumWidth * 0.75) + 'em';
12867 }
12868
12869 this.$search.css('width', width);
12870 };
12871
12872 return Search;
12873});
12874
12875S2.define('select2/selection/eventRelay',[
12876 'jquery'
12877], function ($) {
12878 function EventRelay () { }
12879
12880 EventRelay.prototype.bind = function (decorated, container, $container) {
12881 var self = this;
12882 var relayEvents = [
12883 'open', 'opening',
12884 'close', 'closing',
12885 'select', 'selecting',
12886 'unselect', 'unselecting',
12887 'clear', 'clearing'
12888 ];
12889
12890 var preventableEvents = [
12891 'opening', 'closing', 'selecting', 'unselecting', 'clearing'
12892 ];
12893
12894 decorated.call(this, container, $container);
12895
12896 container.on('*', function (name, params) {
12897 // Ignore events that should not be relayed
12898 if ($.inArray(name, relayEvents) === -1) {
12899 return;
12900 }
12901
12902 // The parameters should always be an object
12903 params = params || {};
12904
12905 // Generate the jQuery event for the Select2 event
12906 var evt = $.Event('select2:' + name, {
12907 params: params
12908 });
12909
12910 self.$element.trigger(evt);
12911
12912 // Only handle preventable events if it was one
12913 if ($.inArray(name, preventableEvents) === -1) {
12914 return;
12915 }
12916
12917 params.prevented = evt.isDefaultPrevented();
12918 });
12919 };
12920
12921 return EventRelay;
12922});
12923
12924S2.define('select2/translation',[
12925 'jquery',
12926 'require'
12927], function ($, require) {
12928 function Translation (dict) {
12929 this.dict = dict || {};
12930 }
12931
12932 Translation.prototype.all = function () {
12933 return this.dict;
12934 };
12935
12936 Translation.prototype.get = function (key) {
12937 return this.dict[key];
12938 };
12939
12940 Translation.prototype.extend = function (translation) {
12941 this.dict = $.extend({}, translation.all(), this.dict);
12942 };
12943
12944 // Static functions
12945
12946 Translation._cache = {};
12947
12948 Translation.loadPath = function (path) {
12949 if (!(path in Translation._cache)) {
12950 var translations = require(path);
12951
12952 Translation._cache[path] = translations;
12953 }
12954
12955 return new Translation(Translation._cache[path]);
12956 };
12957
12958 return Translation;
12959});
12960
12961S2.define('select2/diacritics',[
12962
12963], function () {
12964 var diacritics = {
12965 '\u24B6': 'A',
12966 '\uFF21': 'A',
12967 '\u00C0': 'A',
12968 '\u00C1': 'A',
12969 '\u00C2': 'A',
12970 '\u1EA6': 'A',
12971 '\u1EA4': 'A',
12972 '\u1EAA': 'A',
12973 '\u1EA8': 'A',
12974 '\u00C3': 'A',
12975 '\u0100': 'A',
12976 '\u0102': 'A',
12977 '\u1EB0': 'A',
12978 '\u1EAE': 'A',
12979 '\u1EB4': 'A',
12980 '\u1EB2': 'A',
12981 '\u0226': 'A',
12982 '\u01E0': 'A',
12983 '\u00C4': 'A',
12984 '\u01DE': 'A',
12985 '\u1EA2': 'A',
12986 '\u00C5': 'A',
12987 '\u01FA': 'A',
12988 '\u01CD': 'A',
12989 '\u0200': 'A',
12990 '\u0202': 'A',
12991 '\u1EA0': 'A',
12992 '\u1EAC': 'A',
12993 '\u1EB6': 'A',
12994 '\u1E00': 'A',
12995 '\u0104': 'A',
12996 '\u023A': 'A',
12997 '\u2C6F': 'A',
12998 '\uA732': 'AA',
12999 '\u00C6': 'AE',
13000 '\u01FC': 'AE',
13001 '\u01E2': 'AE',
13002 '\uA734': 'AO',
13003 '\uA736': 'AU',
13004 '\uA738': 'AV',
13005 '\uA73A': 'AV',
13006 '\uA73C': 'AY',
13007 '\u24B7': 'B',
13008 '\uFF22': 'B',
13009 '\u1E02': 'B',
13010 '\u1E04': 'B',
13011 '\u1E06': 'B',
13012 '\u0243': 'B',
13013 '\u0182': 'B',
13014 '\u0181': 'B',
13015 '\u24B8': 'C',
13016 '\uFF23': 'C',
13017 '\u0106': 'C',
13018 '\u0108': 'C',
13019 '\u010A': 'C',
13020 '\u010C': 'C',
13021 '\u00C7': 'C',
13022 '\u1E08': 'C',
13023 '\u0187': 'C',
13024 '\u023B': 'C',
13025 '\uA73E': 'C',
13026 '\u24B9': 'D',
13027 '\uFF24': 'D',
13028 '\u1E0A': 'D',
13029 '\u010E': 'D',
13030 '\u1E0C': 'D',
13031 '\u1E10': 'D',
13032 '\u1E12': 'D',
13033 '\u1E0E': 'D',
13034 '\u0110': 'D',
13035 '\u018B': 'D',
13036 '\u018A': 'D',
13037 '\u0189': 'D',
13038 '\uA779': 'D',
13039 '\u01F1': 'DZ',
13040 '\u01C4': 'DZ',
13041 '\u01F2': 'Dz',
13042 '\u01C5': 'Dz',
13043 '\u24BA': 'E',
13044 '\uFF25': 'E',
13045 '\u00C8': 'E',
13046 '\u00C9': 'E',
13047 '\u00CA': 'E',
13048 '\u1EC0': 'E',
13049 '\u1EBE': 'E',
13050 '\u1EC4': 'E',
13051 '\u1EC2': 'E',
13052 '\u1EBC': 'E',
13053 '\u0112': 'E',
13054 '\u1E14': 'E',
13055 '\u1E16': 'E',
13056 '\u0114': 'E',
13057 '\u0116': 'E',
13058 '\u00CB': 'E',
13059 '\u1EBA': 'E',
13060 '\u011A': 'E',
13061 '\u0204': 'E',
13062 '\u0206': 'E',
13063 '\u1EB8': 'E',
13064 '\u1EC6': 'E',
13065 '\u0228': 'E',
13066 '\u1E1C': 'E',
13067 '\u0118': 'E',
13068 '\u1E18': 'E',
13069 '\u1E1A': 'E',
13070 '\u0190': 'E',
13071 '\u018E': 'E',
13072 '\u24BB': 'F',
13073 '\uFF26': 'F',
13074 '\u1E1E': 'F',
13075 '\u0191': 'F',
13076 '\uA77B': 'F',
13077 '\u24BC': 'G',
13078 '\uFF27': 'G',
13079 '\u01F4': 'G',
13080 '\u011C': 'G',
13081 '\u1E20': 'G',
13082 '\u011E': 'G',
13083 '\u0120': 'G',
13084 '\u01E6': 'G',
13085 '\u0122': 'G',
13086 '\u01E4': 'G',
13087 '\u0193': 'G',
13088 '\uA7A0': 'G',
13089 '\uA77D': 'G',
13090 '\uA77E': 'G',
13091 '\u24BD': 'H',
13092 '\uFF28': 'H',
13093 '\u0124': 'H',
13094 '\u1E22': 'H',
13095 '\u1E26': 'H',
13096 '\u021E': 'H',
13097 '\u1E24': 'H',
13098 '\u1E28': 'H',
13099 '\u1E2A': 'H',
13100 '\u0126': 'H',
13101 '\u2C67': 'H',
13102 '\u2C75': 'H',
13103 '\uA78D': 'H',
13104 '\u24BE': 'I',
13105 '\uFF29': 'I',
13106 '\u00CC': 'I',
13107 '\u00CD': 'I',
13108 '\u00CE': 'I',
13109 '\u0128': 'I',
13110 '\u012A': 'I',
13111 '\u012C': 'I',
13112 '\u0130': 'I',
13113 '\u00CF': 'I',
13114 '\u1E2E': 'I',
13115 '\u1EC8': 'I',
13116 '\u01CF': 'I',
13117 '\u0208': 'I',
13118 '\u020A': 'I',
13119 '\u1ECA': 'I',
13120 '\u012E': 'I',
13121 '\u1E2C': 'I',
13122 '\u0197': 'I',
13123 '\u24BF': 'J',
13124 '\uFF2A': 'J',
13125 '\u0134': 'J',
13126 '\u0248': 'J',
13127 '\u24C0': 'K',
13128 '\uFF2B': 'K',
13129 '\u1E30': 'K',
13130 '\u01E8': 'K',
13131 '\u1E32': 'K',
13132 '\u0136': 'K',
13133 '\u1E34': 'K',
13134 '\u0198': 'K',
13135 '\u2C69': 'K',
13136 '\uA740': 'K',
13137 '\uA742': 'K',
13138 '\uA744': 'K',
13139 '\uA7A2': 'K',
13140 '\u24C1': 'L',
13141 '\uFF2C': 'L',
13142 '\u013F': 'L',
13143 '\u0139': 'L',
13144 '\u013D': 'L',
13145 '\u1E36': 'L',
13146 '\u1E38': 'L',
13147 '\u013B': 'L',
13148 '\u1E3C': 'L',
13149 '\u1E3A': 'L',
13150 '\u0141': 'L',
13151 '\u023D': 'L',
13152 '\u2C62': 'L',
13153 '\u2C60': 'L',
13154 '\uA748': 'L',
13155 '\uA746': 'L',
13156 '\uA780': 'L',
13157 '\u01C7': 'LJ',
13158 '\u01C8': 'Lj',
13159 '\u24C2': 'M',
13160 '\uFF2D': 'M',
13161 '\u1E3E': 'M',
13162 '\u1E40': 'M',
13163 '\u1E42': 'M',
13164 '\u2C6E': 'M',
13165 '\u019C': 'M',
13166 '\u24C3': 'N',
13167 '\uFF2E': 'N',
13168 '\u01F8': 'N',
13169 '\u0143': 'N',
13170 '\u00D1': 'N',
13171 '\u1E44': 'N',
13172 '\u0147': 'N',
13173 '\u1E46': 'N',
13174 '\u0145': 'N',
13175 '\u1E4A': 'N',
13176 '\u1E48': 'N',
13177 '\u0220': 'N',
13178 '\u019D': 'N',
13179 '\uA790': 'N',
13180 '\uA7A4': 'N',
13181 '\u01CA': 'NJ',
13182 '\u01CB': 'Nj',
13183 '\u24C4': 'O',
13184 '\uFF2F': 'O',
13185 '\u00D2': 'O',
13186 '\u00D3': 'O',
13187 '\u00D4': 'O',
13188 '\u1ED2': 'O',
13189 '\u1ED0': 'O',
13190 '\u1ED6': 'O',
13191 '\u1ED4': 'O',
13192 '\u00D5': 'O',
13193 '\u1E4C': 'O',
13194 '\u022C': 'O',
13195 '\u1E4E': 'O',
13196 '\u014C': 'O',
13197 '\u1E50': 'O',
13198 '\u1E52': 'O',
13199 '\u014E': 'O',
13200 '\u022E': 'O',
13201 '\u0230': 'O',
13202 '\u00D6': 'O',
13203 '\u022A': 'O',
13204 '\u1ECE': 'O',
13205 '\u0150': 'O',
13206 '\u01D1': 'O',
13207 '\u020C': 'O',
13208 '\u020E': 'O',
13209 '\u01A0': 'O',
13210 '\u1EDC': 'O',
13211 '\u1EDA': 'O',
13212 '\u1EE0': 'O',
13213 '\u1EDE': 'O',
13214 '\u1EE2': 'O',
13215 '\u1ECC': 'O',
13216 '\u1ED8': 'O',
13217 '\u01EA': 'O',
13218 '\u01EC': 'O',
13219 '\u00D8': 'O',
13220 '\u01FE': 'O',
13221 '\u0186': 'O',
13222 '\u019F': 'O',
13223 '\uA74A': 'O',
13224 '\uA74C': 'O',
13225 '\u0152': 'OE',
13226 '\u01A2': 'OI',
13227 '\uA74E': 'OO',
13228 '\u0222': 'OU',
13229 '\u24C5': 'P',
13230 '\uFF30': 'P',
13231 '\u1E54': 'P',
13232 '\u1E56': 'P',
13233 '\u01A4': 'P',
13234 '\u2C63': 'P',
13235 '\uA750': 'P',
13236 '\uA752': 'P',
13237 '\uA754': 'P',
13238 '\u24C6': 'Q',
13239 '\uFF31': 'Q',
13240 '\uA756': 'Q',
13241 '\uA758': 'Q',
13242 '\u024A': 'Q',
13243 '\u24C7': 'R',
13244 '\uFF32': 'R',
13245 '\u0154': 'R',
13246 '\u1E58': 'R',
13247 '\u0158': 'R',
13248 '\u0210': 'R',
13249 '\u0212': 'R',
13250 '\u1E5A': 'R',
13251 '\u1E5C': 'R',
13252 '\u0156': 'R',
13253 '\u1E5E': 'R',
13254 '\u024C': 'R',
13255 '\u2C64': 'R',
13256 '\uA75A': 'R',
13257 '\uA7A6': 'R',
13258 '\uA782': 'R',
13259 '\u24C8': 'S',
13260 '\uFF33': 'S',
13261 '\u1E9E': 'S',
13262 '\u015A': 'S',
13263 '\u1E64': 'S',
13264 '\u015C': 'S',
13265 '\u1E60': 'S',
13266 '\u0160': 'S',
13267 '\u1E66': 'S',
13268 '\u1E62': 'S',
13269 '\u1E68': 'S',
13270 '\u0218': 'S',
13271 '\u015E': 'S',
13272 '\u2C7E': 'S',
13273 '\uA7A8': 'S',
13274 '\uA784': 'S',
13275 '\u24C9': 'T',
13276 '\uFF34': 'T',
13277 '\u1E6A': 'T',
13278 '\u0164': 'T',
13279 '\u1E6C': 'T',
13280 '\u021A': 'T',
13281 '\u0162': 'T',
13282 '\u1E70': 'T',
13283 '\u1E6E': 'T',
13284 '\u0166': 'T',
13285 '\u01AC': 'T',
13286 '\u01AE': 'T',
13287 '\u023E': 'T',
13288 '\uA786': 'T',
13289 '\uA728': 'TZ',
13290 '\u24CA': 'U',
13291 '\uFF35': 'U',
13292 '\u00D9': 'U',
13293 '\u00DA': 'U',
13294 '\u00DB': 'U',
13295 '\u0168': 'U',
13296 '\u1E78': 'U',
13297 '\u016A': 'U',
13298 '\u1E7A': 'U',
13299 '\u016C': 'U',
13300 '\u00DC': 'U',
13301 '\u01DB': 'U',
13302 '\u01D7': 'U',
13303 '\u01D5': 'U',
13304 '\u01D9': 'U',
13305 '\u1EE6': 'U',
13306 '\u016E': 'U',
13307 '\u0170': 'U',
13308 '\u01D3': 'U',
13309 '\u0214': 'U',
13310 '\u0216': 'U',
13311 '\u01AF': 'U',
13312 '\u1EEA': 'U',
13313 '\u1EE8': 'U',
13314 '\u1EEE': 'U',
13315 '\u1EEC': 'U',
13316 '\u1EF0': 'U',
13317 '\u1EE4': 'U',
13318 '\u1E72': 'U',
13319 '\u0172': 'U',
13320 '\u1E76': 'U',
13321 '\u1E74': 'U',
13322 '\u0244': 'U',
13323 '\u24CB': 'V',
13324 '\uFF36': 'V',
13325 '\u1E7C': 'V',
13326 '\u1E7E': 'V',
13327 '\u01B2': 'V',
13328 '\uA75E': 'V',
13329 '\u0245': 'V',
13330 '\uA760': 'VY',
13331 '\u24CC': 'W',
13332 '\uFF37': 'W',
13333 '\u1E80': 'W',
13334 '\u1E82': 'W',
13335 '\u0174': 'W',
13336 '\u1E86': 'W',
13337 '\u1E84': 'W',
13338 '\u1E88': 'W',
13339 '\u2C72': 'W',
13340 '\u24CD': 'X',
13341 '\uFF38': 'X',
13342 '\u1E8A': 'X',
13343 '\u1E8C': 'X',
13344 '\u24CE': 'Y',
13345 '\uFF39': 'Y',
13346 '\u1EF2': 'Y',
13347 '\u00DD': 'Y',
13348 '\u0176': 'Y',
13349 '\u1EF8': 'Y',
13350 '\u0232': 'Y',
13351 '\u1E8E': 'Y',
13352 '\u0178': 'Y',
13353 '\u1EF6': 'Y',
13354 '\u1EF4': 'Y',
13355 '\u01B3': 'Y',
13356 '\u024E': 'Y',
13357 '\u1EFE': 'Y',
13358 '\u24CF': 'Z',
13359 '\uFF3A': 'Z',
13360 '\u0179': 'Z',
13361 '\u1E90': 'Z',
13362 '\u017B': 'Z',
13363 '\u017D': 'Z',
13364 '\u1E92': 'Z',
13365 '\u1E94': 'Z',
13366 '\u01B5': 'Z',
13367 '\u0224': 'Z',
13368 '\u2C7F': 'Z',
13369 '\u2C6B': 'Z',
13370 '\uA762': 'Z',
13371 '\u24D0': 'a',
13372 '\uFF41': 'a',
13373 '\u1E9A': 'a',
13374 '\u00E0': 'a',
13375 '\u00E1': 'a',
13376 '\u00E2': 'a',
13377 '\u1EA7': 'a',
13378 '\u1EA5': 'a',
13379 '\u1EAB': 'a',
13380 '\u1EA9': 'a',
13381 '\u00E3': 'a',
13382 '\u0101': 'a',
13383 '\u0103': 'a',
13384 '\u1EB1': 'a',
13385 '\u1EAF': 'a',
13386 '\u1EB5': 'a',
13387 '\u1EB3': 'a',
13388 '\u0227': 'a',
13389 '\u01E1': 'a',
13390 '\u00E4': 'a',
13391 '\u01DF': 'a',
13392 '\u1EA3': 'a',
13393 '\u00E5': 'a',
13394 '\u01FB': 'a',
13395 '\u01CE': 'a',
13396 '\u0201': 'a',
13397 '\u0203': 'a',
13398 '\u1EA1': 'a',
13399 '\u1EAD': 'a',
13400 '\u1EB7': 'a',
13401 '\u1E01': 'a',
13402 '\u0105': 'a',
13403 '\u2C65': 'a',
13404 '\u0250': 'a',
13405 '\uA733': 'aa',
13406 '\u00E6': 'ae',
13407 '\u01FD': 'ae',
13408 '\u01E3': 'ae',
13409 '\uA735': 'ao',
13410 '\uA737': 'au',
13411 '\uA739': 'av',
13412 '\uA73B': 'av',
13413 '\uA73D': 'ay',
13414 '\u24D1': 'b',
13415 '\uFF42': 'b',
13416 '\u1E03': 'b',
13417 '\u1E05': 'b',
13418 '\u1E07': 'b',
13419 '\u0180': 'b',
13420 '\u0183': 'b',
13421 '\u0253': 'b',
13422 '\u24D2': 'c',
13423 '\uFF43': 'c',
13424 '\u0107': 'c',
13425 '\u0109': 'c',
13426 '\u010B': 'c',
13427 '\u010D': 'c',
13428 '\u00E7': 'c',
13429 '\u1E09': 'c',
13430 '\u0188': 'c',
13431 '\u023C': 'c',
13432 '\uA73F': 'c',
13433 '\u2184': 'c',
13434 '\u24D3': 'd',
13435 '\uFF44': 'd',
13436 '\u1E0B': 'd',
13437 '\u010F': 'd',
13438 '\u1E0D': 'd',
13439 '\u1E11': 'd',
13440 '\u1E13': 'd',
13441 '\u1E0F': 'd',
13442 '\u0111': 'd',
13443 '\u018C': 'd',
13444 '\u0256': 'd',
13445 '\u0257': 'd',
13446 '\uA77A': 'd',
13447 '\u01F3': 'dz',
13448 '\u01C6': 'dz',
13449 '\u24D4': 'e',
13450 '\uFF45': 'e',
13451 '\u00E8': 'e',
13452 '\u00E9': 'e',
13453 '\u00EA': 'e',
13454 '\u1EC1': 'e',
13455 '\u1EBF': 'e',
13456 '\u1EC5': 'e',
13457 '\u1EC3': 'e',
13458 '\u1EBD': 'e',
13459 '\u0113': 'e',
13460 '\u1E15': 'e',
13461 '\u1E17': 'e',
13462 '\u0115': 'e',
13463 '\u0117': 'e',
13464 '\u00EB': 'e',
13465 '\u1EBB': 'e',
13466 '\u011B': 'e',
13467 '\u0205': 'e',
13468 '\u0207': 'e',
13469 '\u1EB9': 'e',
13470 '\u1EC7': 'e',
13471 '\u0229': 'e',
13472 '\u1E1D': 'e',
13473 '\u0119': 'e',
13474 '\u1E19': 'e',
13475 '\u1E1B': 'e',
13476 '\u0247': 'e',
13477 '\u025B': 'e',
13478 '\u01DD': 'e',
13479 '\u24D5': 'f',
13480 '\uFF46': 'f',
13481 '\u1E1F': 'f',
13482 '\u0192': 'f',
13483 '\uA77C': 'f',
13484 '\u24D6': 'g',
13485 '\uFF47': 'g',
13486 '\u01F5': 'g',
13487 '\u011D': 'g',
13488 '\u1E21': 'g',
13489 '\u011F': 'g',
13490 '\u0121': 'g',
13491 '\u01E7': 'g',
13492 '\u0123': 'g',
13493 '\u01E5': 'g',
13494 '\u0260': 'g',
13495 '\uA7A1': 'g',
13496 '\u1D79': 'g',
13497 '\uA77F': 'g',
13498 '\u24D7': 'h',
13499 '\uFF48': 'h',
13500 '\u0125': 'h',
13501 '\u1E23': 'h',
13502 '\u1E27': 'h',
13503 '\u021F': 'h',
13504 '\u1E25': 'h',
13505 '\u1E29': 'h',
13506 '\u1E2B': 'h',
13507 '\u1E96': 'h',
13508 '\u0127': 'h',
13509 '\u2C68': 'h',
13510 '\u2C76': 'h',
13511 '\u0265': 'h',
13512 '\u0195': 'hv',
13513 '\u24D8': 'i',
13514 '\uFF49': 'i',
13515 '\u00EC': 'i',
13516 '\u00ED': 'i',
13517 '\u00EE': 'i',
13518 '\u0129': 'i',
13519 '\u012B': 'i',
13520 '\u012D': 'i',
13521 '\u00EF': 'i',
13522 '\u1E2F': 'i',
13523 '\u1EC9': 'i',
13524 '\u01D0': 'i',
13525 '\u0209': 'i',
13526 '\u020B': 'i',
13527 '\u1ECB': 'i',
13528 '\u012F': 'i',
13529 '\u1E2D': 'i',
13530 '\u0268': 'i',
13531 '\u0131': 'i',
13532 '\u24D9': 'j',
13533 '\uFF4A': 'j',
13534 '\u0135': 'j',
13535 '\u01F0': 'j',
13536 '\u0249': 'j',
13537 '\u24DA': 'k',
13538 '\uFF4B': 'k',
13539 '\u1E31': 'k',
13540 '\u01E9': 'k',
13541 '\u1E33': 'k',
13542 '\u0137': 'k',
13543 '\u1E35': 'k',
13544 '\u0199': 'k',
13545 '\u2C6A': 'k',
13546 '\uA741': 'k',
13547 '\uA743': 'k',
13548 '\uA745': 'k',
13549 '\uA7A3': 'k',
13550 '\u24DB': 'l',
13551 '\uFF4C': 'l',
13552 '\u0140': 'l',
13553 '\u013A': 'l',
13554 '\u013E': 'l',
13555 '\u1E37': 'l',
13556 '\u1E39': 'l',
13557 '\u013C': 'l',
13558 '\u1E3D': 'l',
13559 '\u1E3B': 'l',
13560 '\u017F': 'l',
13561 '\u0142': 'l',
13562 '\u019A': 'l',
13563 '\u026B': 'l',
13564 '\u2C61': 'l',
13565 '\uA749': 'l',
13566 '\uA781': 'l',
13567 '\uA747': 'l',
13568 '\u01C9': 'lj',
13569 '\u24DC': 'm',
13570 '\uFF4D': 'm',
13571 '\u1E3F': 'm',
13572 '\u1E41': 'm',
13573 '\u1E43': 'm',
13574 '\u0271': 'm',
13575 '\u026F': 'm',
13576 '\u24DD': 'n',
13577 '\uFF4E': 'n',
13578 '\u01F9': 'n',
13579 '\u0144': 'n',
13580 '\u00F1': 'n',
13581 '\u1E45': 'n',
13582 '\u0148': 'n',
13583 '\u1E47': 'n',
13584 '\u0146': 'n',
13585 '\u1E4B': 'n',
13586 '\u1E49': 'n',
13587 '\u019E': 'n',
13588 '\u0272': 'n',
13589 '\u0149': 'n',
13590 '\uA791': 'n',
13591 '\uA7A5': 'n',
13592 '\u01CC': 'nj',
13593 '\u24DE': 'o',
13594 '\uFF4F': 'o',
13595 '\u00F2': 'o',
13596 '\u00F3': 'o',
13597 '\u00F4': 'o',
13598 '\u1ED3': 'o',
13599 '\u1ED1': 'o',
13600 '\u1ED7': 'o',
13601 '\u1ED5': 'o',
13602 '\u00F5': 'o',
13603 '\u1E4D': 'o',
13604 '\u022D': 'o',
13605 '\u1E4F': 'o',
13606 '\u014D': 'o',
13607 '\u1E51': 'o',
13608 '\u1E53': 'o',
13609 '\u014F': 'o',
13610 '\u022F': 'o',
13611 '\u0231': 'o',
13612 '\u00F6': 'o',
13613 '\u022B': 'o',
13614 '\u1ECF': 'o',
13615 '\u0151': 'o',
13616 '\u01D2': 'o',
13617 '\u020D': 'o',
13618 '\u020F': 'o',
13619 '\u01A1': 'o',
13620 '\u1EDD': 'o',
13621 '\u1EDB': 'o',
13622 '\u1EE1': 'o',
13623 '\u1EDF': 'o',
13624 '\u1EE3': 'o',
13625 '\u1ECD': 'o',
13626 '\u1ED9': 'o',
13627 '\u01EB': 'o',
13628 '\u01ED': 'o',
13629 '\u00F8': 'o',
13630 '\u01FF': 'o',
13631 '\u0254': 'o',
13632 '\uA74B': 'o',
13633 '\uA74D': 'o',
13634 '\u0275': 'o',
13635 '\u0153': 'oe',
13636 '\u01A3': 'oi',
13637 '\u0223': 'ou',
13638 '\uA74F': 'oo',
13639 '\u24DF': 'p',
13640 '\uFF50': 'p',
13641 '\u1E55': 'p',
13642 '\u1E57': 'p',
13643 '\u01A5': 'p',
13644 '\u1D7D': 'p',
13645 '\uA751': 'p',
13646 '\uA753': 'p',
13647 '\uA755': 'p',
13648 '\u24E0': 'q',
13649 '\uFF51': 'q',
13650 '\u024B': 'q',
13651 '\uA757': 'q',
13652 '\uA759': 'q',
13653 '\u24E1': 'r',
13654 '\uFF52': 'r',
13655 '\u0155': 'r',
13656 '\u1E59': 'r',
13657 '\u0159': 'r',
13658 '\u0211': 'r',
13659 '\u0213': 'r',
13660 '\u1E5B': 'r',
13661 '\u1E5D': 'r',
13662 '\u0157': 'r',
13663 '\u1E5F': 'r',
13664 '\u024D': 'r',
13665 '\u027D': 'r',
13666 '\uA75B': 'r',
13667 '\uA7A7': 'r',
13668 '\uA783': 'r',
13669 '\u24E2': 's',
13670 '\uFF53': 's',
13671 '\u00DF': 's',
13672 '\u015B': 's',
13673 '\u1E65': 's',
13674 '\u015D': 's',
13675 '\u1E61': 's',
13676 '\u0161': 's',
13677 '\u1E67': 's',
13678 '\u1E63': 's',
13679 '\u1E69': 's',
13680 '\u0219': 's',
13681 '\u015F': 's',
13682 '\u023F': 's',
13683 '\uA7A9': 's',
13684 '\uA785': 's',
13685 '\u1E9B': 's',
13686 '\u24E3': 't',
13687 '\uFF54': 't',
13688 '\u1E6B': 't',
13689 '\u1E97': 't',
13690 '\u0165': 't',
13691 '\u1E6D': 't',
13692 '\u021B': 't',
13693 '\u0163': 't',
13694 '\u1E71': 't',
13695 '\u1E6F': 't',
13696 '\u0167': 't',
13697 '\u01AD': 't',
13698 '\u0288': 't',
13699 '\u2C66': 't',
13700 '\uA787': 't',
13701 '\uA729': 'tz',
13702 '\u24E4': 'u',
13703 '\uFF55': 'u',
13704 '\u00F9': 'u',
13705 '\u00FA': 'u',
13706 '\u00FB': 'u',
13707 '\u0169': 'u',
13708 '\u1E79': 'u',
13709 '\u016B': 'u',
13710 '\u1E7B': 'u',
13711 '\u016D': 'u',
13712 '\u00FC': 'u',
13713 '\u01DC': 'u',
13714 '\u01D8': 'u',
13715 '\u01D6': 'u',
13716 '\u01DA': 'u',
13717 '\u1EE7': 'u',
13718 '\u016F': 'u',
13719 '\u0171': 'u',
13720 '\u01D4': 'u',
13721 '\u0215': 'u',
13722 '\u0217': 'u',
13723 '\u01B0': 'u',
13724 '\u1EEB': 'u',
13725 '\u1EE9': 'u',
13726 '\u1EEF': 'u',
13727 '\u1EED': 'u',
13728 '\u1EF1': 'u',
13729 '\u1EE5': 'u',
13730 '\u1E73': 'u',
13731 '\u0173': 'u',
13732 '\u1E77': 'u',
13733 '\u1E75': 'u',
13734 '\u0289': 'u',
13735 '\u24E5': 'v',
13736 '\uFF56': 'v',
13737 '\u1E7D': 'v',
13738 '\u1E7F': 'v',
13739 '\u028B': 'v',
13740 '\uA75F': 'v',
13741 '\u028C': 'v',
13742 '\uA761': 'vy',
13743 '\u24E6': 'w',
13744 '\uFF57': 'w',
13745 '\u1E81': 'w',
13746 '\u1E83': 'w',
13747 '\u0175': 'w',
13748 '\u1E87': 'w',
13749 '\u1E85': 'w',
13750 '\u1E98': 'w',
13751 '\u1E89': 'w',
13752 '\u2C73': 'w',
13753 '\u24E7': 'x',
13754 '\uFF58': 'x',
13755 '\u1E8B': 'x',
13756 '\u1E8D': 'x',
13757 '\u24E8': 'y',
13758 '\uFF59': 'y',
13759 '\u1EF3': 'y',
13760 '\u00FD': 'y',
13761 '\u0177': 'y',
13762 '\u1EF9': 'y',
13763 '\u0233': 'y',
13764 '\u1E8F': 'y',
13765 '\u00FF': 'y',
13766 '\u1EF7': 'y',
13767 '\u1E99': 'y',
13768 '\u1EF5': 'y',
13769 '\u01B4': 'y',
13770 '\u024F': 'y',
13771 '\u1EFF': 'y',
13772 '\u24E9': 'z',
13773 '\uFF5A': 'z',
13774 '\u017A': 'z',
13775 '\u1E91': 'z',
13776 '\u017C': 'z',
13777 '\u017E': 'z',
13778 '\u1E93': 'z',
13779 '\u1E95': 'z',
13780 '\u01B6': 'z',
13781 '\u0225': 'z',
13782 '\u0240': 'z',
13783 '\u2C6C': 'z',
13784 '\uA763': 'z',
13785 '\u0386': '\u0391',
13786 '\u0388': '\u0395',
13787 '\u0389': '\u0397',
13788 '\u038A': '\u0399',
13789 '\u03AA': '\u0399',
13790 '\u038C': '\u039F',
13791 '\u038E': '\u03A5',
13792 '\u03AB': '\u03A5',
13793 '\u038F': '\u03A9',
13794 '\u03AC': '\u03B1',
13795 '\u03AD': '\u03B5',
13796 '\u03AE': '\u03B7',
13797 '\u03AF': '\u03B9',
13798 '\u03CA': '\u03B9',
13799 '\u0390': '\u03B9',
13800 '\u03CC': '\u03BF',
13801 '\u03CD': '\u03C5',
13802 '\u03CB': '\u03C5',
13803 '\u03B0': '\u03C5',
13804 '\u03CE': '\u03C9',
13805 '\u03C2': '\u03C3',
13806 '\u2019': '\''
13807 };
13808
13809 return diacritics;
13810});
13811
13812S2.define('select2/data/base',[
13813 '../utils'
13814], function (Utils) {
13815 function BaseAdapter ($element, options) {
13816 BaseAdapter.__super__.constructor.call(this);
13817 }
13818
13819 Utils.Extend(BaseAdapter, Utils.Observable);
13820
13821 BaseAdapter.prototype.current = function (callback) {
13822 throw new Error('The `current` method must be defined in child classes.');
13823 };
13824
13825 BaseAdapter.prototype.query = function (params, callback) {
13826 throw new Error('The `query` method must be defined in child classes.');
13827 };
13828
13829 BaseAdapter.prototype.bind = function (container, $container) {
13830 // Can be implemented in subclasses
13831 };
13832
13833 BaseAdapter.prototype.destroy = function () {
13834 // Can be implemented in subclasses
13835 };
13836
13837 BaseAdapter.prototype.generateResultId = function (container, data) {
13838 var id = container.id + '-result-';
13839
13840 id += Utils.generateChars(4);
13841
13842 if (data.id != null) {
13843 id += '-' + data.id.toString();
13844 } else {
13845 id += '-' + Utils.generateChars(4);
13846 }
13847 return id;
13848 };
13849
13850 return BaseAdapter;
13851});
13852
13853S2.define('select2/data/select',[
13854 './base',
13855 '../utils',
13856 'jquery'
13857], function (BaseAdapter, Utils, $) {
13858 function SelectAdapter ($element, options) {
13859 this.$element = $element;
13860 this.options = options;
13861
13862 SelectAdapter.__super__.constructor.call(this);
13863 }
13864
13865 Utils.Extend(SelectAdapter, BaseAdapter);
13866
13867 SelectAdapter.prototype.current = function (callback) {
13868 var data = [];
13869 var self = this;
13870
13871 this.$element.find(':selected').each(function () {
13872 var $option = $(this);
13873
13874 var option = self.item($option);
13875
13876 data.push(option);
13877 });
13878
13879 callback(data);
13880 };
13881
13882 SelectAdapter.prototype.select = function (data) {
13883 var self = this;
13884
13885 data.selected = true;
13886
13887 // If data.element is a DOM node, use it instead
13888 if ($(data.element).is('option')) {
13889 data.element.selected = true;
13890
13891 this.$element.trigger('change');
13892
13893 return;
13894 }
13895
13896 if (this.$element.prop('multiple')) {
13897 this.current(function (currentData) {
13898 var val = [];
13899
13900 data = [data];
13901 data.push.apply(data, currentData);
13902
13903 for (var d = 0; d < data.length; d++) {
13904 var id = data[d].id;
13905
13906 if ($.inArray(id, val) === -1) {
13907 val.push(id);
13908 }
13909 }
13910
13911 self.$element.val(val);
13912 self.$element.trigger('change');
13913 });
13914 } else {
13915 var val = data.id;
13916
13917 this.$element.val(val);
13918 this.$element.trigger('change');
13919 }
13920 };
13921
13922 SelectAdapter.prototype.unselect = function (data) {
13923 var self = this;
13924
13925 if (!this.$element.prop('multiple')) {
13926 return;
13927 }
13928
13929 data.selected = false;
13930
13931 if ($(data.element).is('option')) {
13932 data.element.selected = false;
13933
13934 this.$element.trigger('change');
13935
13936 return;
13937 }
13938
13939 this.current(function (currentData) {
13940 var val = [];
13941
13942 for (var d = 0; d < currentData.length; d++) {
13943 var id = currentData[d].id;
13944
13945 if (id !== data.id && $.inArray(id, val) === -1) {
13946 val.push(id);
13947 }
13948 }
13949
13950 self.$element.val(val);
13951
13952 self.$element.trigger('change');
13953 });
13954 };
13955
13956 SelectAdapter.prototype.bind = function (container, $container) {
13957 var self = this;
13958
13959 this.container = container;
13960
13961 container.on('select', function (params) {
13962 self.select(params.data);
13963 });
13964
13965 container.on('unselect', function (params) {
13966 self.unselect(params.data);
13967 });
13968 };
13969
13970 SelectAdapter.prototype.destroy = function () {
13971 // Remove anything added to child elements
13972 this.$element.find('*').each(function () {
13973 // Remove any custom data set by Select2
13974 Utils.RemoveData(this);
13975 });
13976 };
13977
13978 SelectAdapter.prototype.query = function (params, callback) {
13979 var data = [];
13980 var self = this;
13981
13982 var $options = this.$element.children();
13983
13984 $options.each(function () {
13985 var $option = $(this);
13986
13987 if (!$option.is('option') && !$option.is('optgroup')) {
13988 return;
13989 }
13990
13991 var option = self.item($option);
13992
13993 var matches = self.matches(params, option);
13994
13995 if (matches !== null) {
13996 data.push(matches);
13997 }
13998 });
13999
14000 callback({
14001 results: data
14002 });
14003 };
14004
14005 SelectAdapter.prototype.addOptions = function ($options) {
14006 Utils.appendMany(this.$element, $options);
14007 };
14008
14009 SelectAdapter.prototype.option = function (data) {
14010 var option;
14011
14012 if (data.children) {
14013 option = document.createElement('optgroup');
14014 option.label = data.text;
14015 } else {
14016 option = document.createElement('option');
14017
14018 if (option.textContent !== undefined) {
14019 option.textContent = data.text;
14020 } else {
14021 option.innerText = data.text;
14022 }
14023 }
14024
14025 if (data.id !== undefined) {
14026 option.value = data.id;
14027 }
14028
14029 if (data.disabled) {
14030 option.disabled = true;
14031 }
14032
14033 if (data.selected) {
14034 option.selected = true;
14035 }
14036
14037 if (data.title) {
14038 option.title = data.title;
14039 }
14040
14041 var $option = $(option);
14042
14043 var normalizedData = this._normalizeItem(data);
14044 normalizedData.element = option;
14045
14046 // Override the option's data with the combined data
14047 Utils.StoreData(option, 'data', normalizedData);
14048
14049 return $option;
14050 };
14051
14052 SelectAdapter.prototype.item = function ($option) {
14053 var data = {};
14054
14055 data = Utils.GetData($option[0], 'data');
14056
14057 if (data != null) {
14058 return data;
14059 }
14060
14061 if ($option.is('option')) {
14062 data = {
14063 id: $option.val(),
14064 text: $option.text(),
14065 disabled: $option.prop('disabled'),
14066 selected: $option.prop('selected'),
14067 title: $option.prop('title')
14068 };
14069 } else if ($option.is('optgroup')) {
14070 data = {
14071 text: $option.prop('label'),
14072 children: [],
14073 title: $option.prop('title')
14074 };
14075
14076 var $children = $option.children('option');
14077 var children = [];
14078
14079 for (var c = 0; c < $children.length; c++) {
14080 var $child = $($children[c]);
14081
14082 var child = this.item($child);
14083
14084 children.push(child);
14085 }
14086
14087 data.children = children;
14088 }
14089
14090 data = this._normalizeItem(data);
14091 data.element = $option[0];
14092
14093 Utils.StoreData($option[0], 'data', data);
14094
14095 return data;
14096 };
14097
14098 SelectAdapter.prototype._normalizeItem = function (item) {
14099 if (item !== Object(item)) {
14100 item = {
14101 id: item,
14102 text: item
14103 };
14104 }
14105
14106 item = $.extend({}, {
14107 text: ''
14108 }, item);
14109
14110 var defaults = {
14111 selected: false,
14112 disabled: false
14113 };
14114
14115 if (item.id != null) {
14116 item.id = item.id.toString();
14117 }
14118
14119 if (item.text != null) {
14120 item.text = item.text.toString();
14121 }
14122
14123 if (item._resultId == null && item.id && this.container != null) {
14124 item._resultId = this.generateResultId(this.container, item);
14125 }
14126
14127 return $.extend({}, defaults, item);
14128 };
14129
14130 SelectAdapter.prototype.matches = function (params, data) {
14131 var matcher = this.options.get('matcher');
14132
14133 return matcher(params, data);
14134 };
14135
14136 return SelectAdapter;
14137});
14138
14139S2.define('select2/data/array',[
14140 './select',
14141 '../utils',
14142 'jquery'
14143], function (SelectAdapter, Utils, $) {
14144 function ArrayAdapter ($element, options) {
14145 this._dataToConvert = options.get('data') || [];
14146
14147 ArrayAdapter.__super__.constructor.call(this, $element, options);
14148 }
14149
14150 Utils.Extend(ArrayAdapter, SelectAdapter);
14151
14152 ArrayAdapter.prototype.bind = function (container, $container) {
14153 ArrayAdapter.__super__.bind.call(this, container, $container);
14154
14155 this.addOptions(this.convertToOptions(this._dataToConvert));
14156 };
14157
14158 ArrayAdapter.prototype.select = function (data) {
14159 var $option = this.$element.find('option').filter(function (i, elm) {
14160 return elm.value == data.id.toString();
14161 });
14162
14163 if ($option.length === 0) {
14164 $option = this.option(data);
14165
14166 this.addOptions($option);
14167 }
14168
14169 ArrayAdapter.__super__.select.call(this, data);
14170 };
14171
14172 ArrayAdapter.prototype.convertToOptions = function (data) {
14173 var self = this;
14174
14175 var $existing = this.$element.find('option');
14176 var existingIds = $existing.map(function () {
14177 return self.item($(this)).id;
14178 }).get();
14179
14180 var $options = [];
14181
14182 // Filter out all items except for the one passed in the argument
14183 function onlyItem (item) {
14184 return function () {
14185 return $(this).val() == item.id;
14186 };
14187 }
14188
14189 for (var d = 0; d < data.length; d++) {
14190 var item = this._normalizeItem(data[d]);
14191
14192 // Skip items which were pre-loaded, only merge the data
14193 if ($.inArray(item.id, existingIds) >= 0) {
14194 var $existingOption = $existing.filter(onlyItem(item));
14195
14196 var existingData = this.item($existingOption);
14197 var newData = $.extend(true, {}, item, existingData);
14198
14199 var $newOption = this.option(newData);
14200
14201 $existingOption.replaceWith($newOption);
14202
14203 continue;
14204 }
14205
14206 var $option = this.option(item);
14207
14208 if (item.children) {
14209 var $children = this.convertToOptions(item.children);
14210
14211 Utils.appendMany($option, $children);
14212 }
14213
14214 $options.push($option);
14215 }
14216
14217 return $options;
14218 };
14219
14220 return ArrayAdapter;
14221});
14222
14223S2.define('select2/data/ajax',[
14224 './array',
14225 '../utils',
14226 'jquery'
14227], function (ArrayAdapter, Utils, $) {
14228 function AjaxAdapter ($element, options) {
14229 this.ajaxOptions = this._applyDefaults(options.get('ajax'));
14230
14231 if (this.ajaxOptions.processResults != null) {
14232 this.processResults = this.ajaxOptions.processResults;
14233 }
14234
14235 AjaxAdapter.__super__.constructor.call(this, $element, options);
14236 }
14237
14238 Utils.Extend(AjaxAdapter, ArrayAdapter);
14239
14240 AjaxAdapter.prototype._applyDefaults = function (options) {
14241 var defaults = {
14242 data: function (params) {
14243 return $.extend({}, params, {
14244 q: params.term
14245 });
14246 },
14247 transport: function (params, success, failure) {
14248 var $request = $.ajax(params);
14249
14250 $request.then(success);
14251 $request.fail(failure);
14252
14253 return $request;
14254 }
14255 };
14256
14257 return $.extend({}, defaults, options, true);
14258 };
14259
14260 AjaxAdapter.prototype.processResults = function (results) {
14261 return results;
14262 };
14263
14264 AjaxAdapter.prototype.query = function (params, callback) {
14265 var matches = [];
14266 var self = this;
14267
14268 if (this._request != null) {
14269 // JSONP requests cannot always be aborted
14270 if ($.isFunction(this._request.abort)) {
14271 this._request.abort();
14272 }
14273
14274 this._request = null;
14275 }
14276
14277 var options = $.extend({
14278 type: 'GET'
14279 }, this.ajaxOptions);
14280
14281 if (typeof options.url === 'function') {
14282 options.url = options.url.call(this.$element, params);
14283 }
14284
14285 if (typeof options.data === 'function') {
14286 options.data = options.data.call(this.$element, params);
14287 }
14288
14289 function request () {
14290 var $request = options.transport(options, function (data) {
14291 var results = self.processResults(data, params);
14292
14293 if (self.options.get('debug') && window.console && console.error) {
14294 // Check to make sure that the response included a `results` key.
14295 if (!results || !results.results || !$.isArray(results.results)) {
14296 console.error(
14297 'Select2: The AJAX results did not return an array in the ' +
14298 '`results` key of the response.'
14299 );
14300 }
14301 }
14302
14303 callback(results);
14304 }, function () {
14305 // Attempt to detect if a request was aborted
14306 // Only works if the transport exposes a status property
14307 if ('status' in $request &&
14308 ($request.status === 0 || $request.status === '0')) {
14309 return;
14310 }
14311
14312 self.trigger('results:message', {
14313 message: 'errorLoading'
14314 });
14315 });
14316
14317 self._request = $request;
14318 }
14319
14320 if (this.ajaxOptions.delay && params.term != null) {
14321 if (this._queryTimeout) {
14322 window.clearTimeout(this._queryTimeout);
14323 }
14324
14325 this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
14326 } else {
14327 request();
14328 }
14329 };
14330
14331 return AjaxAdapter;
14332});
14333
14334S2.define('select2/data/tags',[
14335 'jquery'
14336], function ($) {
14337 function Tags (decorated, $element, options) {
14338 var tags = options.get('tags');
14339
14340 var createTag = options.get('createTag');
14341
14342 if (createTag !== undefined) {
14343 this.createTag = createTag;
14344 }
14345
14346 var insertTag = options.get('insertTag');
14347
14348 if (insertTag !== undefined) {
14349 this.insertTag = insertTag;
14350 }
14351
14352 decorated.call(this, $element, options);
14353
14354 if ($.isArray(tags)) {
14355 for (var t = 0; t < tags.length; t++) {
14356 var tag = tags[t];
14357 var item = this._normalizeItem(tag);
14358
14359 var $option = this.option(item);
14360
14361 this.$element.append($option);
14362 }
14363 }
14364 }
14365
14366 Tags.prototype.query = function (decorated, params, callback) {
14367 var self = this;
14368
14369 this._removeOldTags();
14370
14371 if (params.term == null || params.page != null) {
14372 decorated.call(this, params, callback);
14373 return;
14374 }
14375
14376 function wrapper (obj, child) {
14377 var data = obj.results;
14378
14379 for (var i = 0; i < data.length; i++) {
14380 var option = data[i];
14381
14382 var checkChildren = (
14383 option.children != null &&
14384 !wrapper({
14385 results: option.children
14386 }, true)
14387 );
14388
14389 var optionText = (option.text || '').toUpperCase();
14390 var paramsTerm = (params.term || '').toUpperCase();
14391
14392 var checkText = optionText === paramsTerm;
14393
14394 if (checkText || checkChildren) {
14395 if (child) {
14396 return false;
14397 }
14398
14399 obj.data = data;
14400 callback(obj);
14401
14402 return;
14403 }
14404 }
14405
14406 if (child) {
14407 return true;
14408 }
14409
14410 var tag = self.createTag(params);
14411
14412 if (tag != null) {
14413 var $option = self.option(tag);
14414 $option.attr('data-select2-tag', true);
14415
14416 self.addOptions([$option]);
14417
14418 self.insertTag(data, tag);
14419 }
14420
14421 obj.results = data;
14422
14423 callback(obj);
14424 }
14425
14426 decorated.call(this, params, wrapper);
14427 };
14428
14429 Tags.prototype.createTag = function (decorated, params) {
14430 var term = $.trim(params.term);
14431
14432 if (term === '') {
14433 return null;
14434 }
14435
14436 return {
14437 id: term,
14438 text: term
14439 };
14440 };
14441
14442 Tags.prototype.insertTag = function (_, data, tag) {
14443 data.unshift(tag);
14444 };
14445
14446 Tags.prototype._removeOldTags = function (_) {
14447 var $options = this.$element.find('option[data-select2-tag]');
14448
14449 $options.each(function () {
14450 if (this.selected) {
14451 return;
14452 }
14453
14454 $(this).remove();
14455 });
14456 };
14457
14458 return Tags;
14459});
14460
14461S2.define('select2/data/tokenizer',[
14462 'jquery'
14463], function ($) {
14464 function Tokenizer (decorated, $element, options) {
14465 var tokenizer = options.get('tokenizer');
14466
14467 if (tokenizer !== undefined) {
14468 this.tokenizer = tokenizer;
14469 }
14470
14471 decorated.call(this, $element, options);
14472 }
14473
14474 Tokenizer.prototype.bind = function (decorated, container, $container) {
14475 decorated.call(this, container, $container);
14476
14477 this.$search = container.dropdown.$search || container.selection.$search ||
14478 $container.find('.select2-search__field');
14479 };
14480
14481 Tokenizer.prototype.query = function (decorated, params, callback) {
14482 var self = this;
14483
14484 function createAndSelect (data) {
14485 // Normalize the data object so we can use it for checks
14486 var item = self._normalizeItem(data);
14487
14488 // Check if the data object already exists as a tag
14489 // Select it if it doesn't
14490 var $existingOptions = self.$element.find('option').filter(function () {
14491 return $(this).val() === item.id;
14492 });
14493
14494 // If an existing option wasn't found for it, create the option
14495 if (!$existingOptions.length) {
14496 var $option = self.option(item);
14497 $option.attr('data-select2-tag', true);
14498
14499 self._removeOldTags();
14500 self.addOptions([$option]);
14501 }
14502
14503 // Select the item, now that we know there is an option for it
14504 select(item);
14505 }
14506
14507 function select (data) {
14508 self.trigger('select', {
14509 data: data
14510 });
14511 }
14512
14513 params.term = params.term || '';
14514
14515 var tokenData = this.tokenizer(params, this.options, createAndSelect);
14516
14517 if (tokenData.term !== params.term) {
14518 // Replace the search term if we have the search box
14519 if (this.$search.length) {
14520 this.$search.val(tokenData.term);
14521 this.$search.trigger('focus');
14522 }
14523
14524 params.term = tokenData.term;
14525 }
14526
14527 decorated.call(this, params, callback);
14528 };
14529
14530 Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
14531 var separators = options.get('tokenSeparators') || [];
14532 var term = params.term;
14533 var i = 0;
14534
14535 var createTag = this.createTag || function (params) {
14536 return {
14537 id: params.term,
14538 text: params.term
14539 };
14540 };
14541
14542 while (i < term.length) {
14543 var termChar = term[i];
14544
14545 if ($.inArray(termChar, separators) === -1) {
14546 i++;
14547
14548 continue;
14549 }
14550
14551 var part = term.substr(0, i);
14552 var partParams = $.extend({}, params, {
14553 term: part
14554 });
14555
14556 var data = createTag(partParams);
14557
14558 if (data == null) {
14559 i++;
14560 continue;
14561 }
14562
14563 callback(data);
14564
14565 // Reset the term to not include the tokenized portion
14566 term = term.substr(i + 1) || '';
14567 i = 0;
14568 }
14569
14570 return {
14571 term: term
14572 };
14573 };
14574
14575 return Tokenizer;
14576});
14577
14578S2.define('select2/data/minimumInputLength',[
14579
14580], function () {
14581 function MinimumInputLength (decorated, $e, options) {
14582 this.minimumInputLength = options.get('minimumInputLength');
14583
14584 decorated.call(this, $e, options);
14585 }
14586
14587 MinimumInputLength.prototype.query = function (decorated, params, callback) {
14588 params.term = params.term || '';
14589
14590 if (params.term.length < this.minimumInputLength) {
14591 this.trigger('results:message', {
14592 message: 'inputTooShort',
14593 args: {
14594 minimum: this.minimumInputLength,
14595 input: params.term,
14596 params: params
14597 }
14598 });
14599
14600 return;
14601 }
14602
14603 decorated.call(this, params, callback);
14604 };
14605
14606 return MinimumInputLength;
14607});
14608
14609S2.define('select2/data/maximumInputLength',[
14610
14611], function () {
14612 function MaximumInputLength (decorated, $e, options) {
14613 this.maximumInputLength = options.get('maximumInputLength');
14614
14615 decorated.call(this, $e, options);
14616 }
14617
14618 MaximumInputLength.prototype.query = function (decorated, params, callback) {
14619 params.term = params.term || '';
14620
14621 if (this.maximumInputLength > 0 &&
14622 params.term.length > this.maximumInputLength) {
14623 this.trigger('results:message', {
14624 message: 'inputTooLong',
14625 args: {
14626 maximum: this.maximumInputLength,
14627 input: params.term,
14628 params: params
14629 }
14630 });
14631
14632 return;
14633 }
14634
14635 decorated.call(this, params, callback);
14636 };
14637
14638 return MaximumInputLength;
14639});
14640
14641S2.define('select2/data/maximumSelectionLength',[
14642
14643], function (){
14644 function MaximumSelectionLength (decorated, $e, options) {
14645 this.maximumSelectionLength = options.get('maximumSelectionLength');
14646
14647 decorated.call(this, $e, options);
14648 }
14649
14650 MaximumSelectionLength.prototype.bind =
14651 function (decorated, container, $container) {
14652 var self = this;
14653
14654 decorated.call(this, container, $container);
14655
14656 container.on('select', function () {
14657 self._checkIfMaximumSelected();
14658 });
14659 };
14660
14661 MaximumSelectionLength.prototype.query =
14662 function (decorated, params, callback) {
14663 var self = this;
14664
14665 this._checkIfMaximumSelected(function () {
14666 decorated.call(self, params, callback);
14667 });
14668 };
14669
14670 MaximumSelectionLength.prototype._checkIfMaximumSelected =
14671 function (_, successCallback) {
14672 var self = this;
14673
14674 this.current(function (currentData) {
14675 var count = currentData != null ? currentData.length : 0;
14676 if (self.maximumSelectionLength > 0 &&
14677 count >= self.maximumSelectionLength) {
14678 self.trigger('results:message', {
14679 message: 'maximumSelected',
14680 args: {
14681 maximum: self.maximumSelectionLength
14682 }
14683 });
14684 return;
14685 }
14686
14687 if (successCallback) {
14688 successCallback();
14689 }
14690 });
14691 };
14692
14693 return MaximumSelectionLength;
14694});
14695
14696S2.define('select2/dropdown',[
14697 'jquery',
14698 './utils'
14699], function ($, Utils) {
14700 function Dropdown ($element, options) {
14701 this.$element = $element;
14702 this.options = options;
14703
14704 Dropdown.__super__.constructor.call(this);
14705 }
14706
14707 Utils.Extend(Dropdown, Utils.Observable);
14708
14709 Dropdown.prototype.render = function () {
14710 var $dropdown = $(
14711 '<span class="select2-dropdown">' +
14712 '<span class="select2-results"></span>' +
14713 '</span>'
14714 );
14715
14716 $dropdown.attr('dir', this.options.get('dir'));
14717
14718 this.$dropdown = $dropdown;
14719
14720 return $dropdown;
14721 };
14722
14723 Dropdown.prototype.bind = function () {
14724 // Should be implemented in subclasses
14725 };
14726
14727 Dropdown.prototype.position = function ($dropdown, $container) {
14728 // Should be implemented in subclasses
14729 };
14730
14731 Dropdown.prototype.destroy = function () {
14732 // Remove the dropdown from the DOM
14733 this.$dropdown.remove();
14734 };
14735
14736 return Dropdown;
14737});
14738
14739S2.define('select2/dropdown/search',[
14740 'jquery',
14741 '../utils'
14742], function ($, Utils) {
14743 function Search () { }
14744
14745 Search.prototype.render = function (decorated) {
14746 var $rendered = decorated.call(this);
14747
14748 var $search = $(
14749 '<span class="select2-search select2-search--dropdown">' +
14750 '<input class="select2-search__field" type="search" tabindex="-1"' +
14751 ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
14752 ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' +
14753 '</span>'
14754 );
14755
14756 this.$searchContainer = $search;
14757 this.$search = $search.find('input');
14758
14759 $rendered.prepend($search);
14760
14761 return $rendered;
14762 };
14763
14764 Search.prototype.bind = function (decorated, container, $container) {
14765 var self = this;
14766
14767 var resultsId = container.id + '-results';
14768
14769 decorated.call(this, container, $container);
14770
14771 this.$search.on('keydown', function (evt) {
14772 self.trigger('keypress', evt);
14773
14774 self._keyUpPrevented = evt.isDefaultPrevented();
14775 });
14776
14777 // Workaround for browsers which do not support the `input` event
14778 // This will prevent double-triggering of events for browsers which support
14779 // both the `keyup` and `input` events.
14780 this.$search.on('input', function (evt) {
14781 // Unbind the duplicated `keyup` event
14782 $(this).off('keyup');
14783 });
14784
14785 this.$search.on('keyup input', function (evt) {
14786 self.handleSearch(evt);
14787 });
14788
14789 container.on('open', function () {
14790 self.$search.attr('tabindex', 0);
14791 self.$search.attr('aria-controls', resultsId);
14792
14793 self.$search.trigger('focus');
14794
14795 window.setTimeout(function () {
14796 self.$search.trigger('focus');
14797 }, 0);
14798 });
14799
14800 container.on('close', function () {
14801 self.$search.attr('tabindex', -1);
14802 self.$search.removeAttr('aria-controls');
14803 self.$search.removeAttr('aria-activedescendant');
14804
14805 self.$search.val('');
14806 self.$search.trigger('blur');
14807 });
14808
14809 container.on('focus', function () {
14810 if (!container.isOpen()) {
14811 self.$search.trigger('focus');
14812 }
14813 });
14814
14815 container.on('results:all', function (params) {
14816 if (params.query.term == null || params.query.term === '') {
14817 var showSearch = self.showSearch(params);
14818
14819 if (showSearch) {
14820 self.$searchContainer.removeClass('select2-search--hide');
14821 } else {
14822 self.$searchContainer.addClass('select2-search--hide');
14823 }
14824 }
14825 });
14826
14827 container.on('results:focus', function (params) {
14828 if (params.data._resultId) {
14829 self.$search.attr('aria-activedescendant', params.data._resultId);
14830 } else {
14831 self.$search.removeAttr('aria-activedescendant');
14832 }
14833 });
14834 };
14835
14836 Search.prototype.handleSearch = function (evt) {
14837 if (!this._keyUpPrevented) {
14838 var input = this.$search.val();
14839
14840 this.trigger('query', {
14841 term: input
14842 });
14843 }
14844
14845 this._keyUpPrevented = false;
14846 };
14847
14848 Search.prototype.showSearch = function (_, params) {
14849 return true;
14850 };
14851
14852 return Search;
14853});
14854
14855S2.define('select2/dropdown/hidePlaceholder',[
14856
14857], function () {
14858 function HidePlaceholder (decorated, $element, options, dataAdapter) {
14859 this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
14860
14861 decorated.call(this, $element, options, dataAdapter);
14862 }
14863
14864 HidePlaceholder.prototype.append = function (decorated, data) {
14865 data.results = this.removePlaceholder(data.results);
14866
14867 decorated.call(this, data);
14868 };
14869
14870 HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
14871 if (typeof placeholder === 'string') {
14872 placeholder = {
14873 id: '',
14874 text: placeholder
14875 };
14876 }
14877
14878 return placeholder;
14879 };
14880
14881 HidePlaceholder.prototype.removePlaceholder = function (_, data) {
14882 var modifiedData = data.slice(0);
14883
14884 for (var d = data.length - 1; d >= 0; d--) {
14885 var item = data[d];
14886
14887 if (this.placeholder.id === item.id) {
14888 modifiedData.splice(d, 1);
14889 }
14890 }
14891
14892 return modifiedData;
14893 };
14894
14895 return HidePlaceholder;
14896});
14897
14898S2.define('select2/dropdown/infiniteScroll',[
14899 'jquery'
14900], function ($) {
14901 function InfiniteScroll (decorated, $element, options, dataAdapter) {
14902 this.lastParams = {};
14903
14904 decorated.call(this, $element, options, dataAdapter);
14905
14906 this.$loadingMore = this.createLoadingMore();
14907 this.loading = false;
14908 }
14909
14910 InfiniteScroll.prototype.append = function (decorated, data) {
14911 this.$loadingMore.remove();
14912 this.loading = false;
14913
14914 decorated.call(this, data);
14915
14916 if (this.showLoadingMore(data)) {
14917 this.$results.append(this.$loadingMore);
14918 this.loadMoreIfNeeded();
14919 }
14920 };
14921
14922 InfiniteScroll.prototype.bind = function (decorated, container, $container) {
14923 var self = this;
14924
14925 decorated.call(this, container, $container);
14926
14927 container.on('query', function (params) {
14928 self.lastParams = params;
14929 self.loading = true;
14930 });
14931
14932 container.on('query:append', function (params) {
14933 self.lastParams = params;
14934 self.loading = true;
14935 });
14936
14937 this.$results.on('scroll', this.loadMoreIfNeeded.bind(this));
14938 };
14939
14940 InfiniteScroll.prototype.loadMoreIfNeeded = function () {
14941 var isLoadMoreVisible = $.contains(
14942 document.documentElement,
14943 this.$loadingMore[0]
14944 );
14945
14946 if (this.loading || !isLoadMoreVisible) {
14947 return;
14948 }
14949
14950 var currentOffset = this.$results.offset().top +
14951 this.$results.outerHeight(false);
14952 var loadingMoreOffset = this.$loadingMore.offset().top +
14953 this.$loadingMore.outerHeight(false);
14954
14955 if (currentOffset + 50 >= loadingMoreOffset) {
14956 this.loadMore();
14957 }
14958 };
14959
14960 InfiniteScroll.prototype.loadMore = function () {
14961 this.loading = true;
14962
14963 var params = $.extend({}, {page: 1}, this.lastParams);
14964
14965 params.page++;
14966
14967 this.trigger('query:append', params);
14968 };
14969
14970 InfiniteScroll.prototype.showLoadingMore = function (_, data) {
14971 return data.pagination && data.pagination.more;
14972 };
14973
14974 InfiniteScroll.prototype.createLoadingMore = function () {
14975 var $option = $(
14976 '<li ' +
14977 'class="select2-results__option select2-results__option--load-more"' +
14978 'role="option" aria-disabled="true"></li>'
14979 );
14980
14981 var message = this.options.get('translations').get('loadingMore');
14982
14983 $option.html(message(this.lastParams));
14984
14985 return $option;
14986 };
14987
14988 return InfiniteScroll;
14989});
14990
14991S2.define('select2/dropdown/attachBody',[
14992 'jquery',
14993 '../utils'
14994], function ($, Utils) {
14995 function AttachBody (decorated, $element, options) {
14996 this.$dropdownParent = $(options.get('dropdownParent') || document.body);
14997
14998 decorated.call(this, $element, options);
14999 }
15000
15001 AttachBody.prototype.bind = function (decorated, container, $container) {
15002 var self = this;
15003
15004 decorated.call(this, container, $container);
15005
15006 container.on('open', function () {
15007 self._showDropdown();
15008 self._attachPositioningHandler(container);
15009
15010 // Must bind after the results handlers to ensure correct sizing
15011 self._bindContainerResultHandlers(container);
15012 });
15013
15014 container.on('close', function () {
15015 self._hideDropdown();
15016 self._detachPositioningHandler(container);
15017 });
15018
15019 this.$dropdownContainer.on('mousedown', function (evt) {
15020 evt.stopPropagation();
15021 });
15022 };
15023
15024 AttachBody.prototype.destroy = function (decorated) {
15025 decorated.call(this);
15026
15027 this.$dropdownContainer.remove();
15028 };
15029
15030 AttachBody.prototype.position = function (decorated, $dropdown, $container) {
15031 // Clone all of the container classes
15032 $dropdown.attr('class', $container.attr('class'));
15033
15034 $dropdown.removeClass('select2');
15035 $dropdown.addClass('select2-container--open');
15036
15037 $dropdown.css({
15038 position: 'absolute',
15039 top: -999999
15040 });
15041
15042 this.$container = $container;
15043 };
15044
15045 AttachBody.prototype.render = function (decorated) {
15046 var $container = $('<span></span>');
15047
15048 var $dropdown = decorated.call(this);
15049 $container.append($dropdown);
15050
15051 this.$dropdownContainer = $container;
15052
15053 return $container;
15054 };
15055
15056 AttachBody.prototype._hideDropdown = function (decorated) {
15057 this.$dropdownContainer.detach();
15058 };
15059
15060 AttachBody.prototype._bindContainerResultHandlers =
15061 function (decorated, container) {
15062
15063 // These should only be bound once
15064 if (this._containerResultsHandlersBound) {
15065 return;
15066 }
15067
15068 var self = this;
15069
15070 container.on('results:all', function () {
15071 self._positionDropdown();
15072 self._resizeDropdown();
15073 });
15074
15075 container.on('results:append', function () {
15076 self._positionDropdown();
15077 self._resizeDropdown();
15078 });
15079
15080 container.on('results:message', function () {
15081 self._positionDropdown();
15082 self._resizeDropdown();
15083 });
15084
15085 container.on('select', function () {
15086 self._positionDropdown();
15087 self._resizeDropdown();
15088 });
15089
15090 container.on('unselect', function () {
15091 self._positionDropdown();
15092 self._resizeDropdown();
15093 });
15094
15095 this._containerResultsHandlersBound = true;
15096 };
15097
15098 AttachBody.prototype._attachPositioningHandler =
15099 function (decorated, container) {
15100 var self = this;
15101
15102 var scrollEvent = 'scroll.select2.' + container.id;
15103 var resizeEvent = 'resize.select2.' + container.id;
15104 var orientationEvent = 'orientationchange.select2.' + container.id;
15105
15106 var $watchers = this.$container.parents().filter(Utils.hasScroll);
15107 $watchers.each(function () {
15108 Utils.StoreData(this, 'select2-scroll-position', {
15109 x: $(this).scrollLeft(),
15110 y: $(this).scrollTop()
15111 });
15112 });
15113
15114 $watchers.on(scrollEvent, function (ev) {
15115 var position = Utils.GetData(this, 'select2-scroll-position');
15116 $(this).scrollTop(position.y);
15117 });
15118
15119 $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
15120 function (e) {
15121 self._positionDropdown();
15122 self._resizeDropdown();
15123 });
15124 };
15125
15126 AttachBody.prototype._detachPositioningHandler =
15127 function (decorated, container) {
15128 var scrollEvent = 'scroll.select2.' + container.id;
15129 var resizeEvent = 'resize.select2.' + container.id;
15130 var orientationEvent = 'orientationchange.select2.' + container.id;
15131
15132 var $watchers = this.$container.parents().filter(Utils.hasScroll);
15133 $watchers.off(scrollEvent);
15134
15135 $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
15136 };
15137
15138 AttachBody.prototype._positionDropdown = function () {
15139 var $window = $(window);
15140
15141 var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
15142 var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
15143
15144 var newDirection = null;
15145
15146 var offset = this.$container.offset();
15147
15148 offset.bottom = offset.top + this.$container.outerHeight(false);
15149
15150 var container = {
15151 height: this.$container.outerHeight(false)
15152 };
15153
15154 container.top = offset.top;
15155 container.bottom = offset.top + container.height;
15156
15157 var dropdown = {
15158 height: this.$dropdown.outerHeight(false)
15159 };
15160
15161 var viewport = {
15162 top: $window.scrollTop(),
15163 bottom: $window.scrollTop() + $window.height()
15164 };
15165
15166 var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
15167 var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
15168
15169 var css = {
15170 left: offset.left,
15171 top: container.bottom
15172 };
15173
15174 // Determine what the parent element is to use for calculating the offset
15175 var $offsetParent = this.$dropdownParent;
15176
15177 // For statically positioned elements, we need to get the element
15178 // that is determining the offset
15179 if ($offsetParent.css('position') === 'static') {
15180 $offsetParent = $offsetParent.offsetParent();
15181 }
15182
15183 var parentOffset = $offsetParent.offset();
15184
15185 css.top -= parentOffset.top;
15186 css.left -= parentOffset.left;
15187
15188 if (!isCurrentlyAbove && !isCurrentlyBelow) {
15189 newDirection = 'below';
15190 }
15191
15192 if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
15193 newDirection = 'above';
15194 } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
15195 newDirection = 'below';
15196 }
15197
15198 if (newDirection == 'above' ||
15199 (isCurrentlyAbove && newDirection !== 'below')) {
15200 css.top = container.top - parentOffset.top - dropdown.height;
15201 }
15202
15203 if (newDirection != null) {
15204 this.$dropdown
15205 .removeClass('select2-dropdown--below select2-dropdown--above')
15206 .addClass('select2-dropdown--' + newDirection);
15207 this.$container
15208 .removeClass('select2-container--below select2-container--above')
15209 .addClass('select2-container--' + newDirection);
15210 }
15211
15212 this.$dropdownContainer.css(css);
15213 };
15214
15215 AttachBody.prototype._resizeDropdown = function () {
15216 var css = {
15217 width: this.$container.outerWidth(false) + 'px'
15218 };
15219
15220 if (this.options.get('dropdownAutoWidth')) {
15221 css.minWidth = css.width;
15222 css.position = 'relative';
15223 css.width = 'auto';
15224 }
15225
15226 this.$dropdown.css(css);
15227 };
15228
15229 AttachBody.prototype._showDropdown = function (decorated) {
15230 this.$dropdownContainer.appendTo(this.$dropdownParent);
15231
15232 this._positionDropdown();
15233 this._resizeDropdown();
15234 };
15235
15236 return AttachBody;
15237});
15238
15239S2.define('select2/dropdown/minimumResultsForSearch',[
15240
15241], function () {
15242 function countResults (data) {
15243 var count = 0;
15244
15245 for (var d = 0; d < data.length; d++) {
15246 var item = data[d];
15247
15248 if (item.children) {
15249 count += countResults(item.children);
15250 } else {
15251 count++;
15252 }
15253 }
15254
15255 return count;
15256 }
15257
15258 function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
15259 this.minimumResultsForSearch = options.get('minimumResultsForSearch');
15260
15261 if (this.minimumResultsForSearch < 0) {
15262 this.minimumResultsForSearch = Infinity;
15263 }
15264
15265 decorated.call(this, $element, options, dataAdapter);
15266 }
15267
15268 MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
15269 if (countResults(params.data.results) < this.minimumResultsForSearch) {
15270 return false;
15271 }
15272
15273 return decorated.call(this, params);
15274 };
15275
15276 return MinimumResultsForSearch;
15277});
15278
15279S2.define('select2/dropdown/selectOnClose',[
15280 '../utils'
15281], function (Utils) {
15282 function SelectOnClose () { }
15283
15284 SelectOnClose.prototype.bind = function (decorated, container, $container) {
15285 var self = this;
15286
15287 decorated.call(this, container, $container);
15288
15289 container.on('close', function (params) {
15290 self._handleSelectOnClose(params);
15291 });
15292 };
15293
15294 SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
15295 if (params && params.originalSelect2Event != null) {
15296 var event = params.originalSelect2Event;
15297
15298 // Don't select an item if the close event was triggered from a select or
15299 // unselect event
15300 if (event._type === 'select' || event._type === 'unselect') {
15301 return;
15302 }
15303 }
15304
15305 var $highlightedResults = this.getHighlightedResults();
15306
15307 // Only select highlighted results
15308 if ($highlightedResults.length < 1) {
15309 return;
15310 }
15311
15312 var data = Utils.GetData($highlightedResults[0], 'data');
15313
15314 // Don't re-select already selected resulte
15315 if (
15316 (data.element != null && data.element.selected) ||
15317 (data.element == null && data.selected)
15318 ) {
15319 return;
15320 }
15321
15322 this.trigger('select', {
15323 data: data
15324 });
15325 };
15326
15327 return SelectOnClose;
15328});
15329
15330S2.define('select2/dropdown/closeOnSelect',[
15331
15332], function () {
15333 function CloseOnSelect () { }
15334
15335 CloseOnSelect.prototype.bind = function (decorated, container, $container) {
15336 var self = this;
15337
15338 decorated.call(this, container, $container);
15339
15340 container.on('select', function (evt) {
15341 self._selectTriggered(evt);
15342 });
15343
15344 container.on('unselect', function (evt) {
15345 self._selectTriggered(evt);
15346 });
15347 };
15348
15349 CloseOnSelect.prototype._selectTriggered = function (_, evt) {
15350 var originalEvent = evt.originalEvent;
15351
15352 // Don't close if the control key is being held
15353 if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) {
15354 return;
15355 }
15356
15357 this.trigger('close', {
15358 originalEvent: originalEvent,
15359 originalSelect2Event: evt
15360 });
15361 };
15362
15363 return CloseOnSelect;
15364});
15365
15366S2.define('select2/i18n/en',[],function () {
15367 // English
15368 return {
15369 errorLoading: function () {
15370 return 'The results could not be loaded.';
15371 },
15372 inputTooLong: function (args) {
15373 var overChars = args.input.length - args.maximum;
15374
15375 var message = 'Please delete ' + overChars + ' character';
15376
15377 if (overChars != 1) {
15378 message += 's';
15379 }
15380
15381 return message;
15382 },
15383 inputTooShort: function (args) {
15384 var remainingChars = args.minimum - args.input.length;
15385
15386 var message = 'Please enter ' + remainingChars + ' or more characters';
15387
15388 return message;
15389 },
15390 loadingMore: function () {
15391 return 'Loading more results…';
15392 },
15393 maximumSelected: function (args) {
15394 var message = 'You can only select ' + args.maximum + ' item';
15395
15396 if (args.maximum != 1) {
15397 message += 's';
15398 }
15399
15400 return message;
15401 },
15402 noResults: function () {
15403 return 'No results found';
15404 },
15405 searching: function () {
15406 return 'Searching…';
15407 },
15408 removeAllItems: function () {
15409 return 'Remove all items';
15410 }
15411 };
15412});
15413
15414S2.define('select2/defaults',[
15415 'jquery',
15416 'require',
15417
15418 './results',
15419
15420 './selection/single',
15421 './selection/multiple',
15422 './selection/placeholder',
15423 './selection/allowClear',
15424 './selection/search',
15425 './selection/eventRelay',
15426
15427 './utils',
15428 './translation',
15429 './diacritics',
15430
15431 './data/select',
15432 './data/array',
15433 './data/ajax',
15434 './data/tags',
15435 './data/tokenizer',
15436 './data/minimumInputLength',
15437 './data/maximumInputLength',
15438 './data/maximumSelectionLength',
15439
15440 './dropdown',
15441 './dropdown/search',
15442 './dropdown/hidePlaceholder',
15443 './dropdown/infiniteScroll',
15444 './dropdown/attachBody',
15445 './dropdown/minimumResultsForSearch',
15446 './dropdown/selectOnClose',
15447 './dropdown/closeOnSelect',
15448
15449 './i18n/en'
15450], function ($, require,
15451
15452 ResultsList,
15453
15454 SingleSelection, MultipleSelection, Placeholder, AllowClear,
15455 SelectionSearch, EventRelay,
15456
15457 Utils, Translation, DIACRITICS,
15458
15459 SelectData, ArrayData, AjaxData, Tags, Tokenizer,
15460 MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
15461
15462 Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
15463 AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
15464
15465 EnglishTranslation) {
15466 function Defaults () {
15467 this.reset();
15468 }
15469
15470 Defaults.prototype.apply = function (options) {
15471 options = $.extend(true, {}, this.defaults, options);
15472
15473 if (options.dataAdapter == null) {
15474 if (options.ajax != null) {
15475 options.dataAdapter = AjaxData;
15476 } else if (options.data != null) {
15477 options.dataAdapter = ArrayData;
15478 } else {
15479 options.dataAdapter = SelectData;
15480 }
15481
15482 if (options.minimumInputLength > 0) {
15483 options.dataAdapter = Utils.Decorate(
15484 options.dataAdapter,
15485 MinimumInputLength
15486 );
15487 }
15488
15489 if (options.maximumInputLength > 0) {
15490 options.dataAdapter = Utils.Decorate(
15491 options.dataAdapter,
15492 MaximumInputLength
15493 );
15494 }
15495
15496 if (options.maximumSelectionLength > 0) {
15497 options.dataAdapter = Utils.Decorate(
15498 options.dataAdapter,
15499 MaximumSelectionLength
15500 );
15501 }
15502
15503 if (options.tags) {
15504 options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
15505 }
15506
15507 if (options.tokenSeparators != null || options.tokenizer != null) {
15508 options.dataAdapter = Utils.Decorate(
15509 options.dataAdapter,
15510 Tokenizer
15511 );
15512 }
15513
15514 if (options.query != null) {
15515 var Query = require(options.amdBase + 'compat/query');
15516
15517 options.dataAdapter = Utils.Decorate(
15518 options.dataAdapter,
15519 Query
15520 );
15521 }
15522
15523 if (options.initSelection != null) {
15524 var InitSelection = require(options.amdBase + 'compat/initSelection');
15525
15526 options.dataAdapter = Utils.Decorate(
15527 options.dataAdapter,
15528 InitSelection
15529 );
15530 }
15531 }
15532
15533 if (options.resultsAdapter == null) {
15534 options.resultsAdapter = ResultsList;
15535
15536 if (options.ajax != null) {
15537 options.resultsAdapter = Utils.Decorate(
15538 options.resultsAdapter,
15539 InfiniteScroll
15540 );
15541 }
15542
15543 if (options.placeholder != null) {
15544 options.resultsAdapter = Utils.Decorate(
15545 options.resultsAdapter,
15546 HidePlaceholder
15547 );
15548 }
15549
15550 if (options.selectOnClose) {
15551 options.resultsAdapter = Utils.Decorate(
15552 options.resultsAdapter,
15553 SelectOnClose
15554 );
15555 }
15556 }
15557
15558 if (options.dropdownAdapter == null) {
15559 if (options.multiple) {
15560 options.dropdownAdapter = Dropdown;
15561 } else {
15562 var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
15563
15564 options.dropdownAdapter = SearchableDropdown;
15565 }
15566
15567 if (options.minimumResultsForSearch !== 0) {
15568 options.dropdownAdapter = Utils.Decorate(
15569 options.dropdownAdapter,
15570 MinimumResultsForSearch
15571 );
15572 }
15573
15574 if (options.closeOnSelect) {
15575 options.dropdownAdapter = Utils.Decorate(
15576 options.dropdownAdapter,
15577 CloseOnSelect
15578 );
15579 }
15580
15581 if (
15582 options.dropdownCssClass != null ||
15583 options.dropdownCss != null ||
15584 options.adaptDropdownCssClass != null
15585 ) {
15586 var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
15587
15588 options.dropdownAdapter = Utils.Decorate(
15589 options.dropdownAdapter,
15590 DropdownCSS
15591 );
15592 }
15593
15594 options.dropdownAdapter = Utils.Decorate(
15595 options.dropdownAdapter,
15596 AttachBody
15597 );
15598 }
15599
15600 if (options.selectionAdapter == null) {
15601 if (options.multiple) {
15602 options.selectionAdapter = MultipleSelection;
15603 } else {
15604 options.selectionAdapter = SingleSelection;
15605 }
15606
15607 // Add the placeholder mixin if a placeholder was specified
15608 if (options.placeholder != null) {
15609 options.selectionAdapter = Utils.Decorate(
15610 options.selectionAdapter,
15611 Placeholder
15612 );
15613 }
15614
15615 if (options.allowClear) {
15616 options.selectionAdapter = Utils.Decorate(
15617 options.selectionAdapter,
15618 AllowClear
15619 );
15620 }
15621
15622 if (options.multiple) {
15623 options.selectionAdapter = Utils.Decorate(
15624 options.selectionAdapter,
15625 SelectionSearch
15626 );
15627 }
15628
15629 if (
15630 options.containerCssClass != null ||
15631 options.containerCss != null ||
15632 options.adaptContainerCssClass != null
15633 ) {
15634 var ContainerCSS = require(options.amdBase + 'compat/containerCss');
15635
15636 options.selectionAdapter = Utils.Decorate(
15637 options.selectionAdapter,
15638 ContainerCSS
15639 );
15640 }
15641
15642 options.selectionAdapter = Utils.Decorate(
15643 options.selectionAdapter,
15644 EventRelay
15645 );
15646 }
15647
15648 // If the defaults were not previously applied from an element, it is
15649 // possible for the language option to have not been resolved
15650 options.language = this._resolveLanguage(options.language);
15651
15652 // Always fall back to English since it will always be complete
15653 options.language.push('en');
15654
15655 var uniqueLanguages = [];
15656
15657 for (var l = 0; l < options.language.length; l++) {
15658 var language = options.language[l];
15659
15660 if (uniqueLanguages.indexOf(language) === -1) {
15661 uniqueLanguages.push(language);
15662 }
15663 }
15664
15665 options.language = uniqueLanguages;
15666
15667 options.translations = this._processTranslations(
15668 options.language,
15669 options.debug
15670 );
15671
15672 return options;
15673 };
15674
15675 Defaults.prototype.reset = function () {
15676 function stripDiacritics (text) {
15677 // Used 'uni range + named function' from http://jsperf.com/diacritics/18
15678 function match(a) {
15679 return DIACRITICS[a] || a;
15680 }
15681
15682 return text.replace(/[^\u0000-\u007E]/g, match);
15683 }
15684
15685 function matcher (params, data) {
15686 // Always return the object if there is nothing to compare
15687 if ($.trim(params.term) === '') {
15688 return data;
15689 }
15690
15691 // Do a recursive check for options with children
15692 if (data.children && data.children.length > 0) {
15693 // Clone the data object if there are children
15694 // This is required as we modify the object to remove any non-matches
15695 var match = $.extend(true, {}, data);
15696
15697 // Check each child of the option
15698 for (var c = data.children.length - 1; c >= 0; c--) {
15699 var child = data.children[c];
15700
15701 var matches = matcher(params, child);
15702
15703 // If there wasn't a match, remove the object in the array
15704 if (matches == null) {
15705 match.children.splice(c, 1);
15706 }
15707 }
15708
15709 // If any children matched, return the new object
15710 if (match.children.length > 0) {
15711 return match;
15712 }
15713
15714 // If there were no matching children, check just the plain object
15715 return matcher(params, match);
15716 }
15717
15718 var original = stripDiacritics(data.text).toUpperCase();
15719 var term = stripDiacritics(params.term).toUpperCase();
15720
15721 // Check if the text contains the term
15722 if (original.indexOf(term) > -1) {
15723 return data;
15724 }
15725
15726 // If it doesn't contain the term, don't return anything
15727 return null;
15728 }
15729
15730 this.defaults = {
15731 amdBase: './',
15732 amdLanguageBase: './i18n/',
15733 closeOnSelect: true,
15734 debug: false,
15735 dropdownAutoWidth: false,
15736 escapeMarkup: Utils.escapeMarkup,
15737 language: {},
15738 matcher: matcher,
15739 minimumInputLength: 0,
15740 maximumInputLength: 0,
15741 maximumSelectionLength: 0,
15742 minimumResultsForSearch: 0,
15743 selectOnClose: false,
15744 scrollAfterSelect: false,
15745 sorter: function (data) {
15746 return data;
15747 },
15748 templateResult: function (result) {
15749 return result.text;
15750 },
15751 templateSelection: function (selection) {
15752 return selection.text;
15753 },
15754 theme: 'default',
15755 width: 'resolve'
15756 };
15757 };
15758
15759 Defaults.prototype.applyFromElement = function (options, $element) {
15760 var optionLanguage = options.language;
15761 var defaultLanguage = this.defaults.language;
15762 var elementLanguage = $element.prop('lang');
15763 var parentLanguage = $element.closest('[lang]').prop('lang');
15764
15765 var languages = Array.prototype.concat.call(
15766 this._resolveLanguage(elementLanguage),
15767 this._resolveLanguage(optionLanguage),
15768 this._resolveLanguage(defaultLanguage),
15769 this._resolveLanguage(parentLanguage)
15770 );
15771
15772 options.language = languages;
15773
15774 return options;
15775 };
15776
15777 Defaults.prototype._resolveLanguage = function (language) {
15778 if (!language) {
15779 return [];
15780 }
15781
15782 if ($.isEmptyObject(language)) {
15783 return [];
15784 }
15785
15786 if ($.isPlainObject(language)) {
15787 return [language];
15788 }
15789
15790 var languages;
15791
15792 if (!$.isArray(language)) {
15793 languages = [language];
15794 } else {
15795 languages = language;
15796 }
15797
15798 var resolvedLanguages = [];
15799
15800 for (var l = 0; l < languages.length; l++) {
15801 resolvedLanguages.push(languages[l]);
15802
15803 if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) {
15804 // Extract the region information if it is included
15805 var languageParts = languages[l].split('-');
15806 var baseLanguage = languageParts[0];
15807
15808 resolvedLanguages.push(baseLanguage);
15809 }
15810 }
15811
15812 return resolvedLanguages;
15813 };
15814
15815 Defaults.prototype._processTranslations = function (languages, debug) {
15816 var translations = new Translation();
15817
15818 for (var l = 0; l < languages.length; l++) {
15819 var languageData = new Translation();
15820
15821 var language = languages[l];
15822
15823 if (typeof language === 'string') {
15824 try {
15825 // Try to load it with the original name
15826 languageData = Translation.loadPath(language);
15827 } catch (e) {
15828 try {
15829 // If we couldn't load it, check if it wasn't the full path
15830 language = this.defaults.amdLanguageBase + language;
15831 languageData = Translation.loadPath(language);
15832 } catch (ex) {
15833 // The translation could not be loaded at all. Sometimes this is
15834 // because of a configuration problem, other times this can be
15835 // because of how Select2 helps load all possible translation files
15836 if (debug && window.console && console.warn) {
15837 console.warn(
15838 'Select2: The language file for "' + language + '" could ' +
15839 'not be automatically loaded. A fallback will be used instead.'
15840 );
15841 }
15842 }
15843 }
15844 } else if ($.isPlainObject(language)) {
15845 languageData = new Translation(language);
15846 } else {
15847 languageData = language;
15848 }
15849
15850 translations.extend(languageData);
15851 }
15852
15853 return translations;
15854 };
15855
15856 Defaults.prototype.set = function (key, value) {
15857 var camelKey = $.camelCase(key);
15858
15859 var data = {};
15860 data[camelKey] = value;
15861
15862 var convertedData = Utils._convertData(data);
15863
15864 $.extend(true, this.defaults, convertedData);
15865 };
15866
15867 var defaults = new Defaults();
15868
15869 return defaults;
15870});
15871
15872S2.define('select2/options',[
15873 'require',
15874 'jquery',
15875 './defaults',
15876 './utils'
15877], function (require, $, Defaults, Utils) {
15878 function Options (options, $element) {
15879 this.options = options;
15880
15881 if ($element != null) {
15882 this.fromElement($element);
15883 }
15884
15885 if ($element != null) {
15886 this.options = Defaults.applyFromElement(this.options, $element);
15887 }
15888
15889 this.options = Defaults.apply(this.options);
15890
15891 if ($element && $element.is('input')) {
15892 var InputCompat = require(this.get('amdBase') + 'compat/inputData');
15893
15894 this.options.dataAdapter = Utils.Decorate(
15895 this.options.dataAdapter,
15896 InputCompat
15897 );
15898 }
15899 }
15900
15901 Options.prototype.fromElement = function ($e) {
15902 var excludedData = ['select2'];
15903
15904 if (this.options.multiple == null) {
15905 this.options.multiple = $e.prop('multiple');
15906 }
15907
15908 if (this.options.disabled == null) {
15909 this.options.disabled = $e.prop('disabled');
15910 }
15911
15912 if (this.options.dir == null) {
15913 if ($e.prop('dir')) {
15914 this.options.dir = $e.prop('dir');
15915 } else if ($e.closest('[dir]').prop('dir')) {
15916 this.options.dir = $e.closest('[dir]').prop('dir');
15917 } else {
15918 this.options.dir = 'ltr';
15919 }
15920 }
15921
15922 $e.prop('disabled', this.options.disabled);
15923 $e.prop('multiple', this.options.multiple);
15924
15925 if (Utils.GetData($e[0], 'select2Tags')) {
15926 if (this.options.debug && window.console && console.warn) {
15927 console.warn(
15928 'Select2: The `data-select2-tags` attribute has been changed to ' +
15929 'use the `data-data` and `data-tags="true"` attributes and will be ' +
15930 'removed in future versions of Select2.'
15931 );
15932 }
15933
15934 Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags'));
15935 Utils.StoreData($e[0], 'tags', true);
15936 }
15937
15938 if (Utils.GetData($e[0], 'ajaxUrl')) {
15939 if (this.options.debug && window.console && console.warn) {
15940 console.warn(
15941 'Select2: The `data-ajax-url` attribute has been changed to ' +
15942 '`data-ajax--url` and support for the old attribute will be removed' +
15943 ' in future versions of Select2.'
15944 );
15945 }
15946
15947 $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl'));
15948 Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl'));
15949 }
15950
15951 var dataset = {};
15952
15953 function upperCaseLetter(_, letter) {
15954 return letter.toUpperCase();
15955 }
15956
15957 // Pre-load all of the attributes which are prefixed with `data-`
15958 for (var attr = 0; attr < $e[0].attributes.length; attr++) {
15959 var attributeName = $e[0].attributes[attr].name;
15960 var prefix = 'data-';
15961
15962 if (attributeName.substr(0, prefix.length) == prefix) {
15963 // Get the contents of the attribute after `data-`
15964 var dataName = attributeName.substring(prefix.length);
15965
15966 // Get the data contents from the consistent source
15967 // This is more than likely the jQuery data helper
15968 var dataValue = Utils.GetData($e[0], dataName);
15969
15970 // camelCase the attribute name to match the spec
15971 var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter);
15972
15973 // Store the data attribute contents into the dataset since
15974 dataset[camelDataName] = dataValue;
15975 }
15976 }
15977
15978 // Prefer the element's `dataset` attribute if it exists
15979 // jQuery 1.x does not correctly handle data attributes with multiple dashes
15980 if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
15981 dataset = $.extend(true, {}, $e[0].dataset, dataset);
15982 }
15983
15984 // Prefer our internal data cache if it exists
15985 var data = $.extend(true, {}, Utils.GetData($e[0]), dataset);
15986
15987 data = Utils._convertData(data);
15988
15989 for (var key in data) {
15990 if ($.inArray(key, excludedData) > -1) {
15991 continue;
15992 }
15993
15994 if ($.isPlainObject(this.options[key])) {
15995 $.extend(this.options[key], data[key]);
15996 } else {
15997 this.options[key] = data[key];
15998 }
15999 }
16000
16001 return this;
16002 };
16003
16004 Options.prototype.get = function (key) {
16005 return this.options[key];
16006 };
16007
16008 Options.prototype.set = function (key, val) {
16009 this.options[key] = val;
16010 };
16011
16012 return Options;
16013});
16014
16015S2.define('select2/core',[
16016 'jquery',
16017 './options',
16018 './utils',
16019 './keys'
16020], function ($, Options, Utils, KEYS) {
16021 var Select2 = function ($element, options) {
16022 if (Utils.GetData($element[0], 'select2') != null) {
16023 Utils.GetData($element[0], 'select2').destroy();
16024 }
16025
16026 this.$element = $element;
16027
16028 this.id = this._generateId($element);
16029
16030 options = options || {};
16031
16032 this.options = new Options(options, $element);
16033
16034 Select2.__super__.constructor.call(this);
16035
16036 // Set up the tabindex
16037
16038 var tabindex = $element.attr('tabindex') || 0;
16039 Utils.StoreData($element[0], 'old-tabindex', tabindex);
16040 $element.attr('tabindex', '-1');
16041
16042 // Set up containers and adapters
16043
16044 var DataAdapter = this.options.get('dataAdapter');
16045 this.dataAdapter = new DataAdapter($element, this.options);
16046
16047 var $container = this.render();
16048
16049 this._placeContainer($container);
16050
16051 var SelectionAdapter = this.options.get('selectionAdapter');
16052 this.selection = new SelectionAdapter($element, this.options);
16053 this.$selection = this.selection.render();
16054
16055 this.selection.position(this.$selection, $container);
16056
16057 var DropdownAdapter = this.options.get('dropdownAdapter');
16058 this.dropdown = new DropdownAdapter($element, this.options);
16059 this.$dropdown = this.dropdown.render();
16060
16061 this.dropdown.position(this.$dropdown, $container);
16062
16063 var ResultsAdapter = this.options.get('resultsAdapter');
16064 this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
16065 this.$results = this.results.render();
16066
16067 this.results.position(this.$results, this.$dropdown);
16068
16069 // Bind events
16070
16071 var self = this;
16072
16073 // Bind the container to all of the adapters
16074 this._bindAdapters();
16075
16076 // Register any DOM event handlers
16077 this._registerDomEvents();
16078
16079 // Register any internal event handlers
16080 this._registerDataEvents();
16081 this._registerSelectionEvents();
16082 this._registerDropdownEvents();
16083 this._registerResultsEvents();
16084 this._registerEvents();
16085
16086 // Set the initial state
16087 this.dataAdapter.current(function (initialData) {
16088 self.trigger('selection:update', {
16089 data: initialData
16090 });
16091 });
16092
16093 // Hide the original select
16094 $element.addClass('select2-hidden-accessible');
16095 $element.attr('aria-hidden', 'true');
16096
16097 // Synchronize any monitored attributes
16098 this._syncAttributes();
16099
16100 Utils.StoreData($element[0], 'select2', this);
16101
16102 // Ensure backwards compatibility with $element.data('select2').
16103 $element.data('select2', this);
16104 };
16105
16106 Utils.Extend(Select2, Utils.Observable);
16107
16108 Select2.prototype._generateId = function ($element) {
16109 var id = '';
16110
16111 if ($element.attr('id') != null) {
16112 id = $element.attr('id');
16113 } else if ($element.attr('name') != null) {
16114 id = $element.attr('name') + '-' + Utils.generateChars(2);
16115 } else {
16116 id = Utils.generateChars(4);
16117 }
16118
16119 id = id.replace(/(:|\.|\[|\]|,)/g, '');
16120 id = 'select2-' + id;
16121
16122 return id;
16123 };
16124
16125 Select2.prototype._placeContainer = function ($container) {
16126 $container.insertAfter(this.$element);
16127
16128 var width = this._resolveWidth(this.$element, this.options.get('width'));
16129
16130 if (width != null) {
16131 $container.css('width', width);
16132 }
16133 };
16134
16135 Select2.prototype._resolveWidth = function ($element, method) {
16136 var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
16137
16138 if (method == 'resolve') {
16139 var styleWidth = this._resolveWidth($element, 'style');
16140
16141 if (styleWidth != null) {
16142 return styleWidth;
16143 }
16144
16145 return this._resolveWidth($element, 'element');
16146 }
16147
16148 if (method == 'element') {
16149 var elementWidth = $element.outerWidth(false);
16150
16151 if (elementWidth <= 0) {
16152 return 'auto';
16153 }
16154
16155 return elementWidth + 'px';
16156 }
16157
16158 if (method == 'style') {
16159 var style = $element.attr('style');
16160
16161 if (typeof(style) !== 'string') {
16162 return null;
16163 }
16164
16165 var attrs = style.split(';');
16166
16167 for (var i = 0, l = attrs.length; i < l; i = i + 1) {
16168 var attr = attrs[i].replace(/\s/g, '');
16169 var matches = attr.match(WIDTH);
16170
16171 if (matches !== null && matches.length >= 1) {
16172 return matches[1];
16173 }
16174 }
16175
16176 return null;
16177 }
16178
16179 if (method == 'computedstyle') {
16180 var computedStyle = window.getComputedStyle($element[0]);
16181
16182 return computedStyle.width;
16183 }
16184
16185 return method;
16186 };
16187
16188 Select2.prototype._bindAdapters = function () {
16189 this.dataAdapter.bind(this, this.$container);
16190 this.selection.bind(this, this.$container);
16191
16192 this.dropdown.bind(this, this.$container);
16193 this.results.bind(this, this.$container);
16194 };
16195
16196 Select2.prototype._registerDomEvents = function () {
16197 var self = this;
16198
16199 this.$element.on('change.select2', function () {
16200 self.dataAdapter.current(function (data) {
16201 self.trigger('selection:update', {
16202 data: data
16203 });
16204 });
16205 });
16206
16207 this.$element.on('focus.select2', function (evt) {
16208 self.trigger('focus', evt);
16209 });
16210
16211 this._syncA = Utils.bind(this._syncAttributes, this);
16212 this._syncS = Utils.bind(this._syncSubtree, this);
16213
16214 if (this.$element[0].attachEvent) {
16215 this.$element[0].attachEvent('onpropertychange', this._syncA);
16216 }
16217
16218 var observer = window.MutationObserver ||
16219 window.WebKitMutationObserver ||
16220 window.MozMutationObserver
16221 ;
16222
16223 if (observer != null) {
16224 this._observer = new observer(function (mutations) {
16225 $.each(mutations, self._syncA);
16226 $.each(mutations, self._syncS);
16227 });
16228 this._observer.observe(this.$element[0], {
16229 attributes: true,
16230 childList: true,
16231 subtree: false
16232 });
16233 } else if (this.$element[0].addEventListener) {
16234 this.$element[0].addEventListener(
16235 'DOMAttrModified',
16236 self._syncA,
16237 false
16238 );
16239 this.$element[0].addEventListener(
16240 'DOMNodeInserted',
16241 self._syncS,
16242 false
16243 );
16244 this.$element[0].addEventListener(
16245 'DOMNodeRemoved',
16246 self._syncS,
16247 false
16248 );
16249 }
16250 };
16251
16252 Select2.prototype._registerDataEvents = function () {
16253 var self = this;
16254
16255 this.dataAdapter.on('*', function (name, params) {
16256 self.trigger(name, params);
16257 });
16258 };
16259
16260 Select2.prototype._registerSelectionEvents = function () {
16261 var self = this;
16262 var nonRelayEvents = ['toggle', 'focus'];
16263
16264 this.selection.on('toggle', function () {
16265 self.toggleDropdown();
16266 });
16267
16268 this.selection.on('focus', function (params) {
16269 self.focus(params);
16270 });
16271
16272 this.selection.on('*', function (name, params) {
16273 if ($.inArray(name, nonRelayEvents) !== -1) {
16274 return;
16275 }
16276
16277 self.trigger(name, params);
16278 });
16279 };
16280
16281 Select2.prototype._registerDropdownEvents = function () {
16282 var self = this;
16283
16284 this.dropdown.on('*', function (name, params) {
16285 self.trigger(name, params);
16286 });
16287 };
16288
16289 Select2.prototype._registerResultsEvents = function () {
16290 var self = this;
16291
16292 this.results.on('*', function (name, params) {
16293 self.trigger(name, params);
16294 });
16295 };
16296
16297 Select2.prototype._registerEvents = function () {
16298 var self = this;
16299
16300 this.on('open', function () {
16301 self.$container.addClass('select2-container--open');
16302 });
16303
16304 this.on('close', function () {
16305 self.$container.removeClass('select2-container--open');
16306 });
16307
16308 this.on('enable', function () {
16309 self.$container.removeClass('select2-container--disabled');
16310 });
16311
16312 this.on('disable', function () {
16313 self.$container.addClass('select2-container--disabled');
16314 });
16315
16316 this.on('blur', function () {
16317 self.$container.removeClass('select2-container--focus');
16318 });
16319
16320 this.on('query', function (params) {
16321 if (!self.isOpen()) {
16322 self.trigger('open', {});
16323 }
16324
16325 this.dataAdapter.query(params, function (data) {
16326 self.trigger('results:all', {
16327 data: data,
16328 query: params
16329 });
16330 });
16331 });
16332
16333 this.on('query:append', function (params) {
16334 this.dataAdapter.query(params, function (data) {
16335 self.trigger('results:append', {
16336 data: data,
16337 query: params
16338 });
16339 });
16340 });
16341
16342 this.on('keypress', function (evt) {
16343 var key = evt.which;
16344
16345 if (self.isOpen()) {
16346 if (key === KEYS.ESC || key === KEYS.TAB ||
16347 (key === KEYS.UP && evt.altKey)) {
16348 self.close();
16349
16350 evt.preventDefault();
16351 } else if (key === KEYS.ENTER) {
16352 self.trigger('results:select', {});
16353
16354 evt.preventDefault();
16355 } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
16356 self.trigger('results:toggle', {});
16357
16358 evt.preventDefault();
16359 } else if (key === KEYS.UP) {
16360 self.trigger('results:previous', {});
16361
16362 evt.preventDefault();
16363 } else if (key === KEYS.DOWN) {
16364 self.trigger('results:next', {});
16365
16366 evt.preventDefault();
16367 }
16368 } else {
16369 if (key === KEYS.ENTER || key === KEYS.SPACE ||
16370 (key === KEYS.DOWN && evt.altKey)) {
16371 self.open();
16372
16373 evt.preventDefault();
16374 }
16375 }
16376 });
16377 };
16378
16379 Select2.prototype._syncAttributes = function () {
16380 this.options.set('disabled', this.$element.prop('disabled'));
16381
16382 if (this.options.get('disabled')) {
16383 if (this.isOpen()) {
16384 this.close();
16385 }
16386
16387 this.trigger('disable', {});
16388 } else {
16389 this.trigger('enable', {});
16390 }
16391 };
16392
16393 Select2.prototype._syncSubtree = function (evt, mutations) {
16394 var changed = false;
16395 var self = this;
16396
16397 // Ignore any mutation events raised for elements that aren't options or
16398 // optgroups. This handles the case when the select element is destroyed
16399 if (
16400 evt && evt.target && (
16401 evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
16402 )
16403 ) {
16404 return;
16405 }
16406
16407 if (!mutations) {
16408 // If mutation events aren't supported, then we can only assume that the
16409 // change affected the selections
16410 changed = true;
16411 } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
16412 for (var n = 0; n < mutations.addedNodes.length; n++) {
16413 var node = mutations.addedNodes[n];
16414
16415 if (node.selected) {
16416 changed = true;
16417 }
16418 }
16419 } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
16420 changed = true;
16421 }
16422
16423 // Only re-pull the data if we think there is a change
16424 if (changed) {
16425 this.dataAdapter.current(function (currentData) {
16426 self.trigger('selection:update', {
16427 data: currentData
16428 });
16429 });
16430 }
16431 };
16432
16433 /**
16434 * Override the trigger method to automatically trigger pre-events when
16435 * there are events that can be prevented.
16436 */
16437 Select2.prototype.trigger = function (name, args) {
16438 var actualTrigger = Select2.__super__.trigger;
16439 var preTriggerMap = {
16440 'open': 'opening',
16441 'close': 'closing',
16442 'select': 'selecting',
16443 'unselect': 'unselecting',
16444 'clear': 'clearing'
16445 };
16446
16447 if (args === undefined) {
16448 args = {};
16449 }
16450
16451 if (name in preTriggerMap) {
16452 var preTriggerName = preTriggerMap[name];
16453 var preTriggerArgs = {
16454 prevented: false,
16455 name: name,
16456 args: args
16457 };
16458
16459 actualTrigger.call(this, preTriggerName, preTriggerArgs);
16460
16461 if (preTriggerArgs.prevented) {
16462 args.prevented = true;
16463
16464 return;
16465 }
16466 }
16467
16468 actualTrigger.call(this, name, args);
16469 };
16470
16471 Select2.prototype.toggleDropdown = function () {
16472 if (this.options.get('disabled')) {
16473 return;
16474 }
16475
16476 if (this.isOpen()) {
16477 this.close();
16478 } else {
16479 this.open();
16480 }
16481 };
16482
16483 Select2.prototype.open = function () {
16484 if (this.isOpen()) {
16485 return;
16486 }
16487
16488 this.trigger('query', {});
16489 };
16490
16491 Select2.prototype.close = function () {
16492 if (!this.isOpen()) {
16493 return;
16494 }
16495
16496 this.trigger('close', {});
16497 };
16498
16499 Select2.prototype.isOpen = function () {
16500 return this.$container.hasClass('select2-container--open');
16501 };
16502
16503 Select2.prototype.hasFocus = function () {
16504 return this.$container.hasClass('select2-container--focus');
16505 };
16506
16507 Select2.prototype.focus = function (data) {
16508 // No need to re-trigger focus events if we are already focused
16509 if (this.hasFocus()) {
16510 return;
16511 }
16512
16513 this.$container.addClass('select2-container--focus');
16514 this.trigger('focus', {});
16515 };
16516
16517 Select2.prototype.enable = function (args) {
16518 if (this.options.get('debug') && window.console && console.warn) {
16519 console.warn(
16520 'Select2: The `select2("enable")` method has been deprecated and will' +
16521 ' be removed in later Select2 versions. Use $element.prop("disabled")' +
16522 ' instead.'
16523 );
16524 }
16525
16526 if (args == null || args.length === 0) {
16527 args = [true];
16528 }
16529
16530 var disabled = !args[0];
16531
16532 this.$element.prop('disabled', disabled);
16533 };
16534
16535 Select2.prototype.data = function () {
16536 if (this.options.get('debug') &&
16537 arguments.length > 0 && window.console && console.warn) {
16538 console.warn(
16539 'Select2: Data can no longer be set using `select2("data")`. You ' +
16540 'should consider setting the value instead using `$element.val()`.'
16541 );
16542 }
16543
16544 var data = [];
16545
16546 this.dataAdapter.current(function (currentData) {
16547 data = currentData;
16548 });
16549
16550 return data;
16551 };
16552
16553 Select2.prototype.val = function (args) {
16554 if (this.options.get('debug') && window.console && console.warn) {
16555 console.warn(
16556 'Select2: The `select2("val")` method has been deprecated and will be' +
16557 ' removed in later Select2 versions. Use $element.val() instead.'
16558 );
16559 }
16560
16561 if (args == null || args.length === 0) {
16562 return this.$element.val();
16563 }
16564
16565 var newVal = args[0];
16566
16567 if ($.isArray(newVal)) {
16568 newVal = $.map(newVal, function (obj) {
16569 return obj.toString();
16570 });
16571 }
16572
16573 this.$element.val(newVal).trigger('change');
16574 };
16575
16576 Select2.prototype.destroy = function () {
16577 this.$container.remove();
16578
16579 if (this.$element[0].detachEvent) {
16580 this.$element[0].detachEvent('onpropertychange', this._syncA);
16581 }
16582
16583 if (this._observer != null) {
16584 this._observer.disconnect();
16585 this._observer = null;
16586 } else if (this.$element[0].removeEventListener) {
16587 this.$element[0]
16588 .removeEventListener('DOMAttrModified', this._syncA, false);
16589 this.$element[0]
16590 .removeEventListener('DOMNodeInserted', this._syncS, false);
16591 this.$element[0]
16592 .removeEventListener('DOMNodeRemoved', this._syncS, false);
16593 }
16594
16595 this._syncA = null;
16596 this._syncS = null;
16597
16598 this.$element.off('.select2');
16599 this.$element.attr('tabindex',
16600 Utils.GetData(this.$element[0], 'old-tabindex'));
16601
16602 this.$element.removeClass('select2-hidden-accessible');
16603 this.$element.attr('aria-hidden', 'false');
16604 Utils.RemoveData(this.$element[0]);
16605 this.$element.removeData('select2');
16606
16607 this.dataAdapter.destroy();
16608 this.selection.destroy();
16609 this.dropdown.destroy();
16610 this.results.destroy();
16611
16612 this.dataAdapter = null;
16613 this.selection = null;
16614 this.dropdown = null;
16615 this.results = null;
16616 };
16617
16618 Select2.prototype.render = function () {
16619 var $container = $(
16620 '<span class="select2 select2-container">' +
16621 '<span class="selection"></span>' +
16622 '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
16623 '</span>'
16624 );
16625
16626 $container.attr('dir', this.options.get('dir'));
16627
16628 this.$container = $container;
16629
16630 this.$container.addClass('select2-container--' + this.options.get('theme'));
16631
16632 Utils.StoreData($container[0], 'element', this.$element);
16633
16634 return $container;
16635 };
16636
16637 return Select2;
16638});
16639
16640S2.define('jquery-mousewheel',[
16641 'jquery'
16642], function ($) {
16643 // Used to shim jQuery.mousewheel for non-full builds.
16644 return $;
16645});
16646
16647S2.define('jquery.select2',[
16648 'jquery',
16649 'jquery-mousewheel',
16650
16651 './select2/core',
16652 './select2/defaults',
16653 './select2/utils'
16654], function ($, _, Select2, Defaults, Utils) {
16655 if ($.fn.select2 == null) {
16656 // All methods that should return the element
16657 var thisMethods = ['open', 'close', 'destroy'];
16658
16659 $.fn.select2 = function (options) {
16660 options = options || {};
16661
16662 if (typeof options === 'object') {
16663 this.each(function () {
16664 var instanceOptions = $.extend(true, {}, options);
16665
16666 var instance = new Select2($(this), instanceOptions);
16667 });
16668
16669 return this;
16670 } else if (typeof options === 'string') {
16671 var ret;
16672 var args = Array.prototype.slice.call(arguments, 1);
16673
16674 this.each(function () {
16675 var instance = Utils.GetData(this, 'select2');
16676
16677 if (instance == null && window.console && console.error) {
16678 console.error(
16679 'The select2(\'' + options + '\') method was called on an ' +
16680 'element that is not using Select2.'
16681 );
16682 }
16683
16684 ret = instance[options].apply(instance, args);
16685 });
16686
16687 // Check if we should be returning `this`
16688 if ($.inArray(options, thisMethods) > -1) {
16689 return this;
16690 }
16691
16692 return ret;
16693 } else {
16694 throw new Error('Invalid arguments for Select2: ' + options);
16695 }
16696 };
16697 }
16698
16699 if ($.fn.select2.defaults == null) {
16700 $.fn.select2.defaults = Defaults;
16701 }
16702
16703 return Select2;
16704});
16705
16706 // Return the AMD loader configuration so it can be used outside of this file
16707 return {
16708 define: S2.define,
16709 require: S2.require
16710 };
16711}());
16712
16713 // Autoload the jQuery bindings
16714 // We know that all of the modules exist above this, so we're safe
16715 var select2 = S2.require('jquery.select2');
16716
16717 // Hold the AMD module references on the jQuery function that was just loaded
16718 // This allows Select2 to use the internal loader outside of this file, such
16719 // as in the language files.
16720 jQuery.fn.select2.amd = S2;
16721
16722 // Return the Select2 instance for anyone who is importing it.
16723 return select2;
16724}));
16725
16726
16727/***/ }),
16728
16729/***/ "./resources/js/forms.js":
16730/*!*******************************!*\
16731 !*** ./resources/js/forms.js ***!
16732 \*******************************/
16733/*! no static exports found */
16734/***/ (function(module, exports, __webpack_require__) {
16735
16736__webpack_require__(/*! select2 */ "./node_modules/select2/dist/js/select2.js");
16737
16738/***/ }),
16739
16740/***/ 1:
16741/*!*************************************!*\
16742 !*** multi ./resources/js/forms.js ***!
16743 \*************************************/
16744/*! no static exports found */
16745/***/ (function(module, exports, __webpack_require__) {
16746
16747module.exports = __webpack_require__(/*! /var/www/MoneyGuard-Project/resources/js/forms.js */"./resources/js/forms.js");
16748
16749
16750/***/ })
16751
16752/******/ });