You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10253 lines
262 KiB

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