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